1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +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

@ -4,6 +4,7 @@ import { isBE } from '@/react/portainer/feature-flags/feature-flags.service';
import { getTemplateVariables, intersectVariables } from '@/react/portainer/custom-templates/components/utils';
import { confirmWebEditorDiscard } from '@@/modals/confirm';
import { getFilePreview } from '@/react/portainer/gitops/gitops.service';
import { KUBE_TEMPLATE_NAME_VALIDATION_REGEX } from '@/constants';
class KubeEditCustomTemplateViewController {
/* @ngInject */
@ -24,6 +25,7 @@ class KubeEditCustomTemplateViewController {
templateLoadFailed: false,
templatePreviewFailed: false,
templatePreviewError: '',
templateNameRegex: KUBE_TEMPLATE_NAME_VALIDATION_REGEX,
};
this.templates = [];

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>
<git-form value="$ctrl.formValues" on-change="($ctrl.handleChange)" ng-if="$ctrl.formValues.GitConfig"></git-form>