[pve-devel] [PATCH manager] fix #1175: make error messages more verbose

Dominik Csapak d.csapak at proxmox.com
Thu Oct 20 13:51:43 CEST 2016


the error messages for several input fields (e.g. snapshot name)
did not correctly reflect the regex which was checked

this patch adds additional information about the required format

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Toolkit.js | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/www/manager6/Toolkit.js b/www/manager6/Toolkit.js
index 6e30589..e23985e 100644
--- a/www/manager6/Toolkit.js
+++ b/www/manager6/Toolkit.js
@@ -68,8 +68,10 @@ Ext.apply(Ext.form.field.VTypes, {
     InterfaceName: function(v) {
         return (/^[a-z][a-z0-9_]{1,20}$/).test(v);
     },
-    InterfaceNameText: gettext('Format') + ': [a-z][a-z0-9_]{1,20}',
-
+    InterfaceNameText: gettext("Allowed characters") + ": 'a-z', '0-9', '_'" + "<br />" +
+		       gettext("Minimum characters") + ": 2" + "<br />" +
+		       gettext("Maximum characters") + ": 21" + "<br />" +
+		       gettext("Must start with") + ": 'a-z'",
 
     QemuStartDate: function(v) {
 	return (/^(now|\d{4}-\d{1,2}-\d{1,2}(T\d{1,2}:\d{1,2}:\d{1,2})?)$/).test(v);
@@ -79,12 +81,17 @@ Ext.apply(Ext.form.field.VTypes, {
     StorageId:  function(v) {
         return (/^[a-z][a-z0-9\-\_\.]*[a-z0-9]$/i).test(v);
     },
-    StorageIdText: gettext("Allowed characters") + ":  'A-Z', 'a-z', '0-9', '-', '_', '.'",
+    StorageIdText: gettext("Allowed characters") + ":  'A-Z', 'a-z', '0-9', '-', '_', '.'" + "<br />" +
+		   gettext("Minimum characters") + ": 2" + "<br />" +
+		   gettext("Must start with") + ": 'A-Z', 'a-z'<br />" +
+		   gettext("Must end with") + ": 'A-Z', 'a-z', '0-9'<br />",
 
     ConfigId:  function(v) {
         return (/^[a-z][a-z0-9\_]+$/i).test(v);
     },
-    ConfigIdText: gettext("Allowed characters") + ": 'A-Z', 'a-z', '0-9', '_'",
+    ConfigIdText: gettext("Allowed characters") + ": 'A-Z', 'a-z', '0-9', '_'" + "<br />" +
+		  gettext("Minimum characters") + ": 2" + "<br />" +
+		  gettext("Must start with") + ": " + gettext("letter"),
 
     HttpProxy:  function(v) {
         return (/^http:\/\/.*$/).test(v);
-- 
2.1.4





More information about the pve-devel mailing list