This commit is contained in:
Andras Bacsai
2022-10-12 12:02:47 +02:00
parent bef5da49cf
commit 324038486f
4 changed files with 110 additions and 88 deletions

View File

@@ -87,6 +87,9 @@ export async function removeContainer({
await executeDockerCmd({ dockerId, command: `docker stop -t 0 ${id}` }) await executeDockerCmd({ dockerId, command: `docker stop -t 0 ${id}` })
await executeDockerCmd({ dockerId, command: `docker rm ${id}` }) await executeDockerCmd({ dockerId, command: `docker rm ${id}` })
} }
if (JSON.parse(stdout).Status === 'exited') {
await executeDockerCmd({ dockerId, command: `docker rm ${id}` })
}
} catch (error) { } catch (error) {
throw error; throw error;
} }

View File

@@ -272,14 +272,13 @@
> >
{#if $status.application.overallStatus === 'degraded' && application.buildPack !== 'compose'} {#if $status.application.overallStatus === 'degraded' && application.buildPack !== 'compose'}
<a <a
id="applicationerror"
href={$isDeploymentEnabled ? `/applications/${id}/logs` : null} href={$isDeploymentEnabled ? `/applications/${id}/logs` : null}
class="btn btn-error gap-2" class="btn btn-sm text-sm gap-2"
sveltekit:prefetch sveltekit:prefetch
> >
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6" class="w-6 h-6 text-red-500"
viewBox="0 0 24 24" viewBox="0 0 24 24"
stroke-width="1.5" stroke-width="1.5"
stroke="currentcolor" stroke="currentcolor"
@@ -296,7 +295,6 @@
</svg> </svg>
Application Error Application Error
</a> </a>
<Tooltip triggeredBy="#applicationerror">Application exited with an error!</Tooltip>
{/if} {/if}
{#if $status.application.initialLoading} {#if $status.application.initialLoading}
<button class="btn btn-ghost btn-sm gap-2"> <button class="btn btn-ghost btn-sm gap-2">
@@ -321,50 +319,50 @@
Loading... Loading...
</button> </button>
{:else if $status.application.overallStatus === 'healthy'} {:else if $status.application.overallStatus === 'healthy'}
<button <button
on:click={stopApplication} on:click={stopApplication}
type="submit" type="submit"
disabled={!$isDeploymentEnabled} disabled={!$isDeploymentEnabled}
class="btn btn-sm btn-error gap-2" class="btn btn-sm btn-error gap-2"
> >
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6 " class="w-6 h-6 "
viewBox="0 0 24 24" viewBox="0 0 24 24"
stroke-width="1.5" stroke-width="1.5"
stroke="currentColor" stroke="currentColor"
fill="none" fill="none"
stroke-linecap="round" stroke-linecap="round"
stroke-linejoin="round" stroke-linejoin="round"
> >
<path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path stroke="none" d="M0 0h24v24H0z" fill="none" />
<rect x="6" y="5" width="4" height="14" rx="1" /> <rect x="6" y="5" width="4" height="14" rx="1" />
<rect x="14" y="5" width="4" height="14" rx="1" /> <rect x="14" y="5" width="4" height="14" rx="1" />
</svg> Stop </svg> Stop
</button> </button>
{#if application.buildPack !== 'compose'} {#if application.buildPack !== 'compose'}
<button <button
on:click={restartApplication} on:click={restartApplication}
type="submit" type="submit"
disabled={!$isDeploymentEnabled} disabled={!$isDeploymentEnabled}
class="btn btn-sm gap-2" class="btn btn-sm gap-2"
> >
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6" class="w-6 h-6"
viewBox="0 0 24 24" viewBox="0 0 24 24"
stroke-width="1.5" stroke-width="1.5"
stroke="currentColor" stroke="currentColor"
fill="none" fill="none"
stroke-linecap="round" stroke-linecap="round"
stroke-linejoin="round" stroke-linejoin="round"
> >
<path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4" /> <path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4" />
<path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4" /> <path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4" />
</svg> Restart </svg> Restart
</button> </button>
{/if} {/if}
<button <button
disabled={!$isDeploymentEnabled} disabled={!$isDeploymentEnabled}
class="btn btn-sm gap-2" class="btn btn-sm gap-2"
@@ -389,51 +387,73 @@
Force Redeploy Force Redeploy
</button> </button>
{:else if $isDeploymentEnabled && !$page.url.pathname.startsWith(`/applications/${id}/configuration/`)} {:else if $isDeploymentEnabled && !$page.url.pathname.startsWith(`/applications/${id}/configuration/`)}
{#if $status.application.overallStatus === 'degraded'}
<button
on:click={stopApplication}
type="submit"
disabled={!$isDeploymentEnabled}
class="btn btn-sm btn-error gap-2"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6 "
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<rect x="6" y="5" width="4" height="14" rx="1" />
<rect x="14" y="5" width="4" height="14" rx="1" />
</svg> Stop
</button>
{/if}
<button <button
class="btn btn-sm gap-2" class="btn btn-sm gap-2"
class:btn-error={$status.application.overallStatus === 'degraded'}
class:btn-primary={$status.application.overallStatus !== 'degraded'} class:btn-primary={$status.application.overallStatus !== 'degraded'}
disabled={!$isDeploymentEnabled} disabled={!$isDeploymentEnabled}
on:click={() => handleDeploySubmit(false)} on:click={() => handleDeploySubmit(false)}
> >
{#if $status.application.overallStatus !== 'degraded'} {#if $status.application.overallStatus !== 'degraded'}
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6" class="w-6 h-6"
viewBox="0 0 24 24" viewBox="0 0 24 24"
stroke-width="1.5" stroke-width="1.5"
stroke="currentColor" stroke="currentColor"
fill="none" fill="none"
stroke-linecap="round" stroke-linecap="round"
stroke-linejoin="round" stroke-linejoin="round"
> >
<path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M7 4v16l13 -8z" /> <path d="M7 4v16l13 -8z" />
</svg> </svg>
{:else} {:else}
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6" class="w-6 h-6"
viewBox="0 0 24 24" viewBox="0 0 24 24"
stroke-width="1.5" stroke-width="1.5"
stroke="currentColor" stroke="currentColor"
fill="none" fill="none"
stroke-linecap="round" stroke-linecap="round"
stroke-linejoin="round" stroke-linejoin="round"
> >
<path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path <path
d="M16.3 5h.7a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h5l-2.82 -2.82m0 5.64l2.82 -2.82" d="M16.3 5h.7a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h5l-2.82 -2.82m0 5.64l2.82 -2.82"
transform="rotate(-45 12 12)" transform="rotate(-45 12 12)"
/> />
</svg> </svg>
{/if} {/if}
{$status.application.overallStatus === 'degraded' ? 'Restart Degraded Stack' : 'Deploy'} {$status.application.overallStatus === 'degraded'
? $status.application.statuses.length === 1
? 'Force Redeploy'
: 'Redeploy Stack'
: 'Deploy'}
</button> </button>
{/if} {/if}
{#if $location && $status.application.overallStatus === 'healthy'} {#if $location && $status.application.overallStatus === 'healthy'}

View File

@@ -102,10 +102,8 @@
: { : {
Authorization: `Bearer ${$appSession.tokens.gitlab}` Authorization: `Bearer ${$appSession.tokens.gitlab}`
}; };
if (isPublicRepository) {
return; const url = isPublicRepository ? `/projects/${projectId}/repository/tree` : `/v4/projects/${projectId}/repository/tree`;
}
const url = isPublicRepository ? `` : `/v4/projects/${projectId}/repository/tree`;
const files = await get(`${apiUrl}${url}`, { const files = await get(`${apiUrl}${url}`, {
...headers ...headers
}); });

View File

@@ -237,6 +237,7 @@
(application.id && application.id.toLowerCase().includes($search.toLowerCase())) || (application.id && application.id.toLowerCase().includes($search.toLowerCase())) ||
(application.name && application.name.toLowerCase().includes($search.toLowerCase())) || (application.name && application.name.toLowerCase().includes($search.toLowerCase())) ||
(application.fqdn && application.fqdn.toLowerCase().includes($search.toLowerCase())) || (application.fqdn && application.fqdn.toLowerCase().includes($search.toLowerCase())) ||
(application.dockerComposeConfiguration && application.dockerComposeConfiguration.toLowerCase().includes($search.toLowerCase())) ||
(application.repository && (application.repository &&
application.repository.toLowerCase().includes($search.toLowerCase())) || application.repository.toLowerCase().includes($search.toLowerCase())) ||
(application.buildpack && (application.buildpack &&