Revision 101e6604 ui/static/snf/js/ui/web/ui_networks_view.js
b/ui/static/snf/js/ui/web/ui_networks_view.js | ||
---|---|---|
247 | 247 |
if (!this.parent.network.is_public()) { |
248 | 248 |
this.disconnect.click(_.bind(function(e){ |
249 | 249 |
e.preventDefault(); |
250 |
this.confirm_disconnect(); |
|
250 |
this.parent.network.get("actions").add("disconnect", this.vm.id); |
|
251 |
this.parent.network.get("actions").remove("destroy"); |
|
251 | 252 |
}, this)); |
252 | 253 |
this.cancel.click(_.bind(function(e){ |
254 |
this.parent.network.get("actions").remove("disconnect", this.vm.id); |
|
253 | 255 |
e.preventDefault() |
254 |
this.confirm_el.hide(); |
|
255 |
this.disconnect.removeClass("selected"); |
|
256 | 256 |
}, this)); |
257 | 257 |
this.confirm.click(_.bind(function(e){ |
258 | 258 |
e.preventDefault() |
... | ... | |
268 | 268 |
}, this)); |
269 | 269 |
|
270 | 270 |
this.$(".remove-icon").click(_.bind(function(){ |
271 |
this.confirm_disconnect(); |
|
271 |
this.parent.network.get("actions").add("disconnect", this.vm.id); |
|
272 |
this.parent.network.get("actions").remove("destroy"); |
|
272 | 273 |
}, this)); |
273 | 274 |
|
274 | 275 |
this.vm_connect.click(_.bind(function() { |
275 | 276 |
this.connect_overlay.show(this.vm); |
276 | 277 |
}, this)); |
278 |
|
|
279 |
this.parent.network.bind("change:actions", _.bind(function(model, action){ |
|
280 |
if (this.parent.network.get("actions").contains("disconnect", this.vm.id)) { |
|
281 |
this.confirm_disconnect(); |
|
282 |
} else { |
|
283 |
this.cancel_disconnect(); |
|
284 |
} |
|
285 |
}, this)); |
|
277 | 286 |
} |
278 | 287 |
|
279 | 288 |
var vm = this.vm; |
280 | 289 |
this.details.click(function(){ |
281 | 290 |
snf.ui.main.show_vm_details(vm); |
282 |
}) |
|
291 |
}); |
|
292 |
|
|
293 |
}, |
|
283 | 294 |
|
295 |
cancel_disconnect: function() { |
|
296 |
this.confirm_el.hide(); |
|
297 |
this.disconnect.removeClass("selected"); |
|
298 |
this.$(".net-vm-actions a").removeClass("visible"); |
|
284 | 299 |
}, |
285 | 300 |
|
286 | 301 |
confirm_disconnect: function() { |
287 | 302 |
this.confirm_el.show(); |
288 | 303 |
this.disconnect.addClass("selected"); |
304 |
this.$(".net-vm-actions a").addClass("visible"); |
|
289 | 305 |
}, |
290 | 306 |
|
291 | 307 |
init_layout: function() { |
... | ... | |
625 | 641 |
|
626 | 642 |
this.$(".action-add").click(_.bind(function(e){ |
627 | 643 |
e.preventDefault(); |
644 |
this.network.get("actions").remove("destroy"); |
|
628 | 645 |
this.show_connect_vms(); |
629 | 646 |
}, this)) |
630 | 647 |
|
... | ... | |
635 | 652 |
|
636 | 653 |
this.$(".net-actions .destroy a").click(_.bind(function(e){ |
637 | 654 |
e.preventDefault(); |
638 |
this.confirm_destroy(); |
|
655 |
self.network.get("actions").add("destroy"); |
|
656 |
self.network.get("actions").remove_all("disconnect"); |
|
639 | 657 |
}, this)); |
640 | 658 |
|
659 |
self.network.bind("change:actions", _.bind(function(net, action) { |
|
660 |
if (this.network.get("actions").contains("destroy")) { |
|
661 |
this.confirm_destroy(); |
|
662 |
} else { |
|
663 |
this.cancel_destroy(); |
|
664 |
} |
|
665 |
}, this)) |
|
666 |
|
|
641 | 667 |
this.$(".net-actions button.no").click(function(e){ |
642 | 668 |
e.preventDefault(); |
643 |
var el = $(this); |
|
644 |
el.closest(".confirm_single").hide(); |
|
645 |
el.parent().parent().find("a.selected").removeClass("selected"); |
|
669 |
self.network.get("actions").remove("destroy"); |
|
646 | 670 |
}); |
647 | 671 |
|
648 | 672 |
this.$(".net-actions button.yes").click(function(e){ |
... | ... | |
650 | 674 |
var el = $(this); |
651 | 675 |
el.closest(".confirm_single").hide(); |
652 | 676 |
el.parent().parent().find(".selected").removeClass("selected"); |
653 |
self.network.remove(function() { |
|
654 |
self.network.set({state:"DESTROY"}); |
|
677 |
self.network.call('destroy', {}, function(){ |
|
655 | 678 |
el.closest(".confirm_single").removeClass("in-progress"); |
656 | 679 |
}); |
657 | 680 |
el.closest(".confirm_single").addClass("in-progress"); |
... | ... | |
677 | 700 |
_.bind(this.connect_vms, this)); |
678 | 701 |
}, |
679 | 702 |
|
703 |
cancel_destroy: function() { |
|
704 |
this.$(".net-actions .destroy .confirm_single").hide(); |
|
705 |
this.$(".net-actions .destroy a.selected").removeClass("selected"); |
|
706 |
this.$(".net-actions a").removeClass("visible"); |
|
707 |
}, |
|
708 |
|
|
680 | 709 |
confirm_destroy: function() { |
681 | 710 |
this.$(".destroy .confirm_single").show(); |
682 | 711 |
this.$(".destroy a").addClass("selected"); |
712 |
this.$(".net-actions a").addClass("visible"); |
|
683 | 713 |
}, |
684 | 714 |
|
685 | 715 |
connect_vms: function(vms) { |
Also available in: Unified diff