root / snf-cyclades-app / synnefo / ui / new_ui / ui / javascripts / ember / controllers / vm.js @ 74c8da56
History | View | Annotate | Download (2.4 kB)
1 |
App.VmController =App.ItemsItemController.extend({ |
---|---|
2 |
icon: 'snf-pc-full', |
3 |
|
4 |
actionsMeta: function() { |
5 |
var enabledActions = this.get('model').get('enabledActions'); |
6 |
return _.map(enabledActions, function(val,key) { return actionsMetaVm[val]; }); |
7 |
}.property('model.enabledActions'),
|
8 |
|
9 |
detailsMenu: function(){ |
10 |
var detailsMenu = {
|
11 |
'info' : 'snf-info-outline', |
12 |
'disk-connected' : 'snf-volume-outline', |
13 |
'network-connected' : 'snf-network-outline', |
14 |
}; |
15 |
return detailsMenu;
|
16 |
}.property(), |
17 |
|
18 |
actions: {
|
19 |
|
20 |
deleteTag: function(tag) { |
21 |
this.get('model').get('tags').removeObject(tag); |
22 |
}, |
23 |
|
24 |
modalConnect: function(){ |
25 |
var component = Ember.View.views["modal-connect"]; |
26 |
component.set('message', 'connect to your <3 ' + this.get('model').get('name')); |
27 |
component.set('okCallback', _.bind(function() { |
28 |
alert("restarting " + this.get('model').get('name')); |
29 |
}, this));
|
30 |
$("#modal-connect").foundation('reveal', 'open'); |
31 |
}, |
32 |
|
33 |
modalStart: function(){ |
34 |
$("#modal-start").foundation('reveal', 'open'); |
35 |
}, |
36 |
|
37 |
modalShutdown: function(){ |
38 |
$("#modal-shutdown").foundation('reveal', 'open'); |
39 |
}, |
40 |
|
41 |
modalReboot: function(){ |
42 |
$("#modal-reboot").foundation('reveal', 'open'); |
43 |
var component = Ember.View.views["modal-reboot"]; |
44 |
component.set('message', '<p>Are you sure you want to reboot you VM <strong>' + this.get('model').get('name')+'</strong> ?</p>'); |
45 |
component.set('okCallback', _.bind(function() { |
46 |
this.get('model').set('state','rebooting'); |
47 |
$("#modal-reboot").foundation('reveal','close'); |
48 |
}, this));
|
49 |
}, |
50 |
|
51 |
modalDestroy: function(){ |
52 |
$("#modal-destroy").foundation('reveal', 'open'); |
53 |
var component = Ember.View.views["modal-destroy"]; |
54 |
component.set('message', '<p>Are you sure you want to delete you VM <strong>' + this.get('model').get('name')+'</strong> ?</p>'); |
55 |
component.set('okCallback', _.bind(function() { |
56 |
this.get('model').deleteRecord(); |
57 |
this.get('model').save(); |
58 |
$("#modal-destroy").foundation('reveal','close'); |
59 |
}, this));
|
60 |
}, |
61 |
|
62 |
}, |
63 |
}); |
64 |
|
65 |
App.VmInfoController = App.VmController.extend(); |