From 3ab87cd11ebbda77e348cf001d4bc056196acd4b Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 14 Nov 2022 11:53:53 +0100 Subject: [PATCH] ui: reload compose loading --- .../src/routes/applications/[id]/index.svelte | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/apps/ui/src/routes/applications/[id]/index.svelte b/apps/ui/src/routes/applications/[id]/index.svelte index 83946861c..64ad72de8 100644 --- a/apps/ui/src/routes/applications/[id]/index.svelte +++ b/apps/ui/src/routes/applications/[id]/index.svelte @@ -61,7 +61,10 @@ $isDeploymentEnabled = checkIfDeploymentEnabledApplications($appSession.isAdmin, application); let statues: any = {}; - let loading = false; + let loading = { + save: false, + reloadCompose: false + }; let fqdnEl: any = null; let forceSave = false; let isPublicRepository = application.settings.isPublicRepository; @@ -102,7 +105,6 @@ label: 'Uvicorn' } ]; - function normalizeDockerServices(services: any[]) { const tempdockerComposeServices = []; for (const [name, data] of Object.entries(services)) { @@ -237,8 +239,8 @@ } } async function handleSubmit(toast: boolean = true) { - if (loading) return; - if (toast) loading = true; + if (loading.save) return; + if (toast) loading.save = true; try { nonWWWDomain = application.fqdn && getDomain(application.fqdn).replace(/^www\./, ''); if (application.deploymentType) @@ -299,7 +301,7 @@ } return errorNotification(error); } finally { - loading = false; + loading.save = false; } } async function selectWSGI(event: any) { @@ -361,6 +363,8 @@ }); } async function reloadCompose() { + if (loading.reloadCompose) return; + loading.reloadCompose = true; try { if (application.gitSource.type === 'github') { const headers = isPublicRepository @@ -427,6 +431,8 @@ }); } catch (error) { errorNotification(error); + } finally { + loading.reloadCompose = false; } } $: if ($status.application.statuses) { @@ -464,10 +470,10 @@ {$t('forms.save')} {/if} @@ -993,8 +999,11 @@
Stack {#if $appSession.isAdmin} - Reload Docker Compose File {/if}