[Kimchi-devel] [PATCH] issue #415: Do not allow renaming a debug report to the same name

Crístian Viana vianac at linux.vnet.ibm.com
Mon Sep 22 17:54:09 UTC 2014


If the user tries to rename a debug report to the same name (i.e. not
actually rename...), Kimchi displays an error message indicating that
a debug report with that name already exists.

Check the new report name before renaming it, and if it hasn't changed,
display a message indicating that the name is the same as the
original one.

Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
---
 ui/js/src/kimchi.report_rename_main.js | 8 ++++++++
 ui/pages/i18n.json.tmpl                | 1 +
 2 files changed, 9 insertions(+)

diff --git a/ui/js/src/kimchi.report_rename_main.js b/ui/js/src/kimchi.report_rename_main.js
index 03c3c3a..6ee56d9 100644
--- a/ui/js/src/kimchi.report_rename_main.js
+++ b/ui/js/src/kimchi.report_rename_main.js
@@ -24,6 +24,14 @@ kimchi.report_rename_main = function() {
             return false;
         }
         var reportName = nameTextbox.val();
+
+        // if the user hasn't changed the report's name,
+        // nothing should be done.
+        if (reportName == kimchi.selectedReport) {
+            kimchi.message.error.code('KCHDR6013M');
+            return false;
+        }
+
         var validator = RegExp("^[A-Za-z0-9-]*$");
         if (!validator.test(reportName)) {
             kimchi.message.error.code('KCHDR6011M');
diff --git a/ui/pages/i18n.json.tmpl b/ui/pages/i18n.json.tmpl
index 659bec8..c52b175 100644
--- a/ui/pages/i18n.json.tmpl
+++ b/ui/pages/i18n.json.tmpl
@@ -115,6 +115,7 @@
     "KCHDR6010M": "$_("Download")",
     "KCHDR6011M": "$_("Report name should contain only letters, digits, underscore ('_') and/or hyphen ('-').")",
     "KCHDR6012M": "$_("Pending...")",
+    "KCHDR6013M": "$_("Report name is the same as the original one.")",
 
     "KCHVM6001M": "$_("This will delete the virtual machine and its virtual disks. This operation cannot be undone. Would you like to continue?")",
     "KCHVM6002M": "$_("Power off Confirmation")",
-- 
1.9.3




More information about the Kimchi-devel mailing list