Revision 80bb2140 snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_vms_base_view.js
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_vms_base_view.js | ||
---|---|---|
496 | 496 |
hide_actions: function() { |
497 | 497 |
$(this.el).find("a").css("visibility", "hidden"); |
498 | 498 |
}, |
499 |
|
|
500 |
set_can_start: function() { |
|
501 |
var el = $(this.el).find("a.action-start").parent(); |
|
502 |
el.removeClass("disabled-visible"); |
|
503 |
}, |
|
504 |
|
|
505 |
set_cannot_start: function() { |
|
506 |
var el = $(this.el).find("a.action-start").parent(); |
|
507 |
el.addClass("disabled-visible") |
|
508 |
}, |
|
499 | 509 |
|
500 | 510 |
// update the actions layout, depending on the selected actions |
501 | 511 |
update_layout: function() { |
512 |
|
|
513 |
if (this.vm.get('status') == 'STOPPED') { |
|
514 |
if (this.vm.can_start()) { |
|
515 |
this.set_can_start(); |
|
516 |
} else { |
|
517 |
this.set_cannot_start(); |
|
518 |
} |
|
519 |
} |
|
502 | 520 |
|
503 | 521 |
if (!this.vm_handlers_initialized) { |
504 | 522 |
this.vm = storage.vms.get(this.vm.id); |
... | ... | |
636 | 654 |
// action links click events |
637 | 655 |
$(this.el).find(".action-container."+action+" a").click(function(ev) { |
638 | 656 |
ev.preventDefault(); |
657 |
if (action == "start" && !self.vm.can_start()) { |
|
658 |
ui.main.vm_resize_view.show_with_warning(self.vm); |
|
659 |
return; |
|
660 |
} |
|
661 |
|
|
639 | 662 |
if (action == "resize") { |
640 | 663 |
ui.main.vm_resize_view.show(self.vm); |
664 |
return; |
|
641 | 665 |
} else { |
642 | 666 |
self.set(action); |
643 | 667 |
} |
Also available in: Unified diff