Good point about long resource names in the title of the modal.

A bold font or anything that make the resource name more clearer
in the middle of the explanation is enough.

On 08/19/2016 03:28 PM, Samuel Henrique De Oliveira Guimaraes wrote:

I’d suggest we put the resource name between <strong> tag. As for the VM name on the title, sometimes we have guests with very long names so I don’t think it would look good with the modal window.

 

Samuel

 

From: kimchi-devel-bounces@ovirt.org [mailto:kimchi-devel-bounces@ovirt.org] On Behalf Of Daniel Henrique Barboza
Sent: sexta-feira, 19 de agosto de 2016 15:18
To: kimchi-devel@ovirt.org
Subject: Re: [Kimchi-devel] [PATCH] [Kimchi] Issue# 973 Display resource name in confirmation dialog

 

Isn't it feasible to show the resource name in the title instead of in the body
text?

For example:





The name of the VM ('winxp' in this case) is in the middle of the text. I think
it's clearer if the name is in the title of the modal, something like
"<vm_name> delete confirmation". You can keep showing the vm name
in the explanation text too.


Daniel

On 08/18/2016 05:16 PM, Socorro Stoppler wrote:

From: Socorro <socorro@linux.vnet.ibm.com>
 
When confirmation dialogs are shown, also display the name of the resource being
acted on (i.e. guest name, network, storage, template) as part of the message 
 
Signed-off-by: Socorro <socorro@linux.vnet.ibm.com>
---
 ui/js/src/kimchi.guest_main.js    | 15 ++++++++++-----
 ui/js/src/kimchi.network.js       |  6 ++++--
 ui/js/src/kimchi.storage_main.js  |  8 +++++---
 ui/js/src/kimchi.template_main.js |  5 +++--
 ui/pages/i18n.json.tmpl           | 20 ++++++++++----------
 5 files changed, 32 insertions(+), 22 deletions(-)
 
diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
index 9c1aa54..c3ac607 100644
--- a/ui/js/src/kimchi.guest_main.js
+++ b/ui/js/src/kimchi.guest_main.js
@@ -127,8 +127,10 @@ kimchi.vmpoweroff = function(event) {
         var vm_id = vm.attr("id");
         var vmObject = vm.data();
         var vm_persistent = vmObject.persistent == true;
-        var content_msg = vm_persistent ? i18n['KCHVM6003M'] :
-            i18n['KCHVM6009M'];
+        var content_msg_1 = i18n['KCHVM6003M'].replace('%1', vm_id);
+        var content_msg_2 = i18n['KCHVM6009M'].replace('%1', vm_id);
+        var content_msg = vm_persistent ? content_msg_1 :
+            content_msg_2;
         var settings = {
             title: i18n['KCHVM6002M'],
             content: content_msg,
@@ -153,9 +155,10 @@ kimchi.vmshutdown = function(event) {
     var button = event.target;
     var vm = $(button).closest('li[name=guest]');
     var vm_id = vm.attr("id");
+    var confirmMessage = i18n['KCHVM6007M'].replace('%1', vm_id);
     var settings = {
         title: i18n['KCHVM6006M'],
-        content: i18n['KCHVM6007M'],
+        content: confirmMessage,
         confirm: i18n['KCHAPI6002M'],
         cancel: i18n['KCHAPI6003M']
     };
@@ -174,9 +177,10 @@ kimchi.vmreset = function(event) {
         $(button).addClass('loading');
         var vm = $(button).closest('li[name=guest]');
         var vm_id = $(vm).attr("id");
+        var confirmMessage = i18n['KCHVM6005M'].replace('%1', vm_id);
         var settings = {
             title: i18n['KCHVM6004M'],
-            content: i18n['KCHVM6005M'],
+            content: confirmMessage,
             confirm: i18n['KCHAPI6002M'],
             cancel: i18n['KCHAPI6003M']
         };
@@ -204,9 +208,10 @@ kimchi.vmdelete = function(event) {
     var button = event.target;
     var vm = $(button).closest('li[name=guest]');
     var vm_id = $(vm).attr("id");
+    var confirmMessage = i18n['KCHVM6001M'].replace('%1', vm_id);
     var settings = {
         title: i18n['KCHVM6008M'],
-        content: i18n['KCHVM6001M'],
+        content: confirmMessage,
         confirm: i18n['KCHAPI6002M'],
         cancel: i18n['KCHAPI6003M']
     };
diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
index ac6bf74..4359fdc 100644
--- a/ui/js/src/kimchi.network.js
+++ b/ui/js/src/kimchi.network.js
@@ -161,9 +161,10 @@ kimchi.addNetworkActions = function(network) {
                 return false;
             }
             if (!network.persistent) {
+                var confirmMessage = i18n['KCHNET6004M'].replace('%1', network.name);
                 var settings = {
                     title : i18n['KCHAPI6001M'],
-                    content : i18n['KCHNET6004M'],
+                    content : confirmMessage,
                     confirm : i18n['KCHAPI6002M'],
                     cancel : i18n['KCHAPI6003M']
                 };
@@ -180,9 +181,10 @@ kimchi.addNetworkActions = function(network) {
             if (network.state === "up" || network.in_use) {
                 return false;
             }
+            var confirmMessage = i18n['KCHNET6002M'].replace('%1', network.name);
             wok.confirm({
                 title : i18n['KCHAPI6006M'],
-                content : i18n['KCHNET6002M'],
+                content : confirmMessage,
                 confirm : i18n['KCHAPI6002M'],
                 cancel : i18n['KCHAPI6003M']
             }, function() {
diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
index 6c99f93..d88c304 100644
--- a/ui/js/src/kimchi.storage_main.js
+++ b/ui/js/src/kimchi.storage_main.js
@@ -310,14 +310,15 @@ kimchi.storageBindClick = function() {
         $('.pool-delete').on('click', function(event) {
             event.preventDefault();
             var $pool = $(this);
+            var poolName = $pool.data('name');
+            var confirmMessage = i18n['KCHPOOL6001M'].replace('%1', poolName);
             var settings = {
                 title : i18n['KCHAPI6001M'],
-                content : i18n['KCHPOOL6001M'],
+                content : confirmMessage,
                 confirm : i18n['KCHAPI6002M'],
                 cancel : i18n['KCHAPI6003M']
             };
             wok.confirm(settings, function() {
-                var poolName = $pool.data('name');
                 kimchi.deleteStoragePool(poolName, function() {
                     kimchi.doListStoragePools();
                 }, function(err) {
@@ -339,9 +340,10 @@ kimchi.storageBindClick = function() {
         $('.pool-deactivate').on('click', function(event) {
             event.preventDefault();
             var poolName = $(this).data('name');
+            var confirmMessage = i18n['KCHPOOL6012M'].replace('%1', poolName);
             var settings = {
                 title : i18n['KCHAPI6001M'],
-                content : i18n['KCHPOOL6012M'],
+                content : confirmMessage,
                 confirm : i18n['KCHAPI6002M'],
                 cancel : i18n['KCHAPI6003M']
             };
diff --git a/ui/js/src/kimchi.template_main.js b/ui/js/src/kimchi.template_main.js
index 302d906..daf6fb1 100644
--- a/ui/js/src/kimchi.template_main.js
+++ b/ui/js/src/kimchi.template_main.js
@@ -124,14 +124,15 @@ kimchi.templateBindClick = function() {
     $('.template-delete a').on('click', function(event) {
         event.preventDefault();
         var $template = $(this);
+        var templateName = $template.data('template');
+        var confirmMessage = i18n['KCHTMPL6003M'].replace('%1', templateName);
         var settings = {
             title: i18n['KCHAPI6001M'],
-            content: i18n['KCHTMPL6003M'],
+            content: confirmMessage,
             confirm: i18n['KCHAPI6002M'],
             cancel: i18n['KCHAPI6003M']
         };
         wok.confirm(settings, function() {
-            var templateName = $template.data('template');
             kimchi.deleteTemplate(templateName, function() {
                 kimchi.doListTemplates();
             }, function(err) {
diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
index a5185b1..d29a206 100644
--- a/ui/pages/i18n.json.tmpl
+++ b/ui/pages/i18n.json.tmpl
@@ -47,24 +47,24 @@
     "KCHTMPL6001W": "$_("No ISO found")",
 
     "KCHTMPL6002M": "$_("This may take a long time. Do you want to continue?")",
-    "KCHTMPL6003M": "$_("This will permanently delete the template. Would you like to continue?")",
+    "KCHTMPL6003M": "$_("This will permanently delete the %1 template. Would you like to continue?")",
     "KCHTMPL6004M": "$_("View Table")",
     "KCHTMPL6005M": "$_("View Gallery")",
     "KCHTMPL6006M": "$_("Not Available")",
     "KCHTMPL6007M": "$_("Please check the invalid Storage Pools")",
 
-    "KCHVM6001M": "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
+    "KCHVM6001M": "$_("This will delete the %1 virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
     "KCHVM6002M": "$_("Power off Confirmation")",
     "KCHVM6003M": "$_("This action may produce undesirable results, "
-                      "for example unflushed disk cache in the guest. "
+                      "for example unflushed disk cache in the %1 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?")",
+                      " the %1 guest OS shutdown. Would you like to continue?")",
     "KCHVM6006M": "$_("Shut Down Confirmation")",
-    "KCHVM6007M": "$_("Note the guest OS may ignore this request. Would you like to continue?")",
+    "KCHVM6007M": "$_("Note the %1 guest OS may ignore this request. Would you like to continue?")",
     "KCHVM6008M": "$_("Virtual Machine delete Confirmation")",
-    "KCHVM6009M": "$_("This virtual machine is not persistent. Power Off will delete it. Continue?")",
+    "KCHVM6009M": "$_("The %1 virtual machine is not persistent. Power Off will delete it. Continue?")",
 
     "KCHVM0001E": "$_("Input is not a number")",
     "KCHVM0002E": "$_("Memory value cannot be higher than Max Memory value")",
@@ -89,11 +89,11 @@
     "KCHVMED6012M": "$_("Following devices will be affected, confirm?")",
 
     "KCHNET6001M": "$_("unavailable")",
-    "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on this network.")",
-    "KCHNET6004M": "$_("This network is not persistent. Instead of stop, this action will permanently delete it. Would you like to continue?")",
+    "KCHNET6002M": "$_("This action will interrupt network connectivity for any virtual machine that depend on the %1 network.")",
+    "KCHNET6004M": "$_("The %1 network is not persistent. Instead of stop, this action will permanently delete it. Would you like to continue?")",
     "KCHNET6001W": "$_("The bridged VLAN tag may not work well with NetworkManager enabled. You should consider disabling it.")",
 
-    "KCHPOOL6001M": "$_("This will permanently delete the storage pool. Would you like to continue?")",
+    "KCHPOOL6001M": "$_("This will permanently delete the %1 storage pool. Would you like to continue?")",
     "KCHPOOL6002M": "$_("This storage pool is empty.")",
     "KCHPOOL6003M": "$_("It will format your disk and you will loose any data in there, are you sure to continue? ")",
     "KCHPOOL6004M": "$_("SCSI Fibre Channel")",
@@ -108,7 +108,7 @@
     "KCHPOOL6006E": "$_("No logical device selected.")",
     "KCHPOOL6009E": "$_("This is not a valid Server Name or IP. Please, modify it.")",
     "KCHPOOL6011M": "$_("No available partitions found.")",
-    "KCHPOOL6012M": "$_("This storage pool is not persistent. Instead of deactivate, this action will permanently delete it. Would you like to continue?")",
+    "KCHPOOL6012M": "$_("The %1 storage pool is not persistent. Instead of deactivate, this action will permanently delete it. Would you like to continue?")",
     "KCHPOOL6013M": "$_("Unable to retrieve partitions information.")",
     "KCHPOOL6014M": "$_("In progress...")",
     "KCHPOOL6015M": "$_("Failed!")",