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 8048f20e authored by Leigh B Stoller's avatar Leigh B Stoller

Work on issue #287, making use of ready/reloading info to improve

messages we show users.
parent 261efdd6
......@@ -1045,6 +1045,8 @@ $(function ()
var projectReservations = {}
var requested = 0;
var inuse = 0;
var ready = 0;
var reloading = 0;
$('#reservation_confirmation').addClass('hidden');
$('#reservation_warning').addClass('hidden');
......@@ -1110,12 +1112,12 @@ $(function ()
function(thelist, resproj) {
_.each(thelist,
function(obj) {
var req = obj.reserved;
var used = obj.used;
var type = obj.nodetype;
console.info("current", req, used, type,
resproj, project);
var req = obj.reserved;
var used = obj.used;
var type = obj.nodetype;
console.info("current", req, used, obj.ready,
obj.reloading, type, resproj, project);
// Current project has a current reservation
// Used for cluster icons
......@@ -1125,6 +1127,8 @@ $(function ()
// All nodes for current project reservations.
requested += parseInt(req);
inuse += parseInt(used);
ready += parseInt(obj.ready);
reloading += parseInt(obj.reloading);
currentReservations = true;
}
projectReservations[resproj] = {
......@@ -1160,11 +1164,15 @@ $(function ()
}
if (hasReservation || start != null) {
//console.info("res", project, start, end, earliest,
// requested, inuse);
if (0) {
console.info("res", project, start, end, earliest,
requested, inuse, ready, reloading);
}
$(this).attr('data-res-pid', project);
$(this).attr('data-res-requested', requested);
$(this).attr('data-res-used', inuse);
$(this).attr('data-res-ready', ready);
$(this).attr('data-res-reloading', reloading);
if (hasReservation) {
$(this).removeAttr('data-res-end');
$(this).removeAttr('data-res-upcoming');
......@@ -1197,6 +1205,8 @@ $(function ()
$(this).removeAttr('data-res-end');
$(this).removeAttr('data-res-requested');
$(this).removeAttr('data-res-used');
$(this).removeAttr('data-res-ready');
$(this).removeAttr('data-res-reloading');
$(this).removeAttr('data-res-upcoming');
}
}
......
......@@ -47,8 +47,6 @@ window.wt = (function() {
if ($(that).parent().attr('data-res-pid')) {
var project = $(that).parent().attr('data-res-pid');
var requested = $(that).parent().attr('data-res-requested');
var used = $(that).parent().attr('data-res-used');
if ($(that).parent().attr('data-res-start')) {
var start = new Date(parseInt($(that).parent()
......@@ -67,15 +65,32 @@ window.wt = (function() {
$('#reservation_warning').addClass('hidden');
if ($(that).parent().attr('data-now') == 'true') {
var requested =
$(that).parent().attr('data-res-requested');
var used =
$(that).parent().attr('data-res-used');
var ready =
$(that).parent().attr('data-res-ready');
var reloading =
$(that).parent().attr('data-res-reloading');
$(this).attr('data-res-pid', project);
$('#reservation_future').addClass('hidden');
$('#reservation_confirmation .reservation_requested')
.html(requested);
$('#reservation_confirmation .reservation_used')
.html(used);
$('#reservation_confirmation .reservation_project')
.html(project);
$('#reservation_confirmation').removeClass('hidden');
var warning =
CurrentReservationWarning(project,
parseInt(requested),
parseInt(used),
parseInt(ready),
parseInt(reloading));
if (warning) {
$('#reservation_confirmation #reservation_text')
.html(warning);
$('#reservation_confirmation')
.removeClass('hidden');
}
}
else {
var start = new Date(parseInt($(that).parent()
......@@ -261,6 +276,47 @@ window.wt = (function() {
+'</div></div>'
}
function CurrentReservationWarning(project, requested,
used, ready, reloading)
{
var html = "Project " + project + " " +
"has reservations on this cluster for " + requested + " " +
"nodes. ";
if (used >= requested) {
html = html +
"Currently the project has all of the nodes " +
"in the reservation.";
}
else if (used + ready >= requested) {
html = html +
"The project is currently using " + used + " " +
"nodes, " + (requested - used) + " " +
"nodes are immediately available.";
}
else if (used + ready + reloading >= requested) {
html = html +
"The project is currently using " + used + " " +
"nodes, " + ready + " nodes " +
"are immediately available, " +
(requested - (used + ready)) + " nodes will be available " +
"very soon.";
}
else {
html = html +
"The project is currently using " + used + " nodes";
if (ready) {
html = html +
", " + ready + " are immediately available";
}
if (reloading) {
html = html +
", " + reloading + " will be available very soon";
}
html = html + ".";
}
return html;
}
return {
StatusClickEvent: StatusClickEvent,
ResClickEvent: ResClickEvent,
......
......@@ -356,8 +356,11 @@
<div id='reservation_warning' class='hidden col-sm-12'>
<label id='reservation_text' class='alert-warning col-sm-10 col-sm-offset-1'>There is an upcoming reservation on this cluster that may impact your ability to reserve or extend resources. This reservation is from <span class='reservation_start'>start</span> until <span class='reservation_end'>end</span>.</label>
</div>
<div id='reservation_confirmation' class='hidden col-sm-12'>
<label id='reservation_text' class='alert-success col-sm-10 col-sm-offset-1'>Project <span class="reservation_project"></span> has reservations on this cluster for <span class="reservation_requested"></span> nodes, of which <span class="reservation_used"></span> are already allocated by the project.</label>
<div id='reservation_confirmation'
class='hidden col-sm-12'>
<label id='reservation_text'
class='alert-success col-sm-10 col-sm-offset-1'>
</label>
</div>
<div id='reservation_future' class='hidden col-sm-12'>
<label id='reservation_text' class='alert-warning col-sm-10 col-sm-offset-1'>Project <span class="reservation_project"></span> has a reservation on this cluster beginning <span class='reservation_start'>start</span>.</label>
......
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