mirror of https://github.com/apache/cloudstack.git
bug 5920: added confirmation dialog before allowing user to delete snapshots
- Fixed a NPE when listing templates.
This commit is contained in:
parent
76bc3e21e6
commit
0d27ac2e31
|
|
@ -1984,7 +1984,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
}
|
||||
|
||||
HypervisorType hypervisorType = HypervisorType.getType(cmd.getHypervisor());
|
||||
return listTemplates(cmd.getId(), cmd.getTemplateName(), cmd.getKeyword(), templateFilter, false, null, accountId, cmd.getPageSizeVal().intValue(), cmd.getStartIndex(), cmd.getZoneId(), hypervisorType);
|
||||
return listTemplates(cmd.getId(), cmd.getTemplateName(), cmd.getKeyword(), templateFilter, false, null, accountId, (cmd.getPageSizeVal() != null) ? cmd.getPageSizeVal().intValue() : null, cmd.getStartIndex(), cmd.getZoneId(), hypervisorType);
|
||||
}
|
||||
|
||||
private List<VMTemplateVO> listTemplates(Long templateId, String name, String keyword, TemplateFilter templateFilter, boolean isIso, Boolean bootable, Long accountId, Integer pageSize, Long startIndex, Long zoneId, HypervisorType hyperType) throws InvalidParameterValueException {
|
||||
|
|
|
|||
|
|
@ -144,6 +144,12 @@
|
|||
</div>
|
||||
<!-- Add Volume Dialog from Snapshot (end) -->
|
||||
|
||||
<!-- snapshot confirmation dialog (begin) -->
|
||||
<div id="dialog_confirmation_delete_snapshot" title="Confirmation" style="display:none">
|
||||
<p>Please confirm you want to delete the snapshot.</p>
|
||||
</div>
|
||||
<!-- snapshot confirmation dialog (end) -->
|
||||
|
||||
<!-- Create template from snapshot (begin) -->
|
||||
<div id="dialog_create_template_from_snapshot" title="Create Template from Snapshot" style="display:none">
|
||||
<div class="dialog_formcontent">
|
||||
|
|
|
|||
|
|
@ -242,6 +242,12 @@
|
|||
</div>
|
||||
<!-- Create Snapshot Dialog (end) -->
|
||||
|
||||
<!-- snapshot confirmation dialog (begin) -->
|
||||
<div id="dialog_confirmation_delete_snapshot" title="Confirmation" style="display:none">
|
||||
<p>Please confirm you want to delete the snapshot.</p>
|
||||
</div>
|
||||
<!-- snapshot confirmation dialog (end) -->
|
||||
|
||||
<!-- Recurring Snapshots Dialog (begin) -->
|
||||
<div id="dialog_recurring_snapshot" title="Recurring Snapshot" style="display:none;">
|
||||
<div class="dialog_snapshotcontainer">
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@
|
|||
function afterLoadSnapshotJSP() {
|
||||
//initialize dialog
|
||||
initDialog("dialog_add_volume_from_snapshot");
|
||||
initDialog("dialog_create_template_from_snapshot", 400);
|
||||
initDialog("dialog_create_template_from_snapshot", 400);
|
||||
initDialog("dialog_confirmation_delete_snapshot");
|
||||
|
||||
//populate dropdown
|
||||
$.ajax({
|
||||
|
|
@ -123,7 +124,8 @@ var snapshotActionMap = {
|
|||
"Delete Snapshot": {
|
||||
api: "deleteSnapshot",
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "deletesnapshotresponse",
|
||||
asyncJobResponse: "deletesnapshotresponse",
|
||||
dialogBeforeActionFn : doSnapshotDelete,
|
||||
inProcessText: "Deleting snapshot....",
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id){
|
||||
$midmenuItem1.remove();
|
||||
|
|
@ -140,6 +142,22 @@ var snapshotActionMap = {
|
|||
afterActionSeccessFn: function(json, $midmenuItem1, id){}
|
||||
}
|
||||
}
|
||||
|
||||
function doSnapshotDelete($actionLink, $thisTab, $midmenuItem1) {
|
||||
$("#dialog_confirmation_delete_snapshot")
|
||||
.dialog('option', 'buttons', {
|
||||
"Confirm": function() {
|
||||
$(this).dialog("close");
|
||||
var id = $thisTab.data("jsonObj").id;
|
||||
var apiCommand = "command=deleteSnapshot&id="+id;
|
||||
doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $thisTab);
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
|
||||
}
|
||||
}).dialog("open");
|
||||
}
|
||||
|
||||
function doCreateVolumeFromSnapshotInSnapshotPage($actionLink, $detailsTab, $midmenuItem1){
|
||||
var jsonObj = $detailsTab.data("jsonObj");
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ function afterLoadVolumeJSP() {
|
|||
initDialog("dialog_add_volume");
|
||||
initDialog("dialog_attach_volume");
|
||||
initDialog("dialog_add_volume_from_snapshot");
|
||||
initDialog("dialog_create_template_from_snapshot", 400);
|
||||
initDialog("dialog_create_template_from_snapshot", 400);
|
||||
initDialog("dialog_confirmation_delete_snapshot");
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=listOsTypes"),
|
||||
|
|
@ -888,7 +889,8 @@ var volumeSnapshotActionMap = {
|
|||
"Delete Snapshot": {
|
||||
api: "deleteSnapshot",
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "deletesnapshotresponse",
|
||||
asyncJobResponse: "deletesnapshotresponse",
|
||||
dialogBeforeActionFn : doSnapshotDelete,
|
||||
inProcessText: "Deleting snapshot....",
|
||||
afterActionSeccessFn: function(json, id, $subgridItem) {
|
||||
$subgridItem.slideUp("slow", function() {
|
||||
|
|
@ -904,7 +906,23 @@ var volumeSnapshotActionMap = {
|
|||
inProcessText: "Creating Template....",
|
||||
afterActionSeccessFn: function(json, id, $subgridItem) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function doSnapshotDelete($actionLink, $subgridItem) {
|
||||
$("#dialog_confirmation_delete_snapshot")
|
||||
.dialog('option', 'buttons', {
|
||||
"Confirm": function() {
|
||||
$(this).dialog("close");
|
||||
var id = $subgridItem.data("jsonObj").id;
|
||||
var apiCommand = "command=deleteSnapshot&id="+id;
|
||||
doActionToSubgridItem(id, $actionLink, apiCommand, $subgridItem);
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
|
||||
}
|
||||
}).dialog("open");
|
||||
}
|
||||
|
||||
function doCreateVolumeFromSnapshotInVolumePage($actionLink, $subgridItem) {
|
||||
var jsonObj = $subgridItem.data("jsonObj");
|
||||
|
|
|
|||
Loading…
Reference in New Issue