root / snf-cyclades-app / synnefo / ui / new_ui / ui / javascripts / ember / controllers / vm.js @ a6c6857c
History | View | Annotate | Download (2.2 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 |
actions: {
|
10 |
|
11 |
deleteTag: function(tag) { |
12 |
this.get('model').get('tags').removeObject(tag); |
13 |
}, |
14 |
|
15 |
modalConnect: function(){ |
16 |
var component = Ember.View.views["modal-connect"]; |
17 |
component.set('message', 'connect to your <3 ' + this.get('model').get('name')); |
18 |
component.set('okCallback', _.bind(function() { |
19 |
|
20 |
alert("restarting " + this.get('model').get('name')); |
21 |
}, this));
|
22 |
$("#modal-connect").foundation('reveal', 'open'); |
23 |
}, |
24 |
|
25 |
modalStart: function(){ |
26 |
$("#modal-start").foundation('reveal', 'open'); |
27 |
}, |
28 |
|
29 |
modalShutdown: function(){ |
30 |
$("#modal-shutdown").foundation('reveal', 'open'); |
31 |
}, |
32 |
|
33 |
modalReboot: function(){ |
34 |
$("#modal-reboot").foundation('reveal', 'open'); |
35 |
var component = Ember.View.views["modal-reboot"]; |
36 |
component.set('message', '<p>Are you sure you want to reboot you VM <strong>' + this.get('model').get('name')+'</strong> ?</p>'); |
37 |
component.set('okCallback', _.bind(function() { |
38 |
this.get('model').set('state','rebooting'); |
39 |
$("#modal-reboot").foundation('reveal','close'); |
40 |
}, this));
|
41 |
}, |
42 |
|
43 |
modalDestroy: function(){ |
44 |
$("#modal-destroy").foundation('reveal', 'open'); |
45 |
var component = Ember.View.views["modal-destroy"]; |
46 |
component.set('message', '<p>Are you sure you want to delete you VM <strong>' + this.get('model').get('name')+'</strong> ?</p>'); |
47 |
component.set('okCallback', _.bind(function() { |
48 |
this.get('model').deleteRecord(); |
49 |
this.get('model').save(); |
50 |
$("#modal-destroy").foundation('reveal','close'); |
51 |
}, this));
|
52 |
}, |
53 |
|
54 |
} |
55 |
}); |
56 |
App.VmInfoController = App.VmController.extend(); |