Commit e0633f56 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Various fixes and improvements for image snapshot/clone.

parent 0b49431e
......@@ -29,7 +29,7 @@ define(['underscore', 'js/quickvm_sup', 'filesize',
if (imaging_modal_active) {
sup.HideModal("#imaging-modal");
imaging_modal_active = false;
$('#imaging_modal').off('hidden.bs.modal');
$('#imaging-modal').off('hidden.bs.modal');
}
sup.SpitOops("oops", "Server says: " + json.value);
completion_callback(1);
......@@ -42,9 +42,9 @@ define(['underscore', 'js/quickvm_sup', 'filesize',
imaging_modal_display = false;
// Handler so we know the user closed the modal.
$('#imaging_modal').on('hidden.bs.modal', function (e) {
$('#imaging-modal').on('hidden.bs.modal', function (e) {
imaging_modal_active = false;
$('#imaging_modal').off('hidden.bs.modal');
$('#imaging-modal').off('hidden.bs.modal');
})
}
......@@ -85,6 +85,20 @@ define(['underscore', 'js/quickvm_sup', 'filesize',
$('#tracker-ready').removeClass('progtrckr-todo');
$('#tracker-ready').addClass('progtrckr-done');
$('#imaging-spinner').addClass("hidden");
if (_.has(value, "image_name")) {
$('#imaging-done-modal-imagename')
.text(value["image_name"]);
$('#imaging-modal-imagename')
.text(value["image_name"]);
if (!imaging_modal_active) {
sup.ShowModal("#imaging-done-modal");
}
else {
$('#imaging_modal_done_div')
.removeClass("hidden");
}
}
$('#imaging-close').removeClass("hidden");
completion_callback(0);
return;
......@@ -135,9 +149,10 @@ define(['underscore', 'js/quickvm_sup', 'filesize',
if (imagingTemplate == null) {
imagingTemplate = _.template(imagingString);
var imaging_html = imagingTemplate({});
$('#imaging_div').html(imaging_html);
}
var imaging_html = imagingTemplate({});
$('#imaging_div').html(imaging_html);
imaging_modal_display = true;
ShowImagingModal();
}
......
......@@ -23,6 +23,7 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
var oneonly = 0;
var isadmin = 0;
var isguest = 0;
var ispprofile = 0;
var dossh = 1;
var profile_uuid= null;
var extend = null;
......@@ -48,6 +49,7 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
isguest = (window.APT_OPTIONS.registered ? false : true);
dossh = window.APT_OPTIONS.dossh;
extend = window.APT_OPTIONS.extend || null;
ispprofile = window.APT_OPTIONS.ispprofile;
profile_uuid = window.APT_OPTIONS.profileUUID;
lockout = window.APT_OPTIONS.lockout;
lockdown = window.APT_OPTIONS.lockdown;
......@@ -388,7 +390,10 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
$("#status_progress_bar").width("100%");
}
EnableButtons();
AutoStartSSH();
// We should be looking at the node status instead.
if (lastStatus != "imaging") {
AutoStartSSH();
}
}
else if (status == 'failed') {
bgtype = "panel-danger";
......@@ -1378,10 +1383,20 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
if (node_id) {
// Default to checked any time we show the modal.
$('#snapshot_update_profile').prop("checked", true);
$('#snapshot_update_profile_div').removeClass("hidden");
if (ispprofile) {
$('#snapshot_update_profile_div').addClass("hidden");
$('#snapshot_update_script_div').removeClass("hidden");
}
else {
$('#snapshot_update_profile_div').removeClass("hidden");
$('#snapshot_update_script_div').addClass("hidden");
}
}
else {
$('#snapshot_update_profile_div').addClass("hidden");
if (ispprofile) {
$('#snapshot_update_script_div').removeClass("hidden");
}
}
sup.ShowModal('#snapshot_modal');
......
......@@ -63,6 +63,9 @@ function Do_CloneStatus()
# Success, but not sure what to report. Come back to this later.
$blob["exited"] = $webtask->exited();
$blob["exitcode"] = $webtask->exitcode();
if (isset($taskdata["image_name"])) {
$blob["image_name"] = $taskdata["image_name"];
}
}
#
# Size is in KB to avoid bigint problems. But kill the KB.
......
......@@ -826,6 +826,9 @@ function Do_SnapshotStatus()
# Success, but not sure what to report. Come back to this later.
$blob["exited"] = $webtask->exited();
$blob["exitcode"] = $webtask->exitcode();
if (isset($taskdata["image_name"])) {
$blob["image_name"] = $taskdata["image_name"];
}
$webtask->Delete();
}
SPITAJAX_RESPONSE($blob);
......
Supports Markdown
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