Revision d1f55cb0 ui/static/snf/js/ui/web/ui_list_view.js
b/ui/static/snf/js/ui/web/ui_list_view.js | ||
---|---|---|
52 | 52 |
|
53 | 53 |
this.parent.$(".actions a.enabled").live({ |
54 | 54 |
'mouseenter': function() { |
55 |
self.parent.set_indicator_for($(this).attr("id").replace("action-","")) |
|
56 | 55 |
self.hovered = true; |
56 |
self.parent.set_indicator_for($(this).attr("id").replace("action-","")) |
|
57 | 57 |
}, |
58 | 58 |
'mouseleave': function() { |
59 |
self.parent.clear_indicators(); |
|
60 | 59 |
self.hovered = false; |
60 |
self.parent.clear_indicators(); |
|
61 | 61 |
} |
62 | 62 |
}); |
63 | 63 |
}, |
... | ... | |
81 | 81 |
}, this)) |
82 | 82 |
}, |
83 | 83 |
|
84 |
update_selected: function() { |
|
85 |
this.$("tr").removeClass("checked"); |
|
86 |
this.$("tr input:checked").parent().parent().addClass("checked"); |
|
87 |
}, |
|
88 |
|
|
84 | 89 |
update_layout: function() { |
85 | 90 |
this.update_actions(); |
91 |
this.update_selected(); |
|
86 | 92 |
} |
87 | 93 |
}); |
88 | 94 |
|
... | ... | |
174 | 180 |
|
175 | 181 |
// set generic view handlers |
176 | 182 |
set_handlers: function() { |
177 |
//init_action_indicator_handlers('list'); |
|
178 |
|
|
179 | 183 |
this.$(".list-vm-checkbox").live('change', _.bind(function(){ |
180 | 184 |
this.reset_actions(); |
181 | 185 |
this.actions.update_layout(); |
... | ... | |
184 | 188 |
} else { |
185 | 189 |
this.select_all.attr("checked", false); |
186 | 190 |
} |
191 |
self.actions.update_layout(); |
|
187 | 192 |
}, this)) |
188 | 193 |
|
189 | 194 |
var self = this; |
... | ... | |
238 | 243 |
|
239 | 244 |
// ancestor method |
240 | 245 |
this.__set_vm_handlers(vm); |
241 |
this.set_vm_handlers(vm); |
|
242 | 246 |
this.post_add(vm); |
243 | 247 |
}, |
244 | 248 |
|
... | ... | |
259 | 263 |
}, |
260 | 264 |
|
261 | 265 |
set_indicator_for: function(action) { |
262 |
var vms = this.get_selected_vms(); |
|
266 |
var vms = this.get_selected_vms();;
|
|
263 | 267 |
_.each(vms, _.bind(function(vm){ |
264 | 268 |
var vmel = this.vm(vm); |
265 | 269 |
vmel.find("img.spinner, img.wave, img.os_icon").hide(); |
... | ... | |
306 | 310 |
img = img + '<img src="static/icons/indicators/medium/wave.gif" class="wave" />'; |
307 | 311 |
img = img + '<span class="action-indicator" />'; |
308 | 312 |
|
309 |
var name = util.truncate(vm.get('name'), 20);
|
|
313 |
var name = util.truncate(vm.get('name'), 25);
|
|
310 | 314 |
var flavor = vm.get_flavor().details_string(); |
311 | 315 |
var status = STATE_TEXTS[vm.state()]; |
312 | 316 |
|
... | ... | |
318 | 322 |
|
319 | 323 |
// is vm in transition ??? show the progress spinner |
320 | 324 |
update_transition_state: function(vm) { |
325 |
if ((this.actions.hovered && this.vm(vm).find("input").is(":checked")) || vm.pending_action) { |
|
326 |
this.sel('vm_spinner', vm.id).hide(); |
|
327 |
this.sel('vm_wave', vm.id).hide(); |
|
328 |
this.sel('os_icon', vm.id).hide(); |
|
329 |
this.vm(vm).find(".action-indicator").show(); |
|
330 |
return; |
|
331 |
} |
|
332 |
|
|
321 | 333 |
if (vm.in_transition()){ |
322 | 334 |
this.sel('vm_spinner', vm.id).show(); |
323 | 335 |
this.sel('vm_wave', vm.id).hide(); |
... | ... | |
325 | 337 |
this.$(".action-indicator").hide(); |
326 | 338 |
} else { |
327 | 339 |
this.sel('vm_spinner', vm.id).hide(); |
340 |
this.$(".action-indicator").hide(); |
|
328 | 341 |
} |
329 | 342 |
}, |
330 | 343 |
|
... | ... | |
348 | 361 |
if (vm.in_transition()) { |
349 | 362 |
self.sel("vm_spinner", vm.id).fadeIn(200); |
350 | 363 |
} else { |
351 |
self.sel("os_icon", vm.id).fadeIn(200); |
|
364 |
if (vm.pending_action || (self.actions.hovered && this.vm(vm).find("input").is(":checked"))) { |
|
365 |
self.vm(vm).find(".action-indicator").show(); |
|
366 |
} else { |
|
367 |
self.sel("os_icon", vm.id).fadeIn(200); |
|
368 |
} |
|
352 | 369 |
} |
353 | 370 |
}); |
354 | 371 |
}, |
... | ... | |
367 | 384 |
this.table.fnUpdate(params[2], parseInt(index), 2); |
368 | 385 |
this.table.fnUpdate(params[3], parseInt(index), 3); |
369 | 386 |
this.table.fnUpdate(params[4], parseInt(index), 4); |
387 |
|
|
388 |
var active_class = vm.is_active() ? "active" : "inactive"; |
|
389 |
this.vm(vm).removeClass("active").removeClass("inactive").addClass(active_class); |
|
390 |
$(this.vm(vm).find("td").get(4)).addClass("status"); |
|
391 |
$(this.vm(vm).find("td").get(3)).addClass("flavor"); |
|
392 |
$(this.vm(vm).find("td").get(2)).addClass("name"); |
|
393 |
|
|
394 |
if (vm.status() == "ERROR") { |
|
395 |
this.vm(vm).removeClass("active").removeClass("inactive").addClass("error"); |
|
396 |
} |
|
370 | 397 |
|
371 | 398 |
this.update_os_icon(vm); |
372 | 399 |
this.update_transition_state(vm); |
... | ... | |
378 | 405 |
|
379 | 406 |
// vm specific event handlers |
380 | 407 |
set_vm_handlers: function(vm) { |
381 |
|
|
382 | 408 |
}, |
383 | 409 |
|
384 | 410 |
// generic stuff to do on each view update |
Also available in: Unified diff