[Kimchi-devel] [PATCH v2] [Kimchi] Disable vm statistics/screenshots in edit guest
Jose Ricardo Ziviani
joserz at linux.vnet.ibm.com
Thu Jul 28 13:40:34 UTC 2016
- When Edit Guest modal window is opened, Kimchi continues to make
requests to get all VM' statistics and screenshots, that affects
necessary and heavy requests like PCI queries. This commit
disable those poolings when the modal window is opened and
re-enable when the modal is closed.
Signed-off-by: Jose Ricardo Ziviani <joserz at linux.vnet.ibm.com>
---
v2:
- wrapped the setTimeout in a function to avoid duplication of
hardcoded magic numbers
ui/js/src/kimchi.guest_edit_main.js | 5 +++++
ui/js/src/kimchi.guest_main.js | 11 +++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/ui/js/src/kimchi.guest_edit_main.js b/ui/js/src/kimchi.guest_edit_main.js
index 9099f39..c4f39c4 100644
--- a/ui/js/src/kimchi.guest_edit_main.js
+++ b/ui/js/src/kimchi.guest_edit_main.js
@@ -20,6 +20,11 @@ kimchi.guest_edit_main = function() {
var formTargetId;
var guestEditForm = $('#form-guest-edit-general');
var saveButton = $('#guest-edit-button-save');
+ clearTimeout(kimchi.vmTimeout);
+
+ $('#modalWindow').on('hidden.bs.modal', function() {
+ kimchi.setListVMAutoTimeout();
+ });
$('#guest-edit-window a[data-toggle="tab"]').on('show.bs.tab', function(tab) {
tab.target; // newly activated tab
diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
index ab26fa4..9c1aa54 100644
--- a/ui/js/src/kimchi.guest_main.js
+++ b/ui/js/src/kimchi.guest_main.js
@@ -900,8 +900,7 @@ kimchi.listVmsAuto = function() {
$('#guests-root-container > .wok-mask').fadeOut(300, function() {});
}
}
-
- kimchi.vmTimeout = window.setTimeout("kimchi.listVmsAuto();", 5000);
+ kimchi.setListVMAutoTimeout();
},
function(errorResponse, textStatus, errorThrown) {
if (errorResponse.responseJSON && errorResponse.responseJSON.reason) {
@@ -910,11 +909,11 @@ kimchi.listVmsAuto = function() {
$('#guests-root-container > .wok-mask').addClass('hidden');
});
}
- kimchi.vmTimeout = window.setTimeout("kimchi.listVmsAuto();", 5000);
+ kimchi.setListVMAutoTimeout();
});
} else {
clearTimeout(kimchi.vmTimeout);
- kimchi.vmTimeout = window.setTimeout("kimchi.listVmsAuto();", 5000);
+ kimchi.setListVMAutoTimeout();
}
};
@@ -924,3 +923,7 @@ kimchi.editTemplate = function(guestTemplate, oldPopStat) {
}
return guestTemplate;
};
+
+kimchi.setListVMAutoTimeout = function() {
+ kimchi.vmTimeout = window.setTimeout("kimchi.listVmsAuto();", 5000);
+}
--
2.7.4
More information about the Kimchi-devel
mailing list