From 8a0afb912c59e3c262fa9b538d4977f4f10e867f Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Wed, 9 Jun 2021 13:57:42 +0530 Subject: [PATCH] chore: Add validation error for label create/edit modal (#2381) Co-authored-by: Pranav Raj S --- .../dashboard/i18n/locale/en/labelsMgmt.json | 10 +- .../dashboard/settings/labels/AddLabel.vue | 114 ++++++++---------- .../dashboard/settings/labels/EditLabel.vue | 114 ++++++++---------- .../dashboard/settings/labels/Index.vue | 21 ++-- .../labels/specs/validationMixin.spec.js | 76 ++++++++++++ .../settings/labels/validationMixin.js | 16 +++ 6 files changed, 208 insertions(+), 143 deletions(-) create mode 100644 app/javascript/dashboard/routes/dashboard/settings/labels/specs/validationMixin.spec.js create mode 100644 app/javascript/dashboard/routes/dashboard/settings/labels/validationMixin.js diff --git a/app/javascript/dashboard/i18n/locale/en/labelsMgmt.json b/app/javascript/dashboard/i18n/locale/en/labelsMgmt.json index b0dbe439f..2b6848a32 100644 --- a/app/javascript/dashboard/i18n/locale/en/labelsMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/labelsMgmt.json @@ -9,17 +9,15 @@ "404": "There are no labels available in this account.", "TITLE": "Manage labels", "DESC": "Labels let you group the conversations together.", - "TABLE_HEADER": [ - "Name", - "Description", - "Color" - ] + "TABLE_HEADER": ["Name", "Description", "Color"] }, "FORM": { "NAME": { "LABEL": "Label Name", "PLACEHOLDER": "Label name", - "ERROR": "Label Name is required" + "REQUIRED_ERROR": "Label name is required", + "MINIMUM_LENGTH_ERROR": "Minimum length 2 is required", + "VALID_ERROR": "Only Alphabets, Numbers, Hyphen and Underscore are allowed" }, "DESCRIPTION": { "LABEL": "Description", diff --git a/app/javascript/dashboard/routes/dashboard/settings/labels/AddLabel.vue b/app/javascript/dashboard/routes/dashboard/settings/labels/AddLabel.vue index 8056362b4..29c2ddd6d 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/labels/AddLabel.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/labels/AddLabel.vue @@ -1,79 +1,66 @@