Revision cde4f28b
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/ember/models/volume.js | ||
---|---|---|
31 | 31 |
App.Volume = DS.Model.extend({ |
32 | 32 |
name : DS.attr(), |
33 | 33 |
state : DS.attr(), |
34 |
os : DS.attr(), |
|
35 |
link : DS.attr(), |
|
36 |
flavor : DS.attr('raw'), |
|
37 |
networks : DS.hasMany('network', { async:true }), |
|
38 | 34 |
|
39 | 35 |
enabledActions: function() { |
40 | 36 |
return statesActionsVolume[this.get('state')].enabledActions; |
... | ... | |
45 | 41 |
App.Volume.FIXTURES = [ |
46 | 42 |
{ |
47 | 43 |
id: 1, |
48 |
name: 'My cool Volume 1',
|
|
44 |
name: 'Disk 1',
|
|
49 | 45 |
state: 'off', |
50 |
os: 'kubuntu', |
|
51 |
link: 'http://www.in.gr', |
|
52 |
networks:[1,2], |
|
53 |
flavor: { |
|
54 |
ram: 1, |
|
55 |
cpu: 2, |
|
56 |
}, |
|
57 |
}, |
|
58 |
{ |
|
59 |
id: 2, |
|
60 |
name: 'My even cooler Volume 2 that has a long name', |
|
61 |
state: 'error', |
|
62 |
os: 'unknown', |
|
63 |
link: 'http://www.in.gr', |
|
64 |
networks:[3], |
|
65 |
}, |
|
66 |
{ |
|
67 |
id: 3, |
|
68 |
name: 'My cool Volume 3', |
|
69 |
state: 'building', |
|
70 |
os: 'windows', |
|
71 |
link: 'http://www.in.gr', |
|
72 |
}, |
|
73 |
{ |
|
74 |
id: 4, |
|
75 |
name: 'So awesome Volume 4', |
|
76 |
state: 'running', |
|
77 |
os: 'fedora', |
|
78 |
link: 'www.france24.fr', |
|
79 |
}, |
|
80 |
{ |
|
81 |
id: 5, |
|
82 |
name: 'olga', |
|
83 |
state: 'rebooting', |
|
84 |
os: 'kubuntu', |
|
85 |
link: 'http://www.in.gr', |
|
86 |
}, |
|
87 |
{ |
|
88 |
id: 6, |
|
89 |
name: 'athina', |
|
90 |
state: 'starting', |
|
91 |
os: 'kubuntu', |
|
92 |
link: 'http://www.in.gr', |
|
93 |
}, |
|
94 |
{ |
|
95 |
id: 7, |
|
96 |
name: 'kpap', |
|
97 |
state: 'shutting', |
|
98 |
os: 'kubuntu', |
|
99 |
link: 'http://www.in.gr', |
|
100 | 46 |
}, |
101 | 47 |
]; |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/ember/routes/items.js | ||
---|---|---|
1 |
App.ItemsListRoute = Ember.Route.extend({ |
|
2 |
|
|
3 |
modelName: '', |
|
4 |
|
|
5 |
model: function(params){ |
|
6 |
this.set( 'viewCls', params.view_cls ); |
|
7 |
var controller = this.get("controller"); |
|
8 |
|
|
9 |
// Ember checks if controller is already set, and if so, does not set it |
|
10 |
// up again. Hence, the following hack: |
|
11 |
if (controller) { |
|
12 |
controller.set("viewCls", params.view_cls); |
|
13 |
} |
|
14 |
|
|
15 |
// end of hack |
|
16 |
return this.store.find(this.modelName); |
|
17 |
}, |
|
18 |
renderTemplate: function() { |
|
19 |
this.render('items'); |
|
20 |
}, |
|
21 |
|
|
22 |
setupController: function(controller, model) { |
|
23 |
controller.set('model', model); |
|
24 |
controller.set("viewCls", this.get("viewCls")); |
|
25 |
controller.set('modelName', this.modelName); |
|
26 |
}, |
|
27 |
|
|
28 |
}); |
|
29 |
|
|
30 |
App.VmsRoute = App.ItemsListRoute.extend({ |
|
31 |
modelName: 'vm', |
|
32 |
}); |
|
33 |
|
|
34 |
App.NetworksRoute = App.ItemsListRoute.extend({ |
|
35 |
modelName: 'network', |
|
36 |
}); |
|
37 |
|
|
38 |
App.VolumesRoute = App.ItemsListRoute.extend({ |
|
39 |
modelName: 'volume', |
|
40 |
}); |
/dev/null | ||
---|---|---|
1 |
App.NetworksRoute = Ember.Route.extend({ |
|
2 |
|
|
3 |
model: function(params){ |
|
4 |
this.set( 'viewCls', params.view_cls ); |
|
5 |
var controller = this.get("controller"); |
|
6 |
|
|
7 |
// Ember checks if controller is already set, and if so, does not set it |
|
8 |
// up again. Hence, the following hack: |
|
9 |
if (controller) { |
|
10 |
controller.set("viewCls", params.view_cls); |
|
11 |
} |
|
12 |
|
|
13 |
// end of hack |
|
14 |
return this.store.find('network'); |
|
15 |
}, |
|
16 |
renderTemplate: function() { |
|
17 |
this.render('items'); |
|
18 |
}, |
|
19 |
|
|
20 |
setupController: function(controller, model) { |
|
21 |
controller.set('model', model); |
|
22 |
controller.set("viewCls", this.get("viewCls")); |
|
23 |
controller.set('modelName', 'network'); |
|
24 |
}, |
|
25 |
}); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/ember/routes/vm.js | ||
---|---|---|
1 | 1 |
App.VmRoute = Ember.Route.extend({ |
2 | 2 |
redirect: function() { |
3 |
this.transitionTo('vm.info');
|
|
4 |
}
|
|
3 |
this.transitionTo('vm.info'); |
|
4 |
} |
|
5 | 5 |
}); |
/dev/null | ||
---|---|---|
1 |
App.VmsRoute = Ember.Route.extend({ |
|
2 |
|
|
3 |
model: function(params){ |
|
4 |
this.set( 'viewCls', params.view_cls ); |
|
5 |
var controller = this.get("controller"); |
|
6 |
|
|
7 |
// Ember checks if controller is already set, and if so, does not set it |
|
8 |
// up again. Hence, the following hack: |
|
9 |
if (controller) { |
|
10 |
controller.set("viewCls", params.view_cls); |
|
11 |
} |
|
12 |
|
|
13 |
// end of hack |
|
14 |
return this.store.find('vm'); |
|
15 |
}, |
|
16 |
renderTemplate: function() { |
|
17 |
this.render('items'); |
|
18 |
}, |
|
19 |
|
|
20 |
setupController: function(controller, model) { |
|
21 |
controller.set('model', model); |
|
22 |
controller.set("viewCls", this.get("viewCls")); |
|
23 |
controller.set('modelName', 'vm'); |
|
24 |
}, |
|
25 |
|
|
26 |
}); |
/dev/null | ||
---|---|---|
1 |
App.VolumesRoute = Ember.Route.extend({ |
|
2 |
|
|
3 |
model: function(params){ |
|
4 |
this.set( 'viewCls', params.view_cls ); |
|
5 |
var controller = this.get("controller"); |
|
6 |
|
|
7 |
// Ember checks if controller is already set, and if so, does not set it |
|
8 |
// up again. Hence, the following hack: |
|
9 |
if (controller) { |
|
10 |
controller.set("viewCls", params.view_cls); |
|
11 |
} |
|
12 |
|
|
13 |
// end of hack |
|
14 |
return this.store.find('Volume'); |
|
15 |
}, |
|
16 |
renderTemplate: function() { |
|
17 |
this.render('items'); |
|
18 |
}, |
|
19 |
|
|
20 |
setupController: function(controller, model) { |
|
21 |
controller.set('model', model); |
|
22 |
controller.set("viewCls", this.get("viewCls")); |
|
23 |
controller.set('modelName', 'Volume'); |
|
24 |
}, |
|
25 |
|
|
26 |
}); |
Also available in: Unified diff