All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 7a2fd436 authored by Leigh B Stoller's avatar Leigh B Stoller

Show the maximum allowed extension when under a week, with warning

colors. I also reduced line padding a bit to make the table take up a
bit less room.
parent 688b8768
......@@ -122,6 +122,10 @@ $(function ()
});
ProgressBarUpdate();
// Periodic check for max allowed extension
LoadMaxExtension();
setInterval(LoadMaxExtension, 3600 * 1000);
// This activates the popover subsystem.
$('[data-toggle="popover"]').popover({
trigger: 'hover',
......@@ -2666,6 +2670,51 @@ $(function ()
"callback" : callback});
}
/*
* Get the max allowed extension and show a warning if its below
* a couple of days.
*/
function LoadMaxExtension()
{
var maxcallback = function(json) {
if (json.code) {
console.info("Failed to get max extension: " + json.value);
return;
}
var maxdate = new Date(json.value);
//console.info("Max extension date:", maxdate);
/*
* See if the difference is less then two days
*/
var now = new Date();
var hours = Math.floor((maxdate.getTime() -
now.getTime()) / (1000 * 3600.0));
if (hours < (7 * 24)) {
return;
}
//console.info("Max allowed extension hours: ", hours);
var when = moment(maxdate).format('lll');
var fromnow = moment(maxdate).fromNow(true) + " from now";
$('#maximum-extension-string').html(when + " (" + fromnow + ")");
if (hours < 48) {
$('#maximum-extension-string').removeClass("text-warning");
$('#maximum-extension-string').addClass("text-danger");
}
else {
$('#maximum-extension-string').removeClass("text-danger");
$('#maximum-extension-string').addClass("text-warning");
}
$('.maximum-extension').removeClass("hidden");
}
var xmlthing =
sup.CallServerMethod(null, "status", "MaxExtension",
{"uuid" : uuid});
xmlthing.done(maxcallback);
}
// Helper.
function decodejson(id) {
return JSON.parse(_.unescape($(id)[0].textContent));
......
......@@ -20,7 +20,15 @@ pre {
white-space: pre-wrap;
}
.panel-body-nopad {
padding: 5px;
padding: 5px;
}
.table-condensed > thead > tr > th,
.table-condensed > tbody > tr > th,
.table-condensed > tfoot > tr > th,
.table-condensed > thead > tr > td,
.table-condensed > tbody > tr > td,
.table-condensed > tfoot > tr > td {
padding: 3px;
}
</style>
<div class='row'>
......@@ -127,6 +135,24 @@ pre {
</span>
</td>
</tr>
<tr>
<td class='border-none'>Extendable:</td>
<td class='border-none maximum-extension hidden'>
<span id="maximum-extension-string"></span>
<a href='#' class='btn btn-xs'
data-toggle='popover'
data-html='true'
data-delay='{"hide":500}'
data-content="This is the maximum extension that is
<em>possible</em> because of future reservation
promises for the resources you are using. It
does not mean you will be granted an extension
till this date.">
<span class='glyphicon glyphicon-question-sign'
style='margin-bottom: 4px;'></span>
</a>
</td>
</tr>
</table>
<div class='pull-left'>
<a class='btn btn-info btn-xs pull-left hidden'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment