1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Feature #3782: Add confirmation dialogs to snapshot actions

This commit is contained in:
Carlos Martín 2015-07-02 12:30:34 +02:00
parent 7cd3378864
commit 7972b86665
2 changed files with 43 additions and 10 deletions

View File

@ -11,6 +11,8 @@ define(function(require){
var TemplateHtml = require('hbs!./snapshots/html');
var TemplateEmptyTable = require('hbs!utils/tab-datatable/empty-table');
var CONFIRM_DIALOG_ID = require('utils/dialogs/generic-confirm/dialogId');
/*
CONSTANTS
*/
@ -106,8 +108,18 @@ define(function(require){
$("#snapshot_flatten", context).on('click', function() {
var snapshot_id = $(".snapshot_check_item:checked", context).attr('snapshot_id');
Sunstone.runAction('Image.snapshot_flatten', that.element.ID,
{ "snapshot_id": snapshot_id});
Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
//header :
body : Locale.tr("This will delete all the other image snapshots"),
//question :
submit : function(){
Sunstone.runAction('Image.snapshot_flatten', that.element.ID,
{ "snapshot_id": snapshot_id});
}
});
Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
return false;
});
@ -128,8 +140,18 @@ define(function(require){
$("#snapshot_delete", context).on('click', function() {
var snapshot_id = $(".snapshot_check_item:checked", context).attr('snapshot_id');
Sunstone.runAction('Image.snapshot_delete', that.element.ID,
{ "snapshot_id": snapshot_id});
Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
//header :
body : Locale.tr("This will delete the image snapshot "+snapshot_id),
//question :
submit : function(){
Sunstone.runAction('Image.snapshot_delete', that.element.ID,
{ "snapshot_id": snapshot_id});
}
});
Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
return false;
});

View File

@ -20,6 +20,7 @@ define(function(require) {
var ATTACH_DISK_DIALOG_ID = require('../dialogs/attach-disk/dialogId');
var DISK_SNAPSHOT_DIALOG_ID = require('../dialogs/disk-snapshot/dialogId');
var DISK_SAVEAS_DIALOG_ID = require('../dialogs/disk-saveas/dialogId');
var CONFIRM_DIALOG_ID = require('utils/dialogs/generic-confirm/dialogId');
var RESOURCE = "VM"
var XML_ROOT = "VM"
@ -367,12 +368,22 @@ define(function(require) {
var disk_id = $(this).parents('.snapshots').attr('disk_id');
var snapshot_id = $(this).parents('.snapshot_row').attr('snapshot_id');
Sunstone.runAction(
'VM.disk_snapshot_delete',
that.element.ID,
{ "disk_id": disk_id,
"snapshot_id": snapshot_id
});
Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
//header :
body : Locale.tr("This will delete the disk snapshot "+snapshot_id),
//question :
submit : function(){
Sunstone.runAction(
'VM.disk_snapshot_delete',
that.element.ID,
{ "disk_id": disk_id,
"snapshot_id": snapshot_id
});
}
});
Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
return false;
});