diff --git a/.travis.yml b/.travis.yml index 258b59a16..a2c460253 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,9 @@ language: go go: - 1.9.x +addons: + chrome: stable + git: depth: 300 @@ -28,13 +31,11 @@ matrix: - os: osx fast_finish: true -cache: - directories: - - ui/node_modules - 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 [[ "$RUN_UI_TESTS" ]]; then curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.0.1 ; fi + - if [[ "$RUN_UI_TESTS" ]]; then export PATH="$HOME/.yarn/bin:$PATH" ; fi install: - if [[ -z "$SKIP_NOMAD_TESTS" ]]; then make deps ; fi diff --git a/GNUmakefile b/GNUmakefile index 3c9741a71..951e7a81b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -283,8 +283,8 @@ static-assets: ## Compile the static routes to serve alongside the API .PHONY: test-ui test-ui: ## Run Nomad UI test suite @echo "--> Installing JavaScript assets" + @cd ui && npm rebuild node-sass @cd ui && yarn install - @cd ui && npm install phantomjs-prebuilt @echo "--> Running ember tests" @cd ui && phantomjs --version @cd ui && npm test diff --git a/ui/.nvmrc b/ui/.nvmrc index 1e8b31496..45a4fb75d 100644 --- a/ui/.nvmrc +++ b/ui/.nvmrc @@ -1 +1 @@ -6 +8 diff --git a/ui/.prettierrc b/ui/.prettierrc new file mode 100644 index 000000000..7f9eaa64f --- /dev/null +++ b/ui/.prettierrc @@ -0,0 +1,3 @@ +printWidth: 100 +singleQuote: true +trailingComma: es5 diff --git a/ui/.travis.yml b/ui/.travis.yml deleted file mode 100644 index 385f003d4..000000000 --- a/ui/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -language: node_js -node_js: - - "6" - -sudo: false - -cache: - directories: - - $HOME/.npm - -before_install: - - npm config set spin false - - npm install -g phantomjs-prebuilt - - phantomjs --version - -install: - - npm install - -script: - - npm test diff --git a/ui/app/adapters/application.js b/ui/app/adapters/application.js index 1e5c97333..bcf223383 100644 --- a/ui/app/adapters/application.js +++ b/ui/app/adapters/application.js @@ -1,15 +1,14 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import { computed, get } from '@ember/object'; import RESTAdapter from 'ember-data/adapters/rest'; import codesForError from '../utils/codes-for-error'; -const { get, computed, inject } = Ember; - export const namespace = 'v1'; export default RESTAdapter.extend({ namespace, - token: inject.service(), + token: service(), headers: computed('token.secret', function() { const token = this.get('token.secret'); diff --git a/ui/app/adapters/job.js b/ui/app/adapters/job.js index 4d18d1625..80398adac 100644 --- a/ui/app/adapters/job.js +++ b/ui/app/adapters/job.js @@ -1,10 +1,10 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import RSVP from 'rsvp'; +import { assign } from '@ember/polyfills'; import ApplicationAdapter from './application'; -const { RSVP, inject, assign } = Ember; - export default ApplicationAdapter.extend({ - system: inject.service(), + system: service(), shouldReloadAll: () => true, diff --git a/ui/app/adapters/token.js b/ui/app/adapters/token.js index 0bd103334..32315037a 100644 --- a/ui/app/adapters/token.js +++ b/ui/app/adapters/token.js @@ -1,10 +1,8 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; import { default as ApplicationAdapter, namespace } from './application'; -const { inject } = Ember; - export default ApplicationAdapter.extend({ - store: inject.service(), + store: service(), namespace: namespace + '/acl', diff --git a/ui/app/app.js b/ui/app/app.js index 831ad6106..7d6bae3ce 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -1,16 +1,14 @@ -import Ember from 'ember'; +import Application from '@ember/application'; import Resolver from './resolver'; import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; let App; -Ember.MODEL_FACTORY_INJECTIONS = true; - -App = Ember.Application.extend({ +App = Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, - Resolver + Resolver, }); loadInitializers(App, config.modulePrefix); diff --git a/ui/app/components/allocation-row.js b/ui/app/components/allocation-row.js index a258f5b24..5625c092f 100644 --- a/ui/app/components/allocation-row.js +++ b/ui/app/components/allocation-row.js @@ -1,10 +1,10 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import Component from '@ember/component'; +import { run } from '@ember/runloop'; import { lazyClick } from '../helpers/lazy-click'; -const { Component, inject, run } = Ember; - export default Component.extend({ - store: inject.service(), + store: service(), tagName: 'tr', diff --git a/ui/app/components/allocation-status-bar.js b/ui/app/components/allocation-status-bar.js index 0a3734626..7f2d1e2fc 100644 --- a/ui/app/components/allocation-status-bar.js +++ b/ui/app/components/allocation-status-bar.js @@ -1,8 +1,6 @@ -import Ember from 'ember'; +import { computed } from '@ember/object'; import DistributionBar from './distribution-bar'; -const { computed } = Ember; - export default DistributionBar.extend({ layoutName: 'components/distribution-bar', diff --git a/ui/app/components/attributes-section.js b/ui/app/components/attributes-section.js index f2503c9fc..479865264 100644 --- a/ui/app/components/attributes-section.js +++ b/ui/app/components/attributes-section.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Component } = Ember; +import Component from '@ember/component'; export default Component.extend({ tagName: '', diff --git a/ui/app/components/client-node-row.js b/ui/app/components/client-node-row.js index e2f9dd19c..2775ed58f 100644 --- a/ui/app/components/client-node-row.js +++ b/ui/app/components/client-node-row.js @@ -1,8 +1,6 @@ -import Ember from 'ember'; +import Component from '@ember/component'; import { lazyClick } from '../helpers/lazy-click'; -const { Component } = Ember; - export default Component.extend({ tagName: 'tr', classNames: ['client-node-row', 'is-interactive'], diff --git a/ui/app/components/distribution-bar.js b/ui/app/components/distribution-bar.js index 105273df6..46d47d8f4 100644 --- a/ui/app/components/distribution-bar.js +++ b/ui/app/components/distribution-bar.js @@ -1,10 +1,13 @@ -import Ember from 'ember'; +import Component from '@ember/component'; +import { computed } from '@ember/object'; +import { run } from '@ember/runloop'; +import { assign } from '@ember/polyfills'; +import { guidFor } from '@ember/object/internals'; import d3 from 'npm:d3-selection'; import 'npm:d3-transition'; import WindowResizable from '../mixins/window-resizable'; import styleStringProperty from '../utils/properties/style-string'; -const { Component, computed, run, assign, guidFor } = Ember; const sumAggregate = (total, val) => total + val; export default Component.extend(WindowResizable, { @@ -96,7 +99,7 @@ export default Component.extend(WindowResizable, { }); slices = slices.merge(slicesEnter); - slices.attr('class', d => d.className || `slice-${filteredData.indexOf(d)}`); + slices.attr('class', d => d.className || `slice-${_data.indexOf(d)}`); const setWidth = d => `${width * d.percent - (d.index === sliceCount - 1 || d.index === 0 ? 1 : 2)}px` const setOffset = d => `${width * d.offset + (d.index === 0 ? 0 : 1)}px` diff --git a/ui/app/components/freestyle/sg-boxed-section.js b/ui/app/components/freestyle/sg-boxed-section.js new file mode 100644 index 000000000..4e4f4fa7d --- /dev/null +++ b/ui/app/components/freestyle/sg-boxed-section.js @@ -0,0 +1,27 @@ +import Component from '@ember/component'; +import { computed } from '@ember/object'; + +export default Component.extend({ + variants: computed(() => [ + { + key: 'Normal', + title: 'Normal', + slug: '', + }, + { + key: 'Info', + title: 'Info', + slug: 'is-info', + }, + { + key: 'Warning', + title: 'Warning', + slug: 'is-warning', + }, + { + key: 'Danger', + title: 'Danger', + slug: 'is-danger', + }, + ]), +}); diff --git a/ui/app/components/freestyle/sg-colors.js b/ui/app/components/freestyle/sg-colors.js new file mode 100644 index 000000000..40d77fcd2 --- /dev/null +++ b/ui/app/components/freestyle/sg-colors.js @@ -0,0 +1,97 @@ +import Component from '@ember/component'; +import { computed } from '@ember/object'; + +export default Component.extend({ + nomadTheme: computed(() => [ + { + name: 'Primary', + base: '#25ba81', + }, + { + name: 'Primary Dark', + base: '#1d9467', + }, + { + name: 'Text', + base: '#0a0a0a', + }, + { + name: 'Link', + base: '#1563ff', + }, + { + name: 'Gray', + base: '#bbc4d1', + }, + { + name: 'Off-white', + base: '#f5f5f5', + }, + ]), + + productColors: computed(() => [ + { + name: 'Consul Pink', + base: '#ff0087', + }, + { + name: 'Consul Pink Dark', + base: '#c62a71', + }, + { + name: 'Packer Blue', + base: '#1daeff', + }, + { + name: 'Packer Blue Dark', + base: '#1d94dd', + }, + { + name: 'Terraform Purple', + base: '#5c4ee5', + }, + { + name: 'Terraform Purple Dark', + base: '#4040b2', + }, + { + name: 'Vagrant Blue', + base: '#1563ff', + }, + { + name: 'Vagrant Blue Dark', + base: '#104eb2', + }, + { + name: 'Nomad Green', + base: '#25ba81', + }, + { + name: 'Nomad Green Dark', + base: '#1d9467', + }, + { + name: 'Nomad Green Darker', + base: '#16704d', + }, + ]), + + emotiveColors: computed(() => [ + { + name: 'Success', + base: '#23d160', + }, + { + name: 'Warning', + base: '#fa8e23', + }, + { + name: 'Danger', + base: '#c84034', + }, + { + name: 'Info', + base: '#1563ff', + }, + ]), +}); diff --git a/ui/app/components/freestyle/sg-distribution-bar-jumbo.js b/ui/app/components/freestyle/sg-distribution-bar-jumbo.js new file mode 100644 index 000000000..9176d6b7c --- /dev/null +++ b/ui/app/components/freestyle/sg-distribution-bar-jumbo.js @@ -0,0 +1,13 @@ +import Component from '@ember/component'; +import { computed } from '@ember/object'; + +export default Component.extend({ + distributionBarData: computed(() => { + return [ + { label: 'one', value: 10 }, + { label: 'two', value: 20 }, + { label: 'three', value: 0 }, + { label: 'four', value: 35 }, + ]; + }), +}); diff --git a/ui/app/components/freestyle/sg-distribution-bar.js b/ui/app/components/freestyle/sg-distribution-bar.js new file mode 100644 index 000000000..ab43ceb03 --- /dev/null +++ b/ui/app/components/freestyle/sg-distribution-bar.js @@ -0,0 +1,43 @@ +import Component from '@ember/component'; +import { computed } from '@ember/object'; + +export default Component.extend({ + timerTicks: 0, + + startTimer: function() { + this.set( + 'timer', + setInterval(() => { + this.incrementProperty('timerTicks'); + }, 500) + ); + }.on('init'), + + willDestroy() { + clearInterval(this.get('timer')); + }, + + distributionBarData: computed(() => { + return [ + { label: 'one', value: 10 }, + { label: 'two', value: 20 }, + { label: 'three', value: 30 }, + ]; + }), + + distributionBarDataWithClasses: computed(() => { + return [ + { label: 'Queued', value: 10, className: 'queued' }, + { label: 'Complete', value: 20, className: 'complete' }, + { label: 'Failed', value: 30, className: 'failed' }, + ]; + }), + + distributionBarDataRotating: computed('timerTicks', () => { + return [ + { label: 'one', value: Math.round(Math.random() * 50) }, + { label: 'two', value: Math.round(Math.random() * 50) }, + { label: 'three', value: Math.round(Math.random() * 50) }, + ]; + }), +}); diff --git a/ui/app/components/gutter-menu.js b/ui/app/components/gutter-menu.js index 9ab098cbb..7a5086b76 100644 --- a/ui/app/components/gutter-menu.js +++ b/ui/app/components/gutter-menu.js @@ -1,9 +1,9 @@ -import Ember from 'ember'; - -const { Component, inject, computed } = Ember; +import { inject as service } from '@ember/service'; +import Component from '@ember/component'; +import { computed } from '@ember/object'; export default Component.extend({ - system: inject.service(), + system: service(), sortedNamespaces: computed('system.namespaces.@each.name', function() { const namespaces = this.get('system.namespaces').toArray() || []; diff --git a/ui/app/components/job-deployment.js b/ui/app/components/job-deployment.js index 1a2476be8..feb13f17d 100644 --- a/ui/app/components/job-deployment.js +++ b/ui/app/components/job-deployment.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Component } = Ember; +import Component from '@ember/component'; export default Component.extend({ classNames: ['job-deployment', 'boxed-section'], diff --git a/ui/app/components/job-deployment/deployment-metrics.js b/ui/app/components/job-deployment/deployment-metrics.js index f2503c9fc..479865264 100644 --- a/ui/app/components/job-deployment/deployment-metrics.js +++ b/ui/app/components/job-deployment/deployment-metrics.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Component } = Ember; +import Component from '@ember/component'; export default Component.extend({ tagName: '', diff --git a/ui/app/components/job-deployments-stream.js b/ui/app/components/job-deployments-stream.js index 95bd4f198..0ddb5fedb 100644 --- a/ui/app/components/job-deployments-stream.js +++ b/ui/app/components/job-deployments-stream.js @@ -1,17 +1,16 @@ -import Ember from 'ember'; +import Component from '@ember/component'; +import { computed } from '@ember/object'; import moment from 'moment'; -const { Component, computed } = Ember; - export default Component.extend({ tagName: 'ol', classNames: ['timeline'], deployments: computed(() => []), - sortedDeployments: computed('deployments.@each.version.submitTime', function() { + sortedDeployments: computed('deployments.@each.versionSubmitTime', function() { return this.get('deployments') - .sortBy('version.submitTime') + .sortBy('versionSubmitTime') .reverse(); }), diff --git a/ui/app/components/job-diff-fields-and-objects.js b/ui/app/components/job-diff-fields-and-objects.js index f2503c9fc..479865264 100644 --- a/ui/app/components/job-diff-fields-and-objects.js +++ b/ui/app/components/job-diff-fields-and-objects.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Component } = Ember; +import Component from '@ember/component'; export default Component.extend({ tagName: '', diff --git a/ui/app/components/job-diff.js b/ui/app/components/job-diff.js index 2bba7310e..79371f333 100644 --- a/ui/app/components/job-diff.js +++ b/ui/app/components/job-diff.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Component, computed } = Ember; +import { equal } from '@ember/object/computed'; +import Component from '@ember/component'; export default Component.extend({ classNames: ['job-diff'], @@ -10,7 +9,7 @@ export default Component.extend({ verbose: true, - isEdited: computed.equal('diff.Type', 'Edited'), - isAdded: computed.equal('diff.Type', 'Added'), - isDeleted: computed.equal('diff.Type', 'Deleted'), + isEdited: equal('diff.Type', 'Edited'), + isAdded: equal('diff.Type', 'Added'), + isDeleted: equal('diff.Type', 'Deleted'), }); diff --git a/ui/app/components/job-row.js b/ui/app/components/job-row.js index e370cfba9..db9e6e369 100644 --- a/ui/app/components/job-row.js +++ b/ui/app/components/job-row.js @@ -1,8 +1,6 @@ -import Ember from 'ember'; +import Component from '@ember/component'; import { lazyClick } from '../helpers/lazy-click'; -const { Component } = Ember; - export default Component.extend({ tagName: 'tr', classNames: ['job-row', 'is-interactive'], diff --git a/ui/app/components/job-version.js b/ui/app/components/job-version.js index 0ffe77803..978111a93 100644 --- a/ui/app/components/job-version.js +++ b/ui/app/components/job-version.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Component, computed } = Ember; +import Component from '@ember/component'; +import { computed } from '@ember/object'; const changeTypes = ['Added', 'Deleted', 'Edited']; diff --git a/ui/app/components/job-versions-stream.js b/ui/app/components/job-versions-stream.js index 8ac011376..b2a92d71a 100644 --- a/ui/app/components/job-versions-stream.js +++ b/ui/app/components/job-versions-stream.js @@ -1,8 +1,7 @@ -import Ember from 'ember'; +import Component from '@ember/component'; +import { computed } from '@ember/object'; import moment from 'moment'; -const { Component, computed } = Ember; - export default Component.extend({ tagName: 'ol', classNames: ['timeline'], diff --git a/ui/app/components/json-viewer.js b/ui/app/components/json-viewer.js index 2d8442e33..cf966757d 100644 --- a/ui/app/components/json-viewer.js +++ b/ui/app/components/json-viewer.js @@ -1,8 +1,8 @@ -import Ember from 'ember'; +import Component from '@ember/component'; +import { computed } from '@ember/object'; +import { run } from '@ember/runloop'; import JSONFormatterPkg from 'npm:json-formatter-js'; -const { Component, computed, run } = Ember; - // json-formatter-js is packaged in a funny way that ember-cli-browserify // doesn't unwrap properly. const { default: JSONFormatter } = JSONFormatterPkg; diff --git a/ui/app/components/list-pagination.js b/ui/app/components/list-pagination.js index c18301d4a..c04aaa9f4 100644 --- a/ui/app/components/list-pagination.js +++ b/ui/app/components/list-pagination.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Component, computed } = Ember; +import Component from '@ember/component'; +import { computed } from '@ember/object'; export default Component.extend({ source: computed(() => []), @@ -31,9 +30,11 @@ export default Component.extend({ const lowerBound = Math.max(1, page - spread); const upperBound = Math.min(lastPage, page + spread) + 1; - return Array(upperBound - lowerBound).fill(null).map((_, index) => ({ - pageNumber: lowerBound + index, - })); + return Array(upperBound - lowerBound) + .fill(null) + .map((_, index) => ({ + pageNumber: lowerBound + index, + })); }), list: computed('source.[]', 'page', 'size', function() { diff --git a/ui/app/components/list-pagination/list-pager.js b/ui/app/components/list-pagination/list-pager.js index f2503c9fc..479865264 100644 --- a/ui/app/components/list-pagination/list-pager.js +++ b/ui/app/components/list-pagination/list-pager.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Component } = Ember; +import Component from '@ember/component'; export default Component.extend({ tagName: '', diff --git a/ui/app/components/list-table.js b/ui/app/components/list-table.js index 39cf15fe6..0b6d63416 100644 --- a/ui/app/components/list-table.js +++ b/ui/app/components/list-table.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Component, computed } = Ember; +import Component from '@ember/component'; +import { computed } from '@ember/object'; export default Component.extend({ tagName: 'table', diff --git a/ui/app/components/list-table/sort-by.js b/ui/app/components/list-table/sort-by.js index 9edcb61e7..cd6e3fc2c 100644 --- a/ui/app/components/list-table/sort-by.js +++ b/ui/app/components/list-table/sort-by.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Component, computed } = Ember; +import Component from '@ember/component'; +import { computed } from '@ember/object'; export default Component.extend({ tagName: 'th', diff --git a/ui/app/components/list-table/table-body.js b/ui/app/components/list-table/table-body.js index 4c756a699..782917851 100644 --- a/ui/app/components/list-table/table-body.js +++ b/ui/app/components/list-table/table-body.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Component } = Ember; +import Component from '@ember/component'; export default Component.extend({ tagName: 'tbody', diff --git a/ui/app/components/list-table/table-head.js b/ui/app/components/list-table/table-head.js index c1f0c7825..92a17d670 100644 --- a/ui/app/components/list-table/table-head.js +++ b/ui/app/components/list-table/table-head.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Component } = Ember; +import Component from '@ember/component'; export default Component.extend({ tagName: 'thead', diff --git a/ui/app/components/search-box.js b/ui/app/components/search-box.js index 19aa76bef..8066f3e0b 100644 --- a/ui/app/components/search-box.js +++ b/ui/app/components/search-box.js @@ -1,13 +1,13 @@ -import Ember from 'ember'; - -const { Component, computed, run } = Ember; +import { reads } from '@ember/object/computed'; +import Component from '@ember/component'; +import { run } from '@ember/runloop'; export default Component.extend({ // Passed to the component (mutable) searchTerm: null, // Used as a debounce buffer - _searchTerm: computed.reads('searchTerm'), + _searchTerm: reads('searchTerm'), // Used to throttle sets to searchTerm debounce: 150, diff --git a/ui/app/components/server-agent-row.js b/ui/app/components/server-agent-row.js index f853ada96..98d401fe0 100644 --- a/ui/app/components/server-agent-row.js +++ b/ui/app/components/server-agent-row.js @@ -1,13 +1,15 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import { alias } from '@ember/object/computed'; +import Component from '@ember/component'; +import { computed } from '@ember/object'; import { lazyClick } from '../helpers/lazy-click'; -const { Component, inject, computed } = Ember; - export default Component.extend({ - // TODO Switch back to the router service style when it is no longer feature-flagged + // TODO Switch back to the router service once the service behaves more like Route + // https://github.com/emberjs/ember.js/issues/15801 // router: inject.service('router'), - _router: inject.service('-routing'), - router: computed.alias('_router.router'), + _router: service('-routing'), + router: alias('_router.router'), tagName: 'tr', classNames: ['server-agent-row', 'is-interactive'], @@ -15,7 +17,8 @@ export default Component.extend({ agent: null, isActive: computed('agent', 'router.currentURL', function() { - // TODO Switch back to the router service style when it is no longer feature-flagged + // TODO Switch back to the router service once the service behaves more like Route + // https://github.com/emberjs/ember.js/issues/15801 // const targetURL = this.get('router').urlFor('servers.server', this.get('agent')); // const currentURL = `${this.get('router.rootURL').slice(0, -1)}${this.get('router.currentURL')}`; diff --git a/ui/app/components/task-group-row.js b/ui/app/components/task-group-row.js index 4fb239637..98753d615 100644 --- a/ui/app/components/task-group-row.js +++ b/ui/app/components/task-group-row.js @@ -1,8 +1,6 @@ -import Ember from 'ember'; +import Component from '@ember/component'; import { lazyClick } from '../helpers/lazy-click'; -const { Component } = Ember; - export default Component.extend({ tagName: 'tr', diff --git a/ui/app/components/task-log.js b/ui/app/components/task-log.js index 1b066db73..277023859 100644 --- a/ui/app/components/task-log.js +++ b/ui/app/components/task-log.js @@ -1,12 +1,13 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import Component from '@ember/component'; +import { computed } from '@ember/object'; +import { run } from '@ember/runloop'; import { task } from 'ember-concurrency'; import { logger } from 'nomad-ui/utils/classes/log'; import WindowResizable from 'nomad-ui/mixins/window-resizable'; -const { Component, computed, inject, run } = Ember; - export default Component.extend(WindowResizable, { - token: inject.service(), + token: service(), classNames: ['boxed-section', 'task-log'], diff --git a/ui/app/controllers/allocations/allocation.js b/ui/app/controllers/allocations/allocation.js index 1ee88420b..75ceaaec3 100644 --- a/ui/app/controllers/allocations/allocation.js +++ b/ui/app/controllers/allocations/allocation.js @@ -1,5 +1,3 @@ -import Ember from 'ember'; - -const { Controller } = Ember; +import Controller from '@ember/controller'; export default Controller.extend({}); diff --git a/ui/app/controllers/allocations/allocation/index.js b/ui/app/controllers/allocations/allocation/index.js index 5a764f2a6..810d0f728 100644 --- a/ui/app/controllers/allocations/allocation/index.js +++ b/ui/app/controllers/allocations/allocation/index.js @@ -1,8 +1,7 @@ -import Ember from 'ember'; +import { alias } from '@ember/object/computed'; +import Controller from '@ember/controller'; import Sortable from 'nomad-ui/mixins/sortable'; -const { Controller, computed } = Ember; - export default Controller.extend(Sortable, { queryParams: { sortProperty: 'sort', @@ -12,6 +11,6 @@ export default Controller.extend(Sortable, { sortProperty: 'name', sortDescending: false, - listToSort: computed.alias('model.states'), - sortedStates: computed.alias('listSorted'), + listToSort: alias('model.states'), + sortedStates: alias('listSorted'), }); diff --git a/ui/app/controllers/allocations/allocation/task/index.js b/ui/app/controllers/allocations/allocation/task/index.js index 7374af8fd..790e190ec 100644 --- a/ui/app/controllers/allocations/allocation/task/index.js +++ b/ui/app/controllers/allocations/allocation/task/index.js @@ -1,9 +1,9 @@ -import Ember from 'ember'; - -const { Controller, computed } = Ember; +import { alias } from '@ember/object/computed'; +import Controller from '@ember/controller'; +import { computed } from '@ember/object'; export default Controller.extend({ - network: computed.alias('model.resources.networks.firstObject'), + network: alias('model.resources.networks.firstObject'), ports: computed('network.reservedPorts.[]', 'network.dynamicPorts.[]', function() { return (this.get('network.reservedPorts') || []) .map(port => ({ diff --git a/ui/app/controllers/application.js b/ui/app/controllers/application.js index ee8bee9ee..fc3c5e58e 100644 --- a/ui/app/controllers/application.js +++ b/ui/app/controllers/application.js @@ -1,10 +1,12 @@ +import { inject as service } from '@ember/service'; +import Controller from '@ember/controller'; +import { run } from '@ember/runloop'; +import { observer, computed } from '@ember/object'; import Ember from 'ember'; import codesForError from '../utils/codes-for-error'; -const { Controller, computed, inject, run, observer } = Ember; - export default Controller.extend({ - config: inject.service(), + config: service(), error: null, @@ -33,7 +35,7 @@ export default Controller.extend({ run.next(() => { throw this.get('error'); }); - } else { + } else if (!Ember.testing) { run.next(() => { // eslint-disable-next-line console.warn('UNRECOVERABLE ERROR:', this.get('error')); diff --git a/ui/app/controllers/clients.js b/ui/app/controllers/clients.js index 41e5c9e2f..f4d0631dc 100644 --- a/ui/app/controllers/clients.js +++ b/ui/app/controllers/clients.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Controller } = Ember; +import Controller from '@ember/controller'; export default Controller.extend({ isForbidden: false, diff --git a/ui/app/controllers/clients/client.js b/ui/app/controllers/clients/client.js index ed463e813..008169f5e 100644 --- a/ui/app/controllers/clients/client.js +++ b/ui/app/controllers/clients/client.js @@ -1,9 +1,9 @@ -import Ember from 'ember'; +import { alias } from '@ember/object/computed'; +import Controller from '@ember/controller'; +import { computed } from '@ember/object'; import Sortable from 'nomad-ui/mixins/sortable'; import Searchable from 'nomad-ui/mixins/searchable'; -const { Controller, computed } = Ember; - export default Controller.extend(Sortable, Searchable, { queryParams: { currentPage: 'page', @@ -20,9 +20,9 @@ export default Controller.extend(Sortable, Searchable, { searchProps: computed(() => ['shortId', 'name']), - listToSort: computed.alias('model.allocations'), - listToSearch: computed.alias('listSorted'), - sortedAllocations: computed.alias('listSearched'), + listToSort: alias('model.allocations'), + listToSearch: alias('listSorted'), + sortedAllocations: alias('listSearched'), actions: { gotoAllocation(allocation) { diff --git a/ui/app/controllers/clients/index.js b/ui/app/controllers/clients/index.js index eedb9ebe8..ac19f9d9d 100644 --- a/ui/app/controllers/clients/index.js +++ b/ui/app/controllers/clients/index.js @@ -1,14 +1,14 @@ -import Ember from 'ember'; +import { alias } from '@ember/object/computed'; +import Controller, { inject as controller } from '@ember/controller'; +import { computed } from '@ember/object'; import Sortable from 'nomad-ui/mixins/sortable'; import Searchable from 'nomad-ui/mixins/searchable'; -const { Controller, computed, inject } = Ember; - export default Controller.extend(Sortable, Searchable, { - clientsController: inject.controller('clients'), + clientsController: controller('clients'), - nodes: computed.alias('model.nodes'), - agents: computed.alias('model.agents'), + nodes: alias('model.nodes'), + agents: alias('model.agents'), queryParams: { currentPage: 'page', @@ -25,11 +25,11 @@ export default Controller.extend(Sortable, Searchable, { searchProps: computed(() => ['id', 'name', 'datacenter']), - listToSort: computed.alias('nodes'), - listToSearch: computed.alias('listSorted'), - sortedNodes: computed.alias('listSearched'), + listToSort: alias('nodes'), + listToSearch: alias('listSorted'), + sortedNodes: alias('listSearched'), - isForbidden: computed.alias('clientsController.isForbidden'), + isForbidden: alias('clientsController.isForbidden'), actions: { gotoNode(node) { diff --git a/ui/app/controllers/freestyle.js b/ui/app/controllers/freestyle.js index 71e5bde38..a5809f613 100644 --- a/ui/app/controllers/freestyle.js +++ b/ui/app/controllers/freestyle.js @@ -1,47 +1,6 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; import FreestyleController from 'ember-freestyle/controllers/freestyle'; -const { inject, computed } = Ember; - export default FreestyleController.extend({ - emberFreestyle: inject.service(), - - timerTicks: 0, - - startTimer: function() { - this.set( - 'timer', - setInterval(() => { - this.incrementProperty('timerTicks'); - }, 500) - ); - }.on('init'), - - stopTimer: function() { - clearInterval(this.get('timer')); - }.on('willDestroy'), - - distributionBarData: computed(() => { - return [ - { label: 'one', value: 10 }, - { label: 'two', value: 20 }, - { label: 'three', value: 30 }, - ]; - }), - - distributionBarDataWithClasses: computed(() => { - return [ - { label: 'Queued', value: 10, className: 'queued' }, - { label: 'Complete', value: 20, className: 'complete' }, - { label: 'Failed', value: 30, className: 'failed' }, - ]; - }), - - distributionBarDataRotating: computed('timerTicks', () => { - return [ - { label: 'one', value: Math.round(Math.random() * 50) }, - { label: 'two', value: Math.round(Math.random() * 50) }, - { label: 'three', value: Math.round(Math.random() * 50) }, - ]; - }), + emberFreestyle: service(), }); diff --git a/ui/app/controllers/jobs.js b/ui/app/controllers/jobs.js index 88f3d60e1..e7a69a7d8 100644 --- a/ui/app/controllers/jobs.js +++ b/ui/app/controllers/jobs.js @@ -1,9 +1,10 @@ -import Ember from 'ember'; - -const { Controller, inject, observer, run } = Ember; +import { inject as service } from '@ember/service'; +import Controller from '@ember/controller'; +import { observer } from '@ember/object'; +import { run } from '@ember/runloop'; export default Controller.extend({ - system: inject.service(), + system: service(), queryParams: { jobNamespace: 'namespace', diff --git a/ui/app/controllers/jobs/index.js b/ui/app/controllers/jobs/index.js index 079d30dc3..d0d06e9ee 100644 --- a/ui/app/controllers/jobs/index.js +++ b/ui/app/controllers/jobs/index.js @@ -1,18 +1,19 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import { alias, filterBy } from '@ember/object/computed'; +import Controller, { inject as controller } from '@ember/controller'; +import { computed } from '@ember/object'; import Sortable from 'nomad-ui/mixins/sortable'; import Searchable from 'nomad-ui/mixins/searchable'; -const { Controller, computed, inject } = Ember; - export default Controller.extend(Sortable, Searchable, { - system: inject.service(), - jobsController: inject.controller('jobs'), + system: service(), + jobsController: controller('jobs'), - isForbidden: computed.alias('jobsController.isForbidden'), + isForbidden: alias('jobsController.isForbidden'), - pendingJobs: computed.filterBy('model', 'status', 'pending'), - runningJobs: computed.filterBy('model', 'status', 'running'), - deadJobs: computed.filterBy('model', 'status', 'dead'), + pendingJobs: filterBy('model', 'status', 'pending'), + runningJobs: filterBy('model', 'status', 'running'), + deadJobs: filterBy('model', 'status', 'dead'), queryParams: { currentPage: 'page', @@ -42,9 +43,9 @@ export default Controller.extend(Sortable, Searchable, { } ), - listToSort: computed.alias('filteredJobs'), - listToSearch: computed.alias('listSorted'), - sortedJobs: computed.alias('listSearched'), + listToSort: alias('filteredJobs'), + listToSearch: alias('listSorted'), + sortedJobs: alias('listSearched'), isShowingDeploymentDetails: false, diff --git a/ui/app/controllers/jobs/job.js b/ui/app/controllers/jobs/job.js index fab3c3204..5b8865a11 100644 --- a/ui/app/controllers/jobs/job.js +++ b/ui/app/controllers/jobs/job.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Controller, computed } = Ember; +import Controller from '@ember/controller'; +import { computed } from '@ember/object'; export default Controller.extend({ breadcrumbs: computed('model.{name,id}', function() { diff --git a/ui/app/controllers/jobs/job/definition.js b/ui/app/controllers/jobs/job/definition.js index 95144a831..b105b72b0 100644 --- a/ui/app/controllers/jobs/job/definition.js +++ b/ui/app/controllers/jobs/job/definition.js @@ -1,12 +1,11 @@ -import Ember from 'ember'; +import { alias } from '@ember/object/computed'; +import Controller, { inject as controller } from '@ember/controller'; import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting'; -const { Controller, computed, inject } = Ember; - export default Controller.extend(WithNamespaceResetting, { - jobController: inject.controller('jobs.job'), + jobController: controller('jobs.job'), - job: computed.alias('model.job'), + job: alias('model.job'), - breadcrumbs: computed.alias('jobController.breadcrumbs'), + breadcrumbs: alias('jobController.breadcrumbs'), }); diff --git a/ui/app/controllers/jobs/job/deployments.js b/ui/app/controllers/jobs/job/deployments.js index a8c6b1761..0540c98b1 100644 --- a/ui/app/controllers/jobs/job/deployments.js +++ b/ui/app/controllers/jobs/job/deployments.js @@ -1,13 +1,12 @@ -import Ember from 'ember'; +import { alias } from '@ember/object/computed'; +import Controller, { inject as controller } from '@ember/controller'; import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting'; -const { Controller, computed, inject } = Ember; - export default Controller.extend(WithNamespaceResetting, { - jobController: inject.controller('jobs.job'), + jobController: controller('jobs.job'), - job: computed.alias('model'), - deployments: computed.alias('model.deployments'), + job: alias('model'), + deployments: alias('model.deployments'), - breadcrumbs: computed.alias('jobController.breadcrumbs'), + breadcrumbs: alias('jobController.breadcrumbs'), }); diff --git a/ui/app/controllers/jobs/job/index.js b/ui/app/controllers/jobs/job/index.js index 2738cccf1..97b97efb5 100644 --- a/ui/app/controllers/jobs/job/index.js +++ b/ui/app/controllers/jobs/job/index.js @@ -1,12 +1,13 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import { alias } from '@ember/object/computed'; +import Controller, { inject as controller } from '@ember/controller'; +import { computed } from '@ember/object'; import Sortable from 'nomad-ui/mixins/sortable'; import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting'; -const { Controller, computed, inject } = Ember; - export default Controller.extend(Sortable, WithNamespaceResetting, { - system: inject.service(), - jobController: inject.controller('jobs.job'), + system: service(), + jobController: controller('jobs.job'), queryParams: { currentPage: 'page', @@ -20,15 +21,15 @@ export default Controller.extend(Sortable, WithNamespaceResetting, { sortProperty: 'name', sortDescending: false, - breadcrumbs: computed.alias('jobController.breadcrumbs'), - job: computed.alias('model'), + breadcrumbs: alias('jobController.breadcrumbs'), + job: alias('model'), taskGroups: computed('model.taskGroups.[]', function() { return this.get('model.taskGroups') || []; }), - listToSort: computed.alias('taskGroups'), - sortedTaskGroups: computed.alias('listSorted'), + listToSort: alias('taskGroups'), + sortedTaskGroups: alias('listSorted'), sortedEvaluations: computed('model.evaluations.@each.modifyIndex', function() { return (this.get('model.evaluations') || []).sortBy('modifyIndex').reverse(); diff --git a/ui/app/controllers/jobs/job/loading.js b/ui/app/controllers/jobs/job/loading.js index bb159e836..2251e2d75 100644 --- a/ui/app/controllers/jobs/job/loading.js +++ b/ui/app/controllers/jobs/job/loading.js @@ -1,8 +1,7 @@ -import Ember from 'ember'; - -const { Controller, computed, inject } = Ember; +import { alias } from '@ember/object/computed'; +import Controller, { inject as controller } from '@ember/controller'; export default Controller.extend({ - jobController: inject.controller('jobs.job'), - breadcrumbs: computed.alias('jobController.breadcrumbs'), + jobController: controller('jobs.job'), + breadcrumbs: alias('jobController.breadcrumbs'), }); diff --git a/ui/app/controllers/jobs/job/task-group.js b/ui/app/controllers/jobs/job/task-group.js index 4fc628201..2e2ab25e7 100644 --- a/ui/app/controllers/jobs/job/task-group.js +++ b/ui/app/controllers/jobs/job/task-group.js @@ -1,12 +1,12 @@ -import Ember from 'ember'; +import { alias } from '@ember/object/computed'; +import Controller, { inject as controller } from '@ember/controller'; +import { computed } from '@ember/object'; import Sortable from 'nomad-ui/mixins/sortable'; import Searchable from 'nomad-ui/mixins/searchable'; import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting'; -const { Controller, computed, inject } = Ember; - export default Controller.extend(Sortable, Searchable, WithNamespaceResetting, { - jobController: inject.controller('jobs.job'), + jobController: controller('jobs.job'), queryParams: { currentPage: 'page', @@ -27,9 +27,9 @@ export default Controller.extend(Sortable, Searchable, WithNamespaceResetting, { return this.get('model.allocations') || []; }), - listToSort: computed.alias('allocations'), - listToSearch: computed.alias('listSorted'), - sortedAllocations: computed.alias('listSearched'), + listToSort: alias('allocations'), + listToSearch: alias('listSorted'), + sortedAllocations: alias('listSearched'), breadcrumbs: computed('jobController.breadcrumbs.[]', 'model.{name}', function() { return this.get('jobController.breadcrumbs').concat([ diff --git a/ui/app/controllers/jobs/job/versions.js b/ui/app/controllers/jobs/job/versions.js index 3b2420213..eb669a22b 100644 --- a/ui/app/controllers/jobs/job/versions.js +++ b/ui/app/controllers/jobs/job/versions.js @@ -1,13 +1,12 @@ -import Ember from 'ember'; +import { alias } from '@ember/object/computed'; +import Controller, { inject as controller } from '@ember/controller'; import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting'; -const { Controller, computed, inject } = Ember; - export default Controller.extend(WithNamespaceResetting, { - jobController: inject.controller('jobs.job'), + jobController: controller('jobs.job'), - job: computed.alias('model'), - versions: computed.alias('model.versions'), + job: alias('model'), + versions: alias('model.versions'), - breadcrumbs: computed.alias('jobController.breadcrumbs'), + breadcrumbs: alias('jobController.breadcrumbs'), }); diff --git a/ui/app/controllers/servers.js b/ui/app/controllers/servers.js index a8d0e1f8a..5e6f1bea4 100644 --- a/ui/app/controllers/servers.js +++ b/ui/app/controllers/servers.js @@ -1,11 +1,10 @@ -import Ember from 'ember'; +import { alias } from '@ember/object/computed'; +import Controller from '@ember/controller'; import Sortable from 'nomad-ui/mixins/sortable'; -const { Controller, computed } = Ember; - export default Controller.extend(Sortable, { - nodes: computed.alias('model.nodes'), - agents: computed.alias('model.agents'), + nodes: alias('model.nodes'), + agents: alias('model.agents'), queryParams: { currentPage: 'page', @@ -21,6 +20,6 @@ export default Controller.extend(Sortable, { isForbidden: false, - listToSort: computed.alias('agents'), - sortedAgents: computed.alias('listSorted'), + listToSort: alias('agents'), + sortedAgents: alias('listSorted'), }); diff --git a/ui/app/controllers/servers/index.js b/ui/app/controllers/servers/index.js index adf0eee4d..ee49e8f72 100644 --- a/ui/app/controllers/servers/index.js +++ b/ui/app/controllers/servers/index.js @@ -1,8 +1,7 @@ -import Ember from 'ember'; - -const { Controller, computed, inject } = Ember; +import { alias } from '@ember/object/computed'; +import Controller, { inject as controller } from '@ember/controller'; export default Controller.extend({ - serversController: inject.controller('servers'), - isForbidden: computed.alias('serversController.isForbidden'), + serversController: controller('servers'), + isForbidden: alias('serversController.isForbidden'), }); diff --git a/ui/app/controllers/servers/server.js b/ui/app/controllers/servers/server.js index 94f5f0bdd..dd455b3ad 100644 --- a/ui/app/controllers/servers/server.js +++ b/ui/app/controllers/servers/server.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Controller, computed } = Ember; +import Controller from '@ember/controller'; +import { computed } from '@ember/object'; export default Controller.extend({ activeTab: 'tags', diff --git a/ui/app/controllers/settings/tokens.js b/ui/app/controllers/settings/tokens.js index 2aad23469..be1db757d 100644 --- a/ui/app/controllers/settings/tokens.js +++ b/ui/app/controllers/settings/tokens.js @@ -1,12 +1,13 @@ -import Ember from 'ember'; - -const { Controller, inject, computed, getOwner } = Ember; +import { inject as service } from '@ember/service'; +import { reads } from '@ember/object/computed'; +import Controller from '@ember/controller'; +import { getOwner } from '@ember/application'; export default Controller.extend({ - token: inject.service(), - store: inject.service(), + token: service(), + store: service(), - secret: computed.reads('token.secret'), + secret: reads('token.secret'), tokenIsValid: false, tokenIsInvalid: false, diff --git a/ui/app/helpers/css-class.js b/ui/app/helpers/css-class.js index a23d3b90d..d7f30127c 100644 --- a/ui/app/helpers/css-class.js +++ b/ui/app/helpers/css-class.js @@ -1,4 +1,4 @@ -import Ember from 'ember'; +import { helper } from '@ember/component/helper'; /** * CSS Class @@ -12,4 +12,4 @@ export function cssClass([updateType]) { return updateType.replace(/\//g, '-').dasherize(); } -export default Ember.Helper.helper(cssClass); +export default helper(cssClass); diff --git a/ui/app/helpers/format-bytes.js b/ui/app/helpers/format-bytes.js index dc3ab3e15..b2c69ed06 100644 --- a/ui/app/helpers/format-bytes.js +++ b/ui/app/helpers/format-bytes.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Helper } = Ember; +import Helper from '@ember/component/helper'; const UNITS = ['Bytes', 'KiB', 'MiB']; diff --git a/ui/app/helpers/format-percentage.js b/ui/app/helpers/format-percentage.js index ff4358bc7..cfd409c13 100644 --- a/ui/app/helpers/format-percentage.js +++ b/ui/app/helpers/format-percentage.js @@ -1,4 +1,4 @@ -import Ember from 'ember'; +import { helper } from '@ember/component/helper'; /** * Percentage Calculator @@ -35,4 +35,4 @@ function safeNumber(value) { return isNaN(value) ? 0 : +value; } -export default Ember.Helper.helper(formatPercentage); +export default helper(formatPercentage); diff --git a/ui/app/helpers/is-object.js b/ui/app/helpers/is-object.js index 0b7dae86d..97dd42e65 100644 --- a/ui/app/helpers/is-object.js +++ b/ui/app/helpers/is-object.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Helper } = Ember; +import Helper from '@ember/component/helper'; export function isObject([value]) { const isObject = !Array.isArray(value) && value !== null && typeof value === 'object'; diff --git a/ui/app/helpers/lazy-click.js b/ui/app/helpers/lazy-click.js index f9d12dcd2..de96d1c0e 100644 --- a/ui/app/helpers/lazy-click.js +++ b/ui/app/helpers/lazy-click.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Helper, $ } = Ember; +import Helper from '@ember/component/helper'; +import $ from 'jquery'; /** * Lazy Click Event diff --git a/ui/app/helpers/pluralize.js b/ui/app/helpers/pluralize.js index 161b366a4..fcab84cbe 100644 --- a/ui/app/helpers/pluralize.js +++ b/ui/app/helpers/pluralize.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Helper } = Ember; +import Helper from '@ember/component/helper'; export function pluralize([term, count]) { return count === 1 ? term : term.pluralize(); diff --git a/ui/app/helpers/x-icon.js b/ui/app/helpers/x-icon.js index d3c670e54..f53a50543 100644 --- a/ui/app/helpers/x-icon.js +++ b/ui/app/helpers/x-icon.js @@ -1,4 +1,4 @@ -import Ember from 'ember'; +import { helper } from '@ember/component/helper'; import { inlineSvg } from 'ember-inline-svg/helpers/inline-svg'; // Generated at compile-time by ember-inline-svg @@ -18,4 +18,4 @@ export function xIcon(params, options) { return inlineSvg(SVGs, name, { class: classes }); } -export default Ember.Helper.helper(xIcon); +export default helper(xIcon); diff --git a/ui/app/mixins/searchable.js b/ui/app/mixins/searchable.js index 99a929eed..26557f75a 100644 --- a/ui/app/mixins/searchable.js +++ b/ui/app/mixins/searchable.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Mixin, computed, get } = Ember; +import Mixin from '@ember/object/mixin'; +import { get, computed } from '@ember/object'; /** Searchable mixin diff --git a/ui/app/mixins/sortable.js b/ui/app/mixins/sortable.js index 269075cd8..e6a78aaf9 100644 --- a/ui/app/mixins/sortable.js +++ b/ui/app/mixins/sortable.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Mixin, computed } = Ember; +import Mixin from '@ember/object/mixin'; +import { computed } from '@ember/object'; /** Sortable mixin diff --git a/ui/app/mixins/window-resizable.js b/ui/app/mixins/window-resizable.js index 3f3c5b7aa..6a7055bdf 100644 --- a/ui/app/mixins/window-resizable.js +++ b/ui/app/mixins/window-resizable.js @@ -1,8 +1,8 @@ -import Ember from 'ember'; +import Mixin from '@ember/object/mixin'; +import { run } from '@ember/runloop'; +import $ from 'jquery'; -const { run, $ } = Ember; - -export default Ember.Mixin.create({ +export default Mixin.create({ setupWindowResize: function() { run.scheduleOnce('afterRender', this, () => { this.set('_windowResizeHandler', this.get('windowResizeHandler').bind(this)); diff --git a/ui/app/mixins/with-forbidden-state.js b/ui/app/mixins/with-forbidden-state.js index 4b1397e09..85f27676a 100644 --- a/ui/app/mixins/with-forbidden-state.js +++ b/ui/app/mixins/with-forbidden-state.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Mixin } = Ember; +import Mixin from '@ember/object/mixin'; export default Mixin.create({ setupController(controller) { diff --git a/ui/app/mixins/with-model-error-handling.js b/ui/app/mixins/with-model-error-handling.js index 585c61595..484a80148 100644 --- a/ui/app/mixins/with-model-error-handling.js +++ b/ui/app/mixins/with-model-error-handling.js @@ -1,8 +1,6 @@ -import Ember from 'ember'; +import Mixin from '@ember/object/mixin'; import notifyError from 'nomad-ui/utils/notify-error'; -const { Mixin } = Ember; - export default Mixin.create({ model() { return this._super(...arguments).catch(notifyError(this)); diff --git a/ui/app/mixins/with-namespace-resetting.js b/ui/app/mixins/with-namespace-resetting.js index c40407568..ab57f3e3e 100644 --- a/ui/app/mixins/with-namespace-resetting.js +++ b/ui/app/mixins/with-namespace-resetting.js @@ -1,10 +1,10 @@ -import Ember from 'ember'; - -const { Mixin, inject } = Ember; +import { inject as controller } from '@ember/controller'; +import { inject as service } from '@ember/service'; +import Mixin from '@ember/object/mixin'; export default Mixin.create({ - system: inject.service(), - jobsController: inject.controller('jobs'), + system: service(), + jobsController: controller('jobs'), actions: { gotoJobs(namespace) { diff --git a/ui/app/models/agent.js b/ui/app/models/agent.js index aea6c7ee5..63bd7d2b0 100644 --- a/ui/app/models/agent.js +++ b/ui/app/models/agent.js @@ -1,11 +1,10 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import { computed } from '@ember/object'; import Model from 'ember-data/model'; import attr from 'ember-data/attr'; -const { computed, inject } = Ember; - export default Model.extend({ - system: inject.service(), + system: service(), name: attr('string'), address: attr('string'), diff --git a/ui/app/models/allocation.js b/ui/app/models/allocation.js index 6cf164a41..617c1d3f7 100644 --- a/ui/app/models/allocation.js +++ b/ui/app/models/allocation.js @@ -1,4 +1,7 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import { readOnly } from '@ember/object/computed'; +import { computed } from '@ember/object'; +import RSVP from 'rsvp'; import Model from 'ember-data/model'; import attr from 'ember-data/attr'; import { belongsTo } from 'ember-data/relationships'; @@ -7,8 +10,6 @@ import PromiseObject from '../utils/classes/promise-object'; import timeout from '../utils/timeout'; import shortUUIDProperty from '../utils/properties/short-uuid'; -const { computed, RSVP, inject } = Ember; - const STATUS_ORDER = { pending: 1, running: 2, @@ -18,7 +19,7 @@ const STATUS_ORDER = { }; export default Model.extend({ - token: inject.service(), + token: service(), shortId: shortUUIDProperty('id'), job: belongsTo('job'), @@ -56,7 +57,7 @@ export default Model.extend({ return taskGroups && taskGroups.findBy('name', this.get('taskGroupName')); }), - memoryUsed: computed.readOnly('stats.ResourceUsage.MemoryStats.RSS'), + memoryUsed: readOnly('stats.ResourceUsage.MemoryStats.RSS'), cpuUsed: computed('stats.ResourceUsage.CpuStats.TotalTicks', function() { return Math.floor(this.get('stats.ResourceUsage.CpuStats.TotalTicks') || 0); }), diff --git a/ui/app/models/deployment.js b/ui/app/models/deployment.js index 2a952afb7..02dfb4c81 100644 --- a/ui/app/models/deployment.js +++ b/ui/app/models/deployment.js @@ -1,4 +1,5 @@ -import Ember from 'ember'; +import { alias } from '@ember/object/computed'; +import { computed } from '@ember/object'; import Model from 'ember-data/model'; import attr from 'ember-data/attr'; import { belongsTo, hasMany } from 'ember-data/relationships'; @@ -6,8 +7,6 @@ import { fragmentArray } from 'ember-data-model-fragments/attributes'; import shortUUIDProperty from '../utils/properties/short-uuid'; import sumAggregation from '../utils/properties/sum-aggregation'; -const { computed } = Ember; - export default Model.extend({ shortId: shortUUIDProperty('id'), @@ -34,6 +33,9 @@ export default Model.extend({ return (this.get('job.versions') || []).findBy('number', this.get('versionNumber')); }), + // Dependent keys can only go one level past an @each so an alias is needed + versionSubmitTime: alias('version.submitTime'), + placedCanaries: sumAggregation('taskGroupSummaries', 'placedCanaries'), desiredCanaries: sumAggregation('taskGroupSummaries', 'desiredCanaries'), desiredTotal: sumAggregation('taskGroupSummaries', 'desiredTotal'), diff --git a/ui/app/models/evaluation.js b/ui/app/models/evaluation.js index 8afdf15ae..5fcb3550a 100644 --- a/ui/app/models/evaluation.js +++ b/ui/app/models/evaluation.js @@ -1,12 +1,10 @@ -import Ember from 'ember'; +import { bool } from '@ember/object/computed'; import Model from 'ember-data/model'; import attr from 'ember-data/attr'; import { belongsTo } from 'ember-data/relationships'; import { fragmentArray } from 'ember-data-model-fragments/attributes'; import shortUUIDProperty from '../utils/properties/short-uuid'; -const { computed } = Ember; - export default Model.extend({ shortId: shortUUIDProperty('id'), priority: attr('number'), @@ -16,7 +14,7 @@ export default Model.extend({ statusDescription: attr('string'), failedTGAllocs: fragmentArray('placement-failure', { defaultValue: () => [] }), - hasPlacementFailures: computed.bool('failedTGAllocs.length'), + hasPlacementFailures: bool('failedTGAllocs.length'), // TEMPORARY: https://github.com/emberjs/data/issues/5209 originalJobId: attr('string'), diff --git a/ui/app/models/job.js b/ui/app/models/job.js index 4f33983ac..511f89856 100644 --- a/ui/app/models/job.js +++ b/ui/app/models/job.js @@ -1,12 +1,11 @@ -import Ember from 'ember'; +import { collect, sum, bool, equal } from '@ember/object/computed'; +import { computed } from '@ember/object'; import Model from 'ember-data/model'; import attr from 'ember-data/attr'; import { belongsTo, hasMany } from 'ember-data/relationships'; import { fragmentArray } from 'ember-data-model-fragments/attributes'; import sumAggregation from '../utils/properties/sum-aggregation'; -const { computed } = Ember; - export default Model.extend({ region: attr('string'), name: attr('string'), @@ -35,7 +34,7 @@ export default Model.extend({ failedAllocs: sumAggregation('taskGroupSummaries', 'failedAllocs'), lostAllocs: sumAggregation('taskGroupSummaries', 'lostAllocs'), - allocsList: computed.collect( + allocsList: collect( 'queuedAllocs', 'startingAllocs', 'runningAllocs', @@ -44,7 +43,7 @@ export default Model.extend({ 'lostAllocs' ), - totalAllocs: computed.sum('allocsList'), + totalAllocs: sum('allocsList'), pendingChildren: attr('number'), runningChildren: attr('number'), @@ -56,7 +55,7 @@ export default Model.extend({ evaluations: hasMany('evaluations'), namespace: belongsTo('namespace'), - hasPlacementFailures: computed.bool('latestFailureEvaluation'), + hasPlacementFailures: bool('latestFailureEvaluation'), latestEvaluation: computed('evaluations.@each.modifyIndex', 'evaluations.isPending', function() { const evaluations = this.get('evaluations'); @@ -82,7 +81,7 @@ export default Model.extend({ } ), - supportsDeployments: computed.equal('type', 'service'), + supportsDeployments: equal('type', 'service'), runningDeployment: computed('deployments.@each.status', function() { return this.get('deployments').findBy('status', 'running'); diff --git a/ui/app/models/namespace.js b/ui/app/models/namespace.js index 7b05135e8..b5b5f5750 100644 --- a/ui/app/models/namespace.js +++ b/ui/app/models/namespace.js @@ -1,11 +1,9 @@ -import Ember from 'ember'; +import { readOnly } from '@ember/object/computed'; import Model from 'ember-data/model'; import attr from 'ember-data/attr'; -const { computed } = Ember; - export default Model.extend({ - name: computed.readOnly('id'), + name: readOnly('id'), hash: attr('string'), description: attr('string'), }); diff --git a/ui/app/models/node-attributes.js b/ui/app/models/node-attributes.js index 6bfaba7ca..c893d8500 100644 --- a/ui/app/models/node-attributes.js +++ b/ui/app/models/node-attributes.js @@ -1,9 +1,8 @@ -import Ember from 'ember'; +import { get, computed } from '@ember/object'; import attr from 'ember-data/attr'; import Fragment from 'ember-data-model-fragments/fragment'; import flat from 'npm:flat'; -const { computed, get } = Ember; const { unflatten } = flat; export default Fragment.extend({ @@ -12,10 +11,12 @@ export default Fragment.extend({ attributesStructured: computed('attributes', function() { // `unflatten` doesn't sort keys before unflattening, so manual preprocessing is necessary. const original = this.get('attributes'); - const attrs = Object.keys(original).sort().reduce((obj, key) => { - obj[key] = original[key]; - return obj; - }, {}); + const attrs = Object.keys(original) + .sort() + .reduce((obj, key) => { + obj[key] = original[key]; + return obj; + }, {}); return unflatten(attrs, { overwrite: true }); }), diff --git a/ui/app/models/node.js b/ui/app/models/node.js index 6966acfb9..56e489e1d 100644 --- a/ui/app/models/node.js +++ b/ui/app/models/node.js @@ -1,4 +1,4 @@ -import Ember from 'ember'; +import { computed } from '@ember/object'; import Model from 'ember-data/model'; import attr from 'ember-data/attr'; import { hasMany } from 'ember-data/relationships'; @@ -6,8 +6,6 @@ import { fragment } from 'ember-data-model-fragments/attributes'; import shortUUIDProperty from '../utils/properties/short-uuid'; import ipParts from '../utils/ip-parts'; -const { computed } = Ember; - export default Model.extend({ // Available from list response name: attr('string'), diff --git a/ui/app/models/task-event.js b/ui/app/models/task-event.js index 1a26daadc..3d6f464f3 100644 --- a/ui/app/models/task-event.js +++ b/ui/app/models/task-event.js @@ -1,10 +1,9 @@ -import Ember from 'ember'; +import { computed } from '@ember/object'; import Fragment from 'ember-data-model-fragments/fragment'; import attr from 'ember-data/attr'; import { fragmentOwner } from 'ember-data-model-fragments/attributes'; import moment from 'moment'; -const { computed } = Ember; const displayProps = [ 'message', 'validationError', diff --git a/ui/app/models/task-group-deployment-summary.js b/ui/app/models/task-group-deployment-summary.js index 9a6b0eab3..9d5c04035 100644 --- a/ui/app/models/task-group-deployment-summary.js +++ b/ui/app/models/task-group-deployment-summary.js @@ -1,10 +1,8 @@ -import Ember from 'ember'; +import { gt } from '@ember/object/computed'; import Fragment from 'ember-data-model-fragments/fragment'; import attr from 'ember-data/attr'; import { fragmentOwner } from 'ember-data-model-fragments/attributes'; -const { computed } = Ember; - export default Fragment.extend({ deployment: fragmentOwner(), @@ -12,7 +10,7 @@ export default Fragment.extend({ autoRevert: attr('boolean'), promoted: attr('boolean'), - requiresPromotion: computed.gt('desiredCanaries', 0), + requiresPromotion: gt('desiredCanaries', 0), placedCanaries: attr('number'), desiredCanaries: attr('number'), diff --git a/ui/app/models/task-group-summary.js b/ui/app/models/task-group-summary.js index 5d937f73b..9e713b8ab 100644 --- a/ui/app/models/task-group-summary.js +++ b/ui/app/models/task-group-summary.js @@ -1,10 +1,8 @@ -import Ember from 'ember'; +import { collect, sum } from '@ember/object/computed'; import Fragment from 'ember-data-model-fragments/fragment'; import attr from 'ember-data/attr'; import { fragmentOwner } from 'ember-data-model-fragments/attributes'; -const { computed } = Ember; - export default Fragment.extend({ job: fragmentOwner(), name: attr('string'), @@ -16,7 +14,7 @@ export default Fragment.extend({ failedAllocs: attr('number'), lostAllocs: attr('number'), - allocsList: computed.collect( + allocsList: collect( 'queuedAllocs', 'startingAllocs', 'runningAllocs', @@ -25,5 +23,5 @@ export default Fragment.extend({ 'lostAllocs' ), - totalAllocs: computed.sum('allocsList'), + totalAllocs: sum('allocsList'), }); diff --git a/ui/app/models/task-group.js b/ui/app/models/task-group.js index b3998a4cd..e5ea67d0e 100644 --- a/ui/app/models/task-group.js +++ b/ui/app/models/task-group.js @@ -1,11 +1,9 @@ -import Ember from 'ember'; +import { computed } from '@ember/object'; import Fragment from 'ember-data-model-fragments/fragment'; import attr from 'ember-data/attr'; import { fragmentOwner, fragmentArray } from 'ember-data-model-fragments/attributes'; import sumAggregation from '../utils/properties/sum-aggregation'; -const { computed } = Ember; - export default Fragment.extend({ job: fragmentOwner(), diff --git a/ui/app/models/task-state.js b/ui/app/models/task-state.js index a5b3bff22..217e87459 100644 --- a/ui/app/models/task-state.js +++ b/ui/app/models/task-state.js @@ -1,10 +1,9 @@ -import Ember from 'ember'; +import { none } from '@ember/object/computed'; +import { computed } from '@ember/object'; import Fragment from 'ember-data-model-fragments/fragment'; import attr from 'ember-data/attr'; import { fragment, fragmentOwner, fragmentArray } from 'ember-data-model-fragments/attributes'; -const { computed } = Ember; - export default Fragment.extend({ name: attr('string'), state: attr('string'), @@ -12,7 +11,7 @@ export default Fragment.extend({ finishedAt: attr('date'), failed: attr('boolean'), - isActive: computed.none('finishedAt'), + isActive: none('finishedAt'), allocation: fragmentOwner(), task: computed('allocation.taskGroup.tasks.[]', function() { diff --git a/ui/app/models/token.js b/ui/app/models/token.js index 07243dd8a..37db199ae 100644 --- a/ui/app/models/token.js +++ b/ui/app/models/token.js @@ -1,10 +1,8 @@ -import Ember from 'ember'; +import { alias } from '@ember/object/computed'; import Model from 'ember-data/model'; import attr from 'ember-data/attr'; import { hasMany } from 'ember-data/relationships'; -const { computed } = Ember; - export default Model.extend({ secret: attr('string'), name: attr('string'), @@ -14,5 +12,5 @@ export default Model.extend({ policies: hasMany('policy'), policyNames: attr(), - accessor: computed.alias('id'), + accessor: alias('id'), }); diff --git a/ui/app/router.js b/ui/app/router.js index bddf8813d..494a2173d 100644 --- a/ui/app/router.js +++ b/ui/app/router.js @@ -1,7 +1,7 @@ -import Ember from 'ember'; +import EmberRouter from '@ember/routing/router'; import config from './config/environment'; -const Router = Ember.Router.extend({ +const Router = EmberRouter.extend({ location: config.locationType, rootURL: config.rootURL, }); diff --git a/ui/app/routes/allocations/allocation.js b/ui/app/routes/allocations/allocation.js index 60eff663b..17aa8b10c 100644 --- a/ui/app/routes/allocations/allocation.js +++ b/ui/app/routes/allocations/allocation.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; +import Route from '@ember/routing/route'; import WithModelErrorHandling from 'nomad-ui/mixins/with-model-error-handling'; -const { Route } = Ember; - export default Route.extend(WithModelErrorHandling); diff --git a/ui/app/routes/allocations/allocation/task.js b/ui/app/routes/allocations/allocation/task.js index 4a57f1ad2..dcf2bda10 100644 --- a/ui/app/routes/allocations/allocation/task.js +++ b/ui/app/routes/allocations/allocation/task.js @@ -1,9 +1,9 @@ -import Ember from 'ember'; - -const { Route, inject, Error: EmberError } = Ember; +import { inject as service } from '@ember/service'; +import Route from '@ember/routing/route'; +import EmberError from '@ember/error'; export default Route.extend({ - store: inject.service(), + store: service(), model({ name }) { const allocation = this.modelFor('allocations.allocation'); diff --git a/ui/app/routes/allocations/allocation/task/logs.js b/ui/app/routes/allocations/allocation/task/logs.js index 5e4767eb5..399258f21 100644 --- a/ui/app/routes/allocations/allocation/task/logs.js +++ b/ui/app/routes/allocations/allocation/task/logs.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Route } = Ember; +import Route from '@ember/routing/route'; export default Route.extend({ model() { diff --git a/ui/app/routes/application.js b/ui/app/routes/application.js index 0a2e57c39..f7437a18c 100644 --- a/ui/app/routes/application.js +++ b/ui/app/routes/application.js @@ -1,9 +1,8 @@ -import Ember from 'ember'; - -const { Route, inject } = Ember; +import { inject as service } from '@ember/service'; +import Route from '@ember/routing/route'; export default Route.extend({ - config: inject.service(), + config: service(), resetController(controller, isExiting) { if (isExiting) { diff --git a/ui/app/routes/clients.js b/ui/app/routes/clients.js index f2915a3a9..49559c8c9 100644 --- a/ui/app/routes/clients.js +++ b/ui/app/routes/clients.js @@ -1,12 +1,12 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import Route from '@ember/routing/route'; +import RSVP from 'rsvp'; import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state'; import notifyForbidden from 'nomad-ui/utils/notify-forbidden'; -const { Route, inject, RSVP } = Ember; - export default Route.extend(WithForbiddenState, { - store: inject.service(), - system: inject.service(), + store: service(), + system: service(), beforeModel() { return this.get('system.leader'); diff --git a/ui/app/routes/clients/client.js b/ui/app/routes/clients/client.js index 9571d975a..1be621e47 100644 --- a/ui/app/routes/clients/client.js +++ b/ui/app/routes/clients/client.js @@ -1,10 +1,9 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import Route from '@ember/routing/route'; import notifyError from 'nomad-ui/utils/notify-error'; -const { Route, inject } = Ember; - export default Route.extend({ - store: inject.service(), + store: service(), model() { return this._super(...arguments).catch(notifyError(this)); diff --git a/ui/app/routes/freestyle.js b/ui/app/routes/freestyle.js new file mode 100644 index 000000000..21534ffe7 --- /dev/null +++ b/ui/app/routes/freestyle.js @@ -0,0 +1,18 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; +import RSVP from 'rsvp'; + +export default Route.extend({ + emberFreestyle: service(), + + beforeModel() { + let emberFreestyle = this.get('emberFreestyle'); + + return emberFreestyle.ensureHljs().then(() => { + return RSVP.all([ + emberFreestyle.ensureHljsLanguage('handlebars'), + emberFreestyle.ensureHljsLanguage('htmlbars'), + ]); + }); + }, +}); diff --git a/ui/app/routes/index.js b/ui/app/routes/index.js index f07c338c8..7de6fff38 100644 --- a/ui/app/routes/index.js +++ b/ui/app/routes/index.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Route } = Ember; +import Route from '@ember/routing/route'; export default Route.extend({ redirect() { diff --git a/ui/app/routes/jobs.js b/ui/app/routes/jobs.js index 9d51a55b6..745e326e2 100644 --- a/ui/app/routes/jobs.js +++ b/ui/app/routes/jobs.js @@ -1,12 +1,12 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import Route from '@ember/routing/route'; +import { run } from '@ember/runloop'; import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state'; import notifyForbidden from 'nomad-ui/utils/notify-forbidden'; -const { Route, inject, run } = Ember; - export default Route.extend(WithForbiddenState, { - system: inject.service(), - store: inject.service(), + system: service(), + store: service(), beforeModel() { return this.get('system.namespaces'); diff --git a/ui/app/routes/jobs/index.js b/ui/app/routes/jobs/index.js index 8962abd90..0a8317fea 100644 --- a/ui/app/routes/jobs/index.js +++ b/ui/app/routes/jobs/index.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Route } = Ember; +import Route from '@ember/routing/route'; export default Route.extend({ actions: { diff --git a/ui/app/routes/jobs/job.js b/ui/app/routes/jobs/job.js index 4317a1e35..558ea55e4 100644 --- a/ui/app/routes/jobs/job.js +++ b/ui/app/routes/jobs/job.js @@ -1,10 +1,10 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import Route from '@ember/routing/route'; +import RSVP from 'rsvp'; import notifyError from 'nomad-ui/utils/notify-error'; -const { Route, RSVP, inject } = Ember; - export default Route.extend({ - store: inject.service(), + store: service(), serialize(model) { return { job_name: model.get('plainId') }; @@ -13,7 +13,7 @@ export default Route.extend({ model(params, transition) { const namespace = transition.queryParams.namespace || this.get('system.activeNamespace.id'); const name = params.job_name; - const fullId = JSON.stringify([name, namespace]); + const fullId = JSON.stringify([name, namespace || 'default']); return this.get('store') .findRecord('job', fullId, { reload: true }) .then(job => { diff --git a/ui/app/routes/jobs/job/definition.js b/ui/app/routes/jobs/job/definition.js index 4f24dbc60..8730f83b8 100644 --- a/ui/app/routes/jobs/job/definition.js +++ b/ui/app/routes/jobs/job/definition.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Route } = Ember; +import Route from '@ember/routing/route'; export default Route.extend({ model() { diff --git a/ui/app/routes/jobs/job/deployments.js b/ui/app/routes/jobs/job/deployments.js index a048c898a..41363eff6 100644 --- a/ui/app/routes/jobs/job/deployments.js +++ b/ui/app/routes/jobs/job/deployments.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Route, RSVP } = Ember; +import Route from '@ember/routing/route'; +import RSVP from 'rsvp'; export default Route.extend({ model() { diff --git a/ui/app/routes/jobs/job/task-group.js b/ui/app/routes/jobs/job/task-group.js index 2be6107ab..def6e57ea 100644 --- a/ui/app/routes/jobs/job/task-group.js +++ b/ui/app/routes/jobs/job/task-group.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Route } = Ember; +import Route from '@ember/routing/route'; export default Route.extend({ model({ name }) { diff --git a/ui/app/routes/jobs/job/versions.js b/ui/app/routes/jobs/job/versions.js index 637d663c3..6debc85db 100644 --- a/ui/app/routes/jobs/job/versions.js +++ b/ui/app/routes/jobs/job/versions.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; - -const { Route } = Ember; +import Route from '@ember/routing/route'; export default Route.extend({ model() { diff --git a/ui/app/routes/not-found.js b/ui/app/routes/not-found.js index 1974ee9ba..a7df89c01 100644 --- a/ui/app/routes/not-found.js +++ b/ui/app/routes/not-found.js @@ -1,6 +1,5 @@ -import Ember from 'ember'; - -const { Route, Error: EmberError } = Ember; +import Route from '@ember/routing/route'; +import EmberError from '@ember/error'; export default Route.extend({ model() { diff --git a/ui/app/routes/servers.js b/ui/app/routes/servers.js index f2915a3a9..49559c8c9 100644 --- a/ui/app/routes/servers.js +++ b/ui/app/routes/servers.js @@ -1,12 +1,12 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import Route from '@ember/routing/route'; +import RSVP from 'rsvp'; import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state'; import notifyForbidden from 'nomad-ui/utils/notify-forbidden'; -const { Route, inject, RSVP } = Ember; - export default Route.extend(WithForbiddenState, { - store: inject.service(), - system: inject.service(), + store: service(), + system: service(), beforeModel() { return this.get('system.leader'); diff --git a/ui/app/routes/servers/server.js b/ui/app/routes/servers/server.js index 60eff663b..17aa8b10c 100644 --- a/ui/app/routes/servers/server.js +++ b/ui/app/routes/servers/server.js @@ -1,6 +1,4 @@ -import Ember from 'ember'; +import Route from '@ember/routing/route'; import WithModelErrorHandling from 'nomad-ui/mixins/with-model-error-handling'; -const { Route } = Ember; - export default Route.extend(WithModelErrorHandling); diff --git a/ui/app/serializers/allocation.js b/ui/app/serializers/allocation.js index 33cb3ebf5..8a7a5d43b 100644 --- a/ui/app/serializers/allocation.js +++ b/ui/app/serializers/allocation.js @@ -1,10 +1,9 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import { get } from '@ember/object'; import ApplicationSerializer from './application'; -const { get, inject } = Ember; - export default ApplicationSerializer.extend({ - system: inject.service(), + system: service(), attrs: { taskGroupName: 'TaskGroup', diff --git a/ui/app/serializers/application.js b/ui/app/serializers/application.js index bdec30fc1..3d63f5b63 100644 --- a/ui/app/serializers/application.js +++ b/ui/app/serializers/application.js @@ -1,8 +1,6 @@ -import Ember from 'ember'; +import { makeArray } from '@ember/array'; import JSONSerializer from 'ember-data/serializers/json'; -const { makeArray } = Ember; - export default JSONSerializer.extend({ primaryKey: 'ID', diff --git a/ui/app/serializers/deployment.js b/ui/app/serializers/deployment.js index 04e5475a0..2a21f484e 100644 --- a/ui/app/serializers/deployment.js +++ b/ui/app/serializers/deployment.js @@ -1,8 +1,7 @@ -import Ember from 'ember'; +import { get } from '@ember/object'; +import { assign } from '@ember/polyfills'; import ApplicationSerializer from './application'; -const { get, assign } = Ember; - export default ApplicationSerializer.extend({ attrs: { versionNumber: 'JobVersion', diff --git a/ui/app/serializers/evaluation.js b/ui/app/serializers/evaluation.js index 76a2b9b3c..e5faad410 100644 --- a/ui/app/serializers/evaluation.js +++ b/ui/app/serializers/evaluation.js @@ -1,10 +1,10 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; +import { get } from '@ember/object'; +import { assign } from '@ember/polyfills'; import ApplicationSerializer from './application'; -const { inject, get, assign } = Ember; - export default ApplicationSerializer.extend({ - system: inject.service(), + system: service(), normalize(typeHash, hash) { hash.FailedTGAllocs = Object.keys(hash.FailedTGAllocs || {}).map(key => { diff --git a/ui/app/serializers/job-version.js b/ui/app/serializers/job-version.js index 490b6d740..f05809b3f 100644 --- a/ui/app/serializers/job-version.js +++ b/ui/app/serializers/job-version.js @@ -1,8 +1,6 @@ -import Ember from 'ember'; +import { assign } from '@ember/polyfills'; import ApplicationSerializer from './application'; -const { assign } = Ember; - export default ApplicationSerializer.extend({ attrs: { number: 'Version', diff --git a/ui/app/serializers/job.js b/ui/app/serializers/job.js index 74eeb78b0..e09c95cd8 100644 --- a/ui/app/serializers/job.js +++ b/ui/app/serializers/job.js @@ -1,9 +1,8 @@ -import Ember from 'ember'; +import { get } from '@ember/object'; +import { assign } from '@ember/polyfills'; import ApplicationSerializer from './application'; import queryString from 'npm:query-string'; -const { get, assign } = Ember; - export default ApplicationSerializer.extend({ attrs: { parameterized: 'ParameterizedJob', diff --git a/ui/app/serializers/node.js b/ui/app/serializers/node.js index 376f15d12..e0ecfc9a7 100644 --- a/ui/app/serializers/node.js +++ b/ui/app/serializers/node.js @@ -1,10 +1,8 @@ -import Ember from 'ember'; +import { inject as service } from '@ember/service'; import ApplicationSerializer from './application'; -const { inject } = Ember; - export default ApplicationSerializer.extend({ - config: inject.service(), + config: service(), attrs: { httpAddr: 'HTTPAddr', diff --git a/ui/app/serializers/task-group.js b/ui/app/serializers/task-group.js index 107ddf11e..a834250c9 100644 --- a/ui/app/serializers/task-group.js +++ b/ui/app/serializers/task-group.js @@ -1,8 +1,6 @@ -import Ember from 'ember'; +import { copy } from '@ember/object/internals'; import ApplicationSerializer from './application'; -const { copy } = Ember; - export default ApplicationSerializer.extend({ normalize(typeHash, hash) { // Provide EphemeralDisk to each task diff --git a/ui/app/serializers/token.js b/ui/app/serializers/token.js index ede185aed..7ac46e611 100644 --- a/ui/app/serializers/token.js +++ b/ui/app/serializers/token.js @@ -1,8 +1,6 @@ -import Ember from 'ember'; +import { copy } from '@ember/object/internals'; import ApplicationSerializer from './application'; -const { copy } = Ember; - export default ApplicationSerializer.extend({ primaryKey: 'AccessorID', diff --git a/ui/app/services/config.js b/ui/app/services/config.js index 2c586d97c..80e38e1ea 100644 --- a/ui/app/services/config.js +++ b/ui/app/services/config.js @@ -1,14 +1,14 @@ -import Ember from 'ember'; +import { equal } from '@ember/object/computed'; +import Service from '@ember/service'; +import { get } from '@ember/object'; import config from '../config/environment'; -const { Service, get, computed } = Ember; - export default Service.extend({ unknownProperty(path) { return get(config, path); }, - isDev: computed.equal('environment', 'development'), - isProd: computed.equal('environment', 'production'), - isTest: computed.equal('environment', 'test'), + isDev: equal('environment', 'development'), + isProd: equal('environment', 'production'), + isTest: equal('environment', 'test'), }); diff --git a/ui/app/services/ember-freestyle.js b/ui/app/services/ember-freestyle.js index fa276c8d9..a30217765 100644 --- a/ui/app/services/ember-freestyle.js +++ b/ui/app/services/ember-freestyle.js @@ -1,5 +1,5 @@ import EmberFreestyle from 'ember-freestyle/services/ember-freestyle'; export default EmberFreestyle.extend({ - defaultTheme: 'monokai-sublime', + defaultTheme: 'solarized-light', }); diff --git a/ui/app/services/system.js b/ui/app/services/system.js index 111e3bfc2..558b411a9 100644 --- a/ui/app/services/system.js +++ b/ui/app/services/system.js @@ -1,12 +1,11 @@ -import Ember from 'ember'; +import Service, { inject as service } from '@ember/service'; +import { computed } from '@ember/object'; import PromiseObject from '../utils/classes/promise-object'; import { namespace } from '../adapters/application'; -const { Service, computed, inject } = Ember; - export default Service.extend({ - token: inject.service(), - store: inject.service(), + token: service(), + store: service(), leader: computed(function() { const token = this.get('token'); diff --git a/ui/app/services/token.js b/ui/app/services/token.js index d51d7510b..4ce27d9c3 100644 --- a/ui/app/services/token.js +++ b/ui/app/services/token.js @@ -1,8 +1,8 @@ -import Ember from 'ember'; +import Service from '@ember/service'; +import { computed } from '@ember/object'; +import { assign } from '@ember/polyfills'; import fetch from 'nomad-ui/utils/fetch'; -const { Service, computed, assign } = Ember; - export default Service.extend({ secret: computed({ get() { diff --git a/ui/app/styles/app.scss b/ui/app/styles/app.scss index 444a30182..952709aee 100644 --- a/ui/app/styles/app.scss +++ b/ui/app/styles/app.scss @@ -1,5 +1,8 @@ -@import "./core"; -@import "./components"; -@import "./charts"; +@import './core'; +@import './components'; +@import './charts'; -@import "ember-power-select"; +@import 'ember-power-select'; + +// Only necessary in dev +@import './styleguide.scss'; diff --git a/ui/app/styles/charts/colors.scss b/ui/app/styles/charts/colors.scss index 4f3c6335f..e204c723f 100644 --- a/ui/app/styles/charts/colors.scss +++ b/ui/app/styles/charts/colors.scss @@ -10,7 +10,8 @@ $lost: $dark; fill: $queued; } - .starting, .pending { + .starting, + .pending { .layer-0 { fill: $starting; } @@ -58,7 +59,8 @@ $lost: $dark; background: $queued; } - &.starting, &.pending { + &.starting, + &.pending { background: repeating-linear-gradient( -45deg, $starting, diff --git a/ui/app/styles/charts/distribution-bar.scss b/ui/app/styles/charts/distribution-bar.scss index a59c041fb..fcd4a7824 100644 --- a/ui/app/styles/charts/distribution-bar.scss +++ b/ui/app/styles/charts/distribution-bar.scss @@ -21,8 +21,7 @@ opacity: 0; } - $color-sequence: $orange, $yellow, $green, $turquoise, $blue, $purple, - $red; + $color-sequence: $orange, $yellow, $green, $turquoise, $blue, $purple, $red; @for $i from 1 through length($color-sequence) { .slice-#{$i - 1} { diff --git a/ui/app/styles/charts/tooltip.scss b/ui/app/styles/charts/tooltip.scss index c8e17f908..580e0ab3b 100644 --- a/ui/app/styles/charts/tooltip.scss +++ b/ui/app/styles/charts/tooltip.scss @@ -18,7 +18,7 @@ &::before { pointer-events: none; display: inline-block; - content: ""; + content: ''; width: 0; height: 0; border-top: 7px solid $grey; @@ -34,7 +34,7 @@ &::after { pointer-events: none; display: inline-block; - content: ""; + content: ''; width: 0; height: 0; border-top: 6px solid $white; diff --git a/ui/app/styles/components.scss b/ui/app/styles/components.scss index cb2162c2f..afd92f4e0 100644 --- a/ui/app/styles/components.scss +++ b/ui/app/styles/components.scss @@ -1,6 +1,5 @@ @import "./components/badge"; @import "./components/boxed-section"; -@import "./components/breadcrumbs"; @import "./components/cli-window"; @import "./components/ember-power-select"; @import "./components/empty-message"; @@ -12,6 +11,7 @@ @import "./components/loading-spinner"; @import "./components/metrics"; @import "./components/node-status-light"; +@import "./components/page-layout"; @import "./components/simple-list"; @import "./components/status-text"; @import "./components/timeline"; diff --git a/ui/app/styles/components/breadcrumbs.scss b/ui/app/styles/components/breadcrumbs.scss deleted file mode 100644 index c3ec634a6..000000000 --- a/ui/app/styles/components/breadcrumbs.scss +++ /dev/null @@ -1,26 +0,0 @@ -.breadcrumbs { - .breadcrumb { - color: $white; - opacity: 0.7; - text-decoration: none; - - + .breadcrumb { - margin-left: 15px; - &::before { - content: "/"; - color: $primary; - position: relative; - left: -7px; - } - } - - &:last-child { - opacity: 1; - } - } - - a.breadcrumb:hover { - color: $primary-invert; - opacity: 1; - } -} diff --git a/ui/app/styles/components/json-viewer.scss b/ui/app/styles/components/json-viewer.scss index dd215bc97..4c6b1431f 100644 --- a/ui/app/styles/components/json-viewer.scss +++ b/ui/app/styles/components/json-viewer.scss @@ -13,7 +13,9 @@ $url-color: blue ) { font-family: monospace; - &, a, a:hover { + &, + a, + a:hover { color: $default-color; text-decoration: none; } @@ -31,10 +33,10 @@ display: none; } &.json-formatter-object:after { - content: "No properties"; + content: 'No properties'; } &.json-formatter-array:after { - content: "[]"; + content: '[]'; } } } @@ -100,7 +102,7 @@ // Inline preview on hover (optional) > a > .json-formatter-preview-text { opacity: 0; - transition: opacity .15s ease-in; + transition: opacity 0.15s ease-in; font-style: italic; } diff --git a/ui/app/styles/core/page-layout.scss b/ui/app/styles/components/page-layout.scss similarity index 92% rename from ui/app/styles/core/page-layout.scss rename to ui/app/styles/components/page-layout.scss index 26c8de78e..d463be113 100644 --- a/ui/app/styles/core/page-layout.scss +++ b/ui/app/styles/components/page-layout.scss @@ -1,8 +1,3 @@ -html, body, body > .ember-view { - height: 100%; - width: 100%; -} - .page-layout { height: 100%; display: flex; diff --git a/ui/app/styles/components/timeline.scss b/ui/app/styles/components/timeline.scss index bc3ab077a..553257c6c 100644 --- a/ui/app/styles/components/timeline.scss +++ b/ui/app/styles/components/timeline.scss @@ -4,7 +4,7 @@ z-index: $z-base; &::before { - content: " "; + content: ' '; position: absolute; display: block; top: 0; @@ -32,7 +32,7 @@ } &::before { - content: " "; + content: ' '; position: absolute; display: block; width: 10px; diff --git a/ui/app/styles/components/tooltip.scss b/ui/app/styles/components/tooltip.scss index bcb851033..68842c133 100644 --- a/ui/app/styles/components/tooltip.scss +++ b/ui/app/styles/components/tooltip.scss @@ -31,7 +31,7 @@ pointer-events: none; display: block; opacity: 0; - content: ""; + content: ''; width: 0; height: 0; border-top: 6px solid $black; diff --git a/ui/app/styles/core.scss b/ui/app/styles/core.scss index 3021d6be0..e4391415b 100644 --- a/ui/app/styles/core.scss +++ b/ui/app/styles/core.scss @@ -1,60 +1,28 @@ // Utils +@import "./utils/reset.scss"; @import "./utils/z-indices"; +@import "./utils/product-colors"; +@import "./utils/bumper"; // Start with Bulma variables as a foundation @import "bulma/sass/utilities/initial-variables"; // Override variables where appropriate -@import "./utils/product-colors"; - -$orange: #fa8e23; -$green: #2eb039; -$blue: $vagrant-blue; -$purple: $terraform-purple; -$red: #c84034; -$grey-blue: #bbc4d1; - -$primary: $nomad-green; -$warning: $orange; -$warning-invert: $white; -$danger: $red; -$dark: #234; - -$radius: 2px; - -$body-size: 14px; -$title-size: 1.75rem; -$size-5: 1.15rem; -$size-4: 1.3rem; -$size-7: 0.85rem; - -$title-weight: $weight-semibold; - -$family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, - Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; - -$text: $black; - -$header-height: 112px; -$gutter-width: 250px; - -$icon-dimensions: 1.25rem; -$icon-dimensions-small: 1rem; -$icon-dimensions-medium: 1.5rem; -$icon-dimensions-large: 2.5rem; +@import "./core/variables.scss"; // Bring in the rest of Bulma @import "bulma/bulma"; // Override Bulma details where appropriate @import "./core/buttons"; +@import "./core/breadcrumb"; @import "./core/columns"; @import "./core/forms"; @import "./core/icon"; @import "./core/level"; @import "./core/menu"; @import "./core/message"; -@import "./core/nav"; +@import "./core/navbar"; @import "./core/notification"; @import "./core/pagination"; @import "./core/progress"; @@ -64,7 +32,3 @@ $icon-dimensions-large: 2.5rem; @import "./core/tag"; @import "./core/title"; @import "./core/typography"; - -// Add unique core extensions -@import "./core/page-layout"; -@import "./core/bumper"; diff --git a/ui/app/styles/core/breadcrumb.scss b/ui/app/styles/core/breadcrumb.scss new file mode 100644 index 000000000..182decee3 --- /dev/null +++ b/ui/app/styles/core/breadcrumb.scss @@ -0,0 +1,15 @@ +.breadcrumb { + a { + text-decoration: none; + opacity: 0.7; + + &:hover { + text-decoration: none; + opacity: 1; + } + } + + li.is-active a { + opacity: 1; + } +} diff --git a/ui/app/styles/core/forms.scss b/ui/app/styles/core/forms.scss index 741dd892e..19ad29950 100644 --- a/ui/app/styles/core/forms.scss +++ b/ui/app/styles/core/forms.scss @@ -4,7 +4,12 @@ border-color: $grey-blue; color: $text; - &:hover, &.is-hovered, &:active, &.is-active, &:focus, &.is-focused { + &:hover, + &.is-hovered, + &:active, + &.is-active, + &:focus, + &.is-focused { border-color: darken($grey-blue, 5%); } @@ -14,7 +19,8 @@ } } -.input, .textarea { +.input, +.textarea { @include input; box-shadow: none; padding: 0.75em 1.5em; diff --git a/ui/app/styles/core/message.scss b/ui/app/styles/core/message.scss index b5e71e6b7..dba6ffa4b 100644 --- a/ui/app/styles/core/message.scss +++ b/ui/app/styles/core/message.scss @@ -1,8 +1,8 @@ .message { - background: $body-background; + background: $body-background-color; .message-header { - background: $body-background; + background: $body-background-color; color: $text; font-size: $size-5; font-weight: $weight-semibold; diff --git a/ui/app/styles/core/nav.scss b/ui/app/styles/core/navbar.scss similarity index 71% rename from ui/app/styles/core/nav.scss rename to ui/app/styles/core/navbar.scss index b1c6d6079..39232665d 100644 --- a/ui/app/styles/core/nav.scss +++ b/ui/app/styles/core/navbar.scss @@ -1,21 +1,18 @@ -.nav { +.navbar { &.is-primary { - background: linear-gradient( - to right, - $nomad-green-darker, - $nomad-green-dark - ); + background: linear-gradient(to right, $nomad-green-darker, $nomad-green-dark); height: 3.5rem; color: $primary-invert; padding-left: 20px; padding-right: 20px; - .nav-item { + .navbar-item { color: rgba($primary-invert, 0.8); text-decoration: none; &:hover { color: $primary-invert; + background: transparent; } &.is-active, @@ -24,14 +21,14 @@ border-bottom-color: $primary-invert; } - + .nav-item { + + .navbar-item { position: relative; &::before { width: 1px; height: 1em; background: rgba($primary-invert, 0.5); - content: " "; + content: ' '; display: block; position: absolute; left: 0px; @@ -44,6 +41,15 @@ max-height: 26px; } } + + .navbar-end > a.navbar-item { + color: rgba($primary-invert, 0.8); + + &:hover { + color: $primary-invert; + background: transparent; + } + } } &.is-secondary { @@ -53,12 +59,12 @@ font-weight: $weight-semibold; color: $primary-invert; - .nav-item { + .navbar-item { font-size: $size-4; } } - .nav-item { + .navbar-item { &.is-gutter { width: $gutter-width; } diff --git a/ui/app/styles/core/table.scss b/ui/app/styles/core/table.scss index 171379635..ecfacdd86 100644 --- a/ui/app/styles/core/table.scss +++ b/ui/app/styles/core/table.scss @@ -3,6 +3,7 @@ border-radius: $radius; border: 1px solid $grey-blue; border-collapse: separate; + width: 100%; &.is-fixed { table-layout: fixed; @@ -146,7 +147,7 @@ position: relative; &::after { - content: ""; + content: ''; width: 10px; right: 1.5em; top: 0.75em; @@ -156,11 +157,11 @@ } &.asc::after { - content: "⬇"; + content: '⬇'; } &.desc::after { - content: "⬆"; + content: '⬆'; } } @@ -185,7 +186,7 @@ &::after { position: absolute; - content: ""; + content: ''; width: 3px; top: 0; bottom: 0; diff --git a/ui/app/styles/core/tag.scss b/ui/app/styles/core/tag.scss index de4f25c74..cbf2bbe3b 100644 --- a/ui/app/styles/core/tag.scss +++ b/ui/app/styles/core/tag.scss @@ -1,4 +1,6 @@ -.tag { +// Strange selector mirrors selector used in Bulma +// https://github.com/jgthms/bulma/issues/912 +.tag:not(body) { text-transform: uppercase; border-radius: 200px; font-weight: $weight-normal; diff --git a/ui/app/styles/core/variables.scss b/ui/app/styles/core/variables.scss new file mode 100644 index 000000000..bef639661 --- /dev/null +++ b/ui/app/styles/core/variables.scss @@ -0,0 +1,41 @@ +$orange: #fa8e23; +$green: #2eb039; +$blue: $vagrant-blue; +$purple: $terraform-purple; +$red: #c84034; +$grey-blue: #bbc4d1; + +$primary: $nomad-green; +$warning: $orange; +$warning-invert: $white; +$danger: $red; +$info: $blue; +$dark: #234; + +$radius: 2px; + +$body-size: 14px; +$title-size: 1.75rem; +$size-5: 1.15rem; +$size-4: 1.3rem; +$size-7: 0.85rem; + +$title-weight: $weight-semibold; + +$family-sans-serif: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, + Cantarell, 'Helvetica Neue', sans-serif; + +$text: $black; + +$header-height: 112px; +$gutter-width: 250px; + +$icon-dimensions: 1.25rem; +$icon-dimensions-small: 1rem; +$icon-dimensions-medium: 1.5rem; +$icon-dimensions-large: 2.5rem; + +$breadcrumb-item-color: $white; +$breadcrumb-item-hover-color: $white; +$breadcrumb-item-active-color: $white; +$breadcrumb-item-separator-color: $primary; diff --git a/ui/app/styles/styleguide.scss b/ui/app/styles/styleguide.scss new file mode 100644 index 000000000..f77df0655 --- /dev/null +++ b/ui/app/styles/styleguide.scss @@ -0,0 +1,44 @@ +#styleguide { + .mock-content { + display: flex; + height: 250px; + + .mock-image, + .mock-copy { + height: 100%; + width: 100%; + margin: 1em; + } + + .mock-image { + background: linear-gradient( + to top right, + transparent 0%, + transparent 49%, + $grey-blue 49%, + $grey-blue 51%, + transparent 51%, + transparent 100% + ), + linear-gradient( + to bottom right, + transparent 0%, + transparent 49%, + $grey-blue 49%, + $grey-blue 51%, + transparent 51%, + transparent 100% + ); + } + + .mock-copy { + background: repeating-linear-gradient( + to bottom, + $grey-blue, + $grey-blue 5px, + transparent 5px, + transparent 14px + ); + } + } +} diff --git a/ui/app/styles/core/bumper.scss b/ui/app/styles/utils/bumper.scss similarity index 100% rename from ui/app/styles/core/bumper.scss rename to ui/app/styles/utils/bumper.scss diff --git a/ui/app/styles/utils/product-colors.scss b/ui/app/styles/utils/product-colors.scss index 689b9e84e..bbf4b63aa 100644 --- a/ui/app/styles/utils/product-colors.scss +++ b/ui/app/styles/utils/product-colors.scss @@ -1,15 +1,15 @@ -$consul-pink: #FF0087; -$consul-pink-dark: #C62A71; +$consul-pink: #ff0087; +$consul-pink-dark: #c62a71; -$packer-blue: #1DAEFF; -$packer-blue-dark: #1D94DD; +$packer-blue: #1daeff; +$packer-blue-dark: #1d94dd; -$terraform-purple: #5C4EE5; -$terraform-purple-dark: #4040B2; +$terraform-purple: #5c4ee5; +$terraform-purple-dark: #4040b2; -$vagrant-blue: #1563FF; -$vagrant-blue-dark: #104EB2; +$vagrant-blue: #1563ff; +$vagrant-blue-dark: #104eb2; -$nomad-green: #25BA81; +$nomad-green: #25ba81; $nomad-green-dark: #1d9467; -$nomad-green-darker: #16704D; +$nomad-green-darker: #16704d; diff --git a/ui/app/styles/utils/reset.scss b/ui/app/styles/utils/reset.scss new file mode 100644 index 000000000..42d609252 --- /dev/null +++ b/ui/app/styles/utils/reset.scss @@ -0,0 +1,6 @@ +html, +body, +body > .ember-view { + height: 100%; + width: 100%; +} diff --git a/ui/app/templates/allocations/allocation/index.hbs b/ui/app/templates/allocations/allocation/index.hbs index 96cb194b5..9778b2637 100644 --- a/ui/app/templates/allocations/allocation/index.hbs +++ b/ui/app/templates/allocations/allocation/index.hbs @@ -1,25 +1,25 @@ {{#global-header class="page-header"}} - Allocations - {{#link-to "allocations.allocation" model class="breadcrumb"}} - {{model.shortId}} - {{/link-to}} +
  • Allocations
  • +
  • + {{#link-to "allocations.allocation" model}}{{model.shortId}}{{/link-to}} +
  • {{/global-header}} {{#gutter-menu class="page-body"}}
    -

    +

    Allocation {{model.name}} {{model.clientStatus}} {{model.id}}

    -
    +
    Allocation Details Job - {{#link-to "jobs.job" model.job (query-params jobNamespace=model.job.namespace.id)}}{{model.job.name}}{{/link-to}} + {{#link-to "jobs.job" model.job (query-params jobNamespace=model.job.namespace.id) data-test-job-link}}{{model.job.name}}{{/link-to}} Client - {{#link-to "clients.client" model.node}}{{model.node.shortId}}{{/link-to}} + {{#link-to "clients.client" model.node data-test-client-link}}{{model.node.shortId}}{{/link-to}}
    @@ -33,7 +33,7 @@ source=sortedStates sortProperty=sortProperty sortDescending=sortDescending - class="is-striped tasks" as |t|}} + class="is-striped" as |t|}} {{#t.head}} {{#t.sort-by prop="name"}}Name{{/t.sort-by}} {{#t.sort-by prop="state"}}State{{/t.sort-by}} @@ -42,22 +42,22 @@ Addresses {{/t.head}} {{#t.body as |row|}} - - + + {{#link-to "allocations.allocation.task" row.model.allocation row.model}} {{row.model.task.name}} {{/link-to}} - {{row.model.state}} - + {{row.model.state}} + {{#if row.model.events.lastObject.displayMessage}} {{row.model.events.lastObject.displayMessage}} {{else}} No message {{/if}} - {{moment-format row.model.events.lastObject.time "MM/DD/YY HH:mm:ss"}} - + {{moment-format row.model.events.lastObject.time "MM/DD/YY HH:mm:ss"}} + + +
    diff --git a/ui/app/templates/components/gutter-menu.hbs b/ui/app/templates/components/gutter-menu.hbs index 765b53ab9..055e8e323 100644 --- a/ui/app/templates/components/gutter-menu.hbs +++ b/ui/app/templates/components/gutter-menu.hbs @@ -9,6 +9,7 @@
  • +
  • {{#if record.deployment.version.submitTime}} {{moment-format record.deployment.version.submitTime "MMMM D, YYYY"}} {{else}} @@ -8,7 +8,7 @@ {{/if}}
  • {{/if}} -
  • +
  • {{job-deployment deployment=record.deployment}}
  • {{/each}} diff --git a/ui/app/templates/components/job-diff-fields-and-objects.hbs b/ui/app/templates/components/job-diff-fields-and-objects.hbs index 7da3703c8..dfb51e6e4 100644 --- a/ui/app/templates/components/job-diff-fields-and-objects.hbs +++ b/ui/app/templates/components/job-diff-fields-and-objects.hbs @@ -1,9 +1,12 @@
    {{#each fields as |field|}} -
    +
    {{#if (eq (lowercase field.Type) "added")}} @@ -30,10 +33,13 @@
    {{#each objects as |object|}} -
    +
    {{#if (eq (lowercase object.Type) "added")}} + @@ -44,7 +50,7 @@ {{/if}} {{object.Name}} { -