1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-08 15:25:22 +02:00

fix(edge/stacks): load template [EE-7109] (#11848)
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run

This commit is contained in:
Chaim Lev-Ari 2024-06-16 07:54:00 +03:00 committed by GitHub
parent a28bd349ae
commit 0f5988af49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 126 additions and 60 deletions

View file

@ -31,7 +31,7 @@ export function useAppTemplates<T = Array<TemplateViewModel>>({
export function useAppTemplate(
id: AppTemplate['id'] | undefined,
{ enabled = true }: { enabled?: boolean } = {}
{ enabled }: { enabled?: boolean } = {}
) {
const templateListQuery = useAppTemplates({ enabled: !!id && enabled });
@ -39,7 +39,7 @@ export function useAppTemplate(
return {
data: template,
isLoading: templateListQuery.isLoading,
isLoading: templateListQuery.isInitialLoading,
error: templateListQuery.error,
};
}

View file

@ -19,7 +19,7 @@ export async function getCustomTemplate(id: CustomTemplate['Id']) {
export function useCustomTemplate(
id?: CustomTemplate['Id'],
{ enabled = true }: { enabled?: boolean } = {}
{ enabled }: { enabled?: boolean } = {}
) {
return useQuery(queryKeys.item(id!), () => getCustomTemplate(id!), {
...withGlobalError('Unable to retrieve custom template'),

View file

@ -12,13 +12,17 @@ type CustomTemplateFileContent = {
FileContent: string;
};
export function useCustomTemplateFile(id?: CustomTemplate['Id'], git = false) {
export function useCustomTemplateFile(
id?: CustomTemplate['Id'],
git = false,
{ enabled }: { enabled?: boolean } = {}
) {
return useQuery(
id ? queryKeys.file(id, { git }) : [],
queryKeys.file(id!, { git }),
() => getCustomTemplateFile({ id: id!, git }),
{
...withGlobalError('Failed to get custom template file'),
enabled: !!id,
enabled: !!id && enabled,
// there's nothing to do with a new file content, so we're disabling refetch
refetchOnReconnect: false,
refetchOnWindowFocus: false,