Fixed rcons to reference jquery.min.js. Added IP address and hostname range to z/VM clone and provision page. Updated update page with new links to xCAT repository. Cleaned up code.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11850 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2012-03-14 19:20:37 +00:00
parent f1459db8ba
commit 442bbe9156
19 changed files with 863 additions and 667 deletions

View File

@ -4,7 +4,8 @@
font: 12px sans-serif;
}
.ui-dialog label,.ui-dialog input,.ui-dialog p,.ui-dialog button,.ui-dialog td {
.ui-dialog label,.ui-dialog input,.ui-dialog p,.ui-dialog button,.ui-dialog td
{
font: 12px sans-serif;
}
@ -12,7 +13,8 @@
font: 12px sans-serif;
}
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button {
.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button
{
font: 12px sans-serif;
}
@ -119,7 +121,7 @@ body {
}
pre {
font-size: 10px;
font-size: 10px;
}
/*--------------- Groups ---------------*/
@ -151,11 +153,11 @@ pre {
font-size: 15px;
}
#groups .groupdiv{
#groups .groupdiv {
padding-left: 10px;
}
#groups .groupdiv div{
#groups .groupdiv div {
color: blue;
padding: 5px 0px 5px 20px;
}
@ -166,11 +168,11 @@ pre {
}
#groups .selectgroup {
background: #E5E5E5;
font-weight: bold;
background: #E5E5E5;
font-weight: bold;
}
#groups .actionDiv{
#groups .actionDiv {
text-align: right;
padding-right: 5px;
border-top: thin solid #E7EBFF;
@ -190,15 +192,18 @@ pre {
width: 260px;
height: 220px;
}
.summarypie td{
min-width:0px;
.summarypie td {
min-width: 0px;
}
#summaryTab td{
#summaryTab td {
border: 0px;
padding: 0px;
text-align: left;
line-height: 1;
}
/*--------------- Info/warning bar ---------------*/
span.ui-icon-info {
float: left;
@ -328,14 +333,14 @@ legend {
}
.sf-menu {
border-radius :0.3em 0.3em 0.3em 0.3em;
border-radius: 0.3em 0.3em 0.3em 0.3em;
margin-bottom: 0;
background: none;
border: 0px solid;
}
.sf-menu ul li {
width: 99%;
width: 99%;
}
.sf-menu .sf-menu {
@ -346,8 +351,8 @@ legend {
background: none;
}
.sf-sub-indicator{
right:0;
.sf-sub-indicator {
right: 0;
}
.actionBar {
@ -490,13 +495,13 @@ legend {
}
.sorting_asc,.sorting_desc,.sorting {
background: none;
background: none;
}
/*--------------- jQuery context menu ---------------*/
.context-menu-theme-vista {
background: #FAFAFA url(../images/contextmenu/context-menu-bg.gif) repeat-y left top
;
background: #FAFAFA url(../images/contextmenu/context-menu-bg.gif)
repeat-y left top;
border: 1px solid #868686;
}
@ -516,8 +521,9 @@ legend {
}
.context-menu-theme-vista .context-menu-item-hover {
background: transparent url(../images/contextmenu/context-menu-item-hover.gif)
repeat-x left center;
background: transparent
url(../images/contextmenu/context-menu-item-hover.gif) repeat-x left
center;
border: 1px solid #D7D0B3;
}
@ -647,16 +653,16 @@ table a:hover {
}
.mornitorwarning {
background: #FFD700;
background: #FFD700;
cursor: pointer;
}
.monitorerror {
background: #FF3030;
background: #FF3030;
}
.monitorunknown {
background: #8B8B7A;
background: #8B8B7A;
}
.monitornodeli {
@ -673,20 +679,21 @@ table a:hover {
margin: 0px 0px 10px 10px;
}
.monitorsumdiv td{
.monitorsumdiv td {
padding: 0;
border-style: none;
font-size: 10px;
}
.monitornodediv {
width: 240px;
height: 120px;
margin: 0px 0px 15px 0px;
}
.monitorzoomlink{
.monitorzoomlink {
cursor: pointer;
color : blue;
color: blue;
}
.provision div,.monitor div {
@ -761,12 +768,12 @@ table a:hover {
height: 11px;
}
.fspcheckbox{
.fspcheckbox {
padding: 0px;
margin: 3px 3px 1px 3px;
}
.chasisDiv{
.chasisDiv {
width: 172px;
height: 108px;
font-size: 10px;
@ -777,19 +784,19 @@ table a:hover {
padding: 11px 0px 0px 11px;
}
.bladeDiv{
float:left;
.bladeDiv {
float: left;
width: 11px;
height: 89px;
text-align: left;
white-space: normal;
}
.bladeInsertDiv{
.bladeInsertDiv {
background: url(../images/nodes/blade.jpg);
}
.xnodeDiv{
.xnodeDiv {
font-size: 12px;
height: 21px;
line-height: 21px;
@ -801,6 +808,7 @@ table a:hover {
cursor: pointer;
display: inline-block;
}
/*--------------- Discovery section ---------------*/
.discoverstep {
width: 960px;
@ -812,9 +820,9 @@ table a:hover {
border-radius: .3em;
}
.discovercurrentstep{
.discovercurrentstep {
background-color: yellow;
font: normal bold 12px/ 35px sans-serif;
font: normal bold 12px/35px sans-serif;
padding: 5px;
}
@ -824,12 +832,13 @@ table a:hover {
padding: 0;
}
.discovercontent table{
border : none;
.discovercontent table {
border: none;
}
.discovercontent td {
border : none;
border: none;
text-align: left;
}
.discovercontent th {
@ -843,6 +852,6 @@ td.jqplot-table-legend {
border-width: 0px;
}
td.jqplot-table-legend > div {
td.jqplot-table-legend>div {
border-width: 0px;
}

View File

@ -40,36 +40,30 @@ function createDiscoverButtons(){
var nextButton = createNextButton();
var cancelButton = createCancelButton();
if (backButton){
if (backButton)
buttonDiv.append(backButton);
}
if (nextButton){
if (nextButton)
buttonDiv.append(nextButton);
}
if (cancelButton){
if (cancelButton)
buttonDiv.append(cancelButton);
}
$('#discoverContentDiv').append(buttonDiv);
}
function createCancelButton(){
if (0 == currentStep){
if (0 == currentStep)
return undefined;
}
if ((steps.length - 1) == currentStep){
if ((steps.length - 1) == currentStep)
return undefined;
}
var cancelbutton = createButton('Cancel');
cancelbutton.bind('click', function(){
$('#discoverTab').empty();
for (var name in discoverEnv){
for (var name in discoverEnv)
removeDiscoverEnv(name);
}
loadDiscoverPage();
});
@ -83,19 +77,16 @@ function createCancelButton(){
*/
function createNextButton(){
var tempFlag = true;
if ((steps.length - 1) == currentStep){
if ((steps.length - 1) == currentStep)
return undefined;
}
var nextButton = createButton('Next');
nextButton.bind('click', function(){
if (nextFunctions[currentStep]){
if (nextFunctions[currentStep])
tempFlag = nextFunctions[currentStep]('next');
}
if (!tempFlag){
if (!tempFlag)
return;
}
currentStep ++;
initFunctions[currentStep]('next');
});
@ -110,19 +101,16 @@ function createNextButton(){
*/
function createBackButton(){
var tempFlag = true;
if (0 == currentStep){
if (0 == currentStep)
return undefined;
}
var backButton = createButton('Back');
backButton.bind('click', function(){
if (nextFunctions[currentStep]){
if (nextFunctions[currentStep])
tempFlag = nextFunctions[currentStep]('back');
}
if (!tempFlag){
if (!tempFlag)
return;
}
currentStep--;
@ -142,12 +130,10 @@ function createBackButton(){
* else return null.
*/
function getDiscoverEnv(envName){
if (discoverEnv[envName]){
if (discoverEnv[envName])
return discoverEnv[envName];
}
else{
else
return '';
}
}
/**
@ -160,9 +146,8 @@ function getDiscoverEnv(envName){
* @return nothing
*/
function setDiscoverEnv(envName, envValue){
if (envName){
if (envName)
discoverEnv[envName] = envValue;
}
}
/**
@ -173,9 +158,8 @@ function setDiscoverEnv(envName, envValue){
* @return nothing
*/
function removeDiscoverEnv(envName){
if (discoverEnv[envName]){
if (discoverEnv[envName])
delete discoverEnv[envName];
}
}
/**
@ -187,25 +171,23 @@ function removeDiscoverEnv(envName){
function expandNR(nodeRange){
var retArray = new Array();
var tempResult;
if ('' == nodeRange){
if ('' == nodeRange)
return retArray;
}
tempResult = nodeRange.match(/(.*?)\[(.*?)\](.*)/);
if (null != tempResult){
var parts = tempResult[2].split('-');
if (2 > parts.length){
if (2 > parts.length)
return retArray;
}
var start = Number(parts[0]);
var end = Number(parts[1]);
var len = parts[0].length;
for (var i = parts[0]; i <= parts[1]; i++){
var ts = i.toString();
if (ts.length < len){
if (ts.length < len)
ts = "000000".substring(0, (len - ts.length)) + ts;
}
retArray = retArray.concat(expandNR(tempResult[1] + ts + tempResult[3]));
}
return retArray;
@ -238,9 +220,8 @@ function expandNR(nodeRange){
var len = begin[2].length;
for (var i = begin[2]; i <= end[2]; i++){
var ts = i.toString();
if (ts.length < len){
if (ts.length < len)
ts = "000000".substring(0, (len - ts.length)) + ts;
}
retArray.push(prefix + ts);
}
@ -257,12 +238,10 @@ function collectInputValue(){
$('#discoverContentDiv input[type=text]').each(function(){
var name = $(this).attr('name');
var value = $(this).attr('value');
if ('' != value){
if ('' != value)
setDiscoverEnv(name, value);
}
else{
else
removeDiscoverEnv(name);
}
});
return true;
@ -289,9 +268,8 @@ function verifyIp(ip){
* @return decimal type ip address
*/
function ip2Decimal(ip){
if (!verifyIp(ip)){
if (!verifyIp(ip))
return 0;
}
var retIp = 0;
var tempArray = ip.split('.');
@ -303,6 +281,7 @@ function ip2Decimal(ip){
retIp = retIp >>> 0;
return retIp;
}
/**
* calculate the end IP address by start IP and the number of IP range.
*
@ -343,6 +322,7 @@ function calcEndIp(ipStart, num){
ipArray[0] = ipArray[0] + parseInt(sum / 255);
return (ipArray.join('.'));
}
/**
* Step 1: show the wizard's function
* platform selector(system P or system X)
@ -350,27 +330,34 @@ function calcEndIp(ipStart, num){
* @return nothing
*/
function initSelectPlatform(){
var temp = '';
var type = '';
$('#discoverContentDiv').empty();
$('.tooltip').remove();
temp += '<div style="min-height:360px"><h2>' + steps[currentStep] + '</h2>';
temp += '<p>This wizard will guide you through the process of defining the naming conventions within' +
'your cluster, discovering the hardware on your network, and automatically defining it in the xCAT' +
'database.<br/>Choose which type of hardware you want to discover, and then click Next.</p>';
temp += '<input type="radio" name="platform" id="idataplex"><label for="idataplex">iDataPlex</label></input><br/>';
temp += '<input type="radio" name="platform" disabled="true" id="blade"><span style="color:gray;"> Blade Center</span></input><br/>';
temp += '<input type="radio" name="platform" id="ih"> System p hardware (P7 IH)</input><br/>';
temp += '<input type="radio" name="platform" id="nonih"> System p hardware (Non P7 IH)</input><br/>';
temp += '</div>';
$('#discoverContentDiv').append(temp);
if (getDiscoverEnv('machineType')){
var selectPlatform = $('<div style="min-height:360px"><h2>' + steps[currentStep] + '</h2></div>');
var infoMsg = 'This wizard will guide you through the process of defining the naming conventions within' +
'your cluster, discovering the hardware on your network, and automatically defining it in the xCAT' +
'database. Choose which type of hardware you want to discover, and then click Next.';
var info = createInfoBar(infoMsg);
selectPlatform.append(info);
var hwList = $('<ol>Platforms available:</ol>');
hwList.append('<li><input type="radio" name="platform" 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.find('li').css('padding', '2px 10px');
selectPlatform.append(hwList);
$('#discoverContentDiv').append(selectPlatform);
if (getDiscoverEnv('machineType'))
type = getDiscoverEnv('machineType');
}
else{
else
type = 'ih';
}
$('#discoverContentDiv #' + type).attr('checked', 'checked');
createDiscoverButtons();
@ -386,19 +373,16 @@ function getPlatform(){
var platformObj;
switch(radioValue){
case 'ih':
case 'nonih':{
case 'nonih':
platformObj = new hmcPlugin();
}
break;
case 'idataplex':{
break;
case 'idataplex':
platformObj = new ipmiPlugin();
}
break;
case 'blade':{
}
break;
break;
case 'blade':
break;
}
steps = ['Platform'].concat(platformObj.getStep(), 'compelte');
initFunctions = [initSelectPlatform].concat(platformObj.getInitFunction(), complete);
nextFunctions = [getPlatform].concat(platformObj.getNextFunction(), undefined);

View File

@ -53,12 +53,13 @@ function showRepository(data) {
var show = "";
// Get the corresponding repository by OS Type
if ("aix" == data.rsp) {
if (data.rsp == "aix") {
// No repository exists for AIX on sourceforge!
develRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/";
stableRepository = "http://xcat.sourceforge.net/aix/xcat-core/";
} else {
develRepository = "http://xcat.sourceforge.net/yum/devel/xcat-core/";
stableRepository = "http://xcat.sourceforge.net/yum/xcat-core/";
develRepository = "http://sourceforge.net/projects/xcat/files/yum/devel/xcat-core/";
stableRepository = "http://sourceforge.net/projects/xcat/files/yum/stable/xcat-core/";
}
var repoList = $('<ol></ol>');

View File

@ -187,7 +187,7 @@ bladePlugin.prototype.loadResources = function() {
$('#' + tabId).find('img').remove();
// Create info bar
var infoBar = createInfoBar('Under construction');
var infoBar = createInfoBar('Not yet supported');
// Create resource form
var resrcForm = $('<div class="form"></div>');

View File

@ -255,7 +255,7 @@ function createProvisionExisting(plugin, inst) {
var provisionBtn = createButton('Provision');
provisionBtn.bind('click', function(event) {
// TODO Insert provision code here
openDialog('info', 'Under construction');
openDialog('info', 'Not yet supported');
});
provExisting.append(provisionBtn);
@ -377,7 +377,7 @@ function createProvisionNew(plugin, inst) {
var provisionBtn = createButton('Provision');
provisionBtn.bind('click', function(event) {
// TODO Insert provision code here
openDialog('info', 'Under construction');
openDialog('info', 'Not yet supported');
});
provNew.append(provisionBtn);

View File

@ -466,7 +466,7 @@ esxPlugin.prototype.loadResources = function() {
$('#' + tabId).find('img').remove();
// Create info bar
var infoBar = createInfoBar('Under construction');
var infoBar = createInfoBar('Not yet supported');
// Create resource form
var resrcForm = $('<div class="form"></div>');

View File

@ -167,7 +167,7 @@ hmcPlugin.prototype.loadClonePage = function(node) {
var statBar = $('<div class="statusBar" id="' + statBarId + '"></div>').hide();
// Create info bar
var infoBar = createInfoBar('Under construction');
var infoBar = createInfoBar('Not yet supported');
// Create clone form
var cloneForm = $('<div class="form"></div>');
@ -218,7 +218,7 @@ hmcPlugin.prototype.loadResources = function() {
$('#' + tabId).find('img').remove();
// Create info bar
var infoBar = createInfoBar('Under construction');
var infoBar = createInfoBar('Not yet supported');
// Create resource form
var resrcForm = $('<div class="form"></div>');

View File

@ -208,7 +208,7 @@ ipmiPlugin.prototype.loadResources = function() {
$('#' + tabId).find('img').remove();
// Create info bar
var infoBar = createInfoBar('Under construction');
var infoBar = createInfoBar('Not yet supported');
// Create resource form
var resrcForm = $('<div class="form"></div>');

View File

@ -465,7 +465,7 @@ kvmPlugin.prototype.loadResources = function() {
$('#' + tabId).find('img').remove();
// Create info bar
var infoBar = createInfoBar('Under construction');
var infoBar = createInfoBar('Not yet supported');
// Create resource form
var resrcForm = $('<div class="form"></div>');

View File

@ -545,6 +545,24 @@ zvmPlugin.prototype.loadClonePage = function(node) {
group.append(groupLabel);
group.append(groupInput);
vmAttr.append(group);
// Create an advanced link to set IP address and hostname
var advancedLnk = $('<div><label><a style="color: blue; cursor: pointer;">Advanced</a></label></div>');
vmAttr.append(advancedLnk);
var advanced = $('<div style="margin-left: 20px;"></div>').hide();
vmAttr.append(advanced);
var ip = $('<div><label>IP address range:</label><input type="text" name="ip" ' +
'title="Optional. Specify the IP address range that will be assigned to these nodes. An IP address range must be given in the following format: 192.168.0.1-192.168.9."/></div>');
advanced.append(ip);
var hostname = $('<div><label>Hostname range:</label><input type="text" name="hostname" ' +
'title="Optional. Specify the hostname range that will be assigned to these node. A hostname range must be given in the following format: ihost1.sourceforge.net-ihost9.sourceforge.net."/></div>');
advanced.append(hostname);
// Show IP address and hostname inputs on-click
advancedLnk.click(function() {
advanced.toggle();
});
// Get list of disk pools
var temp = hcp.split('.');
@ -610,9 +628,13 @@ zvmPlugin.prototype.loadClonePage = function(node) {
var nodeRange = $('#' + newTabId + ' input[name=tgtNode]').val();
// Get target user ID
var userIdRange = $('#' + newTabId + ' input[name=tgtUserId]').val();
// Get IP address range
var ipRange = $('#' + newTabId + ' input[name=ip]').val();
// Get hostname range
var hostnameRange = $('#' + newTabId + ' input[name=hostname]').val();
// Check node range and user ID range
if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1) {
if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1 || ipRange.indexOf('-') > -1 || hostnameRange.indexOf('-') > -1) {
if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0) {
errMsg = errMsg + 'A user ID range and node range needs to be given.<br>';
ready = false;
@ -634,13 +656,45 @@ zvmPlugin.prototype.loadClonePage = function(node) {
var userIdStart = parseInt(tmp[0].match(/\d+/));
// Get ending index
var userIdEnd = parseInt(tmp[1].match(/\d+/));
var ipStart = "", ipEnd = "";
if (ipRange) {
tmp = ipRange.split('-');
// Get starting IP address
ipStart = tmp[0].substring(tmp[0].lastIndexOf(".") + 1);
// Get ending IP address
ipEnd = tmp[1].substring(tmp[1].lastIndexOf(".") + 1);
}
var hostnameStart = "", hostnameEnd = "";
if (hostnameRange) {
tmp = hostnameRange.split('-');
// Get starting hostname
hostnameStart = parseInt(tmp[0].substring(0, tmp[0].indexOf(".")).match(/\d+/));
// Get ending hostname
hostnameEnd = parseInt(tmp[1].substring(0, tmp[1].indexOf(".")).match(/\d+/));
}
// If starting and ending index do not match
if (!(nodeStart == userIdStart) || !(nodeEnd == userIdEnd)) {
// Not ready to provision
errMsg = errMsg + 'The node range and user ID range does not match.<br>';
ready = false;
}
// If an IP address range is given and the starting and ending index do not match
if (ipRange && !(nodeStart == ipStart) || !(nodeEnd == ipEnd)) {
errMsg = errMsg + 'The node range and IP address range does not match. ';
ready = false;
}
// If a hostname range is given and the starting and ending index do not match
if (hostnameRange && !(nodeStart == hostnameStart) || !(nodeEnd == hostnameEnd)) {
errMsg = errMsg + 'The node range and hostname range does not match. ';
ready = false;
}
}
}
@ -672,17 +726,45 @@ zvmPlugin.prototype.loadClonePage = function(node) {
// Get user ID base name
var userIdBase = tmp[0].match(/[a-zA-Z]+/);
// Get starting index
var userIdStart = parseInt(tmp[0].match(/\d+/));
// Get ending index
var userIdEnd = parseInt(tmp[1].match(/\d+/));
var ipBase = "";
if (ipRange) {
tmp = ipRange.split('-');
// Get network base
ipBase = tmp[0].substring(0, tmp[0].lastIndexOf(".") + 1);
}
var domain = "";
if (hostnameRange) {
tmp = hostnameRange.split('-');
// Get domain name
domain = tmp[0].substring(tmp[0].indexOf("."));
}
// Loop through each node in the node range
for ( var i = nodeStart; i <= nodeEnd; i++) {
var node = nodeBase + i.toString();
var userId = userIdBase + i.toString();
var inst = i + '/' + nodeEnd;
var args = node
+ ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userId
+ ';nodehm.mgt=zvm'
+ ';groups=' + group;
if (ipRange) {
var ip = ipBase + i.toString();
args += ';hosts.ip=' + ip;
}
if (hostnameRange) {
var hostname = node + domain;
args += ';hosts.hostnames=' + hostname;
}
/**
* (1) Define node
*/
@ -692,10 +774,7 @@ zvmPlugin.prototype.loadClonePage = function(node) {
data : {
cmd : 'nodeadd',
tgt : '',
args : node + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userId
+ ';nodehm.mgt=zvm'
+ ';groups=' + group,
args : args,
msg : 'cmd=nodeadd;inst=' + inst
+ ';out=' + statBarId
+ ';node=' + node
@ -704,7 +783,19 @@ zvmPlugin.prototype.loadClonePage = function(node) {
success : updateZCloneStatus
});
}
} else {
} else {
var args = nodeRange
+ ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userIdRange
+ ';nodehm.mgt=zvm'
+ ';groups=' + group;
if (ipRange)
args += ';hosts.ip=' + ipRange;
if (hostnameRange)
args += ';hosts.hostnames=' + hostnameRange;
/**
* (1) Define node
*/
@ -714,10 +805,7 @@ zvmPlugin.prototype.loadClonePage = function(node) {
data : {
cmd : 'nodeadd',
tgt : '',
args : nodeRange + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userIdRange
+ ';nodehm.mgt=zvm'
+ ';groups=' + group,
args : args,
msg : 'cmd=nodeadd;inst=1/1;out=' + statBarId
+ ';node=' + nodeRange
},
@ -727,8 +815,7 @@ zvmPlugin.prototype.loadClonePage = function(node) {
}
// Create loader
var loader = createLoader('');
$('#' + statBarId).find('div').append(loader);
$('#' + statBarId).find('div').append(createLoader());
$('#' + statBarId).show();
// Disable clone button
@ -1388,8 +1475,9 @@ zvmPlugin.prototype.addNode = function() {
var info = createInfoBar('Add a z/VM node range');
addNodeForm.append(info);
addNodeForm.append('<div><label>Node range:</label><input type="text" name="node"/></div>');
addNodeForm.append('<div><label>IP address range (optional):</label><input name="ip" type="text"></div>');
addNodeForm.append('<div><label>User ID range:</label><input type="text" name="userId"/></div>');
addNodeForm.append('<div><label>IP address range (optional):</label><input name="ip" type="text"></div>');
addNodeForm.append('<div><label>Hostname range (optional):</label><input name="hostname" type="text"></div>');
addNodeForm.append('<div><label>Hardware control point:</label><input type="text" name="hcp"/></div>');
addNodeForm.append('<div><label>Groups:</label><input type="text" name="groups"/></div>');
@ -1406,6 +1494,7 @@ zvmPlugin.prototype.addNode = function() {
// Get inputs
var nodeRange = $(this).find('input[name=node]').val();
var ipRange = $(this).find('input[name=ip]').val();
var hostnameRange = $(this).find('input[name=hostname]').val();
var userIdRange = $(this).find('input[name=userId]').val();
var group = $(this).find('input[name=groups]').val();
var hcp = $(this).find('input[name=hcp]').val();
@ -1420,7 +1509,7 @@ zvmPlugin.prototype.addNode = function() {
var errMsg = '';
var ready = true;
if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1) {
if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0 || ipRange.indexOf('-') < 0) {
if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0) {
errMsg = errMsg + 'A user ID range and node range needs to be given. ';
ready = false;
} else {
@ -1438,12 +1527,25 @@ zvmPlugin.prototype.addNode = function() {
// Get ending index
var userIdEnd = parseInt(tmp[1].match(/\d+/));
tmp = ipRange.split('-');
// Get starting IP address
var ipStart = tmp[0].substring(tmp[0].lastIndexOf(".") + 1);
// Get ending IP address
var ipEnd = tmp[1].substring(tmp[1].lastIndexOf(".") + 1);
var ipStart = "", ipEnd = "";
if (ipRange) {
tmp = ipRange.split('-');
// Get starting IP address
ipStart = tmp[0].substring(tmp[0].lastIndexOf(".") + 1);
// Get ending IP address
ipEnd = tmp[1].substring(tmp[1].lastIndexOf(".") + 1);
}
var hostnameStart = "", hostnameEnd = "";
if (hostnameRange) {
tmp = hostnameRange.split('-');
// Get starting hostname
hostnameStart = parseInt(tmp[0].substring(0, tmp[0].indexOf(".")).match(/\d+/));
// Get ending hostname
hostnameEnd = parseInt(tmp[1].substring(0, tmp[1].indexOf(".")).match(/\d+/));
}
// If starting and ending index do not match
if (!(nodeStart == userIdStart) || !(nodeEnd == userIdEnd)) {
@ -1456,6 +1558,12 @@ zvmPlugin.prototype.addNode = function() {
errMsg = errMsg + 'The node range and IP address range does not match. ';
ready = false;
}
// If a hostname range is given and the starting and ending index do not match
if (hostnameRange && !(nodeStart == hostnameStart) || !(nodeEnd == hostnameEnd)) {
errMsg = errMsg + 'The node range and hostname range does not match. ';
ready = false;
}
}
}
@ -1485,27 +1593,43 @@ zvmPlugin.prototype.addNode = function() {
// Get user ID base name
var userIdBase = tmp[0].match(/[a-zA-Z]+/);
// Get starting index
var userIdStart = parseInt(tmp[0].match(/\d+/));
// Get ending index
var userIdEnd = parseInt(tmp[1].match(/\d+/));
tmp = ipRange.split('-');
// Get network base
var ipBase = tmp[0].substring(0, tmp[0].lastIndexOf(".") + 1);
// Get starting IP address
var ipStart = tmp[0].substring(tmp[0].lastIndexOf(".") + 1);
// Get ending IP address
var ipEnd = tmp[1].substring(tmp[1].lastIndexOf(".") + 1);
var ipBase = "";
if (ipRange) {
tmp = ipRange.split('-');
// Get network base
ipBase = tmp[0].substring(0, tmp[0].lastIndexOf(".") + 1);
}
var domain = "";
if (hostnameRange) {
tmp = hostnameRange.split('-');
// Get domain name
domain = tmp[0].substring(tmp[0].indexOf("."));
}
// Loop through each node in the node range
for ( var i = nodeStart; i <= nodeEnd; i++) {
var node = nodeBase + i.toString();
var userId = userIdBase + i.toString();
var ip = ipBase + i.toString();
var inst = i + '/' + nodeEnd;
var args = node + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userId
+ ';nodehm.mgt=zvm' + ';groups=' + group;
if (ipRange) {
var ip = ipBase + i.toString();
args += ';hosts.ip=' + ip;
}
if (hostnameRange) {
var hostname = node + domain;
args += ';hosts.hostnames=' + hostname;
}
/**
* (1) Define node
*/
@ -1515,10 +1639,7 @@ zvmPlugin.prototype.addNode = function() {
data : {
cmd : 'nodeadd',
tgt : '',
args : node + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userId
+ ';nodehm.mgt=zvm' + ';groups=' + group
+ ';hosts.ip=' + ip,
args : args,
msg : 'cmd=addnewnode;inst=' + inst + ';noderange=' + nodeRange
},
@ -1567,6 +1688,16 @@ zvmPlugin.prototype.addNode = function() {
});
}
} else {
var args = nodeRange + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userIdRange
+ ';nodehm.mgt=zvm' + ';groups=' + group;
if (ipRange)
args += ';hosts.ip=' + ipRange;
if (hostnameRange)
args += ';hosts.hostnames=' + hostnameRange;
// Only one node to add
$.ajax( {
url : 'lib/cmd.php',
@ -1574,10 +1705,7 @@ zvmPlugin.prototype.addNode = function() {
data : {
cmd : 'nodeadd',
tgt : '',
args : nodeRange + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userIdRange
+ ';nodehm.mgt=zvm' + ';groups=' + group
+ ';hosts.ip=' + ipRange,
args : args,
msg : 'cmd=addnewnode;node=' + nodeRange
},

View File

@ -101,8 +101,8 @@ function loadHcpInfo(data) {
} // End of if (hcp)
} else {
// Create warning dialog
var msg = createWarnBar('z/VM SMAPI is not responding to ' + hcp + '. It needs to be reset.');
var warnDialog = $('<div></div>').append(msg);
var warning = createWarnBar('z/VM SMAPI is not responding to ' + hcp + '. It needs to be reset.');
var warnDialog = $('<div></div>').append(warning);
// Open dialog
warnDialog.dialog({
@ -2279,6 +2279,24 @@ function createZProvisionNew(inst) {
hcpDiv.append(hcpInput);
vmAttr.append(hcpDiv);
// Create an advanced link to set IP address and hostname
var advancedLnk = $('<div><label><a style="color: blue; cursor: pointer;">Advanced</a></label></div>');
vmAttr.append(advancedLnk);
var advanced = $('<div style="margin-left: 20px;"></div>').hide();
vmAttr.append(advanced);
var ip = $('<div><label>IP address:</label><input type="text" name="ip" ' +
'title="Optional. Specify the IP address that will be assigned to this node. An IP address must be given in the following format: 192.168.0.1."/></div>');
advanced.append(ip);
var hostname = $('<div><label>Hostname:</label><input type="text" name="hostname" ' +
'title="Optional. Specify the hostname that will be assigned to this node. A hostname must be given in the following format: ihost1.sourceforge.net."/></div>');
advanced.append(hostname);
// Show IP address and hostname inputs on-click
advancedLnk.click(function() {
advanced.toggle();
});
// Create operating system image input
var os = $('<div></div>');
var osLabel = $('<label for="os">Operating system image:</label>');
@ -2568,7 +2586,7 @@ function createZProvisionNew(inst) {
diskArgs.eq(i).css('border', 'solid #BDBDBD 1px');
}
}
// If inputs are valid, ready to provision
if (ready) {
if (!os.val()) {
@ -2627,6 +2645,20 @@ function createZProvisionNew(inst) {
var hcp = $('#' + thisTabId + ' input[name=hcp]').val();
// Get group
var group = $('#' + thisTabId + ' input[name=group]').val();
// Get IP address and hostname
var ip = $('#' + thisTabId + ' input[name=ip]').val();
var hostname = $('#' + thisTabId + ' input[name=hostname]').val();
// Generate arguments to sent
var args = node + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userId
+ ';nodehm.mgt=zvm'
+ ';groups=' + group;
if (ip)
args += ';hosts.ip=' + ip;
if (hostname)
args += ';hosts.hostnames=' + hostname;
/**
* (1) Define node
@ -2637,9 +2669,7 @@ function createZProvisionNew(inst) {
data : {
cmd : 'nodeadd',
tgt : '',
args : node + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userId
+ ';nodehm.mgt=zvm' + ';groups=' + group,
args : args,
msg : 'cmd=nodeadd;out=' + inst
},
@ -2702,6 +2732,20 @@ function createZProvisionNew(inst) {
var hcp = $('#' + thisTabId + ' input[name=hcp]').val();
// Get group
var group = $('#' + thisTabId + ' input[name=group]').val();
// Get IP address and hostname
var ip = $('#' + thisTabId + ' input[name=ip]').val();
var hostname = $('#' + thisTabId + ' input[name=hostname]').val();
// Generate arguments to sent
var args = node + ';zvm.hcp=' + hcp
+ ';zvm.userid=' + userId
+ ';nodehm.mgt=zvm'
+ ';groups=' + group;
if (ip)
args += ';hosts.ip=' + ip;
if (hostname)
args += ';hosts.hostnames=' + hostname;
/**
* (1) Define node
@ -2712,9 +2756,7 @@ function createZProvisionNew(inst) {
data : {
cmd : 'nodeadd',
tgt : '',
args : node + ';zvm.hcp=' + hcp + ';zvm.userid='
+ userId + ';nodehm.mgt=zvm' + ';groups='
+ group,
args : args,
msg : 'cmd=nodeadd;out=' + inst
},

View File

@ -152,7 +152,7 @@ function loadMonitorPage() {
var pcpMon = $('<tr></tr>');
pcpMon.append($('<td><a href="#" name="pcpmon">PCP</a></td>'));
pcpMon.append($('<td></td>').append(statusButtonHash['pcpmon']));
pcpMon.append($('<td>Under construction.</td>'));
pcpMon.append($('<td>Not yet supported</td>'));
monTableBody.append(pcpMon);
// Do not word wrap
@ -303,7 +303,7 @@ function loadMonitorTab(name) {
*/
function loadUnfinish(monitorName, tab) {
var unfinishPage = $('<div></div>');
unfinishPage.append(createInfoBar('Under construction'));
unfinishPage.append(createInfoBar('Not yet supported'));
tab.add(monitorName, 'Unfinished', unfinishPage, true);
}

View File

@ -898,7 +898,7 @@ function chCondScopeDia() {
*/
function mkResponseDia() {
var diaDiv = $('<div title="Make Response"><div>');
diaDiv.append('under construction.');
diaDiv.append('Not yet supported.');
diaDiv.dialog({
modal: true,

View File

@ -1,161 +1,151 @@
/**
* global variable
* Global variables
*/
var XcatmonTableId="XcatMonsettingTable";
var xcatMonTableId = "xcatMonSettingTable";
/**
* load xCAT monitor
* Load xCAT monitoring
*/
function loadXcatMon(){
//find the xcat mon tab
function loadXcatMon() {
// Find xCAT monitoring tab
var xcatMonTab = $('#xcatmon');
xcatMonTab.append("<div id= xcatmonTable></div>");
//show the content of the table monsetting
// Show content of monsetting table
$.ajax({
url:'lib/cmd.php',
dataType: 'json',
data:{
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'tabdump',
tgt :'',
tgt : '',
args : 'monsetting',
msg : ''
},
success: loadXcatMonSetting
});
success : loadXcatMonSetting
});
}
function loadXcatMonSetting(data){
var apps; //contain the xcatmon apps config
var rsp = data.rsp;
var apps_flag = 0; //is the apps is stored?
var ping; //contain the xcatmon ping-interval setting
function loadXcatMonSetting(data) {
var apps = ""; // Contains the xcatmon config
var rsp = data.rsp;
var apps_flag = 0;
var ping; // xcatmon ping interval
var ping_flag = 0;
//create a infoBar
var infoBar=createInfoBar('Click on a cell to edit. Click outside the table to write to the cell. Once you are finished configuring the xCAT monitor, click on Apply.');
// Create an info bar
var infoBar = createInfoBar('Click on a cell to edit. Click outside the table to write to the cell. Once you are finished configuring the xCAT monitor, click on Apply.');
$('#xcatmonTable').append(infoBar);
//create xcatmonTable
var XcatmonTable= new DataTable(XcatmonTableId);
//create Datatable
// Create xcatmon table
var xcatmonTable = new DataTable(xcatMonTableId);
// Create datatable
var dTable;
//create the xcatmonTable header
var header=rsp[0].split(",");
header.splice(3,2);
header.splice(0,1);
header[0]="apps name";
header[1]="configure";
// Create table header
var header = rsp[0].split(",");
header.splice(3, 2);
header.splice(0, 1);
header[0] = "App Name";
header[1] = "Configure";
header.push('<input type="checkbox" onclick="selectAllCheckbox(event,$(this))">');
header.unshift('');
XcatmonTable.init(header); //create the table header
xcatmonTable.init(header);
//create container of original table contents
var origCont= new Array();
origCont[0]=header; //table header
// Create container for original table contents
var origCont = new Array();
origCont[0] = header; // Table headers
//create contariner for new contents use for update the monsetting table
var newCont =new Object();
newCont[0]=rsp[0].split(","); //table header
//create container for other monsetting lines not xcatmon
var otherCont =new Array();
// Create container for new contents to use later updating monsetting table
var newCont = new Object();
newCont[0] = rsp[0].split(","); // Table headers
$('#xcatmonTable').append(XcatmonTable.object()); //add table object
var m = 1; //the count for origCont
// Create container for other monsetting lines
var otherCont = new Array();
$('#xcatmonTable').append(xcatmonTable.object());
var m = 1; // Count for origCont
var n = 0;
for (var i=1; i<rsp.length; i++) { //get the apps and the ping-interval configure
var pos = rsp[i].indexOf("xcatmon"); //only check the xcatmon setting
for ( var i = 1; i < rsp.length; i++) {
var pos = rsp[i].indexOf("xcatmon"); // Only check xcatmon setting
if (pos == 1) {
//get the useful info and add it to the page.
if ((rsp[i].indexOf("apps")== -1 ) && (rsp[i].indexOf("ping")== -1)) {
var cols=rsp[i].split(',');
//pair the semicolon of the content
for (var j=0; j<cols.length; j++) {
if (cols[j].count('"')%2 == 1) {
while (cols[j].count('"')%2 == 1) {
cols[j]=cols[j]+","+cols[j+1];
cols.splice(j+1,1);
if ((rsp[i].indexOf("apps") == -1) && (rsp[i].indexOf("ping") == -1)) {
var cols = rsp[i].split(',');
for ( var j = 0; j < cols.length; j++) {
if (cols[j].count('"') % 2 == 1) {
while (cols[j].count('"') % 2 == 1) {
cols[j] = cols[j] + "," + cols[j + 1];
cols.splice(j + 1, 1);
}
}
cols[j] = cols[j].replace(new RegExp('"','g'),'');
cols[j] = cols[j].replace(new RegExp('"', 'g'), '');
}
//remove the commend disable
cols.splice(3,2);
//remove the xcatmon
cols.splice(0,1);
cols.push('<input type="checkbox" name="' + cols[0] + '" title="Checking this checkbox will add/remove the app from the configure apps value" />');
cols.unshift('<span class="ui-icon ui-icon-close" onclick="deleteRow1(this)"></span>');
//add the column tho the table
XcatmonTable.add(cols);
cols.splice(3, 2);
cols.splice(0, 1);
cols.push('<input type="checkbox" name="' + cols[0] + '" title="Checking this box will add/remove the app from the configured app value"/>');
cols.unshift('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
// Add column to table
xcatmonTable.add(cols);
origCont[m++] = cols;
} else {
if (!apps_flag) { //check the apps setting
if (rsp[i].indexOf("apps") > -1) { //check for is apps or not
apps=rsp[i].split(',');
for (var j=0; j<apps.length; j++) { //pair the semicolon
if (apps[j].count('"')%2 == 1) {
while (apps[j].count('"')%2 == 1){
apps[j] = apps[j]+","+apps[j+1];
apps.splice(j+1,1);
if (!apps_flag) { // Check the apps setting
if (rsp[i].indexOf("apps") > -1) {
apps = rsp[i].split(',');
for ( var j = 0; j < apps.length; j++) {
if (apps[j].count('"') % 2 == 1) {
while (apps[j].count('"') % 2 == 1) {
apps[j] = apps[j] + "," + apps[j + 1];
apps.splice(j + 1, 1);
}
}
apps[j] = apps[j].replace(new RegExp('"','g'),'');
apps[j] = apps[j].replace(new RegExp('"', 'g'), '');
}
apps_flag=1; //set the flag to 1 to avoid this subroute
apps_flag = 1; // Set the flag to 1 to avoid this subroute
}
}
//get into the ping setting subroute
// Get into the ping settings
if (!ping_flag) {
//check the ping-interval config
// Check the ping interval
if (rsp[i].indexOf("ping-interval") > -1) {
ping=rsp[i].split(',');
//pair the semicolon
for (var j=0; j<ping.length; j++) {
if (ping[j].count('"')%2 == 1) {
while (ping[j].count('"')%2 == 1) {
ping[j] = ping[j]+"," + ping[j+1];
ping.splice(j+1,1);
ping = rsp[i].split(',');
for ( var j = 0; j < ping.length; j++) {
if (ping[j].count('"') % 2 == 1) {
while (ping[j].count('"') % 2 == 1) {
ping[j] = ping[j] + "," + ping[j + 1];
ping.splice(j + 1, 1);
}
}
ping[j] = ping[j].replace((new RegExp('"','g')),'');
ping[j] = ping[j].replace((new RegExp('"', 'g')),
'');
}
ping_flag = 1;
}
}
}
}
} else if (pos != 1) {
//the other monitor in the monsetting table
// The other monitor in the monsetting table
var otherCols = rsp[i].split(',');
for (var k=0; k<otherCols.length; k++) {
if (otherCols[k].count('"')%2 == 1) {
while (otherCols[k].count('"')%2 == 1) {
otherCols[k] = otherCols[k]+","+otherCols[k+1];
otherCols.splice(k+1,1);
for ( var k = 0; k < otherCols.length; k++) {
if (otherCols[k].count('"') % 2 == 1) {
while (otherCols[k].count('"') % 2 == 1) {
otherCols[k] = otherCols[k] + "," + otherCols[k + 1];
otherCols.splice(k + 1, 1);
}
}
otherCols[k] = otherCols[k].replace(new RegExp('"','g'),'');
otherCols[k] = otherCols[k].replace(new RegExp('"', 'g'), '');
}
//add the rows to the otherCont.
otherCont[n++] = otherCols;
}
}
//if the apps is not in the monsetting table.Then create the default apps row.
//when saving the changes,add the row to the table.
if(!apps_flag) {
// If app is not in the monsetting table, then create default apps row
if (!apps_flag) {
apps = rsp[0].split(',');
apps[0] = "xcatmon";
apps[1] = "apps";
@ -164,196 +154,176 @@ function loadXcatMonSetting(data){
apps[4] = "";
}
//if the ping-interval is not in the monsetting table.Then create the default ping-interval row.
//when saving the changes,add the row to the table.
if(!ping_flag) {
// If the ping interval is not in the monsetting table, then create the
// default ping-interval
if (!ping_flag) {
ping = rsp[0].split(',');
ping[0] = "xcatmon";
ping[1] = "ping-interval";
//the default ping-interval setting is 5
// Set default ping-interval setting to 5
ping[2] = "5";
ping[3] = "";
ping[4] = "";
}
//set the checkbox to be true according to the apps
// Set checkbox to be true
var checked = apps[2].split(',');
for (var i=0; i<checked.length; i++) {
//set the selcet checkbox to true
$("input:checkbox[name="+checked[i]+"]").attr('checked',true);
for (var j=0; j<origCont.length; j++) {
//set the origCont's checkbox to true
for ( var i = 0; i < checked.length; i++) {
$("input:checkbox[name=" + checked[i] + "]").attr('checked', true);
for ( var j = 0; j < origCont.length; j++) {
if (origCont[j][1] == checked[i]) {
origCont[j].splice(3,1);
origCont[j].push('<input type="checkbox" name="'+origCont[j][1]+'" title="Click this checkbox will add/remove the app from the configure apps value." checked=true/>');
origCont[j].splice(3, 1);
origCont[j].push('<input type="checkbox" name="' + origCont[j][1] + '" title="Check this checkbox to add/remove the app from the configured app value." checked=true/>');
}
}
}
$(":checkbox").tooltip();
//make the table editable
$('#'+ XcatmonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(
function (value,settings) {
var colPos = this.cellIndex;
var rowPos = dTable.fnGetPosition(this.parentNode);
dTable.fnUpdate(value,rowPos,colPos);
return (value);
},{
onblur : 'submit',
type : 'textarea',
placeholder: ' ',
height : '30px'
}
);
//save the datatable
dTable = $('#' + XcatmonTableId).dataTable({
'iDisplayLength': 50,
'bLengthChange': false,
"sScrollX": "100%",
"bAutoWidth": true
// Make the table editable
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
var colPos = this.cellIndex;
var rowPos = dTable.fnGetPosition(this.parentNode);
dTable.fnUpdate(value, rowPos, colPos);
return (value);
}, {
onblur : 'submit',
type : 'textarea',
placeholder : ' ',
height : '30px'
});
//create action bar
// Save datatable
dTable = $('#' + xcatMonTableId).dataTable({
'iDisplayLength' : 50,
'bLengthChange' : false,
"sScrollX" : "100%",
"bAutoWidth" : true
});
// Create action bar
var actionBar = $('<div class="actionBar"></div>');
var addRowLnk = $('<a>Add row</a>');
addRowLnk.bind('click', function(event) {
//create the container of the new row
// Create container for new row
var row = new Array();
//add the delete button to the row
row.push('<span class="ui-icon ui-icon-close" onclick="deleteRow1(this)"></span>');
//add the xcatmon
//add the contain of the setting
for (var i=0; i<header.length-2; i++) {
// Add delete button to row
row.push('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
for ( var i = 0; i < header.length - 2; i++)
row.push('');
}
//add the checkbox
row.push('<input type="checkbox" name="'+row[2]+'" title="Checking this checkbox will add/remove the app from the configure apps value"/>');
//get the datatable of the table
var dTable = $('#' + XcatmonTableId).dataTable();
//add the new row to the datatable
// Add checkbox
row.push('<input type="checkbox" name="' + row[2] + '" title="Checking this checkbox will add/remove the app from the configured apps value"/>');
// Get the datatable of the table
var dTable = $('#' + xcatMonTableId).dataTable();
// Add the new row to the datatable
dTable.fnAddData(row);
//make the datatable editable
// make the datatable editable
$(":checkbox[title]").tooltip();
$('#' + XcatmonTableId+' td:not(td:nth-child(1),td:last-child)').editable(
function(value,settings) {
var colPos = this.cellIndex;
var rowPos = dTable.fnGetPosition(this.parentNode);
dTable.fnUpdate(value,rowPos,colPos);
return (value);
},{
onblur : 'submit',
type : 'textarea',
placeholder: ' ',
height : '30px'
}
);
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
var colPos = this.cellIndex;
var rowPos = dTable
.fnGetPosition(this.parentNode);
dTable.fnUpdate(value, rowPos,
colPos);
return (value);
}, {
onblur : 'submit',
type : 'textarea',
placeholder : ' ',
height : '30px'
});
});
/**
* apply button
*
* the Apply button is used to store the contain of the table in the page to
* the monsetting table on the MN.
*/
// Create apply button to store the contents of the table to the monsetting table
var applyLnk = $('<a>Apply</a>');
applyLnk.bind('click', function(event){
//get the datatable of the page
var dTable = $('#' + XcatmonTableId).dataTable();
//get the rows of the datatable
var dRows = dTable.fnGetNodes();
applyLnk.bind('click', function(event) {
// Get the datatable
var dTable = $('#' + xcatMonTableId).dataTable();
// Get datatable rows
var dRows = dTable.fnGetNodes();
var count = 0;
//create the new container of the apps' value.
// Create a new container for the apps value
var appValue = '';
var tableName = 'monsetting';
var tmp;
var tmp1;
var closeBtn = createButton('close');
//get the contain of the rows
for (var i=0; i<dRows.length; i++) {
// Get the row contents
for ( var i = 0; i < dRows.length; i++) {
if (dRows[i]) {
//get the columns fo the row
// Get the row columns
var cols = dRows[i].childNodes;
//create the container of the new column
// Create a container for the new columns
var vals = new Array();
for (var j=1; j<cols.length-1; j++) {
//get the value of every column(except the first and the last.why ? .ni dong de)
var val=cols.item(j).firstChild.nodeValue;
if (val == ' ') {
vals[j-1] = '';
} else {
vals[j-1] = val;
}
for ( var j = 1; j < cols.length - 1; j++) {
var val = cols.item(j).firstChild.nodeValue;
if (val == ' ')
vals[j - 1] = '';
else
vals[j - 1] = val;
}
//prepare another space for the array/
var vals_orig = new Array();
//copy the data from vals to vals_orig
for (var p=0; p<2; p++) {
// Copy data from vals to vals_orig
for ( var p = 0; p < 2; p++) {
var val = vals[p];
vals_orig[p] = val;
vals_orig[p] = val;
}
vals.push('');
vals.push('');
vals.unshift('xcatmon');
//stored the new column to the newCont
newCont[i+1] = vals;
// Stored new column to newCont
newCont[i + 1] = vals;
//check the checkbox of the row and add different checkbox to the orignCont
//for the cancle button
if (cols.item(cols.length-1).firstChild.checked) {
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Click this checkbox will add/remove the app from the configure apps value." checked=true/>');
if (cols.item(cols.length - 1).firstChild.checked) {
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Checking this checkbox will add/remove the app from the configured apps value" checked=true/>');
} else {
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Click this checkbox will add/remove the app from the configure apps value."/>');
}
//push the delete button to the row
vals_orig.unshift('<span class="ui-icon ui-icon-close" onclick="deleteRow1(this)"></span>');
//add the row to the orignCont
origCont[i+1] = vals_orig;
count = i+1;
//check the checkbox fo everyrow for merging the appName to the apps values
if (cols.item(cols.length-1).firstChild.checked) {
//the new value for the apps.get the name fo every app.
appValue = appValue.concat(cols.item(2).firstChild.nodeValue+",");
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Checking this checkbox will add/remove the app from the configured apps value"/>');
}
// Add delete button to row
vals_orig.unshift('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
// Add row to origCont
origCont[i + 1] = vals_orig;
count = i + 1;
// Check checkbox for every row when merging the app name with the apps values
if (cols.item(cols.length - 1).firstChild.checked)
appValue = appValue.concat(cols.item(2).firstChild.nodeValue + ",");
}
}
count++;
//delete the last "," of the apps value
appValue = appValue.substring(0,(appValue.length-1));
apps[2] = appValue;
//newCont add the apps row
// Delete the last comma of the apps value
appValue = appValue.substring(0, (appValue.length - 1));
apps[2] = appValue;
newCont[count++] = apps;
//newCont add the ping-interval row
newCont[count++] = ping;
//add the other monitor setting of the mosetting
for (var j=0; j<otherCont.length; j++) {
// Add to other monitor settings
for ( var j = 0; j < otherCont.length; j++) {
newCont[count++] = otherCont[j];
}
//create the save dialog
var dialogSave = $('<div id="saveDialog" align="center">saving the configuration </div>');
dialogSave.append(createLoader());
$('#xcatmon').append(dialogSave);
//open the dialog..modal is true
$("#saveDialog").dialog({modal: true});
//hide the cross...
$('.ui-dialog-titlebar-close').hide();
//put the table name and the contain to the tabRestore.php
// Create save dialog
var dialogSave = $('<div id="saveDialog" align="center">Saving configuration</div>');
dialogSave.append(createLoader());
$('#xcatmon').append(dialogSave);
$("#saveDialog").dialog({
modal : true
});
$('.ui-dialog-titlebar-close').hide();
$.ajax({
type : 'POST',
url : 'lib/tabRestore.php',
@ -362,83 +332,76 @@ function loadXcatMonSetting(data){
table : tableName,
cont : newCont
},
success : function(data){
//empty the dialog.add the close button
$("#saveDialog").empty().append('<p>The Configure has saved!</p>');
success : function(data) {
// empty the dialog.add the close button
$("#saveDialog").empty().append('<p>Configuration saved!</p>');
$("#saveDialog").append(closeBtn);
}
});
//close button function
closeBtn.bind('click', function(event){
$("#saveDialog").dialog("distroy");
// Close button
closeBtn.bind('click', function(event) {
$("#saveDialog").dialog("destroy");
$("#saveDialog").remove();
});
//clear the newCont
// Clear the newCont
newCont = null;
newCont = new Object();
//just for tmp=newCont;
newCont[0] = rsp[0].split(",");
});
var cancelLnk = $('<a>Cancel</a>');
cancelLnk.bind('click', function(event){
//get the datatable of the page
var dTable = $('#' + XcatmonTableId).dataTable();
//clear the datatable
cancelLnk.bind('click', function(event) {
// Get the datatable for the page
var dTable = $('#' + xcatMonTableId).dataTable();
// Clear the datatable
dTable.fnClearTable();
//add the contain of the origCont to the datatable
for (var i=1; i<origCont.length; i++){
dTable.fnAddData(origCont[i],true);
}
// Add the contents of origCont to the datatable
for ( var i = 1; i < origCont.length; i++)
dTable.fnAddData(origCont[i], true);
$(":checkbox[title]").tooltip();
$('#'+XcatmonTableId+' td:not(td:nth-child(1),td:last-child)').editable(
function (value,settings){
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
var colPos = this.cellIndex;
var rowPos = dTable.fnGetPosition(this.parentNode);
dTable.fnUpdate(value,rowPos,colPos);
dTable.fnUpdate(value, rowPos, colPos);
return (value);
},{
}, {
onblur : 'submit',
type : 'textarea',
placeholder: ' ',
placeholder : ' ',
height : '30px'
});
});
});
//actions
var actionsLnk = '<a>Actions</a>';
var actsMenu = createMenu([addRowLnk, applyLnk, cancelLnk]);
//create an action menu
// Create actions menu
var actionsLnk = '<a>Actions</a>';
var actsMenu = createMenu([ addRowLnk, applyLnk, cancelLnk ]);
var actionsMenu = createMenu([ [ actionsLnk, actsMenu ] ]);
actionsMenu.superfish();
actionsMenu.css('display', 'inline-block');
actionBar.append(actionsMenu);
//create a division to hold actions menu
var menuDiv = $('<div id="' + XcatmonTableId + '_menuDiv" class="menuDiv"></div>');
$('#' + XcatmonTableId + '_wrapper').prepend(menuDiv);
menuDiv.append(actionBar);
$('#' + XcatmonTableId + '_filter').appendTo(menuDiv);
// Create a division to hold actions menu
var menuDiv = $('<div id="' + xcatMonTableId + '_menuDiv" class="menuDiv"></div>');
$('#' + xcatMonTableId + '_wrapper').prepend(menuDiv);
menuDiv.append(actionBar);
$('#' + xcatMonTableId + '_filter').appendTo(menuDiv);
}
/**
* delete a row from the table
* Delete a row from the table
*/
function deleteRow1(obj){
var dTable = $('#' + XcatmonTableId).dataTable();
function deleteXcatMonRow(obj) {
var dTable = $('#' + xcatMonTableId).dataTable();
var rows = dTable.fnGetNodes();
var tgtRow = $(obj).parent().parent().get(0);
for (var i in rows) {
for ( var i in rows) {
if (rows[i] == tgtRow) {
dTable.fnDeleteRow(i, null,true);
dTable.fnDeleteRow(i, null, true);
break;
}
}

View File

@ -2402,10 +2402,10 @@ function loadRconsPage(tgtNodes){
redirectUrl += hostName;
pos = urlPath.lastIndexOf('/');
redirectUrl += urlPath.substring(0, pos + 1);
redirectUrl += 'rconsShow.php';
redirectUrl += 'rcons.php';
// Open the rcons page
window.open(redirectUrl + "?rconsnd=" + tgtNodes, '', "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=670,height=436");
window.open(redirectUrl + "?rconsnd=" + tgtNodes, '', "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=590,height=436");
}
/**
@ -3266,7 +3266,7 @@ function advancedLoad(group){
}
/**
* Jump to provision page onclick
* Jump to provision page on-click
*
* @param tgtNodes
* Target nodes
@ -3281,7 +3281,7 @@ function jump2Provision(tgtNodes){
var master = '';
var tftpserver = '';
var nfsserver = '';
var diaDiv = $('<div title="Provision (only supported for Linux)" class="form" id="deployDiv"></div>');
var diaDiv = $('<div title="Provision" class="form" id="deployDiv"></div>');
// Check the first node's arch type
for (index in nodeArray){
@ -3293,7 +3293,7 @@ function jump2Provision(tgtNodes){
break;
}
if (0 == index) {
if (index == 0) {
archType = origAttrs[nodeName]['arch'];
}
@ -3313,11 +3313,11 @@ function jump2Provision(tgtNodes){
}
if (archType.indexOf('390') != -1) {
errorMsg += 'Please use the provision page.';
errorMsg += 'Please use the provision page';
}
// Open dialog to show error message
if ('' != errorMsg){
if (errorMsg){
diaDiv.append(createWarnBar(errorMsg));
diaDiv.dialog({
modal: true,

View File

@ -254,7 +254,7 @@ function fillList(nodeName, defaultnodetype){
function createGraphical(){
var tabarea = $('#graphTab');
var selectNodeDiv = $('<div id="selectNodeDiv" style="margin: 20px;">Nodes:</div>');
var selectNodeDiv = $('<div id="selectNodeDiv" style="margin: 20px;"></div>');
var temp = 0;
for (var i in selectNode){
temp ++;
@ -262,7 +262,7 @@ function createGraphical(){
}
//there is not selected lpars, show the info bar
if (0 == temp){
if (temp == 0){
tabarea.append(createInfoBar('Hover over a CEC and select the LPARs to do operations against.'));
}
//show selected lpars
@ -578,19 +578,23 @@ function createSystemxGraphical(xnodes, area){
}
}
function addUnknownGraphical(unknownnode, area){
var graphTab = $('#graphTab');
var index = 0;
if (unknownnode.length < 1){
function addUnknownGraphical(unknownNodes, tab){
// Do not continue if no nodes were found
if (unknownNodes.length < 1)
return;
var list = "";
tab.append('<label>Unknown Type Nodes</label><hr/>');
for (var index in unknownNodes){
list += unknownNodes[index] + ', ';
}
graphTab.append('Unknown Type Nodes:<hr/>');
for (index in unknownnode){
graphTab.append(unknownnode[index] + '; ');
}
// Delete last comma
list = list.substr(0, list.length - 2);
tab.append(list);
}
/**
* update the lpars' background in cec, lpars area and selectNode
*
@ -602,13 +606,15 @@ function updateSelectNodeDiv(){
$('#selectNodeDiv').empty();
//add buttons
$('#selectNodeDiv').append('Nodes: ');
for(var lparName in selectNode){
$('#selectNodeDiv').append(lparName + ' ');
temp ++;
if (6 < temp){
$('#selectNodeDiv').append('...');
break;
if (selectNode.length) {
$('#selectNodeDiv').append('Nodes: ');
for (var lparName in selectNode){
$('#selectNodeDiv').append(lparName + ' ');
temp ++;
if (temp > 6){
$('#selectNodeDiv').append('...');
break;
}
}
}
}

View File

@ -1,8 +1,8 @@
/**
* Global variables
*/
var origAttrs = new Object(); // Original image attributes
var defAttrs; // Definable image attributes
var origAttrs = new Object(); // Original image attributes
var defAttrs; // Definable image attributes
var imgTableId = 'imagesDatatable'; // Images datatable ID
var softwareList = {
"rsct" : ["rsct.core.utils", "rsct.core", "src"],
@ -308,8 +308,6 @@ function setImageDefAttrs(data) {
/**
* Load create image page
*
* @return Nothing
*/
function loadCreateImage() {
// Get nodes tab
@ -322,48 +320,48 @@ function loadCreateImage() {
return;
}
var imageOsvers = $.cookie("osvers").split(",");
var imageOsVers = $.cookie("osvers").split(",");
var imageArch = $.cookie("osarchs").split(",");
var profileArray = $.cookie("profiles").split(",");
var profiles = $.cookie("profiles").split(",");
var parm = '';
var i = 0;
var createImgForm = $('<div class="form"></div>');
var createImgFS = $('<fieldset></fieldset>').append('<legend>Create Image</legend>');
createImgForm.append(createImgFS);
// Create set properties form
var createImgForm = $('<div class="form" ></div>');
// Show the infomation
// Show info bar
var infoBar = createInfoBar('Specify the parameters for the image (stateless or statelite) you want to create, then click Create.');
createImgForm.append(infoBar);
createImgFS.append(infoBar);
// OS version selector
parm += '<div><label>OS version:</label><select id="osvers" onchange="hpcShow()">';
for (i in imageOsvers) {
parm += '<option value="' + imageOsvers[i] + '">' + imageOsvers[i] + '</option>';
}
parm += '</select></div>';
// Drop down for OS versions
var osVerSelect = $('<select id="osvers" onchange="hpcShow()"></select>');
for (var i in imageOsVers)
osVerSelect.append('<option value="' + imageOsVers[i] + '">' + imageOsVers[i] + '</option>');
createImgFS.append($('<div><label>OS version:</label></div>').append(osVerSelect));
// OS arch selector
parm += '<div><label>OS architecture:</label><select id="osarch" onchange="hpcShow()">';
for (i in imageArch) {
parm += '<option value="' + imageArch[i] + '">' + imageArch[i] + '</option>';
}
parm += '</select></div>';
// Drop down for OS architectures
var imgSelect = $('<select id="osarch" onchange="hpcShow()"></select>');
for (var i in imageArch)
imgSelect.append('<option value="' + imageArch[i] + '">' + imageArch[i] + '</option>');
createImgFS.append($('<div><label>OS architecture:</label></div>').append(imgSelect));
// Netboot interface input
parm += '<div><label>Netboot interface:</label><input type="text" id="netbootif"></div>';
createImgFS.append($('<div><label>Netboot interface:</label><input type="text" id="netbootif"/></div>'));
// Profile selector
parm += '<div><label>Profile:</label><select id="profile" onchange="hpcShow()">';
for (i in profileArray) {
parm += '<option value="' + profileArray[i] + '">' + profileArray[i] + '</option>';
}
parm += '</select></div>';
var profileSelect = $('<select id="profile" onchange="hpcShow()">');
for (var i in profiles)
profileSelect.append('<option value="' + profiles[i] + '">' + profiles[i] + '</option>');
createImgFS.append($('<div><label>Profile:</label></div>').append(profileSelect));
// Boot method selector
parm += '<div><label>Boot method:</label><select id="bootmethod"><option value="stateless">stateless</option></select></div>';
createImgForm.append(parm);
createHpcSelect(createImgForm);
// Boot method drop down
createImgFS.append($('<div><label>Boot method:</label>' +
'<select id="bootmethod">' +
'<option value="stateless">stateless</option>' +
'<option value="statelite">statelite</option>' +
'</select></div>'));
// Create HPC software stack fieldset
createHpcFS(createImgForm);
// The button used to create images is created here
var createImageBtn = createButton("Create");
@ -373,39 +371,40 @@ function loadCreateImage() {
createImgForm.append(createImageBtn);
// Add and show the tab
// Add tab
tab.add(tabId, 'Create', createImgForm, true);
tab.select(tabId);
// Check the selected osver and osarch for hcp stack select
// If they are valid, show the hpc stack select area
// Check the selected OS version and OS arch for HPC stack
// If they are valid, show the HCP stack fieldset
hpcShow();
}
/**
* Create HPC select
* Create HPC fieldset
*
* @param container
* The container to hold the HPC select
* @return HPC select appended to the container
* The container to hold the HPC fieldset
* @return Nothing
*/
function createHpcSelect(container) {
function createHpcFS(container) {
var hpcFieldset = $('<fieldset id="hpcsoft"></fieldset>');
hpcFieldset.append('<legend>HPC Software Stack</legend>');
var str = 'Before selecting the software, you should have the following already completed for your xCAT cluster:<br/><br/>'
+ '1. If you are using xCAT hierarchy, your service nodes are installed and running.<br/>'
+ '2. Your compute nodes are defined to xCAT, and you have verified your hardware control capabilities, '
var str = 'Before selecting the software, you should have the following already completed on your xCAT cluster:<br/><br/>'
+ '1. If you are using the xCAT hierarchy, your service nodes are installed and running.<br/>'
+ '2. Your compute nodes are defined in xCAT, and you have verified your hardware control capabilities, '
+ 'gathered MAC addresses, and done all the other necessary preparations for a diskless install.<br/>'
+ '3. You should have a diskless image created with the base OS installed and verified on at least one test node.<br/>'
+ '4. You should install the softwares on the management node, and copy all correponding packages into the location ' + '"/install/custom/otherpkgs/" based on '
+ '<a href="http://sourceforge.net/apps/mediawiki/xcat/index.php?title=IBM_HPC_Stack_in_an_xCAT_Cluster" target="_blank">these documentations</a>.<br/>';
+ '3. You should have a diskless image created with the base OS installed and verified it on at least one test node.<br/>'
+ '4. You should install the software on the management node and copy all correponding packages into the location "/install/custom/otherpkgs/" based on '
+ 'these <a href="http://sourceforge.net/apps/mediawiki/xcat/index.php?title=IBM_HPC_Stack_in_an_xCAT_Cluster" target="_blank">documents</a>.<br/>';
hpcFieldset.append(createInfoBar(str));
// Advanced software when select the compute profile
// Advanced software
str = '<div id="partlysupport"><ul><li id="gpfsli"><input type="checkbox" onclick="softwareCheck(this)" name="gpfs">GPFS</li>' +
'<li id="rsctli"><input type="checkbox" onclick="softwareCheck(this)" name="rsct">RSCT</li>' +
'<li id="peli"><input type="checkbox" onclick="softwareCheck(this)" name="pe">PE</li>' +
'<li id="esslli"><input type="checkbox" onclick="esslCheck(this)" name="essl">ESSl&PESSL</li>' +
'<li id="esslli"><input type="checkbox" onclick="esslCheck(this)" name="essl">ESSl & PESSL</li>' +
'</ul></div>' +
'<div><ul><li id="gangliali"><input type="checkbox" onclick="softwareCheck(this)" name="ganglia">Ganglia</li>' +
'</ul></div>';

View File

@ -1,67 +1,67 @@
rconsTerm = function(nodeName, height, width){
var sid=nodeName;
rconsTerm = function(nodeName, height, width) {
var sid = nodeName;
var keyBuf = [];
var receivingFlag = false;
var sendTimeout;
var errorTimeout;
var sendTimeout = "";
var errorTimeout = "";
var queryStable = 's=' + sid + '&w=' + height + '&h=' + width + '&c=1&k=';
var maxDelay = 200;
var firstFlag = true;
var workingStatus;
var termArea;
var errorArea;
var ie=0;
if(window.ActiveXObject){
ie=1;
var workingStatus = "";
var termArea = "";
var errorArea = "";
var ie = 0;
if (window.ActiveXObject) {
ie = 1;
}
rconsInit();
//init
function rconsInit(){
//create status, configure the css
// init
function rconsInit() {
// create status, configure the css
workingStatus = $('<span>.</span>');
workingStatus.attr('class', 'off');
//create the disconnect button
// create the disconnect button
var disconnectButton = $('<a class="off">Disconnect</a>');
disconnectButton.bind('click', function(){
disconnectButton.bind('click', function() {
window.close();
});
//create the control panel, add to the rcons div
// create the control panel, add to the rcons div
var controlPanel = $('<pre class="stat"></pre>');
$('#term').append(controlPanel);
//create the error erea
// create the error erea
errorArea = $('<span></span>');
//add all item to controlPanel
// add all item to controlPanel
controlPanel.append(workingStatus);
controlPanel.append(disconnectButton);
controlPanel.append(errorArea);
//create the termArea
// create the termArea
termArea = $('<div></div>');
$('#term').append(termArea);
//bind keypress event
document.onkeypress=rconsKeypress;
document.onkeydown=rconsKeydown;
window.onbeforeunload = function(){
// bind keypress event
document.onkeypress = rconsKeypress;
document.onkeydown = rconsKeydown;
window.onbeforeunload = function() {
rconsDisconnect();
alert("This rcons page is closed.");
alert("Closing remote console");
};
rconsSend();
}
//close the connection
function rconsDisconnect(){
// close the connection
function rconsDisconnect() {
window.clearTimeout(sendTimeout);
window.clearTimeout(errorTimeout);
$.ajax({
type : "POST",
url : "lib/rcons.php",
@ -70,153 +70,217 @@ rconsTerm = function(nodeName, height, width){
});
}
//translate the key press
function rconsKeypress(event){
if (!event) var event=window.event;
var kc;
var k="";
// translate the key press
function rconsKeypress(event) {
if (!event)
var event = window.event;
var kc = "";
var k = "";
if (event.keyCode)
kc=event.keyCode;
kc = event.keyCode;
if (event.which)
kc=event.which;
kc = event.which;
if (event.altKey) {
if (kc>=65 && kc<=90)
kc+=32;
if (kc>=97 && kc<=122) {
k=String.fromCharCode(27)+String.fromCharCode(kc);
if (kc >= 65 && kc <= 90)
kc += 32;
if (kc >= 97 && kc <= 122) {
k = String.fromCharCode(27) + String.fromCharCode(kc);
}
} else if (event.ctrlKey) {
if (kc>=65 && kc<=90) k=String.fromCharCode(kc-64); // Ctrl-A..Z
else if (kc>=97 && kc<=122) k=String.fromCharCode(kc-96); // Ctrl-A..Z
else if (kc==54) k=String.fromCharCode(30); // Ctrl-^
else if (kc==109) k=String.fromCharCode(31); // Ctrl-_
else if (kc==219) k=String.fromCharCode(27); // Ctrl-[
else if (kc==220) k=String.fromCharCode(28); // Ctrl-\
else if (kc==221) k=String.fromCharCode(29); // Ctrl-]
else if (kc==219) k=String.fromCharCode(29); // Ctrl-]
else if (kc==219) k=String.fromCharCode(0); // Ctrl-@
} else if (event.which==0) {
if (kc==9) k=String.fromCharCode(9); // Tab
else if (kc==8) k=String.fromCharCode(127); // Backspace
else if (kc==27) k=String.fromCharCode(27); // Escape
if (kc >= 65 && kc <= 90)
k = String.fromCharCode(kc - 64); // Ctrl-A..Z
else if (kc >= 97 && kc <= 122)
k = String.fromCharCode(kc - 96); // Ctrl-A..Z
else if (kc == 54)
k = String.fromCharCode(30); // Ctrl-^
else if (kc == 109)
k = String.fromCharCode(31); // Ctrl-_
else if (kc == 219)
k = String.fromCharCode(27); // Ctrl-[
else if (kc == 220)
k = String.fromCharCode(28); // Ctrl-\
else if (kc == 221)
k = String.fromCharCode(29); // Ctrl-]
else if (kc == 219)
k = String.fromCharCode(29); // Ctrl-]
else if (kc == 219)
k = String.fromCharCode(0); // Ctrl-@
} else if (event.which == 0) {
if (kc == 9)
k = String.fromCharCode(9); // Tab
else if (kc == 8)
k = String.fromCharCode(127); // Backspace
else if (kc == 27)
k = String.fromCharCode(27); // Escape
else {
if (kc==33) k="[5~"; // PgUp
else if (kc==34) k="[6~"; // PgDn
else if (kc==35) k="[4~"; // End
else if (kc==36) k="[1~"; // Home
else if (kc==37) k="[D"; // Left
else if (kc==38) k="[A"; // Up
else if (kc==39) k="[C"; // Right
else if (kc==40) k="[B"; // Down
else if (kc==45) k="[2~"; // Ins
else if (kc==46) k="[3~"; // Del
else if (kc==112) k="[[A"; // F1
else if (kc==113) k="[[B"; // F2
else if (kc==114) k="[[C"; // F3
else if (kc==115) k="[[D"; // F4
else if (kc==116) k="[[E"; // F5
else if (kc==117) k="[17~"; // F6
else if (kc==118) k="[18~"; // F7
else if (kc==119) k="[19~"; // F8
else if (kc==120) k="[20~"; // F9
else if (kc==121) k="[21~"; // F10
else if (kc==122) k="[23~"; // F11
else if (kc==123) k="[24~"; // F12
if (kc == 33)
k = "[5~"; // PgUp
else if (kc == 34)
k = "[6~"; // PgDn
else if (kc == 35)
k = "[4~"; // End
else if (kc == 36)
k = "[1~"; // Home
else if (kc == 37)
k = "[D"; // Left
else if (kc == 38)
k = "[A"; // Up
else if (kc == 39)
k = "[C"; // Right
else if (kc == 40)
k = "[B"; // Down
else if (kc == 45)
k = "[2~"; // Ins
else if (kc == 46)
k = "[3~"; // Del
else if (kc == 112)
k = "[[A"; // F1
else if (kc == 113)
k = "[[B"; // F2
else if (kc == 114)
k = "[[C"; // F3
else if (kc == 115)
k = "[[D"; // F4
else if (kc == 116)
k = "[[E"; // F5
else if (kc == 117)
k = "[17~"; // F6
else if (kc == 118)
k = "[18~"; // F7
else if (kc == 119)
k = "[19~"; // F8
else if (kc == 120)
k = "[20~"; // F9
else if (kc == 121)
k = "[21~"; // F10
else if (kc == 122)
k = "[23~"; // F11
else if (kc == 123)
k = "[24~"; // F12
if (k.length) {
k=String.fromCharCode(27)+k;
k = String.fromCharCode(27) + k;
}
}
} else {
if (kc==8)
k=String.fromCharCode(127); // Backspace
if (kc == 8)
k = String.fromCharCode(127); // Backspace
else
k=String.fromCharCode(kc);
k = String.fromCharCode(kc);
}
if(k.length) {
if(k=="+") {
if (k.length) {
if (k == "+") {
rconsQueue("%2B");
} else {
rconsQueue(escape(k));
}
}
event.cancelBubble=true;
if (event.stopPropagation) event.stopPropagation();
if (event.preventDefault) event.preventDefault();
return false;
event.cancelBubble = true;
if (event.stopPropagation)
event.stopPropagation();
if (event.preventDefault)
event.preventDefault();
return false;
}
//translate the key press, same with rconsKeypress
function rconsKeydown(event){
if (!event) var event=window.event;
// translate the key press, same with rconsKeypress
function rconsKeydown(event) {
if (!event)
var event = window.event;
if (ie) {
o={9:1,8:1,27:1,33:1,34:1,35:1,36:1,37:1,38:1,39:1,40:1,45:1,46:1,112:1, 113:1,114:1,115:1,116:1,117:1,118:1,119:1,120:1,121:1,122:1,123:1};
o = {
9 : 1,
8 : 1,
27 : 1,
33 : 1,
34 : 1,
35 : 1,
36 : 1,
37 : 1,
38 : 1,
39 : 1,
40 : 1,
45 : 1,
46 : 1,
112 : 1,
113 : 1,
114 : 1,
115 : 1,
116 : 1,
117 : 1,
118 : 1,
119 : 1,
120 : 1,
121 : 1,
122 : 1,
123 : 1
};
if (o[event.keyCode] || event.ctrlKey || event.altKey) {
event.which=0;
event.which = 0;
return keypress(event);
}
}
}
//send the command and request to server
function rconsSend(){
// send the command and request to server
function rconsSend() {
var keyPressList = '';
var requireString = '';
if(receivingFlag){
if (receivingFlag) {
return;
}
receivingFlag = true;
workingStatus.attr('class', 'on');
while(keyBuf.length > 0){
keyPressList += keyBuf.pop();
while (keyBuf.length > 0) {
keyPressList += keyBuf.pop();
}
if (firstFlag){
if (firstFlag) {
requireString = queryStable + keyPressList + '&f=1';
firstFlag = false;
} else{
} else {
requireString = queryStable + keyPressList;
}
$.ajax({
type : "POST",
url : "lib/rcons.php",
data : requireString,
dataType : 'json',
success : function(data){
rconsUpdate(data);
}
success : function(data) {
rconsUpdate(data);
}
});
errorTimeout = window.setTimeout(rconsSendError, 15000);
}
//when receive the response, update the term area
function rconsUpdate(data){
// when receive the response, update the term area
function rconsUpdate(data) {
window.clearTimeout(errorTimeout);
errorArea.empty();
if (data.term){
if (data.term) {
termArea.empty().append(data.term);
maxDelay = 200;
} else{
} else {
maxDelay = 2000;
}
receivingFlag = false;
workingStatus.attr('class', 'off');
sendTimeout = window.setTimeout(rconsSend, maxDelay);
}
function rconsSendError(){
function rconsSendError() {
workingStatus.attr('class', 'off');
errorArea.empty().append('Send require error.');
}
function rconsQueue(kc){
function rconsQueue(kc) {
keyBuf.unshift(kc);
if (false == receivingFlag){
if (false == receivingFlag) {
window.clearTimeout(sendTimeout);
sendTimeout = window.setTimeout(rconsSend, 1);
}

View File

@ -800,7 +800,7 @@ function createIFrame(src) {
function openSettings() {
// Create form to add node range
var dialog = $('<div class="form"></div>');
var info = createInfoBar('Select the settings you desire');
var info = createInfoBar('Select from the following options');
dialog.append(info);
var style = {