Commit 1ba99a77 authored by Leigh B Stoller's avatar Leigh B Stoller

Minor fix to calculating day, add a confirm modal for termination.

parent 5153df96
......@@ -70,10 +70,17 @@ $extensions = ExtensionInfo::LookupForInstance($instance);
$days = "null";
if ($instance->extension_requested()) {
$extension = $extensions[0];
if ($extension->action() == "request" &&
$extension->granted() < $extension->wanted()) {
$days = $extension->wanted() - $extension->granted();
#
# Find the last extension request, we might have sent an info
# request out.
#
foreach ($extensions as $extension) {
if ($extension->action() == "request") {
if ($extension->granted() < $extension->wanted()) {
$days = $extension->wanted() - $extension->granted();
}
break;
}
}
}
$pid = $instance->pid();
......@@ -121,6 +128,7 @@ if ($instance->extension_reason() && $instance->extension_reason() != "") {
if (count($extensions)) {
$foo = array();
reset($extensions);
foreach ($extensions as $extension) {
$foo[$extension->idx()] = $extension->info;
}
......
......@@ -87,6 +87,7 @@ function (_, sup, moment, ShowIdleGraphs,
});
$('#do-terminate').click(function (event) {
event.preventDefault();
sup.HideModal("#confirm-terminate-modal");
Action("terminate");
return false;
});
......
......@@ -57,8 +57,8 @@ pre {
<div style="margin-top: 10px;">
<button class='btn btn-primary btn-sm'
style='margin-right: 20px;'
id='do-terminate'
type='submit' name='moreinfo'>Terminate</button>
data-toggle='modal' data-target='#confirm-terminate-modal'
type='button' name='terminate'>Terminate</button>
<button class='btn btn-danger btn-sm'
style='margin-right: 20px;'
id='deny-extension'
......@@ -534,3 +534,17 @@ pre {
</div>
</script>
</div>
<!-- Confirm Terminate -->
<div id='confirm-terminate-modal' class='modal fade'>
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-body'>
<button type='button' class='close' data-dismiss='modal'
aria-hidden='true'>&times;</button>
<center><h3>Confirm to Terminate</h3>
<button class='btn btn-danger btn-sm'
id='do-terminate'>Confirm</a></center>
</div>
</div>
</div>
</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