Revision 2ab5aa9a

b/ui/static/snf/js/ui/web/ui_single_view.js
68 68
        },
69 69

  
70 70
        // overload show function
71
        show_view: function() {
71
        show: function() {
72
            views.SingleView.__super__.show.apply(this, arguments);
72 73
            this.log.debug("showing");
73 74
            this.$(".column3").show();
75
            this.show_vm_menu();
76
            this.show_current();
74 77
        },
75 78

  
76 79
        show_vm: function(vm) {
......
101 104
        },  
102 105

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

  
104 109
            try {
105 110
                this.current_vm_instance = storage.vms.at(this.current_vm);
111
                this.current_vm_instance.do_update_stats = true;
106 112
            } catch (err) {
107 113
                this.log.debug("Cannot select current vm instance for: {0}".format(this.current_vm));
108 114
            }
......
139 145
        // stuff to do when a new vm has been created.
140 146
        // - create vm subviews
141 147
        post_add: function(vm) {
148
            this.show_vm_menu();
149
            this.show_current();
150

  
142 151
            // rename views index
143 152
            this.stats_views = this.stats_views || {};
144 153
            this.connect_views = this.connect_views || {};
......
159 168
        },
160 169

  
161 170
        post_update_vm: function(vm) {
162
            vm.enable_stats_update();
163 171
        },
164 172
        
165 173
        // vm specific event handlers
......
170 178
        // handle selected vm
171 179
        show_current: function() {
172 180
            var index = this.current_vm;
173
            
181
            var vm = storage.vms.at(index);
182

  
174 183
            this.$(".server-name").removeClass("column3-selected");
175 184
            
176
            _.each(storage.vms.models, function(vm){
177
                this.vm(vm).hide();
185
            if (vm) {
186
                this.vm(vm).show();
187
            };
188

  
189
            _.each(storage.vms.models, function(vmo){
190
                if (vm && (vm.id != vmo.id)) {
191
                    this.vm(vmo).hide();
192
                }
178 193
            }, this)
179 194

  
180
            vm = storage.vms.at(index);
181 195
            if (!vm) {
182 196
                // empty list
183 197
                this.$(".column3").hide();
......
185 199
            }
186 200
            this.$(".column3").show();
187 201

  
188
            if (vm) {
189
                this.vm(vm).show();
190
            };
191 202

  
192 203
            $("#" + this.link_id_tpl + this.current_vm).addClass("column3-selected");
193 204
        },
......
205 216
            
206 217
            var self = this;
207 218
            this.menu.find(".server-name").click(function(ev) {
208
                storage.vms.reset_pending_actions();
209

  
210 219
                ev.preventDefault();
211 220
                var id = $(this).attr("id").replace("single-vm-at-", "");
212 221
                self.current_vm = id;
......
219 228
        // called once after each vm has been updated
220 229
        update_layout: function() {
221 230
            this.update_current_vm();
222
            this.show_vm_menu();
223
            this.show_current();
224 231
            fix_v6_addresses();
225 232
        },
226 233

  

Also available in: Unified diff