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

refactor(custom-templates): migrate common-fields to react [EE-6207] (#10445)

This commit is contained in:
Chaim Lev-Ari 2023-10-22 11:19:19 +02:00 committed by GitHub
parent 1ad9488ca7
commit 6b5c24faff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 292 additions and 155 deletions

View file

@ -21,7 +21,6 @@ class KubeCreateCustomTemplateViewController {
formValidationError: '',
isEditorDirty: false,
isTemplateValid: true,
templateNameRegex: KUBE_TEMPLATE_NAME_VALIDATION_REGEX,
};
this.formValues = {
@ -42,12 +41,30 @@ class KubeCreateCustomTemplateViewController {
ComposeFilePathInRepository: 'manifest.yml',
};
this.validationData = {
title: {
pattern: KUBE_TEMPLATE_NAME_VALIDATION_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').",
},
};
this.onChangeFile = this.onChangeFile.bind(this);
this.onChangeFileContent = this.onChangeFileContent.bind(this);
this.onChangeMethod = this.onChangeMethod.bind(this);
this.onBeforeOnload = this.onBeforeOnload.bind(this);
this.handleChange = this.handleChange.bind(this);
this.onVariablesChange = this.onVariablesChange.bind(this);
this.onChangePlatform = this.onChangePlatform.bind(this);
this.onChangeType = this.onChangeType.bind(this);
}
onChangePlatform(value) {
this.handleChange({ Platform: value });
}
onChangeType(value) {
this.handleChange({ Type: value });
}
onChangeMethod(method) {

View file

@ -5,11 +5,7 @@
<rd-widget>
<rd-widget-body>
<form class="form-horizontal" name="$ctrl.form">
<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>
<custom-templates-common-fields values="$ctrl.formValues" on-change="($ctrl.handleChange)" validation-data="$ctrl.validationData"></custom-templates-common-fields>
<!-- build-method -->
<div class="col-sm-12 form-section-title"> Build method </div>