Revision 9ce969a7 ui/static/snf/js/ui/web/ui_main_view.js
b/ui/static/snf/js/ui/web/ui_main_view.js | ||
---|---|---|
339 | 339 |
}, |
340 | 340 |
|
341 | 341 |
handle_api_error_state: function(state) { |
342 |
if (snf.api.error_state) { |
|
342 |
if (snf.api.error_state === snf.api.STATES.ERROR) {
|
|
343 | 343 |
this.stop_intervals(); |
344 | 344 |
} else { |
345 | 345 |
if (this.intervals_stopped) { |
... | ... | |
348 | 348 |
} |
349 | 349 |
}, |
350 | 350 |
|
351 |
handle_api_error: function(xhr, type, message) { |
|
351 |
handle_api_error: function(args) { |
|
352 |
if (arguments.length == 1) { arguments = _.toArray(arguments[0])}; |
|
353 |
|
|
354 |
if (!_.last(arguments).display) { |
|
355 |
return; |
|
356 |
} |
|
357 |
|
|
352 | 358 |
this.error_state = true; |
353 |
this.log.error("API ERRROR", arguments); |
|
354 | 359 |
|
355 | 360 |
var xhr = arguments[0]; |
356 |
var args = util.parse_api_error(arguments);
|
|
361 |
var args = util.parse_api_error.apply(util, arguments);
|
|
357 | 362 |
|
358 | 363 |
// force logout if UNAUTHORIZED request arrives |
359 | 364 |
if (args.code == 401) { snf.ui.logout(); return }; |
... | ... | |
401 | 406 |
this.update_status("Loading vms..."); |
402 | 407 |
storage.vms.fetch({refresh:true, update:false, success: function(){ |
403 | 408 |
self.update_status("VMS Loaded."); |
404 |
self.check_status() |
|
409 |
self.check_status();
|
|
405 | 410 |
}}); |
411 |
|
|
406 | 412 |
this.update_status("Loading networks..."); |
407 | 413 |
storage.networks.fetch({refresh:true, update:false, success: function(){ |
408 | 414 |
self.update_status("Networks loaded."); |
409 |
self.check_status() |
|
415 |
self.check_status();
|
|
410 | 416 |
}}); |
411 | 417 |
}, |
412 | 418 |
|
413 | 419 |
init_intervals: function() { |
414 |
this._networks = storage.networks.get_fetcher(snf.config.update_interval, snf.config.update_interval/2, 2, true, undefined); |
|
415 |
this._vms = storage.vms.get_fetcher(snf.config.update_interval, snf.config.update_interval/2, 2, true, undefined); |
|
420 |
this._networks = storage.networks.get_fetcher(snf.config.update_interval, |
|
421 |
snf.config.update_interval - 100, |
|
422 |
1, true, undefined); |
|
423 |
this._vms = storage.vms.get_fetcher(snf.config.update_interval, |
|
424 |
snf.config.update_interval - 100, |
|
425 |
1, true, undefined); |
|
416 | 426 |
}, |
417 | 427 |
|
418 | 428 |
stop_intervals: function() { |
... | ... | |
679 | 689 |
$(".large-spinner").remove(); |
680 | 690 |
|
681 | 691 |
storage.vms.reset_pending_actions(); |
682 |
storage.vms.reset_stats_update();
|
|
692 |
storage.vms.stop_stats_update();
|
|
683 | 693 |
|
684 | 694 |
// show current view |
685 | 695 |
this.show_view_pane(); |
Also available in: Unified diff