Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / ui / new_ui / ui / javascripts / ember / controllers / volume.js @ ef5eff50

History | View | Annotate | Download (2 kB)

1
App.VolumeController = Ember.ObjectController.extend({
2

    
3
    icon: 'snf-volume-full',
4

    
5
    codeName: 'volume',
6
    
7
    actionsMeta: function() {
8
        var enabledActions = this.get('model').get('enabledActions');
9
        return _.map(enabledActions, function(val,key) {return actionsMetaVolume[val]; });      
10
    }.property('model.enabledActions'),
11

    
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

    
53
    },
54
});