Revision 6db98d7c
b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_main_view.js | ||
---|---|---|
530 | 530 |
}, |
531 | 531 |
|
532 | 532 |
set_interval_timeouts: function(time) { |
533 |
_.each([this._networks, this._vms], _.bind(function(fetcher){
|
|
533 |
_.each(this._fetchers, _.bind(function(fetcher){
|
|
534 | 534 |
if (!fetcher) { return }; |
535 | 535 |
if (this.focused) { |
536 | 536 |
fetcher.interval = fetcher.normal_interval; |
... | ... | |
559 | 559 |
storage.vms.bind("change:status", _.bind(this.check_empty, this)); |
560 | 560 |
storage.vms.bind("reset", _.bind(this.check_empty, this)); |
561 | 561 |
storage.quotas.bind("change", _.bind(this.update_create_buttons_status, this)); |
562 |
// additionally check quotas the first time they get fetched |
|
562 | 563 |
storage.quotas.bind("add", _.bind(this.update_create_buttons_status, this)); |
563 | 564 |
|
564 | 565 |
}, |
... | ... | |
656 | 657 |
}}); |
657 | 658 |
|
658 | 659 |
}, |
659 |
|
|
660 |
init_intervals: function() { |
|
660 |
|
|
661 |
_fetchers: {}, |
|
662 |
init_interval: function(key, collection) { |
|
663 |
if (this._fetchers[key]) { return } |
|
661 | 664 |
var fetcher_params = [snf.config.update_interval, |
662 | 665 |
snf.config.update_interval_increase || 500, |
663 | 666 |
snf.config.fast_interval || snf.config.update_interval/2, |
664 | 667 |
snf.config.update_interval_increase_after_calls || 4, |
665 | 668 |
snf.config.update_interval_max || 20000, |
666 | 669 |
true, |
667 |
{is_recurrent: true}] |
|
668 |
|
|
669 |
this._networks = storage.networks.get_fetcher.apply(storage.networks, _.clone(fetcher_params)); |
|
670 |
this._vms = storage.vms.get_fetcher.apply(storage.vms, _.clone(fetcher_params)); |
|
671 |
this._quotas = storage.quotas.get_fetcher.apply(storage.quotas, _.clone(fetcher_params)); |
|
670 |
{is_recurrent: true}]; |
|
671 |
var fetcher = collection.get_fetcher.apply(collection, _.clone(fetcher_params)); |
|
672 |
this._fetchers[key] = fetcher; |
|
673 |
collection.fetch(); |
|
674 |
|
|
675 |
}, |
|
676 |
|
|
677 |
init_intervals: function() { |
|
678 |
_.each({ |
|
679 |
'networks': storage.networks, |
|
680 |
'vms': storage.vms, |
|
681 |
'quotas': storage.quotas, |
|
682 |
'ips': storage.floating_ips, |
|
683 |
'subnets': storage.subnets, |
|
684 |
'ports': storage.ports, |
|
685 |
'keys': storage.keys |
|
686 |
}, function(col, name) { |
|
687 |
this.init_interval(name, col) |
|
688 |
}, this); |
|
672 | 689 |
}, |
673 | 690 |
|
674 | 691 |
stop_intervals: function() { |
675 |
if (this._networks) { this._networks.stop(); }
|
|
676 |
if (this._vms) { this._vms.stop(); }
|
|
677 |
if (this._quotas) { this._quotas.stop(); }
|
|
692 |
_.each(this._fetchers, function(fetcher) {
|
|
693 |
fetcher.stop();
|
|
694 |
});
|
|
678 | 695 |
this.intervals_stopped = true; |
679 | 696 |
}, |
680 | 697 |
|
681 | 698 |
update_intervals: function() { |
682 |
if (this._networks) { |
|
683 |
this._networks.stop(); |
|
684 |
this._networks.start(); |
|
685 |
} else { |
|
686 |
this.init_intervals(); |
|
687 |
} |
|
688 |
|
|
689 |
if (this._vms) { |
|
690 |
this._vms.stop(); |
|
691 |
this._vms.start(); |
|
692 |
} else { |
|
693 |
this.init_intervals(); |
|
694 |
} |
|
695 |
|
|
696 |
if (this._quotas) { |
|
697 |
this._quotas.stop(); |
|
698 |
this._quotas.start(); |
|
699 |
} else { |
|
700 |
this.init_intervals(); |
|
701 |
} |
|
702 |
|
|
699 |
_.each(this._fetchers, function(fetcher) { |
|
700 |
fetcher.stop(); |
|
701 |
fetcher.start(); |
|
702 |
}) |
|
703 | 703 |
this.intervals_stopped = false; |
704 | 704 |
}, |
705 | 705 |
|
Also available in: Unified diff