From 134474241968d8714f829aa4da76a041df91d839 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 25 Mar 2012 19:53:57 -0400 Subject: [PATCH 1/4] Remove html warnings --- cluster_view.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cluster_view.php b/cluster_view.php index 77660f9f..f2673a46 100644 --- a/cluster_view.php +++ b/cluster_view.php @@ -603,9 +603,9 @@ function get_load_heatmap($hosts_up, $user, $metrics, $data) { $conf['show_stacked_graphs'] == 1 and ! preg_match("/_report$/", $metricname)) { $cluster_url = rawurlencode($clustername); - $stacked_args = "m=$metricname&c=$cluster_url&r=$range&st=$cluster[LOCALTIME]"; + $stacked_args = "m=$metricname&c=$cluster_url&r=$range&st=$cluster[LOCALTIME]"; if (isset($user['host_regex'])) - $stacked_args .= "&host_regex=" . $user['host_regex']; + $stacked_args .= "&host_regex=" . $user['host_regex']; $data->assign("stacked_graph_args", $stacked_args); } From 4ed1ee74780d53f8d3bcb19dcad18667920ae787 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 26 Mar 2012 09:41:18 -0400 Subject: [PATCH 2/4] Added feature to delete selected view --- functions.php | 15 +++++++++++---- header.php | 1 + templates/default/views_view.tpl | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/functions.php b/functions.php index bc3c4572..39302bbf 100644 --- a/functions.php +++ b/functions.php @@ -572,10 +572,17 @@ function get_available_views() { } $view = json_decode(file_get_contents($view_config_file), TRUE); - // Check whether view type has been specified ie. regex. If not it's standard view - isset($view['view_type']) ? $view_type = $view['view_type'] : $view_type = "standard"; - $available_views[] = array ( "file_name" => $view_config_file, "view_name" => $view['view_name'], - "default_size" => $view['default_size'], "items" => $view['items'], "view_type" => $view_type); + // Check whether view type has been specified ie. regex. + // If not it's standard view + $view_type = + isset($view['view_type']) ? $view['view_type'] : "standard"; + $default_size = isset($view['default_size']) ? + $view['default_size'] : $conf['default_view_graph_size']; + $available_views[] = array ("file_name" => $view_config_file, + "view_name" => $view['view_name'], + "default_size" => $default_size, + "items" => $view['items'], + "view_type" => $view_type); unset($view); diff --git a/header.php b/header.php index 388f9aec..6d13db44 100644 --- a/header.php +++ b/header.php @@ -145,6 +145,7 @@ } elseif ( $context == "views") { if( checkAccess( GangliaAcl::ALL_VIEWS, GangliaAcl::EDIT, $conf ) ) { $alt_view = ''; + $alt_view .= '  '; } } diff --git a/templates/default/views_view.tpl b/templates/default/views_view.tpl index c4bb7d5c..c6387459 100644 --- a/templates/default/views_view.tpl +++ b/templates/default/views_view.tpl @@ -23,6 +23,22 @@ .click(function() { $( "#create-new-view-dialog" ).dialog( "open" ); }); + $("#delete_view_button") + .button() + .click(function() { + if ($("#vn").val() != "") { + $.get('views_view.php?view_name=' + + encodeURIComponent($("#vn").val()) + + '&delete_view&views_menu', + function(data) { + $("#views_menu").html(data); + $("#view_graphs").html(""); + $.cookie('ganglia-selected-view-' + window.name, ""); + $("#vn").val(""); + }); + } else + alert("Please select the view to delete"); + }); highlightSelectedView('{$view_name}'); }); From 85b085b4be12ba116c266752b2a28a56af61a97a Mon Sep 17 00:00:00 2001 From: Peter Piela Date: Mon, 26 Mar 2012 10:09:15 -0400 Subject: [PATCH 3/4] Fixes for issue #32 --- inspect_graph.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inspect_graph.php b/inspect_graph.php index c1d8760b..837fc811 100644 --- a/inspect_graph.php +++ b/inspect_graph.php @@ -58,8 +58,8 @@ function utcTimeStr(tstamp) { var month = date.getUTCMonth(); if ( month < 10 ) - month = "0" + month; - var day = date.getUTCDay(); + month = "0" + (month + 1); + var day = date.getUTCDate(); if ( day < 10 ) day = "0" + day; var hr = date.getUTCHours(); From d06c7e66a8c67075e097058d7a4f6bd01e8972ae Mon Sep 17 00:00:00 2001 From: Peter Piela Date: Mon, 26 Mar 2012 10:14:02 -0400 Subject: [PATCH 4/4] Fix last commit --- inspect_graph.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inspect_graph.php b/inspect_graph.php index 837fc811..8efc0c71 100644 --- a/inspect_graph.php +++ b/inspect_graph.php @@ -56,9 +56,9 @@ function utcTimeStr(tstamp) { var date = new Date(tstamp); - var month = date.getUTCMonth(); + var month = date.getUTCMonth() + 1; if ( month < 10 ) - month = "0" + (month + 1); + month = "0" + month; var day = date.getUTCDate(); if ( day < 10 ) day = "0" + day;