Commit f3ddc10d authored by Dietmar Maurer's avatar Dietmar Maurer

fix bug #179: set default button 'no' for dangerous actions

parent c8e44125
pve-manager (2.0-64) unstable; urgency=low
* fix bug #179: set default button 'no' for dangerous actions
-- Proxmox Support Team <support@proxmox.com> Tue, 24 Apr 2012 08:09:23 +0200
pve-manager (2.0-63) unstable; urgency=low pve-manager (2.0-63) unstable; urgency=low
* fix bug 128: implement pvectl startall/stopall * fix bug 128: implement pvectl startall/stopall
......
...@@ -2,7 +2,7 @@ RELEASE=2.0 ...@@ -2,7 +2,7 @@ RELEASE=2.0
VERSION=2.0 VERSION=2.0
PACKAGE=pve-manager PACKAGE=pve-manager
PACKAGERELEASE=63 PACKAGERELEASE=64
BINDIR=${DESTDIR}/usr/bin BINDIR=${DESTDIR}/usr/bin
PERLLIBDIR=${DESTDIR}/usr/share/perl5 PERLLIBDIR=${DESTDIR}/usr/share/perl5
......
include ../defines.mk include ../defines.mk
LINGUAS=de it fr ja es sv ru zh_CN LINGUAS=de it fr ja es sv ru tr zh_CN
all: $(patsubst %, pve-lang-%.js, $(LINGUAS)) all: $(patsubst %, pve-lang-%.js, $(LINGUAS))
......
This diff is collapsed.
...@@ -15,6 +15,9 @@ Ext.define('PVE.button.Button', { ...@@ -15,6 +15,9 @@ Ext.define('PVE.button.Button', {
// function(record) or text // function(record) or text
confirmMsg: false, confirmMsg: false,
// take special care in confirm box (select no as default).
dangerous: false,
initComponent: function() { initComponent: function() {
/*jslint confusion: true */ /*jslint confusion: true */
...@@ -37,11 +40,18 @@ Ext.define('PVE.button.Button', { ...@@ -37,11 +40,18 @@ Ext.define('PVE.button.Button', {
if (Ext.isFunction(me.confirmMsg)) { if (Ext.isFunction(me.confirmMsg)) {
msg = me.confirmMsg(rec); msg = me.confirmMsg(rec);
} }
Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) { Ext.MessageBox.defaultButton = me.dangerous ? 2 : 1;
Ext.Msg.show({
title: gettext('Confirmtest'),
icon: 'ext-mb-question',
msg: msg,
buttons: Ext.Msg.YESNO,
callback: function(btn) {
if (btn !== 'yes') { if (btn !== 'yes') {
return; return;
} }
me.realHandler(button, event, rec); me.realHandler(button, event, rec);
}
}); });
} else { } else {
me.realHandler(button, event, rec); me.realHandler(button, event, rec);
......
...@@ -116,6 +116,7 @@ Ext.define('PVE.grid.BackupView', { ...@@ -116,6 +116,7 @@ Ext.define('PVE.grid.BackupView', {
text: gettext('Remove'), text: gettext('Remove'),
disabled: true, disabled: true,
selModel: sm, selModel: sm,
dangerous: true,
confirmMsg: function(rec) { confirmMsg: function(rec) {
var msg = Ext.String.format(gettext('Are you sure you want to remove entry {0}'), var msg = Ext.String.format(gettext('Are you sure you want to remove entry {0}'),
"'" + rec.data.volid + "'"); "'" + rec.data.volid + "'");
......
...@@ -85,6 +85,7 @@ Ext.define('PVE.openvz.Config', { ...@@ -85,6 +85,7 @@ Ext.define('PVE.openvz.Config', {
var removeBtn = Ext.create('PVE.button.Button', { var removeBtn = Ext.create('PVE.button.Button', {
text: gettext('Remove'), text: gettext('Remove'),
disabled: !caps.vms['VM.Allocate'], disabled: !caps.vms['VM.Allocate'],
dangerous: true,
confirmMsg: Ext.String.format(gettext('Are you sure you want to remove VM {0}? This will permanently erase all VM data.'), vmid), confirmMsg: Ext.String.format(gettext('Are you sure you want to remove VM {0}? This will permanently erase all VM data.'), vmid),
handler: function() { handler: function() {
PVE.Utils.API2Request({ PVE.Utils.API2Request({
......
...@@ -85,6 +85,7 @@ Ext.define('PVE.qemu.Config', { ...@@ -85,6 +85,7 @@ Ext.define('PVE.qemu.Config', {
var removeBtn = Ext.create('PVE.button.Button', { var removeBtn = Ext.create('PVE.button.Button', {
text: gettext('Remove'), text: gettext('Remove'),
disabled: !caps.vms['VM.Allocate'], disabled: !caps.vms['VM.Allocate'],
dangerous: true,
confirmMsg: Ext.String.format(gettext('Are you sure you want to remove VM {0}? This will permanently erase all VM data.'), vmid), confirmMsg: Ext.String.format(gettext('Are you sure you want to remove VM {0}? This will permanently erase all VM data.'), vmid),
handler: function() { handler: function() {
PVE.Utils.API2Request({ PVE.Utils.API2Request({
......
...@@ -210,6 +210,7 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -210,6 +210,7 @@ Ext.define('PVE.qemu.HardwareView', {
text: gettext('Remove'), text: gettext('Remove'),
selModel: sm, selModel: sm,
disabled: true, disabled: true,
dangerous: true,
confirmMsg: function(rec) { confirmMsg: function(rec) {
var msg = Ext.String.format(gettext('Are you sure you want to remove entry {0}'), var msg = Ext.String.format(gettext('Are you sure you want to remove entry {0}'),
"'" + me.renderKey(rec.data.key, {}, rec) + "'"); "'" + me.renderKey(rec.data.key, {}, rec) + "'");
......
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