From 661931d8b0d411519d394060f679f59ab0f8f969 Mon Sep 17 00:00:00 2001 From: Richard Wei <54336863+WaysonWei@users.noreply.github.com> Date: Thu, 7 Oct 2021 13:02:56 +1300 Subject: [PATCH] fix(template): add name validation for template name EE-1806 (#5823) * add name validation for tempalte name --- app/constants.js | 1 + .../customTemplateCommonFields.html | 22 ++++++++++++++++++- .../custom-template-common-fields/index.js | 1 + .../forms/stack-from-template-form/index.js | 1 + .../stackFromTemplateForm.html | 16 +++++++++++--- .../createCustomTemplateView.html | 7 +++++- .../createCustomTemplateViewController.js | 3 +++ .../customTemplatesView.html | 1 + .../customTemplatesViewController.js | 2 ++ 9 files changed, 49 insertions(+), 5 deletions(-) diff --git a/app/constants.js b/app/constants.js index f33165179..7c45f2d61 100644 --- a/app/constants.js +++ b/app/constants.js @@ -31,3 +31,4 @@ angular export const PORTAINER_FADEOUT = 1500; export const STACK_NAME_VALIDATION_REGEX = '^[-_a-z0-9]+$'; +export const TEMPLATE_NAME_VALIDATION_REGEX = '^[-_a-z0-9]+$'; diff --git a/app/portainer/components/custom-template-common-fields/customTemplateCommonFields.html b/app/portainer/components/custom-template-common-fields/customTemplateCommonFields.html index 255097cea..44808228e 100644 --- a/app/portainer/components/custom-template-common-fields/customTemplateCommonFields.html +++ b/app/portainer/components/custom-template-common-fields/customTemplateCommonFields.html @@ -5,7 +5,27 @@ Title
+ + This field must consist of lower case alphanumeric characters, '_' or '-' (e.g. 'my-name', or 'abc-123'). +
+