From 79237170c06d3ab703703de567229ed32f8b9af5 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Fri, 3 Dec 2010 09:16:58 +0000 Subject: [PATCH] update the node area on cec, update the page global list and update the checkbox on tooltip when select one node in any way git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8313 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/nodes/physical.js | 42 +++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/xCAT-UI/js/nodes/physical.js b/xCAT-UI/js/nodes/physical.js index c8e557a39..6968980fb 100644 --- a/xCAT-UI/js/nodes/physical.js +++ b/xCAT-UI/js/nodes/physical.js @@ -2,7 +2,7 @@ var bpaList; var fspList; var lparList; var nodeList; -var selectNode = new Object(); +var selectNode; /** * extract all nodes userful data into a hash, which is used for creating graphical @@ -53,6 +53,7 @@ function createPhysicalLayout(data){ bpaList = new Object(); fspList = new Object(); lparList = new Object(); + selectNode = new Object(); $('#graphTab').empty(); for (var temp in data.rsp){ @@ -216,12 +217,10 @@ function createGraphical(bpa, fsp, area){ return; } if (true == $(this).attr('checked')){ - selectNode[lparName] = 1; - $('#graphTable [name=' + lparName + ']').css('border-color', 'aqua'); + changeNode(lparName, 'select'); } else{ - delete selectNode[lparName]; - $('#graphTable [name=' + lparName + ']').css('border-color', '#BDBDBD'); + changeNode(lparName, 'unselect'); } updateSelectNodeDiv(); @@ -253,16 +252,14 @@ function createGraphical(bpa, fsp, area){ if (selectCount == fspList[fspName]['children'].length){ for (var lparIndex in fspList[fspName]['children']){ var lparName = fspList[fspName]['children'][lparIndex]; - delete selectNode[lparName]; - $('#graphTable [name=' + lparName + ']').css('border-color', '#BDBDBD'); + changeNode(lparName, 'unselect'); } } //not select all lpars on the cec, so add all lpars into selectNode Hash. else{ for (var lparIndex in fspList[fspName]['children']){ var lparName = fspList[fspName]['children'][lparIndex]; - selectNode[lparName] = 1; - $('#graphTable [name=' + lparName + ']').css('border-color', 'aqua'); + changeNode(lparName, 'select'); } } @@ -323,12 +320,10 @@ function showSelectDialog(lpars){ return true; } if (true == $(this).attr('checked')){ - selectNode[lparName] = 1; - $('#graphTable [name=' + lparName + ']').css('border-color', 'aqua'); + changeNode(lparName, 'select'); } else{ - delete selectNode[lparName]; - $('#graphTable [name=' + lparName + ']').css('border-color', '#BDBDBD'); + changeNode(lparName, 'unselect'); } }); updateSelectNodeDiv(); @@ -688,4 +683,25 @@ function reselectNodes(){ } showSelectDialog(temp); +} + +/** + * when the node is selected or unselected, then update the area on cec, update the global + * list and update the tooltip table + * + * @param + + * @return + */ +function changeNode(lparName, status){ + if ('select' == status){ + selectNode[lparName] = 1; + $('#graphTable [name=' + lparName + ']').css('border-color', 'aqua'); + $('.tooltip input[name="' + lparName + '"]').attr('checked', true); + } + else{ + delete selectNode[lparName]; + $('#graphTable [name=' + lparName + ']').css('border-color', '#BDBDBD'); + $('.tooltip input[name="' + lparName + '"]').attr('checked', false); + } } \ No newline at end of file