From 4070e8e830d905784ce5340c83badd4ea489bcf8 Mon Sep 17 00:00:00 2001 From: mxi1 Date: Fri, 4 Sep 2009 06:10:16 +0000 Subject: [PATCH] begin the code for "view by graph" git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4099 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/xcat.js | 12 +++++++++++- xCAT-UI/monitor/rmc_monshow.php | 8 ++++++-- xCAT-UI/monitor/rmc_monshow_data_source.php | 13 ++++++++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/xCAT-UI/js/xcat.js b/xCAT-UI/js/xcat.js index 0a9fcaf97..891ba7083 100644 --- a/xCAT-UI/js/xcat.js +++ b/xCAT-UI/js/xcat.js @@ -513,8 +513,12 @@ function show_monshow_graph() { if($(":input[@checked]").size() != 0) { $("#monshow_data").empty(); $("#monshow_opt").hide("slow"); + $("#back_btn").show("slow"); $(":input[@checked]").each(function(i) { //generate graphics for all the attributes in "checked" status + $.get("monitor/rmc_monshow_data_source.php", {mode: "graph", value: $(this).attr("value")}, function(data) { + $("#monshow_data").append(data); + }); }); } else { } @@ -524,8 +528,9 @@ function show_monshow_text() { if($(":input[@checked]").size() != 0) { $("#monshow_data").empty(); $("#monshow_opt").hide("slow"); + $("#back_btn").show("slow"); $(":input[@checked]").each(function(i) { - $.get("monitor/rmc_monshow_data_source.php", {value: $(this).attr("value")}, function(data) { + $.get("monitor/rmc_monshow_data_source.php", {mode: "text", value: $(this).attr("value")}, function(data) { $("#monshow_data").append(data); }); }); @@ -534,10 +539,15 @@ function show_monshow_text() { } } +function init_rmc_monshow_back_btn() { + $("#back_btn").hide(); +} + function rmc_monshow_back_to_opts() { //clear the
//and, display
$("#monshow_data").empty(); + $("#back_btn").hide("slow"); $("#monshow_opt").show("slow"); } diff --git a/xCAT-UI/monitor/rmc_monshow.php b/xCAT-UI/monitor/rmc_monshow.php index 37bbea52f..1142e747d 100644 --- a/xCAT-UI/monitor/rmc_monshow.php +++ b/xCAT-UI/monitor/rmc_monshow.php @@ -19,7 +19,7 @@ insertDiv("rmc_tree"); ?>
"; //if the user clicks the "View by Text" button, the div named "monshow_data" will show // the text data from the "monshow" command; //and , if the "view by Graphics" button is clicked, the "monshow_data" div will display the pictures, the pictures is generated by "rrdtool" right now, but in the future, some jQuery plugin will be used to generate the graphics for the "monshow" data -echo "
"; +echo "
"; +insertButtons(array('label'=>'Back To the Attributes\' Page', 'id'=>'back_btn', 'onclick'=>'rmc_monshow_back_to_opts()')); +echo "
"; +echo "
"; +echo "
"; echo "
"; ?> diff --git a/xCAT-UI/monitor/rmc_monshow_data_source.php b/xCAT-UI/monitor/rmc_monshow_data_source.php index eb426e2ba..d4e081793 100644 --- a/xCAT-UI/monitor/rmc_monshow_data_source.php +++ b/xCAT-UI/monitor/rmc_monshow_data_source.php @@ -7,13 +7,16 @@ require_once "$TOPDIR/lib/functions.php"; require_once "$TOPDIR/lib/display.php"; require_once "$TOPDIR/lib/monitor_display.php"; +$mode = $_REQUEST['mode']; $value = $_REQUEST['value']; -echo "
"; -insertButtons(array('label'=>'Back', 'id'=>'back_btn', 'onclick'=>'rmc_monshow_back_to_opts()')); -echo "
"; -displayRMCMonshowAttr($value); - +if($mode == "text") { + displayRMCMonshowAttr($value); +} elseif($mode == "graph") { + //display the pictures generated by "rrdtool"; + //in the feture, the pictures will be generated by jQuery plug-ins; + displayRMCMonshowGraph($value); +} ?>