From 1cd9a914388c2eeddccf1f139be412131b9df515 Mon Sep 17 00:00:00 2001 From: phamt Date: Mon, 20 Dec 2010 14:52:48 +0000 Subject: [PATCH] Added configure xCAT monitoring link in status tooltip. Created dialog to start/stop xCAT monitor on nodes page. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8483 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/monitor/gangliamon.js | 4 +- xCAT-UI/js/nodes/nodes.js | 129 +++++++++++++++++++++++++++++-- 2 files changed, 126 insertions(+), 7 deletions(-) diff --git a/xCAT-UI/js/monitor/gangliamon.js b/xCAT-UI/js/monitor/gangliamon.js index a117e65d1..f2bc33c48 100644 --- a/xCAT-UI/js/monitor/gangliamon.js +++ b/xCAT-UI/js/monitor/gangliamon.js @@ -458,11 +458,11 @@ function loadNodes4Ganglia(data) { $('#nodesDataTable tbody tr td:nth-child(5)').css(style); // Instead refresh the ping status and power status - pingCol.bind('click', function(event) { + pingCol.find('span a').bind('click', function(event) { refreshNodeStatus(group); }); - powerCol.bind('click', function(event) { + powerCol.find('span a').bind('click', function(event) { refreshPowerStatus(group); }); diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index ed06263fe..bd9967b20 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -682,10 +682,10 @@ function loadNodes(data) { $('#nodesDataTable tbody tr td:nth-child(5)').css('text-align', 'center'); // Instead refresh the node status and power status - pingCol.bind('click', function(event) { + pingCol.find('span a').bind('click', function(event) { refreshNodeStatus(group); }); - powerCol.bind('click', function(event) { + powerCol.find('span a').bind('click', function(event) { refreshPowerStatus(group); }); @@ -1972,10 +1972,40 @@ function createCommentsToolTip(comment) { */ function createStatusToolTip() { // Create tooltip container - var toolTip = $('
Click here to refresh the node status
').css({ - 'height': '50px', + var toolTip = $('
').css({ 'width': '150px' }); + + // Create info text + var info = $('

'); + info.append('Click here to refresh the node status. To configure the xCAT monitor, '); + + // Create link to turn on xCAT monitoring + var monitorLnk = $('click here').css({ + 'color': '#58ACFA', + 'font-size': '10px' + }); + + // Open dialog to configure xCAT monitor + monitorLnk.bind('click', function(){ + // Check if xCAT monitor is enabled + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'monls', + tgt : '', + args : 'xcatmon', + msg : '' + }, + + success : openConfXcatMon + }); + }); + + info.append(monitorLnk); + toolTip.append(info); + return toolTip; } @@ -1987,12 +2017,101 @@ function createStatusToolTip() { function createPowerToolTip() { // Create tooltip container var toolTip = $('
Click here to refresh the power status
').css({ - 'height': '50px', 'width': '150px' }); return toolTip; } +/** + * Open dialog to configure xCAT monitor + * + * @param data + * Data returned from HTTP request + * @return Nothing + */ +function openConfXcatMon(data) { + // Create info bar + var info = createInfoBar('Configure the xCAT monitor. Select to enable or disable the monitor below.'); + var dialog = $('
'); + dialog.append(info); + + // Create status area + var statusArea = $('
').css('padding-top', '10px'); + var label = $(''); + statusArea.append(label); + + // Get xCAT monitor status + var status = data.rsp[0]; + var buttons; + // If xCAT monitor is disabled + if (status.indexOf('not-monitored') > -1) { + status = $('Disabled').css('padding', '0px 5px'); + statusArea.append(status); + + // Create enable and cancel buttons + buttons = { + "Enable": function(){ + // Enable xCAT monitor + $.ajax({ + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'monstart', + tgt : '', + args : 'xcatmon', + msg : '' + }, + + success : function(data){ + openDialog('info', data.rsp[0]); + } + }); + $(this).dialog("close"); + }, + "Cancel": function(){ + $(this).dialog("close"); + } + }; + } else { + status = $('Enabled').css('padding', '0px 5px'); + statusArea.append(status); + + // Create disable and cancel buttons + buttons = { + "Disable": function(){ + // Disable xCAT monitor + $.ajax({ + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'monstop', + tgt : '', + args : 'xcatmon', + msg : '' + }, + + success : function(data){ + openDialog('info', data.rsp[0]); + } + }); + $(this).dialog("close"); + }, + "Cancel": function(){ + $(this).dialog("close"); + } + }; + } + + dialog.append(statusArea); + + // Open dialog + dialog.dialog({ + modal: true, + width: 500, + buttons: buttons + }); +} + /** * Show chdef output *