From 4666d3d4225b4cf581ab7f048cd6f59fdd3af88a Mon Sep 17 00:00:00 2001 From: Vincent Fiduccia Date: Fri, 30 Sep 2016 17:04:17 -0700 Subject: [PATCH] Move machine into host --- app/applications-tab/route.js | 2 +- app/authenticated/controller.js | 4 +- .../project/waiting/controller.js | 4 +- app/authenticated/project/waiting/route.js | 2 +- app/authenticated/route.js | 1 - app/components/edit-host/template.hbs | 2 +- app/components/host-pod/component.js | 8 +- app/components/host-pod/template.hbs | 38 ++++----- .../machine/driver-aliyunecs/component.js | 2 +- .../machine/driver-amazonec2/component.js | 2 +- .../machine/driver-azure/component.js | 2 +- .../machine/driver-digitalocean/component.js | 19 ++--- .../machine/driver-exoscale/component.js | 2 +- .../machine/driver-other/component.js | 16 ++-- .../machine/driver-packet/component.js | 2 +- .../machine/driver-rackspace/component.js | 2 +- .../machine/driver-ubiquity/component.js | 2 +- .../machine/driver-vmwarevsphere/component.js | 2 +- .../wait-kubernetes/component.js | 2 +- .../orchestration/wait-mesos/component.js | 2 +- .../orchestration/wait-swarm/component.js | 2 +- app/host/template.hbs | 4 +- app/hosts/index/controller.js | 25 ------ app/hosts/index/route.js | 11 +-- app/hosts/index/template.hbs | 8 +- app/hosts/new/controller.js | 8 +- app/hosts/new/route.js | 4 +- app/hosts/route.js | 1 - app/k8s-tab/route.js | 2 +- app/mesos-tab/route.js | 2 +- app/mixins/cattle-transitioning-resource.js | 2 +- app/mixins/manage-labels.js | 2 +- app/models/host.js | 63 +++------------ app/models/machine.js | 79 ------------------- app/models/service.js | 2 +- app/services/catalog-service.js | 2 +- app/services/projects.js | 4 +- app/styles/base/_fonts.scss | 28 +++---- app/styles/pages/_loading.scss | 32 ++++---- app/swarm-tab/route.js | 2 +- app/utils/util.js | 8 +- package.json | 2 +- 42 files changed, 121 insertions(+), 288 deletions(-) delete mode 100644 app/models/machine.js diff --git a/app/applications-tab/route.js b/app/applications-tab/route.js index 92b6fff03..139ee9d74 100644 --- a/app/applications-tab/route.js +++ b/app/applications-tab/route.js @@ -12,7 +12,7 @@ export default Ember.Route.extend({ // Check for waiting only if cattle, because other orchestrations have system services menus that link here if ( !project.get('kubernetes') && !project.get('swarm') && !project.get('mesos') ) { - return this.get('projects').checkForWaiting(auth.get('hosts'),auth.get('machines')); + return this.get('projects').checkForWaiting(auth.get('hosts')); } }, diff --git a/app/authenticated/controller.js b/app/authenticated/controller.js index 8a8725335..c7d9ed5aa 100644 --- a/app/authenticated/controller.js +++ b/app/authenticated/controller.js @@ -24,8 +24,8 @@ export default Ember.Controller.extend({ }.property('model.stacks.@each.externalId'), hasHosts: function() { - return (this.get('model.hosts.length') > 0) || (this.get('model.machines.length') > 0); - }.property('model.{hosts,machines}'), + return (this.get('model.hosts.length') > 0); + }.property('model.hosts.length'), isReady: function() { return this.get('projects.isReady') && this.get('hasHosts'); diff --git a/app/authenticated/project/waiting/controller.js b/app/authenticated/project/waiting/controller.js index facb2f98b..d1af89656 100644 --- a/app/authenticated/project/waiting/controller.js +++ b/app/authenticated/project/waiting/controller.js @@ -10,8 +10,8 @@ export default Ember.Controller.extend({ }.property('projects.current.mesos'), hasHosts: function() { - return (this.get('model.hosts.length') + this.get('model.machines.length')) >= this.get('expectHosts'); - }.property('model.hosts.length','model.machines.length'), + return this.get('model.hosts.length') >= this.get('expectHosts'); + }.property('model.hosts.length'), actions: { kubernetesReady() { diff --git a/app/authenticated/project/waiting/route.js b/app/authenticated/project/waiting/route.js index d87112b88..ca4ed5768 100644 --- a/app/authenticated/project/waiting/route.js +++ b/app/authenticated/project/waiting/route.js @@ -22,7 +22,7 @@ export default Ember.Route.extend({ this.replaceWith('authenticated.project.index'); } } - else if ( (model.get('hosts.length') + model.get('machines.length')) > 0 && this.get('projects.isReady') ) + else if ( model.get('hosts.length') > 0 && this.get('projects.isReady') ) { this.replaceWith('authenticated.project.index'); } diff --git a/app/authenticated/route.js b/app/authenticated/route.js index f166d8557..d66c5ee8a 100644 --- a/app/authenticated/route.js +++ b/app/authenticated/route.js @@ -54,7 +54,6 @@ export default Ember.Route.extend(Subscribe, { projectSchemas: ['project', this.toCb('loadProjectSchemas')], orchestrationState: ['projectSchemas', this.toCb('updateOrchestration')], instances: ['projectSchemas', this.cbFind('instance')], - machines: ['projectSchemas', this.cbFind('machine')], services: ['projectSchemas', this.cbFind('service')], hosts: ['projectSchemas', this.cbFind('host')], stacks: ['projectSchemas', this.cbFind('stack')], diff --git a/app/components/edit-host/template.hbs b/app/components/edit-host/template.hbs index d4598d5aa..c250a2849 100644 --- a/app/components/edit-host/template.hbs +++ b/app/components/edit-host/template.hbs @@ -1,6 +1,5 @@

{{t 'editHost.title'}}

- {{top-errors errors=errors}}
@@ -44,4 +43,5 @@
+{{top-errors errors=errors}} {{save-cancel editing=editing save="save" cancel="cancel"}} diff --git a/app/components/host-pod/component.js b/app/components/host-pod/component.js index 70cbb9c32..a532fa708 100644 --- a/app/components/host-pod/component.js +++ b/app/components/host-pod/component.js @@ -9,7 +9,6 @@ export default Ember.Component.extend(ManageLabels, GroupedInstances, { show : null, classNames : ['pod','host'], - classNameBindings : ['isMachine:machine-host'], init() { this._super(...arguments); @@ -40,12 +39,9 @@ export default Ember.Component.extend(ManageLabels, GroupedInstances, { return this.get('filteredInstances').sortBy('name','id'); }.property('filteredInstances.@each.{name,id}'), - isMachine: Ember.computed.equal('model.type','machine'), isActive: Ember.computed.equal('model.state','active'), - - showAdd: function() { - return this.get('isActive') && !this.get('isMachine'); - }.property('isActive','isMachine'), + isProvisioning: Ember.computed.equal('model.state','provisioning'), + showAdd: Ember.computed.alias('isActive'), stateBackground: function() { return this.get('model.stateColor').replace("text-","bg-"); diff --git a/app/components/host-pod/template.hbs b/app/components/host-pod/template.hbs index ddd403df1..34a5d678a 100644 --- a/app/components/host-pod/template.hbs +++ b/app/components/host-pod/template.hbs @@ -4,33 +4,25 @@
{{action-menu model=model}}
- {{#if isMachine}} - {{model.displayName}} - {{else}} - {{model.displayName}} - {{#if model.showTransitioningMessage}} -
- {{model.transitioningMessage}} -
- {{/if}} + {{model.displayName}} + {{#if model.showTransitioningMessage}} +
+ {{model.transitioningMessage}} +
{{/if}}
-{{#if isMachine}} +{{#if isProvisioning}}
- {{#if isActive}} - {{format-html-message 'hostPod.machineInfo.active.activating'}} - {{else}} - {{#if model.isError}} - {{#if model.transitioningMessage}} - {{model.transitioningMessage}} - {{else}} - {{t 'hostPod.machineInfo.deactivated.error'}} - {{/if}} + {{#if model.isError}} + {{#if model.transitioningMessage}} + {{model.transitioningMessage}} {{else}} -
{{t 'hostPod.machineInfo.deactivated.setup'}}
- {{model.transitioningMessage}} + {{t 'hostPod.machineInfo.deactivated.error'}} {{/if}} + {{else}} +
{{t 'hostPod.machineInfo.deactivated.setup'}}
+ {{model.transitioningMessage}} {{/if}}
{{else}} @@ -58,8 +50,8 @@ {{/if}}
- {{#if model.machine}} -
{{model.machine.driver}}
+ {{#if model.driver}} +
{{model.driver}}
{{/if}}
diff --git a/app/components/machine/driver-aliyunecs/component.js b/app/components/machine/driver-aliyunecs/component.js index 6af1dc157..2c8eb534b 100644 --- a/app/components/machine/driver-aliyunecs/component.js +++ b/app/components/machine/driver-aliyunecs/component.js @@ -22,7 +22,7 @@ export default Ember.Component.extend(Driver, { }); this.set('model', this.get('store').createRecord({ - type: 'machine', + type: 'host', aliyunecsConfig: config, })); diff --git a/app/components/machine/driver-amazonec2/component.js b/app/components/machine/driver-amazonec2/component.js index dc1a7fa64..f1fa982fc 100644 --- a/app/components/machine/driver-amazonec2/component.js +++ b/app/components/machine/driver-amazonec2/component.js @@ -127,7 +127,7 @@ export default Ember.Component.extend(Driver, { }); this.set('model', this.get('store').createRecord({ - type : 'machine', + type : 'host', amazonec2Config : config, })); }, diff --git a/app/components/machine/driver-azure/component.js b/app/components/machine/driver-azure/component.js index 17f0b60cb..cc8d5332a 100644 --- a/app/components/machine/driver-azure/component.js +++ b/app/components/machine/driver-azure/component.js @@ -35,7 +35,7 @@ export default Ember.Component.extend(Driver, { }); this.set('model', this.get('store').createRecord({ - type: 'machine', + type: 'host', azureConfig: config, })); diff --git a/app/components/machine/driver-digitalocean/component.js b/app/components/machine/driver-digitalocean/component.js index 5c2338d39..8100a27b2 100644 --- a/app/components/machine/driver-digitalocean/component.js +++ b/app/components/machine/driver-digitalocean/component.js @@ -1,6 +1,7 @@ import Ember from 'ember'; import Driver from 'ui/mixins/driver'; import fetch from 'ember-api-store/utils/fetch'; +import Util from 'ui/utils/util'; const DIGITALOCEAN_API = 'api.digitalocean.com/v2'; const VALID_IMAGES = [ @@ -81,7 +82,7 @@ export default Ember.Component.extend(Driver, { }, (err) => { let errors = this.get('errors') || []; - errors.push(`${err.xhr.status}: ${err.err}`); + errors.push(`${err.statusText}: ${err.body.message}`); this.setProperties({ errors: errors, @@ -102,7 +103,7 @@ export default Ember.Component.extend(Driver, { }); this.set('model', this.get('store').createRecord({ - type: 'machine', + type: 'host', digitaloceanConfig: config, })); }, @@ -135,19 +136,19 @@ export default Ember.Component.extend(Driver, { return true; }, - apiRequest: function(command, params, method='GET') { + apiRequest: function(command, params) { let proxyEndpoint = this.get('app.proxyEndpoint'); let url = `${proxyEndpoint}/${DIGITALOCEAN_API}/${command}?per_page=100`; + url = Util.addQueryParams(url,params); let accessToken = this.get('model.digitaloceanConfig.accessToken'); - return fetch({ - url: url, - method: method, - header: { + return fetch(url, { + headers: { 'Accept': 'application/json', 'X-Api-Auth-Header': 'Bearer ' + accessToken }, - data: params, - }, true); + }).then((res) => { + return res.body; + }); } }); diff --git a/app/components/machine/driver-exoscale/component.js b/app/components/machine/driver-exoscale/component.js index 4d7824371..192f9db6d 100644 --- a/app/components/machine/driver-exoscale/component.js +++ b/app/components/machine/driver-exoscale/component.js @@ -76,7 +76,7 @@ export default Ember.Component.extend(Driver, { }); this.set('model', this.get('store').createRecord({ - type: 'machine', + type: 'host', exoscaleConfig: config })); }, diff --git a/app/components/machine/driver-other/component.js b/app/components/machine/driver-other/component.js index e79d11a55..49b0af8c6 100644 --- a/app/components/machine/driver-other/component.js +++ b/app/components/machine/driver-other/component.js @@ -21,7 +21,7 @@ export default Ember.Component.extend(Driver, { bootstrap() { let model = this.get('store').createRecord({ - type: 'machine', + type: 'host', }); this.setProperties({ @@ -47,14 +47,14 @@ export default Ember.Component.extend(Driver, { driverChanged: function() { let driver = this.get('otherDriver'); - let machine = this.get('model'); + let host = this.get('model'); - if ( driver && machine) { - if ( !machine.get(driver) ) { - machine.set(driver, this.get('store').createRecord({ type: driver })); + if ( driver && host) { + if ( !host.get(driver) ) { + host.set(driver, this.get('store').createRecord({ type: driver })); } - this.set('driverOpts', machine.get(driver)); + this.set('driverOpts', host.get(driver)); } else { this.set('otherDriver', this.get('otherChoices.firstObject.value')); @@ -73,11 +73,11 @@ export default Ember.Component.extend(Driver, { willSave() { // Null out all the drivers that aren't the active one, because the API only accepts one. let activeDriver = this.get('otherDriver'); - let machine = this.get('model'); + let host = this.get('model'); this.get('otherChoices').forEach((choice) => { let cur = choice.value; if ( choice.value !== activeDriver ) { - machine.set(cur, null); + host.set(cur, null); } }); diff --git a/app/components/machine/driver-packet/component.js b/app/components/machine/driver-packet/component.js index af346e4c9..d4597a119 100644 --- a/app/components/machine/driver-packet/component.js +++ b/app/components/machine/driver-packet/component.js @@ -28,7 +28,7 @@ export default Ember.Component.extend(Driver, { }); this.set('model', store.createRecord({ - type: 'machine', + type: 'host', packetConfig: config, })); } diff --git a/app/components/machine/driver-rackspace/component.js b/app/components/machine/driver-rackspace/component.js index 856d70968..ba87780d4 100644 --- a/app/components/machine/driver-rackspace/component.js +++ b/app/components/machine/driver-rackspace/component.js @@ -62,7 +62,7 @@ export default Ember.Component.extend(Driver, { }); this.set('model', this.get('store').createRecord({ - type: 'machine', + type: 'host', rackspaceConfig: config, })); }, diff --git a/app/components/machine/driver-ubiquity/component.js b/app/components/machine/driver-ubiquity/component.js index 31eecca67..e27171a30 100644 --- a/app/components/machine/driver-ubiquity/component.js +++ b/app/components/machine/driver-ubiquity/component.js @@ -30,7 +30,7 @@ export default Ember.Component.extend(Driver, { }); this.set('model', store.createRecord({ - type: 'machine', + type: 'host', ubiquityConfig: config, })); }, diff --git a/app/components/machine/driver-vmwarevsphere/component.js b/app/components/machine/driver-vmwarevsphere/component.js index 2fef800bd..23273aae4 100644 --- a/app/components/machine/driver-vmwarevsphere/component.js +++ b/app/components/machine/driver-vmwarevsphere/component.js @@ -17,7 +17,7 @@ export default Ember.Component.extend(Driver, { }); this.set('model', this.get('store').createRecord({ - type: 'machine', + type: 'host', vmwarevsphereConfig: config, engineInstallUrl: '', })); diff --git a/app/components/orchestration/wait-kubernetes/component.js b/app/components/orchestration/wait-kubernetes/component.js index f71f5fe36..b2e167134 100644 --- a/app/components/orchestration/wait-kubernetes/component.js +++ b/app/components/orchestration/wait-kubernetes/component.js @@ -39,7 +39,7 @@ export default Ember.Component.extend({ this.set('subStep', 0); this.set('subCount', 0); - if ( (this.get('model.hosts.length') + this.get('model.machines.length')) === 0 ) + if ( this.get('model.hosts.length') === 0 ) { this.set('currentStep', 0); return; diff --git a/app/components/orchestration/wait-mesos/component.js b/app/components/orchestration/wait-mesos/component.js index 2b5f99fff..18454167f 100644 --- a/app/components/orchestration/wait-mesos/component.js +++ b/app/components/orchestration/wait-mesos/component.js @@ -37,7 +37,7 @@ export default Ember.Component.extend({ this.set('subStep', 0); this.set('subCount', 0); - if ( (this.get('model.hosts.length') + this.get('model.machines.length')) < 3 ) + if ( this.get('model.hosts.length') < 3 ) { this.set('currentStep', 0); return; diff --git a/app/components/orchestration/wait-swarm/component.js b/app/components/orchestration/wait-swarm/component.js index 8c4fdc25e..0c126d2c8 100644 --- a/app/components/orchestration/wait-swarm/component.js +++ b/app/components/orchestration/wait-swarm/component.js @@ -31,7 +31,7 @@ export default Ember.Component.extend({ this.set('subStep', 0); this.set('subCount', 0); - if ( (this.get('model.hosts.length') + this.get('model.machines.length')) === 0 ) + if ( this.get('model.hosts.length') === 0 ) { this.set('currentStep', 0); return; diff --git a/app/host/template.hbs b/app/host/template.hbs index 85ad08614..9825e4f55 100644 --- a/app/host/template.hbs +++ b/app/host/template.hbs @@ -80,8 +80,8 @@
- {{#if host.machine}} -
{{host.machine.driver}}
+ {{#if host.driver}} +
{{host.driver}}
{{else}}
{{t 'hostsPage.hostPage.infoMultiStats.provider.noHost'}}
{{/if}} diff --git a/app/hosts/index/controller.js b/app/hosts/index/controller.js index 54a4cd31e..6eec0528c 100644 --- a/app/hosts/index/controller.js +++ b/app/hosts/index/controller.js @@ -23,31 +23,6 @@ export default Ember.Controller.extend({ this.set('show', (this.get('showSystem') ? 'all' : 'standard')); }.observes('showSystem'), - pods: function() { - var out = []; - var hosts = this.get('model.hosts'); - var machines = this.get('model.machines'); - - var knownMachines = hosts.map((host) => { return host.get('physicalHostId'); }).uniq(); - - out.pushObjects(hosts.toArray()); - - // Copy in the pending machines - machines.forEach((machine) => { - if ( machine.get('isPending') && knownMachines.indexOf(machine.get('id')) === -1 ) - { - out.pushObject(Ember.Object.create({ - isPendingMachine: true, - machine: machine, - name: machine.get('name'), - displayName: machine.get('name') - })); - } - }); - - return out.sortBy('displayName','id'); - }.property('model.hosts.@each.{name,id,physicalHostId}','model.machines.@each.{name,id,isPending}'), - listLinkOptions: { route: 'hosts', options: { diff --git a/app/hosts/index/route.js b/app/hosts/index/route.js index cd698960f..2467aef9e 100644 --- a/app/hosts/index/route.js +++ b/app/hosts/index/route.js @@ -2,16 +2,9 @@ import Ember from 'ember'; export default Ember.Route.extend({ model: function() { - var store = this.get('store'); - var promises = [ - store.find('machine'), - store.find('host'), - ]; - - return Ember.RSVP.all(promises).then((results) => { + return this.get('store').findAll('host').then((hosts) => { return { - machines: results[0], - hosts: results[1], + hosts: hosts, }; }); }, diff --git a/app/hosts/index/template.hbs b/app/hosts/index/template.hbs index f59393f53..d04b7f5ce 100644 --- a/app/hosts/index/template.hbs +++ b/app/hosts/index/template.hbs @@ -15,10 +15,6 @@
-{{#columns-section pods=pods emptyMessage=(t 'hostsPage.index.columns.emptyMessage') as |item| }} - {{#if item.isPendingMachine}} - {{host-pod model=item.machine mode=mode newContainer="newContainer"}} - {{else}} - {{host-pod model=item mode=mode newContainer="newContainer" show=show}} - {{/if}} +{{#columns-section pods=model.hosts emptyMessage=(t 'hostsPage.index.columns.emptyMessage') as |item| }} + {{host-pod model=item mode=mode newContainer="newContainer" show=show}} {{/columns-section}} diff --git a/app/hosts/new/controller.js b/app/hosts/new/controller.js index 5d9f85fe6..435eb0af4 100644 --- a/app/hosts/new/controller.js +++ b/app/hosts/new/controller.js @@ -3,18 +3,18 @@ import Ember from 'ember'; export default Ember.Controller.extend({ access: Ember.inject.service(), - queryParams : ['backTo', 'driver', 'machineId'], + queryParams : ['backTo', 'driver', 'hostId'], backTo : null, driver : null, - machineId : null, + hostId : null, allowCustom : true, allowOther : true, actions: { switchDriver(name) { - if (this.get('machineId')) { - this.set('machineId', null); + if (this.get('hostId')) { + this.set('hostId', null); this.set('model.clonedModel', null); } this.set('driver', name); diff --git a/app/hosts/new/route.js b/app/hosts/new/route.js index e8c70fb46..62431e803 100644 --- a/app/hosts/new/route.js +++ b/app/hosts/new/route.js @@ -28,7 +28,7 @@ export default Ember.Route.extend({ driver: { refreshModel: true }, - machineId: { + hostId: { refreshModel: false, } }, @@ -65,7 +65,7 @@ export default Ember.Route.extend({ resetController(controller, isExisting /*, transition*/) { if ( isExisting ) { - controller.set('machineId', null); + controller.set('hostId', null); controller.set('backTo', null); } }, diff --git a/app/hosts/route.js b/app/hosts/route.js index ac4aec341..dc0ddd435 100644 --- a/app/hosts/route.js +++ b/app/hosts/route.js @@ -4,7 +4,6 @@ export default Ember.Route.extend({ model: function() { var store = this.get('store'); return Ember.RSVP.hash({ - machines: store.findAll('machine'), hosts: store.findAll('host'), instances: store.findAll('instance'), }).then((hash) => { diff --git a/app/k8s-tab/route.js b/app/k8s-tab/route.js index 28b27d33f..3a2e261bc 100644 --- a/app/k8s-tab/route.js +++ b/app/k8s-tab/route.js @@ -9,7 +9,7 @@ export default Ember.Route.extend({ beforeModel() { this._super(...arguments); var auth = this.modelFor('authenticated'); - return this.get('projects').checkForWaiting(auth.get('hosts'),auth.get('machines')); + return this.get('projects').checkForWaiting(auth.get('hosts')); }, model() { diff --git a/app/mesos-tab/route.js b/app/mesos-tab/route.js index 080d70188..ed9390088 100644 --- a/app/mesos-tab/route.js +++ b/app/mesos-tab/route.js @@ -6,6 +6,6 @@ export default Ember.Route.extend({ beforeModel() { this._super(...arguments); var auth = this.modelFor('authenticated'); - return this.get('projects').checkForWaiting(auth.get('hosts'),auth.get('machines')); + return this.get('projects').checkForWaiting(auth.get('hosts')); }, }); diff --git a/app/mixins/cattle-transitioning-resource.js b/app/mixins/cattle-transitioning-resource.js index 8269efbe6..ed257ee50 100644 --- a/app/mixins/cattle-transitioning-resource.js +++ b/app/mixins/cattle-transitioning-resource.js @@ -177,7 +177,7 @@ export default Ember.Mixin.create({ var icon = ''; if ( trans === 'yes' ) { - icon = 'icon icon-spinner'; + icon = 'icon icon-spinner icon-spin'; } else if ( trans === 'error' ) { diff --git a/app/mixins/manage-labels.js b/app/mixins/manage-labels.js index 53437f6bc..ad156aa16 100644 --- a/app/mixins/manage-labels.js +++ b/app/mixins/manage-labels.js @@ -292,7 +292,7 @@ export default Ember.Mixin.create({ labelsChanged: debouncedObserver('labelArray.@each.{type,key,value}', function() { // Make a map of the keys we care about, and combine multiple values together let map = {}; - this.get('labelArray').forEach(function(row) { + (this.get('labelArray')||[]).forEach(function(row) { let key = row.get('key') || ''; let type = row.get('type') || ''; diff --git a/app/models/host.js b/app/models/host.js index 6ec51b5b4..bab87c892 100644 --- a/app/models/host.js +++ b/app/models/host.js @@ -30,8 +30,7 @@ var Host = Resource.extend({ }, clone: function() { - var machine = this.get('machine'); - this.get('application').transitionToRoute('hosts.new', {queryParams: {machineId: machine.get('id'), driver: machine.get('driver')}}); + this.get('application').transitionToRoute('hosts.new', {queryParams: {hostId: this.get('id'), driver: this.get('driver')}}); }, edit: function() { @@ -39,15 +38,11 @@ var Host = Resource.extend({ }, machineConfig: function() { - var machine = this.get('machine'); - if ( machine ) + var url = this.linkFor('config'); + if ( url ) { - var url = machine.linkFor('config'); - if ( url ) - { - url = this.get('endpointSvc').addAuthParams(url); - Util.download(url); - } + url = this.get('endpointSvc').addAuthParams(url); + Util.download(url); } } }, @@ -64,34 +59,16 @@ var Host = Resource.extend({ { label: 'action.viewInApi', icon: 'icon icon-external-link',action: 'goToApi', enabled: true}, ]; - if ( this.get('machine') ) + if ( this.get('links.config') ) { - if ( this.get('machine.links.config') ) - { - out.push({ label: 'action.machineConfig', icon: 'icon icon-download', action: 'machineConfig', enabled: true}); - } - - out.push({ label: 'action.clone', icon: 'icon icon-copy', action: 'clone', enabled: true }); + out.push({ label: 'action.machineConfig', icon: 'icon icon-download', action: 'machineConfig', enabled: true}); } + out.push({ label: 'action.clone', icon: 'icon icon-copy', action: 'clone', enabled: true }); out.push({ label: 'action.edit', icon: 'icon icon-edit', action: 'edit', enabled: !!a.update }); return out; - }.property('actionLinks.{activate,deactivate,remove,purge,update}','machine','machine.links.config'), - - - state: function() { - var host = this.get('hostState'); - var agent = this.get('agentState'); - if ( host === 'active' && agent ) - { - return agent; - } - else - { - return host; - } - }.property('hostState','agentState'), + }.property('actionLinks.{activate,deactivate,remove,purge,update}','links.config'), displayIp: Ember.computed.alias('agentIpAddress'), @@ -99,19 +76,6 @@ var Host = Resource.extend({ return this.get('name') || this.get('hostname') || '('+this.get('id')+')'; }.property('name','hostname','id'), - //@TODO PERF - machine: function() { - var phid = this.get('physicalHostId'); - if ( !phid ) - { - return null; - } - - var machine = this.get('store').getById('machine', phid); - return machine; - }.property('physicalHostId'), - //@TODO PERF - osBlurb: function() { var out = this.get('info.osInfo.operatingSystem')||''; @@ -225,15 +189,10 @@ var Host = Resource.extend({ }); Host.reopenClass({ - // Remap the host state to hostState so the regular state can be a computed combination of host+agent state. - mangleIn: function(data) { - data['hostState'] = data['state']; - delete data['state']; - return data; - }, - + defaultSortBy: 'name,hostname', stateMap: { 'active': {icon: 'icon icon-host', color: 'text-success'}, + 'provisioning': {icon: 'icon icon-host', color: 'text-info'}, 'reconnecting': {icon: 'icon icon-help', color: 'text-danger'}, } }); diff --git a/app/models/machine.js b/app/models/machine.js deleted file mode 100644 index 1a8da5b57..000000000 --- a/app/models/machine.js +++ /dev/null @@ -1,79 +0,0 @@ -import Resource from 'ember-api-store/models/resource'; -import PolledResource from 'ui/mixins/cattle-polled-resource'; - -var pendingStates = [ - 'requested', - 'bootstrapping', - 'creating', - 'created', - 'erroring', - 'error', - 'updating' -]; - -var Machine = Resource.extend(PolledResource, { - type: 'machine', - reservedKeys: ['hostsUpdated','hosts','isPending'], - actions: { - - clone: function() { - this.get('router').transitionTo('hosts.new', {queryParams: {machineId: this.get('id'), driver: this.get('driver')}}); - }, - }, - - availableActions: function() { - var a = this.get('actionLinks')||{}; - - var out = [ - { label: 'action.remove', icon: 'icon icon-trash', action: 'promptDelete', enabled: !!a.remove, altAction: 'delete'}, - { divider: true }, - { label: 'action.clone', icon: 'icon icon-copy', action: 'clone', enabled: true }, - ]; - - if ( this.hasLink('config') ) - { - out.push({ label: 'action.machineConfig', icon: 'icon icon-download', action: 'machineConfig', enabled: true}); - } - - out.push({ label: 'action.viewInApi', icon: 'icon icon-external-link',action: 'goToApi', enabled: true}); - - return out; - }.property('actionLinks.remove', 'links.config'), - - hostsUpdated: 0, - onHostChanged: function() { - this.incrementProperty('hostsUpdated'); - }.observes('hosts.@each.{id,name,state}'), - - isPending: function() { - if ( pendingStates.indexOf(this.get('state')) >= 0 ) - { - return true; - } - else - { - return this.get('state') === 'active' && this.get('hosts.length') === 0; - } - }.property('state','hosts.[]','hostsUpdated'), - - combinedState: function() { - let state = this.get('state'); - if (state === 'active' ) - { - return 'waiting'; - } - else - { - return state; - } - }.property('state'), -}); - -Machine.reopenClass({ - stateMap: { - 'bootstrapping': {icon: 'icon icon-tag', color: 'text-info'}, - 'active': {icon: 'icon icon-tag', color: 'text-info'}, - } -}); - -export default Machine; diff --git a/app/models/service.js b/app/models/service.js index 100a7036a..f3a50cfeb 100644 --- a/app/models/service.js +++ b/app/models/service.js @@ -459,7 +459,7 @@ Service.reopenClass({ return _allMaps.filterBy('serviceId', serviceId).map((map) => { return Ember.Object.create({ name: map.get('name'), - service: getByServiceId(l('service:store'), map.get('consumedServiceId')), // @TODO + service: getByServiceId(window.l('service:store'), map.get('consumedServiceId')), // @TODO boooo ports: map.get('ports')||[], }); }).filter((obj) => { diff --git a/app/services/catalog-service.js b/app/services/catalog-service.js index ff6e03736..122b250c3 100644 --- a/app/services/catalog-service.js +++ b/app/services/catalog-service.js @@ -20,7 +20,7 @@ export default Ember.Service.extend(CatalogResource, { fetchCatalogs(auth) { const store = this.get('store'); - return this.get('projects').checkForWaiting(auth.get('hosts'),auth.get('machines')).then(() => { + return this.get('projects').checkForWaiting(auth.get('hosts')).then(() => { return store.request({url: `${this.get('app.catalogEndpoint')}/catalogs`}); }); }, diff --git a/app/services/projects.js b/app/services/projects.js index f35cf07e1..883556882 100644 --- a/app/services/projects.js +++ b/app/services/projects.js @@ -213,7 +213,7 @@ export default Ember.Service.extend({ ); }.property('orchestrationState'), // The state object is always completely replaced, so this is ok - checkForWaiting(hosts,machines) { + checkForWaiting(hosts) { let router = getOwner(this).get('router'); let hasHosts = false; @@ -223,7 +223,7 @@ export default Ember.Service.extend({ } else { - hasHosts = (hosts && hosts.get('length') > 0) || (machines && machines.get('length') > 0); + hasHosts = (hosts && hosts.get('length') > 0); } if ( !hasHosts ) diff --git a/app/styles/base/_fonts.scss b/app/styles/base/_fonts.scss index 7ce707ab9..50e63e4e3 100644 --- a/app/styles/base/_fonts.scss +++ b/app/styles/base/_fonts.scss @@ -29,34 +29,34 @@ // Animated Icons // -------------------------- .icon-spin { - -webkit-animation: icon-spin 2s infinite linear; - animation: icon-spin 2s infinite linear; + -webkit-animation: icon-spin 2s infinite steps(8); + animation: icon-spin 2s infinite steps(8); } -.icon-pulse { - -webkit-animation: icon-spin 1s infinite steps(8); - animation: icon-spin 1s infinite steps(8); -} +//.icon-pulse { +// -webkit-animation: icon-spin 1s infinite steps(8); +// animation: icon-spin 1s infinite steps(8); +//} @-webkit-keyframes icon-spin { 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); + -webkit-transform: rotateZ(0deg); + transform: rotateZ(0deg); } 100% { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); + -webkit-transform: rotateZ(360deg); + transform: rotateZ(360deg); } } @keyframes icon-spin { 0% { - -webkit-transform: rotate(0deg); - transform: rotate(0deg); + -webkit-transform: rotateZ(0deg); + transform: rotateZ(0deg); } 100% { - -webkit-transform: rotate(359deg); - transform: rotate(359deg); + -webkit-transform: rotateZ(360deg); + transform: rotateZ(360deg); } } diff --git a/app/styles/pages/_loading.scss b/app/styles/pages/_loading.scss index 08d597b42..5e98de0a5 100644 --- a/app/styles/pages/_loading.scss +++ b/app/styles/pages/_loading.scss @@ -172,15 +172,15 @@ @-webkit-keyframes orbit { 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); + -webkit-transform: rotateZ(360deg); + transform: rotateZ(360deg); } } @keyframes orbit { 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); + -webkit-transform: rotateZ(360deg); + transform: rotateZ(360deg); } } @@ -282,31 +282,31 @@ @-webkit-keyframes rotate { 0% { - -webkit-transform: rotate(0deg) scale(1); - transform: rotate(0deg) scale(1); + -webkit-transform: rotateZ(0deg) scale(1); + transform: rotateZ(0deg) scale(1); } 50% { - -webkit-transform: rotate(180deg) scale(0.6); - transform: rotate(180deg) scale(0.6); + -webkit-transform: rotateZ(180deg) scale(0.6); + transform: rotateZ(180deg) scale(0.6); } 100% { - -webkit-transform: rotate(360deg) scale(1); - transform: rotate(360deg) scale(1); + -webkit-transform: rotateZ(360deg) scale(1); + transform: rotateZ(360deg) scale(1); } } @keyframes rotate { 0% { - -webkit-transform: rotate(0deg) scale(1); - transform: rotate(0deg) scale(1); + -webkit-transform: rotateZ(0deg) scale(1); + transform: rotateZ(0deg) scale(1); } 50% { - -webkit-transform: rotate(180deg) scale(0.6); - transform: rotate(180deg) scale(0.6); + -webkit-transform: rotateZ(180deg) scale(0.6); + transform: rotateZ(180deg) scale(0.6); } 100% { - -webkit-transform: rotate(360deg) scale(1); - transform: rotate(360deg) scale(1); + -webkit-transform: rotateZ(360deg) scale(1); + transform: rotateZ(360deg) scale(1); } } diff --git a/app/swarm-tab/route.js b/app/swarm-tab/route.js index b354228b2..911815bfa 100644 --- a/app/swarm-tab/route.js +++ b/app/swarm-tab/route.js @@ -7,6 +7,6 @@ export default ApplicationsTabRoute.extend({ beforeModel() { this._super(...arguments); var auth = this.modelFor('authenticated'); - return this.get('projects').checkForWaiting(auth.get('hosts'),auth.get('machines')); + return this.get('projects').checkForWaiting(auth.get('hosts')); }, }); diff --git a/app/utils/util.js b/app/utils/util.js index 887e3e489..155afdfb6 100644 --- a/app/utils/util.js +++ b/app/utils/util.js @@ -83,9 +83,11 @@ export function addQueryParam(url, key, val) { } export function addQueryParams(url, params) { - Object.keys(params).forEach(function(key) { - url = addQueryParam(url, key, params[key]); - }); + if ( params && typeof params === 'object' ) { + Object.keys(params).forEach(function(key) { + url = addQueryParam(url, key, params[key]); + }); + } return url; } diff --git a/package.json b/package.json index 1d132b584..b289d5269 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "devDependencies": { "ansi_up": "^1.3.0", "broccoli-asset-rev": "^2.4.2", - "ember-api-store": "^2.0.0-dev7", + "ember-api-store": "^2.0.0-dev9", "ember-browserify": "^1.0.1", "ember-cli": "^2.8.0", "ember-cli-app-version": "^1.0.0",