From 988064a54256df1885174a5bd19ae041b077396b Mon Sep 17 00:00:00 2001 From: cmeng Date: Fri, 23 Feb 2024 13:28:20 +1300 Subject: [PATCH] fix(stack): make web editor readonly for git template EE-6706 (#11183) --- .../custom-templates-view/customTemplatesViewController.js | 3 +++ app/portainer/views/stacks/create/createStackController.js | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/portainer/views/custom-templates/custom-templates-view/customTemplatesViewController.js b/app/portainer/views/custom-templates/custom-templates-view/customTemplatesViewController.js index f610a0940..307b5e510 100644 --- a/app/portainer/views/custom-templates/custom-templates-view/customTemplatesViewController.js +++ b/app/portainer/views/custom-templates/custom-templates-view/customTemplatesViewController.js @@ -204,6 +204,9 @@ class CustomTemplatesViewController { const template = _.find(this.templates, { Id: templateId }); + const isGit = template.GitConfig !== null; + this.state.isEditorReadOnly = isGit; + try { this.state.templateContent = this.formValues.fileContent = await this.CustomTemplateService.customTemplateFile(template.Id, template.GitConfig !== null); } catch (err) { diff --git a/app/portainer/views/stacks/create/createStackController.js b/app/portainer/views/stacks/create/createStackController.js index 6dade3056..a07c4aa3f 100644 --- a/app/portainer/views/stacks/create/createStackController.js +++ b/app/portainer/views/stacks/create/createStackController.js @@ -302,10 +302,11 @@ angular $scope.state.selectedTemplate = template; try { - $scope.state.templateContent = await this.CustomTemplateService.customTemplateFile(templateId, template.GitConfig !== null); + const isGit = template.GitConfig !== null; + $scope.state.templateContent = await this.CustomTemplateService.customTemplateFile(templateId, isGit); onChangeFileContent($scope.state.templateContent); - $scope.state.isEditorReadOnly = false; + $scope.state.isEditorReadOnly = isGit; } catch (err) { $scope.state.templateLoadFailed = true; throw err;