Fix linting errors
This commit is contained in:
@@ -1,27 +1,12 @@
|
|||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { and, notEmpty } from '@ember/object/computed';
|
import { and, notEmpty } from '@ember/object/computed';
|
||||||
import { inject as injectService } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
kredits: injectService(),
|
kredits: service(),
|
||||||
|
|
||||||
// Default attributes used by reset
|
attributes: null,
|
||||||
attributes: {
|
|
||||||
account: null,
|
|
||||||
name: null,
|
|
||||||
kind: 'person',
|
|
||||||
url: null,
|
|
||||||
github_username: null,
|
|
||||||
github_uid: null,
|
|
||||||
wiki_username: null,
|
|
||||||
isCore: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
didInsertElement() {
|
|
||||||
this._super(...arguments);
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
|
|
||||||
// TODO: add proper address validation
|
// TODO: add proper address validation
|
||||||
isValidAccount: notEmpty('account'),
|
isValidAccount: notEmpty('account'),
|
||||||
@@ -36,6 +21,27 @@ export default Component.extend({
|
|||||||
'isValidGithubUID'
|
'isValidGithubUID'
|
||||||
),
|
),
|
||||||
|
|
||||||
|
init () {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
|
// Default attributes used by reset
|
||||||
|
this.set('attributes', {
|
||||||
|
account: null,
|
||||||
|
name: null,
|
||||||
|
kind: 'person',
|
||||||
|
url: null,
|
||||||
|
github_username: null,
|
||||||
|
github_uid: null,
|
||||||
|
wiki_username: null,
|
||||||
|
isCore: false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.setProperties(this.attributes);
|
this.setProperties(this.attributes);
|
||||||
},
|
},
|
||||||
@@ -61,4 +67,5 @@ export default Component.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,21 +3,9 @@ import { computed } from '@ember/object';
|
|||||||
import { and, notEmpty } from '@ember/object/computed';
|
import { and, notEmpty } from '@ember/object/computed';
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
// Default attributes used by reset
|
|
||||||
attributes: {
|
|
||||||
contributorId: null,
|
|
||||||
kind: 'community',
|
|
||||||
amount: null,
|
|
||||||
description: null,
|
|
||||||
url: null,
|
|
||||||
},
|
|
||||||
|
|
||||||
didInsertElement() {
|
attributes: null,
|
||||||
this._super(...arguments);
|
contributors: null,
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
|
|
||||||
contributors: [],
|
|
||||||
|
|
||||||
isValidContributor: notEmpty('contributorId'),
|
isValidContributor: notEmpty('contributorId'),
|
||||||
isValidAmount: computed('amount', function() {
|
isValidAmount: computed('amount', function() {
|
||||||
@@ -29,6 +17,26 @@ export default Component.extend({
|
|||||||
'isValidAmount',
|
'isValidAmount',
|
||||||
'isValidDescription'),
|
'isValidDescription'),
|
||||||
|
|
||||||
|
init () {
|
||||||
|
this._super(...arguments);
|
||||||
|
|
||||||
|
// Default attributes used by reset
|
||||||
|
this.set('attributes', {
|
||||||
|
contributorId: null,
|
||||||
|
kind: 'community',
|
||||||
|
amount: null,
|
||||||
|
description: null,
|
||||||
|
url: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.set('contributors', []);
|
||||||
|
},
|
||||||
|
|
||||||
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.setProperties(this.attributes);
|
this.setProperties(this.attributes);
|
||||||
},
|
},
|
||||||
@@ -54,4 +62,5 @@ export default Component.extend({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ let categoryColors = {
|
|||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
|
|
||||||
contributions: null,
|
contributions: null,
|
||||||
|
chartOptions: Object.freeze({
|
||||||
|
legend: {
|
||||||
|
display: false
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
chartData: computed('contributions', function() {
|
chartData: computed('contributions', function() {
|
||||||
let kredits = this.contributions
|
let kredits = this.contributions
|
||||||
@@ -52,12 +57,6 @@ export default Component.extend({
|
|||||||
'Documentation'
|
'Documentation'
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
}),
|
})
|
||||||
|
|
||||||
chartOptions: {
|
|
||||||
legend: {
|
|
||||||
display: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
import { inject as injectService } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
kredits: injectService(),
|
kredits: service(),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
import { alias, filter, filterBy, sort } from '@ember/object/computed';
|
import { alias, filter, filterBy, sort } from '@ember/object/computed';
|
||||||
import { inject as injectService } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
kredits: injectService(),
|
kredits: service(),
|
||||||
|
|
||||||
contributors: alias('kredits.contributors'),
|
contributors: alias('kredits.contributors'),
|
||||||
contributorsWithKredits: filter('contributors', function(contributor) {
|
contributorsWithKredits: filter('contributors', function(contributor) {
|
||||||
return contributor.get('balance') !== 0;
|
return contributor.get('balance') !== 0;
|
||||||
}),
|
}),
|
||||||
contributorsSorting: ['balance:desc'],
|
contributorsSorting: Object.freeze(['balance:desc']),
|
||||||
contributorsSorted: sort('contributorsWithKredits', 'contributorsSorting'),
|
contributorsSorted: sort('contributorsWithKredits', 'contributorsSorting'),
|
||||||
|
|
||||||
proposals: alias('kredits.proposals'),
|
proposals: alias('kredits.proposals'),
|
||||||
proposalsOpen: filterBy('proposals', 'isExecuted', false),
|
proposalsOpen: filterBy('proposals', 'isExecuted', false),
|
||||||
proposalsClosed: filterBy('proposals', 'isExecuted', true),
|
proposalsClosed: filterBy('proposals', 'isExecuted', true),
|
||||||
proposalsSorting: ['id:desc'],
|
proposalsSorting: Object.freeze(['id:desc']),
|
||||||
proposalsClosedSorted: sort('proposalsClosed', 'proposalsSorting'),
|
proposalsClosedSorted: sort('proposalsClosed', 'proposalsSorting'),
|
||||||
proposalsOpenSorted: sort('proposalsOpen', 'proposalsSorting'),
|
proposalsOpenSorted: sort('proposalsOpen', 'proposalsSorting'),
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
import { alias, filterBy } from '@ember/object/computed';
|
import { alias, filterBy } from '@ember/object/computed';
|
||||||
import { inject as injectService } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
kredits: injectService(),
|
kredits: service(),
|
||||||
|
|
||||||
contributors: alias('kredits.contributors'),
|
contributors: alias('kredits.contributors'),
|
||||||
minedContributors: filterBy('contributors', 'id'),
|
minedContributors: filterBy('contributors', 'id'),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { alias } from '@ember/object/computed';
|
|||||||
import bignumber from 'kredits-web/utils/cps/bignumber';
|
import bignumber from 'kredits-web/utils/cps/bignumber';
|
||||||
|
|
||||||
export default EmberObject.extend({
|
export default EmberObject.extend({
|
||||||
|
|
||||||
// Contract
|
// Contract
|
||||||
id: bignumber('idRaw', 'toString'),
|
id: bignumber('idRaw', 'toString'),
|
||||||
creatorAccount: null,
|
creatorAccount: null,
|
||||||
@@ -19,7 +20,13 @@ export default EmberObject.extend({
|
|||||||
// IPFS
|
// IPFS
|
||||||
kind: null,
|
kind: null,
|
||||||
description: null,
|
description: null,
|
||||||
details: {},
|
details: null,
|
||||||
url: null,
|
url: null,
|
||||||
ipfsData: '',
|
ipfsData: '',
|
||||||
|
|
||||||
|
init () {
|
||||||
|
this._super(...arguments);
|
||||||
|
this.set('details', {});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { inject as injectService } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
export default Route.extend({
|
export default Route.extend({
|
||||||
kredits: injectService(),
|
kredits: service(),
|
||||||
|
|
||||||
beforeModel(transition) {
|
beforeModel(transition) {
|
||||||
const kredits = this.kredits;
|
const kredits = this.kredits;
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ export default Service.extend({
|
|||||||
|
|
||||||
currentUserAccounts: null, // default to not having an account. this is the wen web3 is loaded.
|
currentUserAccounts: null, // default to not having an account. this is the wen web3 is loaded.
|
||||||
currentUser: null,
|
currentUser: null,
|
||||||
|
contributors: null,
|
||||||
|
proposals: null,
|
||||||
currentUserIsContributor: notEmpty('currentUser'),
|
currentUserIsContributor: notEmpty('currentUser'),
|
||||||
currentUserIsCore: alias('currentUser.isCore'),
|
currentUserIsCore: alias('currentUser.isCore'),
|
||||||
hasAccounts: notEmpty('currentUserAccounts'),
|
hasAccounts: notEmpty('currentUserAccounts'),
|
||||||
@@ -23,6 +25,12 @@ export default Service.extend({
|
|||||||
return this.currentUserAccounts && isEmpty(this.currentUserAccounts);
|
return this.currentUserAccounts && isEmpty(this.currentUserAccounts);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
init () {
|
||||||
|
this._super(...arguments);
|
||||||
|
this.set('contributors', []);
|
||||||
|
this.set('proposals', []);
|
||||||
|
},
|
||||||
|
|
||||||
// this is called in the routes beforeModel(). So it is initialized before everything else
|
// this is called in the routes beforeModel(). So it is initialized before everything else
|
||||||
// and we can rely on the ethProvider and the potential currentUserAccounts to be available
|
// and we can rely on the ethProvider and the potential currentUserAccounts to be available
|
||||||
getEthProvider: function() {
|
getEthProvider: function() {
|
||||||
@@ -84,9 +92,6 @@ export default Service.extend({
|
|||||||
return this.kredits.Token.functions.totalSupply();
|
return this.kredits.Token.functions.totalSupply();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
contributors: [],
|
|
||||||
proposals: [],
|
|
||||||
|
|
||||||
loadContributorsAndProposals() {
|
loadContributorsAndProposals() {
|
||||||
return this.getContributors()
|
return this.getContributors()
|
||||||
.then(contributors => this.contributors.pushObjects(contributors))
|
.then(contributors => this.contributors.pushObjects(contributors))
|
||||||
|
|||||||
Reference in New Issue
Block a user