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 autorefresh button to scheduling checks page #3185

Merged
merged 2 commits into from
Dec 24, 2020
Merged
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
13 changes: 12 additions & 1 deletion esp/public/media/default_styles/scheduling_checks.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,15 @@ table {
}
.alittlepspace {
padding-top: 8px;
}
}

input[name="refresh_interval"] {
width: 40px;
float: right;
margin-right: 10px;
}

button[name="refresh"] {
float: right;
margin-right: 10px;
}
34 changes: 34 additions & 0 deletions esp/public/media/scripts/program/modules/scheduling_checks.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
var auto_running = false;
var myInterval;

$j(function(){
function refreshAll() {
if (auto_running) {
$j("button.refresh-button").click();
// Allow for updating fresh interval while the refresh is already running
myInterval = setTimeout(refreshAll, $j("[name=refresh_interval]").val() * 1000);
}
}
$j("[name=refresh]").click(function() {
if (auto_running) {
auto_running = false;
// Change button class and text
$j(this).addClass("btn-success");
$j(this).removeClass("btn-danger");
$j(this).html("Start Auto Refresh");

// Stop autorefreshing
clearTimeout(myInterval);
} else {
auto_running = true;
// Change button class and text
$j(this).addClass("btn-danger");
$j(this).removeClass("btn-success");
$j(this).html("Stop Auto Refresh");

// Start autorefreshing
refreshAll()
}
});
});

/**
* List of scheduling checks.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ <h1>Schedule Diagnostic Output for {{program.niceName}} </h1>
<p>Clicking "Include unreviewed classes" will show all classes in the diagnostic.</p>
<br></div>
<a class="btn move_left" href="scheduling_checks{% if unreviewed %}">Exclude{% else %}?unreviewed">Include{% endif %} unreviewed classes</a>
<button class="btn btn-success" name="refresh">Start Auto Refresh</button><input type="number" min="5" name="refresh_interval" title="(Refresh interval in seconds)" value=30>

<div id="scheduling-check-wrapper" />
<script type="text/jsx">
Expand Down