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

feat(custom-templates): hide variables [EE-2602] (#7068)

This commit is contained in:
Chaim Lev-Ari 2022-06-16 08:32:41 +03:00 committed by GitHub
parent f39775752d
commit 97a880e6c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 48 additions and 1 deletions

View file

@ -7,6 +7,7 @@ import PortainerError from '@/portainer/error';
import { KubernetesDeployManifestTypes, KubernetesDeployBuildMethods, KubernetesDeployRequestMethods, RepositoryMechanismTypes } from 'Kubernetes/models/deploy';
import { buildOption } from '@/portainer/components/BoxSelector';
import { renderTemplate } from '@/react/portainer/custom-templates/components/utils';
import { isBE } from '@/portainer/feature-flags/feature-flags.service';
class KubernetesDeployController {
/* @ngInject */
@ -23,6 +24,8 @@ class KubernetesDeployController {
this.CustomTemplateService = CustomTemplateService;
this.DeployMethod = 'manifest';
this.isTemplateVariablesEnabled = isBE;
this.deployOptions = [
buildOption('method_kubernetes', 'fa fa-cubes', 'Kubernetes', 'Kubernetes manifest format', KubernetesDeployManifestTypes.KUBERNETES),
buildOption('method_compose', 'fab fa-docker', 'Compose', 'docker-compose format', KubernetesDeployManifestTypes.COMPOSE),
@ -83,6 +86,10 @@ class KubernetesDeployController {
}
renderTemplate() {
if (!this.isTemplateVariablesEnabled) {
return;
}
const rendered = renderTemplate(this.state.templateContent, this.formValues.Variables, this.state.template.Variables);
this.onChangeFormValues({ EditorContent: rendered });
}