Commit cdd60e03 authored by Leigh Stoller's avatar Leigh Stoller

Change previous revision wrt terminate/freeze to allow quarantine or

terminate instead.
parent 7f170620
This diff is collapsed.
...@@ -264,11 +264,7 @@ $(function () ...@@ -264,11 +264,7 @@ $(function ()
lockdown_override}); lockdown_override});
xmlthing.done(callback); xmlthing.done(callback);
}); });
// Warn/Kill an experiment. SetupWarnKill();
$('#warnkill-experiment-button').click(function (event) {
event.preventDefault();
WarnExperiment();
});
// Handler for select/deselect all rows in the list view. // Handler for select/deselect all rows in the list view.
$('#select-all').change(function () { $('#select-all').change(function () {
...@@ -670,6 +666,12 @@ $(function () ...@@ -670,6 +666,12 @@ $(function ()
if (expinfo.admin_lockdown || !window.APT_OPTIONS.canterminate) { if (expinfo.admin_lockdown || !window.APT_OPTIONS.canterminate) {
terminate = 0; terminate = 0;
} }
// Or if paniced, most buttons disabled.
if (expinfo.paniced) {
terminate = extend = snapshot = destroy = 0;
refresh = reloadtopo = 0;
}
ButtonState('terminate', terminate); ButtonState('terminate', terminate);
ButtonState('refresh', refresh); ButtonState('refresh', refresh);
ButtonState('reloadtopo', reloadtopo); ButtonState('reloadtopo', reloadtopo);
...@@ -3461,6 +3463,28 @@ $(function () ...@@ -3461,6 +3463,28 @@ $(function ()
/* /*
* Terminate with cause and optionally freeze user. * Terminate with cause and optionally freeze user.
*/ */
function SetupWarnKill()
{
$('#warnkill-experiment-button').click(function (event) {
event.preventDefault();
WarnExperiment();
});
// The Terminate/quarantine is a radio that can be unselected.
$('#destroy-quarantine-checkbox').change(function () {
if ($('#destroy-quarantine-checkbox').is(':checked')) {
// Flip the other checkbox off
$('#destroy-terminate-checkbox').prop("checked", false);
}
});
$('#destroy-terminate-checkbox').change(function () {
if ($('#destroy-terminate-checkbox').is(':checked')) {
// Flip the other checkbox off
$('#destroy-quarantine-checkbox').prop("checked", false);
}
});
}
function WarnExperiment() function WarnExperiment()
{ {
// Handler for the Snapshot confirm button. // Handler for the Snapshot confirm button.
...@@ -3469,6 +3493,7 @@ $(function () ...@@ -3469,6 +3493,7 @@ $(function ()
event.preventDefault(); event.preventDefault();
var reason = $('#destroy-experiment-reason').val(); var reason = $('#destroy-experiment-reason').val();
var kill = $('#destroy-terminate-checkbox').is(':checked'); var kill = $('#destroy-terminate-checkbox').is(':checked');
var panic = $('#destroy-quarantine-checkbox').is(':checked');
var freeze = $('#destroy-freeze-checkbox').is(':checked'); var freeze = $('#destroy-freeze-checkbox').is(':checked');
var args = {"uuid" : uuid}; var args = {"uuid" : uuid};
if (reason != "") { if (reason != "") {
...@@ -3480,6 +3505,9 @@ $(function () ...@@ -3480,6 +3505,9 @@ $(function ()
if (kill) { if (kill) {
args["terminate"] = true; args["terminate"] = true;
} }
else if (panic) {
args["quarantine"] = true;
}
sup.HideModal("#destroy-experiment-modal", function () { sup.HideModal("#destroy-experiment-modal", function () {
sup.ShowWaitWait(); sup.ShowWaitWait();
sup.CallServerMethod(null, "status", "Warn", args, sup.CallServerMethod(null, "status", "Warn", args,
......
...@@ -1903,10 +1903,13 @@ function Do_WarnExperiment() ...@@ -1903,10 +1903,13 @@ function Do_WarnExperiment()
chmod($filename, 0666); chmod($filename, 0666);
$options = "-f $filename "; $options = "-f $filename ";
} }
# Terminate experiment # Terminate or Quarantine experiment
if (isset($ajax_args["terminate"]) && $ajax_args["terminate"]) { if (isset($ajax_args["terminate"]) && $ajax_args["terminate"]) {
$options .= "-T "; $options .= "-T ";
} }
elseif (isset($ajax_args["quarantine"]) && $ajax_args["quarantine"]) {
$options .= "-Q ";
}
# Freeze user # Freeze user
if (isset($ajax_args["freeze"]) && $ajax_args["freeze"]) { if (isset($ajax_args["freeze"]) && $ajax_args["freeze"]) {
$options .= "-F "; $options .= "-F ";
......
...@@ -18,11 +18,16 @@ ...@@ -18,11 +18,16 @@
class='form-control' rows=5></textarea> class='form-control' rows=5></textarea>
</div> </div>
<input type=checkbox <input type=checkbox
id='destroy-quarantine-checkbox' value=yes>
Quarantine Experiment or
<input type=checkbox style="margin-left: 5px"
id='destroy-terminate-checkbox' value=yes> id='destroy-terminate-checkbox' value=yes>
Terminate Experiment Terminate Experiment
<input type=checkbox style="margin-left: 20px" <div>
<input type=checkbox
id='destroy-freeze-checkbox' value=yes> id='destroy-freeze-checkbox' value=yes>
Freeze User? Freeze User?
</div>
<div style="margin-top: 10px;"> <div style="margin-top: 10px;">
<button class='btn btn-primary' <button class='btn btn-primary'
style="margin-right: 10px;" style="margin-right: 10px;"
......
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