Merge pull request #89 from 67P/feature/84-update_ember_3_8

Update Ember to version 3.8.0
This commit was merged in pull request #89.
This commit is contained in:
2019-03-29 13:03:55 +01:00
committed by GitHub
30 changed files with 7593 additions and 2198 deletions
+20
View File
@@ -0,0 +1,20 @@
# unconventional js
/blueprints/*/files/
/vendor/
# compiled output
/dist/
/tmp/
# dependencies
/bower_components/
/node_modules/
# misc
/coverage/
!.*
# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
+5 -1
View File
@@ -25,10 +25,14 @@ module.exports = {
// node files
{
files: [
'.eslintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js'
'lib/*/index.js',
'server/**/*.js'
],
parserOptions: {
sourceType: 'script',
+13 -11
View File
@@ -1,24 +1,26 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/dist/
/tmp/
# dependencies
/node_modules
/bower_components
/bower_components/
/node_modules/
# misc
/.env*
/.pnp*
/.sass-cache
/connect.lock
/coverage/*
/coverage/
/libpeerconnection.log
npm-debug.log*
yarn-error.log
testem.log
/npm-debug.log*
/testem.log
/yarn-error.log
.tm_properties
# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
+5
View File
@@ -0,0 +1,5 @@
'use strict';
module.exports = {
extends: 'recommended'
};
+1
View File
@@ -22,5 +22,6 @@ before_install:
- npm config set spin false
script:
- npm run lint:hbs
- npm run lint:js
- npm test
+1
View File
@@ -40,6 +40,7 @@ Make use of the many generators for code, try `ember help generate` for more det
### Linting
* `npm run lint:hbs`
* `npm run lint:js`
* `npm run lint:js -- --fix`
+25 -18
View File
@@ -1,27 +1,12 @@
import Component from '@ember/component';
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({
kredits: injectService(),
kredits: service(),
// Default attributes used by reset
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();
},
attributes: null,
// TODO: add proper address validation
isValidAccount: notEmpty('account'),
@@ -36,6 +21,27 @@ export default Component.extend({
'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() {
this.setProperties(this.attributes);
},
@@ -61,4 +67,5 @@ export default Component.extend({
});
}
}
});
+7 -7
View File
@@ -13,7 +13,7 @@
type="text"
placeholder="0xF18E631Ea191aE4ebE70046Fcb01a436554421BA4"
value=account
class=(if isValidAccount 'valid' '')}}
class=(if isValidAccount "valid" "")}}
</p>
<p>
<select required onchange={{action (mut kind) value="target.value"}}>
@@ -26,39 +26,39 @@
type="text"
placeholder="Name"
value=name
class=(if isValidName 'valid' '')}}
class=(if isValidName "valid" "")}}
</p>
<p>
{{input name="url"
type="text"
placeholder="URL"
value=url
class=(if isValidURL 'valid' '')}}
class=(if isValidURL "valid" "")}}
</p>
<p>
{{input name="github_uid"
type="text"
placeholder="GitHub UID (123)"
value=github_uid
class=(if isValidGithubUID 'valid' '')}}
class=(if isValidGithubUID "valid" "")}}
</p>
<p>
{{input name="github_username"
type="text"
placeholder="GitHub username"
value=github_username
class=(if isValidGithubUsername 'valid' '')}}
class=(if isValidGithubUsername "valid" "")}}
</p>
<p>
{{input name="wiki_username"
type="text"
placeholder="Wiki Username"
value=wiki_username
class=(if isValidWikiUsername 'valid' '')}}
class=(if isValidWikiUsername "valid" "")}}
</p>
<p class="actions">
{{input type="submit"
disabled=(is-pending inProgress)
value=(if (is-pending inProgress) 'Processing' 'Save')}}
value=(if (is-pending inProgress) "Processing" "Save")}}
</p>
</form>
+23 -14
View File
@@ -3,21 +3,9 @@ import { computed } from '@ember/object';
import { and, notEmpty } from '@ember/object/computed';
export default Component.extend({
// Default attributes used by reset
attributes: {
contributorId: null,
kind: 'community',
amount: null,
description: null,
url: null,
},
didInsertElement() {
this._super(...arguments);
this.reset();
},
contributors: [],
attributes: null,
contributors: null,
isValidContributor: notEmpty('contributorId'),
isValidAmount: computed('amount', function() {
@@ -29,6 +17,26 @@ export default Component.extend({
'isValidAmount',
'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() {
this.setProperties(this.attributes);
},
@@ -54,4 +62,5 @@ export default Component.extend({
});
}
}
});
+5 -5
View File
@@ -20,25 +20,25 @@
{{input type="text"
placeholder="100"
value=amount
class=(if isValidAmount 'valid' '')}}
class=(if isValidAmount "valid" "")}}
</p>
<p>
{{input type="text"
placeholder="Description"
value=description
class=(if isValidDescription 'valid' '')}}
class=(if isValidDescription "valid" "")}}
</p>
<p>
{{input type="text"
placeholder="URL (optional)"
value=url
class=(if isValidUrl 'valid' '')}}
class=(if isValidUrl "valid" "")}}
</p>
<p class="actions">
{{input type="submit"
disabled=(is-pending inProgress)
value=(if (is-pending inProgress) 'Processing' 'Save')}}
{{#link-to 'index'}}Back{{/link-to}}
value=(if (is-pending inProgress) "Processing" "Save")}}
{{#link-to "index"}}Back{{/link-to}}
</p>
</form>
@@ -12,9 +12,14 @@ let categoryColors = {
export default Component.extend({
contributions: null,
chartOptions: Object.freeze({
legend: {
display: false
}
}),
chartData: computed('contributions', function() {
let kredits = this.get('contributions')
let kredits = this.contributions
.map(c => {
return { kind: c.kind, amount: c.amount }
}).reduce(function (kinds, c) {
@@ -52,12 +57,6 @@ export default Component.extend({
'Documentation'
],
}
}),
chartOptions: {
legend: {
display: false
}
}
})
});
@@ -1,5 +1,5 @@
<div class="chart">
{{ember-chart type='doughnut'
{{ember-chart type="doughnut"
data=chartData
options=chartOptions
width=200
+3 -3
View File
@@ -1,8 +1,8 @@
<tbody>
{{#each contributors as |contributor|}}
<tr class="{{if contributor.isCurrentUser 'current-user'}}" {{action "toggleContributorInfo" contributor}}>
<tr role="button" class={{if contributor.isCurrentUser "current-user"}} {{action "toggleContributorInfo" contributor}}>
<td class="person">
<img class="avatar" src={{contributor.avatarURL}}>
<img class="avatar" src={{contributor.avatarURL}} alt="">
{{contributor.name}}
</td>
<td class="kredits">
@@ -10,7 +10,7 @@
<span class="symbol">₭S</span>
</td>
</tr>
<tr class="metadata {{if contributor.isCurrentUser 'current-user'}} {{if contributor.showMetadata 'visible'}}">
<tr class="metadata {{if contributor.isCurrentUser "current-user"}} {{if contributor.showMetadata "visible"}}">
<td colspan="2">
<ul>
<li><a href="https://testnet.etherscan.io/address/{{contributor.account}}">Inspect Ethereum transactions</a></li>
+2 -2
View File
@@ -1,6 +1,6 @@
import Controller from '@ember/controller';
import { inject as injectService } from '@ember/service';
import { inject as service } from '@ember/service';
export default Controller.extend({
kredits: injectService(),
kredits: service(),
});
+4 -4
View File
@@ -1,21 +1,21 @@
import Controller from '@ember/controller';
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({
kredits: injectService(),
kredits: service(),
contributors: alias('kredits.contributors'),
contributorsWithKredits: filter('contributors', function(contributor) {
return contributor.get('balance') !== 0;
}),
contributorsSorting: ['balance:desc'],
contributorsSorting: Object.freeze(['balance:desc']),
contributorsSorted: sort('contributorsWithKredits', 'contributorsSorting'),
proposals: alias('kredits.proposals'),
proposalsOpen: filterBy('proposals', 'isExecuted', false),
proposalsClosed: filterBy('proposals', 'isExecuted', true),
proposalsSorting: ['id:desc'],
proposalsSorting: Object.freeze(['id:desc']),
proposalsClosedSorted: sort('proposalsClosed', 'proposalsSorting'),
proposalsOpenSorted: sort('proposalsOpen', 'proposalsSorting'),
+2 -2
View File
@@ -1,9 +1,9 @@
import Controller from '@ember/controller';
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({
kredits: injectService(),
kredits: service(),
contributors: alias('kredits.contributors'),
minedContributors: filterBy('contributors', 'id'),
+8 -1
View File
@@ -3,6 +3,7 @@ import { alias } from '@ember/object/computed';
import bignumber from 'kredits-web/utils/cps/bignumber';
export default EmberObject.extend({
// Contract
id: bignumber('idRaw', 'toString'),
creatorAccount: null,
@@ -19,7 +20,13 @@ export default EmberObject.extend({
// IPFS
kind: null,
description: null,
details: {},
details: null,
url: null,
ipfsData: '',
init () {
this._super(...arguments);
this.set('details', {});
}
});
+2 -2
View File
@@ -1,8 +1,8 @@
import { inject as injectService } from '@ember/service';
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
export default Route.extend({
kredits: injectService(),
kredits: service(),
beforeModel(transition) {
const kredits = this.kredits;
+8 -3
View File
@@ -16,6 +16,8 @@ export default Service.extend({
currentUserAccounts: null, // default to not having an account. this is the wen web3 is loaded.
currentUser: null,
contributors: null,
proposals: null,
currentUserIsContributor: notEmpty('currentUser'),
currentUserIsCore: alias('currentUser.isCore'),
hasAccounts: notEmpty('currentUserAccounts'),
@@ -23,6 +25,12 @@ export default Service.extend({
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
// and we can rely on the ethProvider and the potential currentUserAccounts to be available
getEthProvider: function() {
@@ -84,9 +92,6 @@ export default Service.extend({
return this.kredits.Token.functions.totalSupply();
}),
contributors: [],
proposals: [],
loadContributorsAndProposals() {
return this.getContributors()
.then(contributors => this.contributors.pushObjects(contributors))
+2 -2
View File
@@ -52,7 +52,7 @@
{{!-- TODO: We need a better naming --}}
{{#if kredits.hasAccounts}}
<p class="actions">
{{#link-to 'proposals.new'}}Create new proposal{{/link-to}}
{{#link-to "proposals.new"}}Create new proposal{{/link-to}}
</p>
{{/if}}
</section>
@@ -66,7 +66,7 @@
<div class="content">
{{#if kredits.currentUser.isCore}}
{{add-contributor contributors=contributors save=(action 'save')}}
{{add-contributor contributors=contributors save=(action "save")}}
{{else}}
Only core team members can add new contributors. Please ask someone to set you up.
{{/if}}
+1 -1
View File
@@ -4,7 +4,7 @@
</header>
<div class="content">
{{add-proposal contributors=minedContributors save=(action 'save')}}
{{add-proposal contributors=minedContributors save=(action "save")}}
</div>
</section>
+3
View File
@@ -0,0 +1,3 @@
{
"jquery-integration": true
}
+7403 -2077
View File
File diff suppressed because it is too large Load Diff
+27 -22
View File
@@ -3,61 +3,66 @@
"version": "1.0.0",
"private": true,
"description": "Contribution dashboard of the Kosmos project",
"repository": "https://github.com/67P/kredits-web",
"license": "MIT",
"author": "Kosmos Contributors <mail@kosmos.org>",
"directories": {
"doc": "doc",
"test": "tests"
},
"repository": "https://github.com/67P/kredits-web",
"scripts": {
"lint:js": "eslint ./*.js app config lib server tests",
"lint:hbs": "ember-template-lint .",
"lint:js": "eslint .",
"start": "ember serve",
"start:local": "NETWORK_ID=100 WEB3_PROVIDER_URL=http://localhost:7545 ember s",
"test": "ember test",
"start:local": "NETWORK_ID=100 WEB3_PROVIDER_URL=http://localhost:7545 ember s",
"build": "ember build",
"build-prod": "ember build --environment production",
"update-version-file": "bash scripts/update-version-file.sh",
"deploy": "npm run build-prod && npm run update-version-file && bash scripts/deploy.sh"
},
"devDependencies": {
"@ember/jquery": "^0.5.2",
"@ember/optional-features": "^0.6.3",
"babel-preset-es2015": "^6.22.0",
"babelify": "^7.3.0",
"broccoli-asset-rev": "^2.4.5",
"ember-ajax": "^3.0.0",
"broccoli-asset-rev": "^2.7.0",
"ember-ajax": "^4.0.1",
"ember-awesome-macros": "0.41.0",
"ember-browserify": "^1.1.13",
"ember-cli": "~3.1.2",
"ember-cli-app-version": "^3.0.0",
"ember-cli-babel": "^6.6.0",
"ember-cli": "~3.8.1",
"ember-cli-app-version": "^3.2.0",
"ember-cli-babel": "^7.1.2",
"ember-cli-chart": "^3.4.0",
"ember-cli-dependency-checker": "^2.0.0",
"ember-cli-eslint": "^4.2.1",
"ember-cli-htmlbars": "^2.0.1",
"ember-cli-htmlbars-inline-precompile": "^1.0.0",
"ember-cli-inject-live-reload": "^1.4.1",
"ember-cli-qunit": "^4.1.1",
"ember-cli-dependency-checker": "^3.1.0",
"ember-cli-eslint": "^4.2.3",
"ember-cli-htmlbars": "^3.0.0",
"ember-cli-htmlbars-inline-precompile": "^1.0.3",
"ember-cli-inject-live-reload": "^1.8.2",
"ember-cli-sass": "^7.2.0",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^2.0.0",
"ember-cli-sri": "^2.1.1",
"ember-cli-template-lint": "^1.0.0-beta.1",
"ember-cli-uglify": "^2.1.0",
"ember-cli-update": "^0.21.2",
"ember-export-application-global": "^2.0.0",
"ember-load-initializers": "^1.0.0",
"ember-load-initializers": "^1.1.0",
"ember-macro-helpers": "0.17.0",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-promise-helpers": "1.0.6",
"ember-resolver": "^4.0.0",
"ember-source": "~3.1.0",
"ember-qunit": "^3.4.1",
"ember-resolver": "^5.0.1",
"ember-source": "~3.8.0",
"ember-truth-helpers": "github:jmurphyau/ember-truth-helpers#31a14373a31f1f82c77537720549b47a95c28e5f",
"eslint-plugin-ember": "^5.0.0",
"eslint-plugin-ember": "^5.2.0",
"ethers": "3.0.15",
"kosmos-schemas": "^1.1.2",
"kredits-contracts": "^3.x",
"loader.js": "^4.2.3",
"loader.js": "^4.7.0",
"qunit-dom": "^0.8.0",
"tv4": "^1.3.0"
},
"engines": {
"node": "^4.5 || 6.* || >= 7.*"
"node": "6.* || 8.* || >= 10.*"
},
"contributors": [
"Garret Alfert <alfert@wevelop.de>",
+6 -5
View File
@@ -9,13 +9,14 @@ module.exports = {
],
browser_args: {
Chrome: {
mode: 'ci',
args: [
ci: [
// --no-sandbox is needed when running Chrome inside a container
process.env.TRAVIS ? '--no-sandbox' : null,
'--disable-gpu',
process.env.CI ? '--no-sandbox' : null,
'--headless',
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-software-rasterizer',
'--mute-audio',
'--remote-debugging-port=0',
'--window-size=1440,900'
].filter(Boolean)
@@ -1,6 +1,6 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | add proposal', function(hooks) {
@@ -13,6 +13,6 @@ module('Integration | Component | add proposal', function(hooks) {
await render(hbs`{{add-proposal}}`);
assert.equal(find('.actions a').textContent.trim(), 'Back');
assert.dom('.actions a').hasText('Back');
});
});
@@ -24,6 +24,6 @@ module('Integration | Component | chart-contributions-by-type', function(hooks)
await render(hbs`{{chart-contributions-by-type contributions=proposals}}`);
assert.equal(this.element.textContent.trim(), '');
assert.dom(this.element).hasText('');
});
});
@@ -1,6 +1,6 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | contributor list', function(hooks) {
@@ -13,6 +13,6 @@ module('Integration | Component | contributor list', function(hooks) {
await render(hbs`{{contributor-list}}`);
assert.equal(find('*').textContent.trim(), '');
assert.dom('*').hasText('');
});
});
@@ -1,6 +1,6 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | loading spinner', function(hooks) {
@@ -13,6 +13,6 @@ module('Integration | Component | loading spinner', function(hooks) {
await render(hbs`{{loading-spinner}}`);
assert.equal(find('*').textContent.trim(), 'Loading data from Ethereum...');
assert.dom('*').hasText('Loading data from Ethereum...');
});
});
@@ -1,6 +1,6 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | proposal list', function(hooks) {
@@ -13,6 +13,6 @@ module('Integration | Component | proposal list', function(hooks) {
await render(hbs`{{proposal-list}}`);
assert.equal(find('*').textContent.trim(), '');
assert.dom('*').hasText('');
});
});