add checkbox to select cec and frame

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8365 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
xq2005 2010-12-09 08:12:26 +00:00
parent 3474107aee
commit 9a833cc37b
2 changed files with 20 additions and 91 deletions

View File

@ -633,7 +633,6 @@ table a:hover {
}
.fspDiv2 {
margin: 0px 12px 2px 17px;
font-size: 12px;
height: 20px;
line-height: 20px;
@ -643,10 +642,10 @@ table a:hover {
border-style: solid;
border-width: 1px;
cursor: pointer;
display: inline-block;
}
.fspDiv4 {
margin: 0px 12px 2px 17px;
font-size: 12px;
height: 44px;
line-height: 44px;
@ -656,6 +655,7 @@ table a:hover {
border-style: solid;
border-width: 1px;
cursor: pointer;
display: inline-block;
}
.fspDiv42 {
@ -679,6 +679,10 @@ table a:hover {
height: 5px;
}
.fspcheckbox{
padding: 0px;
}
/*--------------- Discovery section ---------------*/
.discoverstep {
width: 200px;

View File

@ -138,7 +138,7 @@ function createGraphical(bpa, fsp, area){
elementNum ++;
var td = $('<td style="padding:0;border-color: transparent;"></td>');
var frameDiv = $('<div class="frameDiv"></div>');
frameDiv.append('<div style="height:27px;">' + bpaName + '</div>');
frameDiv.append('<div style="height:27px;" title="' + bpaName + '"><input type="checkbox" class="fspcheckbox" name="check_'+ bpaName +'"></div>');
for (var fspIndex in bpa[bpaName]){
var fspName = bpa[bpaName][fspIndex];
usedFsp[fspName] = 1;
@ -184,7 +184,7 @@ function createGraphical(bpa, fsp, area){
}
elementNum ++;
var td = $('<td style="vertical-align:top;border-color: transparent;"></td>');
var td = $('<td style="padding:0;vertical-align:top;border-color: transparent;"></td>');
td.append(createFspDiv(fspName, fsp[fspName]['mtm'], fsp));
td.append(createFspTip(fspName, fsp[fspName]['mtm'], fsp));
row.append(td);
@ -265,71 +265,19 @@ function createGraphical(bpa, fsp, area){
updateSelectNodeDiv();
});
}
/**
* show the fsp's information in a dialog
*
* @param fspName : fsp's name
*
* @return
*/
function showSelectDialog(lpars){
var diaDiv = $('<div class="tab" title=Select Lpars"></div>');
if (0 == lpars.length){
diaDiv.append(createInfoBar('There is not any lpars be selected(defined).'));
}
else{
//add the dialog content
var selectTable = $('<table id="selectNodeTable"><tbody></tbody></table>');
selectTable.append('<tr><th><input type="checkbox" onclick="selectAllLpars($(this))"></input></th><th>Name</th><th>Status</th></tr>');
for (var lparIndex in lpars){
var row = $('<tr></tr>');
var lparName = lpars[lparIndex];
var color = statusMap(lparList[lparName]);
if (selectNode[lparName]){
row.append('<td><input type="checkbox" checked="checked" name="' + lparName + '"></input></td>');
}
else{
row.append('<td><input type="checkbox" name="' + lparName + '"></input></td>');
}
row.append('<td>' + lparName + '</td>');
row.append('<td style="background-color:' + color + ';">' + lparList[lparName] + '</td>');
selectTable.append(row);
$('.fspcheckbox').bind('click', function(){
var itemName = $(this).attr('name');
name = itemName.substr(6);
if ($(this).attr('checked')){
selectNode[name] = 1;
}
diaDiv.append(selectTable);
}
diaDiv.dialog({
modal: true,
width: 400,
close: function(event, ui){
$(this).remove();
},
buttons: {
cancel : function(){
$(this).dialog('close');
},
ok : function(){
$('#selectNodeTable input[type=checkbox]').each(function(){
var lparName = $(this).attr('name');
if ('' == lparName){
//continue
return true;
}
if (true == $(this).attr('checked')){
changeNode(lparName, 'select');
}
else{
changeNode(lparName, 'unselect');
}
});
updateSelectNodeDiv();
$(this).dialog('close');
}
else{
delete selectNode[name];
}
updateSelectNodeDiv();
});
}
@ -355,13 +303,6 @@ function updateSelectNodeDiv(){
break;
}
}
var reselectButton = createButton('Reselect');
$('#selectNodeDiv').append(reselectButton);
reselectButton.bind('click', function(){
reselectNodes();
});
}
/**
@ -566,7 +507,8 @@ function createFspDiv(fspName, mtm, fsp){
}
//create return value
var retHtml = '<div value="' + fspName + '" class="' + divClass + '">';
var retHtml = '<input class="fspcheckbox" type="checkbox" name="check_' + fspName + '">';
retHtml += '<div value="' + fspName + '" class="' + divClass + '">';
retHtml += '<div class="lparDiv"><table><tbody><tr>' + lparStatusRow + '</tr></tbody></table></div></div>';
return retHtml;
}
@ -668,23 +610,6 @@ function getSelectNodes(){
return ret.substring(0, ret.length-1);
}
/**
* show all lpars' for users to delete
*
* @param
* @return
*/
function reselectNodes(){
var temp = new Array();
for (var lparName in selectNode){
temp.push(lparName);
}
showSelectDialog(temp);
}
/**
* when the node is selected or unselected, then update the area on cec, update the global
* list and update the tooltip table