Revision 643de8c0
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)) { |
b/ui/static/snf/js/ui/web/ui_icon_view.js | ||
---|---|---|
744 | 744 |
'STOPPED': ['state', 'terminated-state'], |
745 | 745 |
'ACTIVE': ['state', 'running-state'], |
746 | 746 |
'ERROR': ['state', 'error-state'], |
747 |
'DELETE': ['state', 'destroying-state'], |
|
747 |
'DELETED': ['state', 'destroying-state'],
|
|
748 | 748 |
'DESTROY': ['state', 'destroying-state'], |
749 | 749 |
'BUILD_INIT': ['state', 'build-state'], |
750 | 750 |
'BUILD_COPY': ['state', 'build-state'], |
b/ui/static/snf/js/ui/web/ui_list_view.js | ||
---|---|---|
30 | 30 |
this.selected_action = undefined; |
31 | 31 |
this.available_actions = []; |
32 | 32 |
this.multi_view = synnefo.ui.main.multiple_actions_view; |
33 |
|
|
34 | 33 |
this.hovered = false; |
35 | 34 |
}, |
36 | 35 |
|
... | ... | |
208 | 207 |
_.each(selected, function(el){ |
209 | 208 |
var id = parseInt($(el).attr("id").replace("checkbox-list-vm-", "")); |
210 | 209 |
vm = storage.vms.get(id); |
210 |
if (!vm) { return }; |
|
211 | 211 |
vms.push(vm); |
212 | 212 |
}); |
213 | 213 |
|
... | ... | |
248 | 248 |
|
249 | 249 |
// remove vm |
250 | 250 |
remove_vm: function(vm) { |
251 |
this.vm(vm).find("input[type=checkbox]").removeAttr("checked"); |
|
251 | 252 |
var index = this.table_data["vm_" + vm.id].index; |
252 | 253 |
this.table.fnDeleteRow(index); |
253 | 254 |
delete this.table_data["vm_" + vm.id]; |
... | ... | |
263 | 264 |
}, |
264 | 265 |
|
265 | 266 |
set_indicator_for: function(action) { |
266 |
var vms = this.get_selected_vms();;
|
|
267 |
var vms = this.get_selected_vms(); |
|
267 | 268 |
_.each(vms, _.bind(function(vm){ |
268 | 269 |
var vmel = this.vm(vm); |
269 | 270 |
vmel.find("img.spinner, img.wave, img.os_icon").hide(); |
... | ... | |
457 | 458 |
'STOPPED': ['terminated-state'], |
458 | 459 |
'ACTIVE': ['running-state'], |
459 | 460 |
'ERROR': ['error-state'], |
460 |
'DELETE': ['destroying-state'],
|
|
461 |
'DELETED': ['destroying-state'],
|
|
461 | 462 |
'DESTROY': ['destroying-state'], |
462 | 463 |
'BUILD_INIT': ['build-state'], |
463 | 464 |
'BUILD_COPY': ['build-state'], |
b/ui/static/snf/js/ui/web/ui_single_view.js | ||
---|---|---|
110 | 110 |
this.current_vm_instance = storage.vms.at(this.current_vm); |
111 | 111 |
this.current_vm_instance.do_update_stats = true; |
112 | 112 |
} catch (err) { |
113 |
console.trace(); |
|
114 | 113 |
this.log.debug("Cannot select current vm instance for: {0}".format(this.current_vm)); |
114 |
this.current_vm_instance = undefined; |
|
115 |
this.current_vm = 0; |
|
115 | 116 |
} |
116 | 117 |
}, |
117 | 118 |
|
... | ... | |
316 | 317 |
'STOPPED': ['state', 'terminated-state'], |
317 | 318 |
'ACTIVE': ['state', 'running-state'], |
318 | 319 |
'ERROR': ['state', 'error-state'], |
319 |
'DELETE': ['state', 'destroying-state'], |
|
320 |
'DELETED': ['state', 'destroying-state'],
|
|
320 | 321 |
'DESTROY': ['state', 'destroying-state'], |
321 | 322 |
'BUILD_INIT': ['state', 'build-state'], |
322 | 323 |
'BUILD_COPY': ['state', 'build-state'], |
b/ui/static/snf/js/ui/web/ui_vms_base_view.js | ||
---|---|---|
38 | 38 |
this.vms_updated_handler(); |
39 | 39 |
|
40 | 40 |
this.connect_overlay = new views.VMConnectView(); |
41 |
|
|
41 | 42 |
}, |
42 | 43 |
|
43 | 44 |
// Helpers |
... | ... | |
169 | 170 |
|
170 | 171 |
// update ui for the given vm |
171 | 172 |
update_vm: function(vm) { |
173 |
// do not update deleted state vms |
|
174 |
if (!vm || vm.get("status") == 'DELETED') { return }; |
|
172 | 175 |
this.check_vm_container(vm); |
173 | 176 |
|
174 | 177 |
this.update_details(vm); |
Also available in: Unified diff