Revision 7b3c3bd6 snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/ember/models/vm.js
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/ember/models/vm.js | ||
---|---|---|
2 | 2 |
Add tags to Vm model*/ |
3 | 3 |
|
4 | 4 |
|
5 |
var statesActionsVm = {
|
|
5 |
var statussActionsVm = {
|
|
6 | 6 |
'off' : { |
7 | 7 |
enabledActions : ['start', 'destroy'], |
8 | 8 |
}, |
... | ... | |
29 | 29 |
|
30 | 30 |
// the model for a Vm |
31 | 31 |
App.Vm = DS.Model.extend({ |
32 |
name : DS.attr(), |
|
33 |
state : DS.attr(), |
|
34 |
os : DS.attr(), |
|
35 |
link : DS.attr(), |
|
36 |
flavor : DS.attr('raw'), |
|
32 |
name : DS.attr(), |
|
33 |
status : DS.attr(), |
|
34 |
os : DS.attr(), |
|
35 |
link : DS.attr(), |
|
36 |
created : DS.attr('date'), |
|
37 |
updated : DS.attr('date'), |
|
38 |
/*flavor : DS.attr('raw'),*/ |
|
37 | 39 |
networks : DS.hasMany('network', { async:true }), |
38 | 40 |
|
39 | 41 |
enabledActions: function() { |
40 |
return statesActionsVm[this.get('state')].enabledActions;
|
|
41 |
}.property('state'),
|
|
42 |
return statussActionsVm[this.get('status')].enabledActions;
|
|
43 |
}.property('status'),
|
|
42 | 44 |
}); |
43 | 45 |
|
44 | 46 |
|
45 | 47 |
App.Vm.FIXTURES = [ |
46 | 48 |
{ |
47 |
id: 1, |
|
48 |
name: 'My cool VM 1', |
|
49 |
state: 'off', |
|
50 |
os: 'kubuntu', |
|
49 |
|
|
50 |
created: '2011-04-19T10:18:52.085737+00:00', |
|
51 |
id: 42, |
|
52 |
metadata: { foo: "bar"}, |
|
53 |
name: "My Server", |
|
54 |
os: 'windows', |
|
55 |
status: "running", |
|
51 | 56 |
link: 'http://www.in.gr', |
52 |
networks:[1,2], |
|
53 |
flavor: { |
|
54 |
ram: 1, |
|
55 |
cpu: 2, |
|
56 |
}, |
|
57 |
}, |
|
57 |
updated: "2011-05-29T14:07:07.037602+00:00", |
|
58 |
networks: [1,2], |
|
59 |
}, |
|
58 | 60 |
{ |
59 | 61 |
id: 2, |
60 | 62 |
name: 'My even cooler VM 2 that has a long name', |
61 |
state: 'error',
|
|
63 |
status: 'error',
|
|
62 | 64 |
os: 'unknown', |
63 | 65 |
link: 'http://www.in.gr', |
64 | 66 |
networks:[3], |
... | ... | |
66 | 68 |
{ |
67 | 69 |
id: 3, |
68 | 70 |
name: 'My cool VM 3', |
69 |
state: 'building',
|
|
71 |
status: 'building',
|
|
70 | 72 |
os: 'windows', |
71 | 73 |
link: 'http://www.in.gr', |
72 | 74 |
}, |
73 | 75 |
{ |
74 | 76 |
id: 4, |
75 | 77 |
name: 'So awesome VM 4', |
76 |
state: 'running',
|
|
78 |
status: 'running',
|
|
77 | 79 |
os: 'fedora', |
78 | 80 |
link: 'www.france24.fr', |
79 | 81 |
}, |
80 | 82 |
{ |
81 | 83 |
id: 5, |
82 | 84 |
name: 'olga', |
83 |
state: 'rebooting',
|
|
85 |
status: 'rebooting',
|
|
84 | 86 |
os: 'kubuntu', |
85 | 87 |
link: 'http://www.in.gr', |
86 | 88 |
}, |
87 | 89 |
{ |
88 | 90 |
id: 6, |
89 | 91 |
name: 'athina', |
90 |
state: 'starting',
|
|
92 |
status: 'starting',
|
|
91 | 93 |
os: 'kubuntu', |
92 | 94 |
link: 'http://www.in.gr', |
93 | 95 |
}, |
94 | 96 |
{ |
95 | 97 |
id: 7, |
96 | 98 |
name: 'kpap', |
97 |
state: 'shutting',
|
|
99 |
status: 'shutting',
|
|
98 | 100 |
os: 'kubuntu', |
99 | 101 |
link: 'http://www.in.gr', |
100 | 102 |
}, |
Also available in: Unified diff