Revision be5195f3 snf-cyclades-app/synnefo/ui/new_ui/ui/app/controllers/vm.js
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/controllers/vm.js | ||
---|---|---|
1 | 1 |
App.VmController =App.ItemsItemController.extend({ |
2 | 2 |
icon: 'snf-pc-full', |
3 | 3 |
|
4 |
hasConnect: true, |
|
5 |
|
|
4 | 6 |
actionsMeta: function() { |
5 | 7 |
var enabledActions = this.get('model').get('enabledActions'); |
6 | 8 |
return _.map(enabledActions, function(val,key) { return actionsMetaVm[val]; }); |
... | ... | |
31 | 33 |
volume.get('vm').get('volumes').removeObject(volume); |
32 | 34 |
}, |
33 | 35 |
|
34 |
modalConnect: function(){ |
|
35 |
var component = Ember.View.views["modal-connect"]; |
|
36 |
component.set('message', 'connect to your <3 ' + this.get('model').get('name')); |
|
37 |
component.set('okCallback', _.bind(function() { |
|
38 |
alert("restarting " + this.get('model').get('name')); |
|
39 |
}, this)); |
|
40 |
$("#modal-connect").foundation('reveal', 'open'); |
|
41 |
}, |
|
42 |
|
|
43 |
modalStart: function(){ |
|
44 |
$("#modal-start").foundation('reveal', 'open'); |
|
36 |
rebootVm: function(){ |
|
37 |
this.get('model').set('status','rebooting'); |
|
38 |
var that = this; |
|
39 |
setTimeout(function(){ |
|
40 |
that.get('model').set('status','running'); |
|
41 |
},3000); |
|
45 | 42 |
}, |
46 | 43 |
|
47 |
modalShutdown: function(){ |
|
48 |
$("#modal-shutdown").foundation('reveal', 'open'); |
|
44 |
destroyVm: function(){ |
|
45 |
this.get('model').deleteRecord(); |
|
46 |
this.get('model').save(); |
|
47 |
this.transitionToRoute('vms.grid-view'); |
|
49 | 48 |
}, |
50 | 49 |
|
51 |
modalReboot: function(){ |
|
52 |
$("#modal-reboot").foundation('reveal', 'open'); |
|
53 |
var component = Ember.View.views["modal-reboot"]; |
|
54 |
component.set('message', '<p>Are you sure you want to reboot you VM <strong>' + this.get('model').get('name')+'</strong> ?</p>'); |
|
55 |
component.set('okCallback', _.bind(function() { |
|
56 |
this.get('model').set('state','rebooting'); |
|
57 |
$("#modal-reboot").foundation('reveal','close'); |
|
58 |
}, this)); |
|
50 |
shutdownVm: function(){ |
|
51 |
this.get('model').set('status','shutting'); |
|
52 |
var that = this; |
|
53 |
setTimeout(function(){ |
|
54 |
that.get('model').set('status','off'); |
|
55 |
},3000); |
|
59 | 56 |
}, |
60 | 57 |
|
61 |
modalDestroy: function(){ |
|
62 |
$("#modal-destroy").foundation('reveal', 'open'); |
|
63 |
var component = Ember.View.views["modal-destroy"]; |
|
64 |
component.set('message', '<p>Are you sure you want to delete you VM <strong>' + this.get('model').get('name')+'</strong> ?</p>'); |
|
65 |
component.set('okCallback', _.bind(function() { |
|
66 |
this.get('model').deleteRecord(); |
|
67 |
this.get('model').save(); |
|
68 |
$("#modal-destroy").foundation('reveal','close'); |
|
69 |
}, this)); |
|
58 |
startVm: function(){ |
|
59 |
this.get('model').set('status','running'); |
|
70 | 60 |
}, |
71 |
|
|
72 | 61 |
}, |
73 | 62 |
}); |
74 | 63 |
|
Also available in: Unified diff