Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #58 from pcpiela/master

Added capability to delete views
  • Loading branch information...
commit 00f2726572db05e74da1ce533b4dabc9a1bb57a9 2 parents fd551ba + d06c7e6
@vvuksan vvuksan authored
View
4 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);
}
View
15 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);
View
1  header.php
@@ -145,6 +145,7 @@
} elseif ( $context == "views") {
if( checkAccess( GangliaAcl::ALL_VIEWS, GangliaAcl::EDIT, $conf ) ) {
$alt_view = '<button onclick="return false" id="create_view_button">Create View</button>';
+ $alt_view .= '&nbsp;&nbsp;<button onclick="return false" id="delete_view_button">Delete View</button>';
}
}
View
4 inspect_graph.php
@@ -56,10 +56,10 @@
function utcTimeStr(tstamp) {
var date = new Date(tstamp);
- var month = date.getUTCMonth();
+ var month = date.getUTCMonth() + 1;
if ( month < 10 )
month = "0" + month;
- var day = date.getUTCDay();
+ var day = date.getUTCDate();
if ( day < 10 )
day = "0" + day;
var hr = date.getUTCHours();
View
16 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}');
});
</script>
Please sign in to comment.
Something went wrong with that request. Please try again.