Skip to content

Commit

Permalink
Update to jquery 1.12.4, jquery-ui 1.12.0, fullcalendar 2.9.0, jquery…
Browse files Browse the repository at this point in the history
…-scrollTo 2.1.2
  • Loading branch information
pcpiela committed Aug 16, 2016
1 parent 89148ee commit 8338086
Show file tree
Hide file tree
Showing 14 changed files with 325 additions and 307 deletions.
8 changes: 6 additions & 2 deletions aggregate_graphs.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ function createAggregateGraph() {

$(function() {
$( ".ag_buttons" ).button();
$( "#graph_type_menu" ).buttonset();
$( "#graph_legend_menu" ).buttonset();
$( "#gtstack" ).checkboxradio( { icon: false } );
$( "#gtline" ).checkboxradio( { icon: false } );
$( "#graph_type_menu" ).controlgroup();
$( "#glshow" ).checkboxradio( { icon: false } );
$( "#glhide" ).checkboxradio( { icon: false } );
$( "#graph_legend_menu" ).controlgroup();

$("#hreg").change(function() {
$.cookie("ganglia-aggregate-graph-hreg" + window.name,
Expand Down
48 changes: 24 additions & 24 deletions conf_default.php.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

##########################################################################
# IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
# IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
#
# Please DO NOT edit this file. This file should be left as is. If you
# need to change any of the variables override them in conf.php.
Expand All @@ -16,7 +16,7 @@ include_once $conf['gweb_root'] . "/version.php";

#
# 'readonly': No authentication is required. All users may view all resources. No edits are allowed.
# 'enabled': Guest users may view public clusters. Login is required to make changes.
# 'enabled': Guest users may view public clusters. Login is required to make changes.
# An administrator must configure an authentication scheme and ACL rules.
# 'disabled': Guest users may perform any actions, including edits. No authentication is required.
$conf['auth_system'] = 'readonly';
Expand Down Expand Up @@ -56,7 +56,7 @@ $conf['rrdtool'] = "/usr/bin/rrdtool";
# Render graphs with rrdtool's --slope-mode option
$conf['rrdtool_slope_mode'] = true;

# If rrdcached is being used, this argument must specify the
# If rrdcached is being used, this argument must specify the
# socket to use.
#
# ganglia-web only requires, and should use, the low-privilege socket
Expand All @@ -74,15 +74,15 @@ $conf['graphreport_stat_items'] = array("now", "min", "avg", "max");
#
# If you want to grab data from a different ganglia source specify it here.
# Although, it would be strange to alter the IP since the Round-Robin
# databases need to be local to be read.
# databases need to be local to be read.
#
$conf['ganglia_ip'] = "127.0.0.1";
$conf['ganglia_port'] = 8652;

#
# The maximum number of dynamic graphs to display. If you set this
# to 0 (the default) all graphs will be shown. This option is
# helpful if you are viewing the web pages from a browser with a
# helpful if you are viewing the web pages from a browser with a
# small pipe.
#
$conf['max_graphs'] = 0;
Expand Down Expand Up @@ -113,7 +113,7 @@ $conf['show_meta_snapshot'] = "yes";
#
$conf['meta_designator'] = "Grid";

#
#
# The default refresh frequency on pages.
#
$conf['default_refresh'] = 300;
Expand Down Expand Up @@ -175,7 +175,7 @@ $conf['load_scale'] = 1.0;
$conf['default_metric_color'] = "555555";

#
# Default metric
# Default metric
#
$conf['default_metric'] = "load_one";

Expand All @@ -193,14 +193,14 @@ $conf['cluster_hide_down_hosts'] = false;
#
# Optional summary graphs
# This function is deprecated. Please configure included reports
# in the UI or default.json. Please do not use
# in the UI or default.json. Please do not use
#$conf['optional_graphs'] = array('packet');

# Enable Zoom support on graphs
$conf['zoom_support'] = true;


#
#
# Time ranges
# Each value is the # of seconds in that range.
#
Expand Down Expand Up @@ -230,7 +230,7 @@ $conf['graphite_rrd_dir'] = "/opt/graphite/storage/rrd";
$conf['graphite_prefix'] = "";

# One of the bottlenecks is that to get individual metrics we query gmetad which
# returns every single host and all the metrics. If you have lots of hosts and lots of
# returns every single host and all the metrics. If you have lots of hosts and lots of
# checks this may be quite heavy so you may want to cache data
$conf['cachedata'] = 1;
$conf['cachemodule'] = 'Json';
Expand Down Expand Up @@ -308,7 +308,7 @@ $conf['default_graph_size'] = 'default';
$conf['graph_sizes_keys'] = array_keys( $conf['graph_sizes'] );

# sets a default graph size separate from the regular default graph size. You
# can also set this default on a per-view basis by setting 'default_size' in
# can also set this default on a per-view basis by setting 'default_size' in
# the view .json file.
$conf['default_view_graph_size'] = 'medium';

Expand Down Expand Up @@ -378,15 +378,15 @@ $conf['graph_colors'] = array("0000A3", "FF3300", "FFCC33", "00CC66", "B88A00",
# Are heatmaps enabled
$conf['heatmaps_enabled'] = 1;

# Decorated titles are of the form cluster/host, graph_title/metric,
# time range. By setting this attribute to false the clsuter/host and
# Decorated titles are of the form cluster/host, graph_title/metric,
# time range. By setting this attribute to false the clsuter/host and
# time range items are excluded.
$conf['decorated_graph_title'] = true;

# If set to yes, will display stacked graph (aggregated metric across hosts) in cluster view
$conf['show_stacked_graphs'] = 1;

# If set to false the grid view under the main tab will be displayed only if
# If set to false the grid view under the main tab will be displayed only if
# the grid name is not "unspecified", or a parent grid has been defined.
# If set to true the grid view will always be displayed even when only a
# single cluster has been defined.
Expand Down Expand Up @@ -427,30 +427,30 @@ $conf['display_events_using_calendar'] = false;

# Organize views using a tree. A new attribute "parent" has been
# added to the json definition of a view that is used to specify
# the path from the root node to its desired folder, e.g.
# the path from the root node to its desired folder, e.g.
# "Exchange Servers/Throughtput". Individual path entries are
# separated by a forward slash.
$conf['display_views_using_tree'] = false;

# Array of pathnames that define view tree nodes that should be opened
# when the tree is first created in a browser session. Path entries are
# when the tree is first created in a browser session. Path entries are
# separated using "--"
#$conf['view_tree_nodes_initially_open'] = array();

# Gmetad will send back <EXTRA_DATA> information that is not utilized
# in many code paths. This will pre-emptively strip out the tags in
# in many code paths. This will pre-emptively strip out the tags in
# those code paths to save time during XML parsing.
$conf['strip_extra'] = true;

# By default we'll just download Jquery, Cubism and D3 required libraries from a CDN that offers
# that for free. If that is undesirable you can override this in conf.php by putting
# that for free. If that is undesirable you can override this in conf.php by putting
# downloading the asset and putting relative path or absolute paths to it e.g.
#$conf['cubism_js_path'] = "js/cubism.v1.min.js";
$conf['jquery_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js";
$conf['jquery_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js";
$conf['jquerymobile_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/jquery-mobile/1.4.5/jquery.mobile.min.js";
$conf['jqueryui_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js";
$conf['jqueryui_smoothness_css_path'] = "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.min.css";
$conf['jquery_scrollTo_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/1.4.13/jquery.scrollTo.min.js";
$conf['jqueryui_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js";
$conf['jqueryui_smoothness_css_path'] = "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/themes/smoothness/jquery-ui.min.css";
$conf['jquery_scrollTo_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.2/jquery.scrollTo.min.js";
$conf['jquery_cookie_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js";
$conf['rickshaw_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.5.1/rickshaw.min.js";
$conf['cubism_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/cubism/1.6.0/cubism.v1.min.js";
Expand All @@ -465,8 +465,8 @@ $conf['moment_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.
$conf['moment-timezone_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.2.1/moment-timezone-with-data.min.js";
$conf['select2_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js";
$conf['select2_css_path'] = "https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css";
$conf['fullcalendar_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/1.6.1/fullcalendar.min.js";
$conf['fullcalendar_css_path'] = "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/1.6.1/fullcalendar.min.css";
$conf['fullcalendar_js_path'] = "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.9.0/fullcalendar.min.js";
$conf['fullcalendar_css_path'] = "https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.9.0/fullcalendar.min.css";

$conf['jquery_flot_base_path'] = "https://cdnjs.cloudflare.com/ajax/libs/flot/0.8.3/jquery.flot";

Expand Down
67 changes: 38 additions & 29 deletions events.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
include_once $conf['gweb_root'] . "/functions.php";
include_once $conf['gweb_root'] . "/lib/common_api.php";

$events = ganglia_events_get($_GET['start'], $_GET['end']);
$start = new DateTime($_GET['start']);
$end = new DateTime($_GET['end']);
$events = ganglia_events_get($start->getTimestamp(), $end->getTimestamp());
$cal_events = array();
foreach ( $events as $id => $event ) {
$cal_event = array('title' => $event['summary'],
'start' => $event['start_time'],
'end' => (isset($event['end_time']) ?
$event['end_time'] : ""),
'start' => $event['start_time'] * 1000,
'end' => isset($event['end_time']) ? $event['end_time'] * 1000 : NULL,
'gweb_event_id' => $event['event_id'],
'grid' => $event['grid'],
'cluster' => $event['cluster'],
Expand All @@ -24,7 +25,7 @@

if (isset($event['end_time']))
$cal_event['end_time'] = $event['end_time'];

array_push($cal_events, $cal_event);
}
$json = json_encode($cal_events);
Expand Down Expand Up @@ -67,33 +68,42 @@ function refreshOverlayEvent() {

<?php if ($conf['display_events_using_calendar']) { ?>
$('#calendar').fullCalendar({
timezone: 'local',
editable: false,
disableDragging: true,
disableResizing: true,
events: 'events.php?calendar_events_only=1',
disableResizing: true,
eventSources: [
{
url: 'events.php',
data: {
calendar_events_only: '1'
}
}
],
defaultView: 'basicWeek',
header: {left: 'title',
center: '',
right: 'today prev next basicDay basicWeek month'},
header: {left: 'prev,next,today',
center: 'title',
right: 'basicDay,basicWeek,month'},
eventRender: function(event, element) {
var fmt = "HH:mm:ss";

console.log("event = " + JSON.stringify(event));
var start = moment(event.start_time * 1000);
var end = null;
if ('end_time' in event) {
var startDate = new Date(event.start_time * 1000);
var endDate = new Date(event.end_time * 1000);
if (startDate.getFullYear() != endDate.getFullYear()) {
var end = moment(event.end_time * 1000);
if (start.year() != end.year()) {
fmt = "MM/dd/yyyy " + fmt;
} else {
if ((startDate.getDate() != endDate.getDate()) ||
(startDate.getMonth() != endDate.getMonth()))
if ((start.date() != end.date()) ||
(start.month() != end.month()))
fmt = "MM/dd " + fmt;
}
}

var tipText = event.title +
'<br>Start: ' + $.fullCalendar.formatDate(new Date(event.start_time * 1000), fmt);
if ('end_time' in event)
tipText += '<br>End: ' + $.fullCalendar.formatDate(new Date(event.end_time * 1000), fmt);
'<br>Start: ' + start.format(fmt);
if (end)
tipText += '<br>End: ' + end.format(fmt);

element.qtip({
content : {
Expand Down Expand Up @@ -169,17 +179,17 @@ function eventActions(action) {
alert("You must specify a regular expression describing the host(s) to which this event should be associated.");
return false;
}
queryString += "&host_regex=" + encodeURIComponent(host_regex);
queryString += "&host_regex=" + encodeURIComponent(host_regex);

/*
alert('api/events.php' +
"action=" + action +
alert('api/events.php' +
"action=" + action +
"&summary=" + summary + queryString);
*/

$("#event-message").html('<img src="img/spinner.gif">');
$.get('api/events.php',
"action=" + action +
$.get('api/events.php',
"action=" + action +
"&summary=" + encodeURIComponent(summary) + queryString, function(data) {
$("#event-message").html(data);
});
Expand All @@ -203,7 +213,7 @@ function eventActions(action) {
</div>
<br>

<?php
<?php
} // if (!isset($_GET['events_only']))

if ($conf['display_events_using_calendar']) {
Expand All @@ -221,21 +231,20 @@ function eventActions(action) {
print "<th>Host Regex</th>";
print "</tr>";
print "</thead>";

include_once $conf['gweb_root'] . "/functions.php";
include_once $conf['gweb_root'] . "/lib/common_api.php";

function start_time_cmp($ev1, $ev2) {
$start1 = $ev1['start_time'];
$start2 = $ev2['start_time'];

if ($start1 == $start2)
return 0;

return ($start1 < $start2) ? 1 : -1;
}


$events_array = ganglia_events_get();
if (count($events_array) > 0) {
print "<tbody>";
Expand Down
Loading

0 comments on commit 8338086

Please sign in to comment.