From 90675e78152690f5c3aac99f6442e4d66827f584 Mon Sep 17 00:00:00 2001 From: juanmont Date: Tue, 15 Nov 2016 17:29:24 +0100 Subject: [PATCH] Solved the problem of freezing the slider in hosts-tab --- .../tabs/clusters-tab/panels/info/html.hbs | 4 +- .../public/app/tabs/hosts-tab/panels/info.js | 38 +++++++++---------- .../app/tabs/hosts-tab/panels/info/html.hbs | 10 ++--- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/sunstone/public/app/tabs/clusters-tab/panels/info/html.hbs b/src/sunstone/public/app/tabs/clusters-tab/panels/info/html.hbs index 8cf496f1eb..5499fd5c83 100644 --- a/src/sunstone/public/app/tabs/clusters-tab/panels/info/html.hbs +++ b/src/sunstone/public/app/tabs/clusters-tab/panels/info/html.hbs @@ -48,13 +48,13 @@ - + {{tr "Reserved CPU"}} - + {{tr "Reserved Memory"}} diff --git a/src/sunstone/public/app/tabs/hosts-tab/panels/info.js b/src/sunstone/public/app/tabs/hosts-tab/panels/info.js index e73e7b1713..0da79fd82c 100644 --- a/src/sunstone/public/app/tabs/hosts-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/hosts-tab/panels/info.js @@ -120,11 +120,11 @@ define(function(require) { } function changeInputCPU(){ - document.getElementById('change_bar_cpu').value = document.getElementById('textInput_reserved_cpu').value; + document.getElementById('change_bar_cpu_hosts').value = document.getElementById('textInput_reserved_cpu_hosts').value; } function changeInputMEM(){ - document.getElementById('change_bar_mem').value = parseInt(document.getElementById('textInput_reserved_mem').value); + document.getElementById('change_bar_mem_hosts').value = parseInt(document.getElementById('textInput_reserved_mem_hosts').value); } function _setup(context) { @@ -136,10 +136,10 @@ define(function(require) { PermissionsTable.setup(TAB_ID, RESOURCE, this.element, context); //.off and .on prevent multiple clicks events - $(document).off('click', '.update_reserved').on("click", '.update_reserved', function(){ - var reservedCPU = parseInt(document.getElementById('change_bar_cpu').value); + $(document).off('click', '.update_reserved_hosts').on("click", '.update_reserved', function(){ + var reservedCPU = parseInt(document.getElementById('change_bar_cpu_hosts').value); var CPU = parseInt(that.element.HOST_SHARE.FREE_CPU); - var reservedMem = parseInt(document.getElementById('change_bar_mem').value); + var reservedMem = parseInt(document.getElementById('change_bar_mem_hosts').value); var MEM = parseInt(that.element.HOST_SHARE.FREE_MEM); if(parseInt(that.element.HOST_SHARE.USED_CPU) > 0) CPU += parseInt(that.element.HOST_SHARE.USED_CPU); @@ -152,21 +152,21 @@ define(function(require) { Sunstone.runAction("Host.append_template", that.element.ID, TemplateUtils.templateToString(obj)); }); - document.getElementById("change_bar_cpu").addEventListener("change", function(){ - if(parseInt(document.getElementById('change_bar_cpu').value) > that.element.HOST_SHARE.TOTAL_CPU) - document.getElementById('textInput_reserved_cpu').style.backgroundColor = 'rgba(111, 220, 111,0.5)'; - if(parseInt(document.getElementById('change_bar_cpu').value) < that.element.HOST_SHARE.TOTAL_CPU) - document.getElementById('textInput_reserved_cpu').style.backgroundColor = 'rgba(255, 80, 80,0.5)'; - document.getElementById('textInput_reserved_cpu').value = document.getElementById('change_bar_cpu').value; + document.getElementById("change_bar_cpu_hosts").addEventListener("change", function(){ + if(parseInt(document.getElementById('change_bar_cpu_hosts').value) > that.element.HOST_SHARE.TOTAL_CPU) + document.getElementById('textInput_reserved_cpu_hosts').style.backgroundColor = 'rgba(111, 220, 111,0.5)'; + if(parseInt(document.getElementById('change_bar_cpu_hosts').value) < that.element.HOST_SHARE.TOTAL_CPU) + document.getElementById('textInput_reserved_cpu_hosts').style.backgroundColor = 'rgba(255, 80, 80,0.5)'; + document.getElementById('textInput_reserved_cpu_hosts').value = document.getElementById('change_bar_cpu_hosts').value; }); - document.getElementById("textInput_reserved_cpu").addEventListener("change", changeInputCPU); - document.getElementById("change_bar_mem").addEventListener("change", function(){ - if(parseInt(document.getElementById('change_bar_mem').value) > that.element.HOST_SHARE.TOTAL_MEM) - document.getElementById('textInput_reserved_mem').style.backgroundColor = 'rgba(111, 220, 111,0.5)'; - if(parseInt(document.getElementById('change_bar_mem').value) < that.element.HOST_SHARE.TOTAL_MEM) - document.getElementById('textInput_reserved_mem').style.backgroundColor = 'rgba(255, 80, 80,0.5)'; - document.getElementById('textInput_reserved_mem').value = Humanize.size(parseInt(document.getElementById('change_bar_mem').value)); + document.getElementById("textInput_reserved_cpu_hosts").addEventListener("change", changeInputCPU); + document.getElementById("change_bar_mem_hosts").addEventListener("change", function(){ + if(parseInt(document.getElementById('change_bar_mem_hosts').value) > that.element.HOST_SHARE.TOTAL_MEM) + document.getElementById('textInput_reserved_mem_hosts').style.backgroundColor = 'rgba(111, 220, 111,0.5)'; + if(parseInt(document.getElementById('change_bar_mem_hosts').value) < that.element.HOST_SHARE.TOTAL_MEM) + document.getElementById('textInput_reserved_mem_hosts').style.backgroundColor = 'rgba(255, 80, 80,0.5)'; + document.getElementById('textInput_reserved_mem_hosts').value = Humanize.size(parseInt(document.getElementById('change_bar_mem_hosts').value)); }); - document.getElementById("textInput_reserved_mem").addEventListener("change", changeInputMEM); + document.getElementById("textInput_reserved_mem_hosts").addEventListener("change", changeInputMEM); } }); diff --git a/src/sunstone/public/app/tabs/hosts-tab/panels/info/html.hbs b/src/sunstone/public/app/tabs/hosts-tab/panels/info/html.hbs index 2c1662d64c..7ff53d2194 100644 --- a/src/sunstone/public/app/tabs/hosts-tab/panels/info/html.hbs +++ b/src/sunstone/public/app/tabs/hosts-tab/panels/info/html.hbs @@ -83,7 +83,7 @@ {{tr "Overcommitment"}} - @@ -93,15 +93,15 @@ {{tr "CPU"}} - + - + {{tr "Memory"}} - + - +