Commit 022bd92b authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Trigger user quota updates on sepcific ui api calls

- We force user quota information to be updated after the completion of
  vm/network create/destroy actions.
parent 0787ba5c
......@@ -615,6 +615,7 @@
var _success = _.bind(function() {
if (success) { success() };
snf.ui.main.load_user_quotas();
}, this);
var _error = _.bind(function() {
this.set({state: previous_state, status: previous_status})
......@@ -1439,7 +1440,9 @@
function() {
// set state after successful call
self.state('DESTROY');
success.apply(this, arguments)
success.apply(this, arguments);
snf.ui.main.load_user_quotas();
},
error, 'destroy', params);
break;
......@@ -1688,7 +1691,11 @@
params.network.dhcp = false;
}
return this.api_call(this.path, "create", params, callback);
var cb = function() {
callback();
snf.ui.main.load_user_quotas();
}
return this.api_call(this.path, "create", params, cb);
},
get_public: function(){
......@@ -2117,8 +2124,13 @@
opts = {name: name, imageRef: image.id, flavorRef: flavor.id, metadata:meta}
opts = _.extend(opts, extra);
var cb = function() {
snf.ui.main.load_user_quotas();
callback();
}
this.api_call(this.path, "create", {'server': opts}, undefined, undefined, callback, {critical: true});
this.api_call(this.path, "create", {'server': opts}, undefined, undefined, cb, {critical: true});
},
load_missing_images: function(callback) {
......
......@@ -781,7 +781,7 @@
quota_handlers_initialized: false,
load_user_quotas: function() {
load_user_quotas: function(repeat) {
var main_view = this;
if (!snf.user.quota) {
snf.user.quota = new snf.quota.Quota("cyclades");
......@@ -795,9 +795,11 @@
snf.user.quota.load(d);
},
complete: function() {
setTimeout(function(){
main_view.load_user_quotas();
}, synnefo.config.quotas_update_interval || 10000);
if (repeat) {
setTimeout(function(){
main_view.load_user_quotas(1);
}, synnefo.config.quotas_update_interval || 10000);
}
}
});
},
......@@ -838,7 +840,7 @@
// initial view based on user cookie
show_initial_view: function() {
this.set_vm_view_handlers();
this.load_user_quotas();
this.load_user_quotas(1);
this.hide_loading_view();
bb.history.start();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment