From d51368d6803f13863519f88df3d82faa575c8ab5 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 12 Jan 2011 05:54:46 +0000 Subject: [PATCH] start the association behind configure git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8625 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/monitor/rmcmon.js | 71 ++++++++++++++++++++++++++--- xCAT-server/lib/xcat/plugins/web.pm | 2 + 2 files changed, 66 insertions(+), 7 deletions(-) diff --git a/xCAT-UI/js/monitor/rmcmon.js b/xCAT-UI/js/monitor/rmcmon.js index a15c8e7b9..983e21f98 100644 --- a/xCAT-UI/js/monitor/rmcmon.js +++ b/xCAT-UI/js/monitor/rmcmon.js @@ -1125,9 +1125,68 @@ function startStopCondRespDia(){ buttons: { close : function(){ $(this).dialog('close'); - } + } } }); + + $('#divStartStopAss button').bind('click', function(){ + var operationType = ''; + var conditionName = $(this).attr('name'); + if ('Start' == $(this).html()){ + operationType = 'start'; + } + else{ + operationType = 'stop'; + } + + $(this).parent().prev().empty().append(createLoader()); + $('#divStartStopAss').dialog('option', 'disabled', true); + $.ajax({ + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'webrun', + tgt : '', + args : operationType + 'condresp;' + conditionName, + msg : operationType + ';' + conditionName + }, + + success : function(data){ + var conditionName = ''; + var newOperationType = ''; + var associationStatus = ''; + var backgroudColor = ''; + if ('start' == data.msg.substr(0, 5)){ + newOperationType = 'Stop'; + conditionName = data.msg.substr(6); + associationStatus = 'Monitored'; + backgroudColor = '#ffffff'; + } + else{ + newOperationType = 'Start'; + conditionName = data.msg.substr(5); + associationStatus = 'Not Monitored'; + backgroudColor = '#fffacd'; + } + + var button = $('#divStartStopAss button[name="' + conditionName + '"]'); + if (data.rsp[0]){ + $('#rmcEventStatus').empty().append('Getting associations\' status').append(createLoader()); + $('#rmcEventButtons').hide(); + button.html(newOperationType); + button.parent().prev().html(associationStatus); + button.parent().parent().css('background-color', backgroudColor); + globalCondition = ''; + getConditions(); + } + else{ + button.html('Error'); + } + + $('#divStartStopAss').dialog('option', 'disabled', false); + } + }); + }); } /** @@ -1245,15 +1304,13 @@ function createAssociationTable(cond){ tempStatus = name.substr(tempLength - 3); name = name.substr(1, tempLength - 6); - showStr += ''; - showStr += '' + name + ''; if ('Not' == tempStatus){ - showStr += 'Not Monitored'; - showStr += ''; + showStr += '' + name + 'Not Monitored'; + showStr += ''; } else{ - showStr += 'Monitored'; - showStr += ''; + showStr += '' + name + 'Monitored'; + showStr += ''; } showStr += ''; } diff --git a/xCAT-server/lib/xcat/plugins/web.pm b/xCAT-server/lib/xcat/plugins/web.pm index a0c3d90c2..cc9e963b7 100644 --- a/xCAT-server/lib/xcat/plugins/web.pm +++ b/xCAT-server/lib/xcat/plugins/web.pm @@ -175,6 +175,8 @@ sub web_mkcondresp { my $retInfo = xCAT::Utils->runcmd($cmd, -1, 1); } #there's no output for "mkcondresp" + $cmd = 'startcondresp ' . $conditionName; + my $refInfo = xCAT::Utils->runcmd($cmd, -1, 1); $callback->({ data => "Success." }); }