Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to keep the ordering of graphs in the order they appear #228

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cluster_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function get_host_metric_graphs($showhosts,
// If we're hiding DOWN hosts, we skip to next iteration of the loop.
continue;
}
$host_url = rawurlencode($host);
$host_url = ($case_sensitive_hostnames) ? rawurlencode($host) : strtolower(rawurlencode($host));

$host_link="\"?c=$cluster_url&h=$host_url&$get_metric_string\"";
$textval = "";
Expand Down
2 changes: 1 addition & 1 deletion dwoo/Dwoo/Template/String.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Dwoo_Template_String implements Dwoo_ITemplate
*
* @var int
*/
protected $chmod = 0777;
protected $chmod = 0755;

/**
* creates a template from a string
Expand Down
11 changes: 9 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,10 @@ function get_view_graph_elements($view) {
} else {
$graph_args_array[] = "z=" . $default_size;
}

if ( isset($item['sortit']) ) {
$graph_args_array[] = "sortit=" . $item['sortit'];
}

// If graph type is not specified default to line graph
if (isset($item['graph_type']) &&
Expand Down Expand Up @@ -1111,7 +1115,8 @@ function build_aggregate_graph_config ($graph_type,
$hreg,
$mreg,
$glegend,
$exclude_host_from_legend_label) {
$exclude_host_from_legend_label,
$sortit = true) {

global $conf, $index_array, $hosts, $grid, $clusters, $debug, $metrics;

Expand Down Expand Up @@ -1157,7 +1162,9 @@ function build_aggregate_graph_config ($graph_type,
}
}
}
ksort($metric_matches);
if($sortit) {
ksort($metric_matches);
}
}
if( isset($metric_matches)){
$metric_matches_unique = array_unique($metric_matches);
Expand Down
9 changes: 8 additions & 1 deletion graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,20 @@ function build_aggregate_graph_config_from_url($conf_graph_colors) {
$exclude_host_from_legend_label =
(array_key_exists('lgnd_xh', $_GET) &&
$_GET['lgnd_xh'] == "true") ? TRUE : FALSE;

$sortit = true;
if($_GET['sortit'] == "false") {
$sortit = false;
}

$graph_config =
build_aggregate_graph_config($graph_type,
$line_width,
$_GET['hreg'],
$_GET['mreg'],
$graph_legend,
$exclude_host_from_legend_label);
$exclude_host_from_legend_label,
$sortit);
}

// Set up
Expand Down