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

Status / Monitoring - Graph Refresh Enhancement #240

Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,9 @@ function createSlug($string) {
<span class="help-block">Inverse</span>
</div>
<div class="col-sm-2">
<select class="form-control" data-toggle="tooltip" data-trigger="hover" data-placement="top" title="You must save this view for the refresh interval to take effect." id="refresh-interval" name="refresh-interval">
<select class="form-control" data-toggle="tooltip" data-trigger="hover" data-placement="top" title="The refresh interval will take effect immediately." id="refresh-interval" name="refresh-interval">
<option value="0" selected>Never</option>
<option value="-1">Settings Change</option>
<option value="60000">1 Minute</option>
<option value="300000">5 Minutes</option>
<option value="600000">10 Minutes</option>
Expand Down Expand Up @@ -1561,6 +1562,34 @@ function calculate_summary(data) {
$('acronym').tooltip();
}

// Refresh graph scheduler.
var refresh_id;
function refresh_graph_scheduler() {
var refresh_interval = $( "#refresh-interval" ).val();
Visibility.stop(refresh_id);
if(refresh_interval > 0) {
refresh_id = Visibility.every(refresh_interval, function () {
$("#chart-error").hide();
draw_graph(getOptions());
});
}
}

// Refresh graph when settings changes are made.
$('#category-left, #category-right, #graph-left, #graph-right, #time-period, #resolution, #graph-type, #invert, #start-date, #end-date, #start-time, #end-time').on('change', function() {
// If "Settings Change" refresh interval option is selected.
if ($( "#refresh-interval" ).val() == -1) {
$("#chart-error").hide();
draw_graph(getOptions());
refresh_graph_scheduler();
}
});

// Apply refresh interval setting immediately when changed.
$('#refresh-interval').on('change', function() {
refresh_graph_scheduler();
});

var chart;

<?php
Expand All @@ -1580,16 +1609,7 @@ function calculate_summary(data) {
} else {

draw_graph(getOptions());

var refresh_interval = $( "#refresh-interval" ).val();

if(refresh_interval > 0) {

var refresh_id = Visibility.every(refresh_interval, function () {
draw_graph(getOptions());
});

}
refresh_graph_scheduler();

}

Expand Down