
Reviewed-by: Daniel Barboza <danielhb@linux.vnet.ibm.com> On 04/10/2014 10:04 AM, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Reset a VM will cause data loss without the guest OS shutdown.
We should let user confirm it.
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- ui/js/src/kimchi.guest_main.js | 21 +++++++++++++++------ ui/pages/i18n.html.tmpl | 3 +++ 2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js index ba93b1e..891e717 100644 --- a/ui/js/src/kimchi.guest_main.js +++ b/ui/js/src/kimchi.guest_main.js @@ -67,12 +67,21 @@ kimchi.vmpoweroff = function(event) { kimchi.vmreset = function(event){ var vm=$(this).closest('li[name=guest]'); var vm_id=vm.attr("id"); - kimchi.resetVM(vm_id, function(result) { - kimchi.listVmsAuto(); - }, function(err) { - kimchi.message.error(err.responseJSON.reason); - } - ); + var settings = { + title : i18n['KCHVM6004M'], + content : i18n['KCHVM6005M'], + confirm : i18n['KCHAPI6002M'], + cancel : i18n['KCHAPI6003M'] + }; + kimchi.confirm(settings, function() { + kimchi.resetVM(vm_id, function(result) { + kimchi.listVmsAuto(); + }, function(err) { + kimchi.message.error(err.responseJSON.reason); + } + ); + }, function() { + }); };
kimchi.vmdelete = function(event) { diff --git a/ui/pages/i18n.html.tmpl b/ui/pages/i18n.html.tmpl index 6f655e2..6588dff 100644 --- a/ui/pages/i18n.html.tmpl +++ b/ui/pages/i18n.html.tmpl @@ -129,6 +129,9 @@ var i18n = { 'KCHVM6003M': "$_("This action may produce undesirable results, " "for example unflushed disk cache in the guest. " "Would you like to continue?")", + 'KCHVM6004M': "$_("Reset Confirmation")", + 'KCHVM6005M': "$_("There is a risk of data loss caused by reset without" + " the guest OS shutdown. Would you like to continue?")",
'KCHVMCD6001M': "$_("This CDROM will be detached permanently and you can re-attach it. Continue to detach it?")", 'KCHVMCD6002M': "$_("Attach")",