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;