From 1aefbcca675f6e8f0fed1c8700a8822ea9672cb5 Mon Sep 17 00:00:00 2001 From: phamt Date: Wed, 22 Sep 2010 20:18:21 +0000 Subject: [PATCH] Disable buttons by using ".attr('disable', 'true')" instead of ".unbind()" git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7587 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/custom/zvm.js | 6 +----- xCAT-UI/js/custom/zvmUtils.js | 39 +++++++++------------------------- xCAT-UI/js/nodes/nodes.js | 14 +++--------- xCAT-UI/js/nodes/nodeset.js | 6 +----- xCAT-UI/js/nodes/rnetboot.js | 6 +----- xCAT-UI/js/nodes/updatenode.js | 8 ++----- 6 files changed, 18 insertions(+), 61 deletions(-) diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index 74259de7d..e66d1161a 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -252,11 +252,7 @@ zvmPlugin.prototype.loadClonePage = function(node) { $('#' + statBarId).show(); // Disable clone button - $(this).unbind(event); - $(this).css( { - 'background-color' : '#F2F2F2', - 'color' : '#BDBDBD' - }); + $(this).attr('disabled', 'true'); } else { alert('(Error) ' + errMsg); } diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 8c6b992ea..7e9f839c8 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -155,7 +155,6 @@ function loadUserEntry(data) { }); // Disable save button - $(this).unbind(event); $(this).hide(); cancelBtn.hide(); }); @@ -1725,12 +1724,8 @@ function createZProvisionExisting(inst) { // If all inputs are valid, ready to provision if (ready) { // Disable provision button - $(this).unbind(event); - $(this).css( { - 'background-color' : '#F2F2F2', - 'color' : '#BDBDBD' - }); - + $(this).attr('disabled', 'true'); + // Show loader $('#zProvisionStatBar' + inst).show(); $('#zProvisionLoader' + inst).show(); @@ -2040,22 +2035,15 @@ function createZProvisionNew(inst) { // If user clicks Ok if (confirm(msg)) { // Disable provision button - $(this).unbind('click'); - $(this).css( { - 'background-color' : '#F2F2F2', - 'color' : '#BDBDBD' - }); - + $(this).attr('disabled', 'true'); + // Show loader $('#zProvisionStatBar' + inst).show(); $('#zProvisionLoader' + inst).show(); // Disable add disk button - addDiskLink.unbind('click'); - addDiskLink.css( { - 'color' : '#BDBDBD' - }); - + addDiskLink.attr('disabled', 'true'); + // Disable close button on disk table $('#' + thisTabId + ' table span').unbind('click'); @@ -2109,22 +2097,15 @@ function createZProvisionNew(inst) { */ // Disable provision button - $(this).unbind(event); - $(this).css( { - 'background-color' : '#F2F2F2', - 'color' : '#BDBDBD' - }); - + $(this).attr('disabled', 'true'); + // Show loader $('#zProvisionStatBar' + inst).show(); $('#zProvisionLoader' + inst).show(); // Disable add disk button - addDiskLink.unbind('click'); - addDiskLink.css( { - 'color' : '#BDBDBD' - }); - + addDiskLink.attr('disabled', 'true'); + // Disable close button on disk table $('#' + thisTabId + ' table span').unbind('click'); diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index 0ced693e0..d8f13f7e6 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -635,7 +635,7 @@ function loadNodes(data) { powerCol.bind('click', function(event) { refreshPowerStatus(group); }); - + /** * Get power and ping status for each node */ @@ -979,11 +979,7 @@ function loadUnlockPage(tgtNodes) { statusBar.show(); // Disable Ok button - $(this).unbind(event); - $(this).css( { - 'background-color' : '#F2F2F2', - 'color' : '#BDBDBD' - }); + $(this).attr('disabled', 'true'); } }); @@ -1213,11 +1209,7 @@ function deleteNode(tgtNodes) { statBar.show(); // Disable delete button - $(this).unbind(event); - $(this).css( { - 'background-color' : '#F2F2F2', - 'color' : '#BDBDBD' - }); + $(this).attr('disabled', 'true'); }); var cancelBtn = createButton('Cancel'); diff --git a/xCAT-UI/js/nodes/nodeset.js b/xCAT-UI/js/nodes/nodeset.js index 8360aeac6..5ac191fe1 100644 --- a/xCAT-UI/js/nodes/nodeset.js +++ b/xCAT-UI/js/nodes/nodeset.js @@ -154,11 +154,7 @@ function loadNodesetPage(tgtNodes) { var profile = $('#' + tabId + ' input[name=profile]').val(); // Disable Ok button - $(this).unbind(event); - $(this).css( { - 'background-color' : '#F2F2F2', - 'color' : '#424242' - }); + $(this).attr('disabled', 'true'); /** * (1) Set the OS, arch, and profile diff --git a/xCAT-UI/js/nodes/rnetboot.js b/xCAT-UI/js/nodes/rnetboot.js index 16733fa86..6a9bbeeda 100644 --- a/xCAT-UI/js/nodes/rnetboot.js +++ b/xCAT-UI/js/nodes/rnetboot.js @@ -148,11 +148,7 @@ function loadNetbootPage(tgtNodes) { } // Disable Ok button - $(this).unbind(event); - $(this).css( { - 'background-color' : '#F2F2F2', - 'color' : '#424242' - }); + $(this).attr('disabled', 'true'); /** * (1) Boot to network diff --git a/xCAT-UI/js/nodes/updatenode.js b/xCAT-UI/js/nodes/updatenode.js index 475579dd9..49dccc017 100644 --- a/xCAT-UI/js/nodes/updatenode.js +++ b/xCAT-UI/js/nodes/updatenode.js @@ -278,12 +278,8 @@ function loadUpdatenodePage(tgtNodes) { var tgts = $('#' + newTabId + ' input[name=target]').val(); // Disable Ok button - $(this).unbind(event); - $(this).css( { - 'background-color' : '#F2F2F2', - 'color' : '#424242' - }); - + $(this).attr('disabled', 'true'); + /** * (1) Boot to network */