Removed jquery.impromptu and replaced it with the built-in jquery dialog. Added input checks for edit virtual server.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7601 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
5b63531ff4
commit
81aeefc5a1
@ -1,16 +1,15 @@
|
||||
/***************** Login dialog *****************/
|
||||
#logdialog {
|
||||
margin: 0px 10px 20px 10px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
#logdialog label,input,p {
|
||||
font: 14px verdana, arial, helvetica, sans-serif;
|
||||
}
|
||||
|
||||
#logdialog input {
|
||||
/***************** Dialogs *****************/
|
||||
.ui-dialog input {
|
||||
border: solid 1px #BDBDBD;
|
||||
font: 14px verdana, arial, helvetica, sans-serif;
|
||||
font: 12px verdana, arial, helvetica, sans-serif;
|
||||
}
|
||||
|
||||
.ui-dialog label, input, p, button {
|
||||
font: 12px verdana, arial, helvetica, sans-serif;
|
||||
}
|
||||
|
||||
.ui-widget {
|
||||
font: 12px verdana, arial, helvetica, sans-serif;
|
||||
}
|
||||
|
||||
/****************** Header ******************/
|
||||
@ -133,15 +132,15 @@ body {
|
||||
}
|
||||
|
||||
/****************** Info bar ******************/
|
||||
.info {
|
||||
font: 12px verdana, arial, helvetica, sans-serif;
|
||||
}
|
||||
|
||||
span.ui-icon-info {
|
||||
float: left;
|
||||
margin-right: 0.3em;
|
||||
}
|
||||
|
||||
.ui-icon {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.ui-button {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
@ -393,6 +392,7 @@ span.ui-icon-info {
|
||||
border-style: solid;
|
||||
border-color: #BDBDBD;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/*** Row color (odd) ***/
|
||||
@ -444,70 +444,6 @@ span.ui-icon-info {
|
||||
background-color: #E6E6E6;
|
||||
}
|
||||
|
||||
/****************** Prompts ******************/
|
||||
.cleanbluewarning .cleanblue {
|
||||
background-color: #acb4c4;
|
||||
}
|
||||
|
||||
.cleanbluefade {
|
||||
position: absolute;
|
||||
background-color: #aaaaaa;
|
||||
}
|
||||
|
||||
div.cleanblue {
|
||||
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
|
||||
position: absolute;
|
||||
background-color: #ffffff;
|
||||
width: 400px;
|
||||
font-size: 11px;
|
||||
text-align: left;
|
||||
border: solid 1px #213e80;
|
||||
}
|
||||
|
||||
div.cleanblue .cleanbluecontainer {
|
||||
background-color: #ffffff;
|
||||
border-top: solid 14px #213e80;
|
||||
padding: 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.cleanblue .cleanblueclose {
|
||||
float: right;
|
||||
width: 18px;
|
||||
cursor: default;
|
||||
margin: -19px -12px 0 0;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.cleanblue .cleanbluemessage {
|
||||
padding: 10px;
|
||||
line-height: 20px;
|
||||
font-size: 11px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
div.cleanblue .cleanbluebuttons {
|
||||
text-align: right;
|
||||
padding: 5px 0 5px 0;
|
||||
border: solid 1px #eeeeee;
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
|
||||
div.cleanblue button {
|
||||
padding: 3px 10px;
|
||||
margin: 0 10px;
|
||||
background-color: #314e90;
|
||||
border: solid 1px #f4f4f4;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
div.cleanblue button:hover {
|
||||
border: solid 1px #d4d4d4;
|
||||
}
|
||||
|
||||
/****************** Context menu ******************/
|
||||
.context-menu-theme-vista {
|
||||
background: #FAFAFA url(../images/context-menu-bg.gif) repeat-y left top
|
||||
@ -585,7 +521,7 @@ div.cleanblue button:hover {
|
||||
display: inline-table;
|
||||
}
|
||||
|
||||
.form input {
|
||||
.form input, textarea, select {
|
||||
font: 12px verdana, arial, helvetica, sans-serif;
|
||||
border: solid 1px #BDBDBD;
|
||||
padding: 5px;
|
||||
@ -593,10 +529,6 @@ div.cleanblue button:hover {
|
||||
}
|
||||
|
||||
.form textarea {
|
||||
font: 12px verdana, arial, helvetica, sans-serif;
|
||||
border: solid 1px #BDBDBD;
|
||||
padding: 5px;
|
||||
display: inline-table;
|
||||
width: 350px;
|
||||
height: 150px;
|
||||
}
|
||||
|
@ -145,10 +145,8 @@ bladePlugin.prototype.loadResources = function() {
|
||||
/**
|
||||
* Add node
|
||||
*
|
||||
* @param f
|
||||
* Key/value pairs of the form values
|
||||
* @return Nothing
|
||||
*/
|
||||
bladePlugin.prototype.addNode = function(f) {
|
||||
bladePlugin.prototype.addNode = function() {
|
||||
|
||||
};
|
@ -145,10 +145,8 @@ fspPlugin.prototype.loadResources = function() {
|
||||
/**
|
||||
* Add node
|
||||
*
|
||||
* @param f
|
||||
* Key/value pairs of the form values
|
||||
* @return Nothing
|
||||
*/
|
||||
fspPlugin.prototype.addNode = function(f) {
|
||||
fspPlugin.prototype.addNode = function() {
|
||||
|
||||
};
|
@ -198,10 +198,8 @@ hmcPlugin.prototype.loadResources = function() {
|
||||
/**
|
||||
* Add node
|
||||
*
|
||||
* @param f
|
||||
* Key/value pairs of the form values
|
||||
* @return Nothing
|
||||
*/
|
||||
hmcPlugin.prototype.addNode = function(f) {
|
||||
hmcPlugin.prototype.addNode = function() {
|
||||
|
||||
};
|
@ -145,10 +145,8 @@ ipmiPlugin.prototype.loadResources = function() {
|
||||
/**
|
||||
* Add node
|
||||
*
|
||||
* @param f
|
||||
* Key/value pairs of the form values
|
||||
* @return Nothing
|
||||
*/
|
||||
ipmiPlugin.prototype.addNode = function(f) {
|
||||
ipmiPlugin.prototype.addNode = function() {
|
||||
|
||||
};
|
@ -145,10 +145,8 @@ ivmPlugin.prototype.loadResources = function() {
|
||||
/**
|
||||
* Add node
|
||||
*
|
||||
* @param f
|
||||
* Key/value pairs of the form values
|
||||
* @return Nothing
|
||||
*/
|
||||
ivmPlugin.prototype.addNode = function(f) {
|
||||
ivmPlugin.prototype.addNode = function() {
|
||||
|
||||
};
|
@ -556,28 +556,9 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
*/
|
||||
var addProcLink = $('<a href="#">Add processor</a>');
|
||||
addProcLink.bind('click', function(event) {
|
||||
var procForm = '<div class="form">'
|
||||
+ '<div><label for="procNode">Processor for:</label><input type="text" readonly="readonly" id="procNode" name="procNode" value="' + node + '"/></div>'
|
||||
+ '<div><label for="procAddress">Processor address:</label><input type="text" id="procAddress" name="procAddress"/></div>'
|
||||
+ '<div><label for="procType">Processor type:</label>'
|
||||
+ '<select id="procType" name="procType">'
|
||||
+ '<option>CP</option>'
|
||||
+ '<option>IFL</option>'
|
||||
+ '<option>ZAAP</option>'
|
||||
+ '<option>ZIIP</option>'
|
||||
+ '</select>'
|
||||
+ '</div>'
|
||||
+ '</div>';
|
||||
|
||||
$.prompt(procForm, {
|
||||
callback : addProcessor,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
prefix : 'cleanblue'
|
||||
});
|
||||
});
|
||||
createAddProcDialog(node);
|
||||
});
|
||||
|
||||
procFooter.append(addProcLink);
|
||||
procTable.append(procFooter);
|
||||
|
||||
@ -653,48 +634,8 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
*/
|
||||
var addDasdLink = $('<a href="#">Add disk</a>');
|
||||
addDasdLink.bind('click', function(event) {
|
||||
// Get list of disk pools
|
||||
var temp = attrs['hcp'][0].split('.');
|
||||
var cookie = $.cookie(temp[0] + 'DiskPools');
|
||||
|
||||
// Create drop down list for disk pool
|
||||
var pools = cookie.split(',');
|
||||
var selectPool = '<select id="diskPool" name="diskPool">';
|
||||
for ( var i = 0; i < pools.length; i++) {
|
||||
selectPool = selectPool + '<option>' + pools[i]
|
||||
+ '</option>';
|
||||
}
|
||||
selectPool = selectPool + '</select>';
|
||||
|
||||
// Create drop down list for disk mode
|
||||
var selectMode = '<select id="diskMode" name="diskMode">';
|
||||
selectMode = selectMode + '<option>R</option>';
|
||||
selectMode = selectMode + '<option>RR</option>';
|
||||
selectMode = selectMode + '<option>W</option>';
|
||||
selectMode = selectMode + '<option>WR</option>';
|
||||
selectMode = selectMode + '<option>M</option>';
|
||||
selectMode = selectMode + '<option>MR</option>';
|
||||
selectMode = selectMode + '<option>MW</option>';
|
||||
selectMode = selectMode + '</select>';
|
||||
|
||||
var dasdForm = '<div class="form">'
|
||||
+ '<div><label for="diskNode">Disk for:</label><input type="text" readonly="readonly" id="diskNode" name="diskNode" value="' + node + '"/></div>'
|
||||
+ '<div><label for="diskType">Disk type:</label><select id="diskType" name="diskType"><option value="3390">3390</option><option value="9336">9336</option></select></div>'
|
||||
+ '<div><label for="diskAddress">Disk address:</label><input type="text" id="diskAddress" name="diskAddress"/></div>'
|
||||
+ '<div><label for="diskSize">Disk size:</label><input type="text" id="diskSize" name="diskSize"/></div>'
|
||||
+ '<div><label for="diskPool">Disk pool:</label>' + selectPool + '</div>'
|
||||
+ '<div><label for="diskMode">Disk mode:</label>' + selectMode + '</div>'
|
||||
+ '<div><label for="diskPassword">Disk password:</label><input type="password" id="diskPassword" name="diskPassword"/></div>'
|
||||
+ '</div>';
|
||||
|
||||
$.prompt(dasdForm, {
|
||||
callback : addDisk,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
prefix : 'cleanblue'
|
||||
});
|
||||
var hcp = attrs['hcp'][0].split('.');
|
||||
createAddDiskDialog(node, hcp[0]);
|
||||
});
|
||||
dasdFooter.append(addDasdLink);
|
||||
dasdTable.append(dasdFooter);
|
||||
@ -774,148 +715,8 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
*/
|
||||
var addNicLink = $('<a href="#">Add NIC</a>');
|
||||
addNicLink.bind('click', function(event) {
|
||||
// Get network names
|
||||
var temp = attrs['hcp'][0].split('.');
|
||||
var networks = $.cookie(temp[0] + 'Networks').split(',');
|
||||
|
||||
// Create a drop down list
|
||||
var gLansQdio = '<select id="nicLanQdioName" name="nicLanQdioName">';
|
||||
var gLansHipers = '<select id="nicLanHipersName" name="nicLanHipersName">';
|
||||
var vswitches = '<select id="nicVSwitchName" name="nicVSwitchName">';
|
||||
for ( var i = 0; i < networks.length; i++) {
|
||||
var network = networks[i].split(' ');
|
||||
if (network[0] == 'VSWITCH') {
|
||||
vswitches = vswitches + '<option>' + network[1] + ' ' + network[2] + '</option>';
|
||||
} else if (network[0] == 'LAN:QDIO') {
|
||||
gLansQdio = gLansQdio + '<option>' + network[1] + ' ' + network[2] + '</option>';
|
||||
} else if (network[0] == 'LAN:HIPERS') {
|
||||
gLansHipers = gLansHipers + '<option>' + network[1] + ' ' + network[2] + '</option>';
|
||||
}
|
||||
}
|
||||
vswitches = vswitches + '</select>';
|
||||
gLansQdio = gLansQdio + '</select>';
|
||||
gLansHipers = gLansHipers + '</select>';
|
||||
|
||||
var nicTypeForm = '<div class="form">'
|
||||
+ '<div><label for="nicNode">NIC for:</label><input type="text" readonly="readonly" id="nicNode" name="nicNode" value="' + node + '"/></div>'
|
||||
+ '<div><label for="nicAddress">NIC address:</label><input type="text" id="nicAddress" name="nicAddress"/></div>'
|
||||
+ '<div><label for="nicType">NIC type:</label>'
|
||||
+ '<select id="nicType" name="nicType">'
|
||||
+ '<option>QDIO</option>'
|
||||
+ '<option>HiperSockets</option>'
|
||||
+ '</select>'
|
||||
+ '</div>'
|
||||
+ '<div><label for="nicNetworkType">Network type:</label>'
|
||||
+ '<select id="nicNetworkType" name="nicNetworkType">'
|
||||
+ '<option>Guest LAN</option>'
|
||||
+ '<option>Virtual Switch</option>' + '</select>'
|
||||
+ '</div>'
|
||||
+ '</div>';
|
||||
var configGuestLanQdioForm = '<div class="form"><div><label for="nicLanQdioName">Guest LAN name:</label>' + gLansQdio + '</div></div>';
|
||||
var configGuestLanHipersForm = '<div class="form"><div><label for="nicLanHipersName">Guest LAN name:</label>' + gLansHipers + '</div></div>';
|
||||
var configVSwitchForm = '<div class="form"><div><label for="nicVSwitchName">VSWITCH name:</label>' + vswitches + '</div></div>';
|
||||
var notSupportedForm = '<div class="form"><p>The requested operation is not supported</p></div>';
|
||||
|
||||
var states = {
|
||||
// Select NIC type
|
||||
type : {
|
||||
html : nicTypeForm,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (!v) {
|
||||
return true;
|
||||
} else {
|
||||
var nicType = f.nicType;
|
||||
var networkType = f.nicNetworkType;
|
||||
if (networkType == 'Guest LAN' && nicType == 'QDIO')
|
||||
$.prompt.goToState('configGuestLanQdio');
|
||||
else if (networkType == 'Guest LAN' && nicType == 'HiperSockets')
|
||||
$.prompt.goToState('configGuestLanHipers');
|
||||
else if (networkType == 'Virtual Switch' && nicType == 'QDIO')
|
||||
$.prompt.goToState('configVSwitch');
|
||||
else
|
||||
$.prompt.goToState('notSupported');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Configure QDIO guest LAN page
|
||||
configGuestLanQdio : {
|
||||
html : configGuestLanQdioForm,
|
||||
callback : addNic,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Configure HIPERS guest LAN page
|
||||
configGuestLanHipers : {
|
||||
html : configGuestLanHipersForm,
|
||||
callback : addNic,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Configure VSwitch page
|
||||
configVSwitch : {
|
||||
html : configVSwitchForm,
|
||||
callback : addNic,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Not supported page
|
||||
notSupported : {
|
||||
html : notSupportedForm,
|
||||
buttons : {
|
||||
Ok : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.prompt(states, {
|
||||
callback : addNic,
|
||||
prefix : 'cleanblue'
|
||||
});
|
||||
var hcp = attrs['hcp'][0].split('.');
|
||||
createAddNicDialog(node, hcp[0]);
|
||||
});
|
||||
nicFooter.append(addNicLink);
|
||||
nicTable.append(nicFooter);
|
||||
@ -1064,179 +865,197 @@ zvmPlugin.prototype.loadResources = function() {
|
||||
/**
|
||||
* Add node
|
||||
*
|
||||
* @param f
|
||||
* Key/value pairs of the form values
|
||||
* @return Nothing
|
||||
*/
|
||||
zvmPlugin.prototype.addNode = function(f) {
|
||||
var nodeRange = f.node;
|
||||
var group = f.group;
|
||||
var hcp = f.hcp;
|
||||
var userIdRange = f.userId;
|
||||
|
||||
// Check node range and user ID range
|
||||
var errMsg = '';
|
||||
var ready = true;
|
||||
if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1) {
|
||||
if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0) {
|
||||
errMsg = errMsg + 'A user ID range and node range needs to be given. ';
|
||||
ready = false;
|
||||
} else {
|
||||
var tmp = nodeRange.split('-');
|
||||
|
||||
// Get node base name
|
||||
var nodeBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
// Get starting index
|
||||
var nodeStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var nodeEnd = parseInt(tmp[1]);
|
||||
|
||||
tmp = userIdRange.split('-');
|
||||
|
||||
// Get user ID base name
|
||||
var userIdBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
// Get starting index
|
||||
var userIdStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var userIdEnd = parseInt(tmp[1]);
|
||||
|
||||
// If starting and ending index do not match
|
||||
if (!(nodeStart == userIdStart) || !(nodeEnd == userIdEnd)) {
|
||||
// Not ready
|
||||
errMsg = errMsg + 'The node range and user ID range does not match. ';
|
||||
ready = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there are no errors catched
|
||||
if (ready) {
|
||||
// If a node range is given
|
||||
if (nodeRange.indexOf('-') > -1 && userIdRange.indexOf('-') > -1) {
|
||||
var tmp = nodeRange.split('-');
|
||||
zvmPlugin.prototype.addNode = function() {
|
||||
var info = createInfoBar('Add a new node');
|
||||
var addNodeForm = $('<div class="form"></div>');
|
||||
addNodeForm.append(info);
|
||||
addNodeForm.append('<div><label for="node">Node range:</label><input type="text" id="node" name="node"/></div>');
|
||||
addNodeForm.append('<div><label for="userId">User ID range:</label><input type="text" id="userId" name="userId"/></div>');
|
||||
addNodeForm.append('<div><label for="hcp">Hardware control point:</label><input type="text" id="hcp" name="hcp"/></div>');
|
||||
addNodeForm.append('<div><label for="group">Group:</label><input type="text" id="group" name="group"/></div>');
|
||||
|
||||
// Create add node dialog
|
||||
addNodeForm.dialog({
|
||||
position: 'top',
|
||||
modal: true,
|
||||
width: 400,
|
||||
buttons: {
|
||||
"Cancel": function(){
|
||||
// Close dialog
|
||||
$(this).dialog( "close" );
|
||||
},
|
||||
"Ok": function(){
|
||||
// Remove any warning messages
|
||||
$(this).find('.ui-state-error').remove();
|
||||
|
||||
// Get inputs
|
||||
var nodeRange = $(this).find('input[name=node]').val();
|
||||
var userIdRange = $(this).find('input[name=userId]').val();
|
||||
var group = $(this).find('input[name=group]').val();
|
||||
var hcp = $(this).find('input[name=hcp]').val();
|
||||
|
||||
if (!nodeRange || !userIdRange || !group || !hcp) {
|
||||
var warn = createWarnBar('Missing values');
|
||||
warn.prependTo($(this));
|
||||
} else {
|
||||
// Check node range and user ID range
|
||||
var errMsg = '';
|
||||
var ready = true;
|
||||
if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1) {
|
||||
if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0) {
|
||||
errMsg = errMsg + 'A user ID range and node range needs to be given. ';
|
||||
ready = false;
|
||||
} else {
|
||||
var tmp = nodeRange.split('-');
|
||||
|
||||
// Get node base name
|
||||
var nodeBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
// Get starting index
|
||||
var nodeStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var nodeEnd = parseInt(tmp[1]);
|
||||
// Get node base name
|
||||
var nodeBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
// Get starting index
|
||||
var nodeStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var nodeEnd = parseInt(tmp[1]);
|
||||
|
||||
tmp = userIdRange.split('-');
|
||||
tmp = userIdRange.split('-');
|
||||
|
||||
// Get user ID base name
|
||||
var userIdBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
// Get starting index
|
||||
var userIdStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var userIdEnd = parseInt(tmp[1]);
|
||||
// Get user ID base name
|
||||
var userIdBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
// Get starting index
|
||||
var userIdStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var userIdEnd = parseInt(tmp[1]);
|
||||
|
||||
// Loop through each node in the node range
|
||||
for ( var i = nodeStart; i <= nodeEnd; i++) {
|
||||
var node = nodeBase + i.toString();
|
||||
var userId = userIdBase + i.toString();
|
||||
var inst = i + '/' + nodeEnd;
|
||||
|
||||
/**
|
||||
* (1) Define node
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : node + ';zvm.hcp=' + hcp
|
||||
+ ';zvm.userid=' + userId
|
||||
+ ';nodehm.mgt=zvm' + ';groups=' + group,
|
||||
msg : 'cmd=addnewnode;inst=' + inst + ';noderange=' + nodeRange
|
||||
},
|
||||
|
||||
/**
|
||||
* Return function on successful AJAX call
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
success : function (data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
|
||||
// Get command invoked
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
var inst = args[1].replace('inst=', '');
|
||||
var nodeRange = args[2].replace('noderange=', '');
|
||||
|
||||
// If the last node was added
|
||||
var tmp = inst.split('/');
|
||||
if (tmp[0] == tmp[1]) {
|
||||
// If there was an error, do not continue
|
||||
var msg;
|
||||
if (rsp.length) {
|
||||
msg = '<p>(Error) Failed to create node definition</p>';
|
||||
} else {
|
||||
msg = '<p>Node definitions created for ' + nodeRange + '</p>';
|
||||
}
|
||||
|
||||
$.prompt(msg, {
|
||||
buttons: { Ok: true },
|
||||
prefix: 'cleanblue'
|
||||
});
|
||||
// If starting and ending index do not match
|
||||
if (!(nodeStart == userIdStart) || !(nodeEnd == userIdEnd)) {
|
||||
// Not ready
|
||||
errMsg = errMsg + 'The node range and user ID range does not match. ';
|
||||
ready = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : nodeRange + ';zvm.hcp=' + hcp
|
||||
+ ';zvm.userid=' + userIdRange
|
||||
+ ';nodehm.mgt=zvm' + ';groups=' + group,
|
||||
msg : 'cmd=addnewnode;node=' + nodeRange
|
||||
},
|
||||
|
||||
/**
|
||||
* Return function on successful AJAX call
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
success : function (data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
|
||||
// Get command invoked
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
var node = args[1].replace('node=', '');
|
||||
|
||||
// If there was an error, do not continue
|
||||
var msg;
|
||||
if (rsp.length) {
|
||||
msg = '<p>(Error) Failed to create node definition</p>';
|
||||
// If there are no errors
|
||||
if (ready) {
|
||||
// If a node range is given
|
||||
if (nodeRange.indexOf('-') > -1 && userIdRange.indexOf('-') > -1) {
|
||||
var tmp = nodeRange.split('-');
|
||||
|
||||
// Get node base name
|
||||
var nodeBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
// Get starting index
|
||||
var nodeStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var nodeEnd = parseInt(tmp[1]);
|
||||
|
||||
tmp = userIdRange.split('-');
|
||||
|
||||
// Get user ID base name
|
||||
var userIdBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
// Get starting index
|
||||
var userIdStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var userIdEnd = parseInt(tmp[1]);
|
||||
|
||||
// Loop through each node in the node range
|
||||
for ( var i = nodeStart; i <= nodeEnd; i++) {
|
||||
var node = nodeBase + i.toString();
|
||||
var userId = userIdBase + i.toString();
|
||||
var inst = i + '/' + nodeEnd;
|
||||
|
||||
/**
|
||||
* (1) Define node
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : node + ';zvm.hcp=' + hcp
|
||||
+ ';zvm.userid=' + userId
|
||||
+ ';nodehm.mgt=zvm' + ';groups=' + group,
|
||||
msg : 'cmd=addnewnode;inst=' + inst + ';noderange=' + nodeRange
|
||||
},
|
||||
|
||||
/**
|
||||
* Return function on successful AJAX call
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
success : function (data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
|
||||
// Get command invoked
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
var inst = args[1].replace('inst=', '');
|
||||
var nodeRange = args[2].replace('noderange=', '');
|
||||
|
||||
// If the last node was added
|
||||
var tmp = inst.split('/');
|
||||
if (tmp[0] == tmp[1]) {
|
||||
// If there was an error, do not continue
|
||||
if (rsp.length) {
|
||||
openDialog('(Error) Failed to create node definition');
|
||||
} else {
|
||||
openDialog('Node definitions created for ' + nodeRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : nodeRange + ';zvm.hcp=' + hcp
|
||||
+ ';zvm.userid=' + userIdRange
|
||||
+ ';nodehm.mgt=zvm' + ';groups=' + group,
|
||||
msg : 'cmd=addnewnode;node=' + nodeRange
|
||||
},
|
||||
|
||||
/**
|
||||
* Return function on successful AJAX call
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
success : function (data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
|
||||
// Get command invoked
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
var node = args[1].replace('node=', '');
|
||||
|
||||
// If there was an error, do not continue
|
||||
if (rsp.length) {
|
||||
openDialog('(Error) Failed to create node definition');
|
||||
} else {
|
||||
openDialog('Node definitions created for ' + node);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Close dialog
|
||||
$(this).dialog( "close" );
|
||||
} else {
|
||||
msg = '<p>Node definition created for ' + node + '</p>';
|
||||
}
|
||||
|
||||
$.prompt(msg, {
|
||||
buttons: { Ok: true },
|
||||
prefix: 'cleanblue'
|
||||
});
|
||||
// Show warning message
|
||||
var warn = createWarnBar(errMsg);
|
||||
warn.prependTo($(this));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Prompt an error message
|
||||
$.prompt('<p>' + errMsg + '</p>', {
|
||||
buttons: { Ok: true },
|
||||
prefix: 'cleanblue'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
@ -1001,206 +1001,433 @@ function getAttrs(keys, propNames, data) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add processor
|
||||
*
|
||||
* @param v
|
||||
* Value of the button clicked
|
||||
* @param m
|
||||
* jQuery object of the message within the active state when the user
|
||||
* clicked the button
|
||||
* @param f
|
||||
* Key/value pairs of the form values
|
||||
* Create add processor dialog
|
||||
*
|
||||
* @param node
|
||||
* Node to add processor to
|
||||
* @return Nothing
|
||||
*/
|
||||
function addProcessor(v, m, f) {
|
||||
// If user clicks Ok, add processor
|
||||
if (v) {
|
||||
var node = f.procNode;
|
||||
var type = f.procType;
|
||||
var address = f.procAddress;
|
||||
|
||||
// Add processor
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : node,
|
||||
args : '--addprocessoractive;' + address + ';' + type,
|
||||
msg : node
|
||||
},
|
||||
|
||||
success : updateZNodeStatus
|
||||
});
|
||||
|
||||
// Increment node process
|
||||
incrementNodeProcess(node);
|
||||
|
||||
// Show loader
|
||||
var statusId = node + 'StatusBar';
|
||||
var statusBarLoaderId = node + 'StatusBarLoader';
|
||||
$('#' + statusBarLoaderId).show();
|
||||
$('#' + statusId).show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add disk
|
||||
*
|
||||
* @param v
|
||||
* Value of the button clicked
|
||||
* @param m
|
||||
* jQuery object of the message within the active state when the user
|
||||
* clicked the button
|
||||
* @param f
|
||||
* Key/value pairs of the form values
|
||||
* @return Nothing
|
||||
*/
|
||||
function addDisk(v, m, f) {
|
||||
// If user clicks Ok, add disk
|
||||
if (v) {
|
||||
var node = f.diskNode;
|
||||
var type = f.diskType;
|
||||
var address = f.diskAddress;
|
||||
var size = f.diskSize;
|
||||
var pool = f.diskPool;
|
||||
var mode = f.diskMode;
|
||||
var password = f.diskPassword;
|
||||
|
||||
// Add disk
|
||||
if (type == '3390') {
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : node,
|
||||
args : '--add3390;' + pool + ';' + address + ';' + size
|
||||
+ ';' + mode + ';' + password + ';' + password + ';' + password,
|
||||
msg : node
|
||||
},
|
||||
|
||||
success : updateZNodeStatus
|
||||
});
|
||||
|
||||
// Increment node process
|
||||
incrementNodeProcess(node);
|
||||
|
||||
// Show loader
|
||||
var statusId = node + 'StatusBar';
|
||||
var statusBarLoaderId = node + 'StatusBarLoader';
|
||||
$('#' + statusBarLoaderId).show();
|
||||
$('#' + statusId).show();
|
||||
} else if (type == '9336') {
|
||||
// Default block size for FBA volumes = 512
|
||||
var blkSize = '512';
|
||||
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : node,
|
||||
args : '--add9336;' + pool + ';' + address + ';' + blkSize + ';' + size
|
||||
+ ';' + mode + ';' + password + ';' + password + ';' + password,
|
||||
msg : node
|
||||
},
|
||||
|
||||
success : updateZNodeStatus
|
||||
});
|
||||
|
||||
// Increment node process
|
||||
incrementNodeProcess(node);
|
||||
|
||||
// Show loader
|
||||
var statusId = node + 'StatusBar';
|
||||
var statusBarLoaderId = node + 'StatusBarLoader';
|
||||
$('#' + statusBarLoaderId).show();
|
||||
$('#' + statusId).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add NIC
|
||||
*
|
||||
* @param v
|
||||
* Value of the button clicked
|
||||
* @param m
|
||||
* jQuery object of the message within the active state when the user
|
||||
* clicked the button
|
||||
* @param f
|
||||
* Key/value pairs of the form values
|
||||
* @return Nothing
|
||||
*/
|
||||
function addNic(v, m, f) {
|
||||
// If user clicks Ok, add NIC
|
||||
if (v) {
|
||||
var node = f.nicNode;
|
||||
var nicType = f.nicType;
|
||||
var networkType = f.nicNetworkType;
|
||||
var address = f.nicAddress;
|
||||
|
||||
/**
|
||||
* Add guest LAN
|
||||
*/
|
||||
if (networkType == 'Guest LAN') {
|
||||
var temp;
|
||||
if (nicType == 'QDIO') {
|
||||
temp = f.nicLanQdioName.split(' ');
|
||||
} else {
|
||||
temp = f.nicLanHipersName.split(' ');
|
||||
function createAddProcDialog(node) {
|
||||
// Create info bar
|
||||
var info = createInfoBar('Add a processor');
|
||||
|
||||
// Create add processor form
|
||||
var addProcForm = $('<div class="form"></div>');
|
||||
addProcForm.append(info);
|
||||
addProcForm.append('<div><label for="procNode">Processor for:</label><input type="text" readonly="readonly" id="procNode" name="procNode" value="' + node + '"/></div>');
|
||||
addProcForm.append('<div><label for="procAddress">Processor address:</label><input type="text" id="procAddress" name="procAddress"/></div>');
|
||||
|
||||
// Create drop down for processor type
|
||||
var procType = $('<div></div>');
|
||||
procType.append('<label for="procType">Processor type:</label>');
|
||||
var typeSelect = $('<select id="procType" name="procType"></select>');
|
||||
typeSelect.append('<option>CP</option>');
|
||||
typeSelect.append('<option>IFL</option>');
|
||||
typeSelect.append('<option>ZAAP</option>');
|
||||
typeSelect.append('<option>ZIIP</option>');
|
||||
procType.append(typeSelect);
|
||||
addProcForm.append(procType);
|
||||
|
||||
// Create add processor dialog
|
||||
addProcForm.dialog({
|
||||
position: 'top',
|
||||
modal: true,
|
||||
width: 400,
|
||||
buttons: {
|
||||
"Cancel": function() {
|
||||
// Close dialog
|
||||
$(this).dialog( "close" );
|
||||
},
|
||||
"Ok": function(){
|
||||
// Remove any warning messages
|
||||
$(this).find('.ui-state-error').remove();
|
||||
|
||||
// Get processor properties
|
||||
var node = $(this).find('input[name=procNode]').val();
|
||||
var address = $(this).find('input[name=procAddress]').val();
|
||||
var type = $(this).find('select[name=procType]').val();
|
||||
|
||||
if (!node || !address || !type) {
|
||||
var warn = createWarnBar('Missing values');
|
||||
warn.prependTo($(this));
|
||||
} else {
|
||||
// Add processor
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : node,
|
||||
args : '--addprocessoractive;' + address + ';' + type,
|
||||
msg : node
|
||||
},
|
||||
|
||||
success : updateZNodeStatus
|
||||
});
|
||||
|
||||
// Increment node process
|
||||
incrementNodeProcess(node);
|
||||
|
||||
// Show loader
|
||||
var statusId = node + 'StatusBar';
|
||||
var statusBarLoaderId = node + 'StatusBarLoader';
|
||||
$('#' + statusBarLoaderId).show();
|
||||
$('#' + statusId).show();
|
||||
|
||||
// Close dialog
|
||||
$(this).dialog( "close" );
|
||||
}
|
||||
}
|
||||
|
||||
var lanOwner = temp[0];
|
||||
var lanName = temp[1];
|
||||
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : node,
|
||||
args : '--addnic;' + address + ';' + nicType + ';3',
|
||||
msg : 'node=' + node + ';addr=' + address + ';lan='
|
||||
+ lanName + ';owner=' + lanOwner
|
||||
},
|
||||
success : connect2GuestLan
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add virtual switch
|
||||
*/
|
||||
else if (networkType == 'Virtual Switch') {
|
||||
var temp = f.nicVSwitchName.split(' ');
|
||||
var vswitchName = temp[1];
|
||||
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : node,
|
||||
args : '--addnic;' + address + ';' + nicType + ';3',
|
||||
msg : 'node=' + node + ';addr=' + address + ';vsw='
|
||||
+ vswitchName
|
||||
},
|
||||
|
||||
success : connect2VSwitch
|
||||
});
|
||||
}
|
||||
|
||||
// Increment node process
|
||||
incrementNodeProcess(node);
|
||||
|
||||
// Show loader
|
||||
var statusId = node + 'StatusBar';
|
||||
var statusBarLoaderId = node + 'StatusBarLoader';
|
||||
$('#' + statusBarLoaderId).show();
|
||||
$('#' + statusId).show();
|
||||
/**
|
||||
* Create add disk dialog
|
||||
*
|
||||
* @param node
|
||||
* Node to add disk to
|
||||
* @param hcp
|
||||
* Hardware control point of node
|
||||
* @return Nothing
|
||||
*/
|
||||
function createAddDiskDialog(node, hcp) {
|
||||
// Get list of disk pools
|
||||
var cookie = $.cookie(hcp + 'DiskPools');
|
||||
var pools = cookie.split(',');
|
||||
|
||||
// Create info bar
|
||||
var info = createInfoBar('Add a disk');
|
||||
|
||||
// Create add disk form
|
||||
var addDiskForm = $('<div class="form"></div>');
|
||||
addDiskForm.append(info);
|
||||
addDiskForm.append('<div><label for="diskNode">Disk for:</label><input type="text" readonly="readonly" id="diskNode" name="diskNode" value="' + node + '"/></div>');
|
||||
addDiskForm.append('<div><label for="diskType">Disk type:</label><select id="diskType" name="diskType"><option value="3390">3390</option><option value="9336">9336</option></select></div>');
|
||||
addDiskForm.append('<div><label for="diskAddress">Disk address:</label><input type="text" id="diskAddress" name="diskAddress"/></div>');
|
||||
addDiskForm.append('<div><label for="diskSize">Disk size:</label><input type="text" id="diskSize" name="diskSize"/></div>');
|
||||
|
||||
// Create drop down for disk pool
|
||||
var diskPool = $('<div></div>');
|
||||
diskPool.append('<label for="diskPool">Disk pool:</label>');
|
||||
var poolSelect = $('<select id="diskPool" name="diskPool"></select>');
|
||||
for ( var i = 0; i < pools.length; i++) {
|
||||
poolSelect.append('<option>' + pools[i] + '</option>');
|
||||
}
|
||||
diskPool.append(poolSelect);
|
||||
addDiskForm.append(diskPool);
|
||||
|
||||
// Create drop down for disk mode
|
||||
var diskMode = $('<div></div>');
|
||||
diskMode.append('<label for="diskMode">Disk mode:</label>');
|
||||
var modeSelect = $('<select id="diskMode" name="diskMode"></select>');
|
||||
modeSelect.append('<option>R</option>');
|
||||
modeSelect.append('<option>RR</option>');
|
||||
modeSelect.append('<option>W</option>');
|
||||
modeSelect.append('<option>WR</option>');
|
||||
modeSelect.append('<option>M</option>');
|
||||
modeSelect.append('<option>MR</option>');
|
||||
modeSelect.append('<option>MW</option>');
|
||||
diskMode.append(modeSelect);
|
||||
addDiskForm.append(diskMode);
|
||||
|
||||
addDiskForm.append('<div><label for="diskPassword">Disk password:</label><input type="password" id="diskPassword" name="diskPassword"/></div>');
|
||||
|
||||
// Create add disk dialog
|
||||
addDiskForm.dialog({
|
||||
position: 'top',
|
||||
modal: true,
|
||||
width: 400,
|
||||
buttons: {
|
||||
"Cancel": function() {
|
||||
// Close dialog
|
||||
$(this).dialog( "close" );
|
||||
},
|
||||
"Ok": function(){
|
||||
// Remove any warning messages
|
||||
$(this).find('.ui-state-error').remove();
|
||||
|
||||
// Get disk properties
|
||||
var node = $(this).find('input[name=diskNode]').val();
|
||||
var type = $(this).find('select[name=diskType]').val();
|
||||
var address = $(this).find('input[name=diskAddress]').val();
|
||||
var size = $(this).find('input[name=diskSize]').val();
|
||||
var pool = $(this).find('select[name=diskPool]').val();
|
||||
var mode = $(this).find('select[name=diskMode]').val();
|
||||
var password = $(this).find('input[name=diskPassword]').val();
|
||||
|
||||
if (!node || !type || !address || !size || !pool || !mode) {
|
||||
var warn = createWarnBar('Missing values');
|
||||
warn.prependTo($(this));
|
||||
} else {
|
||||
// Add disk
|
||||
if (type == '3390') {
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : node,
|
||||
args : '--add3390;' + pool + ';' + address + ';' + size
|
||||
+ ';' + mode + ';' + password + ';' + password + ';' + password,
|
||||
msg : node
|
||||
},
|
||||
|
||||
success : updateZNodeStatus
|
||||
});
|
||||
|
||||
// Increment node process
|
||||
incrementNodeProcess(node);
|
||||
|
||||
// Show loader
|
||||
var statusId = node + 'StatusBar';
|
||||
var statusBarLoaderId = node + 'StatusBarLoader';
|
||||
$('#' + statusBarLoaderId).show();
|
||||
$('#' + statusId).show();
|
||||
} else if (type == '9336') {
|
||||
// Default block size for FBA volumes = 512
|
||||
var blkSize = '512';
|
||||
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : node,
|
||||
args : '--add9336;' + pool + ';' + address + ';' + blkSize + ';' + size
|
||||
+ ';' + mode + ';' + password + ';' + password + ';' + password,
|
||||
msg : node
|
||||
},
|
||||
|
||||
success : updateZNodeStatus
|
||||
});
|
||||
|
||||
// Increment node process
|
||||
incrementNodeProcess(node);
|
||||
|
||||
// Show loader
|
||||
var statusId = node + 'StatusBar';
|
||||
var statusBarLoaderId = node + 'StatusBarLoader';
|
||||
$('#' + statusBarLoaderId).show();
|
||||
$('#' + statusId).show();
|
||||
}
|
||||
|
||||
// Close dialog
|
||||
$(this).dialog( "close" );
|
||||
} // End of else
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create add NIC dialog
|
||||
*
|
||||
* @param node
|
||||
* Node to add NIC to
|
||||
* @param hcp
|
||||
* Hardware control point of node
|
||||
* @return Nothing
|
||||
*/
|
||||
function createAddNicDialog(node, hcp) {
|
||||
// Get network names
|
||||
var networks = $.cookie(hcp + 'Networks').split(',');
|
||||
|
||||
// Create info bar
|
||||
var info = createInfoBar('Add a NIC');
|
||||
|
||||
// Create add NIC form
|
||||
var addNicForm = $('<div class="form"></div>');
|
||||
addNicForm.append(info);
|
||||
addNicForm.append('<div><label for="nicNode">NIC for:</label><input type="text" readonly="readonly" id="nicNode" name="nicNode" value="' + node + '"/></div>');
|
||||
addNicForm.append('<div><label for="nicAddress">NIC address:</label><input type="text" id="nicAddress" name="nicAddress"/></div>');
|
||||
|
||||
// Create drop down for NIC types
|
||||
var nicType = $('<div></div>');
|
||||
nicType.append('<label for="nicType">NIC type:</label>');
|
||||
var nicTypeSelect = $('<select id="nicType" name="nicType"></select>');
|
||||
nicTypeSelect.append('<option></option>');
|
||||
nicTypeSelect.append('<option>QDIO</option>');
|
||||
nicTypeSelect.append('<option>HiperSockets</option>');
|
||||
nicType.append(nicTypeSelect);
|
||||
addNicForm.append(nicType);
|
||||
|
||||
// Create drop down for network types
|
||||
var networkType = $('<div></div>');
|
||||
networkType.append('<label for="nicNetworkType">Network type:</label>');
|
||||
var networkTypeSelect = $('<select id="nicNetworkType" name="nicNetworkType"></select>');
|
||||
networkTypeSelect.append('<option></option>');
|
||||
networkTypeSelect.append('<option>Guest LAN</option>');
|
||||
networkTypeSelect.append('<option>Virtual Switch</option>');
|
||||
networkType.append(networkTypeSelect);
|
||||
addNicForm.append(networkType);
|
||||
|
||||
// Create drop down for network names
|
||||
var gLansQdioSelect = $('<select id="nicLanQdioName" name="nicLanQdioName"></select>');
|
||||
var gLansHipersSelect = $('<select id="nicLanHipersName" name="nicLanHipersName"></select>');
|
||||
var vswitchSelect = $('<select id="nicVSwitchName" name="nicVSwitchName"></select>');
|
||||
for ( var i = 0; i < networks.length; i++) {
|
||||
var network = networks[i].split(' ');
|
||||
var networkOption = $('<option>' + network[1] + ' ' + network[2] + '</option>');
|
||||
if (network[0] == 'VSWITCH') {
|
||||
vswitchSelect.append(networkOption);
|
||||
} else if (network[0] == 'LAN:QDIO') {
|
||||
gLansQdioSelect.append(networkOption);
|
||||
} else if (network[0] == 'LAN:HIPERS') {
|
||||
gLansHipersSelect.append(networkOption);
|
||||
}
|
||||
}
|
||||
|
||||
var guestLanQdio = $('<div></div>').hide();
|
||||
guestLanQdio.append('<label for="nicLanQdioName">Guest LAN name:</label>');
|
||||
guestLanQdio.append(gLansQdioSelect);
|
||||
addNicForm.append(guestLanQdio);
|
||||
|
||||
var guestLanHipers = $('<div></div>').hide();
|
||||
guestLanHipers.append('<label for="nicLanHipersName">Guest LAN name:</label>');
|
||||
guestLanHipers.append(gLansHipersSelect);
|
||||
addNicForm.append(guestLanHipers);
|
||||
|
||||
var vswitch = $('<div></div>').hide();
|
||||
vswitch.append('<label for="nicVSwitchName">VSWITCH name:</label>');
|
||||
vswitch.append(vswitchSelect);
|
||||
addNicForm.append(vswitch);
|
||||
|
||||
// Show network names on change
|
||||
networkTypeSelect.change(function(){
|
||||
// Remove any warning messages
|
||||
$(this).parent().parent().find('.ui-state-error').remove();
|
||||
|
||||
var nicType = nicTypeSelect.val();
|
||||
var networkType = $(this).val();
|
||||
|
||||
guestLanQdio.hide();
|
||||
guestLanHipers.hide();
|
||||
vswitch.hide();
|
||||
|
||||
if (networkType == 'Guest LAN' && nicType == 'QDIO')
|
||||
guestLanQdio.show();
|
||||
else if (networkType == 'Guest LAN' && nicType == 'HiperSockets')
|
||||
guestLanHipers.show();
|
||||
else if (networkType == 'Virtual Switch' && nicType == 'QDIO')
|
||||
vswitch.show();
|
||||
else if (networkType == 'Virtual Switch' && nicType != 'QDIO') {
|
||||
var warn = createWarnBar('The selected choices are not valid');
|
||||
warn.prependTo($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
|
||||
nicTypeSelect.change(function(){
|
||||
// Remove any warning messages
|
||||
$(this).parent().parent().find('.ui-state-error').remove();
|
||||
|
||||
var nicType = $(this).val();
|
||||
var networkType = networkTypeSelect.val();
|
||||
|
||||
guestLanQdio.hide();
|
||||
guestLanHipers.hide();
|
||||
vswitch.hide();
|
||||
|
||||
if (networkType == 'Guest LAN' && nicType == 'QDIO')
|
||||
guestLanQdio.show();
|
||||
else if (networkType == 'Guest LAN' && nicType == 'HiperSockets')
|
||||
guestLanHipers.show();
|
||||
else if (networkType == 'Virtual Switch' && nicType == 'QDIO')
|
||||
vswitch.show();
|
||||
else if (networkType == 'Virtual Switch' && nicType != 'QDIO') {
|
||||
var warn = createWarnBar('The selected choices are not valid');
|
||||
warn.prependTo($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
|
||||
// Create add NIC dialog
|
||||
addNicForm.dialog({
|
||||
position: 'top',
|
||||
modal: true,
|
||||
width: 400,
|
||||
buttons: {
|
||||
"Cancel": function(){
|
||||
// Close dialog
|
||||
$(this).dialog( "close" );
|
||||
},
|
||||
"Ok": function(){
|
||||
// Remove any warning messages
|
||||
$(this).find('.ui-state-error').remove();
|
||||
|
||||
var node = $(this).find('input[name=nicNode]').val();
|
||||
var nicType = $(this).find('select[name=nicType]').val();
|
||||
var networkType = $(this).find('select[name=nicNetworkType]').val();
|
||||
var address = $(this).find('input[name=nicAddress]').val();
|
||||
|
||||
if (!node || !nicType || !networkType || !address) {
|
||||
var warn = createWarnBar('Missing values');
|
||||
warn.prependTo($(this));
|
||||
} else {
|
||||
/**
|
||||
* Add guest LAN
|
||||
*/
|
||||
if (networkType == 'Guest LAN') {
|
||||
var temp;
|
||||
if (nicType == 'QDIO') {
|
||||
temp = $(this).find('select[name=nicLanQdioName]').val().split(' ');
|
||||
} else {
|
||||
temp = $(this).find('select[name=nicLanHipersName]').val().split(' ');
|
||||
}
|
||||
|
||||
var lanOwner = temp[0];
|
||||
var lanName = temp[1];
|
||||
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : node,
|
||||
args : '--addnic;' + address + ';' + nicType + ';3',
|
||||
msg : 'node=' + node + ';addr=' + address + ';lan='
|
||||
+ lanName + ';owner=' + lanOwner
|
||||
},
|
||||
success : connect2GuestLan
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add virtual switch
|
||||
*/
|
||||
else if (networkType == 'Virtual Switch' && nicType == 'QDIO') {
|
||||
var temp = $(this).find('select[name=nicVSwitchName]').val().split(' ');
|
||||
var vswitchName = temp[1];
|
||||
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chvm',
|
||||
tgt : node,
|
||||
args : '--addnic;' + address + ';' + nicType + ';3',
|
||||
msg : 'node=' + node + ';addr=' + address + ';vsw='
|
||||
+ vswitchName
|
||||
},
|
||||
|
||||
success : connect2VSwitch
|
||||
});
|
||||
}
|
||||
|
||||
// Increment node process
|
||||
incrementNodeProcess(node);
|
||||
|
||||
// Show loader
|
||||
var statusId = node + 'StatusBar';
|
||||
var statusBarLoaderId = node + 'StatusBarLoader';
|
||||
$('#' + statusBarLoaderId).show();
|
||||
$('#' + statusId).show();
|
||||
|
||||
// Close dialog
|
||||
$(this).dialog( "close" );
|
||||
} // End of else
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
318
xCAT-UI/js/jquery/jquery-impromptu.3.0.min.js
vendored
318
xCAT-UI/js/jquery/jquery-impromptu.3.0.min.js
vendored
@ -1,318 +0,0 @@
|
||||
/*
|
||||
* jQuery Impromptu
|
||||
* By: Trent Richardson [http://trentrichardson.com]
|
||||
* Version 3.0
|
||||
* Last Modified: 2/15/2010
|
||||
*
|
||||
* Copyright 2010 Trent Richardson
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
|
||||
* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
$.prompt = function(message, options) {
|
||||
options = $.extend( {}, $.prompt.defaults, options);
|
||||
$.prompt.currentPrefix = options.prefix;
|
||||
var ie6 = ($.browser.msie && $.browser.version < 7);
|
||||
var $body = $(document.body);
|
||||
var $window = $(window);
|
||||
options.classes = $.trim(options.classes);
|
||||
if (options.classes != '')
|
||||
options.classes = ' ' + options.classes;
|
||||
var msgbox = '<div class="' + options.prefix + 'box' + options.classes + '" id="' + options.prefix + 'box">';
|
||||
if (options.useiframe && (($('object, applet').length > 0) || ie6)) {
|
||||
msgbox += '<iframe src="javascript:false;" style="display:block;position:absolute;z-index:-1;" class="' + options.prefix + 'fade" id="' + options.prefix + 'fade"></iframe>';
|
||||
} else {
|
||||
if (ie6) {
|
||||
$('select').css('visibility', 'hidden');
|
||||
}
|
||||
msgbox += '<div class="' + options.prefix + 'fade" id="' + options.prefix + 'fade"></div>';
|
||||
}
|
||||
msgbox += '<div class="' + options.prefix + '" id="' + options.prefix + '"><div class="' + options.prefix + 'container"><div class="';
|
||||
msgbox += options.prefix + 'close">X</div><div id="' + options.prefix + 'states"></div>';
|
||||
msgbox += '</div></div></div>';
|
||||
var $jqib = $(msgbox).appendTo($body);
|
||||
var $jqi = $jqib.children('#' + options.prefix);
|
||||
var $jqif = $jqib.children('#' + options.prefix + 'fade');
|
||||
if (message.constructor == String) {
|
||||
message = {
|
||||
state0 : {
|
||||
html : message,
|
||||
buttons : options.buttons,
|
||||
focus : options.focus,
|
||||
submit : options.submit
|
||||
}
|
||||
};
|
||||
}
|
||||
var states = "";
|
||||
$
|
||||
.each(
|
||||
message,
|
||||
function(statename, stateobj) {
|
||||
stateobj = $.extend( {}, $.prompt.defaults.state, stateobj);
|
||||
message[statename] = stateobj;
|
||||
states += '<div id="' + options.prefix + '_state_' + statename + '" class="' + options.prefix + '_state" style="display:none;"><div class="' + options.prefix + 'message">' + stateobj.html + '</div><div class="' + options.prefix + 'buttons">';
|
||||
$
|
||||
.each(
|
||||
stateobj.buttons,
|
||||
function(k, v) {
|
||||
states += '<button name="' + options.prefix + '_' + statename + '_button' + k + '" id="' + options.prefix + '_' + statename + '_button' + k + '" value="' + v + '">' + k + '</button>';
|
||||
});
|
||||
states += '</div></div>';
|
||||
});
|
||||
$jqi.find('#' + options.prefix + 'states').html(states).children(
|
||||
'.' + options.prefix + '_state:first').css('display', 'block');
|
||||
$jqi.find('.' + options.prefix + 'buttons:empty')
|
||||
.css('display', 'none');
|
||||
$
|
||||
.each(
|
||||
message,
|
||||
function(statename, stateobj) {
|
||||
var $state = $jqi
|
||||
.find('#' + options.prefix + '_state_' + statename);
|
||||
$state
|
||||
.children('.' + options.prefix + 'buttons')
|
||||
.children('button')
|
||||
.click(
|
||||
function() {
|
||||
var msg = $state
|
||||
.children('.' + options.prefix + 'message');
|
||||
var clicked = stateobj.buttons[$(this).text()];
|
||||
var forminputs = {};
|
||||
$
|
||||
.each(
|
||||
$jqi
|
||||
.find(
|
||||
'#' + options.prefix + 'states :input')
|
||||
.serializeArray(),
|
||||
function(i, obj) {
|
||||
if (forminputs[obj.name] === undefined) {
|
||||
forminputs[obj.name] = obj.value;
|
||||
} else if (typeof forminputs[obj.name] == Array || typeof forminputs[obj.name] == 'object') {
|
||||
forminputs[obj.name]
|
||||
.push(obj.value);
|
||||
} else {
|
||||
forminputs[obj.name] = [
|
||||
forminputs[obj.name],
|
||||
obj.value ];
|
||||
}
|
||||
});
|
||||
var close = stateobj.submit(clicked, msg,
|
||||
forminputs);
|
||||
if (close === undefined || close) {
|
||||
removePrompt(true, clicked, msg, forminputs);
|
||||
}
|
||||
});
|
||||
$state
|
||||
.find(
|
||||
'.' + options.prefix + 'buttons button:eq(' + stateobj.focus + ')')
|
||||
.addClass(options.prefix + 'defaultbutton');
|
||||
});
|
||||
var ie6scroll = function() {
|
||||
$jqib.css( {
|
||||
top : $window.scrollTop()
|
||||
});
|
||||
};
|
||||
var fadeClicked = function() {
|
||||
if (options.persistent) {
|
||||
var i = 0;
|
||||
$jqib.addClass(options.prefix + 'warning');
|
||||
var intervalid = setInterval(function() {
|
||||
$jqib.toggleClass(options.prefix + 'warning');
|
||||
if (i++ > 1) {
|
||||
clearInterval(intervalid);
|
||||
$jqib.removeClass(options.prefix + 'warning');
|
||||
}
|
||||
}, 100);
|
||||
} else {
|
||||
removePrompt();
|
||||
}
|
||||
};
|
||||
var keyPressEventHandler = function(e) {
|
||||
var key = (window.event) ? event.keyCode : e.keyCode;
|
||||
if (key == 27) {
|
||||
fadeClicked();
|
||||
}
|
||||
if (key == 9) {
|
||||
var $inputels = $(':input:enabled:visible', $jqib);
|
||||
var fwd = !e.shiftKey && e.target == $inputels[$inputels.length - 1];
|
||||
var back = e.shiftKey && e.target == $inputels[0];
|
||||
if (fwd || back) {
|
||||
setTimeout(
|
||||
function() {
|
||||
if (!$inputels)
|
||||
return;
|
||||
var el = $inputels[back === true ? $inputels.length - 1 : 0];
|
||||
if (el)
|
||||
el.focus();
|
||||
}, 10);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
var positionPrompt = function() {
|
||||
$jqib.css( {
|
||||
position : (ie6) ? "absolute" : "fixed",
|
||||
height : $window.height(),
|
||||
width : "100%",
|
||||
top : (ie6) ? $window.scrollTop() : 0,
|
||||
left : 0,
|
||||
right : 0,
|
||||
bottom : 0
|
||||
});
|
||||
$jqif.css( {
|
||||
position : "absolute",
|
||||
height : $window.height(),
|
||||
width : "100%",
|
||||
top : 0,
|
||||
left : 0,
|
||||
right : 0,
|
||||
bottom : 0
|
||||
});
|
||||
$jqi.css( {
|
||||
position : "absolute",
|
||||
top : options.top,
|
||||
left : "50%",
|
||||
marginLeft : (($jqi.outerWidth() / 2) * -1)
|
||||
});
|
||||
};
|
||||
var stylePrompt = function() {
|
||||
$jqif.css( {
|
||||
zIndex : options.zIndex,
|
||||
display : "none",
|
||||
opacity : options.opacity
|
||||
});
|
||||
$jqi.css( {
|
||||
zIndex : options.zIndex + 1,
|
||||
display : "none"
|
||||
});
|
||||
$jqib.css( {
|
||||
zIndex : options.zIndex
|
||||
});
|
||||
};
|
||||
var removePrompt = function(callCallback, clicked, msg, formvals) {
|
||||
$jqi.remove();
|
||||
if (ie6) {
|
||||
$body.unbind('scroll', ie6scroll);
|
||||
}
|
||||
$window.unbind('resize', positionPrompt);
|
||||
$jqif.fadeOut(options.overlayspeed, function() {
|
||||
$jqif.unbind('click', fadeClicked);
|
||||
$jqif.remove();
|
||||
if (callCallback) {
|
||||
options.callback(clicked, msg, formvals);
|
||||
}
|
||||
$jqib.unbind('keypress', keyPressEventHandler);
|
||||
$jqib.remove();
|
||||
if (ie6 && !options.useiframe) {
|
||||
$('select').css('visibility', 'visible');
|
||||
}
|
||||
});
|
||||
};
|
||||
positionPrompt();
|
||||
stylePrompt();
|
||||
if (ie6) {
|
||||
$window.scroll(ie6scroll);
|
||||
}
|
||||
$jqif.click(fadeClicked);
|
||||
$window.resize(positionPrompt);
|
||||
$jqib.bind("keydown keypress", keyPressEventHandler);
|
||||
$jqi.find('.' + options.prefix + 'close').click(removePrompt);
|
||||
$jqif.fadeIn(options.overlayspeed);
|
||||
$jqi[options.show](options.promptspeed, options.loaded);
|
||||
$jqi
|
||||
.find(
|
||||
'#' + options.prefix + 'states .' + options.prefix + '_state:first .' + options.prefix + 'defaultbutton')
|
||||
.focus();
|
||||
if (options.timeout > 0)
|
||||
setTimeout($.prompt.close, options.timeout);
|
||||
return $jqib;
|
||||
};
|
||||
$.prompt.defaults = {
|
||||
prefix : 'jqi',
|
||||
classes : '',
|
||||
buttons : {
|
||||
Ok : true
|
||||
},
|
||||
loaded : function() {
|
||||
},
|
||||
submit : function() {
|
||||
return true;
|
||||
},
|
||||
callback : function() {
|
||||
},
|
||||
opacity : 0.6,
|
||||
zIndex : 999,
|
||||
overlayspeed : 'slow',
|
||||
promptspeed : 'fast',
|
||||
show : 'fadeIn',
|
||||
focus : 0,
|
||||
useiframe : false,
|
||||
top : "15%",
|
||||
persistent : true,
|
||||
timeout : 0,
|
||||
state : {
|
||||
html : '',
|
||||
buttons : {
|
||||
Ok : true
|
||||
},
|
||||
focus : 0,
|
||||
submit : function() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
$.prompt.currentPrefix = $.prompt.defaults.prefix;
|
||||
$.prompt.setDefaults = function(o) {
|
||||
$.prompt.defaults = $.extend( {}, $.prompt.defaults, o);
|
||||
};
|
||||
$.prompt.setStateDefaults = function(o) {
|
||||
$.prompt.defaults.state = $.extend( {}, $.prompt.defaults.state, o);
|
||||
};
|
||||
$.prompt.getStateContent = function(state) {
|
||||
return $('#' + $.prompt.currentPrefix + '_state_' + state);
|
||||
};
|
||||
$.prompt.getCurrentState = function() {
|
||||
return $('.' + $.prompt.currentPrefix + '_state:visible');
|
||||
};
|
||||
$.prompt.getCurrentStateName = function() {
|
||||
var stateid = $.prompt.getCurrentState().attr('id');
|
||||
return stateid.replace($.prompt.currentPrefix + '_state_', '');
|
||||
};
|
||||
$.prompt.goToState = function(state) {
|
||||
$('.' + $.prompt.currentPrefix + '_state').slideUp('slow');
|
||||
$('#' + $.prompt.currentPrefix + '_state_' + state).slideDown(
|
||||
'slow',
|
||||
function() {
|
||||
$(this).find('.' + $.prompt.currentPrefix + 'defaultbutton')
|
||||
.focus();
|
||||
});
|
||||
};
|
||||
$.prompt.nextState = function() {
|
||||
var $next = $('.' + $.prompt.currentPrefix + '_state:visible').next();
|
||||
$('.' + $.prompt.currentPrefix + '_state').slideUp('slow');
|
||||
$next.slideDown('slow', function() {
|
||||
$next.find('.' + $.prompt.currentPrefix + 'defaultbutton').focus();
|
||||
});
|
||||
};
|
||||
$.prompt.prevState = function() {
|
||||
var $next = $('.' + $.prompt.currentPrefix + '_state:visible').prev();
|
||||
$('.' + $.prompt.currentPrefix + '_state').slideUp('slow');
|
||||
$next.slideDown('slow', function() {
|
||||
$next.find('.' + $.prompt.currentPrefix + 'defaultbutton').focus();
|
||||
});
|
||||
};
|
||||
$.prompt.close = function() {
|
||||
$('#' + $.prompt.currentPrefix + 'box').fadeOut('fast', function() {
|
||||
$(this).remove();
|
||||
});
|
||||
};
|
||||
$.fn.prompt = function(options) {
|
||||
if (options == undefined)
|
||||
options = {};
|
||||
if (options.withDataAndEvents == undefined)
|
||||
options.withDataAndEvents = false;
|
||||
$.prompt($(this).clone(withDataAndEvents).html(), options);
|
||||
}
|
||||
})(jQuery);
|
@ -154,195 +154,63 @@ function loadGroups(data) {
|
||||
// Create link to add nodes
|
||||
var addNodeLink = $('<a href="#">Add node</a>');
|
||||
addNodeLink.bind('click', function(event) {
|
||||
// Create form to give node range, group, and hardware management
|
||||
var mgtForm = '<div class="form">'
|
||||
+ '<div><label for="node">Node range:</label><input type="text" id="node" name="node"/></div>'
|
||||
+ '<div><label for="group">Group:</label><input type="text" id="group" name="group"/></div>'
|
||||
+ '<div><label for="mgt">Hardware management:</label>'
|
||||
+ '<select id="mgt" name="mgt">'
|
||||
+ '<option>ipmi</option>'
|
||||
+ '<option>blade</option>'
|
||||
+ '<option>hmc</option>'
|
||||
+ '<option>ivm</option>'
|
||||
+ '<option>fsp</option>'
|
||||
+ '<option>zvm</option>'
|
||||
+ '</select>'
|
||||
+ '</div>'
|
||||
+ '</div>';
|
||||
|
||||
// Create form for ipmi plugin
|
||||
var ipmiForm = '<div class="form">'
|
||||
+ '<div>Under contruction</div>'
|
||||
+ '</div>';
|
||||
|
||||
// Create form for blade plugin
|
||||
var bladeForm = '<div class="form">'
|
||||
+ '<div>Under contruction</div>'
|
||||
+ '</div>';
|
||||
|
||||
// Create form for hmc plugin
|
||||
var hmcForm = '<div class="form">'
|
||||
+ '<div>Under contruction</div>'
|
||||
+ '</div>';
|
||||
|
||||
// Create form for ivm plugin
|
||||
var ivmForm = '<div class="form">'
|
||||
+ '<div>Under contruction</div>'
|
||||
+ '</div>';
|
||||
|
||||
// Create form for fsp plugin
|
||||
var fspForm = '<div class="form">'
|
||||
+ '<div>Under contruction</div>'
|
||||
+ '</div>';
|
||||
|
||||
// Create form for zvm plugin
|
||||
var zvmForm = '<div class="form">'
|
||||
+ '<div><label for="userId">User ID range:</label><input type="text" id="userId" name="userId"/></div>'
|
||||
+ '<div><label for="hcp">Hardware control point:</label><input type="text" id="hcp" name="hcp"/></div>'
|
||||
+ '</div>';
|
||||
|
||||
var states = {
|
||||
mgt : {
|
||||
html : mgtForm,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (!v) {
|
||||
return true;
|
||||
} else {
|
||||
// Get the hardware management selected
|
||||
var mgt = f.mgt;
|
||||
switch(mgt) {
|
||||
case "blade":
|
||||
$.prompt.goToState("blade");
|
||||
break;
|
||||
case "fsp":
|
||||
$.prompt.goToState("fsp");
|
||||
break;
|
||||
case "hmc":
|
||||
$.prompt.goToState("hmc");
|
||||
break;
|
||||
case "ipmi":
|
||||
$.prompt.goToState("ipmi");
|
||||
break;
|
||||
case "ivm":
|
||||
$.prompt.goToState("ivm");
|
||||
break;
|
||||
case "zvm":
|
||||
$.prompt.goToState("zvm");
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
} // End of else
|
||||
} // End of submit
|
||||
},
|
||||
|
||||
// Show blade form
|
||||
blade : {
|
||||
html : bladeForm,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Show fsp form
|
||||
fsp : {
|
||||
html : fspForm,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Show hmc form
|
||||
hmc : {
|
||||
html : hmcForm,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Show ipmi form
|
||||
ipmi : {
|
||||
html : ipmiForm,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Show ivm form
|
||||
ivm : {
|
||||
html : ivmForm,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Show zvm form
|
||||
zvm : {
|
||||
html : zvmForm,
|
||||
buttons : {
|
||||
Ok : true,
|
||||
Cancel : false
|
||||
},
|
||||
focus : 1,
|
||||
prefix : 'cleanblue',
|
||||
submit : function(v, m, f) {
|
||||
if (v) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
var info = createInfoBar('Select the hardware management for the new node range');
|
||||
var addNodeForm = $('<div class="form"></div>');
|
||||
addNodeForm.append(info);
|
||||
addNodeForm.append('<div><label for="mgt">Hardware management:</label>'
|
||||
+ '<select id="mgt" name="mgt">'
|
||||
+ '<option>ipmi</option>'
|
||||
+ '<option>blade</option>'
|
||||
+ '<option>hmc</option>'
|
||||
+ '<option>ivm</option>'
|
||||
+ '<option>fsp</option>'
|
||||
+ '<option>zvm</option>'
|
||||
+ '</select>'
|
||||
+ '</div>' );
|
||||
|
||||
// Create add processor dialog
|
||||
addNodeForm.dialog({
|
||||
position: 'top',
|
||||
modal: true,
|
||||
width: 400,
|
||||
buttons: {
|
||||
"Cancel": function(){
|
||||
// Close dialog
|
||||
$(this).dialog( "close" );
|
||||
},
|
||||
"Ok": function(){
|
||||
// Get processor properties
|
||||
var mgt = $(this).find('select[name=mgt]').val();
|
||||
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "fsp":
|
||||
plugin = new fspPlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "ivm":
|
||||
plugin = new ivmPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
}
|
||||
|
||||
plugin.addNode();
|
||||
|
||||
// Close dialog
|
||||
$(this).dialog( "close" );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.prompt(states, {
|
||||
callback : addNode,
|
||||
prefix : 'cleanblue'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
$('#groups').append(addNodeLink);
|
||||
@ -1671,47 +1539,4 @@ function loadRconsPage(tgtNodes){
|
||||
|
||||
//open the rcons page
|
||||
window.open(redirectUrl + "?rconsnd=" + tgtNodes, '', "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=670,height=436");
|
||||
}
|
||||
|
||||
/**
|
||||
* Add node
|
||||
*
|
||||
* @param v
|
||||
* Value of the button clicked
|
||||
* @param m
|
||||
* jQuery object of the message within the active state when the user
|
||||
* clicked the button
|
||||
* @param f
|
||||
* Key/value pairs of the form values
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function addNode(v, m, f) {
|
||||
// If user clicks Ok
|
||||
if (v) {
|
||||
var mgt = f.mgt;
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "fsp":
|
||||
plugin = new fspPlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "ivm":
|
||||
plugin = new ivmPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
}
|
||||
|
||||
plugin.addNode(f);
|
||||
} // End of if
|
||||
}
|
@ -320,12 +320,27 @@ function createStatusBar(barId) {
|
||||
*/
|
||||
function createInfoBar(msg) {
|
||||
var infoBar = $('<div class="ui-state-highlight ui-corner-all">');
|
||||
var msg = $('<p class="info"><span class="ui-icon ui-icon-info"></span>' + msg + '</p>');
|
||||
var msg = $('<p><span class="ui-icon ui-icon-info"></span>' + msg + '</p>');
|
||||
infoBar.append(msg);
|
||||
|
||||
return infoBar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create warning bar
|
||||
*
|
||||
* @param msg
|
||||
* Warning message
|
||||
* @return Warning bar
|
||||
*/
|
||||
function createWarnBar(msg) {
|
||||
var warnBar = $('<div class="ui-state-error ui-corner-all">');
|
||||
var msg = $('<p><span class="ui-icon ui-icon-alert"></span>' + msg + '</p>');
|
||||
warnBar.append(msg);
|
||||
|
||||
return warnBar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a loader
|
||||
*
|
||||
@ -504,4 +519,29 @@ function writeRsp(rsp, pattern) {
|
||||
}
|
||||
|
||||
return prg;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a dialog and show given message
|
||||
*
|
||||
* @param msg
|
||||
* Message to show
|
||||
* @return Nothing
|
||||
*/
|
||||
function openDialog(msg) {
|
||||
// If there was an error, do not continue
|
||||
var div = $('<div><p>' + msg + '</p></div>');
|
||||
|
||||
// Create dialog
|
||||
div.dialog({
|
||||
position: 'top',
|
||||
modal: true,
|
||||
width: 400,
|
||||
buttons: {
|
||||
"Ok": function(){
|
||||
// Close dialog
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user