Commit 8f6723e4 authored by Leigh Stoller's avatar Leigh Stoller

Changes to make sure user is aware when they are deleting the most

recent version of a profile.
parent 2c2677b8
......@@ -297,6 +297,7 @@ sub DoListImages()
my %tmp = ();
foreach my $profile (@nakedusing) {
my $profile_uuid = $profile->profile_uuid();
my $headversion = $profile->HeadVersionNumber();
if (!exists($tmp{$profile_uuid})) {
$tmp{$profile_uuid} = {
......@@ -308,9 +309,10 @@ sub DoListImages()
};
}
push(@{$tmp{$profile_uuid}->{'versions'}},
{"uuid" => $profile->uuid(),
"version" => $profile->version(),
"created" => $profile->created(),
{"uuid" => $profile->uuid(),
"version" => $profile->version(),
"created" => $profile->created(),
"iscurrent"=> ($profile->version() == $headversion ? 1 : 0),
});
}
$ref->{'using'} = [ values(%tmp) ];
......@@ -357,6 +359,7 @@ sub DoListImages()
%tmp = ();
foreach my $profile (@using) {
my $profile_uuid = $profile->profile_uuid();
my $headversion = $profile->HeadVersionNumber();
if (!exists($tmp{$profile_uuid})) {
$tmp{$profile_uuid} = {
......@@ -368,9 +371,11 @@ sub DoListImages()
};
}
push(@{$tmp{$profile_uuid}->{'versions'}},
{"uuid" => $profile->uuid(),
"version" => $profile->version(),
"created" => $profile->created(),
{"uuid" => $profile->uuid(),
"version" => $profile->version(),
"created" => $profile->created(),
"iscurrent"=> ($profile->version() ==
$headversion ? 1 :0),
});
}
$image->{'using'} = [ values(%tmp) ];
......
......@@ -33,7 +33,7 @@ $(function ()
_.each(amlist, function(urn, name) {
var callback = function(json) {
console.info(json);
console.info(name, json);
// Kill the spinner.
count--;
......
......@@ -176,6 +176,10 @@ $(function ()
$('#rspectext_div').html(rspectext_html);
$('#share_div').html(shareTemplate({formfields: fields}))
$('#confirm_delete_div').html(deleteString);
// Extra warning in the confirm delete modal.
if (window.THIS_VERSION == window.LATEST_VERSION) {
$('#confirm-delete-profile-warning').removeClass("hidden");
}
// Fireoff repo stuff now.
if (fromrepo) {
......
......@@ -77,6 +77,7 @@ function SPITFORM($formfields, $errors)
$disabled = 0;
$version_uuid = "null";
$profile_uuid = "null";
$this_version = "null";
$latest_uuid = "null";
$latest_version = "null";
......@@ -93,6 +94,7 @@ function SPITFORM($formfields, $errors)
$activity = ($profile->HasActivity() ? 1 : 0);
$ispp = ($profile->isParameterized() ? 1 : 0);
$disabled = ($profile->isDisabled() ? 1 : 0);
$this_version = $profile->version();
if ($canmodify) {
$title = "Modify Profile";
}
......@@ -183,6 +185,7 @@ function SPITFORM($formfields, $errors)
echo " window.PROFILE_UUID = $profile_uuid;\n";
echo " window.LATEST_UUID = $latest_uuid;\n";
echo " window.LATEST_VERSION = $latest_version;\n";
echo " window.THIS_VERSION = $this_version;\n";
echo " window.UPDATED = $notifyupdate;\n";
echo " window.SNAPPING = $notifyclone;\n";
echo " window.AJAXURL = 'server-ajax.php';\n";
......
......@@ -18,6 +18,7 @@
</button>
</center>
<br>
<% var warn = 0; %>
Note: This operation is not reversible, your image will be
permanently deleted, freeing up the disk space it using.
<div id="profile-list"
......@@ -27,7 +28,7 @@
deleted since they are using this image and will no longer
work after the image is deleted.
<div class="table-responsive">
<table class='table table-condensed'>
<table class='table table-condensed' style="margin-bottom: 10px;">
<thead>
<tr>
<th>Name</th>
......@@ -46,6 +47,10 @@
<td>
<a href="show-profile.php?uuid=<%- version.uuid %>"
target="_blank"><%- version.version %></a>
<% if (version.iscurrent) { warn = 1; %>
<span class="text-danger
glyphicon glyphicon-asterisk"></span>
<% } %>
</td>
<td><%= profile.creator %></td>
<td><%= profile.project %></td>
......@@ -57,6 +62,13 @@
<% } %>
</tbody>
</table>
<% if (warn) { %>
<span class="text-danger
glyphicon glyphicon-asterisk"></span>
<span class="text-danger">
This is the most recent version of profile. Are you sure
you want to delete it?</span>
<% } %>
</div>
</div>
</div>
......
......@@ -3,7 +3,12 @@
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<center><h4>Are you sure you want to delete this profile?</h4></center>
<center><h4 style="margin-bottom: 2px">
Are you sure you want to delete this profile?</h4>
<span class="hidden" id="confirm-delete-profile-warning">
(Note: this is the most <em>recent version</em> of this profile)
</span>
</center>
</div>
<div class='modal-body'>
<p>
......
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