Updated xCAT-UI with new functionality for z/VM.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15061 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2013-02-05 15:43:57 +00:00
parent 6f8f0eac9e
commit 23b37343b2
32 changed files with 9059 additions and 6725 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,19 +14,20 @@ EEE;
?>
<script type="text/javascript">
window.onload=function() {
var nodepath = $('#nodepath').val();
window.onload=function() {
includeJs("js/jquery/jquery.jqplot.min.js");
includeJs("js/jquery/jqplot.dateAxisRenderer.min.js");
includeJs("js/jquery/jqplot.dateAxisRenderer.min.js");
includeJs("js/monitor/gangliamon.js");
var nodePath = $('#nodepath').val();
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'gangliashow;' + nodepath + ';hour;_summary_',
args : 'gangliashow;' + nodePath + ';hour;_summary_',
msg : ''
},
@ -38,31 +39,31 @@ window.onload=function() {
};
function drawNodesummary(summaryString){
var nodename = $('#nodename').val();
var nodeName = $('#nodename').val();
var nodeData = new Object();
var metricArray = summaryString.split(';');
var metricname = '';
var metricName = '';
var valueArray = '';
var position = 0;
var tempLength = 0;
for (var index = 0; index < metricArray.length; index++){
position = metricArray[index].indexOf(':');
metricname = metricArray[index].substr(0, position);
nodeData[metricname] = new Array();
metricName = metricArray[index].substr(0, position);
nodeData[metricName] = new Array();
valueArray = metricArray[index].substr(position + 1).split(',');
tempLength = valueArray.length;
for (var i = 0; i < tempLength; i++){
nodeData[metricname].push(Number(valueArray[i]));
nodeData[metricName].push(Number(valueArray[i]));
}
}
drawLoadFlot('ganglianodeload', nodename, nodeData['load_one'], nodeData['cpu_num']);
drawCpuFlot('ganglianodecpu', nodename, nodeData['cpu_idle']);
drawMemFlot('ganglianodemem', nodename, nodeData['mem_free'], nodeData['mem_total']);
drawDiskFlot('ganglianodedisk', nodename, nodeData['disk_free'], nodeData['disk_total']);
drawNetworkFlot('ganglianodenetwork', nodename, nodeData['bytes_in'], nodeData['bytes_out']);
drawLoadFlot('ganglianodeload', nodeName, nodeData['load_one'], nodeData['cpu_num']);
drawCpuFlot('ganglianodecpu', nodeName, nodeData['cpu_idle']);
drawMemFlot('ganglianodemem', nodeName, nodeData['mem_free'], nodeData['mem_total']);
drawDiskFlot('ganglianodedisk', nodeName, nodeData['disk_free'], nodeData['disk_total']);
drawNetworkFlot('ganglianodenetwork', nodeName, nodeData['bytes_in'], nodeData['bytes_out']);
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -324,10 +324,10 @@ function initSelectPlatform() {
selectPlatform.append(info);
var hwList = $('<ol>Platforms available:</ol>');
hwList.append('<li><input type="radio" name="platform" disabled="true" id="idataplex"><label>iDataPlex</label></input></li>');
hwList.append('<li><input type="radio" name="platform" disabled="true" id="blade"><span style="color:gray;"> BladeCenter</span></input></li>');
hwList.append('<li><input type="radio" name="platform" id="ih"> System p hardware (P7 IH)</input></li>');
hwList.append('<li><input type="radio" name="platform" id="nonih"> System p hardware (Non P7 IH)</input></li>');
hwList.append('<li><input type="radio" name="platform" id="idataplex" disabled>iDataPlex</input></li>');
hwList.append('<li><input type="radio" name="platform" id="blade" disabled>BladeCenter</input></li>');
hwList.append('<li><input type="radio" name="platform" id="ih">System p hardware (P7 IH)</input></li>');
hwList.append('<li><input type="radio" name="platform" id="nonih">System p hardware (Non P7 IH)</input></li>');
hwList.find('li').css('padding', '2px 10px');
selectPlatform.append(hwList);

View File

@ -19,9 +19,9 @@ function loadServicePage(tabId) {
// Create radio buttons for platforms
var hwList = $('<ol>Platforms available:</ol>');
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
var esx = $('<li><input type="radio" name="hw" value="esx" disabled/>ESX</li>');
var kvm = $('<li><input type="radio" name="hw" value="kvm" disabled/>KVM</li>');
var zvm = $('<li><input type="radio" name="hw" value="zvm" checked/>z\/VM</li>');
hwList.append(esx);
hwList.append(kvm);
@ -90,433 +90,6 @@ function loadServicePage(tabId) {
servicePg.append(okBtn);
}
/**
* Load the user panel where users can be created, modified, or deleted
*
* @param panelId Panel ID
*/
function loadUserPanel(panelId) {
// Get users list
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'tabdump',
tgt : '',
args : 'passwd',
msg : panelId
},
success : loadUserTable
});
}
/**
* Load user datatable
*
* @param data HTTP request data
*/
function loadUserTable(data) {
// Get response
var rsp = data.rsp;
// Get panel ID
var panelId = data.msg;
// Wipe panel clean
$('#' + panelId).empty();
// Add info bar
$('#' + panelId).append(createInfoBar('Create, edit, and delete users for the self-service portal. Double-click on a cell to edit a users properties. Click outside the table to save changes. Hit the Escape key to ignore changes.'));
// Get table headers
// The table headers in the passwd table are: key, username, password, cryptmethod, comments, and disable
var headers = new Array('priority', 'username', 'password', 'max-vm');
// Create a new datatable
var tableId = panelId + 'Datatable';
var table = new DataTable(tableId);
// Add column for the checkbox
headers.unshift('<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">');
table.init(headers);
headers.shift();
// Append datatable to panel
$('#' + panelId).append(table.object());
// Add table rows
// Start with the 2nd row (1st row is the headers)
for ( var i = 1; i < rsp.length; i++) {
// Split into columns
var tmp = rsp[i].split(',');
// Go through each column
for (var j = 0; j < tmp.length; j++) {
// Replace quote
tmp[j] = tmp[j].replace(new RegExp('"', 'g'), '');
}
// Only add users having the key = xcat
if (tmp[0] == 'xcat') {
// Columns are: priority, username, password, and max-vm
var cols = new Array('', tmp[1], tmp[2], '');
// Add remove button where id = user name
cols.unshift('<input type="checkbox" name="' + tmp[1] + '"/>');
// Add row
table.add(cols);
}
}
// Turn table into datatable
$('#' + tableId).dataTable({
'iDisplayLength': 50,
'bLengthChange': false,
"sScrollX": "100%",
"bAutoWidth": true
});
// Create action bar
var actionBar = $('<div class="actionBar"></div>').css("width", "400px");
var createLnk = $('<a>Create</a>');
createLnk.click(function() {
openCreateUserDialog();
});
var deleteLnk = $('<a>Delete</a>');
deleteLnk.click(function() {
var users = getNodesChecked(tableId);
if (users) {
openDeleteUserDialog(users);
}
});
var refreshLnk = $('<a>Refresh</a>');
refreshLnk.click(function() {
loadUserPanel(panelId);
});
// Create an action menu
var actionsMenu = createMenu([createLnk, deleteLnk, refreshLnk]);
actionsMenu.superfish();
actionsMenu.css('display', 'inline-block');
actionBar.append(actionsMenu);
// Set correct theme for action menu
actionsMenu.find('li').hover(function() {
setMenu2Theme($(this));
}, function() {
setMenu2Normal($(this));
});
// Create a division to hold actions menu
var menuDiv = $('<div id="' + tableId + '_menuDiv" class="menuDiv"></div>');
$('#' + tableId + '_wrapper').prepend(menuDiv);
menuDiv.append(actionBar);
$('#' + tableId + '_filter').appendTo(menuDiv);
// Get policy data
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'tabdump',
tgt : '',
args : 'policy',
msg : tableId
},
success : loadUserTable4Policy
});
/**
* Enable editable cells
*/
// Do not make 1st or 2nd column editable
$('#' + tableId + ' td:not(td:nth-child(1),td:nth-child(2))').editable(
function(value, settings) {
// If users did not make changes, return the value directly
// jeditable saves the old value in this.revert
if ($(this).attr('revert') == value){
return value;
}
var panelId = $(this).parents('.ui-accordion-content').attr('id');
// Get column index
var colPos = this.cellIndex;
// Get row index
var dTable = $('#' + tableId).dataTable();
var rowPos = dTable.fnGetPosition(this.parentNode);
// Update datatable
dTable.fnUpdate(value, rowPos, colPos, false);
// Get table headers
var headers = $('#' + nodesTableId).parents('.dataTables_scroll').find('.dataTables_scrollHead thead tr:eq(0) th');
// Get user attributes
var priority = $(this).parent().find('td:eq(1)').text();
var user = $(this).parent().find('td:eq(2)').text();
var password = $(this).parent().find('td:eq(3)').text();
var maxVM = $(this).parent().find('td:eq(4)').text();
// Send command to change user attributes
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'updateuser;' + priority + ';' + user + ';' + password + ';' + maxVM,
msg : panelId
},
success : updatePanel
});
return value;
}, {
onblur : 'submit', // Clicking outside editable area submits changes
type : 'textarea',
placeholder: ' ',
event : "dblclick", // Double click and edit
height : '30px' // The height of the text area
});
// Resize accordion
$('#' + tableId).parents('.ui-accordion').accordion('resize');
}
/**
* Update user datatable for policy
*
* @param data HTTP request data
*/
function loadUserTable4Policy(data) {
// Get response
var rsp = data.rsp;
// Get datatable ID
var tableId = data.msg;
// Get datatable
var datatable = $('#' + tableId).dataTable();
// Update max-vm column
// The data coming back contains: priority, name, host, commands, noderange, parameters, time, rule, comments, disable
// Start with the 2nd row (1st row is the headers)
topPriority = 0;
for (var i = 1; i < rsp.length; i++) {
// Split into columns
var tmp = rsp[i].split(',');
// Go through each column
for (var j = 0; j < tmp.length; j++) {
// Replace quote
tmp[j] = tmp[j].replace(new RegExp('"', 'g'), '');
}
// Get the row containing the user name
var rowPos = -1;
if (tmp[1])
rowPos = findRow(tmp[1], '#' + tableId, 2);
// Update the priority and max-vm columns
if (rowPos > -1) {
var maxVM = 0;
var comments = tmp[8].split(';');
for (var k in comments) {
if (comments[k].indexOf('max-vm:') > -1)
maxVM = comments[k].replace('max-vm:', '');
}
datatable.fnUpdate(maxVM, rowPos, 4, false);
var priority = tmp[0];
datatable.fnUpdate(priority, rowPos, 1, false);
// Set the highest priority
if (priority > topPriority)
topPriority = priority;
}
}
// Adjust column sizes
adjustColumnSize(tableId);
// Resize accordion
$('#' + tableId).parents('.ui-accordion').accordion('resize');
}
/**
* Open a dialog to create a user
*/
function openCreateUserDialog() {
var dialogId = 'createUser';
var dialog = $('<div id="' + dialogId + '" class="form"></div>');
var info = createInfoBar('Create an xCAT user. A priority will be generated for the new user.');
dialog.append(info);
// Generate the user priority
var userPriority = parseFloat(topPriority) + 0.01;
userPriority = userPriority.toPrecision(3);
// Create node inputs
dialog.append($('<div><label>Priority:</label><input name="priority" type="text" disabled="disabled" value="' + userPriority + '"></div>'));
dialog.append($('<div><label>User name:</label><input name="username" type="text"></div>'));
dialog.append($('<div><label>Password:</label><input name="password" type="password"></div>'));
dialog.append($('<div><label>Maximum virtual machines:</label><input name="maxvm" type="text"></div>'));
dialog.dialog({
title: 'Create user',
modal: true,
width: 400,
close: function(){
$(this).remove();
},
buttons: {
"OK" : function(){
// Remove any warning messages
$(this).find('.ui-state-error').remove();
// Change dialog buttons
$('#' + dialogId).dialog('option', 'buttons', {
'Close':function(){
$(this).dialog('close');
}
});
var priority = $(this).find('input[name="priority"]').val();
var user = $(this).find('input[name="username"]').val();
var password = $(this).find('input[name="password"]').val();
var maxVM = $(this).find('input[name="maxvm"]').val();
// Verify inputs are provided
if (!user || !password || !maxVM) {
var warn = createWarnBar('Please provide a value for each missing field!');
warn.prependTo($(this));
} else {
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'updateuser;' + priority + ';' + user + ';' + password + ';' + maxVM,
msg : dialogId
},
success : updatePanel
});
// Update highest priority
topPriority = priority;
}
},
"Cancel": function(){
$(this).dialog('close');
}
}
});
}
/**
* Update dialog
*
* @param data HTTP request data
*/
function updatePanel(data) {
var dialogId = data.msg;
var infoMsg;
// Create info message
if (jQuery.isArray(data.rsp)) {
infoMsg = '';
for (var i in data.rsp) {
infoMsg += data.rsp[i] + '</br>';
}
} else {
infoMsg = data.rsp;
}
// Create info bar with close button
var infoBar = $('<div class="ui-state-highlight ui-corner-all"></div>').css('margin', '5px 0px');
var icon = $('<span class="ui-icon ui-icon-info"></span>').css({
'display': 'inline-block',
'margin': '10px 5px'
});
// Create close button to close info bar
var close = $('<span class="ui-icon ui-icon-close"></span>').css({
'display': 'inline-block',
'float': 'right'
}).click(function() {
$(this).parent().remove();
});
var msg = $('<pre>' + infoMsg + '</pre>').css({
'display': 'inline-block',
'width': '85%'
});
infoBar.append(icon, msg, close);
infoBar.prependTo($('#' + dialogId));
}
/**
* Open dialog to confirm user delete
*
* @param users Users to delete
*/
function openDeleteUserDialog(users) {
// Create form to delete disk to pool
var dialogId = 'deleteUser';
var deleteForm = $('<div id="' + dialogId + '" class="form"></div>');
// Create info bar
var info = createInfoBar('Are you sure you want to delete ' + users.replace(new RegExp(',', 'g'), ', ') + '?');
deleteForm.append(info);
// Open dialog to delete user
deleteForm.dialog({
title:'Delete user',
modal: true,
width: 400,
close: function(){
$(this).remove();
},
buttons: {
"Ok": function(){
// Remove any warning messages
$(this).find('.ui-state-error').remove();
// Change dialog buttons
$(this).dialog('option', 'buttons', {
'Close': function() {$(this).dialog("close");}
});
// Delete user
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'deleteuser;' + users,
msg : dialogId
},
success : updatePanel
});
},
"Cancel": function() {
$(this).dialog( "close" );
}
}
});
}
/**
* Round a floating point to a given precision
*
@ -680,10 +253,18 @@ function configImagePanel(data) {
// Turn into datatable
$('#' + tableId).dataTable({
'iDisplayLength': 50,
'iDisplayLength': 50,
'bLengthChange': false,
"sScrollX": "100%",
"bAutoWidth": true
"bScrollCollapse": true,
"sScrollY": "400px",
"sScrollX": "110%",
"bAutoWidth": true,
"oLanguage": {
"oPaginate": {
"sNext": "",
"sPrevious": ""
}
}
});
// Create action bar
@ -1186,10 +767,18 @@ function configGroupPanel(data) {
// Turn into datatable
$('#' + tableId).dataTable({
'iDisplayLength': 50,
'iDisplayLength': 50,
'bLengthChange': false,
"sScrollX": "100%",
"bAutoWidth": true
"bScrollCollapse": true,
"sScrollY": "400px",
"sScrollX": "110%",
"bAutoWidth": true,
"oLanguage": {
"oPaginate": {
"sNext": "",
"sPrevious": ""
}
}
});
// Create action bar

View File

@ -8,7 +8,6 @@ function loadUpdatePage() {
statusDiv.hide();
$('#updateTab').append(statusDiv);
$('#updateTab').append('<br/>');
$('#updateTab').append(repositoryDiv);
$('#updateTab').append(rpmDiv);

View File

@ -0,0 +1,469 @@
/**
* Global variables
*/
var userDatatable;
var topPriority = 0;
var tableId = 'usersTable';
/**
* Get user access table
*
* @returns User access table
*/
function getUsersTable(){
return userDatatable;
}
/**
* Set user access table
*
* @param table User access table
*/
function setUsersTable(table){
userDatatable = table;
}
/**
* Load the user page
*/
function loadUserPage() {
// Retrieve users from policy table
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'tabdump',
tgt : '',
args : 'policy',
msg : ''
},
success : loadUserTable
});
}
/**
* Load user table
*
* @param data Data returned from HTTP request
*/
function loadUserTable(data){
var tabId = 'usersTab';
$('#' + tabId).empty();
// Set padding for page
$('#' + tabId).css('padding', '20px 60px');
// Create info bar
var info = $('#' + tabId).find('.ui-state-highlight');
// If there is no info bar
if (!info.length) {
var infoBar = createInfoBar('Configure access given to users.');
// Create users page
var userPg = $('<div class="form"></div>');
$('#' + tabId).append(infoBar, userPg);
}
if (data.rsp) {
// Create a datatable if one does not exist
var table = new DataTable(tableId);
var headers = new Array('Priority', 'Name', 'Host', 'Commands', 'Noderange', 'Parameters', 'Time', 'Rule', 'Comments', 'Disable');
// Add column for the checkbox
headers.unshift('<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">');
table.init(headers);
headers.shift();
// Append datatable to panel
$('#' + tabId).append(table.object());
topPriority = 0;
// Add table rows
// Start with the 2nd row (1st row is the headers)
for (var i = 1; i < data.rsp.length; i++) {
// Trim returned data
data.rsp[i] = jQuery.trim(data.rsp[i]);
// Split data into columns
var cols = data.rsp[i].split(',');
// Go through each column
// Column names are: priority, name, host, commands, noderange, parameters, time, rule, comments, disable
for (var j = 0; j < cols.length; j++) {
// Replace quote
cols[j] = cols[j].replace(/"/g, '');
}
// Set the highest priority
priority = cols[0];
if (priority > topPriority)
topPriority = priority;
// Add check box where name = user name
cols.unshift('<input type="checkbox" name="' + cols[0] + '"/>');
// Add row
table.add(cols);
}
// Turn table into datatable
var dTable = $('#' + tableId).dataTable({
'iDisplayLength': 50,
'bLengthChange': false,
"bScrollCollapse": true,
"sScrollY": "400px",
"sScrollX": "100%",
"bAutoWidth": true,
"oLanguage": {
"oPaginate": {
"sNext": "",
"sPrevious": ""
}
}
});
setUsersTable(dTable); // Cache user access table
}
// Create action bar
var actionBar = $('<div class="actionBar"></div>').css("width", "450px");
var createLnk = $('<a>Create</a>');
createLnk.click(function() {
openCreateUserDialog("");
});
var editLnk = $('<a>Edit</a>');
editLnk.click(function() {
// Should only allow 1 user to be edited at a time
var users = getNodesChecked(tableId).split(',')
for (var i in users) {
openCreateUserDialog(users[i]);
}
});
var deleteLnk = $('<a>Delete</a>');
deleteLnk.click(function() {
// Find the user name from datatable
var usersList = "";
var users = $('#' + tableId + ' input[type=checkbox]:checked');
for (var i in users) {
var user = users.eq(i).parents('tr').find('td:eq(2)').text();
if (user && user != "undefined") {
usersList += user;
if (i < users.length - 1) {
usersList += ',';
}
}
}
if (usersList) {
openDeleteUserDialog(usersList);
}
});
var refreshLnk = $('<a>Refresh</a>');
refreshLnk.click(function() {
loadUserPage();
});
// Create an action menu
var actionsMenu = createMenu([createLnk, editLnk, deleteLnk, refreshLnk]);
actionsMenu.superfish();
actionsMenu.css('display', 'inline-block');
actionBar.append(actionsMenu);
// Set correct theme for action menu
actionsMenu.find('li').hover(function() {
setMenu2Theme($(this));
}, function() {
setMenu2Normal($(this));
});
// Create a division to hold actions menu
var menuDiv = $('<div id="' + tableId + '_menuDiv" class="menuDiv"></div>');
$('#' + tableId + '_wrapper').prepend(menuDiv);
menuDiv.append(actionBar);
$('#' + tableId + '_filter').appendTo(menuDiv);
}
/**
* Open create user dialog
*
* @param data User data (only during edit)
*/
function openCreateUserDialog(data) {
var dialogId = 'createUser';
// Generate the user priority
var priority = parseFloat(topPriority) + 0.01;
priority = priority.toPrecision(3);
// Create form to create user
var createUserForm = $('<div id="' + dialogId + '" class="form"></div>');
// Create info bar
var info = createInfoBar('Create a user and configure access to xCAT.');
var userFS = $('<fieldset></fieldset>');
var userLegend = $('<legend>User</legend>');
userFS.append(userLegend);
var userAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
userFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/nodes/users.png"></img></div>'));
userFS.append(userAttr);
var optionFS = $('<fieldset></fieldset>');
var optionLegend = $('<legend>Options</legend>');
optionFS.append(optionLegend);
var optionAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
optionFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
optionFS.append(optionAttr);
createUserForm.append(info, userFS, optionFS);
userAttr.append($('<div><label>Priority:</label><input type="text" name="priority" disabled="disabled" value="' + priority + '"/></div>'));
userAttr.append($('<div><label>User name:</label><input type="text" name="name"/></div>'));
userAttr.append($('<div><label>Password:</label><input name="password" type="password"></div>'));
userAttr.append($('<div><label>Confirm password:</label><input name="confirm_password" type="password"></div>'));
optionAttr.append($('<div><label>Host:</label><input type="text" name="host"/></div>'));
optionAttr.append($('<div><label>Commands:</label><input type="text" name="commands"/></div>'));
optionAttr.append($('<div><label>Parameters:</label><input type="text" name="parameters"/></div>'));
optionAttr.append($('<div><label>Node Range:</label><input type="text" name="nodeRange"/></div>'));
optionAttr.append($('<div><label>Rule:</label><select name="rule">' +
'<option value="allow">Allow</option>' +
'<option value="accept">Accept</option>' +
'<option value="trusted">Trusted</option>' +
'<option value="deny">Deny</option>' +
'</select></div>'));
var rootPrivilege = $('<div><label>Root privilege:</label></div>');
var accessCheckbox = $('<input type="checkbox" name="rootprivilege"/>');
optionAttr.append(rootPrivilege);
rootPrivilege.append(accessCheckbox);
optionAttr.append($('<div><label>Comments:</label><input type="text" name="comments" style="width: 250px;"/></div>'));
optionAttr.append($('<div><label>Disable:</label><select name="disable">' +
'<option value="">No</option>' +
'<option value="yes">Yes</option>' +
'</select></div>'));
// Open dialog to add disk
createUserForm.dialog({
title:'Configure user',
modal: true,
close: function(){
$(this).remove();
},
width: 600,
buttons: {
"Ok": function(){
// Remove any warning messages
$(this).find('.ui-state-error').remove();
// Get inputs
var priority = $(this).find('input[name=priority]').val();
var usrName = $(this).find('input[name=name]').val();
var password = $(this).find('input[name=password]').val();
var confirmPassword = $(this).find('input[name=confirm_password]').val();
var host = $(this).find('input[name=host]').val();
var commands = $(this).find('input[name=commands]').val();
var parameters = $(this).find('input[name=parameters]').val();
var nodeRange = $(this).find('input[name=nodeRange]').val();
var rule = $(this).find('select[name=rule]').val();
var comments = $(this).find('input[name=comments]').val();
var disable = $(this).find('select[name=disable]').val();
// Verify user name and passwords are supplied
if (!usrName) {
var warn = createWarnBar('Please provide a user name');
warn.prependTo($(this));
return;
}
// Verify passwords match
if (password != confirmPassword) {
var warn = createWarnBar('Passwords do not match');
warn.prependTo($(this));
return;
}
var args = "";
if (usrName) {
args += ' policy.name=' + usrName;
} if (host) {
args += " policy.host='" + host + "'";
} if (commands) {
args += " policy.commands='" + commands + "'";
} if (parameters) {
args += " policy.parameters='" + parameters + "'";
} if (nodeRange) {
args += " policy.noderange='" + nodeRange + "'";
} if (rule) {
args += ' policy.rule=' + rule;
} if (disable) {
args += ' policy.disable=' + disable;
} if (comments) {
args += " policy.comments='" + comments + "'";
}
// Trim any extra spaces
args = jQuery.trim(args);
// Change dialog buttons
$(this).dialog('option', 'buttons', {
'Close': function() {$(this).dialog("close");}
});
// Submit request to update policy and passwd tables
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'policy|' + priority + '|' + args,
msg : dialogId
},
success : updatePanel
});
if (password) {
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'passwd|' + usrName + '|' + password,
msg : dialogId
},
success : updatePanel
});
}
// Update highest priority
topPriority = priority;
},
"Cancel": function() {
$(this).dialog( "close" );
}
}
});
// Change comments if access checkbox is checked
accessCheckbox.click( function(){
var comments = createUserForm.find('input[name=comments]').val();
var tag = "privilege:root";
comments = jQuery.trim(comments);
// Append tag to comments
if (accessCheckbox.is(':checked')) {
if (comments && comments.charAt(comments.length - 1) != ";") {
comments += ";";
}
comments += tag;
createUserForm.find('input[name=comments]').val(comments);
} else {
comments = comments.replace(tag, "");
comments = comments.replace(";;", ";");
createUserForm.find('input[name=comments]').val(comments);
}
// Strip off leading semi-colon
if (comments.charAt(0) == ";") {
comments = comments.substr(1, comments.length);
createUserForm.find('input[name=comments]').val(comments);
}
});
// Set the user data (on edit)
if (data) {
var checkBox = $('#' + tableId + ' input[name="' + data + '"]');
var priority = data;
var name = checkBox.parents('tr').find('td:eq(2)').text();
var host = checkBox.parents('tr').find('td:eq(3)').text();
var commands = checkBox.parents('tr').find('td:eq(4)').text();
var noderange = checkBox.parents('tr').find('td:eq(5)').text();
var parameters = checkBox.parents('tr').find('td:eq(6)').text();
var time = checkBox.parents('tr').find('td:eq(7)').text();
var rule = checkBox.parents('tr').find('td:eq(8)').text();
var comments = checkBox.parents('tr').find('td:eq(9)').text();
var disable = checkBox.parents('tr').find('td:eq(10)').text();
createUserForm.find('input[name=priority]').val(priority);
createUserForm.find('input[name=name]').val(name);
// Do not show password (security)
createUserForm.find('input[name=password]').val();
createUserForm.find('input[name=confirm_password]').val();
createUserForm.find('input[name=host]').val(host);
createUserForm.find('input[name=commands]').val(commands);
createUserForm.find('input[name=parameters]').val(parameters);
createUserForm.find('input[name=nodeRange]').val(noderange);
createUserForm.find('select[name=rule]').val(rule);
createUserForm.find('input[name=comments]').val(comments);
createUserForm.find('select[name=disable]').val(disable);
if (comments.indexOf("privilege:root") > -1) {
accessCheckbox.attr("checked", true);
}
}
}
/**
* Open dialog to confirm user delete
*
* @param users Users to delete
*/
function openDeleteUserDialog(users) {
// Create form to delete disk to pool
var dialogId = 'deleteUser';
var deleteForm = $('<div id="' + dialogId + '" class="form"></div>');
// Create info bar
var info = createInfoBar('Are you sure you want to delete ' + users.replace(new RegExp(',', 'g'), ', ') + '?');
deleteForm.append(info);
// Open dialog to delete user
deleteForm.dialog({
title:'Delete user',
modal: true,
width: 400,
close: function(){
$(this).remove();
},
buttons: {
"Ok": function(){
// Remove any warning messages
$(this).find('.ui-state-error').remove();
// Change dialog buttons
$(this).dialog('option', 'buttons', {
'Close': function() {$(this).dialog("close");}
});
// Delete user
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'deleteuser|' + users,
msg : dialogId
},
success : updatePanel
});
},
"Cancel": function() {
$(this).dialog( "close" );
}
}
});
}

View File

@ -584,7 +584,7 @@ function createBladeProvisionExisting(inst) {
// Create group input
var group = $('<div></div>');
var groupLabel = $('<label for="provType">Group:</label>');
var groupLabel = $('<label>Group:</label>');
group.append(groupLabel);
// Turn on auto complete for group
@ -622,7 +622,7 @@ function createBladeProvisionExisting(inst) {
// Create node input
var node = $('<div></div>');
var nodeLabel = $('<label for="nodeName">Nodes:</label>');
var nodeLabel = $('<label>Nodes:</label>');
var nodeDatatable = $('<div id="' + dTableDivId + '" style="display: inline-block; max-width: 800px;"><p>Select a group to view its nodes</p></div>');
node.append(nodeLabel);
node.append(nodeDatatable);
@ -630,7 +630,7 @@ function createBladeProvisionExisting(inst) {
// Create boot method drop down
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>'
@ -645,7 +645,7 @@ function createBladeProvisionExisting(inst) {
// 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');
@ -662,7 +662,7 @@ function createBladeProvisionExisting(inst) {
// 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');
@ -679,7 +679,7 @@ function createBladeProvisionExisting(inst) {
// 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');

View File

@ -67,7 +67,10 @@ function createNodesDatatable(group, outId) {
// Sort headers
var sorted = new Array();
for ( var key in headers) {
sorted.push(key);
// Do not put in status or comments
if (key.indexOf("status") < 0 && key.indexOf("usercomment") < 0) {
sorted.push(key);
}
}
sorted.sort();
@ -103,7 +106,23 @@ function createNodesDatatable(group, outId) {
}
$('#' + outId).append(dTable.object());
$('#' + dTableId).dataTable();
$('#' + dTableId).dataTable({
'iDisplayLength': 50,
'bLengthChange': false,
"bScrollCollapse": true,
"sScrollY": "400px",
"sScrollX": "110%",
"bAutoWidth": true,
"oLanguage": {
"oPaginate": {
"sNext": "",
"sPrevious": ""
}
}
});
// Fix table styling
$('#' + dTableId + '_wrapper .dataTables_filter label').css('width', '250px');
} // End of function(data)
});
}
@ -121,7 +140,7 @@ function createProvisionExisting(plugin, inst) {
// Create group input
var group = $('<div></div>');
var groupLabel = $('<label for="provType">Group:</label>');
var groupLabel = $('<label>Group:</label>');
group.append(groupLabel);
// Turn on auto complete for group
@ -159,7 +178,7 @@ function createProvisionExisting(plugin, inst) {
// Create node input
var node = $('<div></div>');
var nodeLabel = $('<label for="nodeName">Nodes:</label>');
var nodeLabel = $('<label>Nodes:</label>');
var nodeDatatable = $('<div class="indent" id="' + dTableDivId + '"><p>Select a group to view its nodes</p></div>');
node.append(nodeLabel);
node.append(nodeDatatable);
@ -167,7 +186,7 @@ function createProvisionExisting(plugin, inst) {
// Create boot method drop down
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="boot">boot</option>'
+ '<option value="install">install</option>'
@ -181,7 +200,7 @@ function createProvisionExisting(plugin, inst) {
// Create boot type drop down
var type = $('<div></div>');
var typeLabel = $('<label for="type">Boot type:</label>');
var typeLabel = $('<label>Boot type:</label>');
var typeSelect = $('<select id="bootType" name="bootType"></select>');
typeSelect.append('<option value="pxe">pxe</option>'
+ '<option value="iscsiboot">yaboot</option>'
@ -193,7 +212,7 @@ function createProvisionExisting(plugin, inst) {
// 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');
@ -210,7 +229,7 @@ function createProvisionExisting(plugin, inst) {
// 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');
@ -227,7 +246,7 @@ function createProvisionExisting(plugin, inst) {
// 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');
@ -266,12 +285,12 @@ function createProvisionNew(plugin, inst) {
var provNew = $('<div></div>');
// Create node input
var nodeName = $('<div><label for="nodeName">Node:</label><input type="text" name="nodeName"/></div>');
var nodeName = $('<div><label>Node:</label><input type="text" name="nodeName"/></div>');
provNew.append(nodeName);
// Create group input
var group = $('<div></div>');
var groupLabel = $('<label for="group">Group:</label>');
var groupLabel = $('<label>Group:</label>');
var groupInput = $('<input type="text" name="group"/>');
groupInput.one('focus', function() {
var groupNames = $.cookie('groups');
@ -288,7 +307,7 @@ function createProvisionNew(plugin, inst) {
// Create boot method drop down
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="boot">boot</option>'
+ '<option value="install">install</option>'
@ -302,7 +321,7 @@ function createProvisionNew(plugin, inst) {
// Create boot type drop down
var type = $('<div></div>');
var typeLabel = $('<label for="type">Boot type:</label>');
var typeLabel = $('<label>Boot type:</label>');
var typeSelect = $('<select id="bootType" name="bootType"></select>');
typeSelect.append('<option value="install">pxe</option>'
+ '<option value="iscsiboot">yaboot</option>'
@ -314,7 +333,7 @@ function createProvisionNew(plugin, inst) {
// 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');
@ -331,7 +350,7 @@ function createProvisionNew(plugin, inst) {
// 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');
@ -348,7 +367,7 @@ function createProvisionNew(plugin, inst) {
// 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');

View File

@ -19,18 +19,6 @@ var esxPlugin = function() {
*/
esxPlugin.prototype.loadConfigPage = function(tabId) {
var configAccordion = $('<div id="esxConfigAccordion"></div>');
// Create accordion panel for user
var userSection = $('<div id="esxConfigUser"></div>');
var userLnk = $('<h3><a href="#">Users</a></h3>').click(function () {
// Do not load panel again if it is already loaded
if ($('#esxConfigUser').find('.dataTables_wrapper').length)
return;
else
$('#esxConfigUser').append(createLoader(''));
loadUserPanel('esxConfigUser');
});
// Create accordion panel for profiles
var profileSection = $('<div id="esxConfigProfile"></div>');
@ -41,6 +29,14 @@ esxPlugin.prototype.loadConfigPage = function(tabId) {
else
$('#esxConfigProfile').append(createLoader(''));
// Wipe panel clean
$('#esxConfigProfile').empty();
// Add info bar
$('#esxConfigProfile').append(createInfoBar('Not yet supported'));
// Resize accordion
configAccordion.accordion('resize');
});
// Create accordion panel for images
@ -67,11 +63,11 @@ esxPlugin.prototype.loadConfigPage = function(tabId) {
queryGroups('esxConfigGroups');
});
configAccordion.append(userLnk, userSection, profileLnk, profileSection, imgLnk, imgSection, groupsLnk, groupsSection);
configAccordion.append(profileLnk, profileSection, imgLnk, imgSection, groupsLnk, groupsSection);
$('#' + tabId).append(configAccordion);
configAccordion.accordion();
userLnk.trigger('click');
profileLnk.trigger('click');
};
/**

View File

@ -329,7 +329,7 @@ function createIpmiProvisionExisting(inst) {
// Create group input
var group = $('<div></div>');
var groupLabel = $('<label for="provType">Group:</label>');
var groupLabel = $('<label>Group:</label>');
group.append(groupLabel);
// Turn on auto complete for group
@ -370,7 +370,7 @@ function createIpmiProvisionExisting(inst) {
// Create node input
var node = $('<div></div>');
var nodeLabel = $('<label for="nodeName">Nodes:</label>');
var nodeLabel = $('<label>Nodes:</label>');
var nodeDatatable = $('<div id="'
+ dTableDivId
+ '" style="display: inline-block; max-width: 800px;"><p>Select a group to view its nodes</p></div>');
@ -380,7 +380,7 @@ function createIpmiProvisionExisting(inst) {
// Create boot method drop down
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>'
@ -394,7 +394,7 @@ function createIpmiProvisionExisting(inst) {
// 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');
@ -411,7 +411,7 @@ function createIpmiProvisionExisting(inst) {
// 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');
@ -428,7 +428,7 @@ function createIpmiProvisionExisting(inst) {
// 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');

View File

@ -18,18 +18,6 @@ var kvmPlugin = function() {
kvmPlugin.prototype.loadConfigPage = function(tabId) {
var configAccordion = $('<div id="kvmConfigAccordion"></div>');
// Create accordion panel for user
var userSection = $('<div id="kvmConfigUser"></div>');
var userLnk = $('<h3><a href="#">Users</a></h3>').click(function () {
// Do not load panel again if it is already loaded
if ($('#kvmConfigUser').find('.dataTables_wrapper').length)
return;
else
$('#kvmConfigUser').append(createLoader(''));
loadUserPanel('kvmConfigUser');
});
// Create accordion panel for profiles
var profileSection = $('<div id="kvmConfigProfile"></div>');
var profileLnk = $('<h3><a href="#">Profiles</a></h3>').click(function () {
@ -39,6 +27,14 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) {
else
$('#kvmConfigProfile').append(createLoader(''));
// Wipe panel clean
$('#kvmConfigProfile').empty();
// Add info bar
$('#kvmConfigProfile').append(createInfoBar('Not yet supported'));
// Resize accordion
configAccordion.accordion('resize');
});
// Create accordion panel for images
@ -65,11 +61,11 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) {
queryGroups('kvmConfigGroups');
});
configAccordion.append(userLnk, userSection, profileLnk, profileSection, imgLnk, imgSection, groupsLnk, groupsSection);
configAccordion.append(profileLnk, profileSection, imgLnk, imgSection, groupsLnk, groupsSection);
$('#' + tabId).append(configAccordion);
configAccordion.accordion();
userLnk.trigger('click');
profileLnk.trigger('click');
};
/**

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +1,33 @@
/**
* Load the help page
*/
function loadHelpPage(){
// Create help tab
var tab = new Tab();
tab.init();
$('#content').append(tab.object());
// Add help content
var helpForm = $('<div class="form"></div>');
helpForm.append(
'<fieldset>' +
'<legend>Quick Start</legend>' +
'<div style="display: inline-table; vertical-align: middle;"><img src="images/help/quick_start.png" style="width: 90%;"></img></div>' +
'<ol style="display: inline-table; vertical-align: middle;">' +
'<li><a href="configure.php" style="color: blue;">1. Discover hardware</a><br/>Discover all hardware in the cluster. Define them in the xCAT database. Initialize your cluster.</li>' +
'<li><a href="index.php" style="color: blue;">2. Verify defined nodes</a><br/>View nodes definition by groups in a table or graphical style.</li>' +
'<li><a href="configure.php" style="color: blue;">3. Install compute nodes</a><br/>Copy useful files from DVD onto harddisk. Create Linux images. Install compute nodes in stateful, stateless, and statelite style.</li>' +
'<li><a href="provision.php" style="color: blue;">4. Provision nodes</a><br/>Create stateful, stateless, or statelite virtual machines. Install an operating system on a physical machine.</li>' +
'<li><a href="monitor.php" style="color: blue;">5. Monitor Cluster</a><br/>Monitor your xCAT cluster using one or more third party monitoring software such as Ganglia, RMC, etc. </li>' +
'<li><a href="configure.php" style="color: blue;">1. Discover hardware</a><br/>Discover all hardware in the cluster. Define them in the xCAT database.</li>' +
'<li><a href="index.php" style="color: blue;">2. View defined nodes</a><br/>View node definitions by groups in a table or graphical view.</li>' +
'<li><a href="provision.php" style="color: blue;">3. Manage operating system images</a><br/>View operating system images defined in xCAT. Copy operating system ISOs into xCAT. Create stateful, stateless, or statelite images.</li>' +
'<li><a href="provision.php" style="color: blue;">4. Provision nodes</a><br/>Create stateful, stateless, or statelite virtual machines. Install an operating system onto bare metal machines.</li>' +
'<li><a href="provision.php" style="color: blue;">5. Manage and provision storage and networks</a><br/>Create network devices. Define storage for systems.</li>' +
'<li><a href="monitor.php" style="color: blue;">6. Monitor cluster</a><br/>Monitor the xCAT cluster using one or more third party software such as Ganglia, RMC, etc. </li>' +
'</ol>' +
'</fieldset>' +
'<fieldset>' +
'<legend>Advanced</legend>' +
'<div style="display: inline-table; vertical-align: middle;"><img src="images/help/advanced_settings.png" style="width: 90%;"></img></div>' +
'<ol style="display: inline-table; vertical-align: middle;">' +
'<li><a href="configure.php" style="color: blue;">a. Edit the xCAT database tables</a></li>' +
'<li><a href="configure.php" style="color: blue;">b. Update the xCAT RPM on the Management Node</a></li>' +
'<legend>Settings</legend>' +
'<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>' +
'<ol style="display: inline-table; vertical-align: middle;">' +
'<li><a href="configure.php" style="color: blue;">a. Manage and control user access</a></li>' +
'<li><a href="configure.php" style="color: blue;">b. Edit the xCAT database tables</a></li>' +
'<li><a href="configure.php" style="color: blue;">c. Update xCAT packages</a></li>' +
'</ol>' +
'</fieldset>');
tab.add('helpTab', 'Help', helpForm, false);

View File

@ -66,7 +66,6 @@ function loadMonitorPage() {
statusHash['rmcmon'] = 'Off';
statusHash['rmcevent'] = 'Off';
statusHash['gangliamon'] = 'Off';
statusHash['pcpmon'] = 'Off';
if (data.rsp[0]) {
var tempArray = data.rsp[0].split(';');
var position = 0;
@ -144,12 +143,6 @@ function loadMonitorPage() {
gangliaMon.append($('<td>A scalable distributed monitoring system for high-performance computing systems such as clusters and Grids.</td>'));
monTableBody.append(gangliaMon);
var pcpMon = $('<tr></tr>');
pcpMon.append($('<td><a href="#" name="pcpmon">PCP</a></td>'));
pcpMon.append($('<td></td>').append(statusButtonHash['pcpmon']));
pcpMon.append($('<td>Not yet supported</td>'));
monTableBody.append(pcpMon);
// Do not word wrap
monTableBody.find('td:nth-child(1)').css('white-space', 'nowrap');
monTableBody.find('td:nth-child(3)').css({
@ -166,85 +159,7 @@ function loadMonitorPage() {
loadMonitorTab($(this).attr('name'));
});
}
});
// Create resources tab
var resrcForm = $('<div class="form"></div>');
// Create info bar
var resrcInfoBar = createInfoBar('Select a platform to view its current resources.');
resrcForm.append(resrcInfoBar);
// Create radio buttons for platforms
var hwList = $('<ol>Platforms available:</ol>');
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
var ipmi = $('<li><input type="radio" name="hw" value="ipmi"/>iDataPlex</li>');
var blade = $('<li><input type="radio" name="hw" value="blade"/>BladeCenter</li>');
var hmc = $('<li><input type="radio" name="hw" value="hmc"/>System p</li>');
hwList.append(esx);
hwList.append(kvm);
hwList.append(zvm);
hwList.append(blade);
hwList.append(ipmi);
hwList.append(hmc);
resrcForm.append(hwList);
var okBtn = createButton('Ok');
okBtn.bind('click', function(event) {
// Get hardware that was selected
var hw = $(this).parent().find('input[name="hw"]:checked').val();
// Generate new tab ID
var newTabId = hw + 'ResourceTab';
if (!$('#' + newTabId).length) {
// Create loader
var loader = $('<center></center>').append(createLoader(hw + 'ResourceLoader'));
// Create an instance of the plugin
var plugin = null;
var displayName = "";
switch (hw) {
case "kvm":
plugin = new kvmPlugin();
displayName = "KVM";
break;
case "esx":
plugin = new esxPlugin();
displayName = "ESX";
break;
case "blade":
plugin = new bladePlugin();
displayName = "BladeCenter";
break;
case "hmc":
plugin = new hmcPlugin();
displayName = "System p";
break;
case "ipmi":
plugin = new ipmiPlugin();
displayName = "iDataPlex";
break;
case "zvm":
plugin = new zvmPlugin();
displayName = "z\/VM";
break;
}
// Add resource tab and load resources
tab.add(newTabId, displayName, loader, true);
plugin.loadResources();
}
// Select tab
tab.select(newTabId);
});
resrcForm.append(okBtn);
tab.add('resourceTab', 'Resources', resrcForm, false);
});
}
/**
@ -277,9 +192,6 @@ function loadMonitorTab(name) {
tab.add(name, 'RMC Event', '', true);
loadRmcEvent();
break;
case 'pcpmon':
loadUnfinish(name, tab);
break;
}
tab.select(name);

View File

@ -617,11 +617,19 @@ function showEventLog(data) {
}
eventDiv.append(eventTable.object());
$('#lsEventTable').dataTable({
'iDisplayLength' : 50,
'bLengthChange' : false,
"sScrollX" : "100%",
"bAutoWidth" : true
$('#lsEventTable').dataTable({
'iDisplayLength': 50,
'bLengthChange': false,
"bScrollCollapse": true,
"sScrollY": "400px",
"sScrollX": "110%",
"bAutoWidth": true,
"oLanguage": {
"oPaginate": {
"sNext": "",
"sPrevious": ""
}
}
});
// Add the configure button

View File

@ -28,6 +28,9 @@ function loadXcatMon() {
function loadXcatMonSetting(data) {
var apps = ""; // Contains the xcatmon config
var rsp = data.rsp;
if (!rsp.length)
return;
var apps_flag = 0;
var ping; // xcatmon ping interval
var ping_flag = 0;
@ -196,10 +199,18 @@ function loadXcatMonSetting(data) {
// Save datatable
dTable = $('#' + xcatMonTableId).dataTable({
'iDisplayLength' : 50,
'bLengthChange' : false,
"sScrollX" : "100%",
"bAutoWidth" : true
'iDisplayLength': 50,
'bLengthChange': false,
"bScrollCollapse": true,
"sScrollY": "400px",
"sScrollX": "110%",
"bAutoWidth": true,
"oLanguage": {
"oPaginate": {
"sNext": "",
"sPrevious": ""
}
}
});
// Create action bar

View File

@ -349,7 +349,7 @@ function drawNodesArea(targetgroup, cmdargs, message){
*/
function mkAddNodeLink() {
// Create link to add nodes
var addNodeLink = $('<a title="Add a node or a node range to xCAT">+ Add Node</a>');
var addNodeLink = $('<a title="Add a node or a node range to xCAT">+ Add node</a>');
addNodeLink.click(function() {
// Create info bar
var info = createInfoBar('Select the hardware management for the new node range');
@ -357,8 +357,8 @@ function mkAddNodeLink() {
// Create form to add node
var addNodeForm = $('<div class="form"></div>');
addNodeForm.append(info);
addNodeForm.append('<div><label for="mgt">Hardware management:</label>'
+ '<select id="mgt" name="mgt">'
addNodeForm.append('<div><label>Hardware management:</label>'
+ '<select name="mgt">'
+ '<option value="esx">ESX</option>'
+ '<option value="kvm">KVM</option>'
+ '<option value="zvm">z\/VM</option>'
@ -736,6 +736,40 @@ function loadNodes(data) {
loadScriptPage(tgtNodes);
}
});
// Migrate VM
var migrateLnk = $('<a>Migrate</a>');
migrateLnk.click(function() {
var tgtNodes = getNodesChecked(nodesTableId).split(',');
for (var i in tgtNodes) {
var mgt = getNodeAttr(tgtNodes[i], 'mgt');
// Create an instance of the plugin
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.loadMigratePage(tgtNodes[i]);
}
});
// Update
var updateLnk = $('<a>Update</a>');
@ -801,17 +835,60 @@ function loadNodes(data) {
}
});
// Scan
var rscanLnk = $('<a>Scan</a>');
rscanLnk.bind('click', function(event){
var tgtNodes = getNodesChecked(nodesTableId);
if (tgtNodes) {
loadRscanPage(tgtNodes);
}
});
// Event log
var logLnk = $('<a>Event log</a>');
logLnk.click(function() {
var tgtNodes = getNodesChecked(nodesTableId).split(',');
for (var i in tgtNodes) {
var mgt = getNodeAttr(tgtNodes[i], 'mgt');
// Create an instance of the plugin
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.loadLogPage(tgtNodes[i]);
}
});
// Actions
var actionsLnk = '<a>Actions</a>';
var actsMenu = createMenu([cloneLnk, deleteLnk, monitorOnLnk, monitorOffLnk, powerOnLnk, powerOffLnk, scriptLnk]);
var actsMenu = createMenu([cloneLnk, deleteLnk, migrateLnk, monitorOnLnk, monitorOffLnk, powerOnLnk, powerOffLnk, scriptLnk]);
// Configurations
var configLnk = '<a>Configuration</a>';
var configMenu = createMenu([unlockLnk, updateLnk, editProps, installMonLnk]);
var configMenu = createMenu([editProps, logLnk, installMonLnk, rscanLnk, unlockLnk, updateLnk]);
// Provision
var provLnk = '<a>Provision</a>';
var provMenu = createMenu([boot2NetworkLnk, setBootStateLnk, rcons, provisionLnk]);
var provMenu = createMenu([boot2NetworkLnk, rcons, setBootStateLnk, provisionLnk]);
// Create an action menu
var actionsMenu = createMenu([ [ actionsLnk, actsMenu ], [ configLnk, configMenu ], [ provLnk, provMenu ] ]);
@ -833,10 +910,15 @@ function loadNodes(data) {
var nodesDatatable = $('#' + nodesTableId).dataTable({
'iDisplayLength': 50,
'bLengthChange': false,
"sScrollX": "100%",
"bScrollCollapse": true,
"sScrollY": "400px",
"sScrollX": "110%",
"bAutoWidth": true,
"fnInitComplete": function() {
adjustColumnSize(nodesTableId);
"oLanguage": {
"oPaginate": {
"sNext": "",
"sPrevious": ""
}
}
});
@ -933,7 +1015,7 @@ function loadNodes(data) {
*/
// Do not make 1st, 2nd, 3rd, 4th, 5th, or 6th column editable
$('#' + nodesTableId + ' td:not(td:nth-child(1),td:nth-child(2),td:nth-child(3),td:nth-child(4),td:nth-child(5),td:nth-child(6))').editable(
function(value, settings) {
function(value, settings) {
// If users did not make changes, return the value directly
// jeditable saves the old value in this.revert
if ($(this).attr('revert') == value){
@ -1438,7 +1520,7 @@ function loadPowerStatus(data) {
rowPos = findRow(node, '#' + nodesTableId, 1);
// Update the power status column
dTable.fnUpdate(status, rowPos, 3, false);
dTable.fnUpdate(status, rowPos, 3);
}
// Hide power loader
@ -1627,23 +1709,33 @@ function loadUnlockPage(tgtNodes) {
newTabId = 'unlockTab' + instance;
}
var unlockForm = $('<div class="form"></div>');
// Create status bar, hide on load
var statBarId = 'unlockStatusBar' + instance;
var statusBar = createStatusBar(statBarId).hide();
unlockForm.append(statusBar);
var statBar = createStatusBar(statBarId).hide();
// Create loader
var loader = createLoader('');
statusBar.find('div').append(loader);
statBar.find('div').append(loader);
// Create info bar
var infoBar = createInfoBar('Give the root password for this node range to setup its SSH keys.');
unlockForm.append(infoBar);
// Create unlock form
var unlockForm = $('<div class="form"></div>');
unlockForm.append(statBar, infoBar);
// Create VM fieldset
var vmFS = $('<fieldset></fieldset>');
var vmLegend = $('<legend>Virtual Machine</legend>');
vmFS.append(vmLegend);
unlockForm.append(vmFS);
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
vmFS.append(vmAttr);
unlockForm.append('<div><label>Target node range:</label><input type="text" id="node" name="node" readonly="readonly" value="' + tgtNodes + '" title="The node or node range to unlock"/></div>');
unlockForm.append('<div><label>Password:</label><input type="password" id="password" name="password" title="The root password to unlock this node"/></div>');
vmAttr.append('<div><label>Target node range:</label><input type="text" id="node" name="node" readonly="readonly" value="' + tgtNodes + '" title="The node or node range to unlock"/></div>');
vmAttr.append('<div><label>Password:</label><input type="password" id="password" name="password" title="The root password to unlock this node"/></div>');
// Generate tooltips
unlockForm.find('div input[title]').tooltip({
@ -1663,11 +1755,15 @@ function loadUnlockPage(tgtNodes) {
/**
* Ok
*/
var okBtn = createButton('Ok');
okBtn.click(function() {
// Remove any warning messages
$(this).parent().parent().find('.ui-state-error').remove();
var unlockBtn = createButton('Unlock');
unlockBtn.css({
'width': '80px',
'display': 'block'
});
unlockBtn.click(function() {
// Remove any warning messages
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
// If a password is given
var password = $('#' + newTabId + ' input[name=password]').css('border', 'solid #BDBDBD 1px');
if (password.val()) {
@ -1686,7 +1782,7 @@ function loadUnlockPage(tgtNodes) {
});
// Show status bar
statusBar.show();
statBar.show();
// Disable all inputs and Ok button
$('#' + newTabId + ' input').attr('disabled', 'disabled');
@ -1694,12 +1790,12 @@ function loadUnlockPage(tgtNodes) {
} else {
// Show warning message
var warn = createWarnBar('You are missing some values!');
warn.prependTo($(this).parent().parent());
warn.prependTo($(this).parents('.ui-tabs-panel'));
password.css('border', 'solid #FF0000 1px');
}
});
unlockForm.append(okBtn);
unlockForm.append(unlockBtn);
tab.add(newTabId, 'Unlock', unlockForm, true);
tab.select(newTabId);
}
@ -1722,37 +1818,51 @@ function loadScriptPage(tgtNodes) {
newTabId = 'scriptTab' + inst;
}
// Open new tab
// Create remote script form
var scriptForm = $('<div class="form"></div>');
// Create status bar
// Create status bar
var barId = 'scriptStatusBar' + inst;
var statBar = createStatusBar(barId);
statBar.hide();
scriptForm.append(statBar);
// Create loader
var loader = createLoader('scriptLoader' + inst);
statBar.find('div').append(loader);
// Create info bar
var infoBar = createInfoBar('Load a script to run against this node range.');
scriptForm.append(infoBar);
scriptForm.append(statBar, infoBar);
// Create VM fieldset
var vmFS = $('<fieldset></fieldset>');
var vmLegend = $('<legend>Virtual Machine</legend>');
vmFS.append(vmLegend);
scriptForm.append(vmFS);
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
vmFS.append(vmAttr);
// Create logs fieldset
var scriptFS = $('<fieldset></fieldset>');
var scriptLegend = $('<legend>Script</legend>');
scriptFS.append(scriptLegend);
scriptForm.append(scriptFS);
var scriptAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
scriptFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/nodes/script.png"></img></div>'));
scriptFS.append(scriptAttr);
// Target node or group
var tgt = $('<div><label for="target">Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to run a given script against"/></div>');
scriptForm.append(tgt);
var tgt = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to run a given script against"/></div>');
vmAttr.append(tgt);
// Upload file
var upload = $('<form action="lib/upload.php" method="post" enctype="multipart/form-data"></form>');
var label = $('<label for="file">Remote file:</label>');
var label = $('<label>Remote file:</label>');
var file = $('<input type="file" name="file" id="file"/>');
var subBtn = createButton('Load');
upload.append(label);
upload.append(file);
upload.append(subBtn);
scriptForm.append(upload);
upload.append(label, file, subBtn);
scriptAttr.append(upload);
// Generate tooltips
scriptForm.find('div input[title]').tooltip({
@ -1771,7 +1881,7 @@ function loadScriptPage(tgtNodes) {
// Script
var script = $('<div><label>Script:</label><textarea/>');
scriptForm.append(script);
scriptAttr.append(script);
// Ajax form options
var options = {
@ -1784,10 +1894,13 @@ function loadScriptPage(tgtNodes) {
* Run
*/
var runBtn = createButton('Run');
runBtn.click(function() {
// Remove any warning messages
$(this).parent().parent().find('.ui-state-error').remove();
runBtn.css({
'width': '80px'
});
runBtn.click(function() {
// Remove any warning messages
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
// Get script to run
var textarea = $('#' + newTabId + ' textarea').css('border', 'solid #BDBDBD 1px');
@ -1798,7 +1911,7 @@ function loadScriptPage(tgtNodes) {
} else {
// Show warning message
var warn = createWarnBar('You are missing some values');
warn.prependTo($(this).parent().parent());
warn.prependTo($(this).parents('.ui-tabs-panel'));
textarea.css('border', 'solid #FF0000 1px');
}
});
@ -1868,15 +1981,6 @@ function loadDeletePage(tgtNodes) {
newTabId = 'deleteTab' + inst;
}
// Create status bar, hide on load
var statBarId = 'deleteStatusBar' + inst;
var statBar = createStatusBar(statBarId).hide();
// Create loader
var loader = createLoader('');
statBar.find('div').append(loader);
statBar.hide();
// Create target nodes string
var tgtNodesStr = '';
var nodes = tgtNodes.split(',');
@ -1904,12 +2008,30 @@ function loadDeletePage(tgtNodes) {
// Create delete form
var deleteForm = $('<div class="form"></div>');
deleteForm.append(statBar);
// Create status bar, hide on load
var statBarId = 'deleteStatusBar' + inst;
var statBar = createStatusBar(statBarId).hide();
// Create loader
var loader = createLoader('');
statBar.find('div').append(loader);
statBar.hide();
deleteForm.append(statBar);
// Create confirm fieldset
var confirmFS = $('<fieldset></fieldset>');
var confirmLegend = $('<legend>Confirm</legend>');
confirmFS.append(confirmLegend);
deleteForm.append(confirmFS);
var confirmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
confirmFS.append($('<div style="display: inline-table; vertical-align: middle; margin-right: 10px;"><img src="images/nodes/remove.png"></img></div>'));
confirmFS.append(confirmAttr);
// Confirm delete
var instr = $('<p>Are you sure you want to delete ' + tgtNodesStr + '?</p>').css('word-wrap', 'break-word');
deleteForm.append(instr);
var instr = $('<p>Are you sure you want to delete <b>' + tgtNodesStr + '</b>?</p>').css('word-wrap', 'break-word');
confirmAttr.append(instr);
/**
* Delete
@ -1945,8 +2067,7 @@ function loadDeletePage(tgtNodes) {
myTab.remove($(this).parent().parent().attr('id'));
});
deleteForm.append(deleteBtn);
deleteForm.append(cancelBtn);
deleteForm.append(deleteBtn, cancelBtn);
myTab.add(newTabId, 'Delete', deleteForm, true);
myTab.select(newTabId);
@ -1998,6 +2119,8 @@ function updateStatusBar(data) {
dTable.fnDeleteRow(rowPos);
}
}
adjustColumnSize(nodesTableId);
} else if (cmd == 'xdsh') {
// Hide loader
$('#' + statBarId).find('img').hide();
@ -2025,7 +2148,7 @@ function updateStatusBar(data) {
$('#' + statBarId).find('img').hide();
// Write ajax response to status bar
var prg = writeRsp(rsp, '[A-Za-z0-9._-]+:');
var prg = writeRsp(rsp, '');
$('#' + statBarId).find('div').append(prg);
}
}
@ -2037,9 +2160,9 @@ function updateStatusBar(data) {
*/
function updatePowerStatus(data) {
// Hide power loader
var powerCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(3)');
var powerCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(3)');
powerCol.find('img').hide();
// Get datatable
var dTable = $('#' + nodesTableId).dataTable();
@ -2260,7 +2383,7 @@ function findRow(str, table, col){
for (var i in rows) {
// If the column contains the search string
if (rows[i][col].indexOf(str) > -1) {
return i;
return parseInt(i);
}
}
@ -3146,6 +3269,25 @@ function advancedLoad(group){
});
}
} // End of for
// Retrieve z/VM hypervisors and their zHCPs
if (!$.cookie('zvms')) {
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webportal',
tgt : '',
args : 'lszvm',
msg : ''
},
success : function(data) {
setzVMCookies(data);
loadWwpns();
}
});
}
}
/**

View File

@ -29,14 +29,13 @@ function loadNodesetPage(tgtNodes) {
inst = inst + 1;
tabId = 'nodesetTab' + inst;
}
// Open new tab & create nodeset form
// Create nodeset form
var nodesetForm = $('<div class="form"></div>');
// Create status bar
var statBarId = 'nodesetStatusBar' + inst;
var statBar = createStatusBar(statBarId).hide();
nodesetForm.append(statBar);
// Create loader
var loader = createLoader('nodesetLoader');
@ -44,15 +43,35 @@ function loadNodesetPage(tgtNodes) {
// Create info bar
var infoBar = createInfoBar('Set the boot state for a node range');
nodesetForm.append(infoBar);
nodesetForm.append(statBar, infoBar);
// Create VM fieldset
var vmFS = $('<fieldset></fieldset>');
var vmLegend = $('<legend>Virtual Machine</legend>');
vmFS.append(vmLegend);
nodesetForm.append(vmFS);
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
vmFS.append(vmAttr);
// Create options fieldset
var imageFS = $('<fieldset></fieldset>');
var imageLegend = $('<legend>Image</legend>');
imageFS.append(imageLegend);
nodesetForm.append(imageFS);
var imageAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
imageFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
imageFS.append(imageAttr);
// Create target node or group
var tgt = $('<div><label for="target">Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to set the boot state for"/></div>');
nodesetForm.append(tgt);
var tgt = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to set the boot state for"/></div>');
vmAttr.append(tgt);
// Create boot method drop down
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="boot">boot</option>'
+ '<option value="install">install</option>'
@ -62,11 +81,11 @@ function loadNodesetPage(tgtNodes) {
);
method.append(methodLabel);
method.append(methodSelect);
nodesetForm.append(method);
imageAttr.append(method);
// Create boot type drop down
var type = $('<div></div>');
var typeLabel = $('<label for="type">Boot type:</label>');
var typeLabel = $('<label>Boot type:</label>');
var typeSelect = $('<select id="bootType" name="bootType"></select>');
typeSelect.append('<option value="zvm">zvm</option>'
+ '<option value="install">pxe</option>'
@ -74,11 +93,11 @@ function loadNodesetPage(tgtNodes) {
);
type.append(typeLabel);
type.append(typeSelect);
nodesetForm.append(type);
imageAttr.append(type);
// 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" title="You must give the operating system of this node or node range, e.g. rhel5.5"/>');
osInput.one('focus', function(){
var tmp = $.cookie('osvers');
@ -91,11 +110,11 @@ function loadNodesetPage(tgtNodes) {
});
os.append(osLabel);
os.append(osInput);
nodesetForm.append(os);
imageAttr.append(os);
// 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" title="You must give the architecture of this node or node range, e.g. s390x"/>');
archInput.one('focus', function(){
var tmp = $.cookie('osarchs');
@ -108,11 +127,11 @@ function loadNodesetPage(tgtNodes) {
});
arch.append(archLabel);
arch.append(archInput);
nodesetForm.append(arch);
imageAttr.append(arch);
// Create profiles input
var profile = $('<div></div>');
var profileLabel = $('<label for="profile">Profile:</label>');
var profileLabel = $('<label>Profile:</label>');
var profileInput = $('<input type="text" name="profile" title="You must give the profile for this node or node range. The typical default profile is: compute."/>');
profileInput.one('focus', function(){
tmp = $.cookie('profiles');
@ -125,7 +144,7 @@ function loadNodesetPage(tgtNodes) {
});
profile.append(profileLabel);
profile.append(profileInput);
nodesetForm.append(profile);
imageAttr.append(profile);
// Generate tooltips
nodesetForm.find('div input[title]').tooltip({
@ -146,9 +165,13 @@ function loadNodesetPage(tgtNodes) {
* Ok
*/
var okBtn = createButton('Ok');
okBtn.css({
'width': '80px',
'display': 'block'
});
okBtn.bind('click', function(event) {
// Remove any warning messages
$(this).parent().parent().find('.ui-state-error').remove();
// Remove any warning messages
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
// Check state, OS, arch, and profile
var ready = true;
@ -203,8 +226,8 @@ function loadNodesetPage(tgtNodes) {
statBar.show();
} else {
// Show warning message
var warn = createWarnBar('You are missing some values');
warn.prependTo($(this).parent().parent());
var warn = createWarnBar('You are missing some values!');
warn.prependTo($(this).parents('.ui-tabs-panel'));
}
});
nodesetForm.append(okBtn);

View File

@ -26,14 +26,13 @@ function loadNetbootPage(tgtNodes) {
inst = inst + 1;
newTabId = 'netbootTab' + inst;
}
// Create netboot form
// Create netboot form
var netbootForm = $('<div class="form"></div>');
// Create status bar
var statBarId = 'netbootStatusBar' + inst;
var statusBar = createStatusBar(statBarId).hide();
netbootForm.append(statusBar);
// Create loader
var loader = createLoader('netbootLoader');
@ -41,28 +40,45 @@ function loadNetbootPage(tgtNodes) {
// Create info bar
var infoBar = createInfoBar('Cause the range of nodes to boot to network');
netbootForm.append(infoBar);
netbootForm.append(statusBar, infoBar);
// Create VM fieldset
var vmFS = $('<fieldset></fieldset>');
var vmLegend = $('<legend>Virtual Machine</legend>');
vmFS.append(vmLegend);
netbootForm.append(vmFS);
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
vmFS.append(vmAttr);
// Create options fieldset
var optionsFS = $('<fieldset></fieldset>');
var optionsLegend = $('<legend>Options</legend>');
optionsFS.append(optionsLegend);
netbootForm.append(optionsFS);
var optionsAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
optionsFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
optionsFS.append(optionsAttr);
// Create target node or group input
var target = $('<div><label for="target">Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to boot to network"/></div>');
netbootForm.append(target);
var target = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to boot to network"/></div>');
vmAttr.append(target);
// Create options
var optsDIV = $('<div></div>');
var optsLabel = $('<label>Options:</label>');
var optsList = $('<ul></ul>');
var opt = $('<li></li>');
optsList.append(opt);
optsDIV.append(optsLabel);
optsDIV.append(optsList);
netbootForm.append(optsDIV);
optionsAttr.append(optsList);
// Create boot order checkbox
var opt = $('<li></li>');
var bootOrderChkBox = $('<input type="checkbox" id="s" name="s"/>');
opt.append(bootOrderChkBox);
opt.append('Set the boot device order');
optsList.append(opt);
// Create boot order input
var bootOrder = $('<li><label for="bootOrder">Boot order:</label><input type="text" name="bootOrder"/></li>');
var bootOrder = $('<li><label>Boot order:</label><input type="text" name="bootOrder"/></li>');
bootOrder.hide();
optsList.append(bootOrder);
@ -91,7 +107,7 @@ function loadNetbootPage(tgtNodes) {
// If it is zvm
if (mgt == 'zvm') {
// Add IPL input
netbootForm.append('<div><label for="ipl">IPL:</label><input type="text" name="ipl" title="The virtual address to IPL"/></div>');
optsList.append('<div><label style="width: 40px;">IPL:</label><input type="text" name="ipl" title="The virtual address to IPL"/></div>');
break;
}
}
@ -115,9 +131,13 @@ function loadNetbootPage(tgtNodes) {
* Ok
*/
var okBtn = createButton('Ok');
okBtn.css({
'width': '80px',
'display': 'block'
});
okBtn.bind('click', function(event) {
// Remove any warning messages
$(this).parent().parent().find('.ui-state-error').remove();
// Remove any warning messages
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
// Check inputs
var ready = true;
@ -187,7 +207,7 @@ function loadNetbootPage(tgtNodes) {
} else {
// Show warning message
var warn = createWarnBar('Please provide a value for each missing field.');
warn.prependTo($(this).parent().parent());
warn.prependTo($(this).parents('.ui-tabs-panel'));
}
});
netbootForm.append(okBtn);

171
xCAT-UI/js/nodes/rscan.js Normal file
View File

@ -0,0 +1,171 @@
/**
* Load rscan page
*
* @param tgtNodes Targets to run rscan against
*/
function loadRscanPage(tgtNodes) {
// Get node OS
var osHash = new Object();
var nodes = tgtNodes.split(',');
for (var i in nodes) {
var os = getNodeAttr(nodes[i], 'os');
var osBase = os.match(/[a-zA-Z]+/);
if (osBase) {
nodes[osBase] = 1;
}
}
// Get nodes tab
var tab = getNodesTab();
// Generate new tab ID
var inst = 0;
var newTabId = 'rscanTab' + inst;
while ($('#' + newTabId).length) {
// If one already exists, generate another one
inst = inst + 1;
newTabId = 'rscanTab' + inst;
}
// Create rscan form
var rscanForm = $('<div class="form"></div>');
// Create status bar
var statBarId = 'rscanStatusBar' + inst;
var statBar = createStatusBar(statBarId).hide();
// Create loader
var loader = createLoader('rscanLoader');
statBar.find('div').append(loader);
// Create info bar
var infoBar = createInfoBar('Collects node information from one or more hardware control points');
rscanForm.append(statBar, infoBar);
// Create VM fieldset
var vmFS = $('<fieldset></fieldset>');
var vmLegend = $('<legend>Virtual Machine</legend>');
vmFS.append(vmLegend);
rscanForm.append(vmFS);
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
vmFS.append(vmAttr);
// Create options fieldset
var optionsFS = $('<fieldset></fieldset>');
var optionsLegend = $('<legend>Options</legend>');
optionsFS.append(optionsLegend);
rscanForm.append(optionsFS);
var optionsAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
optionsFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
optionsFS.append(optionsAttr);
// Create target node or group input
var target = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to scan"/></div>');
vmAttr.append(target);
// Create options
var optsList = $('<ul></ul>');
optionsAttr.append(optsList);
optsList.append('<li><input type="checkbox" name="u"/>Updates and then prints out node definitions in the xCAT database for CEC/BPA</li>');
optsList.append('<li><input type="checkbox" name="w"/>Writes output to xCAT database</li>');
optsList.append('<li><input type="checkbox" name="x"/>XML format</li>');
optsList.append('<li><input type="checkbox" name="z"/>Stanza formated output</li>');
// Generate tooltips
rscanForm.find('div input[title]').tooltip({
position: "center right",
offset: [-2, 10],
effect: "fade",
opacity: 0.7,
predelay: 800,
events : {
def : "mouseover,mouseout",
input : "mouseover,mouseout",
widget : "focus mouseover,blur mouseout",
tooltip : "mouseover,mouseout"
}
});
/**
* Ok
*/
var okBtn = createButton('Ok');
okBtn.css({
'width': '80px',
'display': 'block'
});
okBtn.bind('click', function(event) {
// Remove any warning messages
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
// Check inputs
var ready = true;
var inputs = $("#" + newTabId + " input[type='text']");
for ( var i = 0; i < inputs.length; i++) {
if (!inputs.eq(i).val()) {
inputs.eq(i).css('border', 'solid #FF0000 1px');
ready = false;
} else {
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
}
}
// Generate arguments
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
var optStr = '';
var opt;
for ( var i = 0; i < chkBoxes.length; i++) {
opt = chkBoxes.eq(i).attr('name');
optStr += '-' + opt;
// Append ; to end of string
if (i < (chkBoxes.length - 1)) {
optStr += ';';
}
}
// If no inputs are empty
if (ready) {
// Get nodes
var tgts = $('#' + newTabId + ' input[name=target]').val();
// Disable all inputs and Ok button
$('#' + newTabId + ' input').attr('disabled', 'disabled');
$(this).attr('disabled', 'true');
/**
* (1) Scan
*/
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'rscan',
tgt : tgts,
args : optStr,
msg : 'out=' + statBarId + ';cmd=rscan;tgt=' + tgts
},
success : updateStatusBar
});
// Show status bar
statBar.show();
} else {
// Show warning message
var warn = createWarnBar('Please provide a value for each missing field.');
warn.prependTo($(this).parents('.ui-tabs-panel'));
}
});
rscanForm.append(okBtn);
// Append to discover tab
tab.add(newTabId, 'Scan', rscanForm, true);
// Select new tab
tab.select(newTabId);
}

View File

@ -41,13 +41,12 @@ function loadUpdatenodePage(tgtNodes) {
newTabId = 'updatenodeTab' + inst;
}
// Create updatenode form
// Create rscan form
var updatenodeForm = $('<div class="form"></div>');
// Create status bar
var statBarId = 'updatenodeStatusBar' + inst;
var statusBar = createStatusBar(statBarId).hide();
updatenodeForm.append(statusBar);
// Create loader
var loader = createLoader('updatenodeLoader');
@ -55,19 +54,35 @@ function loadUpdatenodePage(tgtNodes) {
// Create info bar
var infoBar = createInfoBar('Update nodes in an xCAT environment');
updatenodeForm.append(infoBar);
updatenodeForm.append(statusBar, infoBar);
// Create VM fieldset
var vmFS = $('<fieldset></fieldset>');
var vmLegend = $('<legend>Virtual Machine</legend>');
vmFS.append(vmLegend);
updatenodeForm.append(vmFS);
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
vmFS.append(vmAttr);
// Create options fieldset
var optionsFS = $('<fieldset></fieldset>');
var optionsLegend = $('<legend>Options</legend>');
optionsFS.append(optionsLegend);
updatenodeForm.append(optionsFS);
var optionsAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
optionsFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
optionsFS.append(optionsAttr);
// Create target node or group input
var tgt = $('<div><label for="target">Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to update"/></div>');
updatenodeForm.append(tgt);
var tgt = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to update"/></div>');
vmAttr.append(tgt);
// Create options
var options = $('<div></div>');
var optionsLabel = $('<label>Options:</label>');
// Create options
var optionsList = $('<ul></ul>');
options.append(optionsLabel);
options.append(optionsList);
updatenodeForm.append(options);
optionsAttr.append(optionsList);
// Create update all software checkbox (only AIX)
if (osHash['AIX']) {
@ -78,7 +93,7 @@ function loadUpdatenodePage(tgtNodes) {
updateAllOption.append('Install or update all software contained in the source directory');
// Create source directory input
var allSwScrDirectory = $('<li><label for="allSwSrcDirectory" style="vertical-align: middle">Source directory:</label><input type="text" id="allSwSrcDirectory" name="allSwSrcDirectory"/></li>');
var allSwScrDirectory = $('<li><label style="vertical-align: middle">Source directory:</label><input type="text" id="allSwSrcDirectory" name="allSwSrcDirectory"/></li>');
// Browse server directory and files
var allSWSrcDirBrowse = createButton('Browse');
allSWSrcDirBrowse.serverBrowser({
@ -125,7 +140,7 @@ function loadUpdatenodePage(tgtNodes) {
updateOption.append('Update existing software');
// Create source directory input
var scrDirectory = $('<li><label for="srcDirectory" style="vertical-align: middle">Source directory:</label><input type="text" id="srcDirectory" name="srcDirectory" title="You must give the source directory containing the updated software packages"/></li>');
var scrDirectory = $('<li><label style="vertical-align: middle">Source directory:</label><input type="text" id="srcDirectory" name="srcDirectory" title="You must give the source directory containing the updated software packages"/></li>');
// Browse server directory and files
var srcDirBrowse = createButton('Browse');
srcDirBrowse.serverBrowser({
@ -155,22 +170,22 @@ function loadUpdatenodePage(tgtNodes) {
optionsList.append(scrDirectory);
// Create other packages input
var otherPkgs = $('<li><label for="otherpkgs" style="vertical-align: middle">otherpkgs:</label><input type="text" id="otherpkgs" name="otherpkgs"/></li>');
var otherPkgs = $('<li><label style="vertical-align: middle">otherpkgs:</label><input type="text" id="otherpkgs" name="otherpkgs"/></li>');
otherPkgs.hide();
optionsList.append(otherPkgs);
// Create RPM flags input (only AIX)
var aixRpmFlags = $('<li><label for="rpm_flags">rpm_flags:</label><input type="text" name="rpm_flags"/></li>');
var aixRpmFlags = $('<li><label>rpm_flags:</label><input type="text" name="rpm_flags"/></li>');
aixRpmFlags.hide();
optionsList.append(aixRpmFlags);
// Create installp flags input (only AIX)
var aixInstallPFlags = $('<li><label for="installp_flags">installp_flags:</label><input type="text" name="installp_flags"/></li>');
var aixInstallPFlags = $('<li><label>installp_flags:</label><input type="text" name="installp_flags"/></li>');
aixInstallPFlags.hide();
optionsList.append(aixInstallPFlags);
// Create emgr flags input (only AIX)
var aixEmgrFlags = $('<li><label for="emgr_flags">emgr_flags:</label><input type="text" name="emgr_flags"/></li>');
var aixEmgrFlags = $('<li><label>emgr_flags:</label><input type="text" name="emgr_flags"/></li>');
aixEmgrFlags.hide();
optionsList.append(aixEmgrFlags);
@ -201,7 +216,7 @@ function loadUpdatenodePage(tgtNodes) {
optionsList.append(postOption);
postOption.append(postChkBox);
postOption.append('Run postscripts');
var postscripts = $('<li><label for="postscripts" style="vertical-align: middle">Postscripts:</label><input type="text" id="postscripts" name="postscripts" title="You must give the postscript(s) to run"/></li>');
var postscripts = $('<li><label style="vertical-align: middle">Postscripts:</label><input type="text" id="postscripts" name="postscripts" title="You must give the postscript(s) to run"/></li>');
postscripts.hide();
optionsList.append(postscripts);
@ -225,7 +240,7 @@ function loadUpdatenodePage(tgtNodes) {
osOption.append('Update the operating system');
var os = $('<li></li>').hide();
var osLabel = $('<label for="os">Operating system:</label>');
var osLabel = $('<label>Operating system:</label>');
var osInput = $('<input type="text" name="os" title="You must give the operating system to upgrade to, e.g. rhel5.5"/>');
osInput.one('focus', function(){
var tmp = $.cookie('osvers');
@ -268,10 +283,14 @@ function loadUpdatenodePage(tgtNodes) {
/**
* Ok
*/
var okBtn = createButton('Ok');
okBtn.bind('click', function(event) {
// Remove any warning messages
$(this).parent().parent().find('.ui-state-error').remove();
var updateBtn = createButton('Update');
updateBtn.css({
'width': '80px',
'display': 'block'
});
updateBtn.bind('click', function(event) {
// Remove any warning messages
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
var ready = true;
// Generate arguments
@ -371,10 +390,10 @@ function loadUpdatenodePage(tgtNodes) {
} else {
// Show warning message
var warn = createWarnBar('You are missing some values');
warn.prependTo($(this).parent().parent());
warn.prependTo($(this).parents('.ui-tabs-panel'));
}
});
updatenodeForm.append(okBtn);
updatenodeForm.append(updateBtn);
// Append to discover tab
tab.add(newTabId, 'Update', updatenodeForm, true);

View File

@ -194,12 +194,17 @@ function loadImages(data) {
// Turn table into a datatable
var myDataTable = $('#' + imgTableId).dataTable({
'iDisplayLength': 50,
'iDisplayLength': 50,
'bLengthChange': false,
"sScrollX": "100%",
"bScrollCollapse": true,
"sScrollY": "400px",
"sScrollX": "110%",
"bAutoWidth": true,
"fnInitComplete": function() {
adjustColumnSize(imgTableId);
"oLanguage": {
"oPaginate": {
"sNext": "",
"sPrevious": ""
}
}
});
@ -209,7 +214,7 @@ function loadImages(data) {
});
// Actions
var actionBar = $('<div class="actionBar"></div>').css("width", "370px");
var actionBar = $('<div class="actionBar"></div>').css("width", "450px");
var advancedLnk = '<a>Advanced</a>';
var advancedMenu = createMenu([copyCDLnk, generateLnk]);

View File

@ -146,11 +146,90 @@ function loadProvisionPage() {
plugin.loadProvisionPage(newTabId);
});
provPg.append(okBtn);
// Create resources tab
var resrcPg = $('<div class="form"></div>');
// Create info bar
var resrcInfoBar = createInfoBar('Select a platform to view its current resources.');
resrcPg.append(resrcInfoBar);
// Create radio buttons for platforms
var hwList = $('<ol>Platforms available:</ol>');
var esx = $('<li><input type="radio" name="hw" value="esx" disabled/>ESX</li>');
var kvm = $('<li><input type="radio" name="hw" value="kvm" disabled/>KVM</li>');
var zvm = $('<li><input type="radio" name="hw" value="zvm" checked/>z\/VM</li>');
var ipmi = $('<li><input type="radio" name="hw" value="ipmi" disabled/>iDataPlex</li>');
var blade = $('<li><input type="radio" name="hw" value="blade" disabled/>BladeCenter</li>');
var hmc = $('<li><input type="radio" name="hw" value="hmc" disabled/>System p</li>');
hwList.append(esx);
hwList.append(kvm);
hwList.append(zvm);
hwList.append(blade);
hwList.append(ipmi);
hwList.append(hmc);
resrcPg.append(hwList);
var okBtn = createButton('Ok');
okBtn.bind('click', function(event) {
// Get hardware that was selected
var hw = $(this).parent().find('input[name="hw"]:checked').val();
// Generate new tab ID
var newTabId = hw + 'ResourceTab';
if (!$('#' + newTabId).length) {
// Create loader
var loader = $('<center></center>').append(createLoader(hw + 'ResourceLoader'));
// Create an instance of the plugin
var plugin = null;
var displayName = "";
switch (hw) {
case "kvm":
plugin = new kvmPlugin();
displayName = "KVM";
break;
case "esx":
plugin = new esxPlugin();
displayName = "ESX";
break;
case "blade":
plugin = new bladePlugin();
displayName = "BladeCenter";
break;
case "hmc":
plugin = new hmcPlugin();
displayName = "System p";
break;
case "ipmi":
plugin = new ipmiPlugin();
displayName = "iDataPlex";
break;
case "zvm":
plugin = new zvmPlugin();
displayName = "z\/VM";
break;
}
// Add resource tab and load resources
tab.add(newTabId, displayName, loader, true);
plugin.loadResources();
}
// Select tab
tab.select(newTabId);
});
resrcPg.append(okBtn);
// Add provision tab
tab.add('provisionTab', 'Provision', provPg, false);
// Add image tab
tab.add('imagesTab', 'Images', '', false);
// Add resource tab
tab.add('resourceTab', 'Resources', resrcPg, false);
// Load tabs onselect
$('#provisionPageTabs').bind('tabsselect', function(event, ui){

View File

@ -172,9 +172,9 @@ function loadServiceProvisionPage(tabId) {
// Create radio buttons for platforms
var hwList = $('<ol>Platforms available:</ol>');
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
var esx = $('<li><input type="radio" name="hw" value="esx" disabled/>ESX</li>');
var kvm = $('<li><input type="radio" name="hw" value="kvm" disabled/>KVM</li>');
var zvm = $('<li><input type="radio" name="hw" value="zvm" checked/>z\/VM</li>');
hwList.append(esx);
hwList.append(kvm);
@ -459,9 +459,18 @@ function loadNodesTable(data) {
// Turn table into a datatable
$('#' + nodesDTId).dataTable({
'iDisplayLength': 50,
'iDisplayLength': 50,
'bLengthChange': false,
"sScrollX": "100%"
"bScrollCollapse": true,
"sScrollY": "400px",
"sScrollX": "110%",
"bAutoWidth": true,
"oLanguage": {
"oPaginate": {
"sNext": "",
"sPrevious": ""
}
}
});
// Set datatable header class to add color

View File

@ -33,18 +33,16 @@ function getNodesShown(tableId) {
* @param col Column to find string under
* @return The row index containing the search string
*/
function findRow(str, table, col){
var dTable, rows;
function findRow(str, table, col){
// Get datatable
dTable = $(table).dataTable();
rows = dTable.fnGetData();
var dTable = $(table).dataTable();
var rows = dTable.fnGetData();
// Loop through each row
for (var i in rows) {
// If the column contains the search string
if (rows[i][col].indexOf(str) > -1) {
return i;
return parseInt(i);
}
}

View File

@ -44,16 +44,6 @@ Tab.prototype.init = function() {
}
$.cookie('tabindex_history', order);
// Find any datatable within the tab
var dTables = $(ui.panel).find('.dataTables_wrapper');
if(dTables.length) {
// Adjust column sizes for each datatable found
for (var i = 0; i < dTables.length; i++) {
var tableId = dTables.eq(i).attr('id').replace('_wrapper', '');
adjustColumnSize(tableId);
}
}
});
// Remove dummy tab
@ -577,6 +567,7 @@ function initPage() {
includeJs("js/configure/update.js");
includeJs("js/configure/discover.js");
includeJs("js/configure/service.js");
includeJs("js/configure/users.js");
headers.eq(1).css(style);
loadConfigPage();
} else if (page == 'provision.php') {
@ -601,6 +592,7 @@ function initPage() {
includeJs("js/nodes/updatenode.js");
includeJs("js/nodes/physical.js");
includeJs("js/nodes/mtm.js");
includeJs("js/nodes/rscan.js");
headers.eq(0).css(style);
loadNodesPage();
}
@ -966,14 +958,8 @@ function changePassword() {
* @param tableId Table ID
*/
function adjustColumnSize(tableId) {
var cols = $('#' + tableId).find('tbody tr:eq(0) td');
// If the column size is zero, wait until table is initialized
if (cols.eq(1).outerWidth()) {
for (var i in cols) {
var headers = $('#' + tableId + '_wrapper .dataTables_scrollHead .datatable thead tr th').eq(i);
headers.css('width', cols.eq(i).outerWidth());
}
}
var dTable = $('#' + tableId).dataTable();
dTable.fnAdjustColumnSizing();
}
/**
@ -1044,7 +1030,7 @@ function getNodesChecked(datatableId) {
for (var i in nodes) {
var tgtNode = nodes.eq(i).attr('name');
if (tgtNode){
if (tgtNode) {
tgts += tgtNode;
// Add a comma at the end
@ -1060,7 +1046,7 @@ function getNodesChecked(datatableId) {
/**
* Check if return message contains errors
*
* @param msg Return message
* @param msg Return message
* @return 0 If return message contains no errors
* -1 If return message contains errors
*/
@ -1071,3 +1057,18 @@ function containErrors(msg) {
return 0;
}
}
/**
* Check if a value is an integer
*
* @param value Value to be checked
* @returns true If value is an integer
false If value is not an integer
*/
function isInteger(value){
if ((parseFloat(value) == parseInt(value)) && !isNaN(value)) {
return true;
} else {
return false;
}
}

View File

@ -41,10 +41,15 @@ if (isset($_GET["cmd"])) {
}
// If no $args are given, set $args_array to NULL
// Separators used are: | or ;
$args_array = array();
if ($args) {
// If $args contains multiple arguments, split it into an array
if (strpos($args,";")) {
if (strpos($args, "|")) {
// Split the arguments into an array
$args_array = array();
$args_array = explode("|", $args);
} else if (strpos($args, ";")) {
// Split the arguments into an array
$args_array = array();
$args_array = explode(";", $args);
@ -59,7 +64,11 @@ if (isset($_GET["cmd"])) {
$opts = $_GET["opts"];
// If $args contains multiple arguments, split it into an array
if (strpos($opts,";")) {
if (strpos($opts, "|")) {
// Split the arguments into an array
$opts_array = array();
$opts_array = explode("|", $opts);
} if (strpos($opts, ";")) {
// Split the arguments into an array
$opts_array = array();
$opts_array = explode(";", $opts);

View File

@ -45,7 +45,12 @@ if (isset($_GET["cmd"])) {
}
// If $args contains multiple arguments, split it into an array
if (strpos($args,";")) {
// Separators used are: | or ;
if (strpos($args, "|")) {
// Split the arguments into an array
$arr = array();
$arr = explode("|", $args);
} else if (strpos($args, ";")) {
// Split the arguments into an array
$arr = array();
$arr = explode(";", $args);

View File

@ -66,7 +66,7 @@ sub process_request {
'getdefaultuserentry' => \&web_getdefaultuserentry,
'getzdiskinfo' => \&web_getzdiskinfo,
'passwd' => \&web_passwd,
'updateuser' => \&web_updateuser,
'policy' => \&web_policy,
'deleteuser' => \&web_deleteuser,
'mkzprofile' => \&web_mkzprofile,
'rmzprofile' => \&web_rmzprofile,
@ -2280,35 +2280,32 @@ sub web_passwd() {
my ( $request, $callback, $sub_req ) = @_;
# Get current and new passwords
my $user = $request->{arg}->[1];
my $newPassword = $request->{arg}->[2];
my $user = $request->{arg}->[1];
my $password = $request->{arg}->[2];
# Generate encrypted password
my $random = rand(10000000);
my $encrypted = `perl -e "print crypt($newPassword, $random)"`;
my $encrypted = `perl -e "print crypt($password, $random)"`;
# Save in xCAT passwd table
`chtab username=$user passwd.key=xcat passwd.password=$encrypted`;
my $info = "Password successfully changed";
my $info = "User password successfully updated";
$callback->( { info => $info } );
return;
}
sub web_updateuser() {
sub web_policy() {
my ( $request, $callback, $sub_req ) = @_;
# Get user attributes
my $priority = $request->{arg}->[1];
my $user = $request->{arg}->[2];
my $password = $request->{arg}->[3];
my $maxVM = $request->{arg}->[4];
my $args = $request->{arg}->[2];
# Save in xCAT passwd and policy tables
`chtab username=$user passwd.key=xcat passwd.password=$password`;
`chtab name=$user policy.priority=$priority policy.rule=allow policy.comments="max-vm:$maxVM"`;
my $out = `chtab priority=$priority $args`;
my $info = "User successfully updated";
my $info = "User policy successfully updated";
$callback->( { info => $info } );
return;
}
@ -2473,7 +2470,7 @@ sub web_rmgroup() {
$callback->( { info => $info } );
}
sub web_framesetup {
sub web_framesetup() {
my ( $request, $callback, $sub_req ) = @_;
my $adminpasswd = $request->{arg}->[1];
my $generalpasswd = $request->{arg}->[2];
@ -2487,9 +2484,8 @@ sub web_framesetup {
sleep(10);
#run makehosts
xCAT::Utils->runcmd('makehosts bpa', -1, 1);
$callback->( { info => 'Configure FRAMEs DHCP, DNS finished.' } );
}
elsif ($configphase == 2){
$callback->( { info => 'FRAMEs DHCP, DNS configured.' } );
} elsif ($configphase == 2){
#run chtab command
xCAT::Utils->runcmd('chtab key=bpa,username=HMC passwd.password=' . $hmcpasswd, -1, 1);
xCAT::Utils->runcmd('chtab key=bpa,username=admin passwd.password=' . $adminpasswd, -1, 1);
@ -2502,13 +2498,11 @@ sub web_framesetup {
xCAT::Utils->runcmd('rspconfig frame admin_passwd=admin,' . $adminpasswd, -1, 1);
xCAT::Utils->runcmd('rspconfig frame HMC_passwd=,' . $hmcpasswd, -1, 1);
$callback->( { info => 'Create hardware connection and configure password finished.' } );
}
else{
$callback->( { info => 'Hardware connection and configure password created.' } );
}
}
sub web_cecsetup{
sub web_cecsetup() {
my ( $request, $callback, $sub_req ) = @_;
my $adminpasswd = $request->{arg}->[1];
my $generalpasswd = $request->{arg}->[2];
@ -2517,28 +2511,25 @@ sub web_cecsetup{
my @tempnode = 'bpa';
if ($configphase == 1){
#run makedhcp
# Run makedhcp
xCAT::Utils->runcmd('makedhcp fsp', -1, 1);
sleep(10);
#run makehosts
# Run makehosts
xCAT::Utils->runcmd('makehosts fsp', -1, 1);
$callback->( { info => 'Configure CEC DHCP, DNS finished.' } );
}
elsif ($configphase == 2){
#run chtab command
$callback->( { info => 'CEC DHCP, DNS configured.' } );
} elsif ($configphase == 2){
# Run chtab command
xCAT::Utils->runcmd('chtab key=fsp,username=HMC passwd.password=' . $hmcpasswd, -1, 1);
xCAT::Utils->runcmd('chtab key=fsp,username=admin passwd.password=' . $adminpasswd, -1, 1);
xCAT::Utils->runcmd('chtab key=fsp,username=general passwd.password=' . $generalpasswd, -1, 1);
#run mkhwconn
# Run mkhwconn
xCAT::Utils->runcmd('mkhwconn cec -t', -1, 1);
#run rspconfig
# Run rspconfig
xCAT::Utils->runcmd('rspconfig cec general_passwd=general,' . $generalpasswd, -1, 1);
xCAT::Utils->runcmd('rspconfig cec admin_passwd=admin,' . $adminpasswd, -1, 1);
xCAT::Utils->runcmd('rspconfig cec HMC_passwd=,' . $hmcpasswd, -1, 1);
$callback->( { info => 'Create hardware connection and configure password finished.' } );
}
else{
$callback->( { info => 'Hardware connection and configure password created.' } );
}
}

View File

@ -693,6 +693,7 @@ sub clonezlinux {
println( $callback, "hosts table, DHCP, and DNS updated" );
# Clone virtual machine
sleep(5); # Time needed to update /etc/hosts
$out = `mkvm $node $src_node pool=$disk_pool`;
println( $callback, "$out" );
if ( $out =~ m/Error/i || $out =~ m/Failed/i ) {