diff --git a/app/docker/__module.js b/app/docker/__module.js index f553d3955..21cfc5149 100644 --- a/app/docker/__module.js +++ b/app/docker/__module.js @@ -125,7 +125,7 @@ angular.module('portainer.docker', ['portainer.app', reactModule]).config([ const customTemplatesNew = { name: 'docker.templates.custom.new', - url: '/new?appTemplateId&type', + url: '/new?fileContent&appTemplateId&type', views: { 'content@': { diff --git a/app/react/portainer/templates/custom-templates/CreateView/useInitialValues.ts b/app/react/portainer/templates/custom-templates/CreateView/useInitialValues.ts index 72856b6df..615c0e828 100644 --- a/app/react/portainer/templates/custom-templates/CreateView/useInitialValues.ts +++ b/app/react/portainer/templates/custom-templates/CreateView/useInitialValues.ts @@ -23,6 +23,10 @@ export function useInitialValues({ const { appTemplateId, type = defaultType } = useAppTemplateParams(); + const { + params: { fileContent = '' }, + } = useCurrentStateAndParams(); + const fileContentQuery = useFetchTemplateFile(appTemplateId); if (fileContentQuery.isLoading) { return undefined; @@ -30,7 +34,7 @@ export function useInitialValues({ return { Title: '', - FileContent: fileContentQuery.data ?? '', + FileContent: (fileContentQuery.data ?? '') || fileContent, Type: type, Platform: Platform.LINUX, File: undefined,