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:
parent
f39775752d
commit
97a880e6c1
13 changed files with 48 additions and 1 deletions
|
@ -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 });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue