1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

fix(templates): update name validation [EE-5344] (#8760)

Co-authored-by: testa113 <testa113>
This commit is contained in:
Ali 2023-04-21 09:39:55 +12:00 committed by GitHub
parent 1b470845b8
commit 861a9a5bbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 28 additions and 4 deletions

View file

@ -3,6 +3,7 @@ import { getTemplateVariables, intersectVariables } from '@/react/portainer/cust
import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
import { editor, upload, git } from '@@/BoxSelector/common-options/build-methods';
import { confirmWebEditorDiscard } from '@@/modals/confirm';
import { KUBE_TEMPLATE_NAME_VALIDATION_REGEX } from '@/constants';
class KubeCreateCustomTemplateViewController {
/* @ngInject */
@ -20,6 +21,7 @@ class KubeCreateCustomTemplateViewController {
formValidationError: '',
isEditorDirty: false,
isTemplateValid: true,
templateNameRegex: KUBE_TEMPLATE_NAME_VALIDATION_REGEX,
};
this.formValues = {

View file

@ -5,7 +5,11 @@
<rd-widget>
<rd-widget-body>
<form class="form-horizontal" name="$ctrl.form">
<custom-template-common-fields form-values="$ctrl.formValues"></custom-template-common-fields>
<custom-template-common-fields
form-values="$ctrl.formValues"
name-regex="$ctrl.state.templateNameRegex"
name-regex-error="'This field must consist of lower-case alphanumeric characters, \'.\', \'_\' or \'-\', must start and end with an alphanumeric character and must be 63 characters or less (e.g. \'my-name\', or \'abc-123\').'"
></custom-template-common-fields>
<!-- build-method -->
<div class="col-sm-12 form-section-title"> Build method </div>