Use the new ember modules imports

Generated with a codemode:
https://github.com/ember-cli/ember-modules-codemod
This commit is contained in:
Michael Lange 2017-12-15 13:39:18 -08:00
parent 4e74096834
commit 1107798da6
136 changed files with 384 additions and 517 deletions

View File

@ -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');

View File

@ -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,

View File

@ -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',

View File

@ -1,3 +1,4 @@
import Application from '@ember/application';
import Ember from 'ember';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
@ -7,10 +8,10 @@ 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);

View File

@ -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',

View File

@ -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',

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Component } = Ember;
import Component from '@ember/component';
export default Component.extend({
tagName: '',

View File

@ -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'],

View File

@ -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, {

View File

@ -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() || [];

View File

@ -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'],

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Component } = Ember;
import Component from '@ember/component';
export default Component.extend({
tagName: '',

View File

@ -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'],

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Component } = Ember;
import Component from '@ember/component';
export default Component.extend({
tagName: '',

View File

@ -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'),
});

View File

@ -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'],

View File

@ -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'];

View File

@ -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'],

View File

@ -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;

View File

@ -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() {

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Component } = Ember;
import Component from '@ember/component';
export default Component.extend({
tagName: '',

View File

@ -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',

View File

@ -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',

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Component } = Ember;
import Component from '@ember/component';
export default Component.extend({
tagName: 'tbody',

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Component } = Ember;
import Component from '@ember/component';
export default Component.extend({
tagName: 'thead',

View File

@ -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,

View File

@ -1,14 +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 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'],

View File

@ -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',

View File

@ -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'],

View File

@ -1,5 +1,3 @@
import Ember from 'ember';
const { Controller } = Ember;
import Controller from '@ember/controller';
export default Controller.extend({});

View File

@ -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'),
});

View File

@ -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 => ({

View File

@ -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,

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Controller } = Ember;
import Controller from '@ember/controller';
export default Controller.extend({
isForbidden: false,

View File

@ -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) {

View File

@ -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) {

View File

@ -1,10 +1,9 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
import FreestyleController from 'ember-freestyle/controllers/freestyle';
const { inject, computed } = Ember;
export default FreestyleController.extend({
emberFreestyle: inject.service(),
emberFreestyle: service(),
timerTicks: 0,

View File

@ -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',

View File

@ -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,

View File

@ -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() {

View File

@ -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'),
});

View File

@ -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'),
});

View File

@ -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();

View File

@ -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'),
});

View File

@ -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([

View File

@ -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'),
});

View File

@ -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'),
});

View File

@ -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'),
});

View File

@ -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',

View File

@ -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,

View File

@ -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);

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Helper } = Ember;
import Helper from '@ember/component/helper';
const UNITS = ['Bytes', 'KiB', 'MiB'];

View File

@ -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);

View File

@ -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';

View File

@ -1,6 +1,5 @@
import Ember from 'ember';
const { Helper, $ } = Ember;
import Helper from '@ember/component/helper';
import $ from 'jquery';
/**
* Lazy Click Event

View File

@ -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();

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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));

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Mixin } = Ember;
import Mixin from '@ember/object/mixin';
export default Mixin.create({
setupController(controller) {

View File

@ -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));

View File

@ -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) {

View File

@ -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'),

View File

@ -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);
}),

View File

@ -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'),
@ -35,7 +34,7 @@ export default Model.extend({
}),
// Dependent keys can only go one level past an @each so an alias is needed
versionSubmitTime: computed.alias('version.submitTime'),
versionSubmitTime: alias('version.submitTime'),
placedCanaries: sumAggregation('taskGroupSummaries', 'placedCanaries'),
desiredCanaries: sumAggregation('taskGroupSummaries', 'desiredCanaries'),

View File

@ -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'),

View File

@ -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');

View File

@ -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'),
});

View File

@ -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 });
}),

View File

@ -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'),

View File

@ -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',

View File

@ -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'),

View File

@ -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'),
});

View File

@ -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(),

View File

@ -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() {

View File

@ -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'),
});

View File

@ -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,
});

View File

@ -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);

View File

@ -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');

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Route } = Ember;
import Route from '@ember/routing/route';
export default Route.extend({
model() {

View File

@ -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) {

View File

@ -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');

View File

@ -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));

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Route } = Ember;
import Route from '@ember/routing/route';
export default Route.extend({
redirect() {

View File

@ -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');

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Route } = Ember;
import Route from '@ember/routing/route';
export default Route.extend({
actions: {

View File

@ -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') };

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Route } = Ember;
import Route from '@ember/routing/route';
export default Route.extend({
model() {

View File

@ -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() {

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Route } = Ember;
import Route from '@ember/routing/route';
export default Route.extend({
model({ name }) {

View File

@ -1,6 +1,4 @@
import Ember from 'ember';
const { Route } = Ember;
import Route from '@ember/routing/route';
export default Route.extend({
model() {

View File

@ -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() {

View File

@ -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');

View File

@ -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);

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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 => {

View File

@ -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',

Some files were not shown because too many files have changed in this diff Show More