diff --git a/app/application/route.js b/app/application/route.js index 751fcaef26..b7933b7847 100644 --- a/app/application/route.js +++ b/app/application/route.js @@ -31,8 +31,8 @@ export default Route.extend({ } // Find out if auth is enabled - return get(this, 'access').detect().finally(() => { - return get(this, 'language').initLanguage(); + return this.access.detect().finally(() => { + return this.language.initLanguage(); }); })(); }, @@ -57,14 +57,14 @@ export default Route.extend({ }, loading(transition) { this.incrementProperty('loadingId'); - let id = get(this, 'loadingId'); + let id = this.loadingId; - cancel(get(this, 'hideTimer')); + cancel(this.hideTimer); // console.log('Loading', id); this.notifyAction('need-to-load'); - if ( !get(this, 'loadingShown') ) { + if ( !this.loadingShown ) { set(this, 'loadingShown', true); // console.log('Loading Show', id); this.notifyLoading(true); @@ -102,7 +102,7 @@ export default Route.extend({ }); } - if ( get(this, 'loadingId') === id ) { + if ( this.loadingId === id ) { if ( transition.isAborted ) { // console.log('Loading aborted', id, get(this, 'loadingId')); set(this, 'hideTimer', next(hide)); @@ -143,8 +143,8 @@ export default Route.extend({ }, logout(transition, errorMsg) { - let session = get(this, 'session'); - let access = get(this, 'access'); + let session = this.session; + let access = this.access; if ( isEmbedded() ) { dashboardWindow().postMessage({ action: 'logout' }); @@ -161,7 +161,7 @@ export default Route.extend({ url = `${ window.location.origin }/dashboard/auth/login`; } - get(this, 'tab-session').clear(); + this['tab-session'].clear(); set(this, `session.${ C.SESSION.CONTAINER_ROUTE }`, undefined); set(this, `session.${ C.SESSION.ISTIO_ROUTE }`, undefined); set(this, `session.${ C.SESSION.CLUSTER_ROUTE }`, undefined); @@ -172,7 +172,7 @@ export default Route.extend({ } if ( get(this, 'modal.modalVisible') ) { - get(this, 'modal').toggleModal(); + this.modal.toggleModal(); } if ( errorMsg ) { @@ -184,11 +184,11 @@ export default Route.extend({ }, langToggle() { - let svc = get(this, 'language'); + let svc = this.language; let cur = svc.getLocale(); if ( cur === 'none' ) { - svc.sideLoadLanguage(get(this, 'previousLang') || 'en-us'); + svc.sideLoadLanguage(this.previousLang || 'en-us'); } else { set(this, 'previousLang', cur); svc.sideLoadLanguage('none'); @@ -201,7 +201,7 @@ export default Route.extend({ }), finishLogin() { - let session = get(this, 'session'); + let session = this.session; let backTo = session.get(C.SESSION.BACK_TO); diff --git a/app/apps-tab/detail/controller.js b/app/apps-tab/detail/controller.js index aad9e4d621..2459b76629 100644 --- a/app/apps-tab/detail/controller.js +++ b/app/apps-tab/detail/controller.js @@ -196,7 +196,7 @@ export default Controller.extend({ actions: { toggleExpand(instId) { - let list = this.get('expandedInstances'); + let list = this.expandedInstances; if ( list.includes(instId) ) { list.removeObject(instId); diff --git a/app/apps-tab/detail/route.js b/app/apps-tab/detail/route.js index 6438c3d316..0923744066 100644 --- a/app/apps-tab/detail/route.js +++ b/app/apps-tab/detail/route.js @@ -8,7 +8,7 @@ export default Route.extend({ store: service(), model(params) { - const store = get(this, 'store'); + const store = this.store; return hash({ app: store.find('app', get(params, 'app_id')), }); }, diff --git a/app/apps-tab/index/controller.js b/app/apps-tab/index/controller.js index a3e78cdb7e..9c870b76b6 100644 --- a/app/apps-tab/index/controller.js +++ b/app/apps-tab/index/controller.js @@ -20,7 +20,7 @@ export default Controller.extend({ }), filteredApps: computed('model.apps.@each.{type,isFromCatalog,tags,state}', 'tags', 'searchText', function() { - var needTags = get(this, 'tags'); + var needTags = this.tags; var apps = get(this, 'model.apps').filter((ns) => !C.REMOVEDISH_STATES.includes(get(ns, 'state'))); @@ -31,7 +31,7 @@ export default Controller.extend({ apps = apps.filterBy('isIstio', false); apps = apps.sortBy('displayName'); - const { matches } = filter(apps, get(this, 'searchText')); + const { matches } = filter(apps, this.searchText); const group = []; let dataIndex = 0; diff --git a/app/apps-tab/index/route.js b/app/apps-tab/index/route.js index 3427d1a319..cb4ddd8e4e 100644 --- a/app/apps-tab/index/route.js +++ b/app/apps-tab/index/route.js @@ -9,17 +9,17 @@ export default Route.extend({ store: service(), beforeModel() { - return get(this, 'catalog').fetchUnScopedCatalogs(); + return this.catalog.fetchUnScopedCatalogs(); }, model() { - return this.get('store').findAll('app') + return this.store.findAll('app') .then((apps) => ({ apps, })); }, afterModel(model/* , transition */) { - return get(this, 'catalog').fetchAppTemplates(get(model, 'apps')); + return this.catalog.fetchAppTemplates(get(model, 'apps')); }, setDefaultRoute: on('activate', function() { diff --git a/app/authenticated/apikeys/controller.js b/app/authenticated/apikeys/controller.js index 2909df788e..b92a356861 100644 --- a/app/authenticated/apikeys/controller.js +++ b/app/authenticated/apikeys/controller.js @@ -57,9 +57,9 @@ export default Controller.extend({ project: alias('scope.currentProject'), actions: { newApikey() { - const cred = this.get('globalStore').createRecord({ type: 'token', }); + const cred = this.globalStore.createRecord({ type: 'token', }); - this.get('modalService').toggleModal('modal-edit-apikey', cred); + this.modalService.toggleModal('modal-edit-apikey', cred); }, }, diff --git a/app/authenticated/apikeys/route.js b/app/authenticated/apikeys/route.js index 836907bac3..7d3322f9e0 100644 --- a/app/authenticated/apikeys/route.js +++ b/app/authenticated/apikeys/route.js @@ -3,6 +3,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ model() { - return hash({ tokens: this.get('globalStore').findAll('token'), }); + return hash({ tokens: this.globalStore.findAll('token'), }); }, }); diff --git a/app/authenticated/cluster/backups/controller.js b/app/authenticated/cluster/backups/controller.js index 9a0f06c50f..50a5882d74 100644 --- a/app/authenticated/cluster/backups/controller.js +++ b/app/authenticated/cluster/backups/controller.js @@ -41,7 +41,7 @@ export default Controller.extend({ rows: computed('model.[]', function() { let { currentClusterId } = this; - return get(this, 'model').filterBy('clusterId', currentClusterId); + return this.model.filterBy('clusterId', currentClusterId); }), }); diff --git a/app/authenticated/cluster/cis/scan/controller.js b/app/authenticated/cluster/cis/scan/controller.js index 5fdf98abed..abbb43f3ed 100644 --- a/app/authenticated/cluster/cis/scan/controller.js +++ b/app/authenticated/cluster/cis/scan/controller.js @@ -1,3 +1,4 @@ +import { filterBy, alias } from '@ember/object/computed'; import Controller from '@ember/controller'; import { downloadFile, generateZip } from 'shared/utils/download-files'; import { get, computed } from '@ember/object'; @@ -62,9 +63,9 @@ export default Controller.extend({ sortBy: 'date', descending: true, - runningClusterScans: computed.filterBy('clusterScans', 'isRunning', true), + runningClusterScans: filterBy('clusterScans', 'isRunning', true), - isRKE: computed.alias('scope.currentCluster.isRKE'), + isRKE: alias('scope.currentCluster.isRKE'), actions: { runScan() { get(this, 'scope.currentCluster').send('runCISScan'); @@ -73,7 +74,7 @@ export default Controller.extend({ get(this, 'scope.currentCluster').send('edit', { scrollTo: 'security-scan' }); }, setAlert() { - get(this, 'router').transitionTo('authenticated.cluster.alert.new', { queryParams: { for: 'security-scan' } }); + this.router.transitionTo('authenticated.cluster.alert.new', { queryParams: { for: 'security-scan' } }); } }, bulkActionHandler: computed(function() { @@ -87,7 +88,7 @@ export default Controller.extend({ await downloadFile(`cis-scans.zip`, zip, get(zip, 'type')); }, promptDelete: async(scans) => { - get(this, 'modalService').toggleModal('confirm-delete', { + this.modalService.toggleModal('confirm-delete', { escToClose: true, resources: scans }); diff --git a/app/authenticated/cluster/cis/scan/detail/controller.js b/app/authenticated/cluster/cis/scan/detail/controller.js index 014953e437..930cb02a66 100644 --- a/app/authenticated/cluster/cis/scan/detail/controller.js +++ b/app/authenticated/cluster/cis/scan/detail/controller.js @@ -1,3 +1,4 @@ +import { filterBy } from '@ember/object/computed'; import Controller from '@ember/controller'; import { computed, get, set } from '@ember/object'; import { inject as service } from '@ember/service'; @@ -36,20 +37,20 @@ export default Controller.extend({ ], sortBy: 'state', - runningClusterScans: computed.filterBy('clusterScans', 'isRunning', true), + runningClusterScans: filterBy('clusterScans', 'isRunning', true), actions: { async runScan() { - get(this, 'scope.currentCluster').send('runCISScan', { onRun: () => get(this, 'router').replaceWith('authenticated.cluster.cis/scan') }); + get(this, 'scope.currentCluster').send('runCISScan', { onRun: () => this.router.replaceWith('authenticated.cluster.cis/scan') }); }, download() { get(this, 'model.scan').send('download'); }, async delete() { - await get(this, 'modalService').toggleModal('confirm-delete', { + await this.modalService.toggleModal('confirm-delete', { escToClose: true, resources: [get(this, 'model.scan')], - onDeleteFinished: () => get(this, 'router').replaceWith('authenticated.cluster.cis/scan') + onDeleteFinished: () => this.router.replaceWith('authenticated.cluster.cis/scan') }); }, clearSearchText() { diff --git a/app/authenticated/cluster/cis/scan/detail/route.js b/app/authenticated/cluster/cis/scan/detail/route.js index 6d815a72fd..c2d2816979 100644 --- a/app/authenticated/cluster/cis/scan/detail/route.js +++ b/app/authenticated/cluster/cis/scan/detail/route.js @@ -7,13 +7,13 @@ export default Route.extend({ globalStore: service(), scope: service(), model(params) { - const scan = get(this, 'globalStore').find('clusterScan', params.scan_id); + const scan = this.globalStore.find('clusterScan', params.scan_id); const report = (async() => { return (await scan).loadReport('report'); })(); return hash({ - clusterScans: get(this, 'globalStore').findAll('clusterScan'), + clusterScans: this.globalStore.findAll('clusterScan'), scan, report, nodes: get(this, 'scope.currentCluster.nodes'), diff --git a/app/authenticated/cluster/cis/scan/route.js b/app/authenticated/cluster/cis/scan/route.js index 599d838887..ecc2c7fefd 100644 --- a/app/authenticated/cluster/cis/scan/route.js +++ b/app/authenticated/cluster/cis/scan/route.js @@ -1,6 +1,5 @@ import { inject as service } from '@ember/service'; import Route from '@ember/routing/route'; -import { get, } from '@ember/object'; import { hash } from 'rsvp'; export default Route.extend({ @@ -8,7 +7,7 @@ export default Route.extend({ scope: service(), model() { - const clusterScans = get(this, 'globalStore').findAll('clusterScan'); + const clusterScans = this.globalStore.findAll('clusterScan'); return hash({ clusterScans, @@ -18,7 +17,7 @@ export default Route.extend({ return await Promise.all(reportPromises); })(), - clusterTemplateRevisions: get(this, 'globalStore').findAll('clustertemplaterevision') + clusterTemplateRevisions: this.globalStore.findAll('clustertemplaterevision') }); }, }); diff --git a/app/authenticated/cluster/cluster-catalogs/controller.js b/app/authenticated/cluster/cluster-catalogs/controller.js index 91bbc3b0b1..0b91585246 100644 --- a/app/authenticated/cluster/cluster-catalogs/controller.js +++ b/app/authenticated/cluster/cluster-catalogs/controller.js @@ -11,14 +11,14 @@ export default Controller.extend({ actions: { add() { - const record = get(this, 'globalStore').createRecord({ + const record = this.globalStore.createRecord({ type: 'clustercatalog', kind: 'helm', branch: 'master', clusterId: get(this, 'scope.currentCluster.id'), }); - get(this, 'modalService').toggleModal('modal-edit-catalog', { + this.modalService.toggleModal('modal-edit-catalog', { model: record, scope: 'cluster' }); diff --git a/app/authenticated/cluster/cluster-catalogs/route.js b/app/authenticated/cluster/cluster-catalogs/route.js index fa69f97430..2dbe9850f2 100644 --- a/app/authenticated/cluster/cluster-catalogs/route.js +++ b/app/authenticated/cluster/cluster-catalogs/route.js @@ -1,6 +1,5 @@ import { inject as service } from '@ember/service'; import Route from '@ember/routing/route'; -import { get } from '@ember/object'; import { hash } from 'rsvp'; export default Route.extend({ @@ -8,8 +7,8 @@ export default Route.extend({ model() { return hash({ - clusterCatalogs: get(this, 'catalog').fetchCatalogs('clusterCatalog'), - globalCatalogs: get(this, 'catalog').fetchCatalogs() + clusterCatalogs: this.catalog.fetchCatalogs('clusterCatalog'), + globalCatalogs: this.catalog.fetchCatalogs() }); }, }); diff --git a/app/authenticated/cluster/controller.js b/app/authenticated/cluster/controller.js index 0654b1a5ea..ce4fda32e3 100644 --- a/app/authenticated/cluster/controller.js +++ b/app/authenticated/cluster/controller.js @@ -6,7 +6,7 @@ export default Controller.extend({ wasReady: true, watchReady: observer('model.isReady', function() { - const wasReady = get(this, 'wasReady'); + const wasReady = this.wasReady; const isReady = get(this, 'model.isReady'); set(this, 'wasReady', isReady); diff --git a/app/authenticated/cluster/edit/controller.js b/app/authenticated/cluster/edit/controller.js index 7894bd8ddb..97bb97ed73 100644 --- a/app/authenticated/cluster/edit/controller.js +++ b/app/authenticated/cluster/edit/controller.js @@ -1,6 +1,6 @@ import Controller from '@ember/controller'; import { alias } from '@ember/object/computed'; -import { get, observer } from '@ember/object'; +import { observer } from '@ember/object'; import { inject as service } from '@ember/service'; export default Controller.extend({ @@ -21,7 +21,7 @@ export default Controller.extend({ scrolling: observer('model.activated', function() { const intervalId = setInterval(() => { - const element = $(`#${ get(this, 'scrollTo') }`); // eslint-disable-line + const element = $(`#${ this.scrollTo }`); // eslint-disable-line if (element.length > 0 && element.get(0).getBoundingClientRect().top !== 0) { element.get(0).scrollIntoView(true); diff --git a/app/authenticated/cluster/edit/route.js b/app/authenticated/cluster/edit/route.js index 6776515320..e56802c2e2 100644 --- a/app/authenticated/cluster/edit/route.js +++ b/app/authenticated/cluster/edit/route.js @@ -2,7 +2,11 @@ import { get, set, setProperties } from '@ember/object'; import { inject as service } from '@ember/service'; import Route from '@ember/routing/route'; import { hash, hashSettled/* , all */ } from 'rsvp'; -import { loadScript, loadStylesheet, proxifyUrl } from 'shared/utils/load-script'; +import { + loadScript, + loadStylesheet, + proxifyUrl +} from 'shared/utils/load-script'; import { isEmpty } from '@ember/utils'; import { scheduleOnce } from '@ember/runloop'; @@ -15,7 +19,7 @@ export default Route.extend({ roleTemplateService: service('roleTemplate'), model() { - const globalStore = this.get('globalStore'); + const globalStore = this.globalStore; const cluster = this.modelFor('authenticated.cluster'); @@ -27,7 +31,7 @@ export default Route.extend({ nodeTemplates: globalStore.findAll('nodeTemplate'), nodeDrivers: globalStore.findAll('nodeDriver'), psacs: globalStore.findAll('podSecurityAdmissionConfigurationTemplate'), - roleTemplates: get(this, 'roleTemplateService').get('allFilteredRoleTemplates'), + roleTemplates: this.roleTemplateService.get('allFilteredRoleTemplates'), users: globalStore.findAll('user'), clusterRoleTemplateBinding: globalStore.findAll('clusterRoleTemplateBinding'), me: get(this, 'access.principal'), @@ -125,7 +129,7 @@ export default Route.extend({ console.log('Error Loading External Component for: ', match); if (match && get(match, 'scriptError') !== true) { - set(match, 'scriptError', get(this, 'intl').t('clusterNew.externalError')); + set(match, 'scriptError', this.intl.t('clusterNew.externalError')); } } }); diff --git a/app/authenticated/cluster/nodes/index/route.js b/app/authenticated/cluster/nodes/index/route.js index 26f1878f9b..6e26b6a1d7 100644 --- a/app/authenticated/cluster/nodes/index/route.js +++ b/app/authenticated/cluster/nodes/index/route.js @@ -11,7 +11,7 @@ export default Route.extend({ model() { const cluster = this.modelFor('authenticated.cluster'); - return this.get('globalStore').findAll('node') + return this.globalStore.findAll('node') .then((nodes) => ({ cluster, nodes, diff --git a/app/authenticated/cluster/notifier/index/controller.js b/app/authenticated/cluster/notifier/index/controller.js index d8266fb65a..c559a798ab 100644 --- a/app/authenticated/cluster/notifier/index/controller.js +++ b/app/authenticated/cluster/notifier/index/controller.js @@ -1,4 +1,3 @@ -import { get } from '@ember/object'; import { alias } from '@ember/object/computed'; import { inject as service } from '@ember/service'; import Controller from '@ember/controller'; @@ -14,10 +13,10 @@ export default Controller.extend({ notifiers: alias('model.notifiers'), actions: { showNewEditModal() { - get(this, 'modalService').toggleModal('notifier/modal-new-edit', { + this.modalService.toggleModal('notifier/modal-new-edit', { closeWithOutsideClick: false, controller: this, - currentType: get(this, 'currentType'), + currentType: this.currentType, mode: 'add', }); }, diff --git a/app/authenticated/cluster/notifier/index/route.js b/app/authenticated/cluster/notifier/index/route.js index 14a7cd13d1..28a0462333 100644 --- a/app/authenticated/cluster/notifier/index/route.js +++ b/app/authenticated/cluster/notifier/index/route.js @@ -10,7 +10,7 @@ export default Route.extend({ scope: service(), model(/* params, transition */) { - const cs = get(this, 'globalStore'); + const cs = this.globalStore; const clusterId = get(this.scope, 'currentCluster.id'); return hash({ notifiers: cs.find('notifier', null, { filter: { clusterId } }).then(() => cs.all('notifier')) }); diff --git a/app/authenticated/cluster/projects/edit/route.js b/app/authenticated/cluster/projects/edit/route.js index 3c8c70840d..92b6ce3611 100644 --- a/app/authenticated/cluster/projects/edit/route.js +++ b/app/authenticated/cluster/projects/edit/route.js @@ -9,14 +9,14 @@ export default Route.extend({ roleTemplateService: service('roleTemplate'), model(params) { - const store = get(this, 'globalStore'); + const store = this.globalStore; return hash({ me: get(this, 'access.principal'), project: store.find('project', params.project_id), projectRoleTemplateBindings: store.find('projectRoleTemplateBinding'), projects: store.findAll('project'), - roles: get(this, 'roleTemplateService').get('allFilteredRoleTemplates'), + roles: this.roleTemplateService.get('allFilteredRoleTemplates'), users: store.find('user', null, { forceReload: true }), }).then((hash) => { set(hash, 'project', get(hash, 'project').clone()); diff --git a/app/authenticated/cluster/projects/index/controller.js b/app/authenticated/cluster/projects/index/controller.js index 481036d9a4..48767e3e62 100644 --- a/app/authenticated/cluster/projects/index/controller.js +++ b/app/authenticated/cluster/projects/index/controller.js @@ -23,8 +23,8 @@ export default Controller.extend({ }), projectsWithoutNamespaces: computed('projects.@each.{id,state,clusterId}', 'rows.@each.projectId', function(){ - return get(this, 'projects').filter((p) => { - const namespaces = get(this, 'rows').filterBy('projectId', get(p, 'id')) || []; + return this.projects.filter((p) => { + const namespaces = this.rows.filterBy('projectId', get(p, 'id')) || []; return get(namespaces, 'length') <= 0; }) diff --git a/app/authenticated/cluster/projects/index/route.js b/app/authenticated/cluster/projects/index/route.js index 0e395e6996..487f3a2bbe 100644 --- a/app/authenticated/cluster/projects/index/route.js +++ b/app/authenticated/cluster/projects/index/route.js @@ -20,8 +20,8 @@ export default Route.extend({ } return hash({ - projects: get(this, 'globalStore').findAll('project'), - namespaces: get(this, 'clusterStore').findAll('namespace') + projects: this.globalStore.findAll('project'), + namespaces: this.clusterStore.findAll('namespace') }); }, diff --git a/app/authenticated/cluster/projects/new-ns/controller.js b/app/authenticated/cluster/projects/new-ns/controller.js index 691e72c9a6..85952f9d00 100644 --- a/app/authenticated/cluster/projects/new-ns/controller.js +++ b/app/authenticated/cluster/projects/new-ns/controller.js @@ -20,10 +20,10 @@ export default Controller.extend(NewOrEdit, { primaryResource: alias('model.namespace'), actions: { cancel() { - let backTo = get(this, 'session').get(C.SESSION.BACK_TO) + let backTo = this.session.get(C.SESSION.BACK_TO) if (backTo) { - this.transitionToRoute('authenticated.project.ns.index', get(this, 'addTo')); + this.transitionToRoute('authenticated.project.ns.index', this.addTo); } else { this.transitionToRoute('authenticated.cluster.projects.index'); } @@ -42,7 +42,7 @@ export default Controller.extend(NewOrEdit, { }, toggleAutoInject() { - set(this, 'istioInjection', !get(this, 'istioInjection')); + set(this, 'istioInjection', !this.istioInjection); }, setLabels(labels) { @@ -73,21 +73,21 @@ export default Controller.extend(NewOrEdit, { projectLimit: computed('allProjects', 'primaryResource.projectId', 'primaryResource.resourceQuota.limit', function() { const projectId = get(this, 'primaryResource.projectId'); - const project = get(this, 'allProjects').findBy('id', projectId); + const project = this.allProjects.findBy('id', projectId); return get(project, 'resourceQuota.limit'); }), projectUsedLimit: computed('allProjects', 'primaryResource.projectId', 'primaryResource.resourceQuota.limit', function() { const projectId = get(this, 'primaryResource.projectId'); - const project = get(this, 'allProjects').findBy('id', projectId); + const project = this.allProjects.findBy('id', projectId); return get(project, 'resourceQuota.usedLimit'); }), nsDefaultQuota: computed('allProjects', 'primaryResource.projectId', 'primaryResource.resourceQuota.limit', function() { const projectId = get(this, 'primaryResource.projectId'); - const project = get(this, 'allProjects').findBy('id', projectId); + const project = this.allProjects.findBy('id', projectId); return get(project, 'namespaceDefaultResourceQuota.limit'); }), @@ -105,7 +105,7 @@ export default Controller.extend(NewOrEdit, { }), willSave() { - const isEnabled = get(this, 'istioInjection'); + const isEnabled = this.istioInjection; const labels = { ...get(this, 'primaryResource.labels') }; if ( isEnabled ) { @@ -120,8 +120,8 @@ export default Controller.extend(NewOrEdit, { validate() { this._super(); - const errors = get(this, 'errors') || []; - const quotaErrors = get(this, 'primaryResource').validateResourceQuota(); + const errors = this.errors || []; + const quotaErrors = this.primaryResource.validateResourceQuota(); if ( quotaErrors.length > 0 ) { errors.pushObjects(quotaErrors); diff --git a/app/authenticated/cluster/projects/new-ns/route.js b/app/authenticated/cluster/projects/new-ns/route.js index 66d3f979aa..b6948efb64 100644 --- a/app/authenticated/cluster/projects/new-ns/route.js +++ b/app/authenticated/cluster/projects/new-ns/route.js @@ -9,7 +9,7 @@ export default Route.extend({ scope: service(), model(params) { - const clusterStore = get(this, 'clusterStore'); + const clusterStore = this.clusterStore; const namespace = clusterStore.createRecord({ type: 'namespace', @@ -28,8 +28,8 @@ export default Route.extend({ return hash({ namespace, - namespaces: get(this, 'clusterStore').findAll('namespace'), - allProjects: get(this, 'globalStore').findAll('project'), + namespaces: this.clusterStore.findAll('namespace'), + allProjects: this.globalStore.findAll('project'), }); }, diff --git a/app/authenticated/cluster/projects/new/route.js b/app/authenticated/cluster/projects/new/route.js index 35506bfccd..c219eb4f4b 100644 --- a/app/authenticated/cluster/projects/new/route.js +++ b/app/authenticated/cluster/projects/new/route.js @@ -11,7 +11,7 @@ export default Route.extend({ model() { - const store = get(this, 'globalStore'); + const store = this.globalStore; const cluster = this.modelFor('authenticated.cluster'); const project = store.createRecord({ @@ -24,7 +24,7 @@ export default Route.extend({ me: get(this, 'access.principal'), project, projects: store.findAll('project'), - roles: get(this, 'roleTemplateService').get('allFilteredRoleTemplates'), + roles: this.roleTemplateService.get('allFilteredRoleTemplates'), users: store.find('user', null, { forceReload: true }), }); }, diff --git a/app/authenticated/cluster/route.js b/app/authenticated/cluster/route.js index d85b54d172..e5fa1fa740 100644 --- a/app/authenticated/cluster/route.js +++ b/app/authenticated/cluster/route.js @@ -19,7 +19,7 @@ export default Route.extend(Preload, { settings: service(), model(params, transition) { - return get(this, 'globalStore').find('cluster', params.cluster_id) + return this.globalStore.find('cluster', params.cluster_id) .then((cluster) => { const hideLocalCluster = get(this.settings, 'shouldHideLocalCluster'); @@ -27,7 +27,7 @@ export default Route.extend(Preload, { return this.replaceWith('authenticated'); } - return get(this, 'scope').startSwitchToCluster(cluster).then(() => { + return this.scope.startSwitchToCluster(cluster).then(() => { if ( get(cluster, 'isReady') ) { const preloads = [ this.preload('namespace', 'clusterStore'), @@ -56,7 +56,7 @@ export default Route.extend(Preload, { }, afterModel(model) { - return get(this, 'scope').finishSwitchToCluster(model); + return this.scope.finishSwitchToCluster(model); }, redirect(router, transition) { @@ -68,7 +68,7 @@ export default Route.extend(Preload, { }, actions: { becameReady() { - get(this, 'clusterStore').reset(); + this.clusterStore.reset(); this.refresh(); }, diff --git a/app/authenticated/cluster/security/members/edit/route.js b/app/authenticated/cluster/security/members/edit/route.js index 02d8b15e0f..7e13d37799 100644 --- a/app/authenticated/cluster/security/members/edit/route.js +++ b/app/authenticated/cluster/security/members/edit/route.js @@ -1,13 +1,12 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; -import { get } from '@ember/object'; import { hash } from 'rsvp'; export default Route.extend({ globalStore: service(), model(params) { - const store = get(this, 'globalStore'); + const store = this.globalStore; return hash({ role: store.find('clusterroletemplatebinding', params.role_id), diff --git a/app/authenticated/cluster/security/members/new/route.js b/app/authenticated/cluster/security/members/new/route.js index 64baf1f9fc..fa2c89de86 100644 --- a/app/authenticated/cluster/security/members/new/route.js +++ b/app/authenticated/cluster/security/members/new/route.js @@ -1,6 +1,5 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; -import { get } from '@ember/object'; import { hash } from 'rsvp'; export default Route.extend({ @@ -10,12 +9,12 @@ export default Route.extend({ // need to get all roles, we should have two roles and custom like the global perms // cluster owner, cluster-member, custom model() { - const gs = get(this, 'globalStore'); + const gs = this.globalStore; const cid = this.paramsFor('authenticated.cluster'); return hash({ cluster: gs.find('cluster', cid.cluster_id, { forceReload: true }), - roles: get(this, 'roleTemplateService').get('allFilteredRoleTemplates'), + roles: this.roleTemplateService.get('allFilteredRoleTemplates'), roleBindings: gs.findAll('clusterRoleTemplateBinding'), }); }, diff --git a/app/authenticated/cluster/storage/classes/detail/edit/route.js b/app/authenticated/cluster/storage/classes/detail/edit/route.js index 05190753ab..35ac742d74 100644 --- a/app/authenticated/cluster/storage/classes/detail/edit/route.js +++ b/app/authenticated/cluster/storage/classes/detail/edit/route.js @@ -1,5 +1,5 @@ import Route from '@ember/routing/route'; -import { get, set } from '@ember/object'; +import { get, set } from '@ember/object'; export default Route.extend({ model() { diff --git a/app/authenticated/cluster/storage/classes/detail/route.js b/app/authenticated/cluster/storage/classes/detail/route.js index db78e23b1d..f223f92e3e 100644 --- a/app/authenticated/cluster/storage/classes/detail/route.js +++ b/app/authenticated/cluster/storage/classes/detail/route.js @@ -1,5 +1,4 @@ import Route from '@ember/routing/route'; -import { get } from '@ember/object'; import { inject as service } from '@ember/service'; import { hash } from 'rsvp'; @@ -7,7 +6,7 @@ export default Route.extend({ clusterStore: service(), model(params) { - const clusterStore = get(this, 'clusterStore'); + const clusterStore = this.clusterStore; const storageClassId = params.storage_class_id; return hash({ diff --git a/app/authenticated/cluster/storage/classes/index/route.js b/app/authenticated/cluster/storage/classes/index/route.js index 5304415d68..d1e7fd2441 100644 --- a/app/authenticated/cluster/storage/classes/index/route.js +++ b/app/authenticated/cluster/storage/classes/index/route.js @@ -12,7 +12,7 @@ export default Route.extend({ this.transitionTo('authenticated.cluster.index'); } - return hash({ storageClasses: get(this, 'clusterStore').findAll('storageClass'), }); + return hash({ storageClasses: this.clusterStore.findAll('storageClass'), }); }, setDefaultRoute: on('activate', function() { diff --git a/app/authenticated/cluster/storage/classes/new/route.js b/app/authenticated/cluster/storage/classes/new/route.js index 25761dfd3e..95292599f1 100644 --- a/app/authenticated/cluster/storage/classes/new/route.js +++ b/app/authenticated/cluster/storage/classes/new/route.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ model(/* params, transition*/) { - return this.get('clusterStore').createRecord({ + return this.clusterStore.createRecord({ type: 'storageClass', provisioner: 'kubernetes.io/aws-ebs', reclaimPolicy: 'Delete', diff --git a/app/authenticated/cluster/storage/persistent-volumes/detail/edit/route.js b/app/authenticated/cluster/storage/persistent-volumes/detail/edit/route.js index ee6badf107..88de57aa53 100644 --- a/app/authenticated/cluster/storage/persistent-volumes/detail/edit/route.js +++ b/app/authenticated/cluster/storage/persistent-volumes/detail/edit/route.js @@ -1,5 +1,5 @@ import Route from '@ember/routing/route'; -import { set } from '@ember/object'; +import { set } from '@ember/object'; export default Route.extend({ model() { diff --git a/app/authenticated/cluster/storage/persistent-volumes/detail/route.js b/app/authenticated/cluster/storage/persistent-volumes/detail/route.js index 44ac2583b0..2a60a94c3f 100644 --- a/app/authenticated/cluster/storage/persistent-volumes/detail/route.js +++ b/app/authenticated/cluster/storage/persistent-volumes/detail/route.js @@ -1,11 +1,10 @@ import Route from '@ember/routing/route'; -import { get } from '@ember/object'; import { inject as service } from '@ember/service'; export default Route.extend({ clusterStore: service(), model(params) { - return get(this, 'clusterStore').find('persistentVolume', params.persistent_volume_id); + return this.clusterStore.find('persistentVolume', params.persistent_volume_id); }, }); diff --git a/app/authenticated/cluster/storage/persistent-volumes/index/route.js b/app/authenticated/cluster/storage/persistent-volumes/index/route.js index 55e42f10f0..7f832e39a4 100644 --- a/app/authenticated/cluster/storage/persistent-volumes/index/route.js +++ b/app/authenticated/cluster/storage/persistent-volumes/index/route.js @@ -12,7 +12,7 @@ export default Route.extend({ this.transitionTo('authenticated.cluster.index'); } - return hash({ persistentVolumes: get(this, 'clusterStore').findAll('persistentVolume'), }); + return hash({ persistentVolumes: this.clusterStore.findAll('persistentVolume'), }); }, setDefaultRoute: on('activate', function() { diff --git a/app/authenticated/cluster/storage/persistent-volumes/new/route.js b/app/authenticated/cluster/storage/persistent-volumes/new/route.js index 254bba86d1..ae9ea3edb2 100644 --- a/app/authenticated/cluster/storage/persistent-volumes/new/route.js +++ b/app/authenticated/cluster/storage/persistent-volumes/new/route.js @@ -2,6 +2,6 @@ import Route from '@ember/routing/route'; export default Route.extend({ model(/* params, transition*/) { - return this.get('clusterStore').createRecord({ type: 'persistentVolume', }); + return this.clusterStore.createRecord({ type: 'persistentVolume', }); }, }); diff --git a/app/authenticated/controller.js b/app/authenticated/controller.js index b5a18b385c..c305257a77 100644 --- a/app/authenticated/controller.js +++ b/app/authenticated/controller.js @@ -1,9 +1,8 @@ import { schedule } from '@ember/runloop'; -import { alias } from '@ember/object/computed'; +import { alias, gt } from '@ember/object/computed'; import { inject as service } from '@ember/service'; import Controller, { inject as controller } from '@ember/controller'; import C from 'ui/utils/constants'; -import { computed } from '@ember/object'; import { on } from '@ember/object/evented'; import { isEmbedded } from 'shared/utils/util'; @@ -17,11 +16,11 @@ export default Controller.extend({ isPopup: alias('application.isPopup'), pageScope: alias('scope.currentPageScope'), - hasHosts: computed.gt('model.hosts.length', 0), + hasHosts: gt('model.hosts.length', 0), bootstrap: on('init', function() { schedule('afterRender', this, () => { - this.get('application').setProperties({ + this.application.setProperties({ error: null, error_description: null, state: null, diff --git a/app/authenticated/prefs/controller.js b/app/authenticated/prefs/controller.js index cf39694470..2eb36c442b 100644 --- a/app/authenticated/prefs/controller.js +++ b/app/authenticated/prefs/controller.js @@ -9,7 +9,7 @@ export default Controller.extend({ actions: { editPassword() { - get(this, 'modal').toggleModal('modal-edit-password', { user: get(this, 'model.account') }); + this.modal.toggleModal('modal-edit-password', { user: get(this, 'model.account') }); }, }, }); diff --git a/app/authenticated/prefs/route.js b/app/authenticated/prefs/route.js index f38b70763c..47dc964fd4 100644 --- a/app/authenticated/prefs/route.js +++ b/app/authenticated/prefs/route.js @@ -9,7 +9,7 @@ export default Route.extend({ globalStore: service(), model(/* params, transition*/) { - return get(this, 'globalStore').find('user', null, { + return this.globalStore.find('user', null, { forceReload: true, filter: { me: true } }).then((user) => EmberObject.create({ account: get(user, 'firstObject'), /* dont like this */ })); diff --git a/app/authenticated/project/certificates/detail/edit/route.js b/app/authenticated/project/certificates/detail/edit/route.js index f95ebc69d5..35ef23718e 100644 --- a/app/authenticated/project/certificates/detail/edit/route.js +++ b/app/authenticated/project/certificates/detail/edit/route.js @@ -1,5 +1,5 @@ import Route from '@ember/routing/route'; -import { set } from '@ember/object'; +import { set } from '@ember/object'; export default Route.extend({ model() { diff --git a/app/authenticated/project/certificates/detail/route.js b/app/authenticated/project/certificates/detail/route.js index b2b636f84c..9b9afa0da9 100644 --- a/app/authenticated/project/certificates/detail/route.js +++ b/app/authenticated/project/certificates/detail/route.js @@ -1,5 +1,4 @@ import Route from '@ember/routing/route'; -import { get } from '@ember/object'; export default Route.extend({ model(params) { @@ -16,6 +15,6 @@ export default Route.extend({ return cert; } - return get(this, 'store').find('certificate', params.certificate_id); + return this.store.find('certificate', params.certificate_id); }, }); diff --git a/app/authenticated/project/certificates/new/route.js b/app/authenticated/project/certificates/new/route.js index 922a59af4e..78a170d938 100644 --- a/app/authenticated/project/certificates/new/route.js +++ b/app/authenticated/project/certificates/new/route.js @@ -2,7 +2,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ model(/* params, transition*/) { - return this.get('store').createRecord({ type: 'certificate' }); + return this.store.createRecord({ type: 'certificate' }); }, resetController(controller, isExiting/* , transition*/) { diff --git a/app/authenticated/project/certificates/route.js b/app/authenticated/project/certificates/route.js index a109def0fc..23101c5ef8 100644 --- a/app/authenticated/project/certificates/route.js +++ b/app/authenticated/project/certificates/route.js @@ -1,12 +1,12 @@ import Route from '@ember/routing/route'; import { hash } from 'rsvp' -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; import { on } from '@ember/object/evented'; import C from 'ui/utils/constants'; export default Route.extend({ model() { - const store = get(this, 'store'); + const store = this.store; return hash({ projectCerts: store.findAll('certificate'), diff --git a/app/authenticated/project/config-maps/detail/route.js b/app/authenticated/project/config-maps/detail/route.js index 4495f53d8c..688060b275 100644 --- a/app/authenticated/project/config-maps/detail/route.js +++ b/app/authenticated/project/config-maps/detail/route.js @@ -1,5 +1,4 @@ import Route from '@ember/routing/route'; -import { get } from '@ember/object'; export default Route.extend({ model(params) { @@ -11,6 +10,6 @@ export default Route.extend({ return configMaps; } - return get(this, 'store').find('configMap', params.config_map_id); + return this.store.find('configMap', params.config_map_id); }, }); diff --git a/app/authenticated/project/config-maps/new/route.js b/app/authenticated/project/config-maps/new/route.js index 4092262990..805dac52ae 100644 --- a/app/authenticated/project/config-maps/new/route.js +++ b/app/authenticated/project/config-maps/new/route.js @@ -4,12 +4,12 @@ import { get, set } from '@ember/object'; export default Route.extend({ model(params/* , transition */) { if (get(params, 'id')) { - const record = get(this, 'store').getById('configMap', get(params, 'id')); + const record = this.store.getById('configMap', get(params, 'id')); return record.cloneForNew(); } - return this.get('store').createRecord({ type: 'configMap' }); + return this.store.createRecord({ type: 'configMap' }); }, resetController(controller, isExiting/* , transition*/) { diff --git a/app/authenticated/project/config-maps/route.js b/app/authenticated/project/config-maps/route.js index 6cc4ade6bc..f54942b1dd 100644 --- a/app/authenticated/project/config-maps/route.js +++ b/app/authenticated/project/config-maps/route.js @@ -1,12 +1,12 @@ import Route from '@ember/routing/route'; import { hash } from 'rsvp' -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; import { on } from '@ember/object/evented'; import C from 'ui/utils/constants'; export default Route.extend({ model() { - const store = get(this, 'store'); + const store = this.store; return hash({ configMaps: store.findAll('configMap'), }); }, diff --git a/app/authenticated/project/console/route.js b/app/authenticated/project/console/route.js index 13b7aed7ec..b9df2c549c 100644 --- a/app/authenticated/project/console/route.js +++ b/app/authenticated/project/console/route.js @@ -9,10 +9,10 @@ export default Route.extend({ k8s: service(), model(params) { - let store = get(this, 'store'); + let store = this.store; if (params.kubernetes) { - return get(this, 'k8s').getInstanceToConnect(); + return this.k8s.getInstanceToConnect(); } return hash({ @@ -28,14 +28,14 @@ export default Route.extend({ set(controller, 'windows', model.windows === 'true'); set(controller, 'containerName', model.containerName); - if (controller.get('kubernetes')) { + if (controller.kubernetes) { defineProperty(controller, 'command', computed('cookies', 'model.pod.labels', function() { var labels = get(this, 'model.pod.labels') || {}; if ( `${ labels[C.LABEL.K8S_TOKEN] }` === 'true' ) { return [ 'kubectl-shell.sh', - get(this, 'cookies').get(C.COOKIE.TOKEN) || 'unauthorized' + this.cookies.get(C.COOKIE.TOKEN) || 'unauthorized' ]; } else { return ['/bin/bash', '-l', '-c', 'echo "# Run kubectl commands inside here\n# e.g. kubectl get rc\n"; TERM=xterm-256color /bin/bash']; diff --git a/app/authenticated/project/container-log/route.js b/app/authenticated/project/container-log/route.js index cd1f55a698..cddfb62c8b 100644 --- a/app/authenticated/project/container-log/route.js +++ b/app/authenticated/project/container-log/route.js @@ -1,11 +1,10 @@ import Route from '@ember/routing/route'; -import { get } from '@ember/object'; import { hash } from 'rsvp'; export default Route.extend({ model(params) { return hash({ - pod: get(this, 'store').find('pod', params.podId), + pod: this.store.find('pod', params.podId), containerName: params.containerName }); }, diff --git a/app/authenticated/project/controller.js b/app/authenticated/project/controller.js index fb684c9ffb..640f27aff3 100644 --- a/app/authenticated/project/controller.js +++ b/app/authenticated/project/controller.js @@ -1,6 +1,6 @@ import Controller from '@ember/controller'; import { computed, observer } from '@ember/object'; -import { alias } from '@ember/object/computed'; +import { alias, and } from '@ember/object/computed'; import { inject as service } from '@ember/service'; import C from 'ui/utils/constants'; import { isEmbedded } from 'shared/utils/util'; @@ -24,18 +24,18 @@ export default Controller.extend({ namespaces: alias('scope.currentProject.namespaces'), - showSystemProjectWarning: computed.and('model.project.isSystemProject', 'notEmbedded'), + showSystemProjectWarning: and('model.project.isSystemProject', 'notEmbedded'), init() { this._super(...arguments); - this.set('nodes', this.get('store').all('node')); + this.set('nodes', this.store.all('node')); this.set('expandedInstances', []); this.set('notEmbedded', !isEmbedded()); }, actions: { toggleExpand(instId) { - let list = this.get('expandedInstances'); + let list = this.expandedInstances; if ( list.includes(instId) ) { list.removeObject(instId); @@ -52,7 +52,7 @@ export default Controller.extend({ groupChanged: observer('group', function() { let key = `prefs.${ C.PREFS.CONTAINER_VIEW }`; let cur = this.get(key); - let neu = this.get('group'); + let neu = this.group; if ( cur !== neu ) { this.set(key, neu); @@ -63,9 +63,9 @@ export default Controller.extend({ }), groupTableBy: computed('group', function() { - if ( this.get('group') === NAMESPACE ) { + if ( this.group === NAMESPACE ) { return 'namespaceId'; - } else if ( this.get('group') === NODE ) { + } else if ( this.group === NODE ) { return 'nodeId'; } else { return null; @@ -73,7 +73,7 @@ export default Controller.extend({ }), preSorts: computed('groupTableBy', function() { - if ( this.get('groupTableBy') ) { + if ( this.groupTableBy ) { return ['namespace.isDefault:desc', 'namespace.displayName']; } else { return null; diff --git a/app/authenticated/project/dns/detail/edit/route.js b/app/authenticated/project/dns/detail/edit/route.js index 7f097c1b23..2834b50ac2 100644 --- a/app/authenticated/project/dns/detail/edit/route.js +++ b/app/authenticated/project/dns/detail/edit/route.js @@ -1,10 +1,10 @@ import Route from '@ember/routing/route'; -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; import { hash } from 'rsvp'; export default Route.extend({ model() { - const store = get(this, 'store'); + const store = this.store; const original = this.modelFor('authenticated.project.dns.detail').record; return hash({ diff --git a/app/authenticated/project/dns/detail/route.js b/app/authenticated/project/dns/detail/route.js index 1d7970b14e..275c51a839 100644 --- a/app/authenticated/project/dns/detail/route.js +++ b/app/authenticated/project/dns/detail/route.js @@ -1,10 +1,9 @@ import Route from '@ember/routing/route'; -import { get } from '@ember/object'; import { hash } from 'rsvp'; export default Route.extend({ model(params) { - const store = get(this, 'store'); + const store = this.store; return hash({ dnsRecords: store.findAll('service'), diff --git a/app/authenticated/project/dns/index/route.js b/app/authenticated/project/dns/index/route.js index f56a405511..4939a2b22b 100644 --- a/app/authenticated/project/dns/index/route.js +++ b/app/authenticated/project/dns/index/route.js @@ -6,7 +6,7 @@ import C from 'ui/utils/constants'; export default Route.extend({ model() { - var store = this.get('store'); + var store = this.store; return hash({ records: store.findAll('service'), }); }, diff --git a/app/authenticated/project/dns/new/route.js b/app/authenticated/project/dns/new/route.js index ef0e3b651d..d51f9806d0 100644 --- a/app/authenticated/project/dns/new/route.js +++ b/app/authenticated/project/dns/new/route.js @@ -4,7 +4,7 @@ import Route from '@ember/routing/route'; export default Route.extend({ model(params/* , transition*/) { - const store = get(this, 'store'); + const store = this.store; const deps = { dnsRecords: store.findAll('service'), diff --git a/app/authenticated/project/help/controller.js b/app/authenticated/project/help/controller.js index 69e22aad42..a2ea53caf1 100644 --- a/app/authenticated/project/help/controller.js +++ b/app/authenticated/project/help/controller.js @@ -37,7 +37,7 @@ export default Controller.extend({ out = { title: announcement.title, - link: `${ this.get('forumsLink') }/t/${ announcement.slug }`, + link: `${ this.forumsLink }/t/${ announcement.slug }`, created: announcement.created_at }; } diff --git a/app/authenticated/project/help/route.js b/app/authenticated/project/help/route.js index b4a2656e64..c989059319 100644 --- a/app/authenticated/project/help/route.js +++ b/app/authenticated/project/help/route.js @@ -5,7 +5,7 @@ import C from 'ui/utils/constants'; export default Route.extend({ beforeModel() { - this.get('store').findAll('host') + this.store.findAll('host') .then((hosts) => { this.controllerFor('authenticated.project.help').set('hasHosts', hosts.get('length') > 0); }); diff --git a/app/authenticated/project/hpa/detail/edit/route.js b/app/authenticated/project/hpa/detail/edit/route.js index 6ba9c6e4af..76d2c64e74 100644 --- a/app/authenticated/project/hpa/detail/edit/route.js +++ b/app/authenticated/project/hpa/detail/edit/route.js @@ -1,5 +1,4 @@ import Route from '@ember/routing/route'; -import { get } from '@ember/object'; import { hash } from 'rsvp'; import { inject as service } from '@ember/service'; @@ -7,8 +6,8 @@ export default Route.extend({ clusterStore: service(), model() { - const store = get(this, 'store'); - const clusterStore = get(this, 'clusterStore'); + const store = this.store; + const clusterStore = this.clusterStore; const original = this.modelFor('authenticated.project.hpa.detail').hpa; return hash({ diff --git a/app/authenticated/project/hpa/detail/route.js b/app/authenticated/project/hpa/detail/route.js index 2e90fae16b..5351c3ae02 100644 --- a/app/authenticated/project/hpa/detail/route.js +++ b/app/authenticated/project/hpa/detail/route.js @@ -1,10 +1,9 @@ import Route from '@ember/routing/route'; -import { get } from '@ember/object'; import { hash } from 'rsvp'; export default Route.extend({ model(params) { - const store = get(this, 'store'); + const store = this.store; return hash({ deployments: store.findAll('deployment'), diff --git a/app/authenticated/project/hpa/index/route.js b/app/authenticated/project/hpa/index/route.js index 156728d94d..e4e86e366a 100644 --- a/app/authenticated/project/hpa/index/route.js +++ b/app/authenticated/project/hpa/index/route.js @@ -1,11 +1,11 @@ import { on } from '@ember/object/evented'; -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; import Route from '@ember/routing/route'; import C from 'ui/utils/constants'; export default Route.extend({ model() { - var store = get(this, 'store'); + var store = this.store; return store.findAll('horizontalpodautoscaler') .then((hpas) => { diff --git a/app/authenticated/project/hpa/new/route.js b/app/authenticated/project/hpa/new/route.js index 00a11389cb..c8c74c5f2f 100644 --- a/app/authenticated/project/hpa/new/route.js +++ b/app/authenticated/project/hpa/new/route.js @@ -7,8 +7,8 @@ export default Route.extend({ clusterStore: service(), model(params) { - const store = get(this, 'store'); - const clusterStore = get(this, 'clusterStore'); + const store = this.store; + const clusterStore = this.clusterStore; const deps = { deployments: store.findAll('workload').then((workloads) => workloads.filter((w) => w.type === 'statefulSet' || w.type === 'deployment')), diff --git a/app/authenticated/project/ns/index/controller.js b/app/authenticated/project/ns/index/controller.js index 769a11e545..6c13ff48bc 100644 --- a/app/authenticated/project/ns/index/controller.js +++ b/app/authenticated/project/ns/index/controller.js @@ -41,8 +41,8 @@ export default Controller.extend({ actions: { newNs() { - get(this, 'session').set(C.SESSION.BACK_TO, window.location.href); - get(this, 'router').transitionTo('authenticated.cluster.projects.new-ns', get(this, 'scope.currentCluster.id'), { + this.session.set(C.SESSION.BACK_TO, window.location.href); + this.router.transitionTo('authenticated.cluster.projects.new-ns', get(this, 'scope.currentCluster.id'), { queryParams: { addTo: get(this, 'scope.currentProject.id'), from: 'project' diff --git a/app/authenticated/project/ns/index/route.js b/app/authenticated/project/ns/index/route.js index d05dc699af..21a863ad51 100644 --- a/app/authenticated/project/ns/index/route.js +++ b/app/authenticated/project/ns/index/route.js @@ -10,7 +10,7 @@ export default Route.extend({ clusterStore: service(), model() { - var store = this.get('clusterStore'); + var store = this.clusterStore; return hash({ namespaces: store.findAll('namespace'), }); }, diff --git a/app/authenticated/project/project-catalogs/controller.js b/app/authenticated/project/project-catalogs/controller.js index 45dee99972..aedc4d1f40 100644 --- a/app/authenticated/project/project-catalogs/controller.js +++ b/app/authenticated/project/project-catalogs/controller.js @@ -14,24 +14,24 @@ export default Controller.extend({ actions: { add() { - const record = get(this, 'globalStore').createRecord({ + const record = this.globalStore.createRecord({ type: 'projectcatalog', kind: 'helm', branch: 'master', projectId: get(this, 'scope.currentProject.id'), }); - get(this, 'modalService').toggleModal('modal-edit-catalog', { + this.modalService.toggleModal('modal-edit-catalog', { model: record, scope: 'project' }); }, goBack() { - if ( get(this, 'istio') ) { - get(this, 'router').transitionTo('authenticated.project.istio.project-istio.rules'); + if ( this.istio ) { + this.router.transitionTo('authenticated.project.istio.project-istio.rules'); } else { - get(this, 'router').transitionTo('apps-tab'); + this.router.transitionTo('apps-tab'); } } }, diff --git a/app/authenticated/project/project-catalogs/route.js b/app/authenticated/project/project-catalogs/route.js index 18c31595b0..8beafc5d02 100644 --- a/app/authenticated/project/project-catalogs/route.js +++ b/app/authenticated/project/project-catalogs/route.js @@ -1,12 +1,12 @@ import { inject as service } from '@ember/service'; import Route from '@ember/routing/route'; -import { set, get } from '@ember/object'; +import { set } from '@ember/object'; export default Route.extend({ catalog: service(), model() { - return get(this, 'catalog').fetchUnScopedCatalogs(); + return this.catalog.fetchUnScopedCatalogs(); }, resetController(controller, isExiting /* , transition*/ ) { diff --git a/app/authenticated/project/registries/detail/edit/route.js b/app/authenticated/project/registries/detail/edit/route.js index 32a558144c..d6c1b63576 100644 --- a/app/authenticated/project/registries/detail/edit/route.js +++ b/app/authenticated/project/registries/detail/edit/route.js @@ -1,5 +1,5 @@ import Route from '@ember/routing/route'; -import { set } from '@ember/object'; +import { set } from '@ember/object'; export default Route.extend({ model() { diff --git a/app/authenticated/project/registries/detail/route.js b/app/authenticated/project/registries/detail/route.js index b23ee68e2a..f48a024f90 100644 --- a/app/authenticated/project/registries/detail/route.js +++ b/app/authenticated/project/registries/detail/route.js @@ -1,5 +1,4 @@ import Route from '@ember/routing/route'; -import { get } from '@ember/object'; export default Route.extend({ model(params) { @@ -16,6 +15,6 @@ export default Route.extend({ return registry; } - return get(this, 'store').find('dockerCredential', params.registry_id); + return this.store.find('dockerCredential', params.registry_id); }, }); diff --git a/app/authenticated/project/registries/new/route.js b/app/authenticated/project/registries/new/route.js index 5786cc93cf..cb1bf97b61 100644 --- a/app/authenticated/project/registries/new/route.js +++ b/app/authenticated/project/registries/new/route.js @@ -4,11 +4,11 @@ import { get, set } from '@ember/object'; export default Route.extend({ model(params/* , transition*/) { if (get(params, 'id')) { - return get(this, 'store').find(get(params, 'type'), get(params, 'id')) + return this.store.find(get(params, 'type'), get(params, 'id')) .then( ( cred ) => cred.cloneForNew() ); } - return this.get('store').createRecord({ + return this.store.createRecord({ type: 'dockerCredential', registries: { 'index.docker.io': { diff --git a/app/authenticated/project/registries/route.js b/app/authenticated/project/registries/route.js index 6f0b4126a0..3022d05aed 100644 --- a/app/authenticated/project/registries/route.js +++ b/app/authenticated/project/registries/route.js @@ -1,12 +1,12 @@ import Route from '@ember/routing/route'; import { hash } from 'rsvp' -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; import { on } from '@ember/object/evented'; import C from 'ui/utils/constants'; export default Route.extend({ model() { - const store = get(this, 'store'); + const store = this.store; return hash({ projectDockerCredentials: store.findAll('dockerCredential'), diff --git a/app/authenticated/project/route.js b/app/authenticated/project/route.js index a5b9315058..8c47edf16c 100644 --- a/app/authenticated/project/route.js +++ b/app/authenticated/project/route.js @@ -29,7 +29,7 @@ export default Route.extend(Preload, { model(params, transition) { const isPopup = this.controllerFor('application').get('isPopup'); - return get(this, 'globalStore').find('project', params.project_id) + return this.globalStore.find('project', params.project_id) .then((project) => { const hideLocalCluster = get(this.settings, 'shouldHideLocalCluster'); @@ -37,7 +37,7 @@ export default Route.extend(Preload, { return this.replaceWith('authenticated'); } - return get(this, 'scope').startSwitchToProject(project, !isPopup) + return this.scope.startSwitchToProject(project, !isPopup) .then(() => PromiseAll([ this.loadSchemas('clusterStore'), this.loadSchemas('store'), @@ -60,7 +60,7 @@ export default Route.extend(Preload, { this.preload('persistentVolumeClaim'), ]).then(() => out) } - })) + })); }) .catch((err) => this.loadingError(err, transition)); }, @@ -90,7 +90,7 @@ export default Route.extend(Preload, { }, importYaml() { - get(this, 'modalService').toggleModal('modal-import', { + this.modalService.toggleModal('modal-import', { escToClose: true, mode: 'project', projectId: get(this, 'scope.currentProject.id') diff --git a/app/authenticated/project/secrets/detail/route.js b/app/authenticated/project/secrets/detail/route.js index 4d6bfe2103..a4159b775b 100644 --- a/app/authenticated/project/secrets/detail/route.js +++ b/app/authenticated/project/secrets/detail/route.js @@ -1,5 +1,4 @@ import Route from '@ember/routing/route'; -import { get } from '@ember/object'; export default Route.extend({ model(params) { @@ -16,6 +15,6 @@ export default Route.extend({ return secret; } - return get(this, 'store').find('secret', params.secret_id); + return this.store.find('secret', params.secret_id); }, }); diff --git a/app/authenticated/project/secrets/new/route.js b/app/authenticated/project/secrets/new/route.js index eea72d8ad2..f01c0f0ca4 100644 --- a/app/authenticated/project/secrets/new/route.js +++ b/app/authenticated/project/secrets/new/route.js @@ -4,11 +4,11 @@ import { get, set } from '@ember/object'; export default Route.extend({ model(params/* , transition*/) { if (get(params, 'id')) { - return get(this, 'store').find(get(params, 'type'), get(params, 'id')) + return this.store.find(get(params, 'type'), get(params, 'id')) .then( ( secret ) => secret.cloneForNew() ); } - return this.get('store').createRecord({ type: 'secret' }); + return this.store.createRecord({ type: 'secret' }); }, resetController(controller, isExiting/* , transition*/) { diff --git a/app/authenticated/project/secrets/route.js b/app/authenticated/project/secrets/route.js index 17d440e1b3..1c19c5a44b 100644 --- a/app/authenticated/project/secrets/route.js +++ b/app/authenticated/project/secrets/route.js @@ -1,12 +1,12 @@ import Route from '@ember/routing/route'; import { hash } from 'rsvp' -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; import { on } from '@ember/object/evented'; import C from 'ui/utils/constants'; export default Route.extend({ model() { - const store = get(this, 'store'); + const store = this.store; return hash({ projectSecrets: store.findAll('secret'), diff --git a/app/authenticated/project/security/members/edit/route.js b/app/authenticated/project/security/members/edit/route.js index 428032ed0a..7b1349db94 100644 --- a/app/authenticated/project/security/members/edit/route.js +++ b/app/authenticated/project/security/members/edit/route.js @@ -1,13 +1,12 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; -import { get } from '@ember/object'; import { hash } from 'rsvp'; export default Route.extend({ globalStore: service(), model(params) { - const store = get(this, 'globalStore'); + const store = this.globalStore; return hash({ role: store.find('projectroletemplatebinding', params.role_id), diff --git a/app/authenticated/project/security/members/new/route.js b/app/authenticated/project/security/members/new/route.js index fa8fc94ceb..6bb6f51f7c 100644 --- a/app/authenticated/project/security/members/new/route.js +++ b/app/authenticated/project/security/members/new/route.js @@ -1,6 +1,5 @@ import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; -import { get } from '@ember/object'; import { hash } from 'rsvp'; export default Route.extend({ @@ -8,12 +7,12 @@ export default Route.extend({ roleTemplateService: service('roleTemplate'), model() { - const gs = get(this, 'globalStore'); + const gs = this.globalStore; const pid = this.paramsFor('authenticated.project'); return hash({ project: gs.find('project', pid.project_id, { forceReload: true }), - roles: get(this, 'roleTemplateService').get('allFilteredRoleTemplates'), + roles: this.roleTemplateService.get('allFilteredRoleTemplates'), roleBindings: gs.findAll('projectRoleTemplateBinding'), }); } diff --git a/app/authenticated/route.js b/app/authenticated/route.js index 7a299b63a0..358873b0bb 100644 --- a/app/authenticated/route.js +++ b/app/authenticated/route.js @@ -78,17 +78,17 @@ export default Route.extend(Preload, { } if (get(this, 'settings.serverUrlIsEmpty')) { - get(this, 'router').transitionTo('update-critical-settings'); + this.router.transitionTo('update-critical-settings'); } }); }, model(params, transition) { - get(this, 'session').set(C.SESSION.BACK_TO, undefined); + this.session.set(C.SESSION.BACK_TO, undefined); const isPopup = this.controllerFor('application').get('isPopup'); - return get(this, 'scope').startSwitchToGlobal(!isPopup) + return this.scope.startSwitchToGlobal(!isPopup) .then(() => { const list = [ this.loadSchemas('globalStore'), @@ -97,7 +97,7 @@ export default Route.extend(Preload, { this.loadPreferences(), ]; - const globalStore = get(this, 'globalStore'); + const globalStore = this.globalStore; if ( !isPopup ) { list.addObjects([ @@ -138,7 +138,7 @@ export default Route.extend(Preload, { }, afterModel() { - return get(this, 'scope').finishSwitchToGlobal(); + return this.scope.finishSwitchToGlobal(); }, activate() { @@ -187,12 +187,12 @@ export default Route.extend(Preload, { deactivate() { this._super(); - const scope = get(this, 'scope'); + const scope = this.scope; scope.startSwitchToNothing().then(() => { scope.finishSwitchToNothing(); }); - cancel(get(this, 'testTimer')); + cancel(this.testTimer); }, actions: { @@ -229,10 +229,10 @@ export default Route.extend(Preload, { finishSwitch(id, transitionTo, transitionArgs) { // console.log('Switch finishing'); - const cookies = get(this, 'cookies'); + const cookies = this.cookies; var [whichCookie, idOut] = id.split(':'); - get(this, 'storeReset').reset(); + this.storeReset.reset(); if ( transitionTo ) { let args = (transitionArgs || []).slice(); @@ -249,7 +249,7 @@ export default Route.extend(Preload, { }, help() { - get(this, 'modalService').toggleModal('modal-shortcuts', { escToClose: true }); + this.modalService.toggleModal('modal-shortcuts', { escToClose: true }); }, // Special @@ -325,7 +325,7 @@ export default Route.extend(Preload, { const clusterId = get(this, 'scope.currentCluster.id'); if ( clusterId ) { - this.get('modalService').toggleModal('modal-kubectl', {}); + this.modalService.toggleModal('modal-kubectl', {}); } }, @@ -352,7 +352,7 @@ export default Route.extend(Preload, { }, testAuthToken() { - return get(this, 'access').testAuth() + return this.access.testAuth() .catch(() => { set(this, `session.${ C.SESSION.BACK_TO }`, window.location.href); this.transitionTo('login'); @@ -361,10 +361,10 @@ export default Route.extend(Preload, { }, loadPreferences() { - return get(this, 'globalStore').find('preference', null, { url: 'preference' }) + return this.globalStore.find('preference', null, { url: 'preference' }) .then((res) => { - get(this, 'language').initLanguage(true); - get(this, 'userTheme').setupTheme(); + this.language.initLanguage(true); + this.userTheme.setupTheme(); if (get(this, `prefs.${ C.PREFS.I_HATE_SPINNERS }`)) { $('BODY').addClass('i-hate-spinners'); @@ -375,20 +375,20 @@ export default Route.extend(Preload, { }, loadClusters() { - return get(this, 'scope').getAllClusters(); + return this.scope.getAllClusters(); }, loadProjects() { - return get(this, 'scope').getAllProjects(); + return this.scope.getAllProjects(); }, loadPublicSettings() { - return get(this, 'globalStore').find('setting', null, { url: 'settings' }); + return this.globalStore.find('setting', null, { url: 'settings' }); }, loadSecrets() { - if ( get(this, 'store').getById('schema', 'secret') ) { - return get(this, 'store').find('secret'); + if ( this.store.getById('schema', 'secret') ) { + return this.store.find('secret'); } else { return resolve(); } diff --git a/app/catalog-tab/index/controller.js b/app/catalog-tab/index/controller.js index 67decd0e48..899190c565 100644 --- a/app/catalog-tab/index/controller.js +++ b/app/catalog-tab/index/controller.js @@ -2,7 +2,6 @@ import { alias } from '@ember/object/computed'; import Controller, { inject as controller } from '@ember/controller'; import { isAlternate } from 'ui/utils/platform'; import { getOwner } from '@ember/application'; -import { get } from '@ember/object'; export default Controller.extend({ @@ -16,7 +15,7 @@ export default Controller.extend({ category: alias('catalogController.category'), actions: { categoryAction(category){ - this.transitionToRoute(this.get('launchRoute'), { queryParams: { category } }); + this.transitionToRoute(this.launchRoute, { queryParams: { category } }); }, launch(id, onlyAlternate) { @@ -24,10 +23,10 @@ export default Controller.extend({ return false; } - if ( get(this, 'istio') ) { - this.transitionToRoute(this.get('launchRoute'), id, { queryParams: { istio: true, } }); + if ( this.istio ) { + this.transitionToRoute(this.launchRoute, id, { queryParams: { istio: true, } }); } else { - this.transitionToRoute(this.get('launchRoute'), id); + this.transitionToRoute(this.launchRoute, id); } }, diff --git a/app/catalog-tab/launch/route.js b/app/catalog-tab/launch/route.js index 2fd3d8288a..0f3fbfdc38 100644 --- a/app/catalog-tab/launch/route.js +++ b/app/catalog-tab/launch/route.js @@ -36,8 +36,8 @@ export default Route.extend({ const currentVersion = getCurrentVersion(appData); // If an app ID is given, the current app version will be used in the app launch route. - dependencies.upgrade = get(this, 'catalog').fetchTemplate(`${ params.template }-${ params.upgrade }`, true, currentVersion); - dependencies.tpl = get(this, 'catalog').fetchTemplate(params.template, false, currentVersion); + dependencies.upgrade = this.catalog.fetchTemplate(`${ params.template }-${ params.upgrade }`, true, currentVersion); + dependencies.tpl = this.catalog.fetchTemplate(params.template, false, currentVersion); }) .catch((err) => { throw new Error(err); @@ -45,9 +45,9 @@ export default Route.extend({ } else { // If an app ID is not given, the current app version will not be used in the app launch route. if (params.upgrade) { - dependencies.upgrade = get(this, 'catalog').fetchTemplate(`${ params.template }-${ params.upgrade }`, true); + dependencies.upgrade = this.catalog.fetchTemplate(`${ params.template }-${ params.upgrade }`, true); } - dependencies.tpl = get(this, 'catalog').fetchTemplate(params.template); + dependencies.tpl = this.catalog.fetchTemplate(params.template); } @@ -239,7 +239,7 @@ export default Route.extend({ actions: { cancel() { - get(this, 'modalService').toggleModal(); + this.modalService.toggleModal(); }, }, @@ -256,7 +256,7 @@ export default Route.extend({ newAppName = this.dedupeName(get(duplicateNamespace, 'displayName')); } - const namespace = get(this, 'clusterStore').createRecord({ + const namespace = this.clusterStore.createRecord({ type: 'namespace', name: newAppName, projectId: this.modelFor('authenticated.project').get('project.id'), diff --git a/app/catalog-tab/route.js b/app/catalog-tab/route.js index b8aa237e13..a329ac7110 100644 --- a/app/catalog-tab/route.js +++ b/app/catalog-tab/route.js @@ -1,6 +1,5 @@ import { inject as service } from '@ember/service'; import Route from '@ember/routing/route'; -import { get } from '@ember/object'; export default Route.extend({ access: service(), @@ -10,14 +9,14 @@ export default Route.extend({ beforeModel() { this._super(...arguments); - return get(this, 'catalog').fetchUnScopedCatalogs(); + return this.catalog.fetchUnScopedCatalogs(); }, model() { // Do not use the model result const out = {}; - return get(this, 'catalog').fetchTemplates().then(() => out); + return this.catalog.fetchTemplates().then(() => out); }, resetController(controller, isExiting/* , transition*/) { diff --git a/app/components/cluster/cis/scan/detail/table-row/component.js b/app/components/cluster/cis/scan/detail/table-row/component.js index 0110b091be..afdfce5e32 100644 --- a/app/components/cluster/cis/scan/detail/table-row/component.js +++ b/app/components/cluster/cis/scan/detail/table-row/component.js @@ -1,3 +1,4 @@ +import { notEmpty } from '@ember/object/computed'; import Component from '@ember/component'; import { computed, get, set } from '@ember/object'; import layout from './template'; @@ -6,10 +7,10 @@ export default Component.extend({ layout, tagName: '', expanded: false, - hasExpandableContent: computed.notEmpty('model.nodes'), + hasExpandableContent: notEmpty('model.nodes'), actions: { toggle() { - set(this, 'expanded', !get(this, 'expanded')); + set(this, 'expanded', !this.expanded); }, toggleSkip() { get(this, 'model.toggleSkip')() @@ -19,10 +20,10 @@ export default Component.extend({ return get(this, 'model.skipList').indexOf(get(this, 'model.id')) !== -1; }), showSkipButton: computed('model.state', 'isInSkipList', function() { - return get(this, 'model.state') !== 'Pass' && get(this, 'model.state') !== 'N/A' && !get(this, 'isInSkipList'); + return get(this, 'model.state') !== 'Pass' && get(this, 'model.state') !== 'N/A' && !this.isInSkipList; }), showUnskipButton: computed('model.state', 'isInSkipList', function() { - return get(this, 'model.state') !== 'Pass' && get(this, 'isInSkipList'); + return get(this, 'model.state') !== 'Pass' && this.isInSkipList; }), badgeState: computed('model.state', function() { const state = get(this, 'model.state'); diff --git a/app/components/cluster/cis/scan/table-row/component.js b/app/components/cluster/cis/scan/table-row/component.js index 7d885150fa..94b017ccbd 100644 --- a/app/components/cluster/cis/scan/table-row/component.js +++ b/app/components/cluster/cis/scan/table-row/component.js @@ -1,3 +1,4 @@ +import { reads } from '@ember/object/computed'; import Component from '@ember/component'; import layout from './template'; import { computed } from '@ember/object' @@ -5,7 +6,7 @@ import { computed } from '@ember/object' export default Component.extend({ layout, tagName: '', - errorMessage: computed.reads('error.message'), + errorMessage: reads('error.message'), error: computed('model.status.conditions.[]', function() { return this.model.status.conditions.find((condition) => condition.type === 'Failed') }), diff --git a/app/components/container-default-limit/component.js b/app/components/container-default-limit/component.js index 7162185488..7bec26c6e4 100644 --- a/app/components/container-default-limit/component.js +++ b/app/components/container-default-limit/component.js @@ -1,4 +1,4 @@ -import { get, set, observer, setProperties } from '@ember/object'; +import { get, set, observer, setProperties } from '@ember/object'; import Component from '@ember/component'; import { convertToMillis } from 'shared/utils/util'; import { parseSi } from 'shared/utils/parse-unit'; @@ -27,10 +27,10 @@ export default Component.extend({ }, limitChanged: observer('requestsCpu', 'limitsCpu', 'requestsMemory', 'limitsMemory', function() { - const requestsCpu = get(this, 'requestsCpu'); - const limitsCpu = get(this, 'limitsCpu'); - const requestsMemory = get(this, 'requestsMemory'); - const limitsMemory = get(this, 'limitsMemory'); + const requestsCpu = this.requestsCpu; + const limitsCpu = this.limitsCpu; + const requestsMemory = this.requestsMemory; + const limitsMemory = this.limitsMemory; const out = {}; if ( requestsCpu ) { diff --git a/app/components/container-dot/component.js b/app/components/container-dot/component.js index 7a505e447b..2dfc524cb6 100644 --- a/app/components/container-dot/component.js +++ b/app/components/container-dot/component.js @@ -23,12 +23,12 @@ export default Component.extend({ resourceActionsObserver: on('init', observer('resourceActions.open', function() { if (this.get('tooltipService.openedViaContextClick')) { - this.get('tooltipService').set('openedViaContextClick', false); + this.tooltipService.set('openedViaContextClick', false); } })), click(event) { this.details(event); - this.get('tooltipService').hide(); + this.tooltipService.hide(); }, details(/* event*/) { @@ -38,7 +38,7 @@ export default Component.extend({ route = 'virtualmachine'; } - this.get('router').transitionTo(route, this.get('model.id')); + this.router.transitionTo(route, this.get('model.id')); }, contextMenu(event) { @@ -48,12 +48,12 @@ export default Component.extend({ event.preventDefault(); - if (this.get('type') === 'tooltip-action-menu') { - this.get('resourceActions').set('open', true); - this.get('tooltipService').set('openedViaContextClick', true); + if (this.type === 'tooltip-action-menu') { + this.resourceActions.set('open', true); + this.tooltipService.set('openedViaContextClick', true); $('.container-tooltip .more-actions').trigger('click'); } else { - this.get('resourceActions').setActionItems(this.get('model'), {}); + this.resourceActions.setActionItems(this.model, {}); } }, diff --git a/app/components/container-logs/component.js b/app/components/container-logs/component.js index 99bea529b8..b3682b641e 100644 --- a/app/components/container-logs/component.js +++ b/app/components/container-logs/component.js @@ -39,7 +39,7 @@ export default Component.extend({ if (AnsiUp) { this._bootstrap(); } else { - import('ansi_up').then( (module) => { + import('ansi_up').then( (module) => { // TODO: RC AnsiUp = module.default; this._bootstrap(); @@ -71,7 +71,7 @@ export default Component.extend({ }, willDestroyElement() { - clearInterval(get(this, 'followTimer')); + clearInterval(this.followTimer); this.disconnect(); this._super(); }, @@ -126,7 +126,7 @@ export default Component.extend({ }, wrapLinesDidChange: observer('wrapLines', function() { - set(this, `prefs.${ C.PREFS.WRAP_LINES }`, get(this, 'wrapLines')); + set(this, `prefs.${ C.PREFS.WRAP_LINES }`, this.wrapLines); }), watchReconnect: on('init', observer('containerName', 'isPrevious', function() { @@ -141,7 +141,7 @@ export default Component.extend({ _bootstrap() { setProperties(this, { wrapLines: !!get(this, `prefs.${ C.PREFS.WRAP_LINES }`), - containerName: get(this, 'containerName') || get(this, 'instance.containers.firstObject.name'), + containerName: this.containerName || get(this, 'instance.containers.firstObject.name'), }); this._initTimer(); @@ -149,7 +149,7 @@ export default Component.extend({ _initTimer() { const followTimer = setInterval(() => { - if ( get(this, 'isFollow') ) { + if ( this.isFollow ) { this.send('scrollToBottom'); } }, 1000); @@ -158,15 +158,15 @@ export default Component.extend({ }, exec() { - var instance = get(this, 'instance'); + var instance = this.instance; const clusterId = get(this, 'scope.currentCluster.id'); const namespaceId = get(instance, 'namespaceId'); const podName = get(instance, 'name'); - const containerName = get(this, 'containerName'); + const containerName = this.containerName; const scheme = window.location.protocol === 'https:' ? 'wss://' : 'ws://'; let url = `${ scheme }${ window.location.host }/k8s/clusters/${ clusterId }/api/v1/namespaces/${ namespaceId }/pods/${ podName }/log`; - url += `?container=${ encodeURIComponent(containerName) }&tailLines=${ LINES }&follow=true×tamps=true&previous=${ get(this, 'isPrevious') }`; + url += `?container=${ encodeURIComponent(containerName) }&tailLines=${ LINES }&follow=true×tamps=true&previous=${ this.isPrevious }`; this.connect(url); }, @@ -231,7 +231,7 @@ export default Component.extend({ disconnect() { set(this, 'status', 'closed'); - var socket = get(this, 'socket'); + var socket = this.socket; if (socket) { socket.close(); diff --git a/app/components/container-metrics/component.js b/app/components/container-metrics/component.js index cc1ce81cff..f6a26f9414 100644 --- a/app/components/container-metrics/component.js +++ b/app/components/container-metrics/component.js @@ -1,7 +1,7 @@ import Component from '@ember/component'; import Metrics from 'shared/mixins/metrics'; import layout from './template'; -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; export default Component.extend(Metrics, { layout, @@ -13,8 +13,8 @@ export default Component.extend(Metrics, { init() { this._super(...arguments); set(this, 'metricParams', { - podName: get(this, 'podId'), - containerName: get(this, 'resourceId') + podName: this.podId, + containerName: this.resourceId }); }, -}); \ No newline at end of file +}); diff --git a/app/components/container-table/component.js b/app/components/container-table/component.js index 54fa85543e..72cac07d95 100644 --- a/app/components/container-table/component.js +++ b/app/components/container-table/component.js @@ -45,9 +45,9 @@ export default Component.extend({ extraSearchFields: ['displayIp', 'primaryHost.displayName'], headers: computed('showNode', 'showStats', function() { - if ( this.get('showStats') ) { + if ( this.showStats ) { return headersWithStats; - } else if ( this.get('showNode') ) { + } else if ( this.showNode ) { return headersWithNode; } else { return headersWithoutHost; @@ -55,7 +55,7 @@ export default Component.extend({ }), filtered: computed('body.@each.isSystem', function() { - let out = this.get('body') || []; + let out = this.body || []; return out; }), diff --git a/app/components/container/form-command/component.js b/app/components/container/form-command/component.js index d5456739a9..7098e7e296 100644 --- a/app/components/container/form-command/component.js +++ b/app/components/container/form-command/component.js @@ -39,7 +39,7 @@ export default Component.extend({ scaleModeDidChange: observer('scaleMode', function() { const restartPolicy = get(this, 'service.restartPolicy'); - if ( get(this, 'isJob') ) { + if ( this.isJob ) { if ( restartPolicy === 'Always' ) { set(this, 'service.restartPolicy', 'Never'); } @@ -49,34 +49,34 @@ export default Component.extend({ }), isJob: computed('scaleMode', function() { - return get(this, 'scaleMode') === 'job' || get(this, 'scaleMode') === 'cronJob'; + return this.scaleMode === 'job' || this.scaleMode === 'cronJob'; }), // ---------------------------------- // Terminal // 'both', initTerminal() { - var instance = get(this, 'instance'); + var instance = this.instance; var tty = get(instance, 'tty'); var stdin = get(instance, 'stdin'); var out = { type: 'both', - name: get(this, 'intl').t('formCommand.console.both', { htmlSafe: true }), + name: this.intl.t('formCommand.console.both', { htmlSafe: true }), }; if ( tty !== undefined || stdin !== undefined ) { if ( tty && stdin ) { out.type = 'both'; - out.name = get(this, 'intl').t('formCommand.console.both', { htmlSafe: true }); + out.name = this.intl.t('formCommand.console.both', { htmlSafe: true }); } else if ( tty ) { out.type = 'terminal'; - out.name = get(this, 'intl').t('formCommand.console.terminal', { htmlSafe: true }); + out.name = this.intl.t('formCommand.console.terminal', { htmlSafe: true }); } else if ( stdin ) { out.type = 'interactive'; - out.name = get(this, 'intl').t('formCommand.console.interactive', { htmlSafe: true }); + out.name = this.intl.t('formCommand.console.interactive', { htmlSafe: true }); } else { out.type = 'none'; - out.name = get(this, 'intl').t('formCommand.console.none', { htmlSafe: true }); + out.name = this.intl.t('formCommand.console.none', { htmlSafe: true }); } } diff --git a/app/components/container/form-custom-metrics/component.js b/app/components/container/form-custom-metrics/component.js index 950462718b..65f8501f01 100644 --- a/app/components/container/form-custom-metrics/component.js +++ b/app/components/container/form-custom-metrics/component.js @@ -34,7 +34,7 @@ export default Component.extend({ actions: { add() { - get(this, 'metrics').pushObject({ + this.metrics.pushObject({ path: '', port: '', schema: HTTP @@ -42,11 +42,11 @@ export default Component.extend({ }, remove(obj) { - get(this, 'metrics').removeObject(obj); + this.metrics.removeObject(obj); }, }, metricsChanged: observer('metrics.@each.{port,path,schema}', function() { - set(this, 'workload.workloadMetrics', get(this, 'metrics').filter((metric) => get(metric, 'port'))); + set(this, 'workload.workloadMetrics', this.metrics.filter((metric) => get(metric, 'port'))); }) }); \ No newline at end of file diff --git a/app/components/container/form-image/component.js b/app/components/container/form-image/component.js index 1988e59b41..7175d57f51 100644 --- a/app/components/container/form-image/component.js +++ b/app/components/container/form-image/component.js @@ -24,9 +24,9 @@ export default Component.extend({ init() { this._super(...arguments); - set(this, 'allPods', get(this, 'store').all('pod')); + set(this, 'allPods', this.store.all('pod')); - let initial = get(this, 'initialValue') || ''; + let initial = this.initialValue || ''; if ( !lastContainer ) { lastContainer = (get(this, 'scope.currentCluster.isWindows') ? WINDOWS_LAST_CONTAINER : LINUX_LAST_CONTAINER) @@ -45,7 +45,7 @@ export default Component.extend({ }, userInputDidChange: observer('userInput', function() { - var input = (get(this, 'userInput') || '').trim(); + var input = (this.userInput || '').trim(); var out; if ( input && input.length ) { @@ -67,7 +67,7 @@ export default Component.extend({ suggestions: computed('allPods.@each.containers', function() { let inUse = []; - get(this, 'allPods').forEach((pod) => { + this.allPods.forEach((pod) => { inUse.addObjects(pod.get('containers') || []); }); @@ -82,7 +82,7 @@ export default Component.extend({ validate() { var errors = []; - if ( !get(this, 'value') ) { + if ( !this.value ) { errors.push('Image is required'); } diff --git a/app/components/container/form-job-config/component.js b/app/components/container/form-job-config/component.js index 6510c2645c..38c4d6921f 100644 --- a/app/components/container/form-job-config/component.js +++ b/app/components/container/form-job-config/component.js @@ -11,14 +11,14 @@ export default Component.extend({ classNames: ['accordion-wrapper'], didReceiveAttrs() { - if (!this.get('expandFn')) { + if (!this.expandFn) { this.set('expandFn', (item) => { item.toggleProperty('expanded'); }); } }, jobConfig: computed('scaleMode', 'workload.cronJobConfig.jobConfig', 'workload.jobConfig', function() { - const scaleMode = get(this, 'scaleMode'); + const scaleMode = this.scaleMode; let config; if ( scaleMode === 'job' ) { diff --git a/app/components/container/form-networking/component.js b/app/components/container/form-networking/component.js index 46236a2868..c3055a2cd3 100644 --- a/app/components/container/form-networking/component.js +++ b/app/components/container/form-networking/component.js @@ -81,7 +81,7 @@ export default Component.extend({ set(this, 'initHostAliasesArray', []); (aliases || []).forEach((alias) => { (alias.hostnames || []).forEach((hostname) => { - get(this, 'initHostAliasesArray').push({ + this.initHostAliasesArray.push({ key: alias.ip, value: hostname, }); @@ -94,7 +94,7 @@ export default Component.extend({ set(this, 'initOptionsArray', []); (options || []).forEach((option) => { - get(this, 'initOptionsArray').push({ + this.initOptionsArray.push({ key: get(option, 'name'), value: get(option, 'value'), }); diff --git a/app/components/container/form-ports/component.js b/app/components/container/form-ports/component.js index e3490edc20..affe8bfb74 100644 --- a/app/components/container/form-ports/component.js +++ b/app/components/container/form-ports/component.js @@ -45,7 +45,7 @@ export default Component.extend({ actions: { addPort() { - this.get('ports').pushObject(get(this, 'store').createRecord({ + this.ports.pushObject(this.store.createRecord({ type: 'containerPort', kind: 'NodePort', protocol: 'TCP', @@ -62,14 +62,14 @@ export default Component.extend({ }, removePort(obj) { - this.get('ports').removeObject(obj); + this.ports.removeObject(obj); }, }, portsChanged: observer('ports.@each.{containerPort,dnsName,hostIp,kind,name,protocol,sourcePort,_ipPort}', function() { const errors = []; - const intl = get(this, 'intl'); - const ports = get(this, 'ports'); + const intl = this.intl; + const ports = this.ports; ports.forEach((obj) => { let containerPort = obj.containerPort; @@ -126,7 +126,7 @@ export default Component.extend({ }), nodePortRangeDidChange: observer('intl.locale', 'scope.currentCluster.rancherKubernetesEngineConfig.services.kubeApi.serviceNodePortRange', function() { - const intl = get(this, 'intl'); + const intl = this.intl; const nodePortRange = get(this, 'scope.currentCluster.rancherKubernetesEngineConfig.services.kubeApi.serviceNodePortRange') const ccPorts = get(this, 'capabilities.allowedNodePortRanges'); @@ -168,7 +168,7 @@ export default Component.extend({ }), initPorts() { - let ports = get(this, 'initialPorts') || []; + let ports = this.initialPorts || []; ports.forEach((obj) => { if ( get(obj, 'kind') === 'HostPort' ) { diff --git a/app/components/container/form-scale/component.js b/app/components/container/form-scale/component.js index d788fc9039..b3a4836a95 100644 --- a/app/components/container/form-scale/component.js +++ b/app/components/container/form-scale/component.js @@ -60,7 +60,7 @@ export default Component.extend({ init() { this._super(...arguments); - let initial = get(this, 'initialScale'); + let initial = this.initialScale; if ( initial === null ) { initial = 1; @@ -68,18 +68,18 @@ export default Component.extend({ set(this, 'userInput', `${ initial }`); this.scaleModeChanged(); - if ( get(this, 'scaleMode') !== 'deployment' && !get(this, 'isUpgrade') ) { + if ( this.scaleMode !== 'deployment' && !this.isUpgrade ) { set(this, 'advancedShown', true); } }, actions: { increase() { - set(this, 'userInput', Math.min(get(this, 'max'), get(this, 'asInteger') + 1)); + set(this, 'userInput', Math.min(this.max, this.asInteger + 1)); }, decrease() { - set(this, 'userInput', Math.max(get(this, 'min'), get(this, 'asInteger') - 1)); + set(this, 'userInput', Math.max(this.min, this.asInteger - 1)); }, showAdvanced() { @@ -88,32 +88,32 @@ export default Component.extend({ }, scaleChanged: observer('asInteger', function() { - let cur = get(this, 'asInteger'); + let cur = this.asInteger; this.setScale(cur); }), scaleModeChanged: observer('scaleMode', function() { - var scaleMode = get(this, 'scaleMode'); + var scaleMode = this.scaleMode; if ( !scaleMode || scaleMode === 'sidekick' ) { return; } const config = `${ scaleMode }Config`; - const workload = get(this, 'workload'); + const workload = this.workload; if ( !get(workload, config) ) { - set(workload, config, get(this, 'store').createRecord(getDefaultConfig(scaleMode))); + set(workload, config, this.store.createRecord(getDefaultConfig(scaleMode))); } }), canAdvanced: computed('advancedShown', 'isUpgrade', 'scaleMode', function() { - if ( get(this, 'advancedShown') ) { + if ( this.advancedShown ) { return false; } - if ( get(this, 'isUpgrade') ) { + if ( this.isUpgrade ) { return false; } @@ -121,11 +121,11 @@ export default Component.extend({ }), asInteger: computed('userInput', function() { - return parseInt(get(this, 'userInput'), 10) || 0; + return parseInt(this.userInput, 10) || 0; }), canChangeScale: computed('scaleMode', function() { - return ['deployment', 'replicaSet', 'daemonSet', 'replicationController', 'statefulSet'].includes(get(this, 'scaleMode')); + return ['deployment', 'replicaSet', 'daemonSet', 'replicationController', 'statefulSet'].includes(this.scaleMode); }), setScale() { diff --git a/app/components/container/form-scheduling/component.js b/app/components/container/form-scheduling/component.js index aca02fa24a..62ded7efa8 100644 --- a/app/components/container/form-scheduling/component.js +++ b/app/components/container/form-scheduling/component.js @@ -32,16 +32,16 @@ export default Component.extend({ init() { this._super(...arguments); - set(this, '_allNodes', get(this, 'globalStore').all('node')); - set(this, 'advanced', !get(this, 'editing')); - if ( get(this, 'initialHostId') ) { + set(this, '_allNodes', this.globalStore.all('node')); + set(this, 'advanced', !this.editing); + if ( this.initialHostId ) { set(this, 'isRequestedHost', true); - set(this, 'requestedHostId', get(this, 'initialHostId')); + set(this, 'requestedHostId', this.initialHostId); } }, didReceiveAttrs() { - if ( !get(this, 'expandFn') ) { + if ( !this.expandFn ) { set(this, 'expandFn', (item) => { item.toggleProperty('expanded'); }); @@ -49,10 +49,10 @@ export default Component.extend({ }, isRequestedHostDidChange: observer('isRequestedHost', function() { - const scheduling = get(this, 'scheduling'); + const scheduling = this.scheduling; - if ( get(this, 'isRequestedHost') ) { - const hostId = get(this, 'requestedHostId') || get(this, 'hostChoices.firstObject.id'); + if ( this.isRequestedHost ) { + const hostId = this.requestedHostId || get(this, 'hostChoices.firstObject.id'); Object.keys(scheduling).forEach((key) => { if ( scheduling.node ) { @@ -67,7 +67,7 @@ export default Component.extend({ }), requestedHostIdDidChange: observer('requestedHostId', function() { - const hostId = get(this, 'requestedHostId'); + const hostId = this.requestedHostId; if ( get(this, 'scheduling.node') ) { set(this, 'scheduling.node.nodeId', hostId); @@ -77,11 +77,11 @@ export default Component.extend({ }), selectedChoice: computed('_allNodes.@each.{clusterId,id,name,state}', 'hostChoices', 'initialHostId', function() { - return get(this, 'hostChoices').findBy('id', get(this, 'initialHostId')); + return this.hostChoices.findBy('id', this.initialHostId); }), hostChoices: computed('_allNodes.@each.{clusterId,id,name,state}', 'scope.currentCluster.id', function() { - const list = get(this, '_allNodes').filter((node) => !get(node, 'isUnschedulable')) + const list = this._allNodes.filter((node) => !get(node, 'isUnschedulable')) .filterBy('clusterId', get(this, 'scope.currentCluster.id')) .map((host) => { let hostLabel = get(host, 'displayName'); diff --git a/app/components/container/form-security/component.js b/app/components/container/form-security/component.js index 8777288165..51ab4e8f1b 100644 --- a/app/components/container/form-security/component.js +++ b/app/components/container/form-security/component.js @@ -85,7 +85,7 @@ export default Component.extend({ }), memoryReservationChanged: observer('memoryReservationMb', function() { - var mem = get(this, 'memoryReservationMb'); + var mem = this.memoryReservationMb; if (isNaN(mem) || mem <= 0) { const requests = get(this, 'instance.resources.requests'); @@ -101,7 +101,7 @@ export default Component.extend({ }), cpuReservationChanged: observer('cpuReservationMillis', function() { - var cpu = get(this, 'cpuReservationMillis'); + var cpu = this.cpuReservationMillis; if (isNaN(cpu) || cpu <= 0) { const requests = get(this, 'instance.resources.requests'); @@ -113,7 +113,7 @@ export default Component.extend({ }), updateGpu: observer('gpuReservation', function() { - var gpu = get(this, 'gpuReservation'); + var gpu = this.gpuReservation; const requests = get(this, 'instance.resources.requests'); const limits = get(this, 'instance.resources.limits'); @@ -137,7 +137,7 @@ export default Component.extend({ initCapability() { set(this, 'instance.capAdd', get(this, 'instance.capAdd') || []); set(this, 'instance.capDrop', get(this, 'instance.capDrop') || []); - var choices = get(this, 'store').getById('schema', 'container') + var choices = this.store.getById('schema', 'container') .optionsFor('capAdd') .sort(); @@ -171,8 +171,8 @@ export default Component.extend({ }, updateMemory() { - let mem = parseInt(get(this, 'memoryMb'), 10); - let memoryMode = get(this, 'memoryMode'); + let mem = parseInt(this.memoryMb, 10); + let memoryMode = this.memoryMode; // Memory if (memoryMode === 'unlimited' || isNaN(mem) || mem <= 0) { @@ -205,8 +205,8 @@ export default Component.extend({ }, updateCpu() { - let cpu = parseInt(get(this, 'cpuMillis'), 10); - let cpuMode = get(this, 'cpuMode'); + let cpu = parseInt(this.cpuMillis, 10); + let cpuMode = this.cpuMode; if (cpuMode === 'unlimited' || isNaN(cpu) || cpu <= 0) { const limits = get(this, 'instance.resources.limits'); diff --git a/app/components/container/form-sources/component.js b/app/components/container/form-sources/component.js index 1be0dcbcfd..dc795e5c95 100644 --- a/app/components/container/form-sources/component.js +++ b/app/components/container/form-sources/component.js @@ -1,7 +1,7 @@ import { inject as service } from '@ember/service'; import Component from '@ember/component'; import layout from './template'; -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; export default Component.extend({ intl: service(), @@ -41,11 +41,11 @@ export default Component.extend({ init() { this._super(...arguments); - if (!get(this, 'sources') ) { + if (!this.sources ) { set(this, 'sources', []) } - get(this, 'sources').forEach((source) => { + this.sources.forEach((source) => { if ( source.sourceKey === undefined ) { set(source, 'sourceKey', null); } @@ -58,10 +58,10 @@ export default Component.extend({ sourceKey: null }; - get(this, 'sources').addObject(source); + this.sources.addObject(source); }, removeSource(source) { - get(this, 'sources').removeObject(source); + this.sources.removeObject(source); }, }, diff --git a/app/components/container/form-upgrade-deployment/component.js b/app/components/container/form-upgrade-deployment/component.js index 5037520609..9b7b3a6a62 100644 --- a/app/components/container/form-upgrade-deployment/component.js +++ b/app/components/container/form-upgrade-deployment/component.js @@ -25,7 +25,7 @@ export default Component.extend({ batchSize: null, didReceiveAttrs() { - const config = get(this, 'workloadConfig'); + const config = this.workloadConfig; let maxSurge = get(config, 'maxSurge'); let maxUnavailable = get(config, 'maxUnavailable'); let actualStrategy = get(config, 'strategy'); @@ -61,10 +61,10 @@ export default Component.extend({ }, strategyChanged: observer('_strategy', 'batchSize', function() { - const _strategy = get(this, '_strategy'); - const config = get(this, 'workloadConfig'); + const _strategy = this._strategy; + const config = this.workloadConfig; - let batchSize = maybeInt(get(this, 'batchSize')); + let batchSize = maybeInt(this.batchSize); let maxSurge = maybeInt(get(config, 'maxSurge')); let maxUnavailable = maybeInt(get(config, 'maxUnavailable')); diff --git a/app/components/container/form-upgrade/component.js b/app/components/container/form-upgrade/component.js index 8f5f46866d..0e8fdc1e11 100644 --- a/app/components/container/form-upgrade/component.js +++ b/app/components/container/form-upgrade/component.js @@ -12,7 +12,7 @@ export default Component.extend({ classNames: ['accordion-wrapper'], didReceiveAttrs() { - if (!this.get('expandFn')) { + if (!this.expandFn) { this.set('expandFn', (item) => { item.toggleProperty('expanded'); }); @@ -20,13 +20,13 @@ export default Component.extend({ }, workloadConfig: computed('scaleMode', function() { - const scaleMode = get(this, 'scaleMode'); + const scaleMode = this.scaleMode; const config = get(this, `workload.${ scaleMode }Config`); return config; }), componentName: computed('scaleMode', function() { - return `container/form-upgrade-${ get(this, 'scaleMode').dasherize() }`; + return `container/form-upgrade-${ this.scaleMode.dasherize() }`; }), }); diff --git a/app/components/container/form-volume-row/component.js b/app/components/container/form-volume-row/component.js index 2028db14fc..85aac69ee7 100644 --- a/app/components/container/form-volume-row/component.js +++ b/app/components/container/form-volume-row/component.js @@ -16,7 +16,7 @@ export default Component.extend({ init() { this._super(...arguments); - set(this, 'pvcs', get(this, 'store').all('persistentVolumeClaim')); + set(this, 'pvcs', this.store.all('persistentVolumeClaim')); }, didReceiveAttrs() { @@ -39,7 +39,7 @@ export default Component.extend({ actions: { defineNewVolume() { - get(this, 'modalService').toggleModal('modal-new-volume', { + this.modalService.toggleModal('modal-new-volume', { model: get(this, 'model.volume').clone(), callback: (volume) => { set(this, 'model.volume', volume); @@ -48,9 +48,9 @@ export default Component.extend({ }, defineNewPvc() { - get(this, 'modalService').toggleModal('modal-new-pvc', { + this.modalService.toggleModal('modal-new-pvc', { model: get(this, 'model.pvc'), - namespace: get(this, 'namespace'), + namespace: this.namespace, callback: (pvc) => { set(this, 'model.pvc', pvc); if ( !get(this, 'model.volume.name') ) { @@ -65,7 +65,7 @@ export default Component.extend({ modalService.toggleModal('modal-new-vct', { model: get(this, 'model.vct'), - namespace: get(this, 'namespace'), + namespace: this.namespace, callback: (vct) => { set(this, 'model.vct', vct); @@ -83,7 +83,7 @@ export default Component.extend({ }, addMount() { - const mount = get(this, 'store').createRecord({ type: 'volumeMount', }) + const mount = this.store.createRecord({ type: 'volumeMount', }) get(this, 'model.mounts').pushObject(mount); }, @@ -94,7 +94,7 @@ export default Component.extend({ }, pvcChoices: computed('pvcs.@each.{name,state}', 'namespace.id', function() { - return get(this, 'pvcs').filterBy('namespaceId', get(this, 'namespace.id')) + return this.pvcs.filterBy('namespaceId', get(this, 'namespace.id')) .map((v) => { let label = get(v, 'displayName'); const state = get(v, 'state'); diff --git a/app/components/container/form-volumes/component.js b/app/components/container/form-volumes/component.js index f714fe1773..f6c2d74ad6 100644 --- a/app/components/container/form-volumes/component.js +++ b/app/components/container/form-volumes/component.js @@ -62,28 +62,28 @@ export default Component.extend({ actions: { remove(obj) { - get(this, 'volumesArray').removeObject(obj); + this.volumesArray.removeObject(obj); }, addVolume() { - const store = get(this, 'store'); + const store = this.store; - get(this, 'volumesArray').pushObject({ + this.volumesArray.pushObject({ mode: NEW_VOLUME, volume: store.createRecord({ type: 'volume', name: this.nextName(), }), mounts: [ - get(this, 'store').createRecord({ type: 'volumeMount', }) + this.store.createRecord({ type: 'volumeMount', }) ], }); }, addNewPvc() { - const store = get(this, 'store'); + const store = this.store; - get(this, 'volumesArray').pushObject({ + this.volumesArray.pushObject({ mode: NEW_PVC, pvc: store.createRecord({ type: 'persistentVolumeClaim', }), name: null, @@ -101,9 +101,9 @@ export default Component.extend({ }, addPvc() { - const store = get(this, 'store'); + const store = this.store; - get(this, 'volumesArray').pushObject({ + this.volumesArray.pushObject({ mode: EXISTING_PVC, volume: store.createRecord({ type: 'volume', @@ -120,9 +120,9 @@ export default Component.extend({ }, addBindMount() { - const store = get(this, 'store'); + const store = this.store; - get(this, 'volumesArray').pushObject({ + this.volumesArray.pushObject({ mode: C.VOLUME_TYPES.BIND_MOUNT, volume: store.createRecord({ type: 'volume', @@ -140,9 +140,9 @@ export default Component.extend({ }, addTmpfs() { - const store = get(this, 'store'); + const store = this.store; - get(this, 'volumesArray').pushObject({ + this.volumesArray.pushObject({ mode: C.VOLUME_TYPES.TMPFS, volume: store.createRecord({ type: 'volume', @@ -159,9 +159,9 @@ export default Component.extend({ }, addConfigMap() { - const store = get(this, 'store'); + const store = this.store; - get(this, 'volumesArray').pushObject({ + this.volumesArray.pushObject({ mode: C.VOLUME_TYPES.CONFIG_MAP, volume: store.createRecord({ type: 'volume', @@ -180,9 +180,9 @@ export default Component.extend({ }, addSecret() { - const store = get(this, 'store'); + const store = this.store; - get(this, 'volumesArray').pushObject({ + this.volumesArray.pushObject({ mode: C.VOLUME_TYPES.SECRET, volume: store.createRecord({ type: 'volume', @@ -201,9 +201,9 @@ export default Component.extend({ }, addCertificate() { - const store = get(this, 'store'); + const store = this.store; - get(this, 'volumesArray').pushObject({ + this.volumesArray.pushObject({ mode: C.VOLUME_TYPES.CERTIFICATE, volume: store.createRecord({ type: 'volume', @@ -222,11 +222,11 @@ export default Component.extend({ }, addCustomLogPath() { - const store = get(this, 'store'); + const store = this.store; const name = this.nextName(); - get(this, 'volumesArray').pushObject({ + this.volumesArray.pushObject({ mode: C.VOLUME_TYPES.CUSTOM_LOG_PATH, volume: store.createRecord({ type: 'volume', @@ -277,7 +277,7 @@ export default Component.extend({ initVolumes() { - if (!get(this, 'expandFn')) { + if (!this.expandFn) { set(this, 'expandFn', (item) => { item.toggleProperty('expanded'); }); @@ -334,7 +334,7 @@ export default Component.extend({ }); // filter out custom log path volume when logging is disabled - if (!get(this, 'loggingEnabled')) { + if (!this.loggingEnabled) { set(this, 'volumesArray', out.filter((row) => row.mode !== C.VOLUME_TYPES.CUSTOM_LOG_PATH)); } else { set(this, 'volumesArray', out); @@ -342,7 +342,7 @@ export default Component.extend({ }, getSecretType(secretName) { - const store = get(this, 'store'); + const store = this.store; let found = store.all('secret').findBy('name', secretName); if ( found ) { @@ -361,7 +361,7 @@ export default Component.extend({ nextName() { const volumes = get(this, 'workload.volumes') || []; - let num = get(this, 'nextNum'); + let num = this.nextNum; let name; let ok = false; @@ -379,7 +379,7 @@ export default Component.extend({ saveVolumes() { const { workload, launchConfig } = this; - const ary = get(this, 'volumesArray') || []; + const ary = this.volumesArray || []; const promises = []; const statefulSetConfig = get(workload, 'statefulSetConfig') || {}; const volumeClaimTemplates = get(statefulSetConfig, 'volumeClaimTemplates') || []; @@ -392,7 +392,7 @@ export default Component.extend({ promises.push(get(row, 'pvc').save()); }); - if (get(this, 'isStatefulSet')) { + if (this.isStatefulSet) { ary.filterBy('vct').forEach((row) => { vct = get(row, 'vct'); volumeClaimTemplates.push(vct) @@ -404,8 +404,8 @@ export default Component.extend({ ary.filterBy('mode', C.VOLUME_TYPES.CUSTOM_LOG_PATH).filterBy('volume.flexVolume.driver', LOG_AGGREGATOR) .forEach((row) => { const options = get(row, 'volume.flexVolume.options'); - const lc = get(this, 'launchConfig'); - const workload = get(this, 'workload'); + const lc = this.launchConfig; + const workload = this.workload; if ( !get(row, 'hidden') ) { setProperties(options, { diff --git a/app/components/container/new-edit/component.js b/app/components/container/new-edit/component.js index b5f5e9c2ae..1481d59fa8 100644 --- a/app/components/container/new-edit/component.js +++ b/app/components/container/new-edit/component.js @@ -67,22 +67,22 @@ export default Component.extend(NewOrEdit, ChildHook, { window.nec = this; this._super(...arguments); - if (get(this, 'launchConfig') && !get(this, 'launchConfig.environmentFrom')) { + if (this.launchConfig && !get(this, 'launchConfig.environmentFrom')) { set(this, 'launchConfig.environmentFrom', []); } - const service = get(this, 'service'); + const service = this.service; const scheduling = get(service, 'scheduling') - if (!get(this, 'isSidekick') && !get(service, 'scheduling.node')) { + if (!this.isSidekick && !get(service, 'scheduling.node')) { set(service, 'scheduling', { ...scheduling, node: {} }); } - if (!get(this, 'isSidekick')) { + if (!this.isSidekick) { setProperties(this, { description: get(this, 'service.description'), scale: get(this, 'service.scale'), @@ -98,14 +98,14 @@ export default Component.extend(NewOrEdit, ChildHook, { namespaceId = get(this, 'service.namespaceId'); if (namespaceId) { - let namespace = get(this, 'clusterStore').getById('namespace', namespaceId); + let namespace = this.clusterStore.getById('namespace', namespaceId); if (namespace) { set(this, 'namespace', namespace); } } - if (!get(this, 'separateLivenessCheck')) { + if (!this.separateLivenessCheck) { const ready = get(this, 'launchConfig.readinessProbe'); const live = get(this, 'launchConfig.livenessProbe'); const readyStr = JSON.stringify(ready); @@ -116,7 +116,7 @@ export default Component.extend(NewOrEdit, ChildHook, { } } - if ( get(this, 'showTargetOS') && get(this, `prefs.${ C.PREFS.TARGET_OS }`) ) { + if ( this.showTargetOS && get(this, `prefs.${ C.PREFS.TARGET_OS }`) ) { set(this, 'targetOs', get(this, `prefs.${ C.PREFS.TARGET_OS }`)); } }, @@ -159,7 +159,7 @@ export default Component.extend(NewOrEdit, ChildHook, { }, toggleSeparateLivenessCheck() { - set(this, 'separateLivenessCheck', !get(this, 'separateLivenessCheck')); + set(this, 'separateLivenessCheck', !this.separateLivenessCheck); }, removeSidekick(idx) { @@ -173,9 +173,9 @@ export default Component.extend(NewOrEdit, ChildHook, { let args = {}; let k = 'newContainer.'; - k += `${ get(this, 'isUpgrade') ? 'upgrade' : 'add' }.`; - if (get(this, 'isSidekick')) { - let svc = get(this, 'service'); + k += `${ this.isUpgrade ? 'upgrade' : 'add' }.`; + if (this.isSidekick) { + let svc = this.service; if (svc && get(svc, 'id')) { k += 'sidekickName'; @@ -183,7 +183,7 @@ export default Component.extend(NewOrEdit, ChildHook, { } else { k += 'sidekick'; } - } else if (get(this, 'isGlobal')) { + } else if (this.isGlobal) { k += 'globalService'; } else { k += 'service'; @@ -194,7 +194,7 @@ export default Component.extend(NewOrEdit, ChildHook, { return; } - set(this, 'header', get(this, 'intl').t(k, args)); + set(this, 'header', this.intl.t(k, args)); }); })), @@ -203,11 +203,11 @@ export default Component.extend(NewOrEdit, ChildHook, { // Save // ---------------------------------- validate() { - let pr = get(this, 'primaryResource'); + let pr = this.primaryResource; let errors = pr.validationErrors() || []; - const lc = get(this, 'launchConfig'); + const lc = this.launchConfig; - const quotaErrors = lc.validateQuota(get(this, 'namespace')); + const quotaErrors = lc.validateQuota(this.namespace); errors.pushObjects(quotaErrors); @@ -225,27 +225,27 @@ export default Component.extend(NewOrEdit, ChildHook, { }); // Errors from components - errors.pushObjects(get(this, 'commandErrors') || []); - errors.pushObjects(get(this, 'volumeErrors') || []); - errors.pushObjects(get(this, 'networkingErrors') || []); - errors.pushObjects(get(this, 'secretsErrors') || []); - errors.pushObjects(get(this, 'readyCheckErrors') || []); - errors.pushObjects(get(this, 'liveCheckErrors') || []); - errors.pushObjects(get(this, 'schedulingErrors') || []); - errors.pushObjects(get(this, 'securityErrors') || []); - errors.pushObjects(get(this, 'scaleErrors') || []); - errors.pushObjects(get(this, 'imageErrors') || []); - errors.pushObjects(get(this, 'portErrors') || []); - errors.pushObjects(get(this, 'namespaceErrors') || []); - errors.pushObjects(get(this, 'labelErrors') || []); - errors.pushObjects(get(this, 'annotationErrors') || []); + errors.pushObjects(this.commandErrors || []); + errors.pushObjects(this.volumeErrors || []); + errors.pushObjects(this.networkingErrors || []); + errors.pushObjects(this.secretsErrors || []); + errors.pushObjects(this.readyCheckErrors || []); + errors.pushObjects(this.liveCheckErrors || []); + errors.pushObjects(this.schedulingErrors || []); + errors.pushObjects(this.securityErrors || []); + errors.pushObjects(this.scaleErrors || []); + errors.pushObjects(this.imageErrors || []); + errors.pushObjects(this.portErrors || []); + errors.pushObjects(this.namespaceErrors || []); + errors.pushObjects(this.labelErrors || []); + errors.pushObjects(this.annotationErrors || []); errors = errors.uniq(); if (get(errors, 'length')) { set(this, 'errors', errors); - if ( get(this, 'isSidekick') && !get(this, 'isUpgrade') ) { + if ( this.isSidekick && !this.isUpgrade ) { get(pr, 'secondaryLaunchConfigs').pop(); } @@ -258,17 +258,17 @@ export default Component.extend(NewOrEdit, ChildHook, { }, willSave() { - let intl = get(this, 'intl'); + let intl = this.intl; let pr; let nameResource; - let lc = get(this, 'launchConfig'); - let name = (get(this, 'name') || '').trim().toLowerCase(); - let service = get(this, 'service'); + let lc = this.launchConfig; + let name = (this.name || '').trim().toLowerCase(); + let service = this.service; let readinessProbe = get(lc, 'readinessProbe'); - if ( get(this, 'showTargetOS') && ( get(this, 'targetOs') === LINUX || get(this, 'targetOs') === WINDOWS ) ) { - const selector = get(this, 'targetOs') === WINDOWS ? WINDOWS_NODE_SELECTOR : LINUX_NODE_SELECTOR; + if ( this.showTargetOS && ( this.targetOs === LINUX || this.targetOs === WINDOWS ) ) { + const selector = this.targetOs === WINDOWS ? WINDOWS_NODE_SELECTOR : LINUX_NODE_SELECTOR; if ( !get(service, 'scheduling') ) { set(service, 'scheduling', { node: { requireAll: [selector] } }); @@ -286,7 +286,7 @@ export default Component.extend(NewOrEdit, ChildHook, { } } - if (!get(this, 'separateLivenessCheck')) { + if (!this.separateLivenessCheck) { if ( readinessProbe ) { const livenessProbe = Object.assign({}, readinessProbe); @@ -302,11 +302,11 @@ export default Component.extend(NewOrEdit, ChildHook, { set(lc, 'uid', null); } - if (get(this, 'isSidekick')) { + if (this.isSidekick) { let errors = []; if (!service) { - errors.push(get(this, 'intl').t('newContainer.errors.noSidekick')); + errors.push(this.intl.t('newContainer.errors.noSidekick')); set(this, 'errors', errors); return false; @@ -329,7 +329,7 @@ export default Component.extend(NewOrEdit, ChildHook, { set(pr, 'secondaryLaunchConfigs', slc); } - let lci = get(this, 'launchConfigIndex'); + let lci = this.launchConfigIndex; if (lci === undefined || lci === null) { // If it's a new sidekick, add it to the end of the list @@ -356,13 +356,13 @@ export default Component.extend(NewOrEdit, ChildHook, { set(pr, 'containers', [pr.containers[0]]); pr.containers.pushObjects(slc); } else { - service.clearConfigsExcept(`${ get(this, 'scaleMode') }Config`); - if ( get(this, 'scaleMode') === 'statefulSet' && !get(service, 'statefulSetConfig.serviceName') ) { + service.clearConfigsExcept(`${ this.scaleMode }Config`); + if ( this.scaleMode === 'statefulSet' && !get(service, 'statefulSetConfig.serviceName') ) { set(service, 'statefulSetConfig.serviceName', name); } pr = service; nameResource = pr; - set(pr, 'scale', get(this, 'scale')); + set(pr, 'scale', this.scale); const containers = get(pr, 'containers'); if (!containers) { @@ -375,7 +375,7 @@ export default Component.extend(NewOrEdit, ChildHook, { nameResource.setProperties({ name, - description: get(this, 'description'), + description: this.description, }); set(this, 'primaryResource', pr); @@ -410,8 +410,8 @@ export default Component.extend(NewOrEdit, ChildHook, { }, doneSaving() { - if (!get(this, 'isUpgrade')) { - let scaleMode = get(this, 'scaleMode'); + if (!this.isUpgrade) { + let scaleMode = this.scaleMode; if (scaleMode === 'sidekick') { // Remember sidekick as service since you're not @@ -423,8 +423,8 @@ export default Component.extend(NewOrEdit, ChildHook, { set(this, `prefs.${ C.PREFS.LAST_NAMESPACE }`, get(this, 'namespace.id')); - if ( get(this, 'showTargetOS') ) { - set(this, `prefs.${ C.PREFS.TARGET_OS }`, get(this, 'targetOs')); + if ( this.showTargetOS ) { + set(this, `prefs.${ C.PREFS.TARGET_OS }`, this.targetOs); } } if (this.done) { diff --git a/app/components/cru-certificate/component.js b/app/components/cru-certificate/component.js index 0f457be357..3feb7ae625 100644 --- a/app/components/cru-certificate/component.js +++ b/app/components/cru-certificate/component.js @@ -4,7 +4,10 @@ import { inject as service } from '@ember/service'; import ViewNewEdit from 'shared/mixins/view-new-edit'; import OptionallyNamespaced from 'shared/mixins/optionally-namespaced'; import layout from './template'; -import { validateCertWeakly, validateKeyWeakly } from 'shared/utils/util'; +import { + validateCertWeakly, + validateKeyWeakly +} from 'shared/utils/util'; export default Component.extend(ViewNewEdit, OptionallyNamespaced, { intl: service(), @@ -27,15 +30,15 @@ export default Component.extend(ViewNewEdit, OptionallyNamespaced, { validate() { this._super(); - var errors = get(this, 'errors') || []; + var errors = this.errors || []; - if ( get(this, 'scope') !== 'project' ) { - errors.pushObjects(get(this, 'namespaceErrors') || []); + if ( this.scope !== 'project' ) { + errors.pushObjects(this.namespaceErrors || []); } - var intl = get(this, 'intl'); + var intl = this.intl; - if (get(this, 'isEncrypted')) { + if (this.isEncrypted) { errors.push(intl.t('newCertificate.errors.encrypted')); } diff --git a/app/components/cru-config-map/component.js b/app/components/cru-config-map/component.js index 8cf39a5455..d9650c3bc5 100644 --- a/app/components/cru-config-map/component.js +++ b/app/components/cru-config-map/component.js @@ -46,7 +46,7 @@ export default Component.extend(ViewNewEdit, OptionallyNamespaced, { }, willSave() { - let pr = get(this, 'primaryResource'); + let pr = this.primaryResource; // Namespace is required, but doesn't exist yet... so lie to the validator let nsId = get(pr, 'namespaceId'); @@ -62,9 +62,9 @@ export default Component.extend(ViewNewEdit, OptionallyNamespaced, { validate() { this._super(); - const errors = get(this, 'errors') || []; + const errors = this.errors || []; - errors.pushObjects(get(this, 'namespaceErrors') || []); + errors.pushObjects(this.namespaceErrors || []); set(this, 'errors', errors); return errors.length === 0; diff --git a/app/components/cru-dns/component.js b/app/components/cru-dns/component.js index 16bcbd8cff..acabd0604f 100644 --- a/app/components/cru-dns/component.js +++ b/app/components/cru-dns/component.js @@ -87,7 +87,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { }, timeoutSecondsDidChange: observer('timeoutSeconds', function() { - const timeoutSeconds = get(this, 'timeoutSeconds'); + const timeoutSeconds = this.timeoutSeconds; if ( !get(this, 'model.sessionAffinityConfig.clientIP.timeoutSeconds') ) { set(this, 'model.sessionAffinityConfig', { clientIP: { timeoutSeconds } }) @@ -97,7 +97,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { }), kindDidChange: observer('kind', function() { - let kind = get(this, 'kind'); + let kind = this.kind; if ( kind === HEADLESS ) { kind = CLUSTER_IP; @@ -116,7 +116,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { }), namespaceDidChange: observer('namespace.id', function() { - if (get(this, 'recordType') === 'workload') { + if (this.recordType === 'workload') { if ( get(this, 'model.targetWorkloads').some((target) => target.namespaceId !== get(this, 'namespace.id')) ) { setProperties(this, { 'model.targetWorkloadIds': null, @@ -130,7 +130,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { }), recordTypeDidChange: observer('recordType', function() { - const recordType = get(this, 'recordType'); + const recordType = this.recordType; if ( recordType === CNAME ) { set(this, 'kind', EXTERNAL_NAME); @@ -140,15 +140,15 @@ export default Component.extend(ViewNewEdit, ChildHook, { }), showSessionAffinity: computed('isHeadless', 'kind', 'showMoreOptions', function() { - return get(this, 'showMoreOptions') && get(this, 'kind') !== HEADLESS; + return this.showMoreOptions && this.kind !== HEADLESS; }), showMoreOptions: computed('recordType', 'kind', function() { - return CNAME !== get(this, 'recordType'); + return CNAME !== this.recordType; }), isHeadless: computed('kind', function() { - return get(this, 'kind') === HEADLESS; + return this.kind === HEADLESS; }), /* @@ -161,7 +161,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { workloadsChoices: computed('namespace.id', 'workloads.[]', function() { const namespaceId = get(this, 'namespace.id'); - return (get(this, 'workloads') || []).filter((w) => get(w, 'namespaceId') === namespaceId); + return (this.workloads || []).filter((w) => get(w, 'namespaceId') === namespaceId); }), initKindChoices() { @@ -191,10 +191,10 @@ export default Component.extend(ViewNewEdit, ChildHook, { }, willSave() { - get(this, 'model').clearTypesExcept(get(this, 'recordType')); + this.model.clearTypesExcept(this.recordType); - if ( get(this, 'mode') === 'edit' && get(this, 'recordType') === WORKLOAD ) { - delete get(this, 'model')[SELECTOR]; + if ( this.mode === 'edit' && this.recordType === WORKLOAD ) { + delete this.model[SELECTOR]; } const ports = this.primaryResource.ports || []; @@ -208,7 +208,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { const sup = this._super; const errors = []; - errors.pushObjects(get(this, 'namespaceErrors') || []); + errors.pushObjects(this.namespaceErrors || []); set(this, 'errors', errors); if ( get(errors, 'length') !== 0 ) { @@ -225,8 +225,8 @@ export default Component.extend(ViewNewEdit, ChildHook, { }, validate() { - const errors = get(this, 'errors') || []; - const intl = get(this, 'intl'); + const errors = this.errors || []; + const intl = this.intl; const aliasTargets = (get(this, 'model.targetDnsRecords') || []); const aliases = aliasTargets.length; @@ -234,7 +234,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { const selectorKeys = Object.keys(get(this, 'model.selector') || {}).length; const workloads = (get(this, 'model.targetWorkloads') || []).length; - switch ( get(this, 'recordType') ) { + switch ( this.recordType ) { case ARECORD: if ( !(get(this, 'model.ipAddresses') || []).any((ip) => ip) ) { errors.pushObject(intl.t('editDns.errors.targetRequired')); diff --git a/app/components/cru-hpa/component.js b/app/components/cru-hpa/component.js index 129f2712ed..50f79705ce 100644 --- a/app/components/cru-hpa/component.js +++ b/app/components/cru-hpa/component.js @@ -38,11 +38,11 @@ export default Component.extend(ViewNewEdit, ChildHook, { }, }); - get(this, 'metrics').pushObject(metric); + this.metrics.pushObject(metric); }, removeMetric(metric) { - get(this, 'metrics').removeObject(metric); + this.metrics.removeObject(metric); }, setLabels(labels) { @@ -52,7 +52,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { }, namespaceDidChange: observer('deploymentsChoices', function() { - const deployments = get(this, 'deploymentsChoices') || []; + const deployments = this.deploymentsChoices || []; const found = deployments.findBy('id', get(this, 'model.workloadId')); if ( !found ) { @@ -61,17 +61,17 @@ export default Component.extend(ViewNewEdit, ChildHook, { }), selectedWorkload: computed('model.workloadId', 'deployments.[]', function() { - return (get(this, 'deployments') || []).findBy('id', get(this, 'model.workloadId')); + return (this.deployments || []).findBy('id', get(this, 'model.workloadId')); }), deploymentsChoices: computed('namespace.id', 'deployments.[]', function() { const namespaceId = get(this, 'namespace.id'); - return (get(this, 'deployments') || []).filter((w) => get(w, 'namespaceId') === namespaceId).sortBy('displayName'); + return (this.deployments || []).filter((w) => get(w, 'namespaceId') === namespaceId).sortBy('displayName'); }), resourceMetricsAvailable: computed('apiServices', function() { - const apiServices = get(this, 'apiServices') || []; + const apiServices = this.apiServices || []; return apiServices.find((api) => get(api, 'name').split('.').length === 4 && get(api, 'name').endsWith(RESOURCE_METRICS_API_GROUP)); }), @@ -79,9 +79,9 @@ export default Component.extend(ViewNewEdit, ChildHook, { validate() { this._super(); - const intl = get(this, 'intl'); + const intl = this.intl; - const errors = get(this, 'errors') || []; + const errors = this.errors || []; if ( get(this, 'model.minReplicas') === null ) { errors.pushObject(intl.t('validation.required', { key: intl.t('cruHpa.minReplicas.label') })); @@ -112,7 +112,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { const sup = this._super; const errors = []; - errors.pushObjects(get(this, 'namespaceErrors') || []); + errors.pushObjects(this.namespaceErrors || []); set(this, 'errors', errors); if ( get(errors, 'length') !== 0 ) { diff --git a/app/components/cru-persistent-volume-claim/component.js b/app/components/cru-persistent-volume-claim/component.js index 74c7ec611e..b27983a5d5 100644 --- a/app/components/cru-persistent-volume-claim/component.js +++ b/app/components/cru-persistent-volume-claim/component.js @@ -27,19 +27,19 @@ export default Component.extend(ViewNewEdit, ChildHook, { canUseStorageClass: gt('storageClasses.length', 0), didReceiveAttrs() { - if ( !get(this, 'persistentVolumes') ) { - set(this, 'persistentVolumes', get(this, 'clusterStore').all('persistentVolume')); + if ( !this.persistentVolumes ) { + set(this, 'persistentVolumes', this.clusterStore.all('persistentVolume')); } - if ( !get(this, 'storageClasses') ) { - set(this, 'storageClasses', get(this, 'clusterStore').all('storageClass')); + if ( !this.storageClasses ) { + set(this, 'storageClasses', this.clusterStore.all('storageClass')); } - if ( !get(this, 'selectNamespace') ) { + if ( !this.selectNamespace ) { set(this, 'primaryResource.namespaceId', get(this, 'namespace.id') || get(this, 'namespace.name')); } - if ( get(this, 'isNew') ) { + if ( this.isNew ) { const capacity = get(this, 'primaryResource.resources.requests.storage'); if ( capacity ) { @@ -49,7 +49,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { set(this, 'capacity', gib); } - if ( !get(this, 'canUseStorageClass')) { + if ( !this.canUseStorageClass) { set(this, 'useStorageClass', false); } } else { @@ -68,19 +68,19 @@ export default Component.extend(ViewNewEdit, ChildHook, { headerToken: computed('actuallySave', 'mode', function() { let k = 'cruPersistentVolumeClaim.'; - if ( get(this, 'actuallySave' ) ) { + if ( this.actuallySave ) { k += 'add.'; } else { k += 'define.'; } - k += get(this, 'mode'); + k += this.mode; return k; }), persistentVolumeChoices: computed('persistentVolumes.@each.{name,state}', function() { - return get(this, 'persistentVolumes').map((v) => { + return this.persistentVolumes.map((v) => { let label = get(v, 'displayName'); const state = get(v, 'state'); const disabled = state !== 'available'; @@ -98,13 +98,13 @@ export default Component.extend(ViewNewEdit, ChildHook, { .sortBy('label'); }), willSave() { - const pr = get(this, 'primaryResource'); - const intl = get(this, 'intl'); + const pr = this.primaryResource; + const intl = this.intl; - if ( get(this, 'useStorageClass') ) { + if ( this.useStorageClass ) { set(pr, 'volumeId', null); - const capacity = get(this, 'capacity'); + const capacity = this.capacity; if ( capacity ) { set(pr, 'resources', { requests: { storage: `${ capacity }Gi`, } }); @@ -121,7 +121,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { set(pr, 'resources', { requests: Object.assign({}, get(pr, 'persistentVolume.capacity')), }); } - if ( !get(this, 'actuallySave') ) { + if ( !this.actuallySave ) { let ok = this._super(...arguments); if ( ok ) { @@ -140,10 +140,10 @@ export default Component.extend(ViewNewEdit, ChildHook, { const self = this; const sup = this._super; - if ( get(this, 'selectNamespace') ) { + if ( this.selectNamespace ) { const errors = []; - errors.pushObjects(get(this, 'namespaceErrors') || []); + errors.pushObjects(this.namespaceErrors || []); set(this, 'errors', errors); if ( get(errors, 'length') !== 0 ) { diff --git a/app/components/cru-persistent-volume/component.js b/app/components/cru-persistent-volume/component.js index d1f69a6324..ceea57bfaf 100644 --- a/app/components/cru-persistent-volume/component.js +++ b/app/components/cru-persistent-volume/component.js @@ -25,14 +25,14 @@ export default Component.extend(ViewNewEdit, { init() { this._super(...arguments); - set(this, 'storageClasses', get(this, 'clusterStore').all('storageclass')); + set(this, 'storageClasses', this.clusterStore.all('storageclass')); }, didReceiveAttrs() { const { primaryResource } = this; const { sourceName = '' } = primaryResource; - if ( get(this, 'isNew') ) { + if ( this.isNew ) { set(this, 'capacity', 10); } else { const source = get(primaryResource, sourceName); @@ -70,7 +70,7 @@ export default Component.extend(ViewNewEdit, { }, sourceChoices: computed('intl.locale', function() { - const intl = get(this, 'intl'); + const intl = this.intl; const out = getSources('persistent').map((p) => { const entry = Object.assign({}, p); const key = `volumeSource.${ entry.name }.title`; @@ -90,9 +90,9 @@ export default Component.extend(ViewNewEdit, { }), supportedSourceChoices: computed('sourceChoices', function() { - const showUnsupported = get(this, 'features').isFeatureEnabled(C.FEATURES.UNSUPPORTED_STORAGE_DRIVERS); + const showUnsupported = this.features.isFeatureEnabled(C.FEATURES.UNSUPPORTED_STORAGE_DRIVERS); - return get(this, 'sourceChoices').filter((choice) => showUnsupported || choice.supported) + return this.sourceChoices.filter((choice) => showUnsupported || choice.supported); }), sourceDisplayName: computed('sourceName', 'sourceChoices.[]', function() { @@ -103,7 +103,7 @@ export default Component.extend(ViewNewEdit, { }), sourceComponent: computed('sourceName', function() { - const name = get(this, 'sourceName'); + const name = this.sourceName; const sources = getSources('persistent'); const entry = sources.findBy('name', name); @@ -115,9 +115,9 @@ export default Component.extend(ViewNewEdit, { }), willSave() { - const vol = get(this, 'primaryResource'); - const entry = getSources('persistent').findBy('name', get(this, 'sourceName')); - const intl = get(this, 'intl'); + const vol = this.primaryResource; + const entry = getSources('persistent').findBy('name', this.sourceName); + const intl = this.intl; const errors = []; if ( !entry ) { @@ -139,7 +139,7 @@ export default Component.extend(ViewNewEdit, { vol.clearSourcesExcept(entry.value); - const capacity = get(this, 'capacity'); + const capacity = this.capacity; if ( capacity ) { set(vol, 'capacity', { storage: `${ capacity }Gi`, }); diff --git a/app/components/cru-registry/component.js b/app/components/cru-registry/component.js index 72c1f7d924..5062a0fb4d 100644 --- a/app/components/cru-registry/component.js +++ b/app/components/cru-registry/component.js @@ -31,15 +31,15 @@ export default Component.extend(ViewNewEdit, OptionallyNamespaced, { set(this, 'scope', 'namespace'); set(this, 'namespace', get(this, 'model.namespace')); } - const globalRegistryEnabled = get(this, 'globalStore').all('setting').findBy('id', 'global-registry-enabled') || {}; + const globalRegistryEnabled = this.globalStore.all('setting').findBy('id', 'global-registry-enabled') || {}; set(this, 'globalRegistryEnabled', get(globalRegistryEnabled, 'value') === 'true') let asArray = JSON.parse(JSON.stringify(get(this, 'model.asArray') || [])) - if (!globalRegistryEnabled && get(this, 'mode') === 'new') { + if (!globalRegistryEnabled && this.mode === 'new') { asArray = asArray.map((item) => { - if (item.preset === get(this, 'hostname')) { + if (item.preset === this.hostname) { return { ...item, preset: 'custom' @@ -56,7 +56,7 @@ export default Component.extend(ViewNewEdit, OptionallyNamespaced, { arrayChanged: observer('asArray.@each.{preset,address,username,password,auth}', function() { const registries = {}; - get(this, 'asArray').forEach((obj) => { + this.asArray.forEach((obj) => { const preset = get(obj, 'preset'); let key = get(obj, 'address'); @@ -108,10 +108,10 @@ export default Component.extend(ViewNewEdit, OptionallyNamespaced, { validate() { this._super(); - const errors = get(this, 'errors') || []; + const errors = this.errors || []; - if ( get(this, 'scope') === 'namespace' && isEmpty(get(this, 'primaryResource.namespaceId')) ) { - errors.pushObjects(get(this, 'namespaceErrors') || []); + if ( this.scope === 'namespace' && isEmpty(get(this, 'primaryResource.namespaceId')) ) { + errors.pushObjects(this.namespaceErrors || []); } set(this, 'errors', errors); diff --git a/app/components/cru-secret/component.js b/app/components/cru-secret/component.js index c43380bd6e..95966ca4e1 100644 --- a/app/components/cru-secret/component.js +++ b/app/components/cru-secret/component.js @@ -28,7 +28,7 @@ export default Component.extend(ViewNewEdit, OptionallyNamespaced, { }, willSave() { - let pr = get(this, 'primaryResource'); + let pr = this.primaryResource; // Namespace is required, but doesn't exist yet... so lie to the validator let nsId = get(pr, 'namespaceId'); @@ -46,10 +46,10 @@ export default Component.extend(ViewNewEdit, OptionallyNamespaced, { validate() { this._super(); - const errors = get(this, 'errors') || []; + const errors = this.errors || []; - if ( get(this, 'scope') !== 'project' ) { - errors.pushObjects(get(this, 'namespaceErrors') || []); + if ( this.scope !== 'project' ) { + errors.pushObjects(this.namespaceErrors || []); } set(this, 'errors', errors); diff --git a/app/components/cru-storage-class/component.js b/app/components/cru-storage-class/component.js index b5c664bf8d..524d2a0f3e 100644 --- a/app/components/cru-storage-class/component.js +++ b/app/components/cru-storage-class/component.js @@ -62,7 +62,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { }), provisionerChoices: computed('intl.locale', function() { - const intl = get(this, 'intl'); + const intl = this.intl; const out = getProvisioners().map((p) => { const entry = Object.assign({}, p); const key = `storageClass.${ entry.name }.title`; @@ -82,9 +82,9 @@ export default Component.extend(ViewNewEdit, ChildHook, { }), supportedProvisionerChoices: computed('provisionerChoices', function() { - const showUnsupported = get(this, 'features').isFeatureEnabled(C.FEATURES.UNSUPPORTED_STORAGE_DRIVERS); + const showUnsupported = this.features.isFeatureEnabled(C.FEATURES.UNSUPPORTED_STORAGE_DRIVERS); - return get(this, 'provisionerChoices').filter((choice) => showUnsupported || choice.supported) + return this.provisionerChoices.filter((choice) => showUnsupported || choice.supported); }), willSave() { diff --git a/app/components/cru-volume-claim-template/component.js b/app/components/cru-volume-claim-template/component.js index 277419ca8c..a13bfc55aa 100644 --- a/app/components/cru-volume-claim-template/component.js +++ b/app/components/cru-volume-claim-template/component.js @@ -26,19 +26,19 @@ export default Component.extend(ViewNewEdit, ChildHook, { canUseStorageClass: gt('storageClasses.length', 0), didReceiveAttrs() { - if ( !get(this, 'persistentVolumes') ) { - set(this, 'persistentVolumes', get(this, 'clusterStore').all('persistentVolume')); + if ( !this.persistentVolumes ) { + set(this, 'persistentVolumes', this.clusterStore.all('persistentVolume')); } - if ( !get(this, 'storageClasses') ) { - set(this, 'storageClasses', get(this, 'clusterStore').all('storageClass')); + if ( !this.storageClasses ) { + set(this, 'storageClasses', this.clusterStore.all('storageClass')); } - if ( !get(this, 'selectNamespace') ) { + if ( !this.selectNamespace ) { set(this, 'primaryResource.namespaceId', get(this, 'namespace.id') || get(this, 'namespace.name')); } - if ( get(this, 'isNew') ) { + if ( this.isNew ) { const capacity = get(this, 'primaryResource.resources.requests.storage'); if ( capacity ) { @@ -48,7 +48,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { set(this, 'capacity', gib); } - if ( !get(this, 'canUseStorageClass')) { + if ( !this.canUseStorageClass) { set(this, 'useStorageClass', false); } } else { @@ -66,7 +66,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { }, persistentVolumeChoices: computed('persistentVolumes.@each.{name,state}', function() { - return get(this, 'persistentVolumes').map((v) => { + return this.persistentVolumes.map((v) => { let label = get(v, 'displayName'); const state = get(v, 'state'); const disabled = state !== 'available'; @@ -85,13 +85,13 @@ export default Component.extend(ViewNewEdit, ChildHook, { }), willSave() { - const pr = get(this, 'primaryResource'); - const intl = get(this, 'intl'); + const pr = this.primaryResource; + const intl = this.intl; - if ( get(this, 'useStorageClass') ) { + if ( this.useStorageClass ) { set(pr, 'volumeId', null); - const capacity = get(this, 'capacity'); + const capacity = this.capacity; if ( capacity ) { set(pr, 'resources', { requests: { storage: `${ capacity }Gi`, } }); @@ -108,7 +108,7 @@ export default Component.extend(ViewNewEdit, ChildHook, { set(pr, 'resources', { requests: Object.assign({}, get(pr, 'persistentVolume.capacity')), }); } - if ( !get(this, 'actuallySave') ) { + if ( !this.actuallySave ) { let ok = this._super(...arguments); if ( ok ) { @@ -125,10 +125,10 @@ export default Component.extend(ViewNewEdit, ChildHook, { const self = this; const sup = this._super; - if ( get(this, 'selectNamespace') ) { + if ( this.selectNamespace ) { const errors = []; - errors.pushObjects(get(this, 'namespaceErrors') || []); + errors.pushObjects(this.namespaceErrors || []); set(this, 'errors', errors); diff --git a/app/components/cru-volume/component.js b/app/components/cru-volume/component.js index 46fd69eb49..bbf3859133 100644 --- a/app/components/cru-volume/component.js +++ b/app/components/cru-volume/component.js @@ -17,7 +17,7 @@ export default Component.extend(ViewNewEdit, { titleKey: 'cruVolume.title', didReceiveAttrs() { - const selectedSource = (get(this, 'sourceChoices') || []).find((source) => !!get(this, `primaryResource.${ get(source, 'value') }`)); + const selectedSource = (this.sourceChoices || []).find((source) => !!get(this, `primaryResource.${ get(source, 'value') }`)); if ( selectedSource ) { set(this, 'sourceName', get(selectedSource, 'name')); @@ -39,13 +39,13 @@ export default Component.extend(ViewNewEdit, { headerToken: computed('mode', 'scope', function() { let k = 'cruPersistentVolumeClaim.define.'; - k += get(this, 'mode'); + k += this.mode; return k; }), sourceChoices: computed('intl.locale', function() { - const intl = get(this, 'intl'); + const intl = this.intl; const skip = ['host-path', 'secret']; const out = getSources('ephemeral').map((p) => { const entry = Object.assign({}, p); @@ -72,13 +72,13 @@ export default Component.extend(ViewNewEdit, { }), supportedSourceChoices: computed('sourceChoices', function() { - const showUnsupported = get(this, 'features').isFeatureEnabled(C.FEATURES.UNSUPPORTED_STORAGE_DRIVERS); + const showUnsupported = this.features.isFeatureEnabled(C.FEATURES.UNSUPPORTED_STORAGE_DRIVERS); - return get(this, 'sourceChoices').filter((choice) => showUnsupported || choice.supported) + return this.sourceChoices.filter((choice) => showUnsupported || choice.supported); }), sourceComponent: computed('sourceName', function() { - const name = get(this, 'sourceName'); + const name = this.sourceName; const sources = getSources('ephemeral'); const entry = sources.findBy('name', name); @@ -93,12 +93,12 @@ export default Component.extend(ViewNewEdit, { }), willSave() { - const vol = get(this, 'primaryResource'); - const entry = getSources('ephemeral').findBy('name', get(this, 'sourceName')); + const vol = this.primaryResource; + const entry = getSources('ephemeral').findBy('name', this.sourceName); if ( !entry ) { const errors = []; - const intl = get(this, 'intl'); + const intl = this.intl; errors.push(intl.t('validation.required', { key: intl.t('cruVolume.source.label') })); set(this, 'errors', errors); diff --git a/app/components/form-access-modes/component.js b/app/components/form-access-modes/component.js index ca9cacf1b7..2f2c7e8758 100644 --- a/app/components/form-access-modes/component.js +++ b/app/components/form-access-modes/component.js @@ -18,7 +18,7 @@ export default Component.extend({ let accessROX = false; let accessRWX = false; - if ( get(this, 'mode') !== 'new' ) { + if ( this.mode !== 'new' ) { const modes = get(this, 'model.accessModes') || []; accessRWO = modes.includes('ReadWriteOnce'); @@ -38,20 +38,20 @@ export default Component.extend({ modesChanged: observer('accessRWO', 'accessROX', 'accessRWX', function() { const modes = []; - if ( get(this, 'accessRWO') ) { + if ( this.accessRWO ) { modes.push('ReadWriteOnce'); } - if ( get(this, 'accessROX') ) { + if ( this.accessROX ) { modes.push('ReadOnlyMany'); } - if ( get(this, 'accessRWX') ) { + if ( this.accessRWX ) { modes.push('ReadWriteMany'); } set(this, 'model.accessModes', modes); }), editing: computed('mode', function() { - return get(this, 'mode') !== 'view'; + return this.mode !== 'view'; }), }); diff --git a/app/components/form-contextual-key-value/component.js b/app/components/form-contextual-key-value/component.js index c5059aadf5..0768e15d06 100644 --- a/app/components/form-contextual-key-value/component.js +++ b/app/components/form-contextual-key-value/component.js @@ -15,7 +15,7 @@ export default Component.extend({ valuePlaceholder: 'formKeyValue.value.placeholder', actions: { onAdd() { - const keyValuePairs = get(this, 'keyValuePairs'); + const keyValuePairs = this.keyValuePairs; // We push a null keyValuePair and replace it so that we can get the filteredContent // with the newly selected value visible to the provider of the contetFilter method. @@ -26,11 +26,11 @@ export default Component.extend({ }]); }, onRemove(index) { - get(this, 'keyValuePairs').removeAt(index); + this.keyValuePairs.removeAt(index); } }, asyncKeyContent: computed('keyContent', function() { - return StatefulPromise.wrap(get(this, 'keyContent'), []); + return StatefulPromise.wrap(this.keyContent, []); }), selections: computed('keyValuePairs.[]', 'asyncKeyContent.value', function() { return this.keyValuePairs @@ -46,10 +46,10 @@ export default Component.extend({ }), lastValue: computed('keyValuePairs', 'keyValuePairs.[]', { get() { - return get(this, 'keyValuePairs').objectAt(get(this, 'keyValuePairs.length') - 1); + return this.keyValuePairs.objectAt(get(this, 'keyValuePairs.length') - 1); }, set(key, value) { - get(this, 'keyValuePairs').set(get(this, 'keyValuePairs.length') - 1, value); + this.keyValuePairs.set(get(this, 'keyValuePairs.length') - 1, value); return value; } @@ -62,10 +62,10 @@ export default Component.extend({ return get(this, 'keyValuePairs.length') - 1; }), filteredKeyContent: computed('asyncKeyContent.value', 'keyContentFilter', 'keyValuePairs.[]', function() { - if (!get(this, 'keyContentFilter')) { + if (!this.keyContentFilter) { return get(this, 'asyncKeyContent.value') || []; } - return this.keyContentFilter(get(this, 'asyncKeyContent.value'), get(this, 'keyValuePairs').slice(0, -1)) || []; + return this.keyContentFilter(get(this, 'asyncKeyContent.value'), this.keyValuePairs.slice(0, -1)) || []; }), }); diff --git a/app/components/form-healthcheck/component.js b/app/components/form-healthcheck/component.js index 5a5b52580b..d59330bf4a 100644 --- a/app/components/form-healthcheck/component.js +++ b/app/components/form-healthcheck/component.js @@ -42,7 +42,7 @@ export default Component.extend({ init() { this._super(...arguments); - const initial = get(this, 'initialCheck'); + const initial = this.initialCheck; let check; let type = NONE; @@ -80,7 +80,7 @@ export default Component.extend({ set(this, 'headers', headers); } } else { - check = get(this, 'store').createRecord({ + check = this.store.createRecord({ type: 'probe', failureThreshold: 3, initialDelaySeconds: 10, @@ -91,7 +91,7 @@ export default Component.extend({ }); } - if ( get(this, 'successMustBeOne') ) { + if ( this.successMustBeOne ) { set(check, 'successThreshold', 1); } @@ -103,9 +103,9 @@ export default Component.extend({ }, checkChanged: observer('path', 'host', 'headers', 'checkType', 'command', function() { - const check = get(this, 'healthCheck'); + const check = this.healthCheck; - if ( get(this, 'isNone') ) { + if ( this.isNone ) { if (this.changed) { this.changed(null); } @@ -113,10 +113,10 @@ export default Component.extend({ return; } - setProperties(check, { tcp: get(this, 'isTcp') }); + setProperties(check, { tcp: this.isTcp }); - if ( get(this, 'isHttpish') ) { - const host = get(this, 'host'); + if ( this.isHttpish ) { + const host = this.host; const httpHeaders = []; if ( host ) { @@ -126,7 +126,7 @@ export default Component.extend({ }) } - const headers = get(this, 'headers') || {}; + const headers = this.headers || {}; Object.keys(headers).forEach((header) => { httpHeaders.push({ @@ -137,8 +137,8 @@ export default Component.extend({ setProperties(check, { httpHeaders, - path: get(this, 'path') || '/', - scheme: get(this, 'isHttps') ? 'HTTPS' : 'HTTP' + path: this.path || '/', + scheme: this.isHttps ? 'HTTPS' : 'HTTP' }); } else { setProperties(check, { @@ -147,8 +147,8 @@ export default Component.extend({ }); } - if ( get(this, 'isCommand') ) { - set(check, 'command', get(this, 'command') ); + if ( this.isCommand ) { + set(check, 'command', this.command ); } else { set(check, 'command', null); } @@ -163,11 +163,11 @@ export default Component.extend({ set(this, 'errors', errors); - if ( get(this, 'isNone') ) { + if ( this.isNone ) { return; } - if ( get(this, 'isCommand') ) { + if ( this.isCommand ) { if ( !get(this, 'healthCheck.command.length') ) { errors.push('Health Check command is required'); } diff --git a/app/components/form-key-to-path/component.js b/app/components/form-key-to-path/component.js index 58ed941bc6..b583cbee05 100644 --- a/app/components/form-key-to-path/component.js +++ b/app/components/form-key-to-path/component.js @@ -1,7 +1,7 @@ import { on } from '@ember/object/evented'; import { next, debounce } from '@ember/runloop'; import Component from '@ember/component'; -import EmberObject, { get, set, observer } from '@ember/object'; +import EmberObject, { set, observer } from '@ember/object'; import layout from './template'; import $ from 'jquery'; const SECRET = 'secret'; @@ -25,11 +25,11 @@ export default Component.extend({ this._super(...arguments); const ary = []; - const items = get(this, 'initialItems'); + const items = this.initialItems; - if ( get(this, 'mode') === SECRET ) { - const allSecrets = get(this, 'store').all('secret'); - const namespacedSecrets = get(this, 'store').all('namespacedSecret') + if ( this.mode === SECRET ) { + const allSecrets = this.store.all('secret'); + const namespacedSecrets = this.store.all('namespacedSecret') .filterBy('type', 'namespacedSecret'); allSecrets.pushObjects(namespacedSecrets); @@ -37,8 +37,8 @@ export default Component.extend({ this.updateSecretKeys(); } - if ( get(this, 'mode') === CONFIG_MAP ) { - const allConfigMaps = get(this, 'store').all('configmap'); + if ( this.mode === CONFIG_MAP ) { + const allConfigMaps = this.store.all('configmap'); set(this, 'allConfigMaps', allConfigMaps); this.updateConfigMapKeys(); @@ -62,7 +62,7 @@ export default Component.extend({ actions: { add() { - let ary = get(this, 'ary'); + let ary = this.ary; ary.pushObject(EmberObject.create({ key: '', @@ -84,19 +84,19 @@ export default Component.extend({ }, remove(obj) { - get(this, 'ary').removeObject(obj); + this.ary.removeObject(obj); }, }, secretDidChange: observer('secretName', function() { - if ( get(this, 'mode') === SECRET ) { + if ( this.mode === SECRET ) { this.updateSecretKeys(); set(this, 'ary', []); } }), configMapDidChange: observer('configMapName', function() { - if ( get(this, 'mode') === CONFIG_MAP ) { + if ( this.mode === CONFIG_MAP ) { this.updateConfigMapKeys(); set(this, 'ary', []); } @@ -108,8 +108,8 @@ export default Component.extend({ // Secret updateSecretKeys() { - const allSecrets = get(this, 'allSecrets'); - const secretName = get(this, 'secretName'); + const allSecrets = this.allSecrets; + const secretName = this.secretName; set(this, 'keys', []); @@ -127,8 +127,8 @@ export default Component.extend({ // Config Map updateConfigMapKeys() { - const allConfigMaps = get(this, 'allConfigMaps'); - const configMapName = get(this, 'configMapName'); + const allConfigMaps = this.allConfigMaps; + const configMapName = this.configMapName; set(this, 'keys', []); @@ -151,7 +151,7 @@ export default Component.extend({ const arr = []; - get(this, 'ary').forEach((row) => { + this.ary.forEach((row) => { const k = (row.get('key') || '').trim(); const p = (row.get('path') || '').trim(); const m = (row.get('mode') || '').trim(); diff --git a/app/components/form-node-affinity/component.js b/app/components/form-node-affinity/component.js index b490c05298..f69dbe3627 100644 --- a/app/components/form-node-affinity/component.js +++ b/app/components/form-node-affinity/component.js @@ -23,16 +23,16 @@ export default Component.extend({ addRule() { const rule = EmberObject.create({}); - get(this, 'rules').pushObject(rule); + this.rules.pushObject(rule); }, removeRule(rule) { - get(this, 'rules').removeObject(rule); + this.rules.removeObject(rule); }, }, rulesChanged: observer('rules.@each.matchExpressions', function() { - const out = (get(this, 'rules') || []).filter((rule) => { + const out = (this.rules || []).filter((rule) => { return rule.matchExpressions && rule.matchExpressions.length > 0; }); diff --git a/app/components/form-node-requirement/component.js b/app/components/form-node-requirement/component.js index c76ce26897..c35984a096 100644 --- a/app/components/form-node-requirement/component.js +++ b/app/components/form-node-requirement/component.js @@ -18,24 +18,24 @@ export default Component.extend({ }, didInsertElement() { - if (get(this, 'ruleArray.length') === 0 && get(this, 'initialRules') !== false) { + if (get(this, 'ruleArray.length') === 0 && this.initialRules !== false) { this.send('addRule'); } }, actions: { addRule() { - get(this, 'ruleArray').pushObject({ operator: 'In' }); + this.ruleArray.pushObject({ operator: 'In' }); }, removeRule(rule) { - get(this, 'ruleArray').removeObject(rule); + this.ruleArray.removeObject(rule); } }, ruleChanged: observer('ruleArray.@each.{key,operator,values}', function() { set(this, 'term.matchExpressions', - (get(this, 'ruleArray') || []) + (this.ruleArray || []) .filter((rule) => { if (rule.operator === 'In' || rule.operator === 'NotIn' ) { return rule.values; diff --git a/app/components/form-pod-scheduling-row/component.js b/app/components/form-pod-scheduling-row/component.js index 9c19710054..6f6c4ba6b7 100644 --- a/app/components/form-pod-scheduling-row/component.js +++ b/app/components/form-pod-scheduling-row/component.js @@ -53,10 +53,10 @@ export default Component.extend({ }), namepsacesChanged: observer('_namespaces', function() { - if (!get(this, '_namespaces')) { + if (!this._namespaces) { set(this, 'model.namespaces', null); } else { - set(this, 'model.namespaces', get(this, '_namespaces').split(',')); + set(this, 'model.namespaces', this._namespaces.split(',')); } }), @@ -71,7 +71,7 @@ export default Component.extend({ initTopologyChoices: observer('nodes.[]', function() { const uniqueObj = {}; - get(this, 'nodes').forEach((node) => { + this.nodes.forEach((node) => { Object.keys(node.metadata.labels).forEach((l) => (uniqueObj[l] = true)); }); @@ -84,11 +84,11 @@ export default Component.extend({ }), showNamepsaceChanged: observer('showNamespace', function() { - if (get(this, 'showNamespace') === 'true') { + if (this.showNamespace === 'true') { set(this, 'model.namespaces', []); set(this, '_namespaces', null); set(this, 'model.namespaceSelector', null); - } else if (get(this, 'showNamespace') === 'all') { + } else if (this.showNamespace === 'all') { set(this, 'model.namespaceSelector', {}); set(this, 'model.namespaces', null); set(this, '_namespaces', null); diff --git a/app/components/form-related-workloads/component.js b/app/components/form-related-workloads/component.js index f89262ef88..4d8c992e2f 100644 --- a/app/components/form-related-workloads/component.js +++ b/app/components/form-related-workloads/component.js @@ -17,7 +17,7 @@ export default Component.extend({ actions: { toggleExpand(instId) { - let list = this.get('expandedInstances'); + let list = this.expandedInstances; if ( list.includes(instId) ) { list.removeObject(instId); diff --git a/app/components/form-scoped-roles/component.js b/app/components/form-scoped-roles/component.js index 3c4f9a598c..647d6f67cb 100644 --- a/app/components/form-scoped-roles/component.js +++ b/app/components/form-scoped-roles/component.js @@ -29,15 +29,15 @@ export default Component.extend(NewOrEdit, { init() { this._super(...arguments); - let model = { type: `${ get(this, 'type') }RoleTemplateBinding`, }; + let model = { type: `${ this.type }RoleTemplateBinding`, }; - set(model, `${ get(this, 'type') }Id`, get(this, `model.${ get(this, 'type') }.id`)) + set(model, `${ this.type }Id`, get(this, `model.${ this.type }.id`)) setProperties(this, { primaryResource: this.make(model), - stdUser: `${ get(this, 'type') }-member`, - admin: `${ get(this, 'type') }-owner`, - cTyped: get(this, 'type').capitalize(), + stdUser: `${ this.type }-member`, + admin: `${ this.type }-owner`, + cTyped: this.type.capitalize(), }); }, @@ -71,11 +71,11 @@ export default Component.extend(NewOrEdit, { }, save(cb) { set(this, 'errors', null); - let mode = get(this, 'mode'); + let mode = this.mode; let add = []; - let pr = get(this, 'primaryResource'); - const userRoles = get(this, 'userRoles'); - let principal = get(this, 'principal'); + let pr = this.primaryResource; + const userRoles = this.userRoles; + let principal = this.principal; if (principal) { if (get(principal, 'principalType') === 'user') { @@ -86,15 +86,15 @@ export default Component.extend(NewOrEdit, { } switch ( mode ) { - case `${ get(this, 'type') }-owner`: - case `${ get(this, 'type') }-member`: + case `${ this.type }-owner`: + case `${ this.type }-member`: case 'read-only': set(pr, 'roleTemplateId', mode); add = [pr]; break; case CUSTOM: - add = get(this, 'customToAdd').map((x) => { - let neu = get(this, 'primaryResource').clone(); + add = this.customToAdd.map((x) => { + let neu = this.primaryResource.clone(); set(neu, 'roleTemplateId', get(x, 'role.id')); @@ -132,10 +132,10 @@ export default Component.extend(NewOrEdit, { }, showAdmin: computed('mode', 'model.roles.@each.id', 'type', function() { - const id = `${ get(this, 'type') }-owner`; + const id = `${ this.type }-owner`; const role = get(this, 'model.roles').findBy('id', id); - if ( get(this, 'mode') === id ) { + if ( this.mode === id ) { return true; } @@ -147,10 +147,10 @@ export default Component.extend(NewOrEdit, { }), showStdUser: computed('mode', 'model.roles.@each.id', 'type', function() { - const id = `${ get(this, 'type') }-member`; + const id = `${ this.type }-member`; const role = get(this, 'model.roles').findBy('id', id); - if ( get(this, 'mode') === id ) { + if ( this.mode === id ) { return true; } @@ -165,7 +165,7 @@ export default Component.extend(NewOrEdit, { const id = 'read-only'; const role = get(this, 'model.roles').findBy('id', id); - if ( get(this, 'mode') === id ) { + if ( this.mode === id ) { return true; } @@ -179,9 +179,9 @@ export default Component.extend(NewOrEdit, { baseRoles: computed('type', function() { return [ - `${ get(this, 'type') }-admin`, - `${ get(this, 'type') }-owner`, - `${ get(this, 'type') }-member`, + `${ this.type }-admin`, + `${ this.type }-owner`, + `${ this.type }-member`, 'read-only' ]; }), @@ -191,7 +191,7 @@ export default Component.extend(NewOrEdit, { let userDef = roles.filter((role) => !get(role, 'builtin') && !get(role, 'external') && !get(role, 'hidden') - && (get(role, 'context') === get(this, 'type') || !get(role, 'context'))); + && (get(role, 'context') === this.type || !get(role, 'context'))); return userDef.map((role) => { return { @@ -204,8 +204,8 @@ export default Component.extend(NewOrEdit, { custom: computed('baseRoles', 'model.roles.[]', 'type', function() { // built in let roles = get(this, 'model.roles').filterBy('hidden', false); - let excludes = get(this, 'baseRoles'); - let context = `${ get(this, 'type') }`; + let excludes = this.baseRoles; + let context = `${ this.type }`; return roles.filter((role) => !excludes.includes(role.id) && get(role, 'builtin') @@ -221,9 +221,9 @@ export default Component.extend(NewOrEdit, { get() { let mode = null; - const memberId = `${ get(this, 'type') }-member`; + const memberId = `${ this.type }-member`; const memberRole = get(this, 'model.roles').findBy('id', memberId); - const ownerId = `${ get(this, 'type') }-owner`; + const ownerId = `${ this.type }-owner`; const onwerRole = get(this, 'model.roles').findBy('id', ownerId); if ( memberRole ) { @@ -243,7 +243,7 @@ export default Component.extend(NewOrEdit, { }, set(key, value) { if (typeof value === 'object') { - const ur = get(this, 'userRoles').findBy('active', true); + const ur = this.userRoles.findBy('active', true); if ( ur ) { set(ur, 'active', false); @@ -252,7 +252,7 @@ export default Component.extend(NewOrEdit, { // value = get(value, 'role.id'); // return get(value, 'role.id'); } else { - let ur = get(this, 'userRoles').findBy('active', true); + let ur = this.userRoles.findBy('active', true); if (ur) { next(() => { @@ -266,20 +266,20 @@ export default Component.extend(NewOrEdit, { }), customToAdd: computed('custom.@each.active', function() { - return get(this, 'custom').filter( (role) => get(role, 'active') ); + return this.custom.filter( (role) => get(role, 'active') ); }), make(role) { - return get(this, 'globalStore').createRecord(role); + return this.globalStore.createRecord(role); }, validate() { var errors = this.get('errors', errors) || []; - let principal = get(this, 'principal'); + let principal = this.principal; if ( !principal ) { - errors.push(this.get('intl').t('rolesPage.new.errors.memberReq')); + errors.push(this.intl.t('rolesPage.new.errors.memberReq')); set(this, 'errors', errors); return false; @@ -288,26 +288,26 @@ export default Component.extend(NewOrEdit, { const current = (get(this, 'model.roleBindings') || []).filter((role) => { let id; - if ( get(this, 'type') === 'project' ) { + if ( this.type === 'project' ) { id = get(this, 'scope.currentProject.id'); } else { id = get(this, 'scope.currentCluster.id'); } - return id === get(role, `${ get(this, 'type') }Id`) && get(role, 'userPrincipalId') === get(principal, 'id'); + return id === get(role, `${ this.type }Id`) && get(role, 'userPrincipalId') === get(principal, 'id'); }); - if (get(this, 'mode') === 'custom') { + if (this.mode === 'custom') { if (get(this, 'customToAdd.length') < 1) { - errors.push(this.get('intl').t('rolesPage.new.errors.noSelectedRoles')); + errors.push(this.intl.t('rolesPage.new.errors.noSelectedRoles')); } - (get(this, 'customToAdd') || []).forEach((add) => { + (this.customToAdd || []).forEach((add) => { if ( current.findBy('roleTemplateId', get(add, 'role.id')) ) { - errors.push(this.get('intl').t('rolesPage.new.errors.roleAlreadyExists', { key: get(add, 'role.displayName') })); + errors.push(this.intl.t('rolesPage.new.errors.roleAlreadyExists', { key: get(add, 'role.displayName') })); } }); } else if ( current.findBy('roleTemplateId', get(this, 'primaryResource.roleTemplateId')) ) { - errors.push(this.get('intl').t('rolesPage.new.errors.roleAlreadyExists', { key: get(this, 'primaryResource.roleTemplate.displayName') })); + errors.push(this.intl.t('rolesPage.new.errors.roleAlreadyExists', { key: get(this, 'primaryResource.roleTemplate.displayName') })); } set(this, 'errors', errors); diff --git a/app/components/form-service-ports/component.js b/app/components/form-service-ports/component.js index 98bd492d73..b3dd3b6be3 100644 --- a/app/components/form-service-ports/component.js +++ b/app/components/form-service-ports/component.js @@ -1,6 +1,6 @@ import { next } from '@ember/runloop'; import { alias } from '@ember/object/computed'; -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; import Component from '@ember/component'; import layout from './template'; import $ from 'jquery'; @@ -26,14 +26,14 @@ export default Component.extend({ init() { this._super(...arguments); - if ( !get(this, 'ports') ) { + if ( !this.ports ) { set(this, 'model.ports', []); } }, actions: { addPort() { - get(this, 'ports').pushObject(get(this, 'store').createRecord({ + this.ports.pushObject(this.store.createRecord({ type: 'servicePort', protocol: 'TCP', })); @@ -48,7 +48,7 @@ export default Component.extend({ }, removePort(obj) { - get(this, 'ports').removeObject(obj); + this.ports.removeObject(obj); }, }, }); diff --git a/app/components/form-sources-row/component.js b/app/components/form-sources-row/component.js index 543f53e448..98120b6dfc 100644 --- a/app/components/form-sources-row/component.js +++ b/app/components/form-sources-row/component.js @@ -56,15 +56,15 @@ export default Component.extend({ }; let sourceType = get(this, 'source.source'); let sourceName = get(this, 'source.sourceName'); - let out = get(this, 'specificKeyOnly') ? [] : [prefix]; + let out = this.specificKeyOnly ? [] : [prefix]; let selected; switch (sourceType) { case 'secret': - selected = get(this, 'selectedSecret'); + selected = this.selectedSecret; break; case 'configMap': - selected = get(this, 'selectedConfigMap'); + selected = this.selectedConfigMap; break; } diff --git a/app/components/hpa-metric-row/component.js b/app/components/hpa-metric-row/component.js index 98700bff04..7ff9e64ab2 100644 --- a/app/components/hpa-metric-row/component.js +++ b/app/components/hpa-metric-row/component.js @@ -120,7 +120,7 @@ export default Component.extend({ }), metricTypeDidChange: observer('metric.type', function() { - const metric = get(this, 'metric'); + const metric = this.metric; const type = get(metric, 'type'); if ( type === RESOURCE ) { @@ -209,7 +209,7 @@ export default Component.extend({ const targetType = get(this, 'metric.target.type'); const type = get(this, 'metric.type'); const name = get(this, 'metric.name'); - const selectedWorkload = get(this, 'selectedWorkload'); + const selectedWorkload = this.selectedWorkload; const hasCpuReservation = get(this, 'selectedWorkload.launchConfig.hasCpuReservation'); if ( name === CPU && targetType === AVERAGE_UTILIZATION && type === RESOURCE && selectedWorkload ) { @@ -223,7 +223,7 @@ export default Component.extend({ const targetType = get(this, 'metric.target.type'); const type = get(this, 'metric.type'); const name = get(this, 'metric.name'); - const selectedWorkload = get(this, 'selectedWorkload'); + const selectedWorkload = this.selectedWorkload; const hasMemoryReservation = get(this, 'selectedWorkload.launchConfig.hasMemoryReservation'); if ( name === MEMORY && targetType === AVERAGE_UTILIZATION && type === RESOURCE && selectedWorkload ) { diff --git a/app/components/input-command/component.js b/app/components/input-command/component.js index 6c05f41f67..7f821c4d31 100644 --- a/app/components/input-command/component.js +++ b/app/components/input-command/component.js @@ -1,7 +1,7 @@ import { isArray } from '@ember/array'; import TextField from '@ember/component/text-field'; import layout from './template'; -import { get, observer, set } from '@ember/object'; +import { observer, set } from '@ember/object'; const ShellQuote = window.ShellQuote; @@ -44,7 +44,7 @@ export default TextField.extend({ init() { this._super(...arguments); - let initial = get(this, 'initialValue') || ''; + let initial = this.initialValue || ''; if ( isArray(initial) ) { set(this, 'value', unparse(reop(initial))); @@ -54,7 +54,7 @@ export default TextField.extend({ }, valueChanged: observer('value', function() { - let out = ShellQuote.parse(get(this, 'value') || '').map((piece) => { + let out = ShellQuote.parse(this.value || '').map((piece) => { if ( typeof piece === 'object' && piece ) { if ( piece.pattern ) { return piece.pattern; diff --git a/app/components/input-edit-password/component.js b/app/components/input-edit-password/component.js index 19cebc0ce2..ac5cd7814c 100644 --- a/app/components/input-edit-password/component.js +++ b/app/components/input-edit-password/component.js @@ -1,6 +1,6 @@ import Component from '@ember/component'; import layout from './template'; -import { get, set, computed, observer } from '@ember/object'; +import { set, computed, observer } from '@ember/object'; import { inject as service } from '@ember/service'; import { later, run } from '@ember/runloop'; import { randomStr } from 'shared/utils/util'; @@ -33,7 +33,7 @@ export default Component.extend({ deleteTokens: false, didReceiveAttrs() { - if ( get(this, 'generate') ) { + if ( this.generate ) { this.send('regenerate'); } @@ -50,18 +50,18 @@ export default Component.extend({ }, save(cb) { - const user = get(this, 'user'); - const old = get(this, 'currentPassword') || ''; - const neu = get(this, 'password') || ''; + const user = this.user; + const old = this.currentPassword || ''; + const neu = this.password || ''; set(this, 'serverErrors', []); - const setOrChange = get(this, 'setOrChange'); + const setOrChange = this.setOrChange; let promise; if ( setOrChange === CHANGE ) { // @TODO-2.0 better way to call collection actions - promise = get(this, 'globalStore').request({ + promise = this.globalStore.request({ url: '/v3/users?action=changepassword', method: 'POST', data: { @@ -73,9 +73,9 @@ export default Component.extend({ promise = user.doAction('setpassword', { newPassword: neu.trim(), }); } - return promise.then(() => get(this, 'access').loadMe().then(() => { - if ( get(this, 'deleteTokens') ) { - return get(this, 'globalStore').findAll('token').then((tokens) => { + return promise.then(() => this.access.loadMe().then(() => { + if ( this.deleteTokens ) { + return this.globalStore.findAll('token').then((tokens) => { const promises = []; tokens.forEach((token) => { @@ -90,7 +90,7 @@ export default Component.extend({ return resolve(); } }).then(() => { - get(this, 'complete')(true); + this.complete(true); later(this, () => { if ( this.isDestroyed || this.isDestroying ) { return; @@ -99,13 +99,13 @@ export default Component.extend({ }, 1000); })).catch((err) => { set(this, 'serverErrors', [err.message]); - get(this, 'complete')(false); + this.complete(false); cb(false); }); }, }, generateChanged: observer('generate', function() { - if ( get(this, 'generate') ) { + if ( this.generate ) { set(this, 'password', randomStr(16, 16, 'password')); } else { set(this, 'password', ''); @@ -115,33 +115,33 @@ export default Component.extend({ }), saveDisabled: computed('generate', 'passwordsMatch', 'forceSaveDisabled', 'showCurrent', 'currentPassword', function() { - if ( get(this, 'forceSaveDisabled') ) { + if ( this.forceSaveDisabled ) { return true; } - if ( get(this, 'showCurrent') && !get(this, 'currentPassword') ) { + if ( this.showCurrent && !this.currentPassword ) { return true; } - if ( get(this, 'generate') ) { + if ( this.generate ) { return false; } - return !get(this, 'passwordsMatch'); + return !this.passwordsMatch; }), passwordsMatch: computed('password', 'confirm', function() { - const pass = (get(this, 'password') || '').trim(); - const confirm = (get(this, 'confirm') || '').trim(); + const pass = (this.password || '').trim(); + const confirm = (this.confirm || '').trim(); return pass && confirm && pass === confirm; }), errors: computed('passwordsMatch', 'confirm', 'confirmBlurred', 'serverErrors.[]', function() { - let out = get(this, 'serverErrors') || []; + let out = this.serverErrors || []; - if ( get(this, 'confirmBlurred') && get(this, 'confirm') && !get(this, 'passwordsMatch') ) { - out.push(get(this, 'intl').t('modalEditPassword.mismatch')); + if ( this.confirmBlurred && this.confirm && !this.passwordsMatch ) { + out.push(this.intl.t('modalEditPassword.mismatch')); } return out; diff --git a/app/components/input-files/component.js b/app/components/input-files/component.js index 3bc954fc07..5405f60aa3 100644 --- a/app/components/input-files/component.js +++ b/app/components/input-files/component.js @@ -22,7 +22,7 @@ export default Component.extend({ this._super(...arguments); let ary = []; - let files = this.get('initialFiles') || {}; + let files = this.initialFiles || {}; Object.keys(files).forEach((name) => { ary.push({ @@ -36,7 +36,7 @@ export default Component.extend({ actions: { add() { - this.get('ary').pushObject({ + this.ary.pushObject({ name: '', value: '', }); @@ -47,14 +47,14 @@ export default Component.extend({ }, remove(file) { - this.get('ary').removeObject(file); + this.ary.removeObject(file); } }, onFilesChanged: observer('ary.@each.{name,value}', function() { let out = {}; - this.get('ary').forEach((file) => { + this.ary.forEach((file) => { if ( file.name && file.value ) { out[file.name] = file.value; } @@ -69,12 +69,12 @@ export default Component.extend({ if ( isSafari ) { return ''; } else { - return this.get('accept'); + return this.accept; } }), change(event) { - let ary = this.get('ary'); + let ary = this.ary; var input = event.target; let handles = input.files; let names = []; @@ -91,7 +91,7 @@ export default Component.extend({ let reader = new FileReader(); reader.onload = (event2) => { - this.get('ary').pushObject({ + this.ary.pushObject({ name: names[i], value: event2.target.result, uploaded: true, @@ -99,7 +99,7 @@ export default Component.extend({ }; reader.onerror = (err) => { - get(this, 'growl').fromError(get(err, 'srcElement.error.message')); + this.growl.fromError(get(err, 'srcElement.error.message')); }; names[i] = handles[i].name; diff --git a/app/components/input-random-port/component.js b/app/components/input-random-port/component.js index 48810bf1d0..4c21224d49 100644 --- a/app/components/input-random-port/component.js +++ b/app/components/input-random-port/component.js @@ -1,4 +1,4 @@ -import { set, get } from '@ember/object'; +import { set } from '@ember/object'; import Component from '@ember/component'; import layout from './template'; import { next } from '@ember/runloop'; @@ -17,7 +17,7 @@ export default Component.extend({ init() { this._super(...arguments); - if (get(this, 'value')) { + if (this.value) { set(this, 'showEdit', true); } }, diff --git a/app/components/modal-about/component.js b/app/components/modal-about/component.js index 1dc41ebf87..5450e42906 100644 --- a/app/components/modal-about/component.js +++ b/app/components/modal-about/component.js @@ -16,24 +16,24 @@ export default Component.extend(ModalBase, { actions: { downloadLinuxImages() { - get(this, 'globalStore').rawRequest({ + this.globalStore.rawRequest({ url: `/v3/kontainerdrivers/rancher-images`, method: 'GET', }).then((res) => { downloadFile(`rancher-linux-images.txt`, get(res, 'body')); }).catch((error) => { - get(this, 'growl').fromError('Error downloading Linux image list', error.message); + this.growl.fromError('Error downloading Linux image list', error.message); }); }, downloadWindowsImages() { - get(this, 'globalStore').rawRequest({ + this.globalStore.rawRequest({ url: `/v3/kontainerdrivers/rancher-windows-images`, method: 'GET', }).then((res) => { downloadFile(`rancher-windows-images.txt`, get(res, 'body')); }).catch((error) => { - get(this, 'growl').fromError('Error downloading Windows image list', error.message); + this.growl.fromError('Error downloading Windows image list', error.message); }); }, } diff --git a/app/components/modal-drain-node/component.js b/app/components/modal-drain-node/component.js index 9d60c7665f..6b322cdb9d 100644 --- a/app/components/modal-drain-node/component.js +++ b/app/components/modal-drain-node/component.js @@ -1,5 +1,4 @@ import { inject as service } from '@ember/service'; -import { get } from '@ember/object'; import { alias } from '@ember/object/computed'; import Component from '@ember/component'; import ModalBase from 'shared/mixins/modal-base'; @@ -23,8 +22,8 @@ export default Component.extend(ModalBase, { actions: { drain() { - const nodeDrainInput = { ...get(this, 'selection') }; - const resources = get(this, 'resources').slice(); + const nodeDrainInput = { ...this.selection }; + const resources = this.resources.slice(); eachLimit(resources, 5, (resource, cb) => { if ( !resource ) { diff --git a/app/components/modal-edit-apikey/component.js b/app/components/modal-edit-apikey/component.js index 518b3e6b4e..63f0392c90 100644 --- a/app/components/modal-edit-apikey/component.js +++ b/app/components/modal-edit-apikey/component.js @@ -1,4 +1,4 @@ -import { alias } from '@ember/object/computed'; +import { alias, not } from '@ember/object/computed'; import { inject as service } from '@ember/service'; import Component from '@ember/component'; import NewOrEdit from 'shared/mixins/new-or-edit'; @@ -33,12 +33,14 @@ export default Component.extend(ModalBase, NewOrEdit, { originalModel: alias('modalService.modalOpts'), displayEndpoint: alias('endpointService.api.display.current'), linkEndpoint: alias('endpointService.api.auth.current'), - showSimpleExpire: computed.not('authTokenHasMaxTTL'), + showSimpleExpire: not('authTokenHasMaxTTL'), + + authTokenHasMaxTTL: computed.gt('authTokenMaxTTL', 0), didReceiveAttrs() { setProperties(this, { - clone: get(this, 'originalModel').clone(), - model: get(this, 'originalModel').clone(), + clone: this.originalModel.clone(), + model: this.originalModel.clone(), justCreated: false, }); @@ -53,24 +55,24 @@ export default Component.extend(ModalBase, NewOrEdit, { }, expireChanged: observer('expire', 'customTTLDuration', function() { - if (!get(this, 'showSimpleExpire')) { + if (!this.showSimpleExpire) { return; } - const expire = get(this, 'expire'); + const expire = this.expire; const isCustom = expire === 'custom'; - const duration = isCustom ? get(this, 'customTTLDuration') : moment.duration(1, expire); + const duration = isCustom ? this.customTTLDuration : moment.duration(1, expire); set(this, 'model.ttl', duration.asMilliseconds()); }), complexExpireChanged: observer('complexExpire', 'maxTTLDuration', 'customTTLDuration', function() { - if (get(this, 'showSimpleExpire')) { + if (this.showSimpleExpire) { return; } - const complexExpire = get(this, 'complexExpire'); - const maxTTLDuration = get(this, 'maxTTLDuration'); - const customTTLDuration = get(this, 'customTTLDuration'); + const complexExpire = this.complexExpire; + const maxTTLDuration = this.maxTTLDuration; + const customTTLDuration = this.customTTLDuration; const duration = complexExpire === 'max' ? maxTTLDuration : customTTLDuration; console.log(complexExpire, maxTTLDuration, customTTLDuration, duration.asMilliseconds()); @@ -83,8 +85,8 @@ export default Component.extend(ModalBase, NewOrEdit, { }), customTTLDuration: computed('customTTL', 'ttlUnit', function() { - const customTTL = Number.parseFloat(get(this, 'customTTL')); - const ttlUnit = get(this, 'ttlUnit'); + const customTTL = Number.parseFloat(this.customTTL); + const ttlUnit = this.ttlUnit; return moment.duration(customTTL, ttlUnit); }), @@ -95,26 +97,22 @@ export default Component.extend(ModalBase, NewOrEdit, { return Number.parseFloat(maxTTL); }), - authTokenHasMaxTTL: computed('authTokenMaxTTL', function() { - return get(this, 'authTokenMaxTTL') > 0; - }), - maxTTLDuration: computed('authTokenMaxTTL', function() { - const maxTTLInMinutes = get(this, 'authTokenMaxTTL'); + const maxTTLInMinutes = this.authTokenMaxTTL; return moment.duration(maxTTLInMinutes, 'minutes'); }), maxTTLBestUnit: computed('maxTTLDuration', function() { - const duration = get(this, 'maxTTLDuration'); + const duration = this.maxTTLDuration; return this.getBestTimeUnit(duration); }), friendlyMaxTTL: computed('maxTTLDuration', 'maxTTLBestUnit', function() { - const intl = get(this, 'intl'); - const duration = get(this, 'maxTTLDuration'); - const unit = get(this, 'maxTTLBestUnit'); + const intl = this.intl; + const duration = this.maxTTLDuration; + const unit = this.maxTTLBestUnit; const count = roundDown(duration.as(unit), 2); return intl.t(`editApiKey.ttl.max.unit.${ unit }`, { count }); @@ -142,19 +140,19 @@ export default Component.extend(ModalBase, NewOrEdit, { }), ttlCustomMax: computed('authTokenHasMaxTTL', 'ttlUnit', 'maxTTLDuration', function() { - if (!get(this, 'authTokenHasMaxTTL')) { + if (!this.authTokenHasMaxTTL) { return; } - const unit = get(this, 'ttlUnit'); - const duration = get(this, 'maxTTLDuration'); + const unit = this.ttlUnit; + const duration = this.maxTTLDuration; return roundDown(duration.as(unit), 2); }), ttlUnitOptions: computed('maxTTLBestUnit', function() { - const unit = get(this, 'maxTTLBestUnit'); + const unit = this.maxTTLBestUnit; const indexOfUnit = ttlUnits.indexOf(unit); return ttlUnits.slice(0, indexOfUnit + 1); @@ -179,7 +177,7 @@ export default Component.extend(ModalBase, NewOrEdit, { }, doneSaving(neu) { - if ( get(this, 'editing') ) { + if ( this.editing ) { this.send('cancel'); } else { setProperties(this, { diff --git a/app/components/modal-edit-certificate/component.js b/app/components/modal-edit-certificate/component.js index bb62f1129b..3229609f1e 100644 --- a/app/components/modal-edit-certificate/component.js +++ b/app/components/modal-edit-certificate/component.js @@ -15,12 +15,12 @@ export default Component.extend(ModalBase, NewOrEdit, { originalModel: alias('modalService.modalOpts'), init() { this._super(...arguments); - this.set('model', this.get('originalModel').clone()); + this.set('model', this.originalModel.clone()); }, manageModel() { - let clone = this.get('originalModel'); - let model = this.get('model'); + let clone = this.originalModel; + let model = this.model; if (clone.get('key') === model.get('key')) { delete model.key; @@ -28,9 +28,9 @@ export default Component.extend(ModalBase, NewOrEdit, { }, validate() { - var model = this.get('model'); - var errors = this.get('errors') || []; - var intl = this.get('intl'); + var model = this.model; + var errors = this.errors || []; + var intl = this.intl; // key is the only node that can be deleted safely this.manageModel(); diff --git a/app/components/modal-edit-host/component.js b/app/components/modal-edit-host/component.js index b490284bb7..08a9a00929 100644 --- a/app/components/modal-edit-host/component.js +++ b/app/components/modal-edit-host/component.js @@ -23,7 +23,7 @@ export default Component.extend(ModalBase, NewOrEdit, { init() { this._super(...arguments); - set(this, 'model', get(this, 'originalModel').clone()); + set(this, 'model', this.originalModel.clone()); if (get(this, 'model.name')) { set(this, 'customName', get(this, 'model.name')) @@ -31,7 +31,7 @@ export default Component.extend(ModalBase, NewOrEdit, { }, customNameObserver: on('init', observer('customName', function() { - let cn = get(this, 'customName'); + let cn = this.customName; if (cn && cn.length > 0) { set(this, 'primaryResource.name', cn); diff --git a/app/components/modal-edit-namespace/component.js b/app/components/modal-edit-namespace/component.js index 8ee2fefbb3..a9ef077e2c 100644 --- a/app/components/modal-edit-namespace/component.js +++ b/app/components/modal-edit-namespace/component.js @@ -30,7 +30,7 @@ export default Component.extend(ModalBase, NewOrEdit, { init() { this._super(...arguments); - const orig = get(this, 'originalModel'); + const orig = this.originalModel; const clone = orig.clone(); delete clone.services; @@ -38,8 +38,8 @@ export default Component.extend(ModalBase, NewOrEdit, { setProperties(this, { model: clone, tags: (get(this, 'primaryResource.tags') || []).join(','), - allNamespaces: get(this, 'clusterStore').all('namespace'), - allProjects: get(this, 'globalStore').all('project') + allNamespaces: this.clusterStore.all('namespace'), + allProjects: this.globalStore.all('project') .filterBy('clusterId', get(this, 'scope.currentCluster.id')), }) @@ -85,7 +85,7 @@ export default Component.extend(ModalBase, NewOrEdit, { }, toggleAutoInject() { - set(this, 'istioInjection', !get(this, 'istioInjection')); + set(this, 'istioInjection', !this.istioInjection); }, }, @@ -100,7 +100,7 @@ export default Component.extend(ModalBase, NewOrEdit, { }), tagsDidChanged: observer('tags', function() { - set(this, 'primaryResource.tags', get(this, 'tags').split(',') || []); + set(this, 'primaryResource.tags', this.tags.split(',') || []); }), canMoveNamespace: computed('primaryResource.actionLinks.move', function() { @@ -109,21 +109,21 @@ export default Component.extend(ModalBase, NewOrEdit, { projectLimit: computed('allProjects', 'primaryResource.projectId', 'primaryResource.resourceQuota.limit', function() { const projectId = get(this, 'primaryResource.projectId'); - const project = get(this, 'allProjects').findBy('id', projectId); + const project = this.allProjects.findBy('id', projectId); return get(project, 'resourceQuota.limit'); }), projectUsedLimit: computed('allProjects', 'primaryResource.projectId', 'primaryResource.resourceQuota.limit', function() { const projectId = get(this, 'primaryResource.projectId'); - const project = get(this, 'allProjects').findBy('id', projectId); + const project = this.allProjects.findBy('id', projectId); return get(project, 'resourceQuota.usedLimit'); }), nsDefaultQuota: computed('allProjects', 'primaryResource.projectId', 'primaryResource.resourceQuota.limit', function() { const projectId = get(this, 'primaryResource.projectId'); - const project = get(this, 'allProjects').findBy('id', projectId); + const project = this.allProjects.findBy('id', projectId); return get(project, 'namespaceDefaultResourceQuota.limit'); }), @@ -131,8 +131,8 @@ export default Component.extend(ModalBase, NewOrEdit, { validate() { this._super(); - const errors = get(this, 'errors') || []; - const quotaErrors = get(this, 'primaryResource').validateResourceQuota(get(this, 'originalModel.resourceQuota.limit')); + const errors = this.errors || []; + const quotaErrors = this.primaryResource.validateResourceQuota(get(this, 'originalModel.resourceQuota.limit')); if ( quotaErrors.length > 0 ) { errors.pushObjects(quotaErrors); @@ -147,7 +147,7 @@ export default Component.extend(ModalBase, NewOrEdit, { const labels = { ...get(this, 'primaryResource.labels') }; if ( get(this, 'scope.currentCluster.istioEnabled') ) { - if ( get(this, 'istioInjection') ) { + if ( this.istioInjection ) { labels[ISTIO_INJECTION] = ENABLED; } else { delete labels[ISTIO_INJECTION]; @@ -155,7 +155,7 @@ export default Component.extend(ModalBase, NewOrEdit, { } setProperties(this, { - 'beforeSaveModel': get(this, 'originalModel').clone(), + 'beforeSaveModel': this.originalModel.clone(), 'primaryResource.labels': labels }); diff --git a/app/components/modal-edit-node-pool/component.js b/app/components/modal-edit-node-pool/component.js index e15b82a7f5..57005cce71 100644 --- a/app/components/modal-edit-node-pool/component.js +++ b/app/components/modal-edit-node-pool/component.js @@ -13,7 +13,7 @@ export default Component.extend(ModalBase, { init() { this._super(...arguments); - set(this, 'model', get(this, 'originalModel').clone()); + set(this, 'model', this.originalModel.clone()); }, actions: { diff --git a/app/components/modal-edit-password/component.js b/app/components/modal-edit-password/component.js index 4074466c72..0275790e8b 100644 --- a/app/components/modal-edit-password/component.js +++ b/app/components/modal-edit-password/component.js @@ -1,7 +1,6 @@ import Component from '@ember/component'; import ModalBase from 'shared/mixins/modal-base'; import layout from './template'; -import { get/* , set */ } from '@ember/object'; import { inject as service } from '@ember/service'; import { alias } from '@ember/object/computed'; @@ -16,15 +15,15 @@ export default Component.extend(ModalBase, { complete(success) { if (success) { // get(this, 'router').replaceWith('authenticated'); - get(this, 'modalService').toggleModal(); + this.modalService.toggleModal(); } }, cancel() { - get(this, 'modalService').toggleModal(); + this.modalService.toggleModal(); }, goBack() { - get(this, 'modalService').toggleModal(); + this.modalService.toggleModal(); }, }, diff --git a/app/components/modal-edit-setting/component.js b/app/components/modal-edit-setting/component.js index aaf7dc8fae..85a365d342 100644 --- a/app/components/modal-edit-setting/component.js +++ b/app/components/modal-edit-setting/component.js @@ -71,8 +71,8 @@ export default Component.extend(ModalBase, { actions: { save(btnCb) { - get(this, 'settings').set(normalizeName(get(this, 'model.key')), get(this, 'value')); - get(this, 'settings').one('settingsPromisesResolved', () => { + this.settings.set(normalizeName(get(this, 'model.key')), this.value); + this.settings.one('settingsPromisesResolved', () => { btnCb(true); this.send('done'); }); diff --git a/app/components/modal-import/component.js b/app/components/modal-import/component.js index 9bff52dc72..a58997ba90 100644 --- a/app/components/modal-import/component.js +++ b/app/components/modal-import/component.js @@ -37,7 +37,7 @@ export default Component.extend(ModalBase, ChildHook, { }, save(cb) { - let yaml = get(this, 'yaml'); + let yaml = this.yaml; const lintError = []; jsyaml.safeLoadAll(yaml, (y) => { @@ -45,7 +45,7 @@ export default Component.extend(ModalBase, ChildHook, { }); if ( lintError.length ) { - set(this, 'errors', [get(this, 'intl').t('yamlPage.errors')]); + set(this, 'errors', [this.intl.t('yamlPage.errors')]); cb(false); return; @@ -53,21 +53,21 @@ export default Component.extend(ModalBase, ChildHook, { set(this, 'errors', null); - const opts = { yaml: get(this, 'yaml'), }; + const opts = { yaml: this.yaml, }; - switch ( get(this, 'mode') ) { + switch ( this.mode ) { case 'namespace': opts.namespace = get(this, 'namespace.name'); break; case 'project': - opts.project = get(this, 'projectId'); + opts.project = this.projectId; opts.defaultNamespace = get(this, 'namespace.name'); break; case 'cluster': break; } - if ( get(this, 'mode') === 'cluster' ) { + if ( this.mode === 'cluster' ) { this.send('actuallySave', opts, cb); } else { return this.applyHooks('_beforeSaveHooks').then(() => { @@ -92,7 +92,7 @@ export default Component.extend(ModalBase, ChildHook, { }, lintObserver: observer('yaml', function() { - const yaml = get(this, 'yaml'); + const yaml = this.yaml; const lintError = []; jsyaml.safeLoadAll(yaml, (y) => { diff --git a/app/components/modal-kubeconfig/component.js b/app/components/modal-kubeconfig/component.js index e38313282a..d517a1f06f 100644 --- a/app/components/modal-kubeconfig/component.js +++ b/app/components/modal-kubeconfig/component.js @@ -28,8 +28,8 @@ export default Component.extend(ModalBase, { set(this, 'step', 2); }) .catch((err) => { - this.get('growl').fromError('Error creating kubeconfig file', err); - this.get('modalService').toggleModal(); + this.growl.fromError('Error creating kubeconfig file', err); + this.modalService.toggleModal(); }); }, diff --git a/app/components/modal-new-pvc/component.js b/app/components/modal-new-pvc/component.js index 038bc32356..fe1427de55 100644 --- a/app/components/modal-new-pvc/component.js +++ b/app/components/modal-new-pvc/component.js @@ -14,17 +14,17 @@ export default Component.extend(ModalBase, { model: alias('modalService.modalOpts.model'), init() { this._super(...arguments); - if ( !this.get('model') ) { + if ( !this.model ) { this.set('model', {}); } }, actions: { doSave() { - let callback = this.get('callback'); + let callback = this.callback; if ( callback ) { - callback(this.get('model')); + callback(this.model); } this.send('cancel'); diff --git a/app/components/modal-new-vct/component.js b/app/components/modal-new-vct/component.js index 2850741d5d..55fb66a10c 100644 --- a/app/components/modal-new-vct/component.js +++ b/app/components/modal-new-vct/component.js @@ -1,4 +1,4 @@ -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; import { alias } from '@ember/object/computed'; import Component from '@ember/component'; import ModalBase from 'shared/mixins/modal-base'; @@ -17,17 +17,17 @@ export default Component.extend(ModalBase, { init() { this._super(...arguments); - if ( !get(this, 'model') ) { + if ( !this.model ) { set(this, 'model', {}); } }, actions: { doSave() { - let callback = get(this, 'callback'); + let callback = this.callback; if ( callback ) { - callback(get(this, 'model')); + callback(this.model); } this.send('cancel'); diff --git a/app/components/modal-new-volume/component.js b/app/components/modal-new-volume/component.js index d2e1a04a38..99afb08050 100644 --- a/app/components/modal-new-volume/component.js +++ b/app/components/modal-new-volume/component.js @@ -13,17 +13,17 @@ export default Component.extend(ModalBase, { model: alias('modalService.modalOpts.model'), init() { this._super(...arguments); - if ( !this.get('model') ) { + if ( !this.model ) { this.set('model', {}); } }, actions: { doSave() { - let callback = this.get('callback'); + let callback = this.callback; if ( callback ) { - callback(this.get('model')); + callback(this.model); } this.send('cancel'); diff --git a/app/components/modal-restore-backup/component.js b/app/components/modal-restore-backup/component.js index 8ff33c506e..11a5f735a9 100644 --- a/app/components/modal-restore-backup/component.js +++ b/app/components/modal-restore-backup/component.js @@ -17,6 +17,10 @@ export default Component.extend(ModalBase, { restoreRkeConfig: null, loadingBackups: false, + k8sVersionRadioDisabled: computed.or('k8sVersionDisabled', 'restorationTypeDisabled'), + + restorationTypeDisabled: computed.not('selectedBackup'), + init() { this._super(...arguments); @@ -45,7 +49,7 @@ export default Component.extend(ModalBase, { }, updateRestoreRkeConfig: observer('backupId', function() { - const value = get(this, 'backupId') ? 'etcd' : ''; + const value = this.backupId ? 'etcd' : ''; set(this, 'restoreRkeConfig', value); }), @@ -67,7 +71,7 @@ export default Component.extend(ModalBase, { }), selectedBackup: computed('modalOpts.cluster.etcdbackups.[]', 'backupId', function() { - const backupId = get(this, 'backupId'); + const backupId = this.backupId; return !backupId ? null : get(this, 'modalOpts.cluster.etcdbackups').findBy('id', backupId); }), @@ -77,15 +81,7 @@ export default Component.extend(ModalBase, { }), k8sVersionDisabled: computed('selectedVersion', 'restorationTypeDisabled', function() { - return !get(this, 'restorationTypeDisabled') && get(this, 'selectedVersion') === this.intl.t('modalRestoreBackup.type.versionUnknown'); - }), - - k8sVersionRadioDisabled: computed('k8sVersionDisabled', 'restorationTypeDisabled', function() { - return get(this, 'k8sVersionDisabled') || get(this, 'restorationTypeDisabled'); - }), - - restorationTypeDisabled: computed('selectedBackup', function() { - return !get(this, 'selectedBackup'); + return !this.restorationTypeDisabled && this.selectedVersion === this.intl.t('modalRestoreBackup.type.versionUnknown'); }), initOwnProperties() { diff --git a/app/components/modal-rollback-app/component.js b/app/components/modal-rollback-app/component.js index 876093fbd6..46faf72f98 100644 --- a/app/components/modal-rollback-app/component.js +++ b/app/components/modal-rollback-app/component.js @@ -31,7 +31,7 @@ export default Component.extend(ModalBase, { let model = get(this, 'modalService.modalOpts.originalModel').clone(); set(this, 'model', model); - get(this, 'store').rawRequest({ + this.store.rawRequest({ url: get(model, 'links.revision'), method: 'GET', }) @@ -40,7 +40,7 @@ export default Component.extend(ModalBase, { }) .catch((err) => { this.send('cancel'); - get(this, 'growl').fromError(err); + this.growl.fromError(err); }) .finally(() => { set(this, 'loading', false); @@ -51,7 +51,7 @@ export default Component.extend(ModalBase, { save(cb) { const { forceUpgrade, revisionId } = this; - get(this, 'model').doAction('rollback', { + this.model.doAction('rollback', { revisionId, forceUpgrade, }) @@ -65,7 +65,7 @@ export default Component.extend(ModalBase, { }, choices: computed('revisions.[]', function() { - return (get(this, 'revisions') || []) + return (this.revisions || []) .sortBy('created') .reverse() .map((r) => { @@ -84,11 +84,11 @@ export default Component.extend(ModalBase, { }), selected: computed('revisionId', 'revisions.[]', function() { - return get(this, 'revisions').findBy('name', get(this, 'revisionId')); + return this.revisions.findBy('name', this.revisionId); }), diff: computed('current.status', 'selected.status', function() { - if (get(this, 'current') && get(this, 'selected')) { + if (this.current && this.selected) { let left = get(this, 'current.status'); let right = get(this, 'selected.status'); var delta = jsondiffpatch.diff(sanitize(left), sanitize(right)); diff --git a/app/components/modal-rollback-mc-app/component.js b/app/components/modal-rollback-mc-app/component.js index 7a5cdce0dd..62a367eef5 100644 --- a/app/components/modal-rollback-mc-app/component.js +++ b/app/components/modal-rollback-mc-app/component.js @@ -40,7 +40,7 @@ export default Component.extend(ModalBase, { const { revisionId } = this; const neu = { revisionId }; - if (get(this, 'multiClusterAppHasUpgradeStrategy')) { + if (this.multiClusterAppHasUpgradeStrategy) { set(neu, 'batch', this.model.upgradeStrategy.rollingUpdate); } @@ -51,7 +51,7 @@ export default Component.extend(ModalBase, { }, choices: computed('revisions.[]', function() { - return (get(this, 'revisions') || []) + return (this.revisions || []) .sortBy('created') .reverse() .map((r) => { @@ -71,13 +71,13 @@ export default Component.extend(ModalBase, { }), selectedMultiClusterAppRevision: computed('choices.[]', 'revisionId', 'currentMultiClusterAppRevision', function() { - const match = get(this, 'choices').findBy('value', get(this, 'revisionId')); + const match = this.choices.findBy('value', this.revisionId); return match ? match.data : null; }), answersDiff: computed('currentMultiClusterAppRevision', 'selectedMultiClusterAppRevision', 'revisionId', function() { - if (get(this, 'currentMultiClusterAppRevision') && get(this, 'selectedMultiClusterAppRevision')) { + if (this.currentMultiClusterAppRevision && this.selectedMultiClusterAppRevision) { const { currentMultiClusterAppRevision, selectedMultiClusterAppRevision } = this; return this.generateAnswersJsonDiff(currentMultiClusterAppRevision, selectedMultiClusterAppRevision); @@ -101,7 +101,7 @@ export default Component.extend(ModalBase, { getMultiClusterAppRevisions() { const revisionsURL = get(this, 'modalService.modalOpts.revisionsLink'); - return get(this, 'store').rawRequest({ + return this.store.rawRequest({ url: revisionsURL, method: 'GET', }) @@ -109,7 +109,7 @@ export default Component.extend(ModalBase, { .catch((err) => { this.send('cancel'); - get(this, 'growl').fromError(err); + this.growl.fromError(err); }) .finally(() => set(this, 'loading', false)); } diff --git a/app/components/modal-rollback-service/component.js b/app/components/modal-rollback-service/component.js index 08ab20cd90..c2294e1f8a 100644 --- a/app/components/modal-rollback-service/component.js +++ b/app/components/modal-rollback-service/component.js @@ -44,7 +44,7 @@ export default Component.extend(ModalBase, { init() { this._super(...arguments); - const schema = get(this, 'store').getById('schema', 'workload'); + const schema = this.store.getById('schema', 'workload'); const resourceFields = get(schema, 'resourceFields'); set(this, 'keys', Object.keys(resourceFields).filter((field) => !field.endsWith('Status') && HIDDEN_FIELDS.indexOf(field) === -1)); @@ -54,7 +54,7 @@ export default Component.extend(ModalBase, { let model = get(this, 'modalService.modalOpts.originalModel').clone(); set(this, 'model', model); - get(this, 'store').rawRequest({ + this.store.rawRequest({ url: get(model, 'links.revisions'), method: 'GET', }) @@ -63,7 +63,7 @@ export default Component.extend(ModalBase, { }) .catch((err) => { this.send('cancel'); - get(this, 'growl').fromError(err); + this.growl.fromError(err); }) .finally(() => { set(this, 'loading', false); @@ -74,7 +74,7 @@ export default Component.extend(ModalBase, { save(cb) { const id = get(this, 'selected.id'); - get(this, 'model').doAction('rollback', { replicaSetId: id, }) + this.model.doAction('rollback', { replicaSetId: id, }) .then(() => { this.send('cancel'); }) @@ -85,7 +85,7 @@ export default Component.extend(ModalBase, { }, choices: computed('model.workloadAnnotations', 'revisions.[]', function() { - return (get(this, 'revisions') || []) + return (this.revisions || []) .sortBy('createdTS') .reverse() .map((r) => { @@ -105,17 +105,17 @@ export default Component.extend(ModalBase, { current: computed('model.workloadAnnotations', 'revisions.@each.workloadAnnotations', function() { const currentRevision = get(this, 'model.workloadAnnotations')[C.LABEL.DEPLOYMENT_REVISION]; - return (get(this, 'revisions') || []).find((r) => get(r, 'workloadAnnotations')[C.LABEL.DEPLOYMENT_REVISION] === currentRevision); + return (this.revisions || []).find((r) => get(r, 'workloadAnnotations')[C.LABEL.DEPLOYMENT_REVISION] === currentRevision); }), selected: computed('revisionId', 'revisions.[]', function() { - return (get(this, 'revisions') || []).findBy('id', get(this, 'revisionId')); + return (this.revisions || []).findBy('id', this.revisionId); }), diff: computed('current', 'keys', 'selected', function() { - if (get(this, 'current') && get(this, 'selected')) { - let left = sanitize(get(this, 'current'), get(this, 'keys')); - let right = sanitize(get(this, 'selected'), get(this, 'keys')); + if (this.current && this.selected) { + let left = sanitize(this.current, this.keys); + let right = sanitize(this.selected, this.keys); var delta = jsondiffpatch.diff(left, right); jsondiffpatch.formatters.html.hideUnchanged(); diff --git a/app/components/modal-rotate-certificates/component.js b/app/components/modal-rotate-certificates/component.js index 4a219908c5..d7da5ee947 100644 --- a/app/components/modal-rotate-certificates/component.js +++ b/app/components/modal-rotate-certificates/component.js @@ -1,5 +1,5 @@ import { inject as service } from '@ember/service'; -import { get, set, setProperties } from '@ember/object'; +import { set, setProperties } from '@ember/object'; import Component from '@ember/component'; import ModalBase from 'shared/mixins/modal-base'; import layout from './template'; @@ -109,7 +109,7 @@ export default Component.extend(ModalBase, { }; case 'single': return { - services: get(this, 'selectedServices'), + services: this.selectedServices, caCertificates: false, }; case 'service': diff --git a/app/components/modal-shortcuts/component.js b/app/components/modal-shortcuts/component.js index 0f150b6cd8..03642d4cae 100644 --- a/app/components/modal-shortcuts/component.js +++ b/app/components/modal-shortcuts/component.js @@ -22,7 +22,7 @@ export default Component.extend(ModalBase, { init() { this._super(...arguments); - this.set('pods', this.get('store').all('pod')); + this.set('pods', this.store.all('pod')); this.set('timer', setInterval(() => { this.updateTime(); @@ -30,7 +30,7 @@ export default Component.extend(ModalBase, { }, willDestroyElement() { - clearInterval(this.get('timer')); + clearInterval(this.timer); }, containerCount: computed('pods.length', function() { let count = this.get('pods.length'); @@ -48,7 +48,7 @@ export default Component.extend(ModalBase, { updateTime() { - let time = this.get('time'); + let time = this.time; if ( time > 0 ) { time--; diff --git a/app/components/modal-telemetry/component.js b/app/components/modal-telemetry/component.js index feb0b57326..edca523639 100644 --- a/app/components/modal-telemetry/component.js +++ b/app/components/modal-telemetry/component.js @@ -32,8 +32,8 @@ export default Component.extend(ModalBase, { actions: { cancel() { - get(this, 'settings').set(C.SETTING.TELEMETRY, (get(this, 'optIn') ? 'in' : 'out')); - get(this, 'modalService').toggleModal(); + this.settings.set(C.SETTING.TELEMETRY, (this.optIn ? 'in' : 'out')); + this.modalService.toggleModal(); }, }, }); diff --git a/app/components/modal-view-template-diff/component.js b/app/components/modal-view-template-diff/component.js index 0878fd0ed9..49ddd4ac1e 100644 --- a/app/components/modal-view-template-diff/component.js +++ b/app/components/modal-view-template-diff/component.js @@ -50,6 +50,6 @@ export default Component.extend(ModalBase, { }, cancel() { - get(this, 'modalService').toggleModal(); + this.modalService.toggleModal(); }, }); diff --git a/app/components/modal-whats-new/component.js b/app/components/modal-whats-new/component.js index 6b3ecb5cbb..dc4635eccf 100644 --- a/app/components/modal-whats-new/component.js +++ b/app/components/modal-whats-new/component.js @@ -20,7 +20,7 @@ export default Component.extend(ModalBase, { set(this, `prefs.${ C.PREFS.SEEN_WHATS_NEW }`, version); } - get(this, 'modalService').toggleModal(); + this.modalService.toggleModal(); }, }, }); diff --git a/app/components/namespace-resource-quota/component.js b/app/components/namespace-resource-quota/component.js index 81612f6b6b..9a5531d4d0 100644 --- a/app/components/namespace-resource-quota/component.js +++ b/app/components/namespace-resource-quota/component.js @@ -1,4 +1,4 @@ -import { get, set, observer } from '@ember/object'; +import { get, set, observer } from '@ember/object'; import { next } from '@ember/runloop'; import Component from '@ember/component'; import { convertToMillis } from 'shared/utils/util'; @@ -38,7 +38,7 @@ export default Component.extend({ quotaDidChange: observer('quotaArray.@each.{key,value}', function() { const out = {}; - (get(this, 'quotaArray') || []).forEach((quota) => { + (this.quotaArray || []).forEach((quota) => { if ( quota.key ) { let value = parseInt(get(quota, 'value'), defaultRadix); let max = get(quota, 'max'); @@ -81,9 +81,9 @@ export default Component.extend({ }, updateLimits() { - ( get(this, 'quotaArray') || [] ).forEach((quota) => { + ( this.quotaArray || [] ).forEach((quota) => { if ( quota.key ) { - const intl = get(this, 'intl'); + const intl = this.intl; const value = parseInt(get(quota, 'value'), defaultRadix) || 0; const usedValue = get(quota, 'currentProjectUse.firstObject.value'); const newUse = get(quota, 'currentProjectUse.lastObject'); @@ -128,8 +128,8 @@ export default Component.extend({ nsDefaultQuota, intl } = this; - const used = get(this, 'usedLimit'); - const currentProjectLimit = get(this, 'projectLimit') + const used = this.usedLimit; + const currentProjectLimit = this.projectLimit const array = []; Object.keys(nsDefaultQuota).forEach((key) => { @@ -177,7 +177,7 @@ export default Component.extend({ break; } - if ( !get(this, 'isNew') ) { + if ( !this.isNew ) { usedValue = usedValue - value } diff --git a/app/components/namespace-table/component.js b/app/components/namespace-table/component.js index 57dd993aa2..0aaca2eda0 100644 --- a/app/components/namespace-table/component.js +++ b/app/components/namespace-table/component.js @@ -1,7 +1,7 @@ import Component from '@ember/component'; import layout from './template'; import { inject as service } from '@ember/service'; -import { get, computed } from '@ember/object'; +import { computed } from '@ember/object'; import { filter } from 'ui/utils/search-text'; const headers = [ @@ -45,7 +45,7 @@ export default Component.extend({ ], projectsWithoutNamespace: computed('projectsWithoutNamespaces.[]', 'searchText', function() { - const { matches } = filter(get(this, 'projectsWithoutNamespaces').slice(), get(this, 'searchText'), ['displayName']); + const { matches } = filter(this.projectsWithoutNamespaces.slice(), this.searchText, ['displayName']); return matches; }), diff --git a/app/components/new-catalog/component.js b/app/components/new-catalog/component.js index 0047908f32..5b1c02cb16 100644 --- a/app/components/new-catalog/component.js +++ b/app/components/new-catalog/component.js @@ -93,10 +93,10 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { }, cancel() { - if ( get(this, 'istio') ) { + if ( this.istio ) { const projectId = get(this, 'scope.currentProject.id'); - get(this, 'router').transitionTo('authenticated.project.istio.project-istio.rules', projectId); + this.router.transitionTo('authenticated.project.istio.project-istio.rules', projectId); } else if ( this.cancel ) { this.cancel(); } @@ -112,7 +112,7 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { }, answersArray: computed('selectedTemplateModel.questions', 'selectedTemplateModel.customAnswers', 'catalogApp.answers', function() { - let model = get(this, 'selectedTemplateModel'); + let model = this.selectedTemplateModel; if (get(model, 'questions')) { const questions = []; @@ -142,7 +142,7 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { }), answersString: computed('answersArray.@each.{variable,answer}', 'selectedTemplateModel.valuesYaml', function() { - let model = get(this, 'selectedTemplateModel'); + let model = this.selectedTemplateModel; if (get(model, 'questions')) { let neu = {}; @@ -151,7 +151,7 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { neu = YAML.parse(model.valuesYaml); neu = flatMap(neu); } else { - (get(this, 'answersArray') || []).forEach((a) => { + (this.answersArray || []).forEach((a) => { neu[a.variable] = isEmpty(a.answer) ? a.default : a.answer; }); } @@ -164,7 +164,7 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { return YAML.stringify(neu); } else { - return JSON.stringify(get(this, 'answersArray')); + return JSON.stringify(this.answersArray); } }), @@ -172,7 +172,7 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { var url = get(this, 'editable.selectedTemplateUrl'); if ( url === 'default' ) { - let defaultUrl = get(this, 'defaultUrl'); + let defaultUrl = this.defaultUrl; if ( defaultUrl ) { url = defaultUrl; @@ -195,7 +195,7 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { set(this, 'catalogApp.answers', current); } - var selectedTemplateModel = yield get(this, 'catalog').fetchByUrl(url) + var selectedTemplateModel = yield this.catalog.fetchByUrl(url) .then((response) => { if (response.questions) { this.parseQuestionsAndAnswers(response, current); @@ -292,10 +292,10 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { validate() { this._super(); - const errors = get(this, 'errors') || []; + const errors = this.errors || []; - errors.pushObjects(get(this, 'namespaceErrors') || []); - errors.pushObjects(get(this, 'selectedTemplateModel').validationErrors(this.answers) || []); + errors.pushObjects(this.namespaceErrors || []); + errors.pushObjects(this.selectedTemplateModel.validationErrors(this.answers) || []); if (errors.length) { set(this, 'errors', errors.uniq()); @@ -307,10 +307,10 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { }, doSave() { - const requiredNamespace = get(this, 'requiredNamespace'); + const requiredNamespace = this.requiredNamespace; - if ( requiredNamespace && (get(this, 'namespaces') || []).findBy('id', requiredNamespace) ) { - return resolve(get(this, 'primaryResource')); + if ( requiredNamespace && (this.namespaces || []).findBy('id', requiredNamespace) ) { + return resolve(this.primaryResource); } return this._super(...arguments); @@ -324,9 +324,9 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { // Validation failed return false; } - if ( get(this, 'actuallySave') ) { + if ( this.actuallySave ) { if (!get(this, 'selectedTemplateModel.valuesYaml') && get(this, 'selectedTemplateModel.questions')) { - set(get(this, 'catalogApp'), 'answers', get(this, 'answers')); + set(this.catalogApp, 'answers', this.answers); } return this.applyHooks('_beforeSaveHooks').catch((err) => { @@ -354,7 +354,7 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { }, didSave(neu) { - let app = get(this, 'catalogApp'); + let app = this.catalogApp; let yaml = get(this, 'selectedTemplateModel.valuesYaml'); if ( !yaml && this.shouldFallBackToYaml() ) { @@ -378,11 +378,11 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { externalId: get(this, 'selectedTemplateModel.externalId'), answers: yaml ? {} : get(app, 'answers'), valuesYaml: yaml ? yaml : '', - forceUpgrade: get(this, 'forceUpgrade'), + forceUpgrade: this.forceUpgrade, }).then((resp) => resp) .catch((err) => err); } else { - const requiredNamespace = get(this, 'requiredNamespace'); + const requiredNamespace = this.requiredNamespace; setProperties(app, { targetNamespace: requiredNamespace ? requiredNamespace : neu.name, @@ -392,17 +392,17 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { valuesYaml: yaml ? yaml : '', }); - return app.save().then(() => get(this, 'primaryResource')); + return app.save().then(() => this.primaryResource); } }, doneSaving() { var projectId = get(this, 'scope.currentProject.id'); - if ( get(this, 'istio') ) { - return get(this, 'router').transitionTo('authenticated.project.istio.project-istio.rules', projectId); + if ( this.istio ) { + return this.router.transitionTo('authenticated.project.istio.project-istio.rules', projectId); } else { - return get(this, 'router').transitionTo('apps-tab.index', projectId); + return this.router.transitionTo('apps-tab.index', projectId); } }, @@ -413,7 +413,7 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { }, setupComponent() { - if ( get(this, 'selectedTemplateUrl') ) { + if ( this.selectedTemplateUrl ) { if (this.catalogTemplate) { this.initTemplateModel(this.catalogTemplate); } else { @@ -421,10 +421,10 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { } } else { var def = get(this, 'templateResource.defaultVersion'); - var links = get(this, 'versionLinks'); - var app = get(this, 'catalogApp'); + var links = this.versionLinks; + var app = this.catalogApp; - if (get(app, 'id') && !get(this, 'upgrade')) { + if (get(app, 'id') && !this.upgrade) { def = get(app, 'externalIdInfo.version'); } @@ -434,6 +434,6 @@ export default Component.extend(NewOrEdit, CatalogApp, ChildHook, LazyIcon, { set(this, 'selectedTemplateUrl', null); } } - set(this, 'editable.selectedTemplateUrl', get(this, 'selectedTemplateUrl')); + set(this, 'editable.selectedTemplateUrl', this.selectedTemplateUrl); } }); diff --git a/app/components/new-edit-ingress/component.js b/app/components/new-edit-ingress/component.js index 728db59e07..2b3abb871e 100644 --- a/app/components/new-edit-ingress/component.js +++ b/app/components/new-edit-ingress/component.js @@ -24,7 +24,7 @@ export default Component.extend(NewOrEdit, { init() { this._super(...arguments); - if ( get(this, 'existing')) { + if ( this.existing) { set(this, 'namespace', get(this, 'existing.namespace')); } }, @@ -54,17 +54,17 @@ export default Component.extend(NewOrEdit, { headerLabel: computed('intl.locale', 'existing', function() { let k; - if (get(this, 'existing')) { + if (this.existing) { k = 'newIngress.header.edit'; } else { k = 'newIngress.header.add'; } - return get(this, 'intl').t(k); + return this.intl.t(k); }), willSave() { - let pr = get(this, 'primaryResource'); + let pr = this.primaryResource; // Namespace is required, but doesn't exist yet... so lie to the validator let nsId = get(pr, 'namespaceId'); @@ -78,16 +78,16 @@ export default Component.extend(NewOrEdit, { }, doSave() { - let pr = get(this, 'primaryResource'); + let pr = this.primaryResource; let namespacePromise = resolve(); - if (!get(this, 'existing')) { + if (!this.existing) { // Set the namespace ID if (get(this, 'namespace.id')) { set(pr, 'namespaceId', get(this, 'namespace.id')); - } else if (get(this, 'namespace')) { - namespacePromise = get(this, 'namespace').save() + } else if (this.namespace) { + namespacePromise = this.namespace.save() .then((newNamespace) => { set(pr, 'namespaceId', get(newNamespace, 'id')); @@ -103,13 +103,13 @@ export default Component.extend(NewOrEdit, { }, validate() { - let intl = get(this, 'intl'); + let intl = this.intl; - let pr = get(this, 'primaryResource'); + let pr = this.primaryResource; let errors = pr.validationErrors() || []; - errors.pushObjects(get(this, 'namespaceErrors') || []); - errors.pushObjects(get(this, 'certErrors') || []); + errors.pushObjects(this.namespaceErrors || []); + errors.pushObjects(this.certErrors || []); if (!get(this, 'ingress.rules.length') && !get(this, 'ingress.defaultBackend')) { errors.push(intl.t('newIngress.error.noRules')); diff --git a/app/components/new-edit-project/component.js b/app/components/new-edit-project/component.js index 2b83ee6581..7c3052ad4d 100644 --- a/app/components/new-edit-project/component.js +++ b/app/components/new-edit-project/component.js @@ -46,7 +46,7 @@ export default Component.extend(NewOrEdit, ChildHook, { }, updateQuota(quota) { - const primaryResource = get(this, 'primaryResource'); + const primaryResource = this.primaryResource; if ( quota ) { setProperties(primaryResource, quota); @@ -59,7 +59,7 @@ export default Component.extend(NewOrEdit, ChildHook, { }, updateContainerDefault(limit) { - const primaryResource = get(this, 'primaryResource'); + const primaryResource = this.primaryResource; set(primaryResource, 'containerDefaultResourceLimit', limit); }, @@ -69,7 +69,7 @@ export default Component.extend(NewOrEdit, ChildHook, { let cid = get(this, 'primaryResource.creatorId'); let creator = null; - if (get(this, 'editing')) { + if (this.editing) { let users = get(this, 'model.users'); creator = users.findBy('id', cid) || users.findBy('username', cid); // TODO 2.0 must do because first clusters and projects are given admin as the creator id which is not the admins userid @@ -81,15 +81,15 @@ export default Component.extend(NewOrEdit, ChildHook, { }), goBack() { - get(this, 'router').transitionTo('authenticated.cluster.projects.index'); + this.router.transitionTo('authenticated.cluster.projects.index'); }, validate() { this._super(); - const errors = get(this, 'errors') || []; + const errors = this.errors || []; - const intl = get(this, 'intl'); + const intl = this.intl; const resourceQuota = get(this, 'primaryResource.resourceQuota.limit') || {}; const nsResourceQuota = get(this, 'primaryResource.namespaceDefaultResourceQuota.limit') || {}; diff --git a/app/components/new-password/component.js b/app/components/new-password/component.js index 46ccfda349..6218a71b32 100644 --- a/app/components/new-password/component.js +++ b/app/components/new-password/component.js @@ -9,9 +9,9 @@ export default Component.extend({ passwordOkay: false, passwordOut: null, passwordsMatch: computed('newPassword', 'confirmPassword', function() { - if (this.get('confirmPassword')) { - if ((this.get('newPassword') === this.get('confirmPassword'))) { - this.set('passwordOut', this.get('newPassword')); + if (this.confirmPassword) { + if ((this.newPassword === this.confirmPassword)) { + this.set('passwordOut', this.newPassword); this.set('passwordOkay', true); return true; diff --git a/app/components/node-group/component.js b/app/components/node-group/component.js index d64adc3616..7f4fc75c86 100644 --- a/app/components/node-group/component.js +++ b/app/components/node-group/component.js @@ -20,8 +20,8 @@ export default Component.extend({ tagName: '', didReceiveAttrs() { - const nodes = get(this, 'nodes'); - const nodeId = get(this, 'nodeId'); + const nodes = this.nodes; + const nodeId = this.nodeId; if (nodes && nodeId) { const clusterId = get(this, 'scope.currentCluster.id'); diff --git a/app/components/node-row/component.js b/app/components/node-row/component.js index 263c03c0a3..faf8a710da 100644 --- a/app/components/node-row/component.js +++ b/app/components/node-row/component.js @@ -1,5 +1,5 @@ import { or } from '@ember/object/computed'; -import { get, computed } from '@ember/object'; +import { computed } from '@ember/object'; import Component from '@ember/component'; import layout from './template'; import { inject as service } from '@ember/service' @@ -98,14 +98,14 @@ export default Component.extend({ }, showCluster: computed('view', function() { - return !!headersMap[get(this, 'view')].findBy('name', 'cluster'); + return !!headersMap[this.view].findBy('name', 'cluster'); }), showRoles: computed('view', function() { - return !!headersMap[get(this, 'view')].findBy('name', 'roles'); + return !!headersMap[this.view].findBy('name', 'roles'); }), labelColspan: computed('fullColspan', function() { - return get(this, 'fullColspan') + 1; + return this.fullColspan + 1; }), }); diff --git a/app/components/node-selector/component.js b/app/components/node-selector/component.js index 78d2c49c30..fb68472755 100644 --- a/app/components/node-selector/component.js +++ b/app/components/node-selector/component.js @@ -22,22 +22,22 @@ export default Component.extend({ value: '' }; - this.get('ruleArray').pushObject(newRule); + this.ruleArray.pushObject(newRule); }, removeRule(rule) { - this.get('ruleArray').removeObject(rule); + this.ruleArray.removeObject(rule); }, }, inputChanged: observer('ruleArray.@each.{key,value,operator,custom}', function() { - this.set('rules', this.get('ruleArray') + this.set('rules', this.ruleArray .filter((r) => this.isRuleValid(r)) .map((r) => this.convertRule(r))); }), initRuleArray() { - const rules = this.get('rules') || []; + const rules = this.rules || []; const ruleArray = rules.map((rule) => ({ custom: rule, })); this.set('ruleArray', ruleArray); diff --git a/app/components/notifier/modal-new-edit/component.js b/app/components/notifier/modal-new-edit/component.js index 0ff4eb1cb2..4868491334 100644 --- a/app/components/notifier/modal-new-edit/component.js +++ b/app/components/notifier/modal-new-edit/component.js @@ -90,15 +90,15 @@ export default Component.extend(ModalBase, NewOrEdit, { init(...args) { this._super(...args); - const mode = get(this, 'mode'); + const mode = this.mode; if (mode === 'edit' || mode === 'clone') { - const t = get(this, 'currentType'); + const t = this.currentType; this.set('types', TYPES.filterBy('type', t)); } else if (mode === 'add') { set(this, 'modelMap', {}); - this.setModel(get(this, 'currentType')); + this.setModel(this.currentType); this.set('types', TYPES); } }, @@ -109,7 +109,7 @@ export default Component.extend(ModalBase, NewOrEdit, { this.setModel(type); }, test() { - if (get(this, 'testing') || get(this, 'tested')) { + if (this.testing || this.tested) { return resolve(); } const ok = this.validate(); @@ -117,8 +117,8 @@ export default Component.extend(ModalBase, NewOrEdit, { if (!ok) { return resolve(); } - const data = get(this, 'model').serialize(); - const gs = get(this, 'globalStore'); + const data = this.model.serialize(); + const gs = this.globalStore; set(this, 'testing', true); @@ -156,7 +156,7 @@ export default Component.extend(ModalBase, NewOrEdit, { }), addBtnLabel: computed('mode', function() { - const mode = get(this, 'mode'); + const mode = this.mode; if (mode === 'edit') { return 'generic.save'; @@ -170,12 +170,12 @@ export default Component.extend(ModalBase, NewOrEdit, { isSelectType: computed('currentType', function() { const types = TYPES.map((t) => t.type) - return types.includes(get(this, 'currentType')) + return types.includes(this.currentType); }), setModel(type) { const cachedModel = get(this, `modelMap.${ type }`); const clusterId = get(this, 'cluster.id'); - const gs = get(this, 'globalStore'); + const gs = this.globalStore; if (cachedModel) { set(this, 'model', cachedModel); @@ -193,20 +193,20 @@ export default Component.extend(ModalBase, NewOrEdit, { clusterId, [configType]: gs.createRecord({ type: configType }), }; - const model = get(this, 'globalStore').createRecord(opt); + const model = this.globalStore.createRecord(opt); set(this, 'model', model); set(this, `modelMap.${ type }`, model); }, doneSaving() { - get(this, 'modalService').toggleModal(); + this.modalService.toggleModal(); }, validate() { this._super(...arguments); - const errors = get(this, 'errors') || []; - const intl = get(this, 'intl') + const errors = this.errors || []; + const intl = this.intl const preError = '"Default Recipient" is required' const notifierType = get(this, 'model.notifierType') diff --git a/app/components/notifier/notifier-table/component.js b/app/components/notifier/notifier-table/component.js index 77dcba396a..19578112fd 100644 --- a/app/components/notifier/notifier-table/component.js +++ b/app/components/notifier/notifier-table/component.js @@ -1,7 +1,7 @@ import Component from '@ember/component'; import { inject as service } from '@ember/service'; import { reads } from '@ember/object/computed'; -import { get, computed } from '@ember/object'; +import { computed } from '@ember/object'; import layout from './template'; const headers = [ @@ -43,8 +43,8 @@ export default Component.extend({ clusterId: reads('scope.currentCluster.id'), filteredNotifiers: computed('model.@each.clusterId', 'clusterId', function() { - const data = this.get('model') || []; - const clusterId = get(this, 'clusterId') + const data = this.model || []; + const clusterId = this.clusterId return data.filterBy('clusterId', clusterId); }), diff --git a/app/components/page-footer/component.js b/app/components/page-footer/component.js index 9c118bd108..e98448f52b 100644 --- a/app/components/page-footer/component.js +++ b/app/components/page-footer/component.js @@ -20,7 +20,7 @@ export default Component.extend({ init() { this._super(...arguments); - let settings = this.get('settings'); + let settings = this.settings; let cli = {}; @@ -33,16 +33,16 @@ export default Component.extend({ actions: { showAbout() { - this.get('modalService').toggleModal('modal-about', { closeWithOutsideClick: true }); + this.modalService.toggleModal('modal-about', { closeWithOutsideClick: true }); }, showWechat() { - this.get('modalService').toggleModal('modal-wechat', { closeWithOutsideClick: true }); + this.modalService.toggleModal('modal-wechat', { closeWithOutsideClick: true }); }, }, displayVersion: computed('settings.rancherVersion', function() { - const fullVersion = get(this, 'settings.rancherVersion') || get(this, 'intl').t('pageFooter.notARelease'); + const fullVersion = get(this, 'settings.rancherVersion') || this.intl.t('pageFooter.notARelease'); let displayVersion = fullVersion; const match = fullVersion.match(/^(.*)-([0-9a-f]{40})-(.*)$/); diff --git a/app/components/page-header-project/component.js b/app/components/page-header-project/component.js index b206eea5f1..419029e835 100644 --- a/app/components/page-header-project/component.js +++ b/app/components/page-header-project/component.js @@ -55,6 +55,10 @@ export default Component.extend(ThrottledResize, { cluster: alias('scope.pendingCluster'), numClusters: alias('byCluster.length'), + twoLine: computed.equal('pageScope', 'project'), + + hide: computed.equal('pageScope', 'user'), + init() { this._super(...arguments); setProperties(this, { @@ -104,7 +108,7 @@ export default Component.extend(ThrottledResize, { if ( currentClusterId ) { const li = $(`.clusters LI[data-cluster-id="${ currentClusterId }"]`)[0]; - const entry = get(this, 'byCluster').findBy('clusterId', currentClusterId); + const entry = this.byCluster.findBy('clusterId', currentClusterId); ensureVisible(li); @@ -144,21 +148,13 @@ export default Component.extend(ThrottledResize, { }, }, - twoLine: computed('pageScope', function() { - return get(this, 'pageScope') === 'project'; - }), - - hide: computed('pageScope', function() { - return get(this, 'pageScope') === 'user'; - }), - projectChoices: computed('scope.allProjects.@each.{id,displayName,relevantState}', function() { return get(this, 'scope.allProjects') .sortBy('displayName', 'id'); }), maxProjects: computed('byCluster.@each.numProjects', function() { - const counts = get(this, 'byCluster').map((x) => x.projects.length); + const counts = this.byCluster.map((x) => x.projects.length); return Math.max(...counts); }), @@ -175,7 +171,7 @@ export default Component.extend(ThrottledResize, { } }); - get(this, 'projectChoices').forEach((project) => { + this.projectChoices.forEach((project) => { const cluster = get(project, 'cluster'); const width = getMaxWidth(textWidth(get(project, 'displayName'), FONT), navWidth); @@ -224,22 +220,22 @@ export default Component.extend(ThrottledResize, { }), clustersWidth: computed('byCluster.@each.width', function() { - const widths = get(this, 'byCluster').map((x) => get(x, 'width')); + const widths = this.byCluster.map((x) => get(x, 'width')); return Math.max(...widths); }), projectsWidth: computed('byCluster.@each.projectWidth', function() { - const widths = get(this, 'byCluster').map((x) => get(x, 'projectWidth')); + const widths = this.byCluster.map((x) => get(x, 'projectWidth')); return Math.max(...widths); }), clusterSearchResults: computed('searchInput', 'byCluster.[]', function() { - const needle = get(this, 'searchInput'); + const needle = this.searchInput; const out = []; - get(this, 'byCluster').forEach((entry) => { + this.byCluster.forEach((entry) => { const cluster = get(entry, 'cluster'); const name = get(cluster, 'displayName'); const { found, match } = highlightMatches(needle, name); @@ -256,10 +252,10 @@ export default Component.extend(ThrottledResize, { }), projectSearchResults: computed('byCluster.[]', 'projectChoices', 'searchInput', function() { - const needle = get(this, 'searchInput'); + const needle = this.searchInput; const out = []; - get(this, 'projectChoices').forEach((project) => { + this.projectChoices.forEach((project) => { const name = get(project, 'displayName'); const { found, match } = highlightMatches(needle, name); @@ -418,7 +414,7 @@ export default Component.extend(ThrottledResize, { }, enterCluster(e) { - if ( get(this, 'searchInput') ) { + if ( this.searchInput ) { return; } @@ -428,7 +424,7 @@ export default Component.extend(ThrottledResize, { const id = $li.data('cluster-id'); if ( id ) { - const entry = get(this, 'byCluster').findBy('clusterId', id); + const entry = this.byCluster.findBy('clusterId', id); this.maybeHover(entry); } @@ -444,13 +440,13 @@ export default Component.extend(ThrottledResize, { set(this, 'leaveDelayTimer', setTimeout(() => { setProperties(this, { hoverEntry: null, - clusterEntry: get(this, 'activeClusterEntry'), + clusterEntry: this.activeClusterEntry, }); }, MOUSE_DELAY)); }, getHoverDelay() { - const entry = get(this, 'activeClusterEntry'); + const entry = this.activeClusterEntry; const points = this.mousePoints; const $menu = $('.clusters'); @@ -525,7 +521,7 @@ export default Component.extend(ThrottledResize, { this.maybeHover(entry); }, delay); } else { - const prev = get(this, 'hoverEntry'); + const prev = this.hoverEntry; if ( entry !== prev ) { setProperties(this, { @@ -553,20 +549,20 @@ export default Component.extend(ThrottledResize, { }, onResize() { - if ( !get(this, 'open') ) { + if ( !this.open ) { return; } const $window = $(window); - let want = Math.max(get(this, 'numClusters'), get(this, 'maxProjects')); + let want = Math.max(this.numClusters, this.maxProjects); let roomFor = Math.ceil( ($window.height() - BUFFER_HEIGHT) / (2 * ITEM_HEIGHT) ); const rows = Math.max(3, Math.min(want, roomFor)); const height = rows * ITEM_HEIGHT; set(this, 'columnStyle', `height: ${ height }px`.htmlSafe()); - let cw = Math.max(MIN_COLUMN_WIDTH, get(this, 'clustersWidth') + 60); // 20px icon, 20px padding, 20px scrollbar - let pw = Math.max(MIN_COLUMN_WIDTH, get(this, 'projectsWidth') + 60); + let cw = Math.max(MIN_COLUMN_WIDTH, this.clustersWidth + 60); // 20px icon, 20px padding, 20px scrollbar + let pw = Math.max(MIN_COLUMN_WIDTH, this.projectsWidth + 60); want = cw + pw; roomFor = $window.width() - BUFFER_WIDTH; diff --git a/app/components/page-header/component.js b/app/components/page-header/component.js index c905bb6e7d..b6b7f7c7f9 100644 --- a/app/components/page-header/component.js +++ b/app/components/page-header/component.js @@ -52,9 +52,9 @@ export default Component.extend({ get(this, 'intl.locale'); setProperties(this, { - stacks: get(this, 'store').all('stack'), - hosts: get(this, 'store').all('host'), - stackSchema: get(this, 'store').getById('schema', 'stack'), + stacks: this.store.all('stack'), + hosts: this.store.all('host'), + stackSchema: this.store.getById('schema', 'stack'), }); run.once(this, 'updateNavTree'); @@ -82,7 +82,7 @@ export default Component.extend({ // beyond things listed in "Inputs" hasProject: computed('project', function() { - return !!get(this, 'project'); + return !!this.project; }), // Hackery: You're an owner if you can write to the 'system' field of a stack @@ -95,12 +95,12 @@ export default Component.extend({ }), dashboardLink: computed('cluster.isReady', 'clusterId', 'pageScope', 'scope.dashboardLink', function() { - if ( get(this, 'pageScope') === 'global' || !this.clusterId ) { + if ( this.pageScope === 'global' || !this.clusterId ) { // Only inside a cluster return; } - const cluster = get(this, 'cluster'); + const cluster = this.cluster; if ( !cluster || !cluster.isReady ) { // Only in ready/active clusters @@ -111,7 +111,7 @@ export default Component.extend({ }), updateNavTree() { - const currentScope = get(this, 'pageScope'); + const currentScope = this.pageScope; const out = getTree().filter((item) => { if ( typeof get(item, 'condition') === 'function' ) { @@ -156,7 +156,7 @@ export default Component.extend({ return true; }); - const old = JSON.stringify(get(this, 'navTree')); + const old = JSON.stringify(this.navTree); const neu = JSON.stringify(out); if ( old !== neu ) { @@ -243,7 +243,7 @@ export default Component.extend({ }, setupTearDown() { - this.get('router').on('routeWillChange', () => { + this.router.on('routeWillChange', () => { $('header > nav').removeClass('nav-open');// eslint-disable-line }); } diff --git a/app/components/pod-dots/component.js b/app/components/pod-dots/component.js index 7db2d10ab2..cd84a203a4 100644 --- a/app/components/pod-dots/component.js +++ b/app/components/pod-dots/component.js @@ -1,4 +1,4 @@ -import { get, computed, observer } from '@ember/object'; +import { computed, observer } from '@ember/object'; import { alias } from '@ember/object/computed'; import Component from '@ember/component'; import pagedArray from 'ember-cli-pagination/computed/paged-array'; @@ -23,11 +23,11 @@ export default Component.extend({ perPage: 120, pageCountChanged: observer('indexFrom', 'filtered.length', function() { // Go to the last page if we end up past the last page - let from = this.get('indexFrom'); + let from = this.indexFrom; let last = this.get('filtered.length'); - var perPage = this.get('perPage'); + var perPage = this.perPage; - if ( this.get('page') > 1 && from > last) { + if ( this.page > 1 && from > last) { let page = Math.ceil(last / perPage); this.set('page', page); @@ -37,8 +37,8 @@ export default Component.extend({ filtered: computed('pod', 'pods.[]', 'searchFields', 'searchText', function() { let out = []; - const pod = this.get('pod'); - const pods = this.get('pods'); + const pod = this.pod; + const pods = this.pods; if ( pods ) { out.pushObjects(pods.slice()); @@ -48,7 +48,7 @@ export default Component.extend({ out.pushObject(pod); } - const { matches } = filter(out, get(this, 'searchText'), get(this, 'searchFields')); + const { matches } = filter(out, this.searchText, this.searchFields); return matches; }), @@ -59,14 +59,14 @@ export default Component.extend({ }), indexFrom: computed('page', 'perPage', function() { - var current = this.get('page'); - var perPage = this.get('perPage'); + var current = this.page; + var perPage = this.perPage; return Math.max(0, 1 + perPage * (current - 1)); }), indexTo: computed('indexFrom', 'perPage', 'filtered.length', function() { - return Math.min(this.get('filtered.length'), this.get('indexFrom') + this.get('perPage') - 1); + return Math.min(this.get('filtered.length'), this.indexFrom + this.perPage - 1); }), }); diff --git a/app/components/pod-metrics/component.js b/app/components/pod-metrics/component.js index 41399c7d61..7919f0b878 100644 --- a/app/components/pod-metrics/component.js +++ b/app/components/pod-metrics/component.js @@ -1,7 +1,7 @@ import Component from '@ember/component'; import Metrics from 'shared/mixins/metrics'; import layout from './template'; -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; export default Component.extend(Metrics, { layout, @@ -12,6 +12,6 @@ export default Component.extend(Metrics, { init() { this._super(...arguments); - set(this, 'metricParams', { podName: get(this, 'resourceId') }); + set(this, 'metricParams', { podName: this.resourceId }); }, -}); \ No newline at end of file +}); diff --git a/app/components/pod-row/component.js b/app/components/pod-row/component.js index a01f4df58a..cc2b28e172 100644 --- a/app/components/pod-row/component.js +++ b/app/components/pod-row/component.js @@ -33,7 +33,7 @@ export default Component.extend({ }, canExpand: computed('expandPlaceholder', 'model.containers.length', function() { - return get(this, 'expandPlaceholder') && get(this, 'model.containers.length') > 1; + return this.expandPlaceholder && get(this, 'model.containers.length') > 1; }), statsAvailable: computed('model.{state,healthState}', function() { diff --git a/app/components/progress-bar-multi/component.js b/app/components/progress-bar-multi/component.js index 4afc88d33f..9831c65ebc 100644 --- a/app/components/progress-bar-multi/component.js +++ b/app/components/progress-bar-multi/component.js @@ -1,4 +1,9 @@ -import { defineProperty, computed, get, observer } from '@ember/object'; +import { + defineProperty, + computed, + get, + observer +} from '@ember/object'; import Component from '@ember/component'; import layout from './template'; import $ from 'jquery'; @@ -31,19 +36,19 @@ export default Component.extend({ init() { this._super(...arguments); - let colorKey = get(this, 'colorKey'); - let labelKey = get(this, 'labelKey'); - let valueKey = get(this, 'valueKey'); + let colorKey = this.colorKey; + let labelKey = this.labelKey; + let valueKey = this.valueKey; let valueDep = `values.@each.{${ colorKey },${ labelKey },${ valueKey }}`; defineProperty(this, 'pieces', computed(valueDep, 'max', 'min', 'minPercent', 'values', () => { - let min = get(this, 'min'); - let max = get(this, 'max'); + let min = this.min; + let max = this.max; var out = []; - (get(this, 'values') || []).forEach((obj) => { + (this.values || []).forEach((obj) => { out.push({ color: get(obj, colorKey), label: get(obj, labelKey), @@ -59,7 +64,7 @@ export default Component.extend({ } let sum = 0; - let minPercent = get(this, 'minPercent'); + let minPercent = this.minPercent; out.forEach((obj) => { let per = Math.max(minPercent, toPercent(obj.value, min, max)); @@ -82,13 +87,13 @@ export default Component.extend({ valueDep = `tooltipValues.@each.{${ labelKey },${ valueKey }}`; defineProperty(this, 'tooltipContent', computed(valueDep, 'labelKey', 'tooltipArrayOrString', 'tooltipValues', 'valueKey', () => { - let labelKey = get(this, 'labelKey'); - let valueKey = get(this, 'valueKey'); + let labelKey = this.labelKey; + let valueKey = this.valueKey; var out = []; - (get(this, 'tooltipValues') || []).forEach((obj) => { - if (get(this, 'tooltipArrayOrString') === 'string') { + (this.tooltipValues || []).forEach((obj) => { + if (this.tooltipArrayOrString === 'string') { out.push(`${ get(obj, labelKey) }: ${ get(obj, valueKey) }`); } else { out.push({ @@ -99,7 +104,7 @@ export default Component.extend({ }); - return get(this, 'tooltipArrayOrString') === 'string' ? out.join('\n') : out; + return this.tooltipArrayOrString === 'string' ? out.join('\n') : out; })); }, @@ -108,7 +113,7 @@ export default Component.extend({ }, zIndexDidChange: observer('zIndex', function() { - $().css('zIndex', get(this, 'zIndex') || 'inherit'); + $().css('zIndex', this.zIndex || 'inherit'); }), }); diff --git a/app/components/project-resource-quota/component.js b/app/components/project-resource-quota/component.js index 5245c72f4d..4dded9f8d0 100644 --- a/app/components/project-resource-quota/component.js +++ b/app/components/project-resource-quota/component.js @@ -1,4 +1,4 @@ -import { get, set, observer } from '@ember/object'; +import { set, observer } from '@ember/object'; import Component from '@ember/component'; import { convertToMillis } from 'shared/utils/util'; import { parseSi } from 'shared/utils/parse-unit'; @@ -21,7 +21,7 @@ export default Component.extend({ actions: { addQuota() { - get(this, 'quotaArray').pushObject({ + this.quotaArray.pushObject({ key: '', projectLimit: '', namespaceLimit: '', @@ -29,7 +29,7 @@ export default Component.extend({ }, removeQuota(quota){ - get(this, 'quotaArray').removeObject(quota); + this.quotaArray.removeObject(quota); } }, @@ -37,7 +37,7 @@ export default Component.extend({ const limit = {}; const nsDefaultLimit = {}; - (get(this, 'quotaArray') || []).forEach((quota) => { + (this.quotaArray || []).forEach((quota) => { if ( quota.key && (quota.projectLimit || quota.namespaceLimit) ) { limit[quota.key] = this.convertToString(quota.key, quota.projectLimit); nsDefaultLimit[quota.key] = this.convertToString(quota.key, quota.namespaceLimit); @@ -97,8 +97,8 @@ export default Component.extend({ }, initQuotaArray() { - const limit = get(this, 'limit') || {}; - const nsDefaultLimit = get(this, 'nsDefaultLimit') || {}; + const limit = this.limit || {}; + const nsDefaultLimit = this.nsDefaultLimit || {}; const array = []; Object.keys(limit).forEach((key) => { diff --git a/app/components/resource-quota-select/component.js b/app/components/resource-quota-select/component.js index c1e02f25d9..439d768ad0 100644 --- a/app/components/resource-quota-select/component.js +++ b/app/components/resource-quota-select/component.js @@ -1,5 +1,5 @@ import C from 'ui/utils/constants'; -import { get, set, observer } from '@ember/object'; +import { get, set, observer } from '@ember/object'; import Component from '@ember/component'; import { next } from '@ember/runloop'; import layout from './template'; @@ -16,11 +16,11 @@ export default Component.extend({ }, currentQuotaDidChange: observer('currentQuota.@each.key', function() { - set(this, 'resourceChoices', get(this, 'allResourceChoices').filter((choice) => this.doesExist(choice))); + set(this, 'resourceChoices', this.allResourceChoices.filter((choice) => this.doesExist(choice))); }), doesExist(choice) { - return get(choice, 'value') === get(this, 'quota.key') || !(get(this, 'currentQuota') || []).findBy('key', get(choice, 'value')); + return get(choice, 'value') === get(this, 'quota.key') || !(this.currentQuota || []).findBy('key', get(choice, 'value')); }, initResourceChoices() { diff --git a/app/components/settings/server-url/component.js b/app/components/settings/server-url/component.js index 2457fc8593..74a23c5f64 100644 --- a/app/components/settings/server-url/component.js +++ b/app/components/settings/server-url/component.js @@ -1,6 +1,6 @@ import Component from '@ember/component'; import layout from './template'; -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; import { inject as service } from '@ember/service'; import { isEmpty } from '@ember/utils'; import { next } from '@ember/runloop'; @@ -28,7 +28,7 @@ export default Component.extend({ init() { this._super(...arguments); - const initServerUrl = get(this, 'initServerUrl'); + const initServerUrl = this.initServerUrl; if ( isEmpty(initServerUrl) ) { set(this, 'serverUrl', window.location.host); @@ -52,12 +52,12 @@ export default Component.extend({ actions: { saveServerUrl() { - let setting = get(this, 'serverUrlSetting'); + let setting = this.serverUrlSetting; - set(setting, 'value', `${ SCHEME }${ get(this, 'serverUrl') }`); + set(setting, 'value', `${ SCHEME }${ this.serverUrl }`); setting.save().then(() => { - if ( !get(this, 'popupMode') ) { - get(this, 'router').replaceWith('authenticated'); + if ( !this.popupMode ) { + this.router.replaceWith('authenticated'); } else { this.send('cancel'); } diff --git a/app/components/settings/table-rows/component.js b/app/components/settings/table-rows/component.js index 3617a72804..56db8bfdd6 100644 --- a/app/components/settings/table-rows/component.js +++ b/app/components/settings/table-rows/component.js @@ -24,10 +24,10 @@ export default Component.extend({ perPage: alias('prefs.tablePerPage'), init() { this._super(...arguments); - this.set('selectedCount', `${ this.get('perPage') }`); + this.set('selectedCount', `${ this.perPage }`); }, countChanged: observer('selectedCount', function() { - this.set(`prefs.${ C.PREFS.TABLE_COUNT }`, parseInt(this.get('selectedCount'), 10)); + this.set(`prefs.${ C.PREFS.TABLE_COUNT }`, parseInt(this.selectedCount, 10)); }), }); diff --git a/app/components/settings/telemetry-opt/component.js b/app/components/settings/telemetry-opt/component.js index d684d966a8..26313c277f 100644 --- a/app/components/settings/telemetry-opt/component.js +++ b/app/components/settings/telemetry-opt/component.js @@ -18,7 +18,7 @@ export default Component.extend({ let val = false; - if ( this.get('initialValue') === IN ) { + if ( this.initialValue === IN ) { val = true; } @@ -26,8 +26,8 @@ export default Component.extend({ }, actions: { save(btnCb) { - this.get('settings').set(C.SETTING.TELEMETRY, (this.get('optIn') ? IN : OUT)); - this.get('settings').one('settingsPromisesResolved', () => { + this.settings.set(C.SETTING.TELEMETRY, (this.optIn ? IN : OUT)); + this.settings.one('settingsPromisesResolved', () => { btnCb(true); if (this.saved) { this.saved(); diff --git a/app/components/settings/theme-toggle/component.js b/app/components/settings/theme-toggle/component.js index 22e6f4180e..4d5220059f 100644 --- a/app/components/settings/theme-toggle/component.js +++ b/app/components/settings/theme-toggle/component.js @@ -12,7 +12,7 @@ export default Component.extend({ layout, actions: { changeTheme(theme) { - var userTheme = this.get('userTheme'); + var userTheme = this.userTheme; var currentTheme = userTheme.getTheme(); if (theme !== currentTheme) { diff --git a/app/components/settings/user-info/component.js b/app/components/settings/user-info/component.js index 6a422ca89f..3bed22a53a 100644 --- a/app/components/settings/user-info/component.js +++ b/app/components/settings/user-info/component.js @@ -10,7 +10,7 @@ export default Component.extend({ actions: { editPassword() { - this.get('account').send('edit'); + this.account.send('edit'); } } diff --git a/app/components/volume-source/source-certificate/component.js b/app/components/volume-source/source-certificate/component.js index fc2158aceb..f57823bac0 100644 --- a/app/components/volume-source/source-certificate/component.js +++ b/app/components/volume-source/source-certificate/component.js @@ -23,7 +23,7 @@ export default Component.extend(VolumeSource, { }, modeDidChange: observer('defaultMode', function() { - const octal = get(this, 'defaultMode') || '0'; + const octal = this.defaultMode || '0'; set(this, 'config.defaultMode', parseInt(octal, 8)); }), diff --git a/app/components/volume-source/source-config-map/component.js b/app/components/volume-source/source-config-map/component.js index e12b5eeba8..9d3ed7264e 100644 --- a/app/components/volume-source/source-config-map/component.js +++ b/app/components/volume-source/source-config-map/component.js @@ -26,13 +26,13 @@ export default Component.extend(VolumeSource, { }, specificDidChange: observer('specific', function() { - if (!get(this, 'specific')){ + if (!this.specific){ set(this, 'config.items', null); } }), modeDidChange: observer('defaultMode', function() { - const octal = get(this, 'defaultMode') || '0'; + const octal = this.defaultMode || '0'; set(this, 'config.defaultMode', parseInt(octal, 8)); }), diff --git a/app/components/volume-source/source-custom-log-path/component.js b/app/components/volume-source/source-custom-log-path/component.js index 7316b4dcda..6bfa88e9c8 100644 --- a/app/components/volume-source/source-custom-log-path/component.js +++ b/app/components/volume-source/source-custom-log-path/component.js @@ -41,22 +41,22 @@ export default Component.extend(VolumeSource, { } }, useCustomRegex() { - set(this, 'useCustomRegex', !get(this, 'useCustomRegex')); + set(this, 'useCustomRegex', !this.useCustomRegex); }, }, useCustomRegexChange: observer('useCustomRegex', function() { - const useCustomRegex = get(this, 'useCustomRegex'); + const useCustomRegex = this.useCustomRegex; if (useCustomRegex) { set(this, 'cachedFormat', get(this, 'config.options.format')); - set(this, 'config.options.format', get(this, 'initialCustomFormat')); + set(this, 'config.options.format', this.initialCustomFormat); } else { - set(this, 'config.options.format', get(this, 'cachedFormat')); + set(this, 'config.options.format', this.cachedFormat); } }), firstMount: computed('mounts.[]', function() { - return get(this, 'mounts').get('firstObject'); + return this.mounts.get('firstObject'); }), }); diff --git a/app/components/volume-source/source-secret/component.js b/app/components/volume-source/source-secret/component.js index 67b34ff083..60e42c2fd1 100644 --- a/app/components/volume-source/source-secret/component.js +++ b/app/components/volume-source/source-secret/component.js @@ -27,13 +27,13 @@ export default Component.extend(VolumeSource, { }, specificDidChange: observer('specific', function() { - if (!get(this, 'specific')){ + if (!this.specific){ set(this, 'config.items', null); } }), modeDidChange: observer('defaultMode', function() { - const octal = get(this, 'defaultMode') || '0'; + const octal = this.defaultMode || '0'; set(this, 'config.defaultMode', parseInt(octal, 8)); }), diff --git a/app/components/workload-metrics/component.js b/app/components/workload-metrics/component.js index ed1aa22df7..cf7d75a906 100644 --- a/app/components/workload-metrics/component.js +++ b/app/components/workload-metrics/component.js @@ -1,7 +1,7 @@ import Component from '@ember/component'; import Metrics from 'shared/mixins/metrics'; import layout from './template'; -import { get, set } from '@ember/object'; +import { set } from '@ember/object'; export default Component.extend(Metrics, { layout, @@ -12,7 +12,7 @@ export default Component.extend(Metrics, { init() { this._super(...arguments); - set(this, 'metricParams', { workloadName: get(this, 'resourceId') }); + set(this, 'metricParams', { workloadName: this.resourceId }); }, -}); \ No newline at end of file +}); diff --git a/app/container-graphs/route.js b/app/container-graphs/route.js index 47d843c7e5..1071edf4a6 100644 --- a/app/container-graphs/route.js +++ b/app/container-graphs/route.js @@ -15,7 +15,7 @@ export default Route.extend({ } }, model(params) { - const pod = get(this, 'store').find('pod', params.pod_id); + const pod = this.store.find('pod', params.pod_id); return hash({ pod }).then((hash) => { const container = get(hash, 'pod.containers').findBy('name', params.container_name); diff --git a/app/container/route.js b/app/container/route.js index 3e10468d42..bcae5991d9 100644 --- a/app/container/route.js +++ b/app/container/route.js @@ -15,7 +15,7 @@ export default Route.extend({ } }, model(params) { - const pod = get(this, 'store').find('pod', params.pod_id); + const pod = this.store.find('pod', params.pod_id); return hash({ pod }).then((hash) => { const container = get(hash, 'pod.containers').findBy('name', params.container_name); diff --git a/app/containers/index/controller.js b/app/containers/index/controller.js index a1dca33772..991180667f 100644 --- a/app/containers/index/controller.js +++ b/app/containers/index/controller.js @@ -59,12 +59,12 @@ export default Controller.extend({ actions: { toggleExpand() { - this.get('projectController').send('toggleExpand', ...arguments); + this.projectController.send('toggleExpand', ...arguments); }, }, rows: computed('group', 'model.workloads.@each.{namespaceId,isBalancer}', 'model.pods.@each.{workloadId,namespaceId}', function() { - const groupBy = this.get('group'); + const groupBy = this.group; let out = []; switch (groupBy) { @@ -82,7 +82,7 @@ export default Controller.extend({ }), groupByRef: computed('group', function() { - const group = this.get('group'); + const group = this.group; if (group === 'node') { return 'node'; diff --git a/app/containers/index/route.js b/app/containers/index/route.js index b9a5ad41a1..c4a7cb71f3 100644 --- a/app/containers/index/route.js +++ b/app/containers/index/route.js @@ -9,8 +9,8 @@ export default Route.extend({ globalStore: service(), model() { - var store = this.get('store'); - var globalStore = this.get('globalStore'); + var store = this.store; + var globalStore = this.globalStore; return hash({ workloads: store.findAll('workload'), diff --git a/app/containers/run/controller.js b/app/containers/run/controller.js index 43936bc3e3..f3e46af372 100644 --- a/app/containers/run/controller.js +++ b/app/containers/run/controller.js @@ -39,7 +39,7 @@ export default Controller.extend({ displayName: get(slc, 'name'), }]; - get(this, 'modalService').toggleModal('confirm-delete', { + this.modalService.toggleModal('confirm-delete', { resources, showProtip: false }); @@ -65,7 +65,7 @@ export default Controller.extend({ set(this, 'deleting', false); }) .catch((err) => { - get(this, 'growl').fromError(err); + this.growl.fromError(err); set(this, 'deleting', false); }); }, diff --git a/app/containers/run/route.js b/app/containers/run/route.js index eb25c2e404..f992cb3ee0 100644 --- a/app/containers/run/route.js +++ b/app/containers/run/route.js @@ -35,7 +35,7 @@ export default Route.extend({ }, model(params/* , transition*/) { - var store = get(this, 'store'); + var store = this.store; let promise = null; @@ -167,7 +167,7 @@ export default Route.extend({ return out; } else { // Clone workload with one container - let neu = get(this, 'store').createRecord(clone.serializeForNew()); + let neu = this.store.createRecord(clone.serializeForNew()); delete neu.deploymentStatus; container = neu.containers[0]; @@ -191,7 +191,7 @@ export default Route.extend({ }, getNamespaceId(params) { - const clusterStore = get(this, 'clusterStore'); + const clusterStore = this.clusterStore; let ns = null; @@ -220,7 +220,7 @@ export default Route.extend({ }, emptyWorkload(params) { - const store = get(this, 'store'); + const store = this.store; return store.createRecord({ type: 'workload', @@ -234,7 +234,7 @@ export default Route.extend({ }, emptyContainer(params, namespaceId) { - return get(this, 'store').createRecord({ + return this.store.createRecord({ type: 'container', tty: true, stdin: true, diff --git a/app/fail-whale/route.js b/app/fail-whale/route.js index d8b8c3d96b..3628b88833 100644 --- a/app/fail-whale/route.js +++ b/app/fail-whale/route.js @@ -11,7 +11,7 @@ export default Route.extend({ afterModel(model) { if ( model ) { - this.get('storeReset').reset(); + this.storeReset.reset(); } else { this.transitionTo('authenticated'); } diff --git a/app/ingress/route.js b/app/ingress/route.js index 84713beabf..fcabb0050f 100644 --- a/app/ingress/route.js +++ b/app/ingress/route.js @@ -1,10 +1,9 @@ import { hash } from 'rsvp'; -import { get } from '@ember/object'; import Route from '@ember/routing/route'; export default Route.extend({ model(params) { - const store = get(this, 'store'); + const store = this.store; return hash({ ingress: store.find('ingress', params.ingress_id), diff --git a/app/ingresses/index/controller.js b/app/ingresses/index/controller.js index 60b77c4f0a..e43159ee86 100644 --- a/app/ingresses/index/controller.js +++ b/app/ingresses/index/controller.js @@ -49,7 +49,7 @@ export default Controller.extend({ }), rows: computed('model.ingresses.[]', 'balancerServices.[]', function() { - const out = (get(this, 'balancerServices') || []).slice(); + const out = (this.balancerServices || []).slice(); out.addObjects(get(this, 'model.ingresses') || []); diff --git a/app/ingresses/index/route.js b/app/ingresses/index/route.js index 84dc7fbe02..fc64169868 100644 --- a/app/ingresses/index/route.js +++ b/app/ingresses/index/route.js @@ -6,7 +6,7 @@ import C from 'ui/utils/constants'; export default Route.extend({ model() { - const store = this.get('store'); + const store = this.store; return hash({ ingresses: store.findAll('ingress'), diff --git a/app/ingresses/run/route.js b/app/ingresses/run/route.js index 492f8967ab..6f268ce45f 100644 --- a/app/ingresses/run/route.js +++ b/app/ingresses/run/route.js @@ -1,10 +1,10 @@ import { hash } from 'rsvp'; -import { get, set } from '@ember/object' +import { set } from '@ember/object' import Route from '@ember/routing/route'; export default Route.extend({ model(params) { - const store = get(this, 'store'); + const store = this.store; const dependencies = { namespacedcertificates: store.findAll('namespacedcertificate'), diff --git a/app/initializers/extend-ember-link.js b/app/initializers/extend-ember-link.js index 2bd3925ad7..f12c78eae5 100644 --- a/app/initializers/extend-ember-link.js +++ b/app/initializers/extend-ember-link.js @@ -12,7 +12,7 @@ export function initialize(/* application */) { activeParent: null, addActiveObserver: on('didInsertElement', function() { - if ( this.get('activeParent') ) { + if ( this.activeParent ) { this.addObserver('active', this, 'activeChanged'); this.addObserver('application.currentRouteName', this, 'activeChanged'); this.activeChanged(); @@ -24,14 +24,14 @@ export function initialize(/* application */) { return; } - const parent = $().closest(get(this, 'activeParent')); + const parent = $().closest(this.activeParent); if ( !parent || !parent.length ) { return; } - let active = !!get(this, 'active'); - let more = get(this, 'currentWhen'); + let active = !!this.active; + let more = this.currentWhen; if ( !active && more && more.length) { const currentRouteName = get(this, 'application.currentRouteName'); diff --git a/app/initializers/route-spy.js b/app/initializers/route-spy.js index f840fb2a52..8f4fdc7de9 100644 --- a/app/initializers/route-spy.js +++ b/app/initializers/route-spy.js @@ -1,3 +1,4 @@ +import { on } from '@ember/object/evented'; import Router from '@ember/routing/router'; import { isEmbedded, dashboardWindow } from 'shared/utils/util'; @@ -6,19 +7,19 @@ export function initialize() { if (isEmbedded()) { Router.reopen({ - notifyTopFrame: function() { + notifyTopFrame: on('didTransition', function() { dashboardWindow().postMessage({ action: 'did-transition', url: this.currentURL }) - }.on('didTransition'), + }), - willTranstionNotify: function(transition) { + willTranstionNotify: on('willTransition', (transition) => { dashboardWindow().postMessage({ action: 'before-navigation', target: transition.targetName, }) - }.on('willTransition') + }) }); // Add listener for post messages to change the route in the application diff --git a/app/instance-initializers/nav.js b/app/instance-initializers/nav.js index 2bd0656c94..0845a00180 100644 --- a/app/instance-initializers/nav.js +++ b/app/instance-initializers/nav.js @@ -1,4 +1,8 @@ -import { getProjectId, getClusterId, bulkAdd } from 'ui/utils/navigation-tree'; +import { + getProjectId, + getClusterId, + bulkAdd +} from 'ui/utils/navigation-tree'; import { get } from '@ember/object'; const rootNav = [ @@ -267,7 +271,7 @@ const rootNav = [ localizedLabel: 'nav.admin.security.authentication', route: 'global-admin.security.authentication', condition() { - const authConfigs = this.get('globalStore').all('authConfig'); + const authConfigs = this.globalStore.all('authConfig'); return authConfigs.get('length') > 0; } diff --git a/app/mixins/logging-model.js b/app/mixins/logging-model.js index 59482abc51..fa2eabb2eb 100644 --- a/app/mixins/logging-model.js +++ b/app/mixins/logging-model.js @@ -9,10 +9,10 @@ export default Mixin.create({ type: null, patch() { - const t = get(this, 'targetType'); - const store = get(this, 'store'); + const t = this.targetType; + const store = this.store; - const nue = store.createRecord({ type: this.get('type'), }); + const nue = store.createRecord({ type: this.type, }); const map = EmberObject.create({}); @@ -55,8 +55,8 @@ export default Mixin.create({ [`${ t }.config`]: get(this, `${ t }Config`), [`${ t }.outputFlushInterval`]: get(this, `outputFlushInterval`), [`${ t }.outputTags`]: get(this, `outputTags`), - [`${ t }.dockerRootDir`]: get(this, 'dockerRootDir'), - [`${ t }.includeSystemComponent`]: get(this, 'includeSystemComponent'), + [`${ t }.dockerRootDir`]: this.dockerRootDir, + [`${ t }.includeSystemComponent`]: this.includeSystemComponent, }) } @@ -91,11 +91,11 @@ export default Mixin.create({ }), sslTargetType: computed('elasticsearchConfig', 'splunkConfig', 'kafkaConfig', 'syslogConfig', 'fluentForwarderConfig', function() { - const es = get(this, 'elasticsearchConfig'); - const splunk = get(this, 'splunkConfig'); - const kafka = get(this, 'kafkaConfig'); - const syslog = get(this, 'syslogConfig'); - const fluentd = get(this, 'fluentForwarderConfig'); + const es = this.elasticsearchConfig; + const splunk = this.splunkConfig; + const kafka = this.kafkaConfig; + const syslog = this.syslogConfig; + const fluentd = this.fluentForwarderConfig; if (es) { return 'elasticsearch'; diff --git a/app/mixins/model-alert.js b/app/mixins/model-alert.js index f54b95b7d3..0c9402a44f 100644 --- a/app/mixins/model-alert.js +++ b/app/mixins/model-alert.js @@ -13,15 +13,15 @@ export default Mixin.create({ canClone: false, relevantState: computed('combinedState', 'alertState', 'state', function() { - if ( get(this, 'state') === 'removing' ) { + if ( this.state === 'removing' ) { return 'removing'; } - return this.get('combinedState') || this.get('alertState') || 'unknown'; + return this.combinedState || this.alertState || 'unknown'; }), isAlertRule: computed('type', function() { - return (get(this, 'type') || '').endsWith('Rule'); + return (this.type || '').endsWith('Rule'); }), init() { @@ -46,8 +46,8 @@ export default Mixin.create({ }, displayTargetType: computed('targetType', function() { - const t = get(this, 'targetType'); - const intl = get(this, 'intl'); + const t = this.targetType; + const intl = this.intl; return intl.t(`alertPage.targetTypes.${ t }`); }), @@ -55,11 +55,11 @@ export default Mixin.create({ resourceKind: computed('eventRule.resourceKind', function() { const rk = get(this, 'eventRule.resourceKind'); - return get(this, 'intl').t(`alertPage.resourceKinds.${ rk }`); + return this.intl.t(`alertPage.resourceKinds.${ rk }`); }), firstRecipient: computed('recipients.length', function() { - const recipient = (get(this, 'recipients') || []).get('firstObject'); + const recipient = (this.recipients || []).get('firstObject'); if (recipient && get(recipient, 'notifierId')) { const notifierId = get(recipient, 'notifierId'); @@ -68,7 +68,7 @@ export default Mixin.create({ return null; } - const notifier = get(this, 'globalStore').all('notifier').filterBy('id', notifierId).get('firstObject'); + const notifier = this.globalStore.all('notifier').filterBy('id', notifierId).get('firstObject'); if (!notifier) { return null; @@ -82,8 +82,8 @@ export default Mixin.create({ displayRecipient: computed('firstRecipient', 'model.recipients.length', 'recipients.length', function() { const len = get(this, 'recipients.length'); - const firstRecipient = get(this, 'firstRecipient'); - const intl = get(this, 'intl'); + const firstRecipient = this.firstRecipient; + const intl = this.intl; let out = intl.t('alertPage.na'); if (len === 0) { @@ -103,7 +103,7 @@ export default Mixin.create({ if (!id) { return null; } - const node = get(this, 'globalStore').all('node').filterBy('id', id).get('firstObject'); + const node = this.globalStore.all('node').filterBy('id', id).get('firstObject'); if (!node) { return null; @@ -114,13 +114,13 @@ export default Mixin.create({ actions: { edit() { - const ps = get(this, 'pageScope'); - const id = get(this, 'id'); + const ps = this.pageScope; + const id = this.id; if (ps === 'cluster') { - get(this, 'router').transitionTo('authenticated.cluster.alert.edit', id); + this.router.transitionTo('authenticated.cluster.alert.edit', id); } else if (ps === 'project') { - get(this, 'router').transitionTo('authenticated.project.alert.edit', id); + this.router.transitionTo('authenticated.project.alert.edit', id); } }, mute() { @@ -138,8 +138,8 @@ export default Mixin.create({ }, availableActions: computed('actionLinks.{activate,deactivate,mute,unmute}', 'alertState', 'isAlertRule', function() { - const state = this.get('alertState'); - const isAlertRule = get(this, 'isAlertRule'); + const state = this.alertState; + const isAlertRule = this.isAlertRule; let out = []; if ( isAlertRule ) { diff --git a/app/mixins/notifier.js b/app/mixins/notifier.js index 7b77cff9ad..6a8a07bac0 100644 --- a/app/mixins/notifier.js +++ b/app/mixins/notifier.js @@ -7,7 +7,7 @@ export default Mixin.create({ if (!id) { return null; } - const notifiers = get(this, 'notifiers'); + const notifiers = this.notifiers; return notifiers.filterBy('id', id).get('firstObject'); }, diff --git a/app/mixins/principal-reference.js b/app/mixins/principal-reference.js index eecf2be5cc..580a65ab8d 100644 --- a/app/mixins/principal-reference.js +++ b/app/mixins/principal-reference.js @@ -4,16 +4,16 @@ import { computed, get } from '@ember/object'; export default Mixin.create({ principalIdReference: computed('groupPrincipalId.length', 'userId.length', 'userPrincipalId.length', function(){ if (get(this, 'userPrincipalId.length') > 0) { - return get(this, 'userPrincipalId'); + return this.userPrincipalId; } if (get(this, 'groupPrincipalId.length') > 0) { - return get(this, 'groupPrincipalId'); + return this.groupPrincipalId; } if (get(this, 'userId.length') > 0) { // TODO temp fix until craig switches PRTB/CRTP to use principalId. userId is only set for local users and only when the user creates a cluster. - return `local://${ get(this, 'userId') }`; + return `local://${ this.userId }`; } return ''; diff --git a/app/models/app.js b/app/models/app.js index d6458aa6fe..af2dbaa79f 100644 --- a/app/models/app.js +++ b/app/models/app.js @@ -58,7 +58,7 @@ const App = Resource.extend(StateCounts, EndpointPorts, { } if ( item['labels'] ) { - const inApp = item['labels']['io.cattle.field/appId'] === get(this, 'name'); + const inApp = item['labels']['io.cattle.field/appId'] === this.name; if ( inApp ) { return true; @@ -68,7 +68,7 @@ const App = Resource.extend(StateCounts, EndpointPorts, { const workload = get(item, 'workload'); if ( workload ) { - const found = get(this, 'workloads').filterBy('id', get(workload, 'id')); + const found = this.workloads.filterBy('id', get(workload, 'id')); return found.length > 0; } @@ -78,7 +78,7 @@ const App = Resource.extend(StateCounts, EndpointPorts, { services: computed('name', 'namespace.services.@each.labels', function() { return (get(this, 'namespace.services') || []).filter((item) => { if ( item['labels'] ) { - return item['labels']['io.cattle.field/appId'] === get(this, 'name'); + return item['labels']['io.cattle.field/appId'] === this.name; } }); }), @@ -86,7 +86,7 @@ const App = Resource.extend(StateCounts, EndpointPorts, { dnsRecords: computed('name', 'namespace.services.@each.labels', function() { return (get(this, 'namespace.services') || []).filter((item) => { if ( item['labels'] ) { - return item['labels']['io.cattle.field/appId'] === get(this, 'name'); + return item['labels']['io.cattle.field/appId'] === this.name; } }); }), @@ -94,7 +94,7 @@ const App = Resource.extend(StateCounts, EndpointPorts, { workloads: computed('name', 'namespace.workloads.@each.workloadLabels', function() { return (get(this, 'namespace.workloads') || []).filter((item) => { if ( item['workloadLabels'] ) { - return item['workloadLabels']['io.cattle.field/appId'] === get(this, 'name'); + return item['workloadLabels']['io.cattle.field/appId'] === this.name; } }); }), @@ -102,7 +102,7 @@ const App = Resource.extend(StateCounts, EndpointPorts, { secrets: computed('name', 'namespace.secrets', function() { return (get(this, 'namespace.secrets') || []).filter((item) => { if ( item['labels'] ) { - return item['labels']['io.cattle.field/appId'] === get(this, 'name'); + return item['labels']['io.cattle.field/appId'] === this.name; } }); }), @@ -110,7 +110,7 @@ const App = Resource.extend(StateCounts, EndpointPorts, { configMaps: computed('name', 'namespace.configMaps', function() { return (get(this, 'namespace.configMaps') || []).filter((item) => { if ( item['labels'] ) { - return item['labels']['io.cattle.field/appId'] === get(this, 'name'); + return item['labels']['io.cattle.field/appId'] === this.name; } }); }), @@ -118,7 +118,7 @@ const App = Resource.extend(StateCounts, EndpointPorts, { ingress: computed('name', 'namespace.ingress', function() { return (get(this, 'namespace.ingress') || []).filter((item) => { if ( item['labels'] ) { - return item['labels']['io.cattle.field/appId'] === get(this, 'name'); + return item['labels']['io.cattle.field/appId'] === this.name; } }); }), @@ -126,7 +126,7 @@ const App = Resource.extend(StateCounts, EndpointPorts, { volumes: computed('name', 'namespace.volumes', function() { return (get(this, 'namespace.volumes') || []).filter((item) => { if ( item['labels'] ) { - return item['labels']['io.cattle.field/appId'] === get(this, 'name'); + return item['labels']['io.cattle.field/appId'] === this.name; } }); }), @@ -134,13 +134,13 @@ const App = Resource.extend(StateCounts, EndpointPorts, { publicEndpoints: computed('workloads.@each.publicEndpoints', 'services.@each.proxyEndpoints', function() { let out = []; - get(this, 'workloads').forEach((workload) => { + this.workloads.forEach((workload) => { (get(workload, 'publicEndpoints') || []).forEach((endpoint) => { out.push(endpoint); }); }); - get(this, 'services').forEach((service) => { + this.services.forEach((service) => { (get(service, 'proxyEndpoints') || []).forEach((endpoint) => { out.push(endpoint); }); @@ -151,7 +151,7 @@ const App = Resource.extend(StateCounts, EndpointPorts, { displayAnswerStrings: computed('answers', function() { let out = []; - let answers = get(this, 'answers') || {}; + let answers = this.answers || {}; Object.keys(answers).forEach((key) => { out.push(key + (answers[key] ? `=${ answers[key] }` : '')); @@ -161,11 +161,11 @@ const App = Resource.extend(StateCounts, EndpointPorts, { }), externalIdInfo: computed('externalId', function() { - return parseHelmExternalId(get(this, 'externalId')); + return parseHelmExternalId(this.externalId); }), canUpgrade: computed('actionLinks.upgrade', 'catalogTemplate', function() { - let a = get(this, 'actionLinks') || {}; + let a = this.actionLinks || {}; return !!a.upgrade && !isEmpty(this.catalogTemplate); }), @@ -184,30 +184,30 @@ const App = Resource.extend(StateCounts, EndpointPorts, { label: 'action.upgrade', icon: 'icon icon-edit', action: 'upgrade', - enabled: get(this, 'canUpgrade') + enabled: this.canUpgrade }, { label: 'action.rollback', icon: 'icon icon-history', action: 'rollback', - enabled: get(this, 'canRollback') + enabled: this.canRollback }, { label: 'action.viewYaml', icon: 'icon icon-file', action: 'viewYaml', - enabled: !!get(this, 'isIstio') + enabled: !!this.isIstio }, ]; }), actions: { viewYaml(){ - get(this, 'modalService').toggleModal('modal-istio-yaml', { + this.modalService.toggleModal('modal-istio-yaml', { escToClose: true, - name: get(this, 'displayName'), + name: this.displayName, namespace: get(this, 'namespace.id'), - appId: get(this, 'name'), + appId: this.name, }); }, @@ -218,31 +218,31 @@ const App = Resource.extend(StateCounts, EndpointPorts, { const latestVersion = vKeys[vKeys.length - 1]; const currentVersion = get(this, 'externalIdInfo.version') - get(this, 'router').transitionTo('catalog-tab.launch', templateId, { + this.router.transitionTo('catalog-tab.launch', templateId, { queryParams: { - appId: get(this, 'id'), + appId: this.id, catalog: catalogId, - namespaceId: get(this, 'targetNamespace'), + namespaceId: this.targetNamespace, upgrade: latestVersion, - istio: get(this, 'isIstio'), + istio: this.isIstio, currentVersion } }); }, rollback() { - get(this, 'modalService').toggleModal('modal-rollback-app', { originalModel: this }); + this.modalService.toggleModal('modal-rollback-app', { originalModel: this }); }, clone() { const templateId = get(this, 'externalIdInfo.templateId'); const catalogId = get(this, 'externalIdInfo.catalog'); - get(this, 'router').transitionTo('catalog-tab.launch', templateId, { + this.router.transitionTo('catalog-tab.launch', templateId, { queryParams: { - appId: get(this, 'id'), + appId: this.id, catalog: catalogId, - namespaceId: get(this, 'targetNamespace'), + namespaceId: this.targetNamespace, clone: true } }); diff --git a/app/models/catalog.js b/app/models/catalog.js index 036d7a5a44..77d010cc89 100644 --- a/app/models/catalog.js +++ b/app/models/catalog.js @@ -27,11 +27,11 @@ const Catalog = Resource.extend({ }), displayKind: computed('kind', function() { - return ucFirst(get(this, 'kind')); + return ucFirst(this.kind); }), combinedState: computed('id', function() { - if ( !get(this, 'id') ) { + if ( !this.id ) { return 'disabled'; } @@ -39,7 +39,7 @@ const Catalog = Resource.extend({ }), canClone: computed('actions.clone', 'name', function() { - const name = get(this, 'name'); + const name = this.name; const catalogNames = get(C, 'CATALOG'); const builtIn = [ get(catalogNames, 'ALIBABA_APP_HUB_KEY'), @@ -54,7 +54,7 @@ const Catalog = Resource.extend({ }), availableActions: computed('actionLinks.refresh', 'id', function() { - let a = get(this, 'actionLinks') || {}; + let a = this.actionLinks || {}; return [ { @@ -82,18 +82,18 @@ const Catalog = Resource.extend({ }, edit() { - get(this, 'modalService').toggleModal('modal-edit-catalog', { + this.modalService.toggleModal('modal-edit-catalog', { model: this, - scope: get(this, 'level') + scope: this.level }); }, clone() { const clone = this.cloneForNew(); - get(this, 'modalService').toggleModal('modal-edit-catalog', { + this.modalService.toggleModal('modal-edit-catalog', { model: clone, - scope: get(this, 'level') + scope: this.level }); }, diff --git a/app/models/catalogtemplate.js b/app/models/catalogtemplate.js index 79fae2532c..01404e433a 100644 --- a/app/models/catalogtemplate.js +++ b/app/models/catalogtemplate.js @@ -10,7 +10,7 @@ export default Resource.extend({ type: 'catalogTemplate', externalId: computed('templateVersionId', 'templateId', function() { - let id = this.get('templateVersionId') || this.get('templateId'); + let id = this.templateVersionId || this.templateId; if ( id ) { return C.EXTERNAL_ID.KIND_CATALOG + C.EXTERNAL_ID.KIND_SEPARATOR + id; @@ -20,16 +20,16 @@ export default Resource.extend({ }), externalIdInfo: computed('externalId', function() { - return parseExternalId(this.get('externalId')); + return parseExternalId(this.externalId); }), // These only works if the templates have already been loaded elsewhere... catalogTemplate: computed('externalIdInfo.templateId', function() { - return this.get('catalog').getTemplateFromCache(this.get('externalIdInfo.templateId')); + return this.catalog.getTemplateFromCache(this.get('externalIdInfo.templateId')); }), icon: computed('catalogTemplate', function() { - let tpl = this.get('catalogTemplate'); + let tpl = this.catalogTemplate; if ( tpl ) { return tpl.linkFor('icon'); @@ -39,7 +39,7 @@ export default Resource.extend({ }), categories: computed('catalogTemplate.categories', function() { - let tpl = this.get('catalogTemplate'); + let tpl = this.catalogTemplate; if ( tpl ) { return tpl.get('categories') || []; diff --git a/app/models/certificate.js b/app/models/certificate.js index 227c35dd37..b40a61181a 100644 --- a/app/models/certificate.js +++ b/app/models/certificate.js @@ -12,39 +12,39 @@ export default Resource.extend({ workloads: computed('allWorkloads.list.@each.{containers,volumes}', 'name', 'namespaceId', function() { return (get(this, 'allWorkloads.list') || []).map((item) => item.obj).filter((workload) => { - if ( get(this, 'namespaceId') && get(workload, 'namespaceId') !== get(this, 'namespaceId')) { + if ( this.namespaceId && get(workload, 'namespaceId') !== this.namespaceId) { return false; } - const volume = (get(workload, 'volumes') || []).find((volume) => get(volume, 'secret.secretName') === get(this, 'name')); - const env = (get(workload, 'containers') || []).find((container) => (get(container, 'environmentFrom') || []).find((env) => get(env, 'source') === 'secret' && get(env, 'sourceName') === get(this, 'name'))); + const volume = (get(workload, 'volumes') || []).find((volume) => get(volume, 'secret.secretName') === this.name); + const env = (get(workload, 'containers') || []).find((container) => (get(container, 'environmentFrom') || []).find((env) => get(env, 'source') === 'secret' && get(env, 'sourceName') === this.name)); return volume || env; }); }), issuedDate: computed('issuedAt', function() { - return new Date(get(this, 'issuedAt')); + return new Date(this.issuedAt); }), expiresDate: computed('expiresAt', function() { - return new Date(get(this, 'expiresAt')); + return new Date(this.expiresAt); }), expiresSoon: computed('expiresDate', function() { - var diff = (get(this, 'expiresDate')).getTime() - (new Date()).getTime(); + var diff = (this.expiresDate).getTime() - (new Date()).getTime(); var days = diff / (86400 * 1000); return days <= 8; }), displayIssuer: computed('issuer', function() { - return (get(this, 'issuer') || '').split(/,/)[0].replace(/^CN=/i, ''); + return (this.issuer || '').split(/,/)[0].replace(/^CN=/i, ''); }), // All the SANs that aren't the CN displaySans: computed('cn', 'subjectAlternativeNames.[]', function() { - const sans = get(this, 'subjectAlternativeNames') || ''; - const cn = get(this, 'cn') || ''; + const sans = this.subjectAlternativeNames || ''; + const cn = this.cn || ''; if ( !sans ) { return []; @@ -56,22 +56,22 @@ export default Resource.extend({ // The useful SANs; Removes "domain.com" when the cert is for "www.domain.com" countableSans: computed('displaySans.[]', 'cn', function() { - var sans = get(this, 'displaySans').slice(); + var sans = this.displaySans.slice(); - if ( get(this, 'cn') ) { - sans.pushObject(get(this, 'cn')); + if ( this.cn ) { + sans.pushObject(this.cn); } var commonBases = sans.filter((name) => name.indexOf('*.') === 0 || name.indexOf('www.') === 0).map((name) => name.substr(name.indexOf('.'))); - return get(this, 'displaySans').slice() + return this.displaySans.slice() .removeObjects(commonBases); }), // "cn.com and 5 others" (for table view) displayDomainName: computed('cn', 'countableSans.length', function() { - const intl = get(this, 'intl'); - const cn = get(this, 'cn'); + const intl = this.intl; + const cn = this.cn; if ( !cn ) { return intl.t('generic.none'); @@ -102,8 +102,8 @@ export default Resource.extend({ // "user-provided-name (cn-if-different-than-user-name.com + 5 others)" displayDetailedName: computed('displayName', 'cn', 'countableSans.length', function() { - var name = get(this, 'displayName'); - var cn = get(this, 'cn'); + var name = this.displayName; + var cn = this.cn; var sans = get(this, 'countableSans.length'); var out = name; @@ -127,7 +127,7 @@ export default Resource.extend({ }), actions: { edit() { - get(this, 'router').transitionTo('authenticated.project.certificates.detail.edit', get(this, 'id')); + this.router.transitionTo('authenticated.project.certificates.detail.edit', this.id); }, }, diff --git a/app/models/cloudcredential.js b/app/models/cloudcredential.js index 1ad4917dd7..dcb84b3564 100644 --- a/app/models/cloudcredential.js +++ b/app/models/cloudcredential.js @@ -3,7 +3,6 @@ import { computed } from '@ember/object'; import { notEmpty } from '@ember/object/computed'; import { inject as service } from '@ember/service'; import { hasMany } from '@rancher/ember-api-store/utils/denormalize'; -import { get } from '@ember/object'; const cloudCredential = Resource.extend({ modal: service(), @@ -26,6 +25,8 @@ const cloudCredential = Resource.extend({ isVMware: notEmpty('vmwarevspherecredentialConfig'), + numberOfNodeTemplateAssociations: computed.reads('nodeTemplates.length'), + displayType: computed('amazonec2credentialConfig', 'azurecredentialConfig', 'digitaloceancredentialConfig', 'harvestercredentialConfig', 'googlecredentialConfig', 'linodecredentialConfig', 'ocicredentialConfig', 'pnapcredentialConfig', 'vmwarevspherecredentialConfig', function() { const { isAmazon, @@ -62,10 +63,6 @@ const cloudCredential = Resource.extend({ return ''; }), - numberOfNodeTemplateAssociations: computed('nodeTemplates.[]', function() { - return get(this, 'nodeTemplates').length; - }), - actions: { edit() { this.modal.toggleModal('modal-add-cloud-credential', { diff --git a/app/models/cluster.js b/app/models/cluster.js index fcc8330990..93f9e983eb 100644 --- a/app/models/cluster.js +++ b/app/models/cluster.js @@ -225,31 +225,33 @@ export default Resource.extend(Grafana, ResourceUsage, { runningClusterScans: computed.filterBy('clusterScans', 'isRunning', true), + isRKE: computed.equal('configName', 'rancherKubernetesEngineConfig'), + conditionsDidChange: on('init', observer('enableClusterMonitoring', 'conditions.@each.status', function() { - if ( !get(this, 'enableClusterMonitoring') ) { + if ( !this.enableClusterMonitoring ) { return false; } - const conditions = get(this, 'conditions') || []; + const conditions = this.conditions || []; const ready = conditions.findBy('type', 'MonitoringEnabled'); const status = ready && get(ready, 'status') === 'True'; - if ( status !== get(this, 'isMonitoringReady') ) { + if ( status !== this.isMonitoringReady ) { set(this, 'isMonitoringReady', status); } })), clusterTemplateDisplayName: computed('clusterTemplate.{displayName,name}', 'clusterTemplateId', function() { const displayName = get(this, 'clusterTemplate.displayName'); - const clusterTemplateId = (get(this, 'clusterTemplateId') || '').replace(CLUSTER_TEMPLATE_ID_PREFIX, ''); + const clusterTemplateId = (this.clusterTemplateId || '').replace(CLUSTER_TEMPLATE_ID_PREFIX, ''); return displayName || clusterTemplateId; }), clusterTemplateRevisionDisplayName: computed('clusterTemplateRevision.{displayName,name}', 'clusterTemplateRevisionId', function() { const displayName = get(this, 'clusterTemplateRevision.displayName'); - const revisionId = (get(this, 'clusterTemplateRevisionId') || '').replace(CLUSTER_TEMPLATE_ID_PREFIX, '') + const revisionId = (this.clusterTemplateRevisionId || '').replace(CLUSTER_TEMPLATE_ID_PREFIX, '') return displayName || revisionId; }), @@ -264,11 +266,11 @@ export default Resource.extend(Grafana, ResourceUsage, { }), getAltActionDelete: computed('action.remove', function() { // eslint-disable-line - return get(this, 'canBulkRemove') ? 'delete' : null; + return this.canBulkRemove ? 'delete' : null; }), hasSessionToken: computed('annotations', function() { - const sessionTokenLabel = `${ (get(this, 'annotations') || {})[C.LABEL.EKS_SESSION_TOKEN] }`; + const sessionTokenLabel = `${ (this.annotations || {})[C.LABEL.EKS_SESSION_TOKEN] }`; let hasSessionToken = false; if (sessionTokenLabel === 'undefined' || sessionTokenLabel === 'false') { @@ -324,7 +326,7 @@ export default Resource.extend(Grafana, ResourceUsage, { }), canBulkRemove: computed('action.remove', function() { // eslint-disable-line - return get(this, 'hasSessionToken') ? false : true; + return this.hasSessionToken ? false : true; }), canSaveAsTemplate: computed('actionLinks.saveAsTemplate', 'isReady', 'clusterTemplateRevisionId', 'clusterTemplateId', function() { @@ -440,7 +442,7 @@ export default Resource.extend(Grafana, ResourceUsage, { const compatibleProviders = ['custom', 'import', 'amazoneksv2', 'googlegkev2', 'azureaksv2']; // internal indicates the local cluster. Rancher does not manage the local cluster, so nodes can not be added via the UI - const internal = get(this, 'internal'); + const internal = this.internal; if (!compatibleProviders.includes(clusterProvider) || internal) { return false; @@ -477,10 +479,6 @@ export default Resource.extend(Grafana, ResourceUsage, { return this.hasCondition('Ready'); }), - isRKE: computed('configName', function() { - return get(this, 'configName') === 'rancherKubernetesEngineConfig'; - }), - isK8s21Plus: computed('version.gitVersion', function() { const version = Semver.coerce(get(this, 'version.gitVersion')); @@ -498,10 +496,10 @@ export default Resource.extend(Grafana, ResourceUsage, { }), clusterProvider: computed('configName', 'nodePools.@each.{driver,nodeTemplateId}', 'driver', function() { - const pools = get(this, 'nodePools') || []; + const pools = this.nodePools || []; const firstPool = pools.objectAt(0); - switch ( get(this, 'configName') ) { + switch ( this.configName ) { case 'amazonElasticContainerServiceConfig': return 'amazoneks'; case 'eksConfig': @@ -531,8 +529,8 @@ export default Resource.extend(Grafana, ResourceUsage, { return firstPool.driver || get(firstPool, 'nodeTemplate.driver') || null; default: - if (get(this, 'driver') && get(this, 'configName') && !isEmpty(get(this, this.configName))) { - return get(this, 'driver'); + if (this.driver && this.configName && !isEmpty(get(this, this.configName))) { + return this.driver; } else { return 'import'; } @@ -540,11 +538,11 @@ export default Resource.extend(Grafana, ResourceUsage, { }), displayProvider: computed('configName', 'driver', 'intl.locale', 'nodePools.@each.displayProvider', 'provider', function() { - const intl = get(this, 'intl'); - const pools = get(this, 'nodePools'); + const intl = this.intl; + const pools = this.nodePools; const firstPool = (pools || []).objectAt(0); - const configName = get(this, 'configName'); - const driverName = get(this, 'driver'); + const configName = this.configName; + const driverName = this.driver; switch ( configName ) { case 'amazonElasticContainerServiceConfig': @@ -606,13 +604,13 @@ export default Resource.extend(Grafana, ResourceUsage, { }), systemProject: computed('projects.@each.isSystemProject', function() { - let projects = (get(this, 'projects') || []).filterBy('isSystemProject', true); + let projects = (this.projects || []).filterBy('isSystemProject', true); return get(projects, 'firstObject'); }), canSaveMonitor: computed('actionLinks.{editMonitoring,enableMonitoring}', 'enableClusterMonitoring', function() { - const action = get(this, 'enableClusterMonitoring') ? 'editMonitoring' : 'enableMonitoring'; + const action = this.enableClusterMonitoring ? 'editMonitoring' : 'enableMonitoring'; return !!this.hasAction(action) }), @@ -622,7 +620,7 @@ export default Resource.extend(Grafana, ResourceUsage, { }), defaultProject: computed('projects.@each.{name,clusterOwner}', function() { - let projects = get(this, 'projects') || []; + let projects = this.projects || []; let out = projects.findBy('isDefault'); @@ -707,7 +705,7 @@ export default Resource.extend(Grafana, ResourceUsage, { }), availableActions: computed('actionLinks.{rotateCertificates,rotateEncryptionKey}', 'canRotateEncryptionKey', 'canSaveAsTemplate', 'canShowAddHost', 'displayImportLabel', 'isClusterScanDisabled', function() { - const a = get(this, 'actionLinks') || {}; + const a = this.actionLinks || {}; return [ { @@ -763,22 +761,22 @@ export default Resource.extend(Grafana, ResourceUsage, { }), isWindows: computed('windowsPreferedCluster', function() { - return !!get(this, 'windowsPreferedCluster'); + return !!this.windowsPreferedCluster; }), isClusterScanDown: computed('systemProject', 'state', 'actionLinks.runSecurityScan', 'isWindows', function() { - return !get(this, 'systemProject') - || get(this, 'state') !== 'active' + return !this.systemProject + || this.state !== 'active' || !get(this, 'actionLinks.runSecurityScan') - || get(this, 'isWindows'); + || this.isWindows; }), isAddClusterScanScheduleDisabled: computed('isClusterScanDown', 'scheduledClusterScan.enabled', 'clusterTemplateRevision', 'clusterTemplateRevision.questions.[]', function() { - if (get(this, 'clusterTemplateRevision') === null) { - return get(this, 'isClusterScanDown'); + if (this.clusterTemplateRevision === null) { + return this.isClusterScanDown; } - if (get(this, 'isClusterScanDown')) { + if (this.isClusterScanDown) { return true; } @@ -792,11 +790,11 @@ export default Resource.extend(Grafana, ResourceUsage, { isClusterScanDisabled: computed('runningClusterScans.length', 'isClusterScanDown', function() { return (get(this, 'runningClusterScans.length') > 0) - || get(this, 'isClusterScanDown'); + || this.isClusterScanDown; }), unhealthyComponents: computed('componentStatuses.@each.conditions', function() { - return (get(this, 'componentStatuses') || []) + return (this.componentStatuses || []) .filter((s) => !(s.conditions || []).any((c) => c.status === 'True')); }), @@ -805,13 +803,13 @@ export default Resource.extend(Grafana, ResourceUsage, { }), inactiveNodes: computed('nodes.@each.state', function() { - return (get(this, 'nodes') || []).filter( (n) => C.ACTIVEISH_STATES.indexOf(get(n, 'state')) === -1 ); + return (this.nodes || []).filter( (n) => C.ACTIVEISH_STATES.indexOf(get(n, 'state')) === -1 ); }), unhealthyNodes: computed('nodes.@each.conditions', function() { const out = []; - (get(this, 'nodes') || []).forEach((n) => { + (this.nodes || []).forEach((n) => { const conditions = get(n, 'conditions') || []; const outOfDisk = conditions.find((c) => c.type === 'OutOfDisk'); const diskPressure = conditions.find((c) => c.type === 'DiskPressure'); @@ -843,12 +841,12 @@ export default Resource.extend(Grafana, ResourceUsage, { }), displayWarnings: computed('unhealthyNodes.[]', 'clusterProvider', 'inactiveNodes.[]', 'unhealthyComponents.[]', function() { - const intl = get(this, 'intl'); + const intl = this.intl; const out = []; - const unhealthyComponents = get(this, 'unhealthyComponents') || []; - const inactiveNodes = get(this, 'inactiveNodes') || []; - const unhealthyNodes = get(this, 'unhealthyNodes') || []; - const clusterProvider = get(this, 'clusterProvider'); + const unhealthyComponents = this.unhealthyComponents || []; + const inactiveNodes = this.inactiveNodes || []; + const unhealthyNodes = this.unhealthyNodes || []; + const clusterProvider = this.clusterProvider; const grayOut = C.GRAY_OUT_SCHEDULER_STATUS_PROVIDERS.indexOf(clusterProvider) > -1; @@ -897,20 +895,20 @@ export default Resource.extend(Grafana, ResourceUsage, { }, restoreFromEtcdBackup(options) { - get(this, 'modalService').toggleModal('modal-restore-backup', { + this.modalService.toggleModal('modal-restore-backup', { cluster: this, selection: (options || {}).selection }); }, promptDelete() { - const hasSessionToken = get(this, 'canBulkRemove') ? false : true; // canBulkRemove returns true of the session token is set false + const hasSessionToken = this.canBulkRemove ? false : true; // canBulkRemove returns true of the session token is set false if (hasSessionToken) { - set(this, `${ get(this, 'configName') }.accessKey`, null); - get(this, 'modalService').toggleModal('modal-delete-eks-cluster', { model: this, }); + set(this, `${ this.configName }.accessKey`, null); + this.modalService.toggleModal('modal-delete-eks-cluster', { model: this, }); } else { - get(this, 'modalService').toggleModal('confirm-delete', { + this.modalService.toggleModal('confirm-delete', { escToClose: true, resources: [this] }); @@ -918,7 +916,7 @@ export default Resource.extend(Grafana, ResourceUsage, { }, edit(additionalQueryParams = {}) { - let provider = get(this, 'clusterProvider') || get(this, 'driver'); + let provider = this.clusterProvider || this.driver; let queryParams = { queryParams: { provider, @@ -927,21 +925,21 @@ export default Resource.extend(Grafana, ResourceUsage, { }; if (provider === 'import' && - isEmpty(get(this, 'eksConfig')) && - isEmpty(get(this, 'gkeConfig')) && - isEmpty(get(this, 'aksConfig'))) { + isEmpty(this.eksConfig) && + isEmpty(this.gkeConfig) && + isEmpty(this.aksConfig)) { set(queryParams, 'queryParams.importProvider', 'other'); } - if (provider === 'amazoneks' && !isEmpty(get(this, 'eksConfig'))) { + if (provider === 'amazoneks' && !isEmpty(this.eksConfig)) { set(queryParams, 'queryParams.provider', 'amazoneksv2'); } - if (provider === 'gke' && !isEmpty(get(this, 'gkeConfig'))) { + if (provider === 'gke' && !isEmpty(this.gkeConfig)) { set(queryParams, 'queryParams.provider', 'googlegkev2'); } - if (provider === 'aks' && !isEmpty(get(this, 'aksConfig'))) { + if (provider === 'aks' && !isEmpty(this.aksConfig)) { set(queryParams, 'queryParams.provider', 'azureaksv2'); } @@ -949,11 +947,11 @@ export default Resource.extend(Grafana, ResourceUsage, { set(queryParams, 'queryParams.clusterTemplateRevision', this.clusterTemplateRevisionId); } - this.router.transitionTo('authenticated.cluster.edit', get(this, 'id'), queryParams); + this.router.transitionTo('authenticated.cluster.edit', this.id, queryParams); }, scaleDownPool(id) { - const pool = (get(this, 'nodePools') || []).findBy('id', id); + const pool = (this.nodePools || []).findBy('id', id); if ( pool ) { pool.incrementQuantity(-1); @@ -961,7 +959,7 @@ export default Resource.extend(Grafana, ResourceUsage, { }, scaleUpPool(id) { - const pool = (get(this, 'nodePools') || []).findBy('id', id); + const pool = (this.nodePools || []).findBy('id', id); if ( pool ) { pool.incrementQuantity(1); @@ -973,7 +971,7 @@ export default Resource.extend(Grafana, ResourceUsage, { }, runCISScan(options) { - this.get('modalService').toggleModal('run-scan-modal', { + this.modalService.toggleModal('run-scan-modal', { closeWithOutsideClick: true, cluster: this, onRun: (options || {}).onRun @@ -983,16 +981,16 @@ export default Resource.extend(Grafana, ResourceUsage, { rotateCertificates() { const model = this; - get(this, 'modalService').toggleModal('modal-rotate-certificates', { + this.modalService.toggleModal('modal-rotate-certificates', { model, - serviceDefaults: get(this, 'globalStore').getById('schema', 'rotatecertificateinput').optionsFor('services'), + serviceDefaults: this.globalStore.getById('schema', 'rotatecertificateinput').optionsFor('services'), }); }, rotateEncryptionKey() { const model = this; - get(this, 'modalService').toggleModal('modal-rotate-encryption-key', { model, }); + this.modalService.toggleModal('modal-rotate-encryption-key', { model, }); }, showCommandModal() { @@ -1039,15 +1037,15 @@ export default Resource.extend(Grafana, ResourceUsage, { const promise = this._super.apply(this, arguments); return promise.then((/* resp */) => { - if (get(this, 'scope.currentCluster.id') === get(this, 'id')) { - get(this, 'router').transitionTo('global-admin.clusters'); + if (get(this, 'scope.currentCluster.id') === this.id) { + this.router.transitionTo('global-admin.clusters'); } }); }, getOrCreateToken() { - const globalStore = get(this, 'globalStore'); - const id = get(this, 'id'); + const globalStore = this.globalStore; + const id = this.id; return globalStore.findAll('clusterRegistrationToken', { forceReload: true }).then((tokens) => { let token = tokens.filterBy('clusterId', id)[0]; @@ -1055,7 +1053,7 @@ export default Resource.extend(Grafana, ResourceUsage, { if ( token ) { return resolve(token); } else { - token = get(this, 'globalStore').createRecord({ + token = this.globalStore.createRecord({ type: 'clusterRegistrationToken', clusterId: id }); @@ -1102,7 +1100,7 @@ export default Resource.extend(Grafana, ResourceUsage, { } = this; let options = null; - if (get(this, 'driver') === 'EKS' || (this.isObject(eksConfig) && !this.isEmptyObject(eksConfig))) { + if (this.driver === 'EKS' || (this.isObject(eksConfig) && !this.isEmptyObject(eksConfig))) { options = this.syncEksConfigs(opt); } else if (this.isObject(gkeConfig) && !this.isEmptyObject(gkeConfig)) { options = this.syncGkeConfigs(opt); @@ -1283,7 +1281,7 @@ export default Resource.extend(Grafana, ResourceUsage, { return; } else { - const config = jsondiffpatch.clone(get(this, 'eksConfig')); + const config = jsondiffpatch.clone(this.eksConfig); const upstreamSpec = jsondiffpatch.clone(get(this, 'eksStatus.upstreamSpec')); if (isEmpty(upstreamSpec)) { diff --git a/app/models/clusteralertrule.js b/app/models/clusteralertrule.js index b1ab061c50..9be8376043 100644 --- a/app/models/clusteralertrule.js +++ b/app/models/clusteralertrule.js @@ -38,18 +38,18 @@ const clusterAlertRule = Resource.extend(Alert, { }), displayTargetType: computed('targetType', function() { - return get(this, 'intl').t(`alertPage.targetTypes.${ get(this, 'targetType') }`); + return this.intl.t(`alertPage.targetTypes.${ this.targetType }`); }), displayCondition: computed('clusterScanRule', 'metricRule.{comparison,expression,thresholdValue}', 'nodeRule.{condition,cpuThreshold,memThreshold}', 'targetType', function() { - const t = get(this, 'targetType'); - const intl = get(this, 'intl'); + const t = this.targetType; + const intl = this.intl; let out = intl.t('alertPage.na'); const c = get(this, 'nodeRule.condition') const cpuThreshold = get(this, 'nodeRule.cpuThreshold'); const memThreshold = get(this, 'nodeRule.memThreshold'); - const metricRule = get(this, 'metricRule'); - const clusterScanRule = get(this, 'clusterScanRule'); + const metricRule = this.metricRule; + const clusterScanRule = this.clusterScanRule; switch (t) { case 'systemService': @@ -86,7 +86,7 @@ const clusterAlertRule = Resource.extend(Alert, { }), threshold: computed('targetType', 'nodeRule.{memThreshold,cpuThreshold,condition}', function() { - const t = get(this, 'targetType'); + const t = this.targetType; const c = get(this, 'nodeRule.condition'); if (t === 'node' || t === 'nodeSelector') { @@ -103,10 +103,10 @@ const clusterAlertRule = Resource.extend(Alert, { actions: { clone() { - get(this, 'router').transitionTo('authenticated.cluster.alert.new-rule', get(this, 'groupId'), { queryParams: { id: get(this, 'id'), } }); + this.router.transitionTo('authenticated.cluster.alert.new-rule', this.groupId, { queryParams: { id: this.id, } }); }, edit() { - get(this, 'router').transitionTo('authenticated.cluster.alert.edit-rule', get(this, 'groupId'), get(this, 'id')); + this.router.transitionTo('authenticated.cluster.alert.edit-rule', this.groupId, this.id); }, }, diff --git a/app/models/clusterroletemplatebinding.js b/app/models/clusterroletemplatebinding.js index 120c2eb420..c35cbb31f9 100644 --- a/app/models/clusterroletemplatebinding.js +++ b/app/models/clusterroletemplatebinding.js @@ -13,15 +13,15 @@ export default Resource.extend(PrincipalReference, { roleTemplate: reference('roleTemplateId'), user: reference('userId', 'user'), isCustom: computed('roleTemplateId', function() { - return !C.BASIC_ROLE_TEMPLATE_ROLES.includes(get(this, 'roleTemplateId')); + return !C.BASIC_ROLE_TEMPLATE_ROLES.includes(this.roleTemplateId); }), principalId: computed('userPrincipalId', 'groupPrincipalId', function() { - return get(this, 'groupPrincipalId') || get(this, 'userPrincipalId') || null; + return this.groupPrincipalId || this.userPrincipalId || null; }), canRemove: computed('links.remove', 'name', function() { - return !!get(this, 'links.remove') && get(this, 'name') !== 'creator'; + return !!get(this, 'links.remove') && this.name !== 'creator'; }), }); diff --git a/app/models/clusterscan.js b/app/models/clusterscan.js index 959f750f4a..99ff01c280 100644 --- a/app/models/clusterscan.js +++ b/app/models/clusterscan.js @@ -1,3 +1,4 @@ +import { alias, equal } from '@ember/object/computed'; import Resource from '@rancher/ember-api-store/models/resource'; import { computed, get, set, observer } from '@ember/object'; import moment from 'moment'; @@ -13,13 +14,13 @@ const ClusterScan = Resource.extend({ type: 'clusterScan', report: 'null', reportPromise: null, - total: computed.alias('summary.total'), - passed: computed.alias('summary.passed'), - skipped: computed.alias('summary.skipped'), - failed: computed.alias('summary.failed'), - notApplicable: computed.alias('summary.notApplicable'), + total: alias('summary.total'), + passed: alias('summary.passed'), + skipped: alias('summary.skipped'), + failed: alias('summary.failed'), + notApplicable: alias('summary.notApplicable'), - isRunning: computed.equal('state', 'running'), + isRunning: equal('state', 'running'), loader: observer('store', 'state', function() { this.loadReport(); @@ -27,13 +28,13 @@ const ClusterScan = Resource.extend({ file: computed('name', 'report', 'resultsForCsv', function(){ return { - name: `${ get(this, 'name') }.csv`, - file: get(this, 'resultsForCsv') + name: `${ this.name }.csv`, + file: this.resultsForCsv }; }), csvFile: computed('file', async function() { - const file = get(this, 'file'); + const file = this.file; return { ...file, @@ -61,10 +62,10 @@ const ClusterScan = Resource.extend({ }), resultsForCsv: computed('profile', 'referencedResults', 'report', function() { - return get(this, 'referencedResults').map((result) => { - const intl = get(this, 'intl'); + return this.referencedResults.map((result) => { + const intl = this.intl; const nodesAndStateForTest = this.getNodesAndStateForTestResult(result); - const profile = intl.t('cis.scan.report.headers.profile', { profile: get(this, 'profile') }); + const profile = intl.t('cis.scan.report.headers.profile', { profile: this.profile }); return { [profile]: '', @@ -74,12 +75,12 @@ const ClusterScan = Resource.extend({ [intl.t('cis.scan.report.headers.failed_nodes')]: nodesAndStateForTest.failedNodes.join(','), [intl.t('cis.scan.report.headers.node_type')]: result.node_type.join(',') }; - }) + }); }), summary: computed('state', 'report', function() { - const state = get(this, 'state'); - const report = get(this, 'report'); + const state = this.state; + const report = this.report; if (state === 'activating' || !report) { return {}; @@ -117,7 +118,7 @@ const ClusterScan = Resource.extend({ actions: { async download() { - const file = await get(this, 'csvFile'); + const file = await this.csvFile; downloadFile(file.name, file.file, 'text/plain'); }, @@ -192,7 +193,7 @@ const ClusterScan = Resource.extend({ }, async loadReport() { - const reportPromise = get(this, 'reportPromise'); + const reportPromise = this.reportPromise; if (reportPromise) { return reportPromise; diff --git a/app/models/clustertemplate.js b/app/models/clustertemplate.js index a0424dba66..b9623736e9 100644 --- a/app/models/clustertemplate.js +++ b/app/models/clustertemplate.js @@ -31,7 +31,7 @@ const ClusterTemplate = Resource.extend({ }), latestRevision: computed('revisions.[]', 'revisions.@each.enabled', function() { - const revisions = (get(this, 'revisions') || []).filter((revision) => revision.enabled); + const revisions = (this.revisions || []).filter((revision) => revision.enabled); return get(revisions, 'length') === 0 ? null @@ -39,7 +39,7 @@ const ClusterTemplate = Resource.extend({ }), displayDefaultRevisionId: computed('defaultRevisionId', 'revisions.[]', 'revisionsCount', function() { - return get(this, 'defaultRevisionId').split(':')[1]; + return this.defaultRevisionId.split(':')[1]; }), canEdit: computed('links.update', function() { diff --git a/app/models/clustertemplaterevision.js b/app/models/clustertemplaterevision.js index 47c0aca84a..845fd49e34 100644 --- a/app/models/clustertemplaterevision.js +++ b/app/models/clustertemplaterevision.js @@ -16,7 +16,7 @@ export default Resource.extend({ canRemove: alias('canMakeDefault'), combinedState: computed('enabled', function() { - if ( get(this, 'enabled') ) { + if ( this.enabled ) { return 'active'; } @@ -34,7 +34,7 @@ export default Resource.extend({ }), availableActions: computed('actionLinks.[]', 'canMakeDefault', 'clusterTemplate.defaultRevisionId', 'enabled', function() { - const a = get(this, 'actionLinks') || {}; + const a = this.actionLinks || {}; return [ { @@ -112,7 +112,7 @@ export default Resource.extend({ validationErrors() { let errors = []; - if (!get(this, 'name')) { + if (!this.name) { errors.push('Revision name is required'); } diff --git a/app/models/configmap.js b/app/models/configmap.js index 94fb5380b4..03b7e2d0e6 100644 --- a/app/models/configmap.js +++ b/app/models/configmap.js @@ -18,8 +18,8 @@ export default Resource.extend({ workloads: computed('name', 'namespace.workloads.@each.{containers,volumes}', function() { return (get(this, 'namespace.workloads') || []).filter((workload) => { - const volume = (get(workload, 'volumes') || []).find((volume) => get(volume, 'configMap.name') === get(this, 'name')); - const env = (get(workload, 'containers') || []).find((container) => (get(container, 'environmentFrom') || []).find((env) => get(env, 'source') === 'configMap' && get(env, 'sourceName') === get(this, 'name'))); + const volume = (get(workload, 'volumes') || []).find((volume) => get(volume, 'configMap.name') === this.name); + const env = (get(workload, 'containers') || []).find((container) => (get(container, 'environmentFrom') || []).find((env) => get(env, 'source') === 'configMap' && get(env, 'sourceName') === this.name)); return volume || env; }); @@ -52,11 +52,11 @@ export default Resource.extend({ actions: { edit() { - get(this, 'router').transitionTo('authenticated.project.config-maps.detail.edit', get(this, 'id')); + this.router.transitionTo('authenticated.project.config-maps.detail.edit', this.id); }, clone() { - get(this, 'router').transitionTo('authenticated.project.config-maps.new', get(this, 'projectId'), { queryParams: { id: get(this, 'id') } }); + this.router.transitionTo('authenticated.project.config-maps.new', this.projectId, { queryParams: { id: this.id } }); } }, diff --git a/app/models/container.js b/app/models/container.js index 4b38e85b88..64411137b7 100644 --- a/app/models/container.js +++ b/app/models/container.js @@ -30,11 +30,11 @@ var Container = Resource.extend(Grafana, DisplayImage, { }), canShell: computed('state', function() { - return C.CAN_SHELL_STATES.indexOf(get(this, 'state')) > -1 + return C.CAN_SHELL_STATES.indexOf(this.state) > -1; }), availableActions: computed('canShell', function() { - const canShell = get(this, 'canShell'); + const canShell = this.canShell; var choices = [ { @@ -57,7 +57,7 @@ var Container = Resource.extend(Grafana, DisplayImage, { }), restarts: computed('name', 'pod.status.containerStatuses.@each.restartCount', function() { - const state = (get(this, 'pod.status.containerStatuses') || []).findBy('name', get(this, 'name')); + const state = (get(this, 'pod.status.containerStatuses') || []).findBy('name', this.name); if ( state ) { return get(state, 'restartCount'); @@ -81,7 +81,7 @@ var Container = Resource.extend(Grafana, DisplayImage, { return []; } - const intl = get(this, 'intl'); + const intl = this.intl; const errors = []; const { @@ -106,16 +106,16 @@ var Container = Resource.extend(Grafana, DisplayImage, { actions: { shell() { - get(this, 'modalService').toggleModal('modal-shell', { - model: get(this, 'pod'), - containerName: get(this, 'name') + this.modalService.toggleModal('modal-shell', { + model: this.pod, + containerName: this.name }); }, popoutShell() { const projectId = get(this, 'scope.currentProject.id'); const podId = get(this, 'pod.id'); - const route = get(this, 'router').urlFor('authenticated.project.console', projectId); + const route = this.router.urlFor('authenticated.project.console', projectId); const system = get(this, 'pod.node.info.os.operatingSystem') || '' let windows = false; @@ -125,24 +125,24 @@ var Container = Resource.extend(Grafana, DisplayImage, { } later(() => { - window.open(`//${ window.location.host }${ route }?podId=${ podId }&windows=${ windows }&containerName=${ get(this, 'name') }&isPopup=true`, '_blank', 'toolbars=0,width=900,height=700,left=200,top=200'); + window.open(`//${ window.location.host }${ route }?podId=${ podId }&windows=${ windows }&containerName=${ this.name }&isPopup=true`, '_blank', 'toolbars=0,width=900,height=700,left=200,top=200'); }); }, logs() { - get(this, 'modalService').toggleModal('modal-container-logs', { - model: get(this, 'pod'), - containerName: get(this, 'name') + this.modalService.toggleModal('modal-container-logs', { + model: this.pod, + containerName: this.name }); }, popoutLogs() { const projectId = get(this, 'scope.currentProject.id'); const podId = get(this, 'pod.id'); - const route = get(this, 'router').urlFor('authenticated.project.container-log', projectId); + const route = this.router.urlFor('authenticated.project.container-log', projectId); later(() => { - window.open(`//${ window.location.host }${ route }?podId=${ podId }&containerName=${ get(this, 'name') }&isPopup=true`, '_blank', 'toolbars=0,width=900,height=700,left=200,top=200'); + window.open(`//${ window.location.host }${ route }?podId=${ podId }&containerName=${ this.name }&isPopup=true`, '_blank', 'toolbars=0,width=900,height=700,left=200,top=200'); }); }, }, diff --git a/app/models/credential.js b/app/models/credential.js index 5990a8a607..a5c83e6c34 100644 --- a/app/models/credential.js +++ b/app/models/credential.js @@ -1,6 +1,5 @@ import Resource from '@rancher/ember-api-store/models/resource'; import { inject as service } from '@ember/service'; -import { get } from '@ember/object'; export default Resource.extend({ router: service(), @@ -9,7 +8,7 @@ export default Resource.extend({ actions: { clone() { - get(this, 'router').transitionTo('authenticated.project.registries.new', null, { queryParams: { id: get(this, 'id') } } ); + this.router.transitionTo('authenticated.project.registries.new', null, { queryParams: { id: this.id } } ); } } }); diff --git a/app/models/cronjob.js b/app/models/cronjob.js index 55455bf717..61e3680868 100644 --- a/app/models/cronjob.js +++ b/app/models/cronjob.js @@ -3,7 +3,7 @@ import { get, set, computed } from '@ember/object'; const CronJob = Workload.extend({ combinedState: computed('state', 'cronJobConfig.suspend', function() { - var service = get(this, 'state'); + var service = this.state; if (service === 'active' && get(this, 'cronJobConfig.suspend')) { return 'suspended'; @@ -14,7 +14,7 @@ const CronJob = Workload.extend({ availableActions: computed('actionLinks.{activate,deactivate,garbagecollect,pause,restart,rollback}', 'canEdit', 'cronJobConfig.suspend', 'isPaused', 'links.{remove,update}', 'podForShell', function() { const actions = this._super(); - const canEdit = get(this, 'canEdit'); + const canEdit = this.canEdit; const suspend = get(this, 'cronJobConfig.suspend'); actions.pushObjects([ diff --git a/app/models/deployment.js b/app/models/deployment.js index 88f5bf1470..29bbb635e6 100644 --- a/app/models/deployment.js +++ b/app/models/deployment.js @@ -1,11 +1,11 @@ import Workload from 'ui/models/workload'; -import { get, computed } from '@ember/object'; +import { computed } from '@ember/object'; const Deployment = Workload.extend({ combinedState: computed('state', 'isPaused', function() { - var service = get(this, 'state'); + var service = this.state; - if (service === 'active' && get(this, 'isPaused')) { + if (service === 'active' && this.isPaused) { return 'paused'; } @@ -13,7 +13,7 @@ const Deployment = Workload.extend({ }), isPaused: computed('paused', function() { - return !!get(this, 'paused'); + return !!this.paused; }), }); diff --git a/app/models/dockercredential.js b/app/models/dockercredential.js index dc6ade441e..5729ff1100 100644 --- a/app/models/dockercredential.js +++ b/app/models/dockercredential.js @@ -25,7 +25,7 @@ var DockerCredential = Resource.extend({ registryCount: alias('asArray.length'), asArray: computed('registries', function() { - const all = get(this, 'registries') || {}; + const all = this.registries || {}; let reg, address, preset; @@ -45,13 +45,13 @@ var DockerCredential = Resource.extend({ }), searchAddresses: computed('asArray.@each.address', function() { - return get(this, 'asArray').map((x) => get(x, 'address')) + return this.asArray.map((x) => get(x, 'address')) .sort() .uniq(); }), searchUsernames: computed('asArray.@each.username', function() { - return get(this, 'asArray').map((x) => get(x, 'username')) + return this.asArray.map((x) => get(x, 'username')) .sort() .uniq(); }), @@ -59,22 +59,22 @@ var DockerCredential = Resource.extend({ displayAddress: computed('intl.locale', 'registryCount', 'firstRegistry.address', function() { const address = get(this, 'firstRegistry.address'); - if ( get(this, 'registryCount') > 1 ) { + if ( this.registryCount > 1 ) { return 'cruRegistry.multiple'; } else if (address === window.location.host) { return address; } else if ( PRESETS[address] ) { - return get(this, 'intl').t(`cruRegistry.address.${ PRESETS[address] }`); + return this.intl.t(`cruRegistry.address.${ PRESETS[address] }`); } else { return address; } }), displayUsername: computed('registryCount', 'firstRegistry.username', function() { - const intl = get(this, 'intl'); + const intl = this.intl; const username = get(this, 'firstRegistry.username'); - if ( get(this, 'registryCount') > 1 ) { + if ( this.registryCount > 1 ) { return intl.t('cruRegistry.multiple'); } else { return username; @@ -82,10 +82,10 @@ var DockerCredential = Resource.extend({ }), actions: { clone() { - get(this, 'router').transitionTo('authenticated.project.registries.new', { + this.router.transitionTo('authenticated.project.registries.new', { queryParams: { - id: get(this, 'id'), - type: get(this, 'type') + id: this.id, + type: this.type } }); } diff --git a/app/models/globaldns.js b/app/models/globaldns.js index a5d9bb3c22..db74248321 100644 --- a/app/models/globaldns.js +++ b/app/models/globaldns.js @@ -17,8 +17,8 @@ export default Resource.extend({ data: null, }; - const multiClusterAppId = get(this, 'multiClusterAppId'); - const projectIds = get(this, 'projectIds'); + const multiClusterAppId = this.multiClusterAppId; + const projectIds = this.projectIds; if (multiClusterAppId && !projectIds) { setProperties(out, { @@ -38,7 +38,7 @@ export default Resource.extend({ linkedProjects: computed('projectIds.[]', 'scope.allProjects.@each.id', function() { const allProjects = get(this, 'scope.allProjects') || []; - const projectIds = get(this, 'projectIds') || []; + const projectIds = this.projectIds || []; const myProjects = []; diff --git a/app/models/globaldnsprovider.js b/app/models/globaldnsprovider.js index fa94a89f43..d86e3b7a73 100644 --- a/app/models/globaldnsprovider.js +++ b/app/models/globaldnsprovider.js @@ -16,21 +16,21 @@ export default Resource.extend({ init() { this._super(...arguments); - if (get(this, 'route53ProviderConfig')) { + if (this.route53ProviderConfig) { setProperties(this, { config: alias('route53ProviderConfig'), provider: 'route53' }); } - if (get(this, 'cloudflareProviderConfig')) { + if (this.cloudflareProviderConfig) { setProperties(this, { config: alias('cloudflareProviderConfig'), provider: 'cloudflare' }); } - if (get(this, 'alidnsProviderConfig')) { + if (this.alidnsProviderConfig) { setProperties(this, { config: alias('alidnsProviderConfig'), provider: 'alidns' diff --git a/app/models/globalrole.js b/app/models/globalrole.js index 93c5a01a25..a46fae8aae 100644 --- a/app/models/globalrole.js +++ b/app/models/globalrole.js @@ -1,5 +1,6 @@ +import { not } from '@ember/object/computed'; import Resource from '@rancher/ember-api-store/models/resource'; -import { get, computed } from '@ember/object'; +import { computed } from '@ember/object'; import { inject as service } from '@ember/service'; import { hasMany } from '@rancher/ember-api-store/utils/denormalize'; @@ -20,46 +21,46 @@ export default Resource.extend({ // because of this the state shows as "Unknown" with bright yellow background stateColor: 'text-success', - canRemove: computed.not('builtin'), + canRemove: not('builtin'), canClone: computed('access.me', 'id', function() { return this.access.allows('globalrole', 'create', 'global'); }), isHidden: computed('id', function() { - return SPECIAL.includes(get(this, 'id')); + return SPECIAL.includes(this.id); }), isBase: computed('id', function() { - return get(this, 'id') === BASE; + return this.id === BASE; }), isUser: computed('id', function() { - return get(this, 'id') === USER; + return this.id === USER; }), isAdmin: computed('id', function() { - return get(this, 'id') === ADMIN; + return this.id === ADMIN; }), isCustom: computed('isAdmin', 'isUser', 'isBase', function() { - return !get(this, 'isAdmin') && !get(this, 'isBase') && !get(this, 'isUser'); + return !this.isAdmin && !this.isBase && !this.isUser; }), globalRoleAssociatedUserCount: computed('globalRoleBindings.@each.{id,state,newUserDefault}', function() { - return ( get(this, 'globalRoleBindings') || [] ).length; + return ( this.globalRoleBindings || [] ).length; }), displayName: computed('id', 'name', 'intl.locale', function() { - const intl = get(this, 'intl'); - const id = get(this, 'id'); + const intl = this.intl; + const id = this.id; const key = `formGlobalRoles.role.${ id }.label`; if ( intl.exists(key) ){ return intl.t(key); } - const name = get(this, 'name'); + const name = this.name; if ( name ) { return name; @@ -69,8 +70,8 @@ export default Resource.extend({ }), detail: computed('id', 'intl.locale', 'name', function() { - const intl = get(this, 'intl'); - const id = get(this, 'id'); + const intl = this.intl; + const id = this.id; const key = `formGlobalRoles.role.${ id }.detail`; if ( intl.exists(key) ){ @@ -84,7 +85,7 @@ export default Resource.extend({ // globalRoles can not be removed or changed as of now and do not have a state actions: { edit() { - this.get('router').transitionTo('global-admin.security.roles.edit', this.get('id'), { queryParams: { type: 'global' } }); + this.router.transitionTo('global-admin.security.roles.edit', this.id, { queryParams: { type: 'global' } }); }, clone() { diff --git a/app/models/googlekubernetesengineconfig.js b/app/models/googlekubernetesengineconfig.js index b46265b624..dcc29bcdc5 100644 --- a/app/models/googlekubernetesengineconfig.js +++ b/app/models/googlekubernetesengineconfig.js @@ -8,9 +8,9 @@ export default Resource.extend({ validationErrors() { let errors = []; - if (!this.get('credential')) { + if (!this.credential) { errors.push('"Service Account" is required'); - } else if (!this.get('projectId')){ + } else if (!this.projectId){ errors.push('"Google Project ID" is required'); } if (errors.length > 0) { diff --git a/app/models/horizontalpodautoscaler.js b/app/models/horizontalpodautoscaler.js index d091e3738a..4b47a607ca 100644 --- a/app/models/horizontalpodautoscaler.js +++ b/app/models/horizontalpodautoscaler.js @@ -16,11 +16,11 @@ export default Resource.extend({ namespace: reference('namespaceId', 'namespace', 'clusterStore'), currentMetrics: computed('metrics.@each.current', function() { - return (get(this, 'metrics') || []).map((metric) => get(metric, 'current')); + return (this.metrics || []).map((metric) => get(metric, 'current')); }), displayMetrics: computed('currentMetrics.@each.{averageValue,utilization,value}', 'metrics', function() { - return (get(this, 'metrics') || []) + return (this.metrics || []) .map((metric) => { const arr = []; const averageValue = get(metric, 'current.averageValue'); @@ -55,11 +55,11 @@ export default Resource.extend({ }), displayMetricsString: computed('displayMetrics', function() { - return (get(this, 'displayMetrics') || []).join(', '); + return (this.displayMetrics || []).join(', '); }), hpaName: computed('id', function() { - const items = get(this, 'id').split(':'); + const items = this.id.split(':'); if ( get(items, 'length') > 1 ) { return items[1]; @@ -70,11 +70,11 @@ export default Resource.extend({ actions: { edit() { - get(this, 'router').transitionTo('authenticated.project.hpa.detail.edit', this.get('id')); + this.router.transitionTo('authenticated.project.hpa.detail.edit', this.id); }, clone() { - get(this, 'router').transitionTo('authenticated.project.hpa.new', this.get('projectId'), { queryParams: { id: this.get('id') } }); + this.router.transitionTo('authenticated.project.hpa.new', this.projectId, { queryParams: { id: this.id } }); }, }, diff --git a/app/models/ingress.js b/app/models/ingress.js index 83a5c45525..b9d428a6ff 100644 --- a/app/models/ingress.js +++ b/app/models/ingress.js @@ -16,23 +16,23 @@ export default Resource.extend({ targets: computed('defaultBackend', 'rules.@each.paths', 'store', 'tls', function() { const out = []; - const store = get(this, 'store'); + const store = this.store; let tlsHosts = []; - (get(this, 'tls') || []).forEach((entry) => { + (this.tls || []).forEach((entry) => { tlsHosts.addObjects(entry.hosts || []); }); tlsHosts = tlsHosts.uniq(); - let def = get(this, 'defaultBackend'); + let def = this.defaultBackend; if ( def ) { addRow(null, null, def); } - (get(this, 'rules') || []).forEach((rule) => { + (this.rules || []).forEach((rule) => { let entries = get(rule, 'paths') || []; entries.forEach((entry) => { @@ -70,24 +70,24 @@ export default Resource.extend({ }), displayKind: computed('intl.locale', function() { - const intl = get(this, 'intl'); + const intl = this.intl; return intl.t('model.ingress.displayKind'); }), actions: { edit() { - get(this, 'router').transitionTo('ingresses.run', { + this.router.transitionTo('ingresses.run', { queryParams: { - ingressId: get(this, 'id'), + ingressId: this.id, upgrade: true, } }); }, clone() { - get(this, 'router').transitionTo('ingresses.run', { + this.router.transitionTo('ingresses.run', { queryParams: { - ingressId: get(this, 'id'), + ingressId: this.id, upgrade: false, } }); diff --git a/app/models/kontainerdriver.js b/app/models/kontainerdriver.js index db5a3a402b..2269f6988d 100644 --- a/app/models/kontainerdriver.js +++ b/app/models/kontainerdriver.js @@ -8,7 +8,7 @@ var KontainerDriver = Resource.extend({ type: 'kontainerDriver', availableActions: computed('actionLinks.{activate,deactivate}', function() { - let a = get(this, 'actionLinks') || {}; + let a = this.actionLinks || {}; return [ { @@ -30,10 +30,10 @@ var KontainerDriver = Resource.extend({ }), displayName: computed('id', 'intl.locale', 'name', function() { - const intl = get(this, 'intl'); - const name = get(this, 'name'); + const intl = this.intl; + const name = this.name; const keyByName = `kontainerDriver.displayName.${ name }`; - const keyById = `kontainerDriver.displayName.${ get(this, 'id') }`; + const keyById = `kontainerDriver.displayName.${ this.id }`; if ( name && intl.exists(keyByName) ) { return intl.t(keyByName); @@ -42,17 +42,17 @@ var KontainerDriver = Resource.extend({ } else if ( name ) { return name.capitalize(); } else { - return `(${ get(this, 'id') })`; + return `(${ this.id })`; } }), canEdit: computed('links.update', 'builtin', function() { - return !!get(this, 'links.update') && !get(this, 'builtin'); + return !!get(this, 'links.update') && !this.builtin; }), hasUi: computed('hasBuiltinUi', 'uiUrl', function() { - return !!get(this, 'uiUrl'); + return !!this.uiUrl; }), @@ -66,11 +66,11 @@ var KontainerDriver = Resource.extend({ }, edit() { - get(this, 'modalService').toggleModal('modal-edit-driver', this); + this.modalService.toggleModal('modal-edit-driver', this); }, promptDeactivate() { - get(this, 'modalService').toggleModal('modal-confirm-deactivate', { + this.modalService.toggleModal('modal-confirm-deactivate', { originalModel: this, action: 'deactivate' }); diff --git a/app/models/member.js b/app/models/member.js index e18b67c0b4..5d6f43189f 100644 --- a/app/models/member.js +++ b/app/models/member.js @@ -7,9 +7,9 @@ export default Resource.extend({ globalStore: service(), principal: computed('userPrincipalId', 'groupPrincipalId', function() { - if (get(this, 'userPrincipalId')) { + if (this.userPrincipalId) { return this.globalStore.getById('principal', this.userPrincipalId) - } else if (get(this, 'groupPrincipalId')) { + } else if (this.groupPrincipalId) { return this.globalStore.getById('principal', this.groupPrincipalId) } @@ -17,28 +17,28 @@ export default Resource.extend({ }), displayType: computed('principal.id', 'principalType', function() { - let principal = get(this, 'principal'); + let principal = this.principal; let type = null; if (principal && get(principal, 'displayType')) { type = get(principal, 'displayType'); } else if (principal && get(principal, 'principalType')) { - type = get(this, 'principalType'); + type = this.principalType; } return type; }), displayName: computed('groupPrincipalId', 'principal.id', 'userPrincipalId', function() { - let principal = get(this, 'principal'); + let principal = this.principal; let name = null; if (principal && get(principal, 'displayName')) { name = get(principal, 'displayName'); - } else if (get(this, 'userPrincipalId')) { - name = get(this, 'userPrincipalId'); - } else if (get(this, 'groupPrincipalId')) { - name = get(this, 'groupPrincipalId'); + } else if (this.userPrincipalId) { + name = this.userPrincipalId; + } else if (this.groupPrincipalId) { + name = this.groupPrincipalId; } return name; diff --git a/app/models/mountentry.js b/app/models/mountentry.js index 91a69038da..cccbcee821 100644 --- a/app/models/mountentry.js +++ b/app/models/mountentry.js @@ -13,7 +13,7 @@ export default Resource.extend({ volume: reference('volumeId'), displayVolumeName: computed('volumeName', function() { - let name = this.get('volumeName'); + let name = this.volumeName; if ( name.match(/^[0-9a-f]{64}$/) ) { return (`${ name.substr(0, 12) }…`).htmlSafe(); @@ -23,9 +23,9 @@ export default Resource.extend({ }), displayPermission: computed('permission', function() { - let permission = this.get('permission'); + let permission = this.permission; let out = null; - let intl = this.get('intl'); + let intl = this.intl; switch (permission) { case 'ro': diff --git a/app/models/multiclusterapp.js b/app/models/multiclusterapp.js index 6788b7af7b..e0cf63c972 100644 --- a/app/models/multiclusterapp.js +++ b/app/models/multiclusterapp.js @@ -42,7 +42,7 @@ const MultiClusterApp = Resource.extend({ }), canUpgrade: computed('actionLinks.upgrade', 'catalogTemplate', 'links', 'templateVersion', function() { - const l = get(this, 'links') || {}; + const l = this.links || {}; return !!l.update && !isEmpty(this.catalogTemplate); }), @@ -61,13 +61,13 @@ const MultiClusterApp = Resource.extend({ label: 'action.upgrade', icon: 'icon icon-edit', action: 'upgrade', - enabled: get(this, 'canUpgrade') + enabled: this.canUpgrade }, { label: 'action.rollback', icon: 'icon icon-history', action: 'rollback', - enabled: get(this, 'canRollback') + enabled: this.canRollback } ]; }), @@ -79,9 +79,9 @@ const MultiClusterApp = Resource.extend({ const vKeys = Object.keys(get(this, 'catalogTemplate.versionLinks')); const latestVersion = vKeys[vKeys.length - 1]; - get(this, 'router').transitionTo('global-admin.multi-cluster-apps.catalog.launch', templateId, { + this.router.transitionTo('global-admin.multi-cluster-apps.catalog.launch', templateId, { queryParams: { - appId: get(this, 'id'), + appId: this.id, catalog: catalogId, upgrade: latestVersion, } @@ -89,7 +89,7 @@ const MultiClusterApp = Resource.extend({ }, rollback() { - get(this, 'modalService').toggleModal('modal-rollback-mc-app', { + this.modalService.toggleModal('modal-rollback-mc-app', { originalModel: this, revisionsLink: this.links.revisions, }); @@ -99,9 +99,9 @@ const MultiClusterApp = Resource.extend({ const templateId = get(this, 'externalIdInfo.templateId'); const catalogId = get(this, 'externalIdInfo.catalog'); - get(this, 'router').transitionTo('global-admin.multi-cluster-apps.catalog.launch', templateId, { + this.router.transitionTo('global-admin.multi-cluster-apps.catalog.launch', templateId, { queryParams: { - appId: get(this, 'id'), + appId: this.id, catalog: catalogId, clone: true } diff --git a/app/models/namespace.js b/app/models/namespace.js index 32a70bf51e..f88548b2bf 100644 --- a/app/models/namespace.js +++ b/app/models/namespace.js @@ -88,7 +88,7 @@ var Namespace = Resource.extend(StateCounts, { }, availableActions: computed('projectId', 'actionLinks.@each.move', 'scope.currentCluster.istioEnabled', 'scope.currentCluster.systemProject', 'autoInjectionEnabled', function() { - let aa = get(this, 'actionLinks') || {}; + let aa = this.actionLinks || {}; let out = [ { @@ -102,14 +102,14 @@ var Namespace = Resource.extend(StateCounts, { label: 'action.enableAutoInject', icon: 'icon icon-plus-circle', action: 'enableAutoInject', - enabled: get(this, 'scope.currentCluster.istioEnabled') && !!get(this, 'scope.currentCluster.systemProject') && !get(this, 'autoInjectionEnabled'), + enabled: get(this, 'scope.currentCluster.istioEnabled') && !!get(this, 'scope.currentCluster.systemProject') && !this.autoInjectionEnabled, bulkable: true }, { label: 'action.disableAutoInject', icon: 'icon icon-minus-circle', action: 'disableAutoInject', - enabled: get(this, 'scope.currentCluster.istioEnabled') && !!get(this, 'scope.currentCluster.systemProject') && get(this, 'autoInjectionEnabled'), + enabled: get(this, 'scope.currentCluster.istioEnabled') && !!get(this, 'scope.currentCluster.systemProject') && this.autoInjectionEnabled, bulkable: true }, { divider: true }, @@ -119,8 +119,8 @@ var Namespace = Resource.extend(StateCounts, { }), combinedState: computed('state', 'healthState', function() { - var stack = this.get('state'); - var health = this.get('healthState'); + var stack = this.state; + var health = this.healthState; if ( stack === 'active' && health ) { return health; @@ -130,11 +130,11 @@ var Namespace = Resource.extend(StateCounts, { }), externalIdInfo: computed('externalId', function() { - return parseExternalId(this.get('externalId')); + return parseExternalId(this.externalId); }), isDefault: computed('name', function() { - return (this.get('name') || '').toLowerCase() === 'default'; + return (this.name || '').toLowerCase() === 'default'; }), isEmpty: computed('pods.length', 'workloads.length', function() { @@ -142,7 +142,7 @@ var Namespace = Resource.extend(StateCounts, { }), hasProject: computed('project', function() { - return !!get(this, 'project'); + return !!this.project; }), isFromCatalog: computed('externalIdInfo.kind', function() { @@ -153,11 +153,11 @@ var Namespace = Resource.extend(StateCounts, { // This only works if the templates have already been loaded elsewhere... catalogTemplate: computed('externalIdInfo.templateId', function() { - return this.get('catalog').getTemplateFromCache(this.get('externalIdInfo.templateId')); + return this.catalog.getTemplateFromCache(this.get('externalIdInfo.templateId')); }), icon: computed('catalogTemplate', function() { - let tpl = this.get('catalogTemplate'); + let tpl = this.catalogTemplate; if ( tpl ) { return tpl.linkFor('icon'); @@ -171,7 +171,7 @@ var Namespace = Resource.extend(StateCounts, { if ( kind === C.EXTERNAL_ID.KIND_KUBERNETES || kind === C.EXTERNAL_ID.KIND_LEGACY_KUBERNETES ) { return C.EXTERNAL_ID.KIND_KUBERNETES; - } else if ( this.get('system') ) { + } else if ( this.system ) { return C.EXTERNAL_ID.KIND_INFRA; } else { return C.EXTERNAL_ID.KIND_USER; @@ -179,17 +179,17 @@ var Namespace = Resource.extend(StateCounts, { }), normalizedTags: computed('tags.[]', function() { - return normalizeTags(this.get('tags')); + return normalizeTags(this.tags); }), autoInjectionEnabled: computed('labels', function() { - const labels = get(this, 'labels') + const labels = this.labels return labels && labels[ISTIO_INJECTION] === ENABLED; }), validateResourceQuota(originLimit) { - const intl = get(this, 'intl'); + const intl = this.intl; let errors = []; const resourceQuota = get(this, 'resourceQuota.limit') || {}; @@ -228,19 +228,19 @@ var Namespace = Resource.extend(StateCounts, { actions: { edit() { - this.get('modalService').toggleModal('modal-edit-namespace', this); + this.modalService.toggleModal('modal-edit-namespace', this); }, delete() { return this._super().then(() => { if ( this.get('application.currentRouteName') === 'stack.index' ) { - this.get('router').transitionTo('containers'); + this.router.transitionTo('containers'); } }); }, move() { - this.get('modalService').toggleModal('modal-move-namespace', this); + this.modalService.toggleModal('modal-move-namespace', this); }, enableAutoInject() { @@ -259,7 +259,7 @@ var Namespace = Resource.extend(StateCounts, { want = normalizeTags(want); - let have = this.get('normalizedTags'); + let have = this.normalizedTags; for ( let i = 0 ; i < want.length ; i++ ) { if ( !have.includes(want[i]) ) { @@ -271,16 +271,16 @@ var Namespace = Resource.extend(StateCounts, { }, autoInjectToggle() { - const labels = get(this, 'labels') + const labels = this.labels const clone = this.clone() - if (get(this, 'autoInjectionEnabled')) { + if (this.autoInjectionEnabled) { delete labels['istio-injection'] } else { labels[ISTIO_INJECTION] = ENABLED; } set(clone, 'labels', labels) - clone.save().catch((err) => get(this, 'growl').fromError('Error:', err)) + clone.save().catch((err) => this.growl.fromError('Error:', err)) }, }); diff --git a/app/models/namespaceddockercredential.js b/app/models/namespaceddockercredential.js index 54e8cc9ec5..b1c1cc1321 100644 --- a/app/models/namespaceddockercredential.js +++ b/app/models/namespaceddockercredential.js @@ -1,7 +1,6 @@ import DockerCredential from './dockercredential'; import { reference } from '@rancher/ember-api-store/utils/denormalize'; import { inject as service } from '@ember/service'; -import { get } from '@ember/object'; export default DockerCredential.extend({ clusterStore: service(), @@ -11,10 +10,10 @@ export default DockerCredential.extend({ namespace: reference('namespaceId', 'namespace', 'clusterStore'), actions: { clone() { - get(this, 'router').transitionTo('authenticated.project.registries.new', { + this.router.transitionTo('authenticated.project.registries.new', { queryParams: { - id: get(this, 'id'), - type: get(this, 'type') + id: this.id, + type: this.type } }); } diff --git a/app/models/namespacedsecret.js b/app/models/namespacedsecret.js index b0229b4901..5aa15aac3f 100644 --- a/app/models/namespacedsecret.js +++ b/app/models/namespacedsecret.js @@ -1,7 +1,6 @@ import Secret from './secret'; import { reference } from '@rancher/ember-api-store/utils/denormalize'; import { inject as service } from '@ember/service'; -import { get } from '@ember/object'; export default Secret.extend({ clusterStore: service(), @@ -13,14 +12,14 @@ export default Secret.extend({ actions: { edit() { - get(this, 'router').transitionTo('authenticated.project.secrets.detail.edit', get(this, 'id')); + this.router.transitionTo('authenticated.project.secrets.detail.edit', this.id); }, clone() { - get(this, 'router').transitionTo('authenticated.project.secrets.new', { + this.router.transitionTo('authenticated.project.secrets.new', { queryParams: { - id: get(this, 'id'), - type: get(this, 'type') + id: this.id, + type: this.type } }); } diff --git a/app/models/node.js b/app/models/node.js index 3a760e9d66..4464e89aae 100644 --- a/app/models/node.js +++ b/app/models/node.js @@ -43,8 +43,8 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, { }, availableActions: computed('actionLinks.{cordon,drain,uncordon}', 'canScaleDown', 'links.nodeConfig', function() { - let l = get(this, 'links'); - const a = get(this, 'actionLinks') || {}; + let l = this.links; + const a = this.actionLinks || {}; let out = [ { @@ -96,20 +96,20 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, { }), canScaleDown: computed('actionLinks.scaledown', 'nodePool.quantity', function() { - const actions = get(this, 'actionLinks'); - const nodePool = get(this, 'nodePool'); + const actions = this.actionLinks; + const nodePool = this.nodePool; return !!actions?.scaledown && nodePool?.quantity > 1; }), displayName: computed('id', 'name', 'nodeName.length', 'nodes', 'requestedHostname', function() { - let name = get(this, 'name'); + let name = this.name; if ( name ) { return name; } - name = get(this, 'nodeName'); + name = this.nodeName; if ( name ) { if ( name.match(/[a-z]/i) ) { name = this.parseNodeName(name); @@ -118,12 +118,12 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, { return name; } - name = get(this, 'requestedHostname'); + name = this.requestedHostname; if ( name ) { return name; } - return `(${ get(this, 'id') })`; + return `(${ this.id })`; }), rolesArray: computed('etcd', 'controlPlane', 'worker', function() { @@ -131,8 +131,8 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, { }), displayRoles: computed('intl.locale', 'rolesArray.[]', function() { - const intl = get(this, 'intl'); - const roles = get(this, 'rolesArray'); + const intl = this.intl; + const roles = this.rolesArray; if ( roles.length >= 3 ) { return [intl.t('generic.all')]; @@ -150,7 +150,7 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, { }), sortRole: computed('rolesArray.[]', function() { - let roles = get(this, 'rolesArray'); + let roles = this.rolesArray; if ( roles.length >= 3 ) { return 1; @@ -168,13 +168,13 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, { }), isUnschedulable: computed('taints.@each.{effect,key}', function(){ - const taints = get(this, 'taints') || []; + const taints = this.taints || []; return taints.some((taint) => UNSCHEDULABLE_KEYS.includes(taint.key) && UNSCHEDULABLE_EFFECTS.includes(taint.effect)); }), isK3sNode: computed('labels', function() { - const labels = get(this, 'labels') || {}; + const labels = this.labels || {}; return Object.prototype.hasOwnProperty.call(labels, C.LABEL.NODE_INSTANCE_TYPE); }), @@ -247,16 +247,16 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, { }), osInfo: computed('labels', function() { - const labels = get(this, 'labels') || {}; + const labels = this.labels || {}; return labels['beta.kubernetes.io/os']; }), // or they will not be pulled in correctly. displayEndpoints: computed('publicEndpoints.@each.{ipAddress,port,serviceId,instanceId}', function() { - var store = get(this, 'clusterStore'); + var store = this.clusterStore; - return (get(this, 'publicEndpoints') || []).map((endpoint) => { + return (this.publicEndpoints || []).map((endpoint) => { if ( !endpoint.service ) { endpoint.service = store.getById('service', endpoint.serviceId); } @@ -269,7 +269,7 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, { // If you use this you must ensure that services and containers are already in the store requireAnyLabelStrings: computed(`labels.${ C.LABEL.REQUIRE_ANY }`, 'labels', function() { - return ((get(this, 'labels') || {})[C.LABEL.REQUIRE_ANY] || '') + return ((this.labels || {})[C.LABEL.REQUIRE_ANY] || '') .split(/\s*,\s*/) .filter((x) => x.length > 0 && x !== C.LABEL.SYSTEM_TYPE); }), @@ -314,7 +314,7 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, { }, drain() { - get(this, 'modalService').toggleModal('modal-drain-node', { + this.modalService.toggleModal('modal-drain-node', { escToClose: true, resources: [this], }); @@ -325,11 +325,11 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, { }, newContainer() { - get(this, 'router').transitionTo('containers.run', { queryParams: { hostId: get(this, 'model.id') } }); + this.router.transitionTo('containers.run', { queryParams: { hostId: get(this, 'model.id') } }); }, edit() { - get(this, 'modalService').toggleModal('modal-edit-host', this); + this.modalService.toggleModal('modal-edit-host', this); }, nodeConfig() { diff --git a/app/models/nodedriver.js b/app/models/nodedriver.js index 6d55520e64..68b9e88ea3 100644 --- a/app/models/nodedriver.js +++ b/app/models/nodedriver.js @@ -30,15 +30,17 @@ export default Resource.extend({ catalog: service(), intl: service(), type: 'nodeDriver', + canRemove: computed.equal('state', 'inactive'), + catalogTemplateIcon: computed('app.baseAssets', 'externalId', function() { - let parsedExtId = parseExternalId(get(this, 'externalId')) || null; + let parsedExtId = parseExternalId(this.externalId) || null; if (!parsedExtId) { return null; } - if (get(this, 'catalog').getTemplateFromCache(parsedExtId.templateId)) { - return get(this, 'catalog').getTemplateFromCache(parsedExtId.templateId) + if (this.catalog.getTemplateFromCache(parsedExtId.templateId)) { + return this.catalog.getTemplateFromCache(parsedExtId.templateId) .get('links.icon'); } else { return `${ get(this, 'app.baseAssets') }assets/images/providers/generic-driver.svg`; @@ -46,8 +48,8 @@ export default Resource.extend({ }), displayName: computed('id', 'intl.locale', 'name', function() { - const intl = get(this, 'intl'); - const name = get(this, 'name'); + const intl = this.intl; + const name = this.name; const key = `nodeDriver.displayName.${ name }`; if ( name && intl.exists(key) ) { @@ -55,14 +57,14 @@ export default Resource.extend({ } else if ( name ) { return name.capitalize(); } else { - return `(${ get(this, 'id') })`; + return `(${ this.id })`; } }), displayIcon: computed('hasBuiltinUi', 'name', function() { - let name = get(this, 'name'); + let name = this.name; - if ( get(this, 'hasBuiltinUi') ) { + if ( this.hasBuiltinUi ) { return name; } else { return 'generic'; @@ -70,31 +72,31 @@ export default Resource.extend({ }), displayUrl: computed('url', function() { - return displayUrl(get(this, 'url')); + return displayUrl(this.url); }), displayChecksum: computed('checksum', function() { - return get(this, 'checksum').substring(0, 8); + return this.checksum.substring(0, 8); }), displayUiUrl: computed('uiUrl', function() { - return displayUrl(get(this, 'uiUrl')); + return displayUrl(this.uiUrl); }), hasBuiltinUi: computed('name', function() { - return BUILT_IN_UI.indexOf(get(this, 'name')) >= 0; + return BUILT_IN_UI.indexOf(this.name) >= 0; }), hasBuiltinIconOnly: computed('name', function() { - return BUILT_IN_ICON_ONLY.indexOf(get(this, 'name')) >= 0; + return BUILT_IN_ICON_ONLY.indexOf(this.name) >= 0; }), isCustom: computed('builtin', 'externalId', function() { - return !get(this, 'builtin') && !get(this, 'externalId'); + return !this.builtin && !this.externalId; }), hasUi: computed('hasBuiltinUi', 'uiUrl', function() { - return get(this, 'hasBuiltinUi') || !!get(this, 'uiUrl'); + return this.hasBuiltinUi || !!this.uiUrl; }), newExternalId: computed('isSystem', 'selectedTemplateModel.id', function() { @@ -104,29 +106,25 @@ export default Resource.extend({ }), canEdit: computed('links.update', 'builtin', function() { - return !!get(this, 'links.update') && !get(this, 'builtin'); - }), - - canRemove: computed('state', function() { - return get(this, 'state') === 'inactive' + return !!get(this, 'links.update') && !this.builtin; }), availableActions: computed('actionLinks.{activate,deactivate}', 'state', function() { - let a = get(this, 'actionLinks') || {}; + let a = this.actionLinks || {}; return [ { label: 'action.activate', icon: 'icon icon-play', action: 'activate', - enabled: !!a.activate && get(this, 'state') === 'inactive', + enabled: !!a.activate && this.state === 'inactive', bulkable: true }, { label: 'action.deactivate', icon: 'icon icon-pause', action: 'promptDeactivate', - enabled: !!a.deactivate && get(this, 'state') === 'active', + enabled: !!a.deactivate && this.state === 'active', bulkable: true, altAction: 'deactivate', }, @@ -134,7 +132,7 @@ export default Resource.extend({ }), externalIdInfo: computed('externalId', function() { - return parseExternalId(get(this, 'externalId')); + return parseExternalId(this.externalId); }), actions: { @@ -147,14 +145,14 @@ export default Resource.extend({ }, promptDeactivate() { - get(this, 'modalService').toggleModal('modal-confirm-deactivate', { + this.modalService.toggleModal('modal-confirm-deactivate', { originalModel: this, action: 'deactivate' }); }, edit() { - get(this, 'modalService').toggleModal('modal-edit-driver', this); + this.modalService.toggleModal('modal-edit-driver', this); }, }, diff --git a/app/models/nodepool.js b/app/models/nodepool.js index a449b1f62d..f5bd02da3a 100644 --- a/app/models/nodepool.js +++ b/app/models/nodepool.js @@ -1,7 +1,7 @@ import Resource from '@rancher/ember-api-store/models/resource'; import { reference } from '@rancher/ember-api-store/utils/denormalize'; import { cancel, later } from '@ember/runloop' -import { get, set, computed } from '@ember/object'; +import { set, computed } from '@ember/object'; import { ucFirst } from 'shared/utils/util'; const NodePool = Resource.extend({ @@ -11,8 +11,8 @@ const NodePool = Resource.extend({ nodeTemplate: reference('nodeTemplateId'), displayProvider: computed('driver', 'nodeTemplate.driver', 'intl.locale', function() { - const intl = get(this, 'intl'); - const driver = get(this, 'driver'); + const intl = this.intl; + const driver = this.driver; const key = `nodeDriver.displayName.${ driver }`; if ( intl.exists(key) ) { @@ -23,20 +23,20 @@ const NodePool = Resource.extend({ }), incrementQuantity(by) { - let quantity = get(this, 'quantity'); + let quantity = this.quantity; quantity += by; quantity = Math.max(0, quantity); set(this, 'quantity', quantity); - if ( get(this, 'quantityTimer') ) { - cancel(get(this, 'quantityTimer')); + if ( this.quantityTimer ) { + cancel(this.quantityTimer); } var timer = later(this, function() { this.save().catch((err) => { - get(this, 'growl').fromError('Error updating node pool scale', err); + this.growl.fromError('Error updating node pool scale', err); }); }, 500); diff --git a/app/models/nodetemplate.js b/app/models/nodetemplate.js index b0f9dfe2fb..693e837b52 100644 --- a/app/models/nodetemplate.js +++ b/app/models/nodetemplate.js @@ -29,14 +29,14 @@ export default Resource.extend({ }, config: computed('driver', function() { - const driver = get(this, 'driver'); + const driver = this.driver; return get(this, `${ driver }Config`); }), displayProvider: computed('driver', 'intl.locale', function() { - const intl = get(this, 'intl'); - const driver = get(this, 'driver'); + const intl = this.intl; + const driver = this.driver; const key = `nodeDriver.displayName.${ driver }`; if ( intl.exists(key) ) { @@ -56,9 +56,9 @@ export default Resource.extend({ actions: { edit() { - let driver = get(this, 'driver'); + let driver = this.driver; - get(this, 'modalService').toggleModal('modal-edit-node-template', { + this.modalService.toggleModal('modal-edit-node-template', { driver, config: get(this, `${ driver }Config`), nodeTemplate: this, @@ -69,7 +69,7 @@ export default Resource.extend({ clone() { const { driver } = this; - get(this, 'modalService').toggleModal('modal-edit-node-template', { + this.modalService.toggleModal('modal-edit-node-template', { driver, config: get(this, `${ driver }Config`), nodeTemplate: this, @@ -79,7 +79,7 @@ export default Resource.extend({ }, _displayVar(keyOrFn) { - const intl = get(this, 'intl'); + const intl = this.intl; if ( keyOrFn ) { if ( typeof (keyOrFn) === 'function' ) { diff --git a/app/models/notifier.js b/app/models/notifier.js index 57d675c6cf..de9de2212e 100644 --- a/app/models/notifier.js +++ b/app/models/notifier.js @@ -1,6 +1,6 @@ import Resource from '@rancher/ember-api-store/models/resource'; import { inject as service } from '@ember/service'; -import { setProperties, get, computed } from '@ember/object'; +import { setProperties, get, computed } from '@ember/object'; import { hash } from 'rsvp'; import C from 'ui/utils/constants'; import moment from 'moment'; @@ -14,21 +14,21 @@ export default Resource.extend({ type: 'notifier', displayNameAndType: computed('displayName', 'notifierType', function() { - const upperCaseType = (get(this, 'notifierType') || '').replace(/^\S/, (s) => { + const upperCaseType = (this.notifierType || '').replace(/^\S/, (s) => { return s.toUpperCase(); }) - return `${ get(this, 'displayName') } (${ upperCaseType })` + return `${ this.displayName } (${ upperCaseType })`; }), notifierTableLabel: computed('dingtalkConfig', 'emailConfig', 'msteamsConfig', 'pagerdutyConfig', 'slackConfig', 'smtpConfig', 'webhookConfig', 'wechatConfig', function(){ - const sc = get(this, 'slackConfig'); - const pc = get(this, 'pagerdutyConfig'); - const ec = get(this, 'smtpConfig'); - const wc = get(this, 'webhookConfig'); - const wcc = get(this, 'wechatConfig'); - const dtc = get(this, 'dingtalkConfig'); - const msc = get(this, 'msteamsConfig'); + const sc = this.slackConfig; + const pc = this.pagerdutyConfig; + const ec = this.smtpConfig; + const wc = this.webhookConfig; + const wcc = this.wechatConfig; + const dtc = this.dingtalkConfig; + const msc = this.msteamsConfig; if ( sc ) { return C.NOTIFIER_TABLE_LABEL.SLACK; @@ -56,13 +56,13 @@ export default Resource.extend({ }), notifierType: computed('dingtalkConfig', 'emailConfig', 'msteamsConfig', 'pagerdutyConfig', 'slackConfig', 'smtpConfig', 'webhookConfig', 'wechatConfig', function(){ - const sc = get(this, 'slackConfig'); - const pc = get(this, 'pagerdutyConfig'); - const ec = get(this, 'smtpConfig'); - const wc = get(this, 'webhookConfig'); - const wcc = get(this, 'wechatConfig'); - const dtc = get(this, 'dingtalkConfig'); - const msc = get(this, 'msteamsConfig'); + const sc = this.slackConfig; + const pc = this.pagerdutyConfig; + const ec = this.smtpConfig; + const wc = this.webhookConfig; + const wcc = this.wechatConfig; + const dtc = this.dingtalkConfig; + const msc = this.msteamsConfig; if ( sc ) { return 'slack'; @@ -90,11 +90,11 @@ export default Resource.extend({ }), notifierValue: computed('emailConfig', 'pagerdutyConfig', 'slackConfig', 'smtpConfig', 'webhookConfig', 'wechatConfig', function(){ - const sc = get(this, 'slackConfig'); - const pc = get(this, 'pagerdutyConfig'); - const ec = get(this, 'smtpConfig'); - const wc = get(this, 'webhookConfig'); - const wcc = get(this, 'wechatConfig'); + const sc = this.slackConfig; + const pc = this.pagerdutyConfig; + const ec = this.smtpConfig; + const wc = this.webhookConfig; + const wcc = this.wechatConfig; if ( sc ) { return get(sc, 'defaultRecipient'); @@ -116,17 +116,17 @@ export default Resource.extend({ }), displayCreated: computed('created', function(){ - const d = get(this, 'created'); + const d = this.created; return moment(d).fromNow(); }), notifierLabel: computed('emailConfig', 'pagerdutyConfig', 'slackConfig', 'smtpConfig', 'webhookConfig', 'wechartConfig', 'wechatConfig', function(){ - const sc = get(this, 'slackConfig'); - const pc = get(this, 'pagerdutyConfig'); - const ec = get(this, 'smtpConfig'); - const wc = get(this, 'webhookConfig'); - const wcc = get(this, 'wechatConfig'); + const sc = this.slackConfig; + const pc = this.pagerdutyConfig; + const ec = this.smtpConfig; + const wc = this.webhookConfig; + const wcc = this.wechatConfig; if ( sc ) { return 'Channel'; @@ -148,8 +148,8 @@ export default Resource.extend({ }), findAlerts(){ - const globalStore = get(this, 'globalStore'); - const clusterId = get(this, 'clusterId'); + const globalStore = this.globalStore; + const clusterId = this.clusterId; const clusterAlertGroups = globalStore.find('clusterAlertGroup', null, { filter: { clusterId } }); const projectAlertGroups = globalStore.findAll('projectAlertGroup'); @@ -170,7 +170,7 @@ export default Resource.extend({ return false; } - return recipients.some((recipient) => recipient.notifierId === get(this, 'id')); + return recipients.some((recipient) => recipient.notifierId === this.id); }); return alerts; @@ -184,10 +184,10 @@ export default Resource.extend({ if ( alerts.length ) { const alertNames = alerts.map((alert) => get(alert, 'displayName')).join(','); - get(this, 'growl') - .error(get(this, 'intl') + this.growl + .error(this.intl .t('notifierPage.deleteErrorMessage', { - displayName: get(this, 'displayName'), + displayName: this.displayName, alertNames })); } else { @@ -197,9 +197,9 @@ export default Resource.extend({ }, actions: { edit() { - get(this, 'modalService').toggleModal('notifier/modal-new-edit', { + this.modalService.toggleModal('notifier/modal-new-edit', { closeWithOutsideClick: false, - currentType: get(this, 'notifierType'), + currentType: this.notifierType, model: this, mode: 'edit', }); @@ -212,9 +212,9 @@ export default Resource.extend({ id: null, name: null }); - get(this, 'modalService').toggleModal('notifier/modal-new-edit', { + this.modalService.toggleModal('notifier/modal-new-edit', { closeWithOutsideClick: false, - currentType: get(this, 'notifierType'), + currentType: this.notifierType, model: nue, mode: 'clone', }); diff --git a/app/models/persistentvolume.js b/app/models/persistentvolume.js index eba610a17d..04b69917dd 100644 --- a/app/models/persistentvolume.js +++ b/app/models/persistentvolume.js @@ -11,7 +11,7 @@ export default Volume.extend({ storageClass: reference('storageClassId'), canRemove: computed('links.remove', 'state', function() { - return !!get(this, 'links.remove') && get(this, 'state') !== 'bound'; + return !!get(this, 'links.remove') && this.state !== 'bound'; }), displayPvc: computed('claimRef.namespace', 'claimRef.name', function() { @@ -24,7 +24,7 @@ export default Volume.extend({ actions: { edit() { - get(this, 'router').transitionTo('authenticated.cluster.storage.persistent-volumes.detail.edit', get(this, 'id')); + this.router.transitionTo('authenticated.cluster.storage.persistent-volumes.detail.edit', this.id); }, }, }); diff --git a/app/models/persistentvolumeclaim.js b/app/models/persistentvolumeclaim.js index 4418ba8869..31be29a01c 100644 --- a/app/models/persistentvolumeclaim.js +++ b/app/models/persistentvolumeclaim.js @@ -39,7 +39,7 @@ var PersistentVolumeClaim = Resource.extend({ }), workloads: computed('id', 'namespace.workloads.@each.volumes', function() { - return (get(this, 'namespace.workloads') || []).filter((workload) => (get(workload, 'volumes') || []).find((volume) => get(volume, 'persistentVolumeClaim.persistentVolumeClaimId') === get(this, 'id'))); + return (get(this, 'namespace.workloads') || []).filter((workload) => (get(workload, 'volumes') || []).find((volume) => get(volume, 'persistentVolumeClaim.persistentVolumeClaimId') === this.id)); }), sizeBytes: computed('status.capacity.storage', function() { @@ -53,7 +53,7 @@ var PersistentVolumeClaim = Resource.extend({ }), displaySize: computed('sizeBytes', function() { - const bytes = get(this, 'sizeBytes'); + const bytes = this.sizeBytes; if ( bytes ) { return formatSi(bytes, 1024, 'iB', 'B'); @@ -64,7 +64,7 @@ var PersistentVolumeClaim = Resource.extend({ actions: { resize() { - get(this, 'modalService').toggleModal('modal-resize-pvc', { model: this, }); + this.modalService.toggleModal('modal-resize-pvc', { model: this, }); } }, diff --git a/app/models/pipeline.js b/app/models/pipeline.js index a08b739312..eac8859df6 100644 --- a/app/models/pipeline.js +++ b/app/models/pipeline.js @@ -1,6 +1,6 @@ import Resource from '@rancher/ember-api-store/models/resource'; import { inject as service } from '@ember/service'; -import { get, computed } from '@ember/object'; +import { computed } from '@ember/object'; import C from 'shared/utils/pipeline-constants'; let Pipeline = Resource.extend({ @@ -12,19 +12,19 @@ let Pipeline = Resource.extend({ canDownloadYaml: false, lastRun: computed('nextRun', function() { - return parseInt(get(this, 'nextRun'), 10) - 1; + return parseInt(this.nextRun, 10) - 1; }), relevantState: computed('lastRunState', 'state', function() { - if ( get(this, 'state') === 'removing' ) { + if ( this.state === 'removing' ) { return 'removing'; } - return get(this, 'lastRunState') || 'untriggered'; + return this.lastRunState || 'untriggered'; }), displayRepositoryUrl: computed('repositoryUrl', function() { - let url = get(this, 'repositoryUrl'); + let url = this.repositoryUrl; if ( url.endsWith('.git') ) { url = url.substr(0, url.length - 4); @@ -34,21 +34,21 @@ let Pipeline = Resource.extend({ }), projectName: computed('displayName', function() { - const displayName = get(this, 'displayName') ; + const displayName = this.displayName ; let tokens = displayName.split('/') ; return tokens[0].startsWith('~') ? tokens[0].substr(1, tokens[0].length) : tokens[0]; }), repoName: computed('displayName', function() { - const displayName = get(this, 'displayName') ; + const displayName = this.displayName ; let tokens = displayName.split('/') ; return tokens[1]; }), displayName: computed('repositoryUrl', function() { - let tokens = get(this, 'repositoryUrl').split('/') ; + let tokens = this.repositoryUrl.split('/') ; tokens = tokens.slice(tokens.length - 2); const last = tokens[tokens.length - 1]; @@ -61,9 +61,9 @@ let Pipeline = Resource.extend({ }), availableActions: computed('actions', 'links.yaml', 'repositoryUrl', function() { - let l = get(this, 'links') || {}; - let a = get(this, 'actions') || {}; - const isExample = C.DEMO_REPOSITORIES.findBy('url', get(this, 'repositoryUrl')); + let l = this.links || {}; + let a = this.actions || {}; + const isExample = C.DEMO_REPOSITORIES.findBy('url', this.repositoryUrl); return [{ divider: true }, { @@ -100,25 +100,25 @@ let Pipeline = Resource.extend({ }), actions: { run() { - get(this, 'modalService').toggleModal('modal-pipeline-run', { + this.modalService.toggleModal('modal-pipeline-run', { originalModel: this, escToClose: true, }); }, setting() { - get(this, 'modalService').toggleModal('modal-pipeline-setting', { + this.modalService.toggleModal('modal-pipeline-setting', { originalModel: this, escToClose: true, }); }, editConfig() { - get(this, 'router').transitionTo('authenticated.project.pipeline.pipelines.edit', get(this, 'id')) + this.router.transitionTo('authenticated.project.pipeline.pipelines.edit', this.id) }, editYaml() { - get(this, 'modalService').toggleModal('modal-pipeline-yaml', { + this.modalService.toggleModal('modal-pipeline-yaml', { originalModel: this, escToClose: true, }); diff --git a/app/models/pipelineexecution.js b/app/models/pipelineexecution.js index 5fb68fc524..8b6ce5b655 100644 --- a/app/models/pipelineexecution.js +++ b/app/models/pipelineexecution.js @@ -12,7 +12,7 @@ let PipelineExecution = Resource.extend({ relevantState: alias('executionState'), availableActions: computed('actionLinks.{rerun,stop}', function() { - const a = get(this, 'actionLinks') || {}; + const a = this.actionLinks || {}; return [ { @@ -55,7 +55,7 @@ let PipelineExecution = Resource.extend({ }), shortCommit: computed('commit', function() { - const commit = get(this, 'commit') + const commit = this.commit if (commit) { return commit.substr(0, 8) @@ -65,17 +65,17 @@ let PipelineExecution = Resource.extend({ }), startedTimeStamp: computed('started', function(){ - const time = get(this, 'started'); + const time = this.started; return new Date(time); }), showTransitioning: computed('showTransitioningMessage', 'executionState', function() { - return get(this, 'showTransitioningMessage') && get(this, 'executionState') !== C.STATES.ABORTED && get(this, 'executionState') !== C.STATES.FAILED; + return this.showTransitioningMessage && this.executionState !== C.STATES.ABORTED && this.executionState !== C.STATES.FAILED; }), displayRepositoryUrl: computed('repositoryUrl', function() { - let url = get(this, 'repositoryUrl'); + let url = this.repositoryUrl; if ( url.endsWith('.git') ) { url = url.substr(0, url.length - 4); @@ -85,46 +85,46 @@ let PipelineExecution = Resource.extend({ }), commitUrl: computed('commit', 'displayRepositoryUrl', 'pipeline.displayName', 'pipeline.sourceCodeCredential.sourceCodeType', function() { - let url = get(this, 'displayRepositoryUrl'); + let url = this.displayRepositoryUrl; const sourceCodeType = get(this, 'pipeline.sourceCodeCredential.sourceCodeType'); const name = get(this, 'pipeline.displayName'); switch ( sourceCodeType ) { case 'bitbucketserver': if ( name.startsWith('~') ) { - return `${ this.bitbucketRootUrl('users') }/commits/${ get(this, 'commit') }`; + return `${ this.bitbucketRootUrl('users') }/commits/${ this.commit }`; } else { - return `${ this.bitbucketRootUrl('projects') }/commits/${ get(this, 'commit') }`; + return `${ this.bitbucketRootUrl('projects') }/commits/${ this.commit }`; } case 'bitbucketcloud': - return `${ url }/commits/${ get(this, 'commit') }`; + return `${ url }/commits/${ this.commit }`; default: - return `${ url }/commit/${ get(this, 'commit') }`; + return `${ url }/commit/${ this.commit }`; } }), branchUrl: computed('branch', 'displayRepositoryUrl', 'pipeline.displayName', 'pipeline.sourceCodeCredential.sourceCodeType', function() { - let url = get(this, 'displayRepositoryUrl'); + let url = this.displayRepositoryUrl; const sourceCodeType = get(this, 'pipeline.sourceCodeCredential.sourceCodeType'); const name = get(this, 'pipeline.displayName'); switch ( sourceCodeType ) { case 'bitbucketserver': if ( name.startsWith('~') ) { - return `${ this.bitbucketRootUrl('users') }/browse?at=refs%2Fheads%2F${ get(this, 'branch') }`; + return `${ this.bitbucketRootUrl('users') }/browse?at=refs%2Fheads%2F${ this.branch }`; } else { - return `${ this.bitbucketRootUrl('projects') }/browse?at=refs%2Fheads%2F${ get(this, 'branch') }`; + return `${ this.bitbucketRootUrl('projects') }/browse?at=refs%2Fheads%2F${ this.branch }`; } case 'bitbucketcloud': - return `${ url }/src/${ get(this, 'branch') }`; + return `${ url }/src/${ this.branch }`; default: - return `${ url }/tree/${ get(this, 'branch') }`; + return `${ url }/tree/${ this.branch }`; } }), duration: computed('started', 'ended', function(){ - const started = get(this, 'started'); - const ended = get(this, 'ended'); + const started = this.started; + const ended = this.ended; if ( ended ) { const duration = new Date(ended).getTime() - new Date(started).getTime(); @@ -136,7 +136,7 @@ let PipelineExecution = Resource.extend({ }), bitbucketRootUrl(repoType) { - let url = get(this, 'displayRepositoryUrl'); + let url = this.displayRepositoryUrl; url = url.substr(0, get(url, 'length') - get(this, 'pipeline.displayName.length') - 5); @@ -149,7 +149,7 @@ let PipelineExecution = Resource.extend({ const pipelineId = get(this, 'pipeline.id'); const nextRun = get(this, 'pipeline.nextRun'); - get(this, 'router').transitionTo('authenticated.project.pipeline.pipelines.run', pipelineId, nextRun); + this.router.transitionTo('authenticated.project.pipeline.pipelines.run', pipelineId, nextRun); }); }, diff --git a/app/models/pod.js b/app/models/pod.js index 018330c781..6a3bbcd0bc 100644 --- a/app/models/pod.js +++ b/app/models/pod.js @@ -36,11 +36,11 @@ var Pod = Resource.extend(Grafana, DisplayImage, { }), canShell: computed('containers', function() { - return !!get(this, 'containers').findBy('canShell', true); + return !!this.containers.findBy('canShell', true); }), availableActions: computed('canShell', function() { - const canShell = get(this, 'canShell'); + const canShell = this.canShell; var choices = [ { @@ -63,8 +63,8 @@ var Pod = Resource.extend(Grafana, DisplayImage, { }), memoryReservationBlurb: computed('memoryReservation', function() { - if ( get(this, 'memoryReservation') ) { - return formatSi(get(this, 'memoryReservation'), 1024, 'iB', 'B'); + if ( this.memoryReservation ) { + return formatSi(this.memoryReservation, 1024, 'iB', 'B'); } return; @@ -72,10 +72,10 @@ var Pod = Resource.extend(Grafana, DisplayImage, { combinedState: computed('node.state', 'workload.state', 'state', 'healthState', 'healthCheck', function() { var node = get(this, 'node.state'); - var resource = get(this, 'state'); + var resource = this.state; // var workload = get(this,'workload.state'); - var health = get(this, 'healthState'); - var hasCheck = !!get(this, 'healthCheck'); + var health = this.healthState; + var hasCheck = !!this.healthCheck; if ( !hasCheck && C.DISCONNECTED_STATES.includes(node) ) { return 'unknown'; @@ -87,14 +87,14 @@ var Pod = Resource.extend(Grafana, DisplayImage, { }), isOn: computed('state', function() { - return ['running', 'migrating', 'restarting'].indexOf(get(this, 'state')) >= 0; + return ['running', 'migrating', 'restarting'].indexOf(this.state) >= 0; }), displayState: computed('_displayState', 'exitCode', 'state', function() { - let out = get(this, '_displayState'); - let code = get(this, 'exitCode'); + let out = this._displayState; + let code = this.exitCode; - if ( get(this, 'state') === 'stopped' && get(this, 'exitCode') > 0) { + if ( this.state === 'stopped' && this.exitCode > 0) { out += ` (${ code })`; } @@ -103,7 +103,7 @@ var Pod = Resource.extend(Grafana, DisplayImage, { displayEnvironmentVars: computed('environment', function() { var envs = []; - var environment = get(this, 'environment') || {}; + var environment = this.environment || {}; Object.keys(environment).forEach((key) => { envs.pushObject({ @@ -120,7 +120,7 @@ var Pod = Resource.extend(Grafana, DisplayImage, { }), dislayContainerMessage: computed('containers.@each.showTransitioningMessage', function() { - return !!get(this, 'containers').findBy('showTransitioningMessage', true); + return !!this.containers.findBy('showTransitioningMessage', true); }), restarts: computed('status.containerStatuses.@each.restartCount', function() { @@ -138,7 +138,7 @@ var Pod = Resource.extend(Grafana, DisplayImage, { }), sortIp: computed('primaryIpAddress', 'primaryAssociatedIpAddress', function() { - var ip = get(this, 'primaryAssociatedIpAddress') || get(this, 'primaryIpAddress'); + var ip = this.primaryAssociatedIpAddress || this.primaryIpAddress; if ( !ip ) { return ''; @@ -154,22 +154,22 @@ var Pod = Resource.extend(Grafana, DisplayImage, { }), isGlobalScale: computed('labels', function() { - return `${ (get(this, 'labels') || {})[C.LABEL.SCHED_GLOBAL] }` === 'true'; + return `${ (this.labels || {})[C.LABEL.SCHED_GLOBAL] }` === 'true'; }), actions: { clone() { - get(this, 'router').transitionTo('containers.run', { queryParams: { podId: get(this, 'id'), } }); + this.router.transitionTo('containers.run', { queryParams: { podId: this.id, } }); }, shell() { - get(this, 'modalService').toggleModal('modal-shell', { model: this, }); + this.modalService.toggleModal('modal-shell', { model: this, }); }, popoutShell() { const projectId = get(this, 'scope.currentProject.id'); - const podId = get(this, 'id'); - const route = get(this, 'router').urlFor('authenticated.project.console', projectId); + const podId = this.id; + const route = this.router.urlFor('authenticated.project.console', projectId); const system = get(this, 'node.info.os.operatingSystem') || '' let windows = false; @@ -190,13 +190,13 @@ var Pod = Resource.extend(Grafana, DisplayImage, { set(dataToModal, 'containerName', this.containers.firstObject.name); } - get(this, 'modalService').toggleModal('modal-container-logs', dataToModal); + this.modalService.toggleModal('modal-container-logs', dataToModal); }, popoutLogs() { const projectId = get(this, 'scope.currentProject.id'); - const podId = get(this, 'id'); - const route = get(this, 'router').urlFor('authenticated.project.container-log', projectId); + const podId = this.id; + const route = this.router.urlFor('authenticated.project.container-log', projectId); later(() => { window.open(`//${ window.location.host }${ route }?podId=${ podId }&isPopup=true`, '_blank', 'toolbars=0,width=900,height=700,left=200,top=200'); @@ -205,7 +205,7 @@ var Pod = Resource.extend(Grafana, DisplayImage, { }, hasLabel(key, desiredValue) { - const labels = get(this, 'labels') || {}; + const labels = this.labels || {}; const value = get(labels, key); if ( value === undefined ) { diff --git a/app/models/port.js b/app/models/port.js index 80d3418df1..9b222c2587 100644 --- a/app/models/port.js +++ b/app/models/port.js @@ -5,23 +5,23 @@ var Port = Resource.extend({ _publicIp: null, _publicIpState: null, displayPublicIp: computed('_publicIp', '_publicIpState', 'bindAddress', 'publicIpAddressId', 'publicPort', 'store', function() { - var bind = this.get('bindAddress'); + var bind = this.bindAddress; if ( bind ) { return bind; - } else if ( !this.get('publicPort') ) { + } else if ( !this.publicPort ) { return null; } - var ip = this.get('_publicIp'); + var ip = this._publicIp; if ( ip ) { return ip; - } else if ( this.get('_publicIpState') === 2 ) { + } else if ( this._publicIpState === 2 ) { return '(Unknown IP)'; - } else if ( !this.get('_publicIpState') ) { + } else if ( !this._publicIpState ) { this.set('_publicIpState', 1); - this.get('store').find('ipaddress', this.get('publicIpAddressId')) + this.store.find('ipaddress', this.publicIpAddressId) .then((ip) => { this.set('_publicIp', ip.get('address')); }) diff --git a/app/models/principal.js b/app/models/principal.js index 968a2ba6bf..30d4dc766f 100644 --- a/app/models/principal.js +++ b/app/models/principal.js @@ -2,7 +2,7 @@ import { equal } from '@ember/object/computed'; import { inject as service } from '@ember/service'; import Resource from '@rancher/ember-api-store/models/resource'; import C from 'ui/utils/constants'; -import { get, computed } from '@ember/object' +import { computed } from '@ember/object' import Identicon from 'identicon.js'; var Principal = Resource.extend({ @@ -13,15 +13,15 @@ var Principal = Resource.extend({ isOrg: equal('parsedExternalType', C.PROJECT.TYPE_ORG), parsedExternalType: computed('id', function() { - return get(this, 'id').split(':') + return this.id.split(':') .get('firstObject'); }), avatarSrc: computed('isGithub', 'isGoogleOauth', 'id', 'profilePicture', function() { - if ( (get(this, 'isGithub') && get(this, 'profilePicture')) || (get(this, 'isGoogleOauth') && get(this, 'profilePicture')) ) { - return get(this, 'profilePicture'); + if ( (this.isGithub && this.profilePicture) || (this.isGoogleOauth && this.profilePicture) ) { + return this.profilePicture; } else { - let id = get(this, 'id') || 'Unknown'; + let id = this.id || 'Unknown'; id = id.replace('local://', ''); @@ -31,15 +31,15 @@ var Principal = Resource.extend({ isGithub: computed('parsedExternalType', 'provider', function() { // console.log('is github?', get(this, 'provider')); - return (get(this, 'provider') || '').toLowerCase() === 'github'; + return (this.provider || '').toLowerCase() === 'github'; }), isGoogleOauth: computed('parsedExternalType', 'provider', function() { - return (get(this, 'provider') || '').toLowerCase() === 'googleoauth'; + return (this.provider || '').toLowerCase() === 'googleoauth'; }), logicalType: computed('parsedExternalType', function() { - switch ( get(this, 'parsedExternalType') ) { + switch ( this.parsedExternalType ) { case C.PROJECT.TYPE_ACTIVE_DIRECTORY_USER: case C.PROJECT.TYPE_ADFS_USER: case C.PROJECT.TYPE_AZURE_USER: @@ -74,7 +74,7 @@ var Principal = Resource.extend({ }), logicalTypeSort: computed('logicalType', function() { - switch (get(this, 'logicalType') ) { + switch (this.logicalType ) { case C.PROJECT.ORG: return 1; case C.PROJECT.TEAM: return 2; case C.PROJECT.PERSON: return 3; @@ -84,7 +84,7 @@ var Principal = Resource.extend({ displayType: computed('parsedExternalType', 'intl.locale', function() { let key = 'model.identity.displayType.unknown'; - let type = get(this, 'parsedExternalType'); + let type = this.parsedExternalType; switch ( type ) { case C.PROJECT.TYPE_ACTIVE_DIRECTORY_USER: @@ -129,7 +129,7 @@ var Principal = Resource.extend({ break; } - return get(this, 'intl').t(key, { type }); + return this.intl.t(key, { type }); }), }); diff --git a/app/models/project.js b/app/models/project.js index 8a338f0b67..d9a7c43717 100644 --- a/app/models/project.js +++ b/app/models/project.js @@ -31,7 +31,7 @@ export default Resource.extend({ // 2.0 bug projectId is wrong in the ptrb should be : instead of just roleTemplateBindings: alias('projectRoleTemplateBindings'), icon: computed('active', function() { - if (get(this, 'active')) { + if (this.active) { return 'icon icon-folder-open'; } else { return 'icon icon-folder text-muted'; @@ -39,39 +39,39 @@ export default Resource.extend({ }), isDefault: computed(`prefs.${ C.PREFS.PROJECT_DEFAULT }`, 'id', function() { - return get(this, `prefs.${ C.PREFS.PROJECT_DEFAULT }`) === get(this, 'id'); + return get(this, `prefs.${ C.PREFS.PROJECT_DEFAULT }`) === this.id; }), isSystemProject: computed('labels', function() { - const labels = get(this, 'labels') || {}; + const labels = this.labels || {}; return labels[SYSTEM_PROJECT_LABEL] === 'true'; }), conditionsDidChange: on('init', observer('enableProjectMonitoring', 'conditions.@each.status', function() { - if ( !get(this, 'enableProjectMonitoring') ) { + if ( !this.enableProjectMonitoring ) { return false; } - const conditions = get(this, 'conditions') || []; + const conditions = this.conditions || []; const ready = conditions.findBy('type', 'MonitoringEnabled'); const status = ready && get(ready, 'status') === 'True'; - if ( status !== get(this, 'isMonitoringReady') ) { + if ( status !== this.isMonitoringReady ) { set(this, 'isMonitoringReady', status); } })), active: computed('scope.currentProject.id', 'id', function() { - return get(this, 'scope.currentProject.id') === get(this, 'id'); + return get(this, 'scope.currentProject.id') === this.id; }), canSaveMonitor: computed('actionLinks.{editMonitoring,enableMonitoring}', 'enableProjectMonitoring', 'isSystemProject', function() { - if ( get(this, 'isSystemProject') ) { + if ( this.isSystemProject ) { return false; } - const action = get(this, 'enableProjectMonitoring') ? 'editMonitoring' : 'enableMonitoring'; + const action = this.enableProjectMonitoring ? 'editMonitoring' : 'enableMonitoring'; return !!this.hasAction(action) }), @@ -81,16 +81,16 @@ export default Resource.extend({ }), canSetDefault: computed('combinedState', 'isDefault', function() { - return get(this, 'combinedState') === 'active' && !get(this, 'isDefault'); + return this.combinedState === 'active' && !this.isDefault; }), isReady: computed('relevantState', 'cluster.isReady', function() { - return get(this, 'relevantState') === 'active' && get(this, 'cluster.isReady'); + return this.relevantState === 'active' && get(this, 'cluster.isReady'); }), actions: { edit() { - get(this, 'router').transitionTo('authenticated.cluster.projects.edit', get(this, 'id')); + this.router.transitionTo('authenticated.cluster.projects.edit', this.id); }, activate() { @@ -106,11 +106,11 @@ export default Resource.extend({ }, setAsDefault() { - set(get(this, 'prefs'), C.PREFS.PROJECT_DEFAULT, get(this, 'id')); + set(this.prefs, C.PREFS.PROJECT_DEFAULT, this.id); }, promptStop() { - get(this, 'modalService').toggleModal('modal-confirm-deactivate', { + this.modalService.toggleModal('modal-confirm-deactivate', { originalModel: this, action: 'deactivate' }); @@ -121,11 +121,11 @@ export default Resource.extend({ var promise = this._super.apply(this, arguments); return promise.then(() => { - if (get(this, 'active')) { + if (this.active) { window.location.href = window.location.href; // eslint-disable-line no-self-assign } }).catch((err) => { - get(this, 'growl').fromError('Error deleting', err); + this.growl.fromError('Error deleting', err); }); }, diff --git a/app/models/projectalertrule.js b/app/models/projectalertrule.js index 30210608ac..22c9fced21 100644 --- a/app/models/projectalertrule.js +++ b/app/models/projectalertrule.js @@ -15,12 +15,12 @@ const projectAlertRule = Resource.extend(Alert, { _targetType: 'pod', displayTargetType: computed('targetType', function() { - return get(this, 'intl').t(`alertPage.targetTypes.${ get(this, 'targetType') }`); + return this.intl.t(`alertPage.targetTypes.${ this.targetType }`); }), podName: computed('podRule.podId', function() { const id = get(this, 'podRule.podId'); - const pod = get(this, 'projectStore').all('pod').filterBy('id', id).get('firstObject'); + const pod = this.projectStore.all('pod').filterBy('id', id).get('firstObject'); if (!pod) { return null; @@ -31,7 +31,7 @@ const projectAlertRule = Resource.extend(Alert, { workloadName: computed('workloadRule.workloadId', function() { const id = get(this, 'workloadRule.workloadId'); - const workload = get(this, 'projectStore').all('workload').filterBy('id', id).get('firstObject'); + const workload = this.projectStore.all('workload').filterBy('id', id).get('firstObject'); if (!workload) { return null; @@ -41,8 +41,8 @@ const projectAlertRule = Resource.extend(Alert, { }), displayCondition: computed('metricRule', 'podRule.{condition,restartIntervalSeconds,restartTimes}', 'targetType', 'workloadRule.availablePercentage', function() { - const t = get(this, 'targetType'); - const intl = get(this, 'intl'); + const t = this.targetType; + const intl = this.intl; let out = intl.t('alertPage.na'); @@ -50,7 +50,7 @@ const projectAlertRule = Resource.extend(Alert, { const interval = get(this, 'podRule.restartIntervalSeconds'); const c = get(this, 'podRule.condition'); const percent = get(this, 'workloadRule.availablePercentage'); - const metricRule = get(this, 'metricRule') + const metricRule = this.metricRule switch (t) { case 'pod': @@ -100,10 +100,10 @@ const projectAlertRule = Resource.extend(Alert, { actions: { clone() { - get(this, 'router').transitionTo('authenticated.project.alert.new-rule', get(this, 'groupId'), { queryParams: { id: get(this, 'id'), } }); + this.router.transitionTo('authenticated.project.alert.new-rule', this.groupId, { queryParams: { id: this.id, } }); }, edit() { - get(this, 'router').transitionTo('authenticated.project.alert.edit-rule', get(this, 'groupId'), get(this, 'id')); + this.router.transitionTo('authenticated.project.alert.edit-rule', this.groupId, this.id); }, }, diff --git a/app/models/projectroletemplatebinding.js b/app/models/projectroletemplatebinding.js index d2379b364e..2208d19773 100644 --- a/app/models/projectroletemplatebinding.js +++ b/app/models/projectroletemplatebinding.js @@ -11,23 +11,23 @@ export default Resource.extend(PrincipalReference, { roleTemplate: reference('roleTemplateId'), user: reference('userId', 'user'), displayName: computed('name', 'id', function() { - let name = get(this, 'name'); + let name = this.name; if ( name ) { return name; } - return `(${ get(this, 'id') })`; + return `(${ this.id })`; }), isCustom: computed('roleTemplateId', function() { - return !C.BASIC_ROLE_TEMPLATE_ROLES.includes(get(this, 'roleTemplateId')); + return !C.BASIC_ROLE_TEMPLATE_ROLES.includes(this.roleTemplateId); }), principalId: computed('userPrincipalId', 'groupPrincipalId', function() { - return get(this, 'groupPrincipalId') || get(this, 'userPrincipalId') || null; + return this.groupPrincipalId || this.userPrincipalId || null; }), canRemove: computed('links.remove', 'name', function() { - return !!get(this, 'links.remove') && get(this, 'name') !== 'creator'; + return !!get(this, 'links.remove') && this.name !== 'creator'; }), }); diff --git a/app/models/publicendpoint.js b/app/models/publicendpoint.js index 2e4f9b7428..c004bc411a 100644 --- a/app/models/publicendpoint.js +++ b/app/models/publicendpoint.js @@ -43,25 +43,25 @@ var PublicEndpoint = Resource.extend({ settings: service(), portProto: computed('port', 'protocol', function() { - let out = `${ get(this, 'port') }/${ get(this, 'protocol').toLowerCase() }`; + let out = `${ this.port }/${ this.protocol.toLowerCase() }`; return out; }), // ip:port endpoint: computed('addresses', 'allNodes', 'hostname', 'isIngress', 'port', 'scope.currentCluster.id', function() { - const addresses = get(this, 'addresses'); - const allNodes = get(this, 'allNodes'); - const hostname = get(this, 'hostname') || ''; + const addresses = this.addresses; + const allNodes = this.allNodes; + const hostname = this.hostname || ''; let out = ''; - if (get(this, 'isIngress') && hostname !== '' ) { + if (this.isIngress && hostname !== '' ) { out = hostname; } else if ( addresses && addresses.length ) { out = addresses[0]; } else if ( allNodes ) { - const globalStore = get(this, 'globalStore'); + const globalStore = this.globalStore; const nodes = globalStore.all('node').filterBy('clusterId', get(this, 'scope.currentCluster.id')); let node = nodes.findBy('externalIpAddress'); @@ -76,7 +76,7 @@ var PublicEndpoint = Resource.extend({ } if (out) { - out += `:${ get(this, 'port') }`; + out += `:${ this.port }`; } return out; @@ -84,7 +84,7 @@ var PublicEndpoint = Resource.extend({ // port[/udp] displayEndpoint: computed('port', 'protocol', 'path', function() { - let path = get(this, 'path') || ''; + let path = this.path || ''; if ( path && path !== '/' ) { return path; @@ -92,8 +92,8 @@ var PublicEndpoint = Resource.extend({ let out = ''; - out += get(this, 'port'); - let proto = get(this, 'protocol').toLowerCase(); + out += this.port; + let proto = this.protocol.toLowerCase(); out += `/${ proto }`; @@ -101,18 +101,18 @@ var PublicEndpoint = Resource.extend({ }), linkEndpoint: computed('displayEndpoint', 'endpoint', 'isIngress', 'isMaybeSecure', 'isTcpish', 'path', 'port', function() { - let path = get(this, 'path') || ''; + let path = this.path || ''; - if (get(this, 'isTcpish') && get(this, 'port') > 0 ) { - let out = get(this, 'endpoint'); + if (this.isTcpish && this.port > 0 ) { + let out = this.endpoint; - if (get(this, 'isMaybeSecure')) { + if (this.isMaybeSecure) { out = `https://${ out.replace(/:443$/, '') }`; } else { out = `http://${ out.replace(/:80$/, '') }`; } - if (get(this, 'isIngress')) { + if (this.isIngress) { out = out + path; } @@ -123,26 +123,26 @@ var PublicEndpoint = Resource.extend({ }), isTcpish: computed('protocol', function() { - const proto = get(this, 'protocol').toLowerCase(); + const proto = this.protocol.toLowerCase(); return ( ['tcp', 'http', 'https'].includes(proto) ); }), isMaybeSecure: computed('port', 'protocol', function() { - const proto = get(this, 'protocol').toLowerCase(); + const proto = this.protocol.toLowerCase(); - return portMatch([get(this, 'port')], [443, 8443], '443') || proto === 'https'; + return portMatch([this.port], [443, 8443], '443') || proto === 'https'; }), isIngress: computed('ingressId', function(){ - return get(this, 'ingressId') !== '' && get(this, 'ingressId') !== null; + return this.ingressId !== '' && this.ingressId !== null; }), isReady: computed('hostname', 'isIngress', function(){ const xip = get(this, `settings.${ C.SETTING.INGRESS_IP_DOMAIN }`); - const hostname = get(this, 'hostname') || ''; + const hostname = this.hostname || ''; - if ( get(this, 'isIngress') ){ + if ( this.isIngress ){ if ( xip === hostname ){ return false } diff --git a/app/models/roletemplate.js b/app/models/roletemplate.js index aadb99b2bf..dc17670371 100644 --- a/app/models/roletemplate.js +++ b/app/models/roletemplate.js @@ -12,36 +12,36 @@ export default Resource.extend({ canClone: true, state: computed('locked', function() { - return get(this, 'locked') ? 'locked' : 'active'; + return this.locked ? 'locked' : 'active'; }), isCustom: computed('id', 'roleTemplateId', function() { - return !C.BASIC_ROLE_TEMPLATE_ROLES.includes(get(this, 'id')); + return !C.BASIC_ROLE_TEMPLATE_ROLES.includes(this.id); }), displayName: computed('name', 'id', function() { - let name = get(this, 'name'); + let name = this.name; if ( name ) { return name; } - return `(${ get(this, 'id') })`; + return `(${ this.id })`; }), canRemove: computed('links.remove', 'builtin', function() { - return !!get(this, 'links.remove') && !get(this, 'builtin'); + return !!get(this, 'links.remove') && !this.builtin; }), actions: { edit() { - get(this, 'router').transitionTo('global-admin.security.roles.edit', get(this, 'id')); + this.router.transitionTo('global-admin.security.roles.edit', this.id); }, clone() { - get(this, 'router').transitionTo('global-admin.security.roles.new', { + this.router.transitionTo('global-admin.security.roles.new', { queryParams: { - id: get(this, 'id'), - context: get(this, 'context') + id: this.id, + context: this.context } }); } @@ -50,7 +50,7 @@ export default Resource.extend({ delete() { const self = this; const sup = self._super; - const roleTemplateService = get(this, 'roleTemplateService') + const roleTemplateService = this.roleTemplateService let canDelete = true const roleNames = [] @@ -71,12 +71,12 @@ export default Resource.extend({ if (canDelete) { return sup.apply(self, arguments); } else { - return get(this, 'growl').error(get(this, 'intl').t('rolesPage.index.errors.inherited', { - displayName: get(this, 'displayName'), + return this.growl.error(this.intl.t('rolesPage.index.errors.inherited', { + displayName: this.displayName, roleNames: roleNames.join(','), })); } - }) + }); }, }); diff --git a/app/models/scalehost.js b/app/models/scalehost.js index 72dae5b188..aced0393c8 100644 --- a/app/models/scalehost.js +++ b/app/models/scalehost.js @@ -3,7 +3,7 @@ import { computed } from '@ember/object'; export default Resource.extend({ hostSelectorStr: computed('hostSelector', function() { - let all = this.get('hostSelector') || []; + let all = this.hostSelector || []; return Object.keys(all).map((key) => { let val = all[key]; @@ -15,8 +15,8 @@ export default Resource.extend({ validationErrors() { let errors = this._super(...arguments); - let min = parseInt(this.get('min'), 10); - let max = parseInt(this.get('max'), 10); + let min = parseInt(this.min, 10); + let max = parseInt(this.max, 10); if ( min && max && min > max ) { errors.push('"Minimum Scale" cannot be greater than "Maximum Scale"'); diff --git a/app/models/secret.js b/app/models/secret.js index 98c598fe84..8c74da2214 100644 --- a/app/models/secret.js +++ b/app/models/secret.js @@ -12,16 +12,16 @@ export default Resource.extend({ canHaveLabels: true, firstKey: alias('keys.firstObject'), keys: computed('data', function() { - return Object.keys(get(this, 'data') || {}).sort(); + return Object.keys(this.data || {}).sort(); }), workloads: computed('allWorkloads.list.@each.{containers,volumes}', 'name', 'namespaceId', function() { return (get(this, 'allWorkloads.list') || []).map((item) => item.obj).filter((workload) => { - if ( get(this, 'namespaceId') && get(workload, 'namespaceId') !== get(this, 'namespaceId')) { + if ( this.namespaceId && get(workload, 'namespaceId') !== this.namespaceId) { return false; } - const volume = (get(workload, 'volumes') || []).find((volume) => get(volume, 'secret.secretName') === get(this, 'name')); - const env = (get(workload, 'containers') || []).find((container) => (get(container, 'environmentFrom') || []).find((env) => get(env, 'source') === 'secret' && get(env, 'sourceName') === get(this, 'name'))); + const volume = (get(workload, 'volumes') || []).find((volume) => get(volume, 'secret.secretName') === this.name); + const env = (get(workload, 'containers') || []).find((container) => (get(container, 'environmentFrom') || []).find((env) => get(env, 'source') === 'secret' && get(env, 'sourceName') === this.name)); return volume || env; }); @@ -29,14 +29,14 @@ export default Resource.extend({ actions: { edit() { - get(this, 'router').transitionTo('authenticated.project.secrets.detail.edit', get(this, 'id')); + this.router.transitionTo('authenticated.project.secrets.detail.edit', this.id); }, clone() { - get(this, 'router').transitionTo('authenticated.project.secrets.new', { + this.router.transitionTo('authenticated.project.secrets.new', { queryParams: { - id: get(this, 'id'), - type: get(this, 'type') + id: this.id, + type: this.type } }); } diff --git a/app/models/service.js b/app/models/service.js index 8e503c1768..5e6365d197 100644 --- a/app/models/service.js +++ b/app/models/service.js @@ -33,14 +33,14 @@ var Service = Resource.extend(EndpointPorts, { isIngress: equal('ownerReferences.firstObject.kind', 'Ingress'), selectedPods: computed('selector', 'store', function() { - const rules = get(this, 'selector'); + const rules = this.selector; let keys = Object.keys(rules); if ( !keys.length ) { return []; } - let pods = get(this, 'store').all('pod'); + let pods = this.store.all('pod'); let key; for ( let i = 0 ; pods.length > 0 && i < keys.length ; i++ ) { @@ -52,16 +52,16 @@ var Service = Resource.extend(EndpointPorts, { }), nameWithType: computed('displayName', 'recordType', 'intl.locale', function() { - const name = get(this, 'displayName'); - const recordType = get(this, 'recordType'); - const type = get(this, 'intl').t(`dnsPage.type.${ recordType }`); + const name = this.displayName; + const recordType = this.recordType; + const type = this.intl.t(`dnsPage.type.${ recordType }`); return `${ name } (${ type })`; }), availablePorts: computed('recordType', 'ports.@each.{targetPort,port}', function() { const list = []; - const ports = get(this, 'ports'); + const ports = this.ports; ports.forEach((p) => { list.push(p.targetPort.toString()); @@ -83,7 +83,7 @@ var Service = Resource.extend(EndpointPorts, { return ARECORD; } - if ( get(this, 'hostname') ) { + if ( this.hostname ) { return CNAME; } @@ -95,13 +95,13 @@ var Service = Resource.extend(EndpointPorts, { return WORKLOAD; } - const selector = get(this, 'selector'); + const selector = this.selector; if ( selector && Object.keys(selector).length ) { return SELECTOR; } - if ( get(this, 'clusterIp') ) { + if ( this.clusterIp ) { return CLUSTERIP; } @@ -109,19 +109,19 @@ var Service = Resource.extend(EndpointPorts, { }), displayType: computed('recordType', 'intl.locale', function() { - return get(this, 'intl').t(`dnsPage.type.${ get(this, 'recordType') }`); + return this.intl.t(`dnsPage.type.${ this.recordType }`); }), displayTarget: computed('clusterIp', 'hostname', 'ipAddresses.[]', 'recordType', 'selector', 'targetDnsRecords.[]', 'targetWorkloads.[]', function() { - const selectors = get(this, 'selector') || {}; - const records = get(this, 'targetDnsRecords') || []; - const workloads = get(this, 'targetWorkloads') || {}; + const selectors = this.selector || {}; + const records = this.targetDnsRecords || []; + const workloads = this.targetWorkloads || {}; - switch ( get(this, 'recordType') ) { + switch ( this.recordType ) { case ARECORD: - return get(this, 'ipAddresses').join('\n'); + return this.ipAddresses.join('\n'); case CNAME: - return get(this, 'hostname'); + return this.hostname; case SELECTOR: return Object.keys(selectors).map((k) => `${ k }=${ selectors[k] }`) .join('\n'); @@ -130,14 +130,14 @@ var Service = Resource.extend(EndpointPorts, { case WORKLOAD: return workloads.map((x) => get(x, 'displayName')).join('\n'); case CLUSTERIP: - return get(this, 'clusterIp'); + return this.clusterIp; default: return 'Unknown'; } }), selectorArray: computed('selector', function() { - const selectors = get(this, 'selector') || {}; + const selectors = this.selector || {}; const out = []; Object.keys(selectors).map((k) => { @@ -151,17 +151,17 @@ var Service = Resource.extend(EndpointPorts, { }), canEdit: computed('links.update', 'isIngress', function() { - return !!get(this, 'links.update') && !get(this, 'isIngress'); + return !!get(this, 'links.update') && !this.isIngress; }), canRemove: computed('links.remove', 'isIngress', function() { - return !!get(this, 'links.remove') && !get(this, 'isIngress'); + return !!get(this, 'links.remove') && !this.isIngress; }), displayKind: computed('intl.locale', 'kind', function() { - const intl = get(this, 'intl'); + const intl = this.intl; - if ( get(this, 'kind') === 'LoadBalancer' ) { + if ( this.kind === 'LoadBalancer' ) { return intl.t('model.service.displayKind.loadBalancer'); } else { return intl.t('model.service.displayKind.generic'); @@ -170,17 +170,17 @@ var Service = Resource.extend(EndpointPorts, { proxyEndpoints: computed('labels', 'name', 'namespaceId', 'ports', 'scope.currentCluster.id', function(){ const parts = [] - const labels = get(this, 'labels'); + const labels = this.labels; const location = window.location; if ( labels && labels['kubernetes.io/cluster-service'] === 'true' ) { - (get(this, 'ports') || []).forEach((port) => { - let linkEndpoint = `${ location.origin }/k8s/clusters/${ get(this, 'scope.currentCluster.id') }/api/v1/namespaces/${ get(this, 'namespaceId') }/services/`; + (this.ports || []).forEach((port) => { + let linkEndpoint = `${ location.origin }/k8s/clusters/${ get(this, 'scope.currentCluster.id') }/api/v1/namespaces/${ this.namespaceId }/services/`; if ( get(port, 'name') === 'http' || get(port, 'name') === 'https' ) { linkEndpoint += `${ get(port, 'name') }:`; } - linkEndpoint += `${ get(this, 'name') }:${ get(port, 'port') }/proxy/`; + linkEndpoint += `${ this.name }:${ get(port, 'port') }/proxy/`; parts.push({ linkEndpoint, @@ -197,11 +197,11 @@ var Service = Resource.extend(EndpointPorts, { actions: { edit() { - get(this, 'router').transitionTo('authenticated.project.dns.detail.edit', this.get('id')); + this.router.transitionTo('authenticated.project.dns.detail.edit', this.id); }, clone() { - get(this, 'router').transitionTo('authenticated.project.dns.new', this.get('projectId'), { queryParams: { id: this.get('id') } }); + this.router.transitionTo('authenticated.project.dns.new', this.projectId, { queryParams: { id: this.id } }); }, }, diff --git a/app/models/setting.js b/app/models/setting.js index 71e0b0c022..b2d3e92857 100644 --- a/app/models/setting.js +++ b/app/models/setting.js @@ -12,15 +12,15 @@ export default Resource.extend({ canRemove: false, isDefault: computed('value', 'default', function() { - return get(this, 'default') === get(this, 'value'); + return this['default'] === this.value; }), canRevert: computed('default', 'isDefault', function() { - return !isEmpty(get(this, 'default')) && !get(this, 'isDefault'); + return !isEmpty(this['default']) && !this.isDefault; }), canEdit: computed('links.update', 'id', function() { - const id = get(this, 'id'); + const id = this.id; return !!get(this, 'links.update') && id !== 'cacerts'; }), @@ -31,7 +31,7 @@ export default Resource.extend({ label: 'action.revert', icon: 'icon icon-history', action: 'revert', - enabled: get(this, 'canRevert'), + enabled: this.canRevert, altAction: 'bypassRevert' }, ]; @@ -39,13 +39,13 @@ export default Resource.extend({ allowed: C.SETTING.ALLOWED, actions: { edit() { - let key = get(this, 'id'); - let obj = this.get('settings').findByName(key); - let details = this.get('allowed')[key]; + let key = this.id; + let obj = this.settings.findByName(key); + let details = this.allowed[key]; - this.get('modalService').toggleModal('modal-edit-setting', { + this.modalService.toggleModal('modal-edit-setting', { key, - descriptionKey: `dangerZone.description.${ get(this, 'id') }`, + descriptionKey: `dangerZone.description.${ this.id }`, kind: details.kind, options: details.options, canDelete: obj && !obj.get('isDefault'), @@ -54,16 +54,16 @@ export default Resource.extend({ }, revert() { - let key = get(this, 'id'); - let details = this.get('allowed')[key]; + let key = this.id; + let details = this.allowed[key]; - this.get('modalService').toggleModal('modal-revert-setting', { + this.modalService.toggleModal('modal-revert-setting', { setting: this, kind: details.kind, }); }, bypassRevert() { - set(this, 'value', get(this, 'default') || ''); + set(this, 'value', this['default'] || ''); this.save(); }, diff --git a/app/models/sourcecodecredential.js b/app/models/sourcecodecredential.js index b6b13f689b..e1fa719a72 100644 --- a/app/models/sourcecodecredential.js +++ b/app/models/sourcecodecredential.js @@ -1,15 +1,9 @@ import Resource from '@rancher/ember-api-store/models/resource'; -import { get, computed } from '@ember/object'; +import { computed } from '@ember/object'; export default Resource.extend({ - type: 'sourcecodecredential', - username: computed('displayName', function(){ - return get(this, 'displayName'); - }), - profilePicture: computed('avatarUrl', function(){ - return get(this, 'avatarUrl'); - }), - profileUrl: computed('htmlUrl', function(){ - return get(this, 'htmlUrl'); - }), + type: 'sourcecodecredential', + username: computed.reads('displayName'), + profilePicture: computed.reads('avatarUrl'), + profileUrl: computed.reads('htmlUrl'), }); diff --git a/app/models/storageclass.js b/app/models/storageclass.js index 4f46a66c9e..2e6aae25f6 100644 --- a/app/models/storageclass.js +++ b/app/models/storageclass.js @@ -1,5 +1,5 @@ import Resource from '@rancher/ember-api-store/models/resource'; -import { get, set, computed } from '@ember/object'; +import { set, computed } from '@ember/object'; import { inject as service } from '@ember/service'; import { all } from 'rsvp'; import C from 'ui/utils/constants'; @@ -56,14 +56,14 @@ export default Resource.extend({ state: 'active', isDefault: computed('annotations', function() { - const annotations = get(this, 'annotations') || {}; + const annotations = this.annotations || {}; return annotations[DEFAULT_ANNOTATION] === 'true' || annotations[BETA_ANNOTATION] === 'true'; }), availableActions: computed('isDefault', function() { - const isDefault = get(this, 'isDefault'); + const isDefault = this.isDefault; let out = [ { @@ -84,8 +84,8 @@ export default Resource.extend({ }), displayProvisioner: computed('provisioner', 'intl.locale', function() { - const intl = get(this, 'intl'); - const provisioner = get(this, 'provisioner'); + const intl = this.intl; + const provisioner = this.provisioner; const entry = PROVISIONERS.findBy('value', provisioner) if ( provisioner && entry ) { @@ -100,7 +100,7 @@ export default Resource.extend({ }), actions: { makeDefault() { - const cur = get(this, 'clusterStore').all('storageClass') + const cur = this.clusterStore.all('storageClass') .filterBy('isDefault', true); const promises = []; @@ -118,12 +118,12 @@ export default Resource.extend({ }, edit() { - get(this, 'router').transitionTo('authenticated.cluster.storage.classes.detail.edit', get(this, 'id')); + this.router.transitionTo('authenticated.cluster.storage.classes.detail.edit', this.id); }, }, setDefault(on) { - let annotations = get(this, 'annotations'); + let annotations = this.annotations; if ( !annotations ) { annotations = {}; diff --git a/app/models/template.js b/app/models/template.js index 5c768b4be8..42344056b6 100644 --- a/app/models/template.js +++ b/app/models/template.js @@ -16,7 +16,7 @@ const Template = Resource.extend({ projectCatalog: reference('projectCatalogId'), latestVersion: computed('versionLinks', function() { - const links = get(this, 'versionLinks'); + const links = this.versionLinks; return get(Object.keys(links || {}).sort((a, b) => compareVersion(a, b)), 'lastObject'); }), @@ -30,7 +30,7 @@ const Template = Resource.extend({ }), isIstio: computed('labels', function() { - const labels = get(this, 'labels') || {}; + const labels = this.labels || {}; return labels[C.LABEL_ISTIO_RULE] === 'true'; }), @@ -77,10 +77,10 @@ const Template = Resource.extend({ }), categoryArray: computed('category', 'categories.[]', function() { - let out = get(this, 'categories'); + let out = this.categories; if ( !out || !out.length ) { - let single = get(this, 'category'); + let single = this.category; if ( single ) { out = [single]; @@ -93,18 +93,18 @@ const Template = Resource.extend({ }), categoryLowerArray: computed('categoryArray.[]', function() { - return get(this, 'categoryArray').map((x) => (x || '').underscore().toLowerCase()); + return this.categoryArray.map((x) => (x || '').underscore().toLowerCase()); }), certifiedType: computed('catalogId', 'labels', function() { let str = null; - let labels = get(this, 'labels'); + let labels = this.labels; if ( labels && labels[C.LABEL.CERTIFIED] ) { str = labels[C.LABEL.CERTIFIED]; } - if ( str === C.LABEL.CERTIFIED_RANCHER && get(this, 'catalogId') === C.CATALOG.LIBRARY_KEY ) { + if ( str === C.LABEL.CERTIFIED_RANCHER && this.catalogId === C.CATALOG.LIBRARY_KEY ) { return 'rancher'; } else if ( str === C.LABEL.CERTIFIED_PARTNER ) { return 'partner'; @@ -114,7 +114,7 @@ const Template = Resource.extend({ }), certifiedClass: computed('certifiedType', 'settings.isRancher', function() { - let type = get(this, 'certifiedType'); + let type = this.certifiedType; if ( type === 'rancher' && get(this, 'settings.isRancher') ) { return 'badge-rancher-logo'; @@ -125,7 +125,7 @@ const Template = Resource.extend({ certified: computed('catalogId', 'certifiedType', 'intl.locale', 'labels', 'settings.isRancher', function() { let out = null; - let labels = get(this, 'labels'); + let labels = this.labels; if ( labels && labels[C.LABEL.CERTIFIED] ) { out = labels[C.LABEL.CERTIFIED]; @@ -134,12 +134,12 @@ const Template = Resource.extend({ let looksLikeCertified = false; if ( out ) { - let display = get(this, 'intl').t('catalogPage.index.certified.rancher.rancher'); + let display = this.intl.t('catalogPage.index.certified.rancher.rancher'); looksLikeCertified = normalize(out) === normalize(display); } - if ( get(this, 'catalogId') !== C.CATALOG.LIBRARY_KEY && (out === C.LABEL.CERTIFIED_RANCHER || looksLikeCertified) ) { + if ( this.catalogId !== C.CATALOG.LIBRARY_KEY && (out === C.LABEL.CERTIFIED_RANCHER || looksLikeCertified) ) { // Rancher-certified things can only be in the library catalog. out = null; } @@ -152,7 +152,7 @@ const Template = Resource.extend({ pl = 'rancher'; } - return get(this, 'intl').t(`catalogPage.index.certified.${ pl }.${ out }`); + return this.intl.t(`catalogPage.index.certified.${ pl }.${ out }`); } // For custom strings, use what they said. diff --git a/app/models/templateversion.js b/app/models/templateversion.js index 3f52c3bc56..7798eeea39 100644 --- a/app/models/templateversion.js +++ b/app/models/templateversion.js @@ -33,7 +33,7 @@ export default Resource.extend({ }), filesAsArray: computed('files', function() { - var obj = (get(this, 'files') || {}); + var obj = (this.files || {}); var out = []; Object.keys(obj).forEach((key) => { @@ -48,7 +48,7 @@ export default Resource.extend({ allQuestions: computed('questions', function() { const out = []; - const originQuestions = get(this, 'questions') || []; + const originQuestions = this.questions || []; originQuestions.forEach((q) => { out.push(q); diff --git a/app/models/token.js b/app/models/token.js index 3ca082d47a..8608020328 100644 --- a/app/models/token.js +++ b/app/models/token.js @@ -1,5 +1,5 @@ import Resource from '@rancher/ember-api-store/models/resource'; -import { get, computed, set } from '@ember/object'; +import { computed, set } from '@ember/object'; import { next } from '@ember/runloop' import { inject as service } from '@ember/service'; @@ -7,7 +7,7 @@ export default Resource.extend({ growl: service(), state: computed('expired', function() { - if ( get(this, 'expired') ) { + if ( this.expired ) { return 'expired'; } @@ -42,7 +42,7 @@ export default Resource.extend({ set(this, 'enabled', false); this.save().catch((err) => { set(this, 'enabled', true); - get(this, 'growl').fromError('Error deactivating token', err) + this.growl.fromError('Error deactivating token', err) }); }); }, @@ -52,7 +52,7 @@ export default Resource.extend({ set(this, 'enabled', true); this.save().catch((err) => { set(this, 'enabled', false); - get(this, 'growl').fromError('Error activating token', err) + this.growl.fromError('Error activating token', err) }); }); }, diff --git a/app/models/user.js b/app/models/user.js index 4421e6e8fb..85a6c1000f 100644 --- a/app/models/user.js +++ b/app/models/user.js @@ -16,56 +16,56 @@ export default Resource.extend({ projectRoleBindings: hasMany('id', 'projectRoleTemplateBinding', 'userId'), combinedState: computed('enabled', 'state', function() { - if ( get(this, 'enabled') === false ) { + if ( this.enabled === false ) { return 'inactive'; } else { - return get(this, 'state'); + return this.state; } }), displayName: computed('name', 'username', 'id', function() { - let name = get(this, 'name'); + let name = this.name; if ( name ) { return name; } - name = get(this, 'username'); + name = this.username; if ( name ) { return name; } - return `(${ get(this, 'id') })`; + return `(${ this.id })`; }), avatarSrc: computed('id', function() { - return `data:image/png;base64,${ new Identicon(AWS.util.crypto.md5(this.get('id') || 'Unknown', 'hex'), 80, 0.01).toString() }`; + return `data:image/png;base64,${ new Identicon(AWS.util.crypto.md5(this.id || 'Unknown', 'hex'), 80, 0.01).toString() }`; }), hasAdmin: computed('globalRoleBindings.[]', function() { - return get(this, 'globalRoleBindings').findBy('globalRole.isAdmin', true); + return this.globalRoleBindings.findBy('globalRole.isAdmin', true); }), hasCustom: computed('globalRoleBindings.[]', function() { - return get(this, 'globalRoleBindings').findBy('globalRole.isCustom', true); + return this.globalRoleBindings.findBy('globalRole.isCustom', true); }), hasUser: computed('globalRoleBindings.[]', function() { - return get(this, 'globalRoleBindings').findBy('globalRole.isUser', true); + return this.globalRoleBindings.findBy('globalRole.isUser', true); }), hasBase: computed('globalRoleBindings.[]', function() { - return get(this, 'globalRoleBindings').findBy('globalRole.isBase', true); + return this.globalRoleBindings.findBy('globalRole.isBase', true); }), isMe: computed('access.principal.id', 'id', function() { - return get(this, 'access.principal.id') === get(this, 'id'); + return get(this, 'access.principal.id') === this.id; }), availableActions: computed('access.providers.[]', 'actionLinks', 'enabled', function() { - const on = get(this, 'enabled') !== false; + const on = this.enabled !== false; const { access } = this; - const a = get(this, 'actionLinks') || {}; + const a = this.actionLinks || {}; return [ { @@ -109,7 +109,7 @@ export default Resource.extend({ set(this, 'enabled', false); this.save().catch((err) => { set(this, 'enabled', true); - get(this, 'growl').fromError('Error deactivating user', err) + this.growl.fromError('Error deactivating user', err) }); }); }, @@ -119,7 +119,7 @@ export default Resource.extend({ set(this, 'enabled', true); this.save().catch((err) => { set(this, 'enabled', false); - get(this, 'growl').fromError('Error activating user', err) + this.growl.fromError('Error activating user', err) }); }); }, diff --git a/app/models/volume.js b/app/models/volume.js index 1bdde03418..e44e593cb9 100644 --- a/app/models/volume.js +++ b/app/models/volume.js @@ -77,7 +77,7 @@ var Volume = Resource.extend({ type: 'volume', configName: computed('sources.@each.value', 'state', function() { - const keys = get(this, 'sources').map((x) => x.value); + const keys = this.sources.map((x) => x.value); for ( let key, i = 0 ; i < keys.length ; i++ ) { key = keys[i]; @@ -90,7 +90,7 @@ var Volume = Resource.extend({ }), config: computed('configName', function() { - const key = get(this, 'configName'); + const key = this.configName; if ( key ) { return get(this, key); @@ -100,7 +100,7 @@ var Volume = Resource.extend({ }), sourceName: computed('configName', 'sources', function(){ - const key = get(this, 'configName'); + const key = this.configName; if ( !key ) { return; @@ -108,7 +108,7 @@ var Volume = Resource.extend({ let entry; let driver = get(this, key).driver; - const sources = get(this, 'sources'); + const sources = this.sources; entry = sources.findBy('value', key); @@ -128,8 +128,8 @@ var Volume = Resource.extend({ }), displaySource: computed('csi.driver', 'intl.locale', 'sourceName', function() { - const intl = get(this, 'intl'); - const sourceName = get(this, 'sourceName'); + const intl = this.intl; + const sourceName = this.sourceName; if ( sourceName === 'csi' ) { return get(this, 'csi.driver') @@ -139,7 +139,7 @@ var Volume = Resource.extend({ }), clearSourcesExcept(keep) { - const keys = get(this, 'sources').map((x) => x.value); + const keys = this.sources.map((x) => x.value); for ( let key, i = 0 ; i < keys.length ; i++ ) { key = keys[i]; diff --git a/app/models/workload.js b/app/models/workload.js index 1d0fa7afa7..2eb99baab6 100644 --- a/app/models/workload.js +++ b/app/models/workload.js @@ -59,7 +59,7 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts restarts: computed('pods.@each.restarts', function() { let out = 0; - (get(this, 'pods') || []).forEach((pod) => { + (this.pods || []).forEach((pod) => { out += get(pod, 'restarts'); }); @@ -67,22 +67,22 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts }), lcType: computed('type', function() { - return (get(this, 'type') || '').toLowerCase(); + return (this.type || '').toLowerCase(); }), canEdit: computed('links.update', 'lcType', function() { - const lcType = get(this, 'lcType'); + const lcType = this.lcType; return !!get(this, 'links.update') && ( lcType !== 'job' ); }), availableActions: computed('actionLinks.{activate,deactivate,pause,restart,rollback,garbagecollect}', 'links.{update,remove}', 'podForShell', 'isPaused', 'canEdit', function() { - const a = get(this, 'actionLinks') || {}; + const a = this.actionLinks || {}; - const podForShell = get(this, 'podForShell'); + const podForShell = this.podForShell; - const isPaused = get(this, 'isPaused'); - const canEdit = get(this, 'canEdit'); + const isPaused = this.isPaused; + const canEdit = this.canEdit; let choices = [ { @@ -133,18 +133,18 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts }), displayType: computed('type', function() { - let type = this.get('type'); + let type = this.type; - return get(this, 'intl').t(`servicePage.serviceType.${ type }`); + return this.intl.t(`servicePage.serviceType.${ type }`); }), sortName: computed('displayName', function() { - return sortableNumericSuffix(get(this, 'displayName')); + return sortableNumericSuffix(this.displayName); }), combinedState: computed('state', 'healthState', function() { - var service = get(this, 'state'); - var health = get(this, 'healthState'); + var service = this.state; + var health = this.healthState; if ( service === 'active' && health ) { // Return the health state for active services @@ -156,25 +156,25 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts }), isGlobalScale: computed('lcType', function() { - let lcType = get(this, 'lcType'); + let lcType = this.lcType; return lcType === 'daemonset'; }), canScaleDown: computed('canScale', 'scale', function() { - return get(this, 'canScale') && get(this, 'scale') > 0; + return this.canScale && this.scale > 0; }), displayScale: computed('scale', 'isGlobalScale', 'lcType', function() { - if ( get(this, 'isGlobalScale') ) { - return get(this, 'intl').t('servicePage.multistat.daemonSetScale'); + if ( this.isGlobalScale ) { + return this.intl.t('servicePage.multistat.daemonSetScale'); } else { - return get(this, 'scale'); + return this.scale; } }), canScale: computed('lcType', function() { - let lcType = get(this, 'lcType'); + let lcType = this.lcType; return lcType !== 'cronjob' && lcType !== 'daemonset' && lcType !== 'job'; }), @@ -192,15 +192,15 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts }), podForShell: computed('pods.@each.canShell', function() { - return get(this, 'pods').findBy('canShell', true); + return this.pods.findBy('canShell', true); }), secondaryLaunchConfigs: computed('containers.[]', function() { - return (get(this, 'containers') || []).slice(1); + return (this.containers || []).slice(1); }), isCreatedByRancher: computed('workloadAnnotations', function() { - const workloadAnnotations = get(this, 'workloadAnnotations') || {}; + const workloadAnnotations = this.workloadAnnotations || {}; return !!workloadAnnotations[C.LABEL.CREATOR_ID]; }), @@ -233,7 +233,7 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts }, rollback() { - get(this, 'modalService').toggleModal('modal-rollback-service', { originalModel: this }); + this.modalService.toggleModal('modal-rollback-service', { originalModel: this }); }, garbageCollect() { @@ -252,16 +252,16 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts }, promptStop() { - get(this, 'modalService').toggleModal('modal-container-stop', { model: [this] }); + this.modalService.toggleModal('modal-container-stop', { model: [this] }); }, scaleUp() { - set(this, 'scale', get(this, 'scale') + 1); + set(this, 'scale', this.scale + 1); this.saveScale(); }, scaleDown() { - let scale = get(this, 'scale'); + let scale = this.scale; scale -= 1; scale = Math.max(scale, 0); @@ -272,22 +272,22 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts edit(upgradeImage = 'false') { var route = 'containers.run'; - if ( get(this, 'lcType') === 'loadbalancerservice' ) { + if ( this.lcType === 'loadbalancerservice' ) { route = 'balancers.run'; } - get(this, 'router').transitionTo(route, { + this.router.transitionTo(route, { queryParams: { - workloadId: get(this, 'id'), + workloadId: this.id, upgrade: true, upgradeImage, - namespaceId: get(this, 'namespaceId'), + namespaceId: this.namespaceId, } }); }, clone() { - get(this, 'router').transitionTo('containers.run', { queryParams: { workloadId: get(this, 'id'), } }); + this.router.transitionTo('containers.run', { queryParams: { workloadId: this.id, } }); }, redeploy() { @@ -300,22 +300,22 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts }, addSidekick() { - get(this, 'router').transitionTo('containers.run', { + this.router.transitionTo('containers.run', { queryParams: { - workloadId: get(this, 'id'), + workloadId: this.id, addSidekick: true, } }); }, shell() { - get(this, 'modalService').toggleModal('modal-shell', { model: get(this, 'podForShell'), }); + this.modalService.toggleModal('modal-shell', { model: this.podForShell, }); }, popoutShell() { const projectId = get(this, 'scope.currentProject.id'); const podId = get(this, 'podForShell.id'); - const route = get(this, 'router').urlFor('authenticated.project.console', projectId); + const route = this.router.urlFor('authenticated.project.console', projectId); const system = get(this, 'podForShell.node.info.os.operatingSystem') || '' let windows = false; @@ -333,7 +333,7 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts }, updateTimestamp() { - let obj = get(this, 'annotations'); + let obj = this.annotations; if ( !obj ) { obj = {}; @@ -344,14 +344,14 @@ var Workload = Resource.extend(Grafana, DisplayImage, StateCounts, EndpointPorts }, saveScale() { - if ( get(this, 'scaleTimer') ) { - cancel(get(this, 'scaleTimer')); + if ( this.scaleTimer ) { + cancel(this.scaleTimer); } - const scale = get(this, 'scale'); + const scale = this.scale; var timer = later(this, function() { this.save({ data: { scale } }).catch((err) => { - get(this, 'growl').fromError('Error updating scale', err); + this.growl.fromError('Error updating scale', err); }); }, 500); diff --git a/app/not-found/controller.js b/app/not-found/controller.js index 473db2e6c1..f4c488f399 100644 --- a/app/not-found/controller.js +++ b/app/not-found/controller.js @@ -11,7 +11,7 @@ export default Controller.extend({ const looped = window.location.href === target; if (looped || get(this, 'app.environment') === 'development') { - const router = get(this, 'router'); + const router = this.router; router.transitionTo('authenticated'); } else { diff --git a/app/not-found/route.js b/app/not-found/route.js index f6bd8309b7..021cb20ea9 100644 --- a/app/not-found/route.js +++ b/app/not-found/route.js @@ -5,7 +5,7 @@ export default Route.extend({ language: service('user-language'), beforeModel() { - return this.get('language').initLanguage(); + return this.language.initLanguage(); }, redirect() { diff --git a/app/pod-graphs/route.js b/app/pod-graphs/route.js index 7729ac75d3..fe425c3854 100644 --- a/app/pod-graphs/route.js +++ b/app/pod-graphs/route.js @@ -1,4 +1,3 @@ -import { get } from '@ember/object'; import Route from '@ember/routing/route'; export default Route.extend({ @@ -6,7 +5,7 @@ export default Route.extend({ if (window.ShellQuote) { return; } else { - return import('shell-quote').then( (module) => { + return import('shell-quote').then( (module) => { // TODO: RC window.ShellQuote = module.default; return module.default; @@ -14,7 +13,7 @@ export default Route.extend({ } }, model(params) { - const pod = get(this, 'store').find('pod', params.pod_id); + const pod = this.store.find('pod', params.pod_id); if ( !pod ) { this.replaceWith('authenticated.project.index'); diff --git a/app/pod/route.js b/app/pod/route.js index 5009961472..b7ee2ddd4c 100644 --- a/app/pod/route.js +++ b/app/pod/route.js @@ -1,4 +1,3 @@ -import { get } from '@ember/object'; import Route from '@ember/routing/route'; export default Route.extend({ @@ -6,7 +5,7 @@ export default Route.extend({ if (window.ShellQuote) { return; } else { - return import('shell-quote').then( (module) => { + return import('shell-quote').then( (module) => { // TODO: RC window.ShellQuote = module.default; return module.default; @@ -14,7 +13,7 @@ export default Route.extend({ } }, model(params) { - const pod = get(this, 'store').find('pod', params.pod_id); + const pod = this.store.find('pod', params.pod_id); if ( !pod ) { this.replaceWith('authenticated.project.index'); diff --git a/app/router.js b/app/router.js index 091dba2507..b73107ce0b 100644 --- a/app/router.js +++ b/app/router.js @@ -11,7 +11,7 @@ const Router = EmberRouter.extend({ this.on('routeWillChange', ( /* transition */ ) => { if (get(this, 'modalService.modalVisible')) { - get(this, 'modalService').toggleModal(); + this.modalService.toggleModal(); } }); } diff --git a/app/signup/controller.js b/app/signup/controller.js index 062a08d6b7..1fac5cc9fe 100644 --- a/app/signup/controller.js +++ b/app/signup/controller.js @@ -16,7 +16,7 @@ export default Controller.extend({ fetch('/register-new', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(this.get('model')) + body: JSON.stringify(this.model) }).then(() => { this.set('saving', false); this.set('emailSent', true); @@ -30,7 +30,7 @@ export default Controller.extend({ }); }, cancel() { - if (this.get('errors')) { + if (this.errors) { this.set('errors', []); } this.transitionToRoute('login'); @@ -38,7 +38,7 @@ export default Controller.extend({ }, validate: observer('model.name', 'model.email', function() { if (this.get('model.name') && this.get('model.email')) { - if (this.get('errors')) { + if (this.errors) { this.set('errors', []); } this.set('saveDisabled', false); diff --git a/app/templates/-add-cluster.hbs b/app/templates/-add-cluster.hbs index e565e54ceb..585b6b53c9 100644 --- a/app/templates/-add-cluster.hbs +++ b/app/templates/-add-cluster.hbs @@ -1,16 +1,16 @@
- - {{input type="text" value=newHost.user }} + +
- - {{input type="text" value=newHost.advertisedHostname }} + +
- - {{textarea value=newHost.ssh classNames="form-control no-resize" rows="6"}} + +