Revision 643de8c0 ui/static/snf/js/models.js

b/ui/static/snf/js/models.js
40 40
        },
41 41

  
42 42
        handle_remove: function() {
43
            if (this.get("status") == "DELETED") {
43
            if (this.get("status") == 'DELETED') {
44 44
                if (this.collection) {
45
                    try { this.clear_pending_action();} catch (err) {};
46
                    try { this.reset_pending_actions();} catch (err) {};
45 47
                    this.collection.remove(this.id);
46 48
                }
47 49
            }
......
577 579
                url: stats_url, 
578 580
                refresh:true, 
579 581
                success: _.bind(this.handle_stats_update, this),
580
                error: _.bind(this.handle_stats_error)
582
                error: _.bind(this.handle_stats_error, this)
581 583
            });
582 584
        },
583 585

  
......
764 766
        state: function() {
765 767
            var args = slice.call(arguments);
766 768
                
767
            // TODO: it might not be a good idea to let api set the state
769
            // TODO: it might not be a good idea to set the state in set_state method
768 770
            if (args.length > 0 && models.VM.STATES.indexOf(args[0]) > -1) {
769 771
                this.set({'state': args[0]});
770 772
            }
......
1068 1070
        'STOPPED'       : ['start', 'destroy'],
1069 1071
        'ACTIVE'        : ['shutdown', 'destroy', 'reboot', 'console'],
1070 1072
        'ERROR'         : ['destroy'],
1071
        'DELETE'        : [],
1073
        'DELETED'        : [],
1072 1074
        'DESTROY'       : [],
1073 1075
        'BUILD_INIT'    : ['destroy'],
1074 1076
        'BUILD_COPY'    : ['destroy'],
......
1087 1089
        'STOPPED',
1088 1090
        'ACTIVE',
1089 1091
        'ERROR',
1090
        'DELETE'
1092
        'DELETED'
1091 1093
    ]
1092 1094

  
1093 1095
    // api status values
......
1111 1113
    ]);
1112 1114
    
1113 1115
    models.VM.STATES_TRANSITIONS = {
1114
        'DESTROY' : ['DELETE'],
1116
        'DESTROY' : ['DELETED'],
1115 1117
        'SHUTDOWN': ['ERROR', 'STOPPED', 'DESTROY'],
1116 1118
        'STOPPED': ['ERROR', 'ACTIVE', 'DESTROY'],
1117 1119
        'ACTIVE': ['ERROR', 'STOPPED', 'REBOOT', 'SHUTDOWN', 'DESTROY'],
......
1335 1337
        },
1336 1338

  
1337 1339
        parse_vm_api_data: function(data) {
1338

  
1339 1340
            // do not add non existing DELETED entries
1340 1341
            if (data.status && data.status == "DELETED") {
1341 1342
                if (!this.get(data.id)) {

Also available in: Unified diff