From 4e69c56bd37f63b90a83b1863f498fcfdd20c3a3 Mon Sep 17 00:00:00 2001 From: Andras Date: Thu, 25 Mar 2021 23:25:49 +0100 Subject: [PATCH] Bugfixes: - Loading screen on Github reconfiguration. - Fix Github App name in case on space is in the name. --- package.json | 2 +- .../Configuration/Configuration.svelte | 55 ++++++++++++------- .../Configuration/Repositories.svelte | 2 +- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 75397757e..0031023cc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "coolify", "description": "An open-source, hassle-free, self-hostable Heroku & Netlify alternative.", - "version": "1.0.0", + "version": "1.0.1", "license": "AGPL-3.0", "scripts": { "lint": "standard", diff --git a/src/components/Application/Configuration/Configuration.svelte b/src/components/Application/Configuration/Configuration.svelte index ebffc92e2..51cce71e5 100644 --- a/src/components/Application/Configuration/Configuration.svelte +++ b/src/components/Application/Configuration/Configuration.svelte @@ -11,11 +11,22 @@ let loading = { branches: false, + github: false, }; let branches = []; let repositories = []; + function dashify(str, options) { + if (typeof str !== "string") return str + return str + .trim() + .replace(/\W/g, m => (/[À-ž]/.test(m) ? m : "-")) + .replace(/^-+|-+$/g, "") + .replace(/-{2,}/g, m => (options && options.condense ? "-" : m)) + .toLowerCase(); + } + async function loadBranches() { loading.branches = true; const selectedRepository = repositories.find( @@ -62,14 +73,15 @@ } catch (error) { return false; } + loading.github = false; } function modifyGithubAppConfig() { const left = screen.width / 2 - 1020 / 2; const top = screen.height / 2 - 618 / 2; const newWindow = open( - `https://github.com/apps/${ - import.meta.env.VITE_GITHUB_APP_NAME - }/installations/new`, + `https://github.com/apps/${dashify( + import.meta.env.VITE_GITHUB_APP_NAME, + )}/installations/new`, "Install App", "resizable=1, scrollbars=1, fullscreen=0, height=1000, width=1020,top=" + top + @@ -80,6 +92,7 @@ const timer = setInterval(async () => { if (newWindow.closed) { clearInterval(timer); + loading.github = true; if (!$isActive("/application/new")) { try { const config = await $fetch(`/api/v1/config`, { @@ -111,23 +124,27 @@ {#await loadGithub()} {:then} -
- - {#if $application.repository.organization !== "new"} - - {/if} + {#if loading.github} + + {:else} +
+ + {#if $application.repository.organization !== "new"} + + {/if} - {#if $application.repository.branch} - - {/if} -
+ {#if $application.repository.branch} + + {/if} +
+ {/if} {/await} {/if} diff --git a/src/components/Application/Configuration/Repositories.svelte b/src/components/Application/Configuration/Repositories.svelte index d61add1f5..c69685e71 100644 --- a/src/components/Application/Configuration/Repositories.svelte +++ b/src/components/Application/Configuration/Repositories.svelte @@ -38,7 +38,7 @@ {:else} {/if}