Permalink
Browse files

Changes to add vertical label to aggregate graphs. Correctly process is

in Add to View
  • Loading branch information...
1 parent 6bea120 commit 8073b25e4ea892f8742be6582687959531a53c27 vuksan committed May 31, 2011
Showing with 25 additions and 13 deletions.
  1. +16 −9 ganglia-web/actions.php
  2. +5 −1 ganglia-web/aggregate_graphs.php
  3. +2 −2 ganglia-web/js/ganglia.js
  4. +2 −1 ganglia-web/views.php
View
@@ -29,20 +29,27 @@
<form id="add_metric_to_view_form">
Add to view
<?php
- if ( isset($_GET['host_name']) ) {
- ?>
- <input type=hidden name=host_name value="<?php print $_GET['host_name']; ?>">
- <?php
+ // Get all the aggregate form variables and put them in the hidden fields
+ if ( isset($_GET['aggregate']) ) {
+ foreach ( $_GET as $key => $value ) {
+ if ( is_array($value) ) {
+ foreach ( $value as $index => $value2 ) {
+ print '<input type=hidden name="' . $key .'[]" value="' . $value2 . '">';
+ }
+ } else {
+ print '<input type=hidden name=' . $key .' value="' . $value . '">';
+ }
+ }
} else {
?>
- <input type=hidden name=hreg value="<?php print $_GET['hreg']; ?>">
- <input type=hidden name=aggregate value=1>
- <input type=hidden name=graph_type value="<?php print $_GET['graph_type']; ?>">
+ // If hostname is not set we assume we are dealing with aggregate graphs
+ <input type=hidden name=host_name value="<?php print $_GET['host_name']; ?>">
+ <input type=hidden name=metric_name value="<?php print $_GET['metric_name']; ?>">
+ <input type=hidden name=type value="<?php print $_GET['type']; ?>">
<?php
}
?>
- <input type=hidden name=metric_name value="<?php print $_GET['metric_name']; ?>">
- <input type=hidden name=type value="<?php print $_GET['type']; ?>">
+
<select onChange="addItemToView()" name="view_name">
<option value='none'>Please choose one</option>
<?php
@@ -66,6 +66,10 @@ function createAggregateGraph() {
<form id="aggregate_graph_form">
<table id="aggregate_graph_table_form">
<tr>
+<td>Vertical (Y-Axis) label:</td>
+<td colspan=2><input name="vl" id="vl" value="" size=50></td>
+<tr>
+<tr>
<td>Host Regular expression e.g. web-[0,4], web or (web|db):</td>
<td colspan=2><input name="hreg[]" id="hreg" size=60></td>
<tr>
@@ -78,7 +82,7 @@ function createAggregateGraph() {
<input type="radio" name="gtype" value="stack">Stacked</input></div></td>
<td>
<button class="ag_buttons" onclick="createAggregateGraph(); return false">Create Graph</button>
-<button class="ag_buttons" onclick="metricActionsAggregateGraph($('#hreg').val(), $('#metric_chooser').val(), $('input[name=gtype]:checked').val()); return false">Add To View</button></td>
+<button class="ag_buttons" onclick="metricActionsAggregateGraph(); return false">Add To View</button></td>
</tr>
</table>
</form>
@@ -157,10 +157,10 @@ function createAggregateGraph() {
return false;
}
-function metricActionsAggregateGraph(hreg,metric_name,type) {
+function metricActionsAggregateGraph() {
$( "#metric-actions-dialog" ).dialog( "open" );
$("#metric-actions-dialog-content").html('<img src="img/spinner.gif">');
- $.get('actions.php', "action=show_views&hreg=" + hreg + "&metric_name=" + metric_name + "&graph_type=" + type, function(data) {
+ $.get('actions.php', "action=show_views&aggregate=1&" + $("#aggregate_graph_form").serialize(), function(data) {
$("#metric-actions-dialog-content").html(data);
});
return false;
View
@@ -82,7 +82,8 @@
if ( isset($_GET['aggregate']) ) {
$view['items'][] = array( "aggregate_graph" => "true", "metric" => $_GET['metric_name'],
- "host_regex" => array( "regex" => $_GET['hreg'] ), "graph_type" => $_GET['graph_type']);
+ "host_regex" => array( "regex" => $_GET['hreg'] ), "graph_type" => $_GET['gtype'],
+ "vertical_label" => $_GET['vl']);
} else {

0 comments on commit 8073b25

Please sign in to comment.