Revision 44660f58

b/ui/static/snf/js/ui/web/ui_icon_view.js
112 112
                } else {
113 113
                    this.toggler.addClass("open");
114 114
                    this.vm.do_update_stats = true;
115
                    this.view.details_views[this.vm.id].update_layout();
116
                    this.view.tags_views[this.vm.id].update_layout();
117
                    this.view.stats_views[this.vm.id].update_layout();
115 118
                }
116 119
                
117 120
                var self = this;
......
542 545
        },
543 546

  
544 547
        update_layout: function() {
548
            if (!this.visible() && this.parent.details_hidden) { return };
549

  
545 550
            var image = this.vm.get_image();
546 551
            var flavor = this.vm.get_flavor();
547 552
            if (!flavor || !image) {
......
554 559
            this.sel('cpu').text(flavor.get('cpu'));
555 560
            this.sel('ram').text(flavor.get('ram'));
556 561
            this.sel('disk').text(flavor.get('disk'));
562

  
563
            this.parent.tags_views[this.vm.id].update_layout();
564
            this.parent.stats_views[this.vm.id].update_layout();
557 565
        }
558 566
    });
559 567
    
......
563 571
        // view id (this could be used to identify 
564 572
        // the view object from global context
565 573
        view_id: 'vm_icon',
574
        
575
        details_hidden: true,
566 576

  
567 577
        el: '#machinesview-icon',
568 578
        id_tpl: 'icon-vm-',
569 579

  
570 580
        selectors: {
571 581
            'vms': '.machine-container',
572
            'vm': '#icon-vm-{0}',
582
            'vm': '#icon-vm-',
573 583
            'view': '#machinesview-icon',
574 584
            'tpl': '#machinesview-icon.standard #machine-container-template',
575 585
            'spinner': '.large-spinner',
......
662 672
            // truncate name
663 673
            el.find("span.name").text(util.truncate(vm.get("name"), 40));
664 674
            // set ips
665
            el.find(".ipv4-text").text(vm.get_addresses().ip4 || "undefined");
675
            el.find("span.ipv4-text").text(vm.get_addresses().ip4 || "undefined");
666 676
            // TODO: fix ipv6 truncates and tooltip handler
667
            el.find(".ipv6-text").text(vm.get_addresses().ip6 || "undefined");
677
            el.find("span.ipv6-text").text(vm.get_addresses().ip6 || "undefined");
668 678
            // set the state (i18n ??)
669
            el.find(".status").text(STATE_TEXTS[vm.state()]);
679
            el.find("div.status").text(STATE_TEXTS[vm.state()]);
670 680
            // set state class
671
            el.find(".state").removeClass().addClass(views.IconView.STATE_CLASSES[vm.state()].join(" "));
681
            el.find("div.state").removeClass().addClass(views.IconView.STATE_CLASSES[vm.state()].join(" "));
672 682
            // os icon
673
            el.find(".logo").css({'background-image': "url(" + this.get_vm_icon_path(vm, "medium") + ")"});
683
            el.find("div.logo").css({'background-image': "url(" + this.get_vm_icon_path(vm, "medium") + ")"});
674 684
            
675 685
            el.removeClass("connectable");
676 686
            if (vm.is_connectable()) {
677 687
                el.addClass("connectable");
678 688
            }
679 689
            
680
            if (vm.get('status') == 'BUILD') {
690
            var status = vm.get("status");
691
            var state = vm.get("state");
692

  
693
            if (status == 'BUILD') {
681 694
                // update bulding progress
682
                el.find(".machine-ips").hide();
683
                el.find(".build-progress").show().text(vm.get('progress_message'));
695
                el.find("div.machine-ips").hide();
696
                el.find("div.build-progress").show().text(vm.get('progress_message'));
684 697
            } else {
685 698
                // hide building progress
686
                el.find(".machine-ips").show()
687
                el.find(".build-progress").hide();
699
                el.find("div.machine-ips").show()
700
                el.find("div.build-progress").hide();
688 701
            }
689 702

  
690
            if (vm.state() == "DESTROY") {
691
                el.find(".machine-ips").hide();
692
                el.find(".build-progress").show().text("Terminating...");
703
            if (state == "DESTROY") {
704
                el.find("div.machine-ips").hide();
705
                el.find("div.build-progress").show().text("Terminating...");
693 706
            }
694 707

  
695 708
            icon_state = vm.is_active() ? "on" : "off";
......
697 710
            
698 711
            // update subviews
699 712
            this.rename_views[vm.id].update_layout();
700
            this.stats_views[vm.id].update_layout();
701 713
            this.connect_views[vm.id].update_layout();
702
            this.tags_views[vm.id].update_layout();
703 714
            this.details_views[vm.id].update_layout();
704 715
        },
705 716

  
b/ui/static/snf/js/ui/web/ui_list_view.js
108 108

  
109 109
        selectors: {
110 110
            'vms': '.list-container',
111
            'vm': '#list-vm-{0}',
111
            'vm': '#list-vm-',
112 112
            'view': '#machinesview-list',
113 113
            'tpl': '.list-container#machine-container-template',
114 114
            'spinner': '.large-spinner',
b/ui/static/snf/js/ui/web/ui_single_view.js
45 45

  
46 46
        selectors: {
47 47
            'vms': '.single-container',
48
            'vm': 'div#single-vm-{0}',
48
            'vm': 'div#single-vm-',
49 49
            'view': '#machinesview-single',
50 50
            'tpl': 'div.single-container#machine-container-template',
51 51
            'spinner': '.large-spinner',
......
105 105

  
106 106
        update_current_vm: function() {
107 107
            storage.vms.stop_stats_update();
108

  
109 108
            try {
110 109
                this.current_vm_instance = storage.vms.at(this.current_vm);
111 110
                this.current_vm_instance.do_update_stats = true;
......
208 207

  
209 208

  
210 209
            $("#" + this.link_id_tpl + this.current_vm).addClass("column3-selected");
210
            try {
211
                this.update_details(vm);
212
            } catch (err) {};
211 213
        },
212 214

  
213 215
        show_vm_menu: function() {
......
241 243
        // update vm details
242 244
        update_details: function(vm) {
243 245
            var el = this.vm(vm);
246
            if (vm != this.current_vm_instance) { return };
247

  
244 248
            // truncate name
245 249
            el.find(".machine-detail.name").text(util.truncate(vm.get("name"), 35));
246 250
            // set ips
b/ui/static/snf/js/ui/web/ui_vms_base_view.js
32 32

  
33 33
        initialize: function() {
34 34
            views.VMListView.__super__.initialize.call(this);
35

  
36 35
            this.set_storage_handlers();
37 36
            this.set_handlers();
38 37
            this.vms_updated_handler();
39

  
40 38
            this.connect_overlay = new views.VMConnectView();
41
            
39
            this.vm_selector = this.selectors.vm;
42 40
        },
43 41

  
44 42
        // Helpers
......
51 49
        
52 50
        // vm element based on vm model instance provided
53 51
        vm: function(vm) {
54
            return this.sel('vm', vm.id);
52
            return $(this.vm_selector + vm.id);
55 53
        },
56 54
        
57 55
        // get vm model instance from DOM element
......
80 78
                this.remove_vm(model)
81 79
                return;
82 80
            }
83

  
81
            
84 82
            this.update_vms(updated);
85 83
        },
86 84

  
......
160 158

  
161 159
        // do update for provided vms, then update the view layout
162 160
        update_vms: function(vms) {
163

  
164 161
            if (!this.visible() && !snf.config.update_hidden_views) { return };
165 162

  
166 163
            _.each(vms, _.bind(function(vm){
b/ui/templates/home.html
562 562
                synnefo.config.overlay_speed = 0;
563 563
            }
564 564

  
565
            synnefo.config.update_hidden_views = true;
565
            synnefo.config.update_hidden_views = false;
566 566
            synnefo.ui.init();
567 567

  
568 568
        })

Also available in: Unified diff