Revision a6c6857c
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js | ||
---|---|---|
1 | 1 |
/* |
2 |
* These functions are used throughout ember |
|
3 |
*/ |
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
/* ---------------------- */ |
|
9 |
/* END OF EMBER FUNCTIONS */ |
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
/* |
|
2 | 15 |
* Various functions that will be used throughout all templates |
3 | 16 |
* are inside ui Object |
4 | 17 |
*/ |
... | ... | |
803 | 816 |
ui.setCustomScrollBar(); |
804 | 817 |
ui.setElmaxHeight($('.storage-progress')); |
805 | 818 |
|
806 |
}) |
|
819 |
}); |
|
820 |
|
|
821 |
|
|
822 |
_.mixin({ |
|
823 |
capitalize: function(string) { |
|
824 |
return string.charAt(0).toUpperCase() + string.substring(1).toLowerCase(); |
|
825 |
} |
|
826 |
}); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/ember/controllers/item.js | ||
---|---|---|
1 |
App.ItemsItemController = Ember.ObjectController.extend({ |
|
2 |
|
|
3 |
codeName: 'vm', |
|
4 |
|
|
5 |
needs: function() { |
|
6 |
|
|
7 |
var needs = []; |
|
8 |
/* |
|
9 |
App.Vm.eachRelationship(function(name, meta) { |
|
10 |
if (meta.kind == 'hasMany') { |
|
11 |
needs.push(name); |
|
12 |
} |
|
13 |
});*/ |
|
14 |
needs.push(this.codeName+'s'); |
|
15 |
return needs; |
|
16 |
|
|
17 |
}.property(), |
|
18 |
|
|
19 |
hasViewCls: true, |
|
20 |
|
|
21 |
// i would like to get it from parent controller ???? |
|
22 |
icon: function () { |
|
23 |
var item = this.codeName; |
|
24 |
return 'snf-'+item+'-full'; |
|
25 |
}.property(), |
|
26 |
|
|
27 |
hasTags: true, |
|
28 |
|
|
29 |
codeNameParent: function() { |
|
30 |
return this.codeName+'s'; |
|
31 |
}.property(), |
|
32 |
|
|
33 |
codeNameChildInit: function() { |
|
34 |
return this.codeName+'init'; |
|
35 |
}.property(), |
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
}); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/ember/controllers/items.js | ||
---|---|---|
65 | 65 |
|
66 | 66 |
App.VolumesController = App.ItemsListController.extend({ |
67 | 67 |
codeName : 'volumes', |
68 |
}); |
|
68 |
}); |
|
69 |
|
|
70 |
App.TagsController = Ember.ArrayController.extend(); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/ember/controllers/network.js | ||
---|---|---|
1 |
App.NetworkController = Ember.ObjectController.extend({
|
|
1 |
App.NetworkController = App.ItemsItemController.extend({
|
|
2 | 2 |
|
3 |
icon: 'snf-network-full', |
|
4 |
|
|
5 | 3 |
codeName: 'network', |
6 | 4 |
|
7 | 5 |
actionsMeta: function() { |
... | ... | |
9 | 7 |
return _.map(enabledActions, function(val,key) { return actionsMetaNetwork[val]; }); |
10 | 8 |
}.property('model.enabledActions'), |
11 | 9 |
|
12 |
actions: { |
|
13 |
|
|
14 |
modalConnect: function(){ |
|
15 |
var component = Ember.View.views["modal-connect"]; |
|
16 |
component.set('message', 'connect to your <3 ' + this.get('model').get('name')); |
|
17 |
component.set('okCallback', _.bind(function() { |
|
18 |
alert("restarting " + this.get('model').get('name')); |
|
19 |
}, this)); |
|
20 |
$("#modal-connect").foundation('reveal', 'open'); |
|
21 |
}, |
|
22 |
|
|
23 |
modalStart: function(){ |
|
24 |
$("#modal-start").foundation('reveal', 'open'); |
|
25 |
}, |
|
26 |
|
|
27 |
modalShutdown: function(){ |
|
28 |
$("#modal-shutdown").foundation('reveal', 'open'); |
|
29 |
}, |
|
30 |
|
|
31 |
modalReboot: function(){ |
|
32 |
$("#modal-reboot").foundation('reveal', 'open'); |
|
33 |
var component = Ember.View.views["modal-reboot"]; |
|
34 |
component.set('message', '<p>Are you sure you want to reboot you VM <strong>' + this.get('model').get('name')+'</strong> ?</p>'); |
|
35 |
component.set('okCallback', _.bind(function() { |
|
36 |
this.get('model').set('state','rebooting'); |
|
37 |
$("#modal-reboot").foundation('reveal','close'); |
|
38 |
}, this)); |
|
39 |
}, |
|
40 |
|
|
41 |
modalDestroy: function(){ |
|
42 |
$("#modal-destroy").foundation('reveal', 'open'); |
|
43 |
var component = Ember.View.views["modal-destroy"]; |
|
44 |
component.set('message', '<p>Are you sure you want to delete you VM <strong>' + this.get('model').get('name')+'</strong> ?</p>'); |
|
45 |
component.set('okCallback', _.bind(function() { |
|
46 |
this.get('model').deleteRecord(); |
|
47 |
this.get('model').save(); |
|
48 |
$("#modal-destroy").foundation('reveal','close'); |
|
49 |
}, this)); |
|
50 |
}, |
|
51 |
|
|
52 |
}, |
|
53 | 10 |
}); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/ember/controllers/vm.js | ||
---|---|---|
1 |
App.VmController = Ember.ObjectController.extend({ |
|
2 |
|
|
3 |
needs: ['vms'], |
|
4 |
|
|
5 |
hasViewCls: true, |
|
6 |
|
|
7 |
/*icon: function () { |
|
8 |
return this.get('parentController').get('iconCls'); |
|
9 |
}.property(),*/ |
|
10 |
|
|
1 |
App.VmController =App.ItemsItemController.extend({ |
|
11 | 2 |
icon: 'snf-pc-full', |
12 | 3 |
|
13 |
codeName: 'vm', |
|
14 |
|
|
15 |
hasTags: true, |
|
16 |
|
|
17 |
codeNameParent: function() { |
|
18 |
return this.codeName+'s'; |
|
19 |
}.property(), |
|
20 |
|
|
21 |
codeNameChildInit: function() { |
|
22 |
return this.codeName+'init'; |
|
23 |
}.property(), |
|
24 |
|
|
25 | 4 |
actionsMeta: function() { |
26 | 5 |
var enabledActions = this.get('model').get('enabledActions'); |
27 |
return _.map(enabledActions, function(val,key) {return actionsMetaVm[val]; }); |
|
6 |
return _.map(enabledActions, function(val,key) { return actionsMetaVm[val]; });
|
|
28 | 7 |
}.property('model.enabledActions'), |
29 |
|
|
8 |
|
|
30 | 9 |
actions: { |
31 | 10 |
|
32 | 11 |
deleteTag: function(tag) { |
... | ... | |
72 | 51 |
}, this)); |
73 | 52 |
}, |
74 | 53 |
|
75 |
}, |
|
76 |
}); |
|
77 |
|
|
78 |
|
|
79 |
App.VmInfoController = App.VmController.extend({ |
|
54 |
} |
|
80 | 55 |
}); |
56 |
App.VmInfoController = App.VmController.extend(); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/ember/controllers/volume.js | ||
---|---|---|
1 |
App.VolumeController = Ember.ObjectController.extend({ |
|
2 |
|
|
3 |
icon: 'snf-volume-full', |
|
1 |
App.VolumeController = App.ItemsItemController.extend({ |
|
4 | 2 |
|
5 | 3 |
codeName: 'volume', |
6 | 4 |
|
... | ... | |
9 | 7 |
return _.map(enabledActions, function(val,key) {return actionsMetaVolume[val]; }); |
10 | 8 |
}.property('model.enabledActions'), |
11 | 9 |
|
12 |
actions: { |
|
13 |
|
|
14 |
modalConnect: function(){ |
|
15 |
var component = Ember.View.views["modal-connect"]; |
|
16 |
component.set('message', 'connect to your <3 ' + this.get('model').get('name')); |
|
17 |
component.set('okCallback', _.bind(function() { |
|
18 |
|
|
19 |
alert("restarting " + this.get('model').get('name')); |
|
20 |
}, this)); |
|
21 |
$("#modal-connect").foundation('reveal', 'open'); |
|
22 |
}, |
|
23 |
|
|
24 |
modalStart: function(){ |
|
25 |
$("#modal-start").foundation('reveal', 'open'); |
|
26 |
}, |
|
27 |
|
|
28 |
modalShutdown: function(){ |
|
29 |
$("#modal-shutdown").foundation('reveal', 'open'); |
|
30 |
}, |
|
31 |
|
|
32 |
modalReboot: function(){ |
|
33 |
$("#modal-reboot").foundation('reveal', 'open'); |
|
34 |
var component = Ember.View.views["modal-reboot"]; |
|
35 |
component.set('message', '<p>Are you sure you want to reboot you Volume <strong>' + this.get('model').get('name')+'</strong> ?</p>'); |
|
36 |
component.set('okCallback', _.bind(function() { |
|
37 |
this.get('model').set('state','rebooting'); |
|
38 |
$("#modal-reboot").foundation('reveal','close'); |
|
39 |
}, this)); |
|
40 |
}, |
|
41 |
|
|
42 |
modalDestroy: function(){ |
|
43 |
$("#modal-destroy").foundation('reveal', 'open'); |
|
44 |
var component = Ember.View.views["modal-destroy"]; |
|
45 |
component.set('message', '<p>Are you sure you want to delete you Volume <strong>' + this.get('model').get('name')+'</strong> ?</p>'); |
|
46 |
component.set('okCallback', _.bind(function() { |
|
47 |
this.get('model').deleteRecord(); |
|
48 |
this.get('model').save(); |
|
49 |
$("#modal-destroy").foundation('reveal','close'); |
|
50 |
}, this)); |
|
51 |
}, |
|
52 | 10 |
|
53 |
}, |
|
54 | 11 |
}); |
Also available in: Unified diff