Commit b078b2b2 authored by Leigh Stoller's avatar Leigh Stoller

Show the maximum slice extension on the admin extension page. There is a

slight delay filling in that table value, since we ask the backend
cluster(s) and fill in the value when it comes back.
parent bf3fb9f0
......@@ -168,6 +168,8 @@ function (_, sup, moment, ShowIdleGraphs,
trigger: 'hover',
placement: 'auto',
});
// Update the Max Extension
DoMaxExtension();
}
});
}
......@@ -258,6 +260,24 @@ function (_, sup, moment, ShowIdleGraphs,
xmlthing.done(callback);
}
//
// Get Max Extension and update the table.
//
function DoMaxExtension()
{
var callback = function(json) {
if (json.code) {
alert("Failed to change lockdown: " + json.value);
return;
}
$('#max-extension').html(moment(json.value)
.format("LLL"));
}
var xmlthing = sup.CallServerMethod(null, "status", "MaxExtension",
{"uuid" : window.UUID});
xmlthing.done(callback);
}
//
// Slothd graphs.
//
......
......@@ -160,6 +160,8 @@ $routing = array("myprofiles" =>
"Do_Linktest",
"OpenstackStats" =>
"Do_OpenstackStats",
"MaxExtension" =>
"Do_MaxExtension",
"dismissExtensionDenied" =>
"Do_DismissExtensionDenied")),
"approveuser" =>
......
......@@ -1861,6 +1861,45 @@ function Do_OpenstackStats()
SPITAJAX_RESPONSE($blob);
}
#
# Max extension allowed.
#
function Do_MaxExtension()
{
global $instance, $creator, $TBADMINGROUP;
if (StatusSetupAjax(0)) {
return;
}
$uuid = $instance->uuid();
$webtask = WebTask::CreateAnonymous();
# XXX Need to do this as elabman cause of emulab.key. Pondering.
$retval = SUEXEC("elabman", $TBADMINGROUP,
"webmanage_instance -t " . $webtask->task_id() . " -- ".
" maxextension $uuid",
SUEXEC_ACTION_IGNORE);
$webtask->Refresh();
if ($retval != 0) {
if ($webtask->exited()) {
SPITAJAX_ERROR($webtask->exitcode(), $webtask->TaskValue("output"));
}
elseif ($retval < 0) {
SPITAJAX_ERROR($retval, "Internal error, cannot proceed.");
# Notify tbops.
SUEXECERROR(SUEXEC_ACTION_CONTINUE);
}
else {
SPITAJAX_ERROR($retval, $suexec_output);
}
$webtask->Delete();
return;
}
$blob = $webtask->TaskValue("MaxExtension");
$webtask->Delete();
SPITAJAX_RESPONSE($blob);
}
# Local Variables:
# mode:php
# End:
......
......@@ -354,22 +354,25 @@ pre {
data-delay='{"hide":1000, "show":500}'
data-content="When checked, only administrator can extend
this experiment. No free time is granted to
user at all.">Lockout:</span></td>
<td><input type="checkbox" id="lockout-checkbox"
<% if (expinfo.lockout) { %>checked<% } %> >
user at all.">Lockout:</span>
<input type="checkbox" id="lockout-checkbox"
<% if (expinfo.lockout) { %>checked<% } %> >
</td>
<td>
<span data-toggle='popover'
data-delay='{"hide":1000, "show":500}'
data-content="When checked, the experiment
<span data-toggle='popover'
data-delay='{"hide":1000, "show":500}'
data-content="When checked, the experiment
cannot be terminated until the lockdown bit
is cleared by an admininstrator, or if the
user verifies
the lockdown code when clicking the Terminate
button.">Lockdown:</span></td>
<td><input type="checkbox" id="lockdown-checkbox"
<% if (expinfo.lockdown) { %>checked<% } %> >
button.">Lockdown:</span>
<input type="checkbox" id="lockdown-checkbox"
<% if (expinfo.lockdown) { %>checked<% } %> >
</td>
<td>Max Ext:</td>
<td id="max-extension">...</td>
<td></td>
</tbody>
</table>
</div>
......
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