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

Backlog #3925: Add confirmation dialog to a couple actions

This commit is contained in:
Carlos Martín 2015-08-28 18:11:21 +02:00
parent d1f65ab012
commit 300813de81
3 changed files with 44 additions and 5 deletions

View File

@ -20,6 +20,7 @@ define(function(require) {
var TAB_ID = require('../tabId');
var PANEL_ID = require('./network/panelId');
var ATTACH_NIC_DIALOG_ID = require('../dialogs/attach-nic/dialogId');
var CONFIRM_DIALOG_ID = require('utils/dialogs/generic-confirm/dialogId');
var RESOURCE = "VM"
var XML_ROOT = "VM"
@ -352,7 +353,20 @@ define(function(require) {
context.off('click', '.detachnic');
context.on('click', '.detachnic', function() {
var nic_id = $(this).parents('tr').attr('nic_id');
Sunstone.runAction('VM.detachnic', that.element.ID, nic_id);
Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
//header :
body : Locale.tr("This will detach the nic inmediately"),
//question :
submit : function(){
Sunstone.runAction('VM.detachnic', that.element.ID, nic_id);
return false;
}
});
Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
return false;
});
}

View File

@ -300,7 +300,20 @@ define(function(require) {
context.off('click', '.detachdisk');
context.on('click', '.detachdisk', function() {
var disk_id = $(this).parents('tr').attr('disk_id');
Sunstone.runAction('VM.detachdisk', that.element.ID, disk_id);
Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
//header :
body : Locale.tr("This will detach the disk inmediately"),
//question :
submit : function(){
Sunstone.runAction('VM.detachdisk', that.element.ID, disk_id);
return false;
}
});
Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
return false;
});
}

View File

@ -26,6 +26,7 @@ define(function(require) {
var ADD_AR_DIALOG_ID = require('../dialogs/add-ar/dialogId');
var UPDATE_AR_DIALOG_ID = require('../dialogs/update-ar/dialogId');
var CONFIRM_DIALOG_ID = require('utils/dialogs/generic-confirm/dialogId');
/*
CONSTRUCTOR
@ -152,11 +153,22 @@ define(function(require) {
if (Config.isTabActionEnabled("vnets-tab", "Network.remove_ar")) {
context.off("click", 'button#rm_ar_button');
context.on("click", 'button#rm_ar_button', function(){
// TODO: confirm?
var ar_id = $(this).attr('ar_id');
var obj = {ar_id: ar_id};
Sunstone.runAction('Network.rm_ar',that.element.ID,obj);
Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({
//header :
body : Locale.tr("This will delete all the addresses in this range"),
//question :
submit : function(){
var obj = {ar_id: ar_id};
Sunstone.runAction('Network.rm_ar',that.element.ID,obj);
return false;
}
});
Sunstone.getDialog(CONFIRM_DIALOG_ID).reset();
Sunstone.getDialog(CONFIRM_DIALOG_ID).show();
return false;
});