Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Ember 2.18 β†’ 3.4 Take two #5544

Merged
merged 46 commits into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
afa3529
Fix deprecations
DingoEatingFuzz Mar 12, 2019
71bcfaa
Upgrade to Ember 3.0
DingoEatingFuzz Mar 12, 2019
b70b042
Fix eslint error and add lint script to package.json
DingoEatingFuzz Mar 12, 2019
a0e8eef
Modules codemod + prettier
DingoEatingFuzz Mar 13, 2019
90278bf
Ember QUnit Codemod
DingoEatingFuzz Mar 13, 2019
0a6e84e
Ember test-helpers codemod
DingoEatingFuzz Mar 13, 2019
9cc9fa8
Fix a bunch of snowflake situations the codemod missed
DingoEatingFuzz Mar 13, 2019
06e7338
Use mirage test hooks
DingoEatingFuzz Mar 13, 2019
57e84b1
Critical peer dependency upgrades
DingoEatingFuzz Mar 14, 2019
43a9b6d
Update environment to 3.0 conventions
DingoEatingFuzz Mar 14, 2019
2d6aaaa
Update test-helper to new testing style
DingoEatingFuzz Mar 14, 2019
31dc139
Update adapter tests to use module instead of custom code
DingoEatingFuzz Mar 14, 2019
a35fd98
Update serializer unit tests to use module instead of custom code
DingoEatingFuzz Mar 14, 2019
205797d
Upgrade ember-power-select
DingoEatingFuzz Mar 14, 2019
acddf2b
Update the test index.html file
DingoEatingFuzz Mar 14, 2019
f3acad3
Fix scoping issue with the jobs list page object
DingoEatingFuzz Mar 14, 2019
f959aa8
Adapt the codemirror helper for the hooks model
DingoEatingFuzz Mar 14, 2019
a4ef453
Fix page object issues with acceptance tests that couldn't be codemodded
DingoEatingFuzz Mar 14, 2019
bebc9b8
Fix integration tests that had test failures
DingoEatingFuzz Mar 14, 2019
1e669bb
Fix bug in the stats-tracker-frame-mising behavior
DingoEatingFuzz Mar 14, 2019
2474eca
Remove all andThen and .then usages (except for integration tests)
DingoEatingFuzz Mar 14, 2019
2fce7c7
Upgrade to Ember 3.4
DingoEatingFuzz Mar 15, 2019
c408a21
Update ember-data-model-fragments
DingoEatingFuzz Mar 15, 2019
467a7b3
Upgrade miscellaneous packages
DingoEatingFuzz Mar 16, 2019
67372fc
Override default template lintrc (borrowed this one from vault)
DingoEatingFuzz Mar 16, 2019
30bcacf
Address template linting issues
DingoEatingFuzz Mar 25, 2019
cf44c54
Address test failures
DingoEatingFuzz Mar 25, 2019
7e6a4f7
Address inflector deprecations
DingoEatingFuzz Mar 26, 2019
6d63a42
Commit the deprecation workflow to prevent fixed deprecations from cr…
DingoEatingFuzz Mar 26, 2019
23729ad
Address the copy/copyable deprecation
DingoEatingFuzz Mar 26, 2019
e74873f
Address the Ember.Logger deprecations
DingoEatingFuzz Mar 26, 2019
d589620
Kind of address the sendAction deprecation
DingoEatingFuzz Mar 26, 2019
f6232f1
ES5 getters codemod
DingoEatingFuzz Mar 26, 2019
4c9a026
Rethink the adapter job unit tests to avoid notifyPropertyChange
DingoEatingFuzz Mar 26, 2019
542f124
Auto-upgrade packages
DingoEatingFuzz Apr 2, 2019
b0a65bd
Update everything to work with the mirage backwards incompat
DingoEatingFuzz Apr 2, 2019
baf5077
Manually upgrade fringe dependencies
DingoEatingFuzz Apr 2, 2019
a4c5410
Upgrade ember addons
DingoEatingFuzz Apr 2, 2019
56500bd
Upgrade eslint to v5
DingoEatingFuzz Apr 2, 2019
513f882
Upgrade third party packages
DingoEatingFuzz Apr 2, 2019
514e8aa
Major upgrade, ember-cli-sass; swiches to sass-dart
DingoEatingFuzz Apr 2, 2019
3b5f7f6
Upgrade ember-concurrency
DingoEatingFuzz Apr 2, 2019
6cba965
Don't remove viewBox from svgs as part of svgo
DingoEatingFuzz Apr 3, 2019
54e89a5
Upgrade to Node 10, latest LTS
DingoEatingFuzz Apr 8, 2019
bd2b2d7
Upgrade Yarn
DingoEatingFuzz Apr 8, 2019
27ee73a
Force Travis to use node 10
DingoEatingFuzz Apr 9, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ rkt-*
/ui/testem.log
.ignore

# ember-try
/ui/.node_modules.ember-try/
/ui/bower.json.ember-try
/ui/package.json.ember-try

# generated routes file
command/agent/bindata_assetfs.go

Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,14 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]] && [[ -z "$SKIP_NOMAD_TESTS" ]]; then sudo -E bash ./scripts/travis-mac-priv.sh ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ -z "$SKIP_NOMAD_TESTS" ]]; then sudo -E bash ./scripts/travis-linux.sh ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$RUN_STATIC_CHECKS" ]]; then sudo -E bash ./scripts/vagrant-linux-priv-protoc.sh; fi
- if [[ "$RUN_UI_TESTS" ]]; then curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.0.1 ; fi
- if [[ "$RUN_UI_TESTS" ]]; then curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2 ; fi
- if [[ "$RUN_UI_TESTS" ]]; then export PATH="$HOME/.yarn/bin:$PATH" ; fi
- echo "Travis Node Version" && node -v

install:
- if [[ -z "$SKIP_NOMAD_TESTS" ]] || [[ "$RUN_STATIC_CHECKS" ]]; then make deps; fi
- if [[ "$RUN_STATIC_CHECKS" ]]; then make lint-deps ; fi
- if [[ "$RUN_UI_TESTS" ]]; then . $HOME/.nvm/nvm.sh && cd ui && nvm use && cd .. ; fi
- if [[ "$RUN_UI_TESTS" ]]; then . $HOME/.nvm/nvm.sh && cd ui && nvm install && nvm use && cd .. ; fi

script:
- sudo -E "PATH=$PATH" GOTESTSUM_JUNITFILE=/tmp/results.xml make travis
Expand Down
6 changes: 3 additions & 3 deletions scripts/vagrant-linux-unpriv-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export NVM_DIR="/home/vagrant/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

# Install Node, Ember CLI, and Phantom for UI development
nvm install 8.11.2
nvm alias default 8.11.2
nvm install 10
nvm alias default 10
npm install -g ember-cli

# Install Yarn for front-end dependency management
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.7.0
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.15.2

# Install Chrome for running tests (in headless mode)
wget -qO- - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
Expand Down
21 changes: 21 additions & 0 deletions ui/.eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
mirage/

# 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
27 changes: 23 additions & 4 deletions ui/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ module.exports = {
},
extends: 'eslint:recommended',
parserOptions: {
ecmaVersion: 2017,
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
experimentalObjectRestSpread: true,
},
},
rules: {
indent: ['error', 2, { SwitchCase: 1 }],
Expand All @@ -26,4 +23,26 @@ module.exports = {
},
],
},
overrides: [
// node files
{
files: [
'.eslintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js',
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015,
},
env: {
browser: false,
node: true,
},
},
],
};
2 changes: 1 addition & 1 deletion ui/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8
10
40 changes: 40 additions & 0 deletions ui/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use strict';

module.exports = {
extends: 'recommended',
rules: {
// should definitely move to template only
// glimmer components for this one
'no-partial': false,

// these need to be looked into, but
// may be a bigger change
'no-invalid-interactive': false,
'simple-unless': false,

'self-closing-void-elements': false,
'no-unnecessary-concat': false,
'no-quoteless-attributes': false,
'no-nested-interactive': false,

// Only used in list-pager, which can be replaced with
// an angle-bracket component
'no-attrs-in-components': false,

// Used in practice with charts. Ideally this would be true
// except for a whitelist of chart files.
'no-inline-styles': false,

// not sure we'll ever want these on,
// would be nice but if prettier isn't doing
// it for us, then not sure it's worth it
'attribute-indentation': false,
'block-indentation': false,
quotes: false,
},

ignore: [
'app/templates/components/freestyle/**',
'nomad-ui/templates/components/freestyle/**'
]
};
10 changes: 10 additions & 0 deletions ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ Nomad UI tests can be run independently of Nomad golang tests.
* `ember test` (single run, headless browser)
* `ember test --server` (watches for changes, runs in a full browser)



### Linting

Linting should happen automatically in your editor and when committing changes, but it can also be invoked manually.

* `npm run lint:hbs`
* `npm run lint:js`
* `npm run lint:js -- --fix`

### Building

Typically `make release` or `make dev-ui` will be the desired build workflow, but in the event that build artifacts need to be inspected, `ember build` will output compiled files in `ui/dist`.
Expand Down
2 changes: 1 addition & 1 deletion ui/app/adapters/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default Watchable.extend({

plan(job) {
const jobId = job.get('id');
const store = this.get('store');
const store = this.store;
const url = addToPath(this.urlForFindRecord(jobId, 'job'), '/plan');

return this.ajax(url, 'POST', {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/adapters/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default ApplicationAdapter.extend({

findSelf() {
return this.ajax(`${this.buildURL()}/token/self`, 'GET').then(token => {
const store = this.get('store');
const store = this.store;
store.pushPayload('token', {
tokens: [token],
});
Expand Down
20 changes: 10 additions & 10 deletions ui/app/adapters/watchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ export default ApplicationAdapter.extend({
if (previousBeforeSend) {
previousBeforeSend(...arguments);
}
this.get('xhrs').track(key, jqXHR);
this.xhrs.track(key, jqXHR);
jqXHR.always(() => {
this.get('xhrs').remove(key, jqXHR);
this.xhrs.remove(key, jqXHR);
});
};

Expand All @@ -60,7 +60,7 @@ export default ApplicationAdapter.extend({
const url = this.urlForFindAll(type.modelName);

if (get(snapshotRecordArray || {}, 'adapterOptions.watch')) {
params.index = this.get('watchList').getIndexFor(url);
params.index = this.watchList.getIndexFor(url);
}

return this.ajax(url, 'GET', {
Expand All @@ -73,7 +73,7 @@ export default ApplicationAdapter.extend({
params = assign(queryString.parse(params) || {}, this.buildQuery(), additionalParams);

if (get(snapshot || {}, 'adapterOptions.watch')) {
params.index = this.get('watchList').getIndexFor(url);
params.index = this.watchList.getIndexFor(url);
}

return this.ajax(url, 'GET', {
Expand All @@ -97,7 +97,7 @@ export default ApplicationAdapter.extend({
let params = {};

if (watch) {
params.index = this.get('watchList').getIndexFor(url);
params.index = this.watchList.getIndexFor(url);
}

// Avoid duplicating existing query params by passing them to ajax
Expand All @@ -113,7 +113,7 @@ export default ApplicationAdapter.extend({
data: params,
}).then(
json => {
const store = this.get('store');
const store = this.store;
const normalizeMethod =
relationship.kind === 'belongsTo'
? 'normalizeFindBelongsToResponse'
Expand All @@ -138,7 +138,7 @@ export default ApplicationAdapter.extend({
// case sensitive.
const newIndex = headers['x-nomad-index'] || headers['X-Nomad-Index'];
if (newIndex) {
this.get('watchList').setIndexFor(requestData.url, newIndex);
this.watchList.setIndexFor(requestData.url, newIndex);
}

return this._super(...arguments);
Expand All @@ -149,7 +149,7 @@ export default ApplicationAdapter.extend({
return;
}
const url = this.urlForFindRecord(id, modelName);
this.get('xhrs').cancel(`GET ${url}`);
this.xhrs.cancel(`GET ${url}`);
},

cancelFindAll(modelName) {
Expand All @@ -161,7 +161,7 @@ export default ApplicationAdapter.extend({
if (params) {
url = `${url}?${params}`;
}
this.get('xhrs').cancel(`GET ${url}`);
this.xhrs.cancel(`GET ${url}`);
},

cancelReloadRelationship(model, relationshipName) {
Expand All @@ -175,7 +175,7 @@ export default ApplicationAdapter.extend({
);
} else {
const url = model[relationship.kind](relationship.key).link();
this.get('xhrs').cancel(`GET ${url}`);
this.xhrs.cancel(`GET ${url}`);
}
},
});
18 changes: 9 additions & 9 deletions ui/app/components/allocation-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export default Component.extend({
if (!this.get('allocation.isRunning')) return;

return AllocationStatsTracker.create({
fetch: url => this.get('token').authorizedRequest(url),
allocation: this.get('allocation'),
fetch: url => this.token.authorizedRequest(url),
allocation: this.allocation,
});
}),

Expand All @@ -41,22 +41,22 @@ export default Component.extend({
onClick() {},

click(event) {
lazyClick([this.get('onClick'), event]);
lazyClick([this.onClick, event]);
},

didReceiveAttrs() {
const allocation = this.get('allocation');
const allocation = this.allocation;

if (allocation) {
run.scheduleOnce('afterRender', this, qualifyAllocation);
} else {
this.get('fetchStats').cancelAll();
this.fetchStats.cancelAll();
}
},

fetchStats: task(function*() {
do {
if (this.get('stats')) {
if (this.stats) {
try {
yield this.get('stats.poll').perform();
this.set('statsError', false);
Expand All @@ -66,14 +66,14 @@ export default Component.extend({
}

yield timeout(500);
} while (this.get('enablePolling'));
} while (this.enablePolling);
}).drop(),
});

function qualifyAllocation() {
const allocation = this.get('allocation');
const allocation = this.allocation;
return allocation.reload().then(() => {
this.get('fetchStats').perform();
this.fetchStats.perform();

// Make sure that the job record in the store for this allocation
// is complete and not a partial from the list endpoint
Expand Down
4 changes: 2 additions & 2 deletions ui/app/components/allocation-status-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export default DistributionBar.extend({
data: computed(
'allocationContainer.{queuedAllocs,completeAllocs,failedAllocs,runningAllocs,startingAllocs}',
function() {
if (!this.get('allocationContainer')) {
if (!this.allocationContainer) {
return [];
}

const allocs = this.get('allocationContainer').getProperties(
const allocs = this.allocationContainer.getProperties(
'queuedAllocs',
'completeAllocs',
'failedAllocs',
Expand Down
4 changes: 2 additions & 2 deletions ui/app/components/children-status-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export default DistributionBar.extend({
'data-test-children-status-bar': true,

data: computed('job.{pendingChildren,runningChildren,deadChildren}', function() {
if (!this.get('job')) {
if (!this.job) {
return [];
}

const children = this.get('job').getProperties(
const children = this.job.getProperties(
'pendingChildren',
'runningChildren',
'deadChildren'
Expand Down
14 changes: 7 additions & 7 deletions ui/app/components/client-node-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@ export default Component.extend(WithVisibilityDetection, {
onClick() {},

click(event) {
lazyClick([this.get('onClick'), event]);
lazyClick([this.onClick, event]);
},

didReceiveAttrs() {
// Reload the node in order to get detail information
const node = this.get('node');
const node = this.node;
if (node) {
node.reload().then(() => {
this.get('watch').perform(node, 100);
this.watch.perform(node, 100);
});
}
},

visibilityHandler() {
if (document.hidden) {
this.get('watch').cancelAll();
this.watch.cancelAll();
} else {
const node = this.get('node');
const node = this.node;
if (node) {
this.get('watch').perform(node, 100);
this.watch.perform(node, 100);
}
}
},

willDestroy() {
this.get('watch').cancelAll();
this.watch.cancelAll();
this._super(...arguments);
},

Expand Down
Loading