From 971bed5ddff27380eaeef9861864a3f60a82e63e Mon Sep 17 00:00:00 2001 From: phamt Date: Wed, 26 Oct 2011 03:31:22 +0000 Subject: [PATCH] Added refresh button for monitoring and nodes table in self-service portal. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10892 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/custom/zvm.js | 7 ++++++- xCAT-UI/js/service/service.js | 33 +++++++++++++++++++++++++++++---- xCAT-UI/js/ui.js | 4 ++-- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index e943e05ca..3aa6ae261 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -207,10 +207,15 @@ zvmPlugin.prototype.loadServiceInventory = function(data) { * Monitoring section */ fieldSet = $('
'); - legend = $('Monitoring'); + legend = $('Monitoring [Refresh]'); fieldSet.append(legend); getMonitorMetrics(node); + // Refresh monitoring charts on-click + legend.find('a').click(function() { + getMonitorMetrics(node); + }); + // Append to inventory form invDiv.append(fieldSet); diff --git a/xCAT-UI/js/service/service.js b/xCAT-UI/js/service/service.js index 6a23ea84d..dc43fc963 100644 --- a/xCAT-UI/js/service/service.js +++ b/xCAT-UI/js/service/service.js @@ -548,9 +548,34 @@ function loadNodesTable(data) { var actionBar = $('
'); // Prepend menu to datatable - var actionsLnk = 'Actions'; + var actionsLnk = $('Actions'); + var refreshLnk = $('Refresh'); + refreshLnk.click(function() { + var userName = $.cookie('srv_usrname'); + var userNodes = $.cookie(userName + '_usrnodes'); + if (userNodes) { + // Get nodes definitions + $.ajax( { + url : 'lib/srv_cmd.php', + dataType : 'json', + data : { + cmd : 'lsdef', + tgt : '', + args : userNodes, + msg : '' + }, + + success : loadNodesTable + }); + } else { + // Clear the tab before inserting the table + $('#manageTab').children().remove(); + $('#manageTab').append(createWarnBar('You are not managing any node. Try to provision a node.')); + } + }); + var actionMenu = createMenu([cloneLnk, deleteLnk, monitorOnLnk, monitorOffLnk, powerOnLnk, powerOffLnk, unlockLnk]); - var menu = createMenu([[actionsLnk, actionMenu]]); + var menu = createMenu([[actionsLnk, actionMenu], refreshLnk]); menu.superfish(); actionBar.append(menu); @@ -771,7 +796,7 @@ function loadNode(e) { // Get node that was clicked var node = (e.target) ? e.target.id : e.srcElement.id; - + // Create a new tab to show inventory var tabId = node + '_inventory'; @@ -1573,7 +1598,7 @@ function saveNodeLoad(status){ function getMonitorMetrics(node) { // Inventory tab should have this fieldset already created // e.g.
- $('#' + node + '_monitor').children().remove(); + $('#' + node + '_monitor').children('div').remove(); // Before trying to get the metrics, check if Ganglia is running $.ajax({ diff --git a/xCAT-UI/js/ui.js b/xCAT-UI/js/ui.js index 8c8a0466c..368aa8a2d 100644 --- a/xCAT-UI/js/ui.js +++ b/xCAT-UI/js/ui.js @@ -770,8 +770,8 @@ function createIFrame(src) { var iframe = $('').attr('src', src).css({ 'display': 'inline-block', 'border': '0px', - 'margin': '10px 20px', - 'width': '95%' + 'margin': '10px', + 'width': '90%' }); var loader = createLoader('iLoader').css({