294 |
294 |
|
295 |
295 |
initialize: function(show_view) {
|
296 |
296 |
if (!show_view) { show_view = 'icon' };
|
297 |
|
|
|
297 |
|
|
298 |
this.empty_hidden = true;
|
298 |
299 |
// fallback to browser error reporting (true for debug)
|
299 |
300 |
this.skip_errors = true
|
300 |
301 |
|
... | ... | |
355 |
356 |
// vm handlers
|
356 |
357 |
storage.vms.bind("remove", _.bind(this.check_empty, this));
|
357 |
358 |
storage.vms.bind("add", _.bind(this.check_empty, this));
|
358 |
|
storage.vms.bind("change", _.bind(this.check_empty, this));
|
|
359 |
storage.vms.bind("change:status", _.bind(this.check_empty, this));
|
359 |
360 |
storage.vms.bind("reset", _.bind(this.check_empty, this));
|
360 |
361 |
|
361 |
362 |
// api calls handlers
|
... | ... | |
577 |
578 |
if (storage.vms.length == 0) {
|
578 |
579 |
this.show_view("machines");
|
579 |
580 |
this.show_empty();
|
|
581 |
this.empty_hidden = false;
|
580 |
582 |
} else {
|
581 |
583 |
this.hide_empty();
|
582 |
584 |
}
|
583 |
|
this.select_view.update_layout();
|
584 |
585 |
},
|
585 |
586 |
|
586 |
587 |
show_empty: function() {
|
|
588 |
if (!this.empty_hidden) { return };
|
587 |
589 |
$("#machines-pane-top").addClass("empty");
|
588 |
590 |
|
589 |
591 |
this.$(".panes").hide();
|
590 |
592 |
this.$("#machines-pane").show();
|
591 |
593 |
|
592 |
594 |
this.hide_views([]);
|
|
595 |
this.empty_hidden = false;
|
593 |
596 |
this.empty_view.show();
|
|
597 |
this.select_view.update_layout();
|
|
598 |
this.empty_hidden = false;
|
594 |
599 |
},
|
595 |
600 |
|
596 |
601 |
hide_empty: function() {
|
|
602 |
if (this.empty_hidden) { return };
|
597 |
603 |
$("#machines-pane-top").removeClass("empty");
|
598 |
604 |
|
599 |
|
this.empty_view = new views.EmptyView();
|
600 |
|
this.empty_view.hide();
|
|
605 |
this.empty_view.hide(true);
|
601 |
606 |
if (this.current_view && !this.current_view.visible()) {
|
602 |
607 |
this.current_view.show();
|
603 |
608 |
}
|
|
609 |
this.empty_hidden = true;
|
|
610 |
this.select_view.update_layout();
|
604 |
611 |
},
|
605 |
612 |
|
606 |
613 |
get_title: function(view_id) {
|