Added titles to dialogs. Complete ESX provision page.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11097 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2011-12-01 04:10:40 +00:00
parent 79683084e5
commit c1b50c993e
9 changed files with 183 additions and 88 deletions

View File

@ -411,7 +411,7 @@ function addBladeNode(){
}
if ((!name) || (!group) || (!id) || (!mpa)){
$('#nodeTypeSelectDia').prepend(createWarnBar("You miss some inputs."));
$('#nodeTypeSelectDia').prepend(createWarnBar("Please provide a value for each missing field."));
return;
}

View File

@ -581,7 +581,7 @@ function quickProvision(plugin){
$('#' + containerId + ' input[type!="checkbox"]').each(function() {
if (!$(this).val()) {
errorMessage = 'You are missing some inputs!';
errorMessage = 'Please provide a value for each missing field!';
return false;
} else {
argsArray.push($(this).val());

View File

@ -159,14 +159,11 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
success : setGroupsCookies
});
// Get provision tab instance
var inst = tabId.replace('esxProvisionTab', '');
// Create provision form
var provForm = $('<div class="form"></div>');
// Create info bar
var infoBar = createInfoBar('Provision an ESX virtual machine.');
var infoBar = createInfoBar('Provision an VMware virtual machine.');
provForm.append(infoBar);
// Append to provision tab
@ -187,31 +184,12 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
provForm.append(vmFS, hwFS, imgFS);
// Create hypervisor input
var hypervisor = $('<div></div>');
var hypervisorLabel = $('<label>Hypervisor:</label>');
hypervisor.append(hypervisorLabel);
// Turn on auto complete for group
var hypervisorNames = $.cookie('');
if (hypervisorNames) {
// Split group names into an array
var tmp = groupNames.split(',');
// Create drop down for groups
var hypervisorSelect = $('<select></select>');
hypervisorSelect.append('<option></option>');
for ( var i in tmp) {
// Add group into drop down
var opt = $('<option value="' + tmp[i] + '">' + tmp[i] + '</option>');
hypervisorSelect.append(opt);
}
hypervisor.append(groupSelect);
} else {
// If no groups are cookied
var hypervisorInput = $('<input type="text" name="group"/>');
hypervisor.append(hypervisorInput);
}
vmFS.append(hypervisor);
var host = $('<div></div>');
var hostLabel = $('<label>Host:</label>');
host.append(hostLabel);
var hostInput = $('<input type="text" name="host"/>');
host.append(hostInput);
vmFS.append(host);
// Create group input
var group = $('<div></div>');
@ -225,7 +203,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
var tmp = groupNames.split(',');
// Create drop down for groups
var groupSelect = $('<select></select>');
var groupSelect = $('<select name="group"></select>');
groupSelect.append('<option></option>');
for ( var i in tmp) {
// Add group into drop down
@ -251,7 +229,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
// Create memory input
var memory = $('<div></div>');
var memoryLabel = $('<label>Memory:</label>');
var memoryInput = $('<input type="text" name="memory"/>');
var memoryInput = $('<input type="text" name="memory" size="5"/>');
memory.append(memoryLabel);
memory.append(memoryInput);
hwFS.append(memory);
@ -276,34 +254,33 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
// Create NIC dropdown
var nic = $('<div></div>');
var nicLabel = $('<label>NIC:</label>');
var nicSelect = $('<select name="nic"></select>');
nicSelect.append('<option value="1">1</option>'
+ '<option value="2">2</option>'
+ '<option value="3">3</option>'
+ '<option value="4">4</option>'
+ '<option value="5">5</option>'
+ '<option value="6">6</option>'
+ '<option value="7">7</option>'
+ '<option value="8">8</option>'
);
var nicInput = $('<input type="text" name="nic"/>');
nic.append(nicLabel);
nic.append(nicSelect);
nic.append(nicInput);
hwFS.append(nic);
// Create disk input
var disk = $('<div></div>');
var diskLabel = $('<label>Disk size:</label>');
var diskInput = $('<input type="text" name="disk"/>');
var diskSizeSelect = $('<select name="nic"></select>');
diskSizeSelect.append('<option value="MB">MB</option>'
+ '<option value="GB">GB</option>'
var diskInput = $('<input type="text" name="disk" size="5"/>');
var diskSizeSelect = $('<select name="diskUnit"></select>');
diskSizeSelect.append('<option value="G">GB</option>' +
'<option value="M">MB</option>'
);
disk.append(diskLabel, diskInput, diskSizeSelect);
hwFS.append(disk);
// Create disk storage input
var storage = $('<div></div>');
var storageLabel = $('<label>Storage:</label>');
var storageInput = $('<input type="text" name="storage"/>');
storage.append(storageLabel);
storage.append(storageInput);
hwFS.append(storage);
// Create operating system input
var os = $('<div></div>');
var osLabel = $('<label for="os">Operating system:</label>');
var osLabel = $('<label>Operating system:</label>');
var osInput = $('<input type="text" name="os"/>');
osInput.one('focus', function() {
var tmp = $.cookie('osvers');
@ -320,7 +297,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
// Create architecture input
var arch = $('<div></div>');
var archLabel = $('<label for="arch">Architecture:</label>');
var archLabel = $('<label>Architecture:</label>');
var archInput = $('<input type="text" name="arch"/>');
archInput.one('focus', function() {
var tmp = $.cookie('osarchs');
@ -337,7 +314,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
// Create profile input
var profile = $('<div></div>');
var profileLabel = $('<label for="profile">Profile:</label>');
var profileLabel = $('<label>Profile:</label>');
var profileInput = $('<input type="text" name="profile"/>');
profileInput.one('focus', function() {
var tmp = $.cookie('profiles');
@ -354,7 +331,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
// Create boot method dropdown
var method = $('<div></div>');
var methodLabel = $('<label for="method">Boot method:</label>');
var methodLabel = $('<label>Boot method:</label>');
var methodSelect = $('<select id="bootMethod" name="bootMethod"></select>');
methodSelect.append('<option value=""></option>'
+ '<option value="boot">boot</option>'
@ -375,15 +352,14 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
// Remove any warning messages
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
var ready = true;
var errorMessage = '';
// Get tab ID
var thisTabId = $(this).parents('.ui-tabs-panel').attr('id');
var tabId = $(this).parents('.ui-tabs-panel').attr('id');
// Check if fields are properly filled in
var inputs = $('#' + thisTabId + ' input:visible');
var inputs = $('#' + tabId + ' input:visible');
for ( var i = 0; i < inputs.length; i++) {
if (!inputs.eq(i).val()) {
if (!inputs.eq(i).val() && inputs.eq(i).attr('name') != 'storage') {
inputs.eq(i).css('border', 'solid #FF0000 1px');
ready = false;
} else {
@ -391,7 +367,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
}
}
var selects = $('#' + thisTabId + ' select:visible');
var selects = $('#' + tabId + ' select:visible');
for ( var i = 0; i < selects.length; i++) {
if (!selects.eq(i).val()) {
selects.eq(i).css('border', 'solid #FF0000 1px');
@ -400,6 +376,65 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
selects.eq(i).css('border', 'solid #BDBDBD 1px');
}
}
if (ready) {
var inst = tabId.replace('kvmProvisionTab', '');
// Prepend status bar
var statBar = createStatusBar('kvmProvisionStatBar' + inst);
statBar.append(createLoader(''));
statBar.prependTo($('#' + tabId));
var host = $('#' + tabId + ' input[name=host]').val();
var group = $('#' + tabId + ' select[name=group]').val();
var node = $('#' + tabId + ' input[name=node]').val();
var memory = $('#' + tabId + ' input[name=memory]').val();
var cpu = $('#' + tabId + ' select[name=cpu]').val();
var nic = $('#' + tabId + ' input[name=nic]').val();
var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val();
var storage = $('#' + tabId + ' input[name=storage]').val();
var os = $('#' + tabId + ' input[name=os]').val();
var arch = $('#' + tabId + ' input[name=arch]').val();
var profile = $('#' + tabId + ' input[name=profile]').val();
var boot = $('#' + tabId + ' select[name=bootMethod]').val();
/**
* (1) Define node
*/
var args = '-t;node;-o;' + node +
';vmhost=' + host +
';groups=' + group +
';vmmemory=' + memory +
';vmcpus=' + cpu +
';vmnics=' + nic +
';vmstorage=' + storage +
';os=' + os +
';arch=' + arch +
';profile=' + profile +
';netboot=xnba' +
';nodetype=osi' +
';serialport=0' +
';serialspeed=115200' +
';mgt=esx';
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'chdef',
tgt : '',
args : args,
msg : 'cmd=chdef;out=' + inst
},
success : updateESXProvisionStatus
});
} else {
// Show warning message
var warn = createWarnBar('Please provide a value for each missing field.');
warn.prependTo($(this).parent().parent());
}
});
provForm.append(provisionBtn);
};
@ -490,7 +525,7 @@ function addIdataplex(){
if (attr) {
tempArray.push($(this).val());
} else {
errorMessage = "You are missing some inputs!";
errorMessage = "Please provide a value for each missing field!";
return false;
}
});
@ -568,35 +603,31 @@ function updateESXProvisionStatus(data) {
var inst = args[1].replace('out=', '');
// Get provision tab and status bar ID
var statBarId = 'esxProvisionStatBar' + inst;
var tabId = 'esxProvisionTab' + inst;
var statBarId = 'kvmProvisionStatBar' + inst;
var tabId = 'kvmProvisionTab' + inst;
var node = $('#' + tabId + ' input[name=node]').val();
/**
* (2) Remote install
* (2) Create virtual machine
*/
if (cmd == 'nodeadd') {
if (cmd == 'chdef') {
// Write ajax response to status bar
var prg = writeRsp(rsp, '');
$('#' + statBarId).find('div').append(prg);
// Get parameters
var os = $('#' + tabId + ' input[name="os"]').val();
var profile = $('#' + tabId + ' input[name="profile"]').val();
var arch = $('#' + tabId + ' input[name="arch"]').val();
// Get nodes that were checked
var dTableId = 'esxNodesDatatable' + inst;
var tgts = getNodesChecked(dTableId);
var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val();
// Begin installation
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
cmd : 'mkvm',
tgt : '',
args : 'rinstall;' + os + ';' + profile + ';' + arch + ';' + tgts,
msg : 'cmd=rinstall;out=' + inst
args : node + ';-s;' + disk,
msg : 'cmd=mkvm;out=' + inst
},
success : updateESXProvisionStatus
@ -604,9 +635,57 @@ function updateESXProvisionStatus(data) {
}
/**
* (3) Done
* (3) Prepare node for boot
*/
else if (cmd == 'rinstall') {
if (cmd == 'mkvm') {
// Write ajax response to status bar
var prg = writeRsp(rsp, '');
$('#' + statBarId).find('div').append(prg);
// Get provision method
var boot = $('#' + tabId + ' select[name=bootMethod]').val();
// Prepare node for boot
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'nodeset',
tgt : node,
args : boot,
msg : 'cmd=nodeset;out=' + inst
},
success : updateESXProvisionStatus
});
}
/**
* (4) Power on node
*/
if (cmd == 'nodeset') {
var prg = writeRsp(rsp, '');
$('#' + statBarId).find('div').append(prg);
// Prepare node for boot
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'rpower',
tgt : node,
args : 'on',
msg : 'cmd=rpower;out=' + inst
},
success : updateESXProvisionStatus
});
}
/**
* (5) Done
*/
else if (cmd == 'rpower') {
// Write ajax response to status bar
var prg = writeRsp(rsp, '');
$('#' + statBarId).find('div').append(prg);
@ -614,7 +693,7 @@ function updateESXProvisionStatus(data) {
// If installation was successful
if (prg.html().indexOf('Error') == -1) {
$('#' + statBarId).find('div').append('<pre>It will take several minutes before the nodes are up and ready. Use nodestat to check the status of the install.</pre>');
$('#' + statBarId).find('div').append('<pre>It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.</pre>');
}
}
}

View File

@ -371,7 +371,7 @@ function addHmcNode(){
var args = '';
$('#pnodeeditarea input').each(function(){
if (!$(this).val()){
errorinfo = 'You are missing some inputs!';
errorinfo = 'Please provide a value for each missing field!';
}
args += $(this).val() + ',';
});

View File

@ -263,7 +263,7 @@ function addIdataplex(){
if (attr) {
tempArray.push($(this).val());
} else {
errorMessage = "You are missing some inputs!";
errorMessage = "Please provide a value for each missing field!";
return false;
}
});

View File

@ -525,7 +525,7 @@ function addIdataplex(){
if (attr) {
tempArray.push($(this).val());
} else {
errorMessage = "You are missing some inputs!";
errorMessage = "Please provide a value for each missing field!";
return false;
}
});

View File

@ -503,10 +503,21 @@ zvmPlugin.prototype.loadClonePage = function(node) {
var cloneForm = $('<div class="form"></div>');
cloneForm.append(statBar);
cloneForm.append(infoBar);
cloneForm.append('<div><label>Target node range:</label><input type="text" id="tgtNode" name="tgtNode" title="You must give a node or a node range. A node range must be given as: node1-node9 or node[1-9]."/></div>');
cloneForm.append('<div><label>Target user ID range:</label><input type="text" id="tgtUserId" name="tgtUserId" title="You must give a user ID or a user ID range. A user ID range must be given as: user1-user9 or user[1-9]."/></div>');
cloneForm.append('<div><label>Clone source:</label><input type="text" id="srcNode" name="srcNode" readonly="readonly" value="' + node + '" title="The source node to be cloned"/></div>');
cloneForm.append('<div><label>Hardware control point:</label><input type="text" id="newHcp" name="newHcp" readonly="readonly" value="' + hcp + '" title="The System z hardware control point (zHCP) responsible for managing the node(s). It must be the same as the source node."/></div>');
var vmFS = $('<fieldset></fieldset>');
var vmLegend = $('<legend>Virtual Machine</legend>');
vmFS.append(vmLegend);
cloneForm.append(vmFS);
var hwFS = $('<fieldset></fieldset>');
var hwLegend = $('<legend>Hardware</legend>');
hwFS.append(hwLegend);
cloneForm.append(hwFS);
vmFS.append('<div><label>Target node range:</label><input type="text" id="tgtNode" name="tgtNode" title="You must give a node or a node range. A node range must be given as: node1-node9 or node[1-9]."/></div>');
vmFS.append('<div><label>Target user ID range:</label><input type="text" id="tgtUserId" name="tgtUserId" title="You must give a user ID or a user ID range. A user ID range must be given as: user1-user9 or user[1-9]."/></div>');
vmFS.append('<div><label>Clone source:</label><input type="text" id="srcNode" name="srcNode" readonly="readonly" value="' + node + '" title="The source node to be cloned"/></div>');
vmFS.append('<div><label>Hardware control point:</label><input type="text" id="newHcp" name="newHcp" readonly="readonly" value="' + hcp + '" title="The System z hardware control point (zHCP) responsible for managing the node(s). It must be the same as the source node."/></div>');
// Create group input
var group = $('<div></div>');
@ -523,7 +534,7 @@ zvmPlugin.prototype.loadClonePage = function(node) {
});
group.append(groupLabel);
group.append(groupInput);
cloneForm.append(group);
vmFS.append(group);
// Get list of disk pools
var temp = hcp.split('.');
@ -537,9 +548,9 @@ zvmPlugin.prototype.loadClonePage = function(node) {
});
poolDiv.append(poolLabel);
poolDiv.append(poolInput);
cloneForm.append(poolDiv);
hwFS.append(poolDiv);
cloneForm.append('<div><label>Disk password:</label><input type="password" id="diskPw" name="diskPw" title="The password that will be used for accessing the disk. This input is optional."/></div>');
hwFS.append('<div><label>Disk password:</label><input type="password" id="diskPw" name="diskPw" title="The password that will be used for accessing the disk. This input is optional."/></div>');
// Generate tooltips
cloneForm.find('div input[title]').tooltip({
@ -582,7 +593,7 @@ zvmPlugin.prototype.loadClonePage = function(node) {
// Write error message
if (!ready) {
errMsg = errMsg + 'You are missing some inputs.<br>';
errMsg = errMsg + 'Please provide a value for each missing field.<br>';
}
// Get target node

View File

@ -108,6 +108,7 @@ function loadHcpInfo(data) {
// Open dialog
warnDialog.dialog({
title:'Warning',
modal: true,
width: 400,
buttons: {
@ -1144,6 +1145,7 @@ function openAddProcDialog(node) {
// Open dialog to add processor
addProcForm.dialog({
title:'Add processor',
modal: true,
width: 400,
buttons: {
@ -1248,6 +1250,7 @@ function openAddDiskDialog(node, hcp) {
// Open dialog to add disk
addDiskForm.dialog({
title:'Add disk',
modal: true,
width: 400,
buttons: {
@ -1478,6 +1481,7 @@ function openAddNicDialog(node, hcp) {
// Open dialog to add NIC
addNicForm.dialog({
title:'Add NIC',
modal: true,
width: 400,
buttons: {
@ -2555,6 +2559,7 @@ function createZProvisionNew(inst) {
// Open dialog to confirm
var confirmDialog = $('<div><p>' + msg + '</p></div>');
confirmDialog.dialog({
title:'Confirm',
modal: true,
width: 400,
buttons: {

View File

@ -188,7 +188,7 @@ function loadNetbootPage(tgtNodes) {
statusBar.show();
} else {
// Show warning message
var warn = createWarnBar('You are missing some inputs.');
var warn = createWarnBar('Please provide a value for each missing field.');
warn.prependTo($(this).parent().parent());
}
});