[Kimchi-devel] [PATCHv4] [Kimchi] Issue# 973 Emphasize resource name in dlg

Socorro Stoppler socorro at linux.vnet.ibm.com
Thu Sep 1 20:02:54 UTC 2016


From: Socorro <socorro at linux.vnet.ibm.com>

v4:
Add style for <strong> to only ones in confirmation dialog.  Thanks
Samuel for the consultation :)

v3:
In some distros, the resource name is not being displayed in bold due to 
a problem with Open Sans.  Per Samuel, there are some cases, mainly with
Firefox in that some style with font weight set to 600 does not work and 700
is usually too bold to set as a fallback.  Therefore, just use the same style
as <abbr> and <acronynm> tags which creates a dotted bottom

v2:
Display resource name (with name in bold) in confirmation dialog

v1:
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 at linux.vnet.ibm.com>
---
 ui/css/kimchi.css                 |  4 ++++
 ui/css/src/modules/_guests.scss   |  4 ++++
 ui/js/src/kimchi.guest_main.js    | 14 +++++++++-----
 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 ++++++++++----------
 7 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/ui/css/kimchi.css b/ui/css/kimchi.css
index dff8013..6cf2cc9 100644
--- a/ui/css/kimchi.css
+++ b/ui/css/kimchi.css
@@ -294,6 +294,10 @@
   font-size: 32px;
 }
 
+#wok-confirm-modal .modal-body strong {
+  border-bottom: 1px dotted;
+}
+
 #guest-add-window .modal-body {
   margin: 0;
   padding: 0;
diff --git a/ui/css/src/modules/_guests.scss b/ui/css/src/modules/_guests.scss
index 040b351..8b8345c 100644
--- a/ui/css/src/modules/_guests.scss
+++ b/ui/css/src/modules/_guests.scss
@@ -46,6 +46,10 @@
     }
 }
 
+#wok-confirm-modal .modal-body strong {
+    border-bottom: 1px dotted;
+}
+
 #guest-add-window {
     .modal-body {
         margin: 0;
diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
index 9c1aa54..34217e4 100644
--- a/ui/js/src/kimchi.guest_main.js
+++ b/ui/js/src/kimchi.guest_main.js
@@ -127,8 +127,9 @@ 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', '<strong>'+vm_id+'</strong>');
+        var content_msg_2 = i18n['KCHVM6009M'].replace('%1', '<strong>'+vm_id+'</strong>');
+        var content_msg = vm_persistent ? content_msg_1 : content_msg_2;
         var settings = {
             title: i18n['KCHVM6002M'],
             content: content_msg,
@@ -153,9 +154,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', '<strong>'+vm_id+'</strong>');
     var settings = {
         title: i18n['KCHVM6006M'],
-        content: i18n['KCHVM6007M'],
+        content: confirmMessage,
         confirm: i18n['KCHAPI6002M'],
         cancel: i18n['KCHAPI6003M']
     };
@@ -174,9 +176,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', '<strong>'+vm_id+'</strong>');
         var settings = {
             title: i18n['KCHVM6004M'],
-            content: i18n['KCHVM6005M'],
+            content: confirmMessage,
             confirm: i18n['KCHAPI6002M'],
             cancel: i18n['KCHAPI6003M']
         };
@@ -204,9 +207,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', '<strong>'+vm_id+'</strong>');
     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..7ce5b28 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', '<strong>'+network.name+'</strong>');
                 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', '<strong>'+network.name+'</strong>');
             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..18e6eea 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', '<strong>'+poolName+'</strong>');
             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', '<strong>'+poolName+'</strong>');
             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..cf98a7b 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', '<strong>'+templateName+'</strong>');
         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 f9e148d..7beee19 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!")",
-- 
2.7.4




More information about the Kimchi-devel mailing list