From e46a62708da3f49d009bb21a4db0a9947ca2b2c2 Mon Sep 17 00:00:00 2001 From: mxi1 Date: Mon, 7 Dec 2009 09:42:14 +0000 Subject: [PATCH] the web page for "RMC event ", and the web page for /home/control" are modified. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4735 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/css/demo_table.css | 4 +- xCAT-UI/css/main.css | 35 ++------ xCAT-UI/css/monitor.css | 58 ++++++++----- xCAT-UI/js/monitor.js | 52 ++++++++---- xCAT-UI/js/xcat.js | 10 --- xCAT-UI/js/xcatauth.js | 10 ++- xCAT-UI/lib/display.php | 93 ++++++++++---------- xCAT-UI/lib/functions.php | 45 ++++++---- xCAT-UI/lib/monitor_display.php | 107 +++++++++++++++--------- xCAT-UI/monitor/makecondresp.php | 2 + xCAT-UI/monitor/options.php | 35 +++++++- xCAT-UI/monitor/rmc_event_define.php | 11 ++- xCAT-UI/monitor/rmc_resource_attr.php | 5 +- xCAT-UI/monitor/updateCondRespTable.php | 95 +++++++++++++-------- xCAT-UI/rangeDisplay.php | 93 +++++++++----------- 15 files changed, 375 insertions(+), 280 deletions(-) diff --git a/xCAT-UI/css/demo_table.css b/xCAT-UI/css/demo_table.css index af1f4bb50..0ef5327de 100644 --- a/xCAT-UI/css/demo_table.css +++ b/xCAT-UI/css/demo_table.css @@ -32,8 +32,8 @@ .dataTables_wrapper { position: relative; - min-height: 302px; - _height: 302px; + min-height: 231px; /*mxi1: changed from 302 to 131*/ + _height: 231px; /*mxi1: changed from 302 to 131*/ clear: both; } diff --git a/xCAT-UI/css/main.css b/xCAT-UI/css/main.css index 148a162c1..ff9ccce6d 100644 --- a/xCAT-UI/css/main.css +++ b/xCAT-UI/css/main.css @@ -117,8 +117,9 @@ a.button:active span { } #rangedisplay { - float: left; + float: right; text-align: left; + width: 650px; width: auto; } #nrtree { @@ -279,9 +280,9 @@ padding:10px 2px; color: #ddd; } .mContent { - padding: 10px; + padding: 5px; padding-top: 0px; - margin: 10px; + margin: 5px; margin-top: 0px; text-align: left; color: #555; @@ -302,8 +303,9 @@ padding:10px 2px; color:#6ea1fa; } .nrcmd { - float: right; - text-align: left; + float: left; + text-align: right; + width: 916px; } .mapper span { float: left; @@ -386,30 +388,7 @@ padding:10px 2px; } -#monsetting_tips { - width: 920px; - margin: 5px; - padding: 5px; - float: left; -} -#rmcSrcList { - width: 420px; - margin: 5px; - padding: 5px; - float: left; - background-color:silver; - height: 480px; - overflow-y: scroll; -} - -#rmcScrAttr { - width: 420px; - margin: 5px; - padding: 5px; - float: left; - background-color:silver; -} #options { width: 880px; diff --git a/xCAT-UI/css/monitor.css b/xCAT-UI/css/monitor.css index c3c126368..7087e5b37 100644 --- a/xCAT-UI/css/monitor.css +++ b/xCAT-UI/css/monitor.css @@ -127,7 +127,7 @@ fieldset { } #condresp { - width: 71%; + width: 97%; margin: 5px; padding: 5px; float: left; @@ -135,40 +135,54 @@ fieldset { border: 1px solid orange; } -#assocaition { +#association { margin: 5px; padding: 5px; float:left; display: block; + width: 94%; border: 1px solid lime; } #avail_cond { - width: 33%; - margin: 5px; - padding: 5px; + width: 40%; + margin: 3px; + padding: 3px; float: left; - background-color: #ffee33; + border: 1px solid lime; } -#avail_cond tbody { - overflow-y: scroll; - overflow-x: hide; -} - -#condition .ui-selecting {background: #FECA40;} -#condition .ui-selected { background: #F39814; color: white; } -#condition {list-style-type: none; margin: 0; padding: 0;} - #avail_resp { - width: 60%; - margin: 5px; - padding: 5px; + width: 50%; + margin: 3px; + padding: 3px; float: left; - background-color: #eeffee; + border: 1px solid lime; } -#avail_resp tbody { +/*For the RMC resources and their attributes*/ +#monsetting_tips { + width: 97%; + margin: 3px; + padding: 1px; + float: left; +} + +#rmcSrcList { + width: 48%; + margin: 3px; + padding: 1px; + float: left; + background-color:silver; + height: 480px; overflow-y: scroll; - overflow-x: hide; -} \ No newline at end of file +} + +#rmcSrcAttr { + width: 48%; + margin: 3px; + padding: 1px; + float: left; + background-color:silver; +} +/**/ diff --git a/xCAT-UI/js/monitor.js b/xCAT-UI/js/monitor.js index 6eb19af12..db2ee3e90 100644 --- a/xCAT-UI/js/monitor.js +++ b/xCAT-UI/js/monitor.js @@ -25,7 +25,7 @@ jQuery.fn.customInput = function(){//from http://www.filamentgroup.com/examples/ $(this).addClass('checkedHover'); } }, - function(){ $(this).removeClass('hover checkedHover'); } + function(){$(this).removeClass('hover checkedHover');} ); //bind custom event, trigger it, bind click,focus,blur events @@ -38,7 +38,7 @@ jQuery.fn.customInput = function(){//from http://www.filamentgroup.com/examples/ }; label.addClass('checked'); } - else { label.removeClass('checked checkedHover checkedFocus'); } + else {label.removeClass('checked checkedHover checkedFocus');} }) .trigger('updateState') @@ -51,7 +51,7 @@ jQuery.fn.customInput = function(){//from http://www.filamentgroup.com/examples/ $(this).addClass('checkedFocus'); } }) - .blur(function(){ label.removeClass('focus checkedFocus'); }); + .blur(function(){label.removeClass('focus checkedFocus');}); } }); }; @@ -159,23 +159,31 @@ function appmonSetStat() function mkCondResp() { //get the name of the selected condition + //then, get the selected noderange //then, get the response in "checked" status //then, run the command "mkcondresp" var cond_val = $(':input[name=conditions][checked]').val(); - if(cond_val) { - //get the response in "checked" status - var resps_obj = $(':input[name=responses][checked]'); - if(resps_obj) { - $.each(resps_obj,function(i,n) { - //i is the index - //n is the content - //TODO:add one new php file to handle "mkcondresp" command - $.get("monitor/makecondresp.php", {cond: cond_val, resp: n.value}, function(data) { - $("#devstatus").html(data); - }); + var value="";//the noderange selected from the osi tree + var i=0; + var node_selected = nrtree.selected_arr; + for(; i< node_selected.length; i++) { + value += node_selected[i].attr('id'); + } + //remove the "," at the front + value = value.substr(1); + var resps_obj = $(':input[name=responses][checked]'); + if(cond_val && resps_obj && value) { + $.each(resps_obj,function(i,n) { + //i is the index + //n is the content + //TODO:add one new php file to handle "mkcondresp" command + $.get("monitor/makecondresp.php", {cond: cond_val, resp: n.value, nr: value}, function(data) { + //nothing to do right now. }); - $("#association").load("monitor/updateCondRespTable.php"); - } + }); + $("#notify_me").html("

The associations are created!

"); + $("#notify_me").addClass("ui-state-highlight"); + $("#association table tbody").load("monitor/updateCondRespTable.php"); } } @@ -201,5 +209,17 @@ function control_RMCAssoc(cond, node, resp, action) ); } +/*when one RMC Resource is selected, this function is called to display its attributes*/ +function showRMCAttrib() +{ + var class_val = $('input[name=classGrp]:checked').val(); + if(class_val) { + $.get("monitor/rmc_resource_attr.php", {name: class_val}, function(data) { + $("#rmcSrcAttr").html(data); + }); + } +} + + // for the progress bar myBar.loaded('monitor.js'); \ No newline at end of file diff --git a/xCAT-UI/js/xcat.js b/xCAT-UI/js/xcat.js index 4873043c0..5e1b1dbbd 100644 --- a/xCAT-UI/js/xcat.js +++ b/xCAT-UI/js/xcat.js @@ -400,16 +400,6 @@ function goto_next() } } -function showRMCAttrib() -{ - var class_val = $('input[@name=classGrp][@checked]').val(); - if(class_val) { - $.get("monitor/rmc_resource_attr.php", {name: class_val}, function(data) { - $("#rmcScrAttr").html(data); - }); - } -} - function show_monshow_data(type,range) { //type = "text" or "graph" diff --git a/xCAT-UI/js/xcatauth.js b/xCAT-UI/js/xcatauth.js index be6fdd17b..c0b981fed 100644 --- a/xCAT-UI/js/xcatauth.js +++ b/xCAT-UI/js/xcatauth.js @@ -76,7 +76,7 @@ function openDialog(){ } else { $("#password").focus(); } - }, + } }); $("#username").keydown(function(event) { //When 'enter' is hit while in username, advance to password @@ -86,7 +86,13 @@ function openDialog(){ }); $("#password").keydown(function(event) { //Submit authentication if enter is pressed in password field if (event.keyCode==13) { - authenticate(); + //TODO: it doesn't work on Chrome and Safari + $(".ui-dialog-buttonpane button").each(function() { + if($(this).html() == "Log In") { + $(this).click(); + } + }); + //authenticate(); } }); diff --git a/xCAT-UI/lib/display.php b/xCAT-UI/lib/display.php index 295529114..36e5dce72 100644 --- a/xCAT-UI/lib/display.php +++ b/xCAT-UI/lib/display.php @@ -360,8 +360,8 @@ displayMapper(array('home'=>'main.php', 'control' =>'')); function displayNrTree(){ echo << -

Please select a node or noderange on the left.

+
+

Please select a node or noderange on the left.

You can use ctrl-click to select more than one node grouping,

or expand the noderanges to select individual nodes.

+//JS00; + echo "
"; + $rvals = docmd($cmd, $nr, array($subcmd)); + #print_r($rvals); + $headers = attributesOfNodes($rvals,$cmd); + #echo "

Headers:
"; #print_r($headers); - $nh = mkNodeHash($rvals,$cmd); - #echo "


"; - #print_r($nh); - echo ""; - echo "\n"; - echo ""; - echo ""; - foreach ($headers as $head){ - echo ""; - } - echo ""; - echo ""; - $ooe = 0; - foreach($nh as $n => $vals){ - $cl = "ListLine$ooe"; - echo "\n"; - #echo ""; - echo ""; - foreach($headers as $h){ - if($vals[$h] == ''){ - echo " "; - }else{ - #echo ""; - echo ""; - } - } - echo "\n"; - $ooe = 1 - $ooe; - } - echo ""; - echo "
Node$head
$n$n" . $vals[$h] . "" . $vals[$h] . "
\n"; - echo << - $("table").tablesorter({ - sortList: [[0,0]] - }); - -JS; + $nh = mkNodeHash($rvals,$cmd); + #echo "


"; + echo ""; + echo ""; + echo ""; + echo ""; + foreach ($headers as $head){ + echo ""; + } + echo ""; + echo ""; + foreach($nh as $n => $vals){ + echo "\n"; + #echo ""; + echo ""; + foreach($headers as $h){ + if($vals[$h] == ''){ + echo " "; + }else{ + #echo ""; + echo ""; + } + } + echo ""; + } + echo ""; + echo "
Node$head
$n$n" . $vals[$h] . "" . $vals[$h] . "
"; + echo "
"; + } diff --git a/xCAT-UI/lib/functions.php b/xCAT-UI/lib/functions.php index 21c73ab6d..27ca68742 100644 --- a/xCAT-UI/lib/functions.php +++ b/xCAT-UI/lib/functions.php @@ -258,23 +258,36 @@ function mkNodeHash ($ht,$cmd){ $name = ""; $desc = ""; $cont = ""; - foreach($ht->children() as $response){ - foreach($response as $node){ - #print_r($response); - $name = (string) $node->name; - $desc = (string) $node->data->desc; - if($cmd == 'rpower'){ - $desc = 'Power Status'; - }elseif($cmd == 'rbeacon'){ - $desc = 'Beacon Status'; - } - $cont = (string) $node->data->contents; - if($cont == ''){ - $cont = (string) $node->error; - } - $arr[$name][$desc] = $cont; - } + foreach($ht->children() as $response) foreach($response->children() as $node) { + if($node->name) { + $name = (string) $node->name; + $desc = (string) $node->data->desc; + if($cmd == 'rpower'){ + $desc = 'Power Status'; + }elseif($cmd == 'rbeacon'){ + $desc = 'Beacon Status'; + } + $cont = (string) $node->data->contents; + if($cont == ''){ + $cont = (string) $node->error; + } + $arr[$name][$desc] = $cont; + } +// #print_r($response); +// $name = (string) $node->name; +// $desc = (string) $node->data->desc; +// if($cmd == 'rpower'){ +// $desc = 'Power Status'; +// }elseif($cmd == 'rbeacon'){ +// $desc = 'Beacon Status'; +// } +// $cont = (string) $node->data->contents; +// if($cont == ''){ +// $cont = (string) $node->error; +// } +// $arr[$name][$desc] = $cont; } + // add the more fields so we can click in place. if($cmd == 'rpower'){ foreach($arr as $n => $val){ diff --git a/xCAT-UI/lib/monitor_display.php b/xCAT-UI/lib/monitor_display.php index a383aa304..24c99a552 100644 --- a/xCAT-UI/lib/monitor_display.php +++ b/xCAT-UI/lib/monitor_display.php @@ -67,7 +67,7 @@ function displayOSITree() { //display the node range tree, but only with the nodes with OSI type //this follows the function showNrTreeInput(); - echo "
"; + echo "
"; echo << $(function() { @@ -130,7 +130,13 @@ echo <<$record[7] TOS6; //TODO: insert the button here - echo "Button"; + echo ""; + if($record[7] == "Active") { + echo ""; + }else { + echo ""; + } + echo ""; echo ""; // $association = explode("=", $data); // @@ -170,8 +176,7 @@ function displayCond() { //display all the avaiable conditions to a element echo << -Available Conditions +
@@ -200,17 +205,7 @@ echo << TOS99; } -// $ooe = 0; -// $line = 0; -// foreach($conditions as $elem) { -// $ooe = $ooe%2; -// echo ""; -// echo ""; -// echo ""; -// echo ""; -// $ooe++; -// $line++; -// } + echo "
$elem
"; return 0; @@ -219,13 +214,12 @@ TOS99; function displayResp() { echo << -Available Response - +
- - + @@ -242,15 +236,6 @@ echo <<"; } -// foreach($responses as $elem) { -// $ooe = $ooe%2; -// echo ""; -// echo ""; -// echo ""; -// echo ""; -// $ooe++; -// $line++; -// } echo '
Response + Response
$elem
'; return 0; } @@ -258,11 +243,53 @@ TOS7; function displayCondResp() { echo '
'; +echo << + $(function() { + $("#nrtree-input").hide(); + $("#showOpt4association").click(function() { + if($("#avail_cond").css("display") == "none") { + $("#nrtree-input").show(); + $("#assobuttonsets").show(); + $("#avail_cond").show(); + $("#avail_resp").show(); + } + }); + $("#addAssociation").click(function() { + mkCondResp(); + }); + + $("#cancelAssociation").click(function() { + clearEventDisplay(); + }); + }); + +JS00; + echo "
"; displayAssociation(); + echo "
"; + echo "
"; +echo << +

Click here if you want to create new associations...

+TOS00; + echo "
"; + echo "
"; + echo "
"; + displayOSITree(); + echo "
"; +echo <<
+BTN00; + echo "
"; displayCond(); displayResp(); - insertButtons(array('label'=>'Add', id=>'addAssociation', 'onclick'=>'mkCondResp()')); - insertButtons(array('label'=>'Cancel', id=>'cancel_op', 'onclick'=>'clearEventDisplay()')); + echo "
"; + echo "
"; + echo "
"; echo '
'; } @@ -329,9 +356,18 @@ function RMCEventLogToTable() //displayRMCEventLog() to display the RMC event logs in one table with "tablesorter" class function displayRMCEvnetLog() { -echo '
'; +echo '
'; +echo << +$("#lseventLog").dataTable({ + "bLengthChange": false, + "bFilter": true, + "bSort": true +}); + +TOS8; echo << + @@ -343,11 +379,6 @@ TOS9; RMCEventLogToTable(); echo "
Time
"; //TODO: the following javascript doesn't work well. -echo << - $("#lsevent_tab").tablesorter({ sortList: [[0,1],[1,1]] }); - -TOS8; echo "
"; } diff --git a/xCAT-UI/monitor/makecondresp.php b/xCAT-UI/monitor/makecondresp.php index d0899fdbe..77ae68a4f 100644 --- a/xCAT-UI/monitor/makecondresp.php +++ b/xCAT-UI/monitor/makecondresp.php @@ -12,7 +12,9 @@ require_once "$TOPDIR/lib/monitor_display.php"; $cond = '"' . $_REQUEST["cond"] . '"'; $resp = '"' . $_REQUEST["resp"] . '"'; +$nr = '"' . $_REQUEST["nr"] . '"'; +//Fixit: The parameter $nr can't work right now. $xml=docmd("webrun", '', array("mkcondresp $cond $resp")); if(getXmlErrors($xml, $errors)) { echo "

",implode(' ', $errors), "

"; diff --git a/xCAT-UI/monitor/options.php b/xCAT-UI/monitor/options.php index 73d134a30..497ed0368 100644 --- a/xCAT-UI/monitor/options.php +++ b/xCAT-UI/monitor/options.php @@ -109,9 +109,15 @@ TOS11; echo <<

For your convenience, all the available RMC Resources and their attributes will list here

- -
+
+
TOS15; + displayRMCRsrc(); + echo "
"; + displayRMCAttr(); + echo "
+
+ "; } echo ""; } @@ -122,13 +128,34 @@ TOS15; function showRMCAssocTab() { echo "
"; - + displayAssociation(); echo "
"; } function showPluginView($name) { - //TODO + // + echo "
"; + echo << + $(function() { + $("#rmcViewAccord").accordion({autoHeight: false}); + }); + +JS11; + echo <<RMC Event Log +
+

TODO

+
+ACD01; + echo <<RMC Performance Monitoring +
+

TODO

+
+ACD02; + echo "
"; } function updatePluginStat($name) diff --git a/xCAT-UI/monitor/rmc_event_define.php b/xCAT-UI/monitor/rmc_event_define.php index c3bc32225..adbc352e4 100644 --- a/xCAT-UI/monitor/rmc_event_define.php +++ b/xCAT-UI/monitor/rmc_event_define.php @@ -14,14 +14,13 @@ require_once "$TOPDIR/lib/monitor_display.php"; displayMapper(array('home'=>'main.php', 'monitor' =>'monitor/monlist.php', 'RMC Event Setup' => '')); -displayTips(array( - "All the conditions and the responses are here;", - "Use \"mkcondition\" and \"mkresponse\" to create new conditions and new responses", - "Select the condition, and response to create condition/response association" - )); +//displayTips(array( +// "All the conditions and the responses are here;", +// "Use \"mkcondition\" and \"mkresponse\" to create new conditions and new responses", +// "Select the condition, and response to create condition/response association" +// )); echo "
"; //TODO:one "text input" widget should be put here, to allow the user to input noderange -displayOSITree(); displayCondResp(); echo "
"; ?> diff --git a/xCAT-UI/monitor/rmc_resource_attr.php b/xCAT-UI/monitor/rmc_resource_attr.php index ef3599964..3d43fb3e3 100644 --- a/xCAT-UI/monitor/rmc_resource_attr.php +++ b/xCAT-UI/monitor/rmc_resource_attr.php @@ -1,8 +1,5 @@ Available Condition/Response Associations - - - - - - - - - - -TOS5; +//echo << +// +// +// +// +// +//TOS5; $xml = docmd("webrun", "", array("lscondresp")); if(getXmlErrors($xml,$errors)) { echo "

",implode(' ', $errors), "

"; @@ -31,29 +31,52 @@ TOS5; //get all the condition&response associations for RMC foreach ($xml->children() as $response) foreach($response->children() as $data) { //get the data from xcatd - $association = explode("=", $data); - - $ooe = 0; - $line = 0; - foreach($association as $elem) { - $ooe = $ooe%2; - //the format should be - //"NodeReachability"\t"EmailRootOffShift"\t"hv8plus01.ppd.pok.ibm.com"\t"Active" - $record = explode("\"", $elem); - $cond = $record[1]; - $resp = $record[3]; - $node = $record[5]; - $state = $record[7]; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - $ooe++; - $line++; + $record = split('"',$data); + echo ""; +echo <<$record[1] + + + +TOS6; + //TODO: insert the button here + echo ""; + echo ""; +// $association = explode("=", $data); +// +// $ooe = 0; +// $line = 0; +// foreach($association as $elem) { +// $ooe = $ooe%2; +// //the format should be +// //"NodeReachability"\t"EmailRootOffShift"\t"hv8plus01.ppd.pok.ibm.com"\t"Active" +// $record = explode("\"", $elem); +// $cond = $record[1]; +// $resp = $record[3]; +// $node = $record[5]; +// $state = $record[7]; +// echo ""; +// echo ""; +// echo ""; +// echo ""; +// echo ""; +// echo ""; +// echo ""; +// $ooe++; +// $line++; +// } } - echo "
ConditionResponseNodeState
Condition +// Response +// Node +// State +// Action +//
$cond$resp$node$state
$record[3]$record[5]$record[7]"; + if($record[7] == "Active") { + echo ""; + }else { + echo ""; } + echo "
$cond$resp$node$state"; +// if($state == "Active") { +// insertButtons(array('label'=>'DeActivate', 'id'=>'deactivate', 'onclick'=>"control_RMCAssoc(\"$cond\", \"$node\", \"$resp\", \"stop\")")); +// }else if($state == "Not active"){ +// insertButtons(array('label'=>'Activate', 'id'=>'activate', 'onclick'=>"control_RMCAssoc(\"$cond\", \"$node\", \"$resp\", \"start\")")); +// } +// echo "
"; - +// echo ""; ?> diff --git a/xCAT-UI/rangeDisplay.php b/xCAT-UI/rangeDisplay.php index 19b8b71bf..6849fcd16 100644 --- a/xCAT-UI/rangeDisplay.php +++ b/xCAT-UI/rangeDisplay.php @@ -6,58 +6,47 @@ require_once "lib/functions.php"; require_once "lib/display.php"; ?> -