This commit is contained in:
Westly Wright 2017-12-12 15:05:23 -07:00
parent ac9307e52e
commit 43c3699ab1
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
11 changed files with 129 additions and 3 deletions

View File

@ -0,0 +1,12 @@
import Controller from '@ember/controller'
export default Controller.extend({
actions: {
launch() {
this.transitionToRoute('machines.launch');
},
add() {
this.transitionToRoute('machines.configure');
},
}
});

View File

@ -0,0 +1,23 @@
import EmberObject from '@ember/object';
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import { hash } from 'rsvp';
export default Route.extend({
globalStore: service(),
model() {
let store = this.get('globalStore');
return hash({
hosts: store.findAll('machine'), // this should eventually be all host with out cluster id
hostTemplates: store.findAll('machinetemplate'),
machineDrivers: store.findAll('machinedriver'),
}).then((hash) => {
return EmberObject.create({
hosts: hash.hosts,
hostTemplates: hash.hostTemplates,
machineDrivers: hash.machineDrivers,
});
});
},
});

View File

@ -0,0 +1,7 @@
<section>
{{host-template-list
model=model.hostTemplates
launch=(action 'launch')
add=(action 'add')
}}
</section>

View File

@ -0,0 +1,8 @@
import Controller from '@ember/controller'
export default Controller.extend({
actions: {
goBack() {},
launch() {},
}
});

View File

@ -0,0 +1,23 @@
import EmberObject from '@ember/object';
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import { get } from '@ember/object';
export default Route.extend({
globalStore: service(),
model(params) {
let store = this.get('globalStore');
// let drivers = get(this, 'model.machineDrivers');
// let selectedDriver = drivers.findBy('name', get(template, 'driver'));
return store.find('machinetemplate', get(params, 'template_id')).then(( template ) => {
return store.find('machinedriver', get(template, 'driver.id')).then( ( driver ) => {
debugger;
return EmberObject.create({
template: template,
driver: driver,
});
})
});
},
});

View File

@ -0,0 +1,8 @@
<section>
{{cloud-host-add-or-edit
hostTemplate=model.template
driver=model.driver
goBack=(action 'goBack')
save=(action 'launch')
}}
</section>

View File

@ -0,0 +1,13 @@
import Controller from '@ember/controller'
import { get } from '@ember/object';
export default Controller.extend({
actions: {
launch(template) {
this.transitionToRoute('machines.launch', get(template, 'id'));
},
add() {
this.transitionToRoute('machines.configure');
},
}
});

View File

@ -0,0 +1,23 @@
import EmberObject from '@ember/object';
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import { hash } from 'rsvp';
export default Route.extend({
globalStore: service(),
model() {
let store = this.get('globalStore');
return hash({
hosts: store.findAll('machine'), // this should eventually be all host with out cluster id
hostTemplates: store.findAll('machinetemplate'),
machineDrivers: store.findAll('machinedriver'),
}).then((hash) => {
return EmberObject.create({
hosts: hash.hosts,
hostTemplates: hash.hostTemplates,
machineDrivers: hash.machineDrivers,
});
});
},
});

View File

@ -0,0 +1,7 @@
<section>
{{host-template-list
model=model.hostTemplates
launch=(action 'launch')
add=(action 'add')
}}
</section>

View File

@ -44,6 +44,8 @@ export default buildRoutes(function() {
this.route('machines', {path: '/nodes'}, function() { this.route('machines', {path: '/nodes'}, function() {
this.route('index', {path: '/'}); this.route('index', {path: '/'});
this.route('templates'); this.route('templates');
this.route('launch', {path: '/launch/:template_id'});
this.route('configure');
}); });
this.route('catalog'); this.route('catalog');

View File

@ -2803,9 +2803,9 @@ elliptic@^6.0.0:
minimalistic-assert "^1.0.0" minimalistic-assert "^1.0.0"
minimalistic-crypto-utils "^1.0.0" minimalistic-crypto-utils "^1.0.0"
ember-api-store@2.4.0: ember-api-store@2.5.1:
version "2.4.0" version "2.5.1"
resolved "https://registry.yarnpkg.com/ember-api-store/-/ember-api-store-2.4.0.tgz#91dd74729e34beea28b898d6c12a102aab80eade" resolved "https://registry.yarnpkg.com/ember-api-store/-/ember-api-store-2.5.1.tgz#eb88f552e8025b6a950a2ee1b239776a1284ff88"
dependencies: dependencies:
broccoli-file-creator "^1.1.1" broccoli-file-creator "^1.1.1"
ember-cli-babel "^6.8.2" ember-cli-babel "^6.8.2"