var globalErrNodes;
var globalNodesDetail;
var globalAllNodesNum = 0;
var globalFinishNodesNum = 0;
var globalSelectedAttributes = '';
var globalTimeStamp;
var globalCondition = '';
var globalResponse = new Object();
function loadRmcMon(){
//find the rmcmon tab
var rmcMonTab = $('#rmcmon');
//add the stauts bar first. id = 'rmcMonStatus'
var rmcStatusBar = createStatusBar('rmcMonStatus');
rmcStatusBar.append(createLoader());
rmcMonTab.append(rmcStatusBar);
//add the configure button.
var configButton = createButton('Configure');
configButton.hide();
configButton.click(function(){
if ($('#rmcMonConfig').is(':hidden')){
$('#rmcMonConfig').show();
}
else{
$('#rmcMonConfig').hide();
}
});
rmcMonTab.append(configButton);
//add configure div
rmcMonTab.append("
");
$('#rmcMonConfig').hide();
//load the configure div's content
loadRmcMonConfigure();
//add the content of the rmcmon, id = 'rmcMonTab'
rmcMonTab.append("
");
$('#nodeDetail').hide();
//check the software work status by platform(linux and aix)
$.ajax( {
url : 'lib/systemcmd.php',
dataType : 'json',
data : {
cmd : 'ostype'
},
success : rsctRpmCheck
});
}
function loadRmcMonConfigure(){
//get the configure div and clean its content.
var rmcmonCfgDiv = $('#rmcMonConfig');
rmcmonCfgDiv.empty();
//add the start button
var startButton = createButton('Start');
rmcmonCfgDiv.append(startButton);
startButton.click(function(){
$('#rmcMonStatus').empty().append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'rmcstart;lpar',
msg : ''
},
success : function(data){
$('#rmcMonStatus').empty().append(data.rsp[0]);
}
});
});
//add the stop button
var stopButton = createButton('Stop');
rmcmonCfgDiv.append(stopButton);
stopButton.click(function(){
$('#rmcMonStatus').empty().append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'monstop',
tgt : '',
args : 'rmcmon',
msg : ''
},
success : function(data){
$('#rmcMonStatus').empty().append(data.rsp[0]);
}
});
});
//add the attributes button
var attrButton = createButton('Attribute Select');
rmcmonCfgDiv.append(attrButton);
attrButton.bind('click',function(){
showConfigureDia();
});
//add the cancel button
var cancelButton = createButton('Cancel');
rmcmonCfgDiv.append(cancelButton);
cancelButton.click(function(){
$('#rmcMonConfig').hide();
});
}
function rsctRpmCheck(data){
//linux had to check the rscp first
if ('aix' != data.rsp){
$.ajax( {
url : 'lib/systemcmd.php',
dataType : 'json',
data : {
cmd : 'rpm -q rsct.core'
},
success : function(data){
if (-1 != data.rsp.indexOf("not")){
$('#rmcMonStatus').empty().append(
'Please install the RSCT first. ' +
'You can find more support from xCAT2-Monitoring.pdf');
}
else{
xcatrmcRpmCheck();
}
}
});
}
else{
xcatrmcRpmCheck();
}
}
function xcatrmcRpmCheck(){
$.ajax( {
url : 'lib/systemcmd.php',
dataType : 'json',
data : {
cmd : 'rpm -q xCAT-rmc rrdtool'
},
success : function(data){
var softInstallStatus = data.rsp.split(/\n/);
var needHelp = false;
$('#rmcMonStatus').empty();
//check the xcat-rmc
if (-1 != softInstallStatus[0].indexOf("not")){
needHelp = true;
$('#rmcMonStatus').append(
'Please install the xCAT-rmc first. ');
}
//check the rrdtool
if (-1 != softInstallStatus[1].indexOf("not")){
needHelp = true;
$('#rmcMonStatus').append(
'Please install the RRD-tool first. ');
}
//add help info or load the rmc show
if (needHelp){
$('#rmcMonStatus').append(
'You can find more support form xCAT2-Monitoring.pdf');
}
else{
rmcWorkingCheck();
}
}
});
}
function rmcWorkingCheck(){
$('#rmcMonStatus').empty().append("Checking RMC working status.");
$('#rmcMonStatus').append(createLoader());
$('#rmcmon button:first').show();
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'monls',
tgt : '',
args : 'rmcmon',
msg : ''
},
success : function(data){
if (-1 != data.rsp[0].indexOf("not-monitored")){
$('#rmcMonStatus').empty().append("Please start the RMC Monitoring first.");
return;
}
loadRmcMonShow();
}
});
}
function loadRmcMonShow(){
$('#rmcMonStatus').empty().append("Getting monitoring Data (This step may take a long time).");
$('#rmcMonStatus').append(createLoader());
//init the selected Attributes string
if ($.cookie('rmcmonattr')){
globalSelectedAttributes = $.cookie('rmcmonattr');
}
else{
globalSelectedAttributes = 'PctTotalTimeIdle,PctTotalTimeWait,PctTotalTimeUser,PctTotalTimeKernel,PctRealMemFree';
}
//load the rmc status summary
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'rmcshow;summary;' + globalSelectedAttributes,
msg : ''
},
success : function(data){
showRmcSummary(data.rsp[0]);
}
});
}
function showRmcSummary(returnData){
var attributes = returnData.split(';');
var attr;
var attrName;
var attrValues;
var attrDiv;
var summaryTable = $('
');
var summaryRow;
globalTimeStamp = new Array();
//load each nodes' status
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'rmcshow;lpar;' + globalSelectedAttributes,
msg : ''
},
success : function(data){
parseRmcData(data.rsp);
}
});
//create the timestamp, the flot only use the UTC time, so had to change the value, to show the right time
var tempDate = new Date();
var tempOffset = tempDate.getTimezoneOffset();
var tempTime = tempDate.getTime() - 3600000 - tempOffset * 60000;
for (var i = 0; i < 60; i++){
globalTimeStamp.push(tempTime + i * 60000);
}
//show the summary data
$('#rmcmonSummary').empty().append('
Overview
');
$('#rmcmonSummary').append(summaryTable);
for ( attr in attributes){
var tempTd = $('
');
var tempArray = [];
var temp = attributes[attr].indexOf(':');
attrName = attributes[attr].substr(0, temp);
attrValues = attributes[attr].substr(temp + 1).split(',');
for (var i in attrValues){
tempArray.push([globalTimeStamp[i], attrValues[i]]);
}
if (0 == (attr % 3)){
summaryRow = $('
');
}
}
function parseRmcData(returnData){
var nodeName;
var nodeStatus;
var nodeChat;
//clean all the history data, because all of the follow variables are global
globalAllNodesNum = returnData.length;
globalFinishNodesNum = 0;
globalErrNodes = {};
globalNodesDetail = {};
for (var i in returnData){
var temp = returnData[i].indexOf(':');;
nodeName = returnData[i].substr(0, temp);
nodeStatus = returnData[i].substr(temp + 1).replace(/(^\s*)|(\s*$)/g, '');
//not active nodes
if ('OK' != nodeStatus){
globalErrNodes[nodeName] = nodeStatus;
globalFinishNodesNum ++;
if (globalFinishNodesNum == globalAllNodesNum){
showDetail();
}
continue;
}
//ok
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'rmcshow;' + nodeName + ';' + globalSelectedAttributes,
msg : nodeName
},
success : function(data){
var tempObject = {};
for (var i in data.rsp){
var temp = data.rsp[i].indexOf(':');
var attrName = data.rsp[i].substr(0, temp);
tempObject[attrName] = data.rsp[i].substr(temp + 1);
}
globalNodesDetail[data.msg] = tempObject;
globalFinishNodesNum++;
if (globalFinishNodesNum == globalAllNodesNum){
showDetail();
}
}
});
}
}
function showDetail(){
var nodeChat;
var select;
var detailFilter = $('');
$('#rmcMonStatus').empty().append("RMC Monitoring Show");
$('#rmcmonDetail').empty().append('
Detail
');
$('#rmcmonDetail').append(detailFilter);
select = $('');
for (var node in globalNodesDetail){
for (var attr in globalNodesDetail[node]){
select.append('');
}
break;
}
detailFilter.append('Metric: ');
detailFilter.append(select);
detailFilter.append(' ');
//sort type
select = $('');
select.append('');
select.append('');
select.append('');
detailFilter.append('Sort: ');
detailFilter.append(select);
detailFilter.append(' ');
var filterButton = createButton('Filter');
detailFilter.append(filterButton);
filterButton.bind('click', function(){
var attr = $('#metric').val();
var type = $('#sortType').val();
showAllNodes(attr, type);
});
filterButton.trigger('click');
}
function showAllNodes(attrName, type){
$('#rmcmonDetail table').remove();
var detailTable = $('
');
//remember how many nodes parsed, used for adding new table row
var parseNum = 0;
var detailRow;
var sortArray = new Array();
$('#rmcmonDetail').append(detailTable);
for (var nodeName in globalErrNodes){
var tempTd = $('
');
}
else if ('NI' == globalErrNodes[nodeName]){
nodeChat.css('background-color', '#ffce7b');
nodeChat.append('
' + nodeName + '\'s RSCT is not installed.
');
}
else if ('NR' == globalErrNodes[nodeName]){
nodeChat.css('background-color', '#ffce7b');
nodeChat.append('
' + nodeName + '\'s RSCT is not started.
');
}
tempTd.append(nodeChat);
tempTd.append('
' + nodeName + '
');
}
filterSort(attrName, type, sortArray);
for (var sortIndex in sortArray){
var tempTd = $('
');
if (0 == (parseNum % 4)){
detailRow = $('
');
detailTable.append(detailRow);
}
detailRow.append(tempTd);
parseNum ++;
nodeChat = $('');
tempTd.append(nodeChat);
var tempData = sortArray[sortIndex]['value'].split(',');
var tempArray = [];
for (var i in tempData){
tempArray.push([globalTimeStamp[i], tempData[i]]);
}
$.plot(nodeChat, [tempArray], {xaxis: {mode:"time", tickSize: [20, "minute"]}});
tempTd.append('
' + sortArray[sortIndex]['name'] + '
');
tempTd.css('cursor', 'pointer');
tempTd.bind('click', function(){
showNode($('center', $(this)).html());
});
}
}
function showNode(nodeName){
var nodeTable = $('
');
var backButton = createButton('Go back to all nodes');
var nodeRow;
var parseNum = 0;
$('#rmcmonDetail').hide();
$('#nodeDetail').empty().show();
$('#nodeDetail').append('
' + nodeName +' Detail
');
$('#nodeDetail').append(backButton);
backButton.bind('click', function(){
$('#nodeDetail').hide();
$('#rmcmonDetail').show();
});
$('#nodeDetail').append(nodeTable);
for(var attr in globalNodesDetail[nodeName]){
var tempTd = $('
');
var attrChat = $('');
if (0 == parseNum % 4){
nodeRow = $('
');
nodeTable.append(nodeRow);
}
nodeRow.append(tempTd);
parseNum++;
//data
tempTd.append(attrChat);
var tempData = globalNodesDetail[nodeName][attr].split(',');
var tempArray = [];
for (var i in tempData){
tempArray.push([globalTimeStamp[i], tempData[i]]);
}
$.plot(attrChat, [tempArray], {xaxis: {mode:"time", tickSize: [20, "minute"]}});
attrChat.append('
' + attr +'
');
}
}
function filterSort(attrName, sortType, retArray){
var tempObj = {};
for (var node in globalNodesDetail){
tempObj['name'] = node;
tempObj['value'] = globalNodesDetail[node][attrName];
retArray.push(tempObj);
}
//by node name
if (3 == sortType){
retArray.sort(sortName);
}
//desend
else if (2 == sortType){
retArray.sort(sortDes);
}
//ascend
else{
retArray.sort(sortAsc);
}
return;
}
function sortAsc(x, y){
if (x['value'] > y['value']){
return 1;
}
else{
return -1;
}
}
function sortDes(x, y){
if (x['value'] > y['value']){
return -1;
}
else{
return 1;
}
}
function sortName(x, y){
if (x['name'] > y['name']){
return 1;
}
else{
return -1;
}
}
function showConfigureDia(){
var diaDiv = $('');
var tempArray = globalSelectedAttributes.split(',');
var selectedAttrHash = new Object();
var wholeAttrArray = new Array('PctTotalTimeIdle','PctTotalTimeWait','PctTotalTimeUser','PctTotalTimeKernel','PctRealMemFree');
//init the selectedAttrHash
for (var i in tempArray){
selectedAttrHash[tempArray[i]] = 1;
}
var attrTable = $('
');
for (var i in wholeAttrArray){
var name = wholeAttrArray[i];
var tempString = '
';
if (selectedAttrHash[name]){
tempString += '
';
}
else{
tempString += '
';
}
tempString += '
' + name + '
';
attrTable.append(tempString);
}
var selectAllButton = createButton('Select All');
selectAllButton.bind('click', function(){
$('#rmcAttrTable input[type=checkbox]').attr('checked', true);
});
diaDiv.append(selectAllButton);
var unselectAllButton = createButton('Unselect All');
unselectAllButton.bind('click', function(){
$('#rmcAttrTable input[type=checkbox]').attr('checked', false);
});
diaDiv.append(unselectAllButton);
diaDiv.append(attrTable);
diaDiv.dialog({
modal: true,
width: 400,
close: function(event, ui){
$(this).remove();
},
buttons: {
cancel : function(){
$(this).dialog('close');
},
ok : function(){
//collect all attibutes' name
var str = '';
$('#rmcAttrTable input:checked').each(function(){
if ('' == str){
str += $(this).attr('name');
}
else{
str += ',' + $(this).attr('name');
}
});
//if no attribute is selected, alert the information.
if ('' == str){
alert('Please select one attribute at lease!');
return;
}
//new selected attributes is different from the old, update the cookie and reload this tab
if ($.cookie('rmcmonattr') != str){
$.cookie('rmcmonattr', str, {path : '/xcat', expires : 10});
//todo reload the tab
$('#rmcmon').empty();
loadRmcMon();
}
$(this).dialog('close');
}
}
});
}
/*===========RMC Event Tab============*/
/**
* load the rmc event tab.
*
* @param
*
* @return
*
*/
function loadRmcEvent(){
//find the rmcevent tab
//add the stauts bar first. id = 'rmcMonStatus'
var rmcStatusBar = createStatusBar('rmcEventStatus');
rmcStatusBar.append(createLoader());
$('#rmcevent').append(rmcStatusBar);
$('#rmcevent').append('');
$.ajax( {
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'lsevent;-O;1000',
msg : ''
},
success : showEventLog
});
}
/**
* get all conditions
*
* @return
*
*/
function getConditions(){
if ('' == globalCondition){
$('#rmcEventStatus').empty().append('Getting predefined conditions').append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'lscondition',
msg : ''
},
success : function (data){
$('#rmcEventStatus').empty();
$('#rmcEventButtons').show();
globalCondition = data.rsp[0];
}
});
}
else{
$('#rmcEventButtons').show();
}
}
/**
* get all response
*
* @return
*
*/
function getResponse(){
var tempFlag = false;
//get all response first
for (var i in globalResponse){
tempFlag = true;
break;
}
if (!tempFlag){
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'lsresponse',
msg : ''
},
success : function(data){
var resps = data.rsp[0].split(';');
for (var i in resps){
var name = resps[i];
name = name.substr(1, (name.length - 2));
globalResponse[name] = 1;
}
}
});
}
}
/**
* show all the event in the rmc event tab
*
* @param data response from the xcat server.
* @return
*
*/
function showEventLog(data){
$('#rmcEventStatus').empty();
//rsct not installed.
if (data.rsp[0] && (-1 != data.rsp[0].indexOf('lsevent'))){
$('#rmcEventStatus').append('Please install RSCT first!');
return;
}
var eventDiv = $('#rmcEventDiv');
eventDiv.empty();
//add the configure button
loadRmcEventConfig();
//get conditions and responses, save in the global
getConditions();
getResponse();
var eventTable = new DataTable('lsEventTable');
eventTable.init(['Time', 'Type', 'Content']);
for (var i in data.rsp){
var row = data.rsp[i].split(';');
eventTable.add(row);
}
eventDiv.append(eventTable.object());
$('#lsEventTable').dataTable({
'bFilter' : true,
'bLengthChange' :true,
'bSort' :true,
'bPaginate' :true,
'iDisplayLength' :10
});
//unsort on the content column
$('#lsEventTable thead tr th').eq(2).unbind('click');
}
/**
* Add the configure button into rmc event tab
*
* @param
* @return
*
*/
function loadRmcEventConfig(){
var buttons = $('');
var chCondScopeBut = createButton('Change Condition Scope');
chCondScopeBut.bind('click', function(){
chCondScopeDia();
});
buttons.append(chCondScopeBut);
var mkCondRespBut = createButton('Make/Remove Association');
mkCondRespBut.bind('click', function(){
mkCondRespDia();
});
buttons.append(mkCondRespBut);
var startCondRespBut = createButton('Start/Stop Association');
startCondRespBut.bind('click', function(){
startStopCondRespDia();
});
buttons.append(startCondRespBut);
$('#rmcEventDiv').append(buttons);
}
/**
* show the make association dialogue
*
* @param
* @return
*
*/
function mkCondRespDia(){
var diaDiv = $('');
var mkAssociationTable = '
Condition Name
Response Name
';
mkAssociationTable += '
';
//add the conditions into fieldset
if ('' == globalCondition){
mkAssociationTable += 'Getting predefined conditions, open this dislogue later.';
}
else{
mkAssociationTable += createConditionTd(globalCondition);
}
mkAssociationTable += '
');
//change the response field when click the condition
diaDiv.find('input:radio').bind('click', function(){
diaDiv.find('#mkAssResp').empty().append('Getting response').append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'lscondresp;"' + $(this).attr('value') + '"',
msg : ''
},
success : function (data){
var tempHash = new Object();
var oldSelectedResp = '';
var showStr = '';
if (data.rsp[0]){
var names = data.rsp[0].split(';');
for (var i in names){
var name = names[i];
name = name.substr(1, name.length - 2);
tempHash[name] = 1;
}
}
for (var name in globalResponse){
if (tempHash[name]){
showStr += '' + name + ' ';
oldSelectedResp += ';' + name;
}
else{
showStr += '' + name + ' ';
}
}
diaDiv.find('#mkAssResp').empty().append(showStr);
diaDiv.find('#selectedResp').empty().append(oldSelectedResp);
}
});
});
diaDiv.dialog({
modal: true,
width: 620,
height: 600,
close: function(event, ui){
$(this).remove();
},
buttons: {
cancel : function(){
$(this).dialog('close');
},
ok : function(){
var newResp = new Object();
var oldResp = new Object();
var oldString = '';
var newString = '';
//get the old seelected responses
var conditionName = $(this).find('#mkAssCond :checked').attr('value');
if (!conditionName){
return;
}
var temp = $(this).find('#selectedResp').html();
if('' == temp){
return;
}
var tempArray = temp.substr(1).split(';');
for (var i in tempArray){
oldResp[tempArray[i]] = 1;
}
//get the new selected responses
$(this).find('#mkAssResp input:checked').each(function(){
var respName = $(this).attr('value');
newResp[respName] = 1;
});
for (var i in newResp){
if (oldResp[i]){
delete oldResp[i];
delete newResp[i];
}
}
//add the response which are delete.
for (var i in oldResp){
oldString += ',"' + i + '"';
}
if ('' != oldString){
oldString = oldString.substr(1);
}
//add the response which are new add
for (var i in newResp){
newString += ',"' + i +'"';
}
if ('' != newString){
newString = newString.substr(1);
}
if (('' != oldString) || ('' != newString)){
$('#rmcEventStatus').empty().append('Create/Remove associations').append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'mkcondresp;"' + conditionName + '";+' + newString + ':-' + oldString,
msg : ''
},
success : function(data){
$('#rmcEventStatus').empty().append(data.rsp[0]);;
}
});
}
$(this).dialog('close');
}
}
});
}
/**
* show the make condition dialogue
*
* @param
* @return
*
*/
function chCondScopeDia(){
var diaDiv = $('');
var tableContent = '
Condition Name
Group Name
';
tableContent += '
';
//add the conditions into fieldset
if ('' == globalCondition){
tableContent += 'Getting predefined conditions, open this dislogue later.';
}
else{
tableContent += createConditionTd(globalCondition);
}
tableContent += '
';
//add the groups into table
var groups = $.cookie('groups').split(',');
for (var i in groups){
tableContent += '' + groups[i] + ' ';
}
tableContent += '
';
diaDiv.append(tableContent);
//fieldset to show status
diaDiv.append('');
//create the dislogue
diaDiv.dialog({
modal: true,
width: 500,
height : 600,
close: function(event, ui){
$(this).remove();
},
buttons: {
cancel : function(){
$(this).dialog('close');
},
ok : function(){
$('#changeStatus').empty().append('');
var conditionName = $('#changePreCond :checked').attr('value');
var groupName = '';
$('#changeGroup :checked').each(function(){
if ('' == groupName){
groupName += $(this).attr('value');
}
else{
groupName += ',' + $(this).attr('value');
}
});
if (undefined == conditionName){
$('#changeStatus').append('Please select conditon.');
return;
}
if ('' == groupName){
$('#changeStatus').append('Please select group.');
return;
}
$('#changeStatus').append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'mkcondition;change;' + conditionName + ';' + groupName,
msg : ''
},
success : function(data){
$('#changeStatus img').remove();
if (-1 != data.rsp[0].indexOf('Error')){
$('#changeStatus').append(data.rsp[0]);
}
else{
$('#rmcEventStatus').empty().append(data.rsp[0]);
$('#chScopeDiaDiv').remove();
}
}
});
}
}
});
}
/**
* show the make response dialogue
*
* @param
* @return
*
*/
function mkResponseDia(){
var diaDiv = $('
');
diaDiv.append('under construction.');
diaDiv.dialog({
modal: true,
width: 400,
close: function(event, ui){
$(this).remove();
},
buttons: {
cancel : function(){
$(this).dialog('close');
},
ok : function(){
$(this).dialog('close');
}
}
});
}
/**
* start the condition and response associations
*
* @param
* @return
*
*/
function startStopCondRespDia(){
var diaDiv = $('
');
diaDiv.append('Getting conditions').append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'lscondition;-m',
msg : ''
},
success : function(data){
if (data.rsp[0]){
$('#stopAss').empty().append(createConditionTable(data.rsp[0]));
$('#stopAss').dialog("option", "position", 'center');
}
else{
$('#stopAss').empty().append('There is not monitored condition.');
}
}
});
diaDiv.dialog({
modal: true,
width: 570,
close: function(event, ui){
$(this).remove();
},
buttons: {
cancel : function(){
$(this).dialog('close');
},
stop : function(){
var conditionName = $('#stopAss :checked').attr('value');
if (!conditionName){
alert('Select condition name please.');
return;
}
$('#rmcEventStatus').empty().append('Stoping monitor on ' + conditionName).append(createLoader());
$.ajax({
url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webrun',
tgt : '',
args : 'stopcondresp;' + conditionName,
msg : ''
},
success : function(data){
$('#rmcEventStatus').empty().append(data.rsp[0]);
}
});
$(this).dialog('close');
}
}
});
}
/**
* create the condition table for dialogue
*
* @param
* @return
*
*/
function createConditionTd(cond){
var conditions = cond.split(';');
var name = '';
var showStr = '';
for (var i in conditions){
name = conditions[i];
//because there is status and quotation marks in name, so we must delete the status and quotation marks
name = name.substr(1, name.length - 6);
showStr += '' + name + ' ';
}
return showStr;
}
/**
* create the association table for dialogue, which show the status
* and start/stop associations
*
* @param
* @return
*
*/
function createAssociationTable(cond){
var conditions = cond.split(';');
var name = '';
var tempLength = '';
var tempStatus = '';
var showStr = '
Condition Name
Status
Start/Stop
';
showStr += '';
for (var i in conditions){
name = conditions[i];
tempLength = name.length;
tempStatus = name.substr(tempLength - 3);
name = name.substr(1, tempLength - 6);
if ('Not' == tempStatus){
showStr += '