fix: service deploymentEnabled
This commit is contained in:
parent
11d10bee12
commit
8600400632
@ -56,6 +56,15 @@ export function checkIfDeploymentEnabledApplications(isAdmin: boolean, applicati
|
|||||||
application.buildPack
|
application.buildPack
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
export function checkIfDeploymentEnabledServices(isAdmin: boolean, service: any) {
|
||||||
|
return (
|
||||||
|
isAdmin &&
|
||||||
|
service.fqdn &&
|
||||||
|
service.destinationDocker &&
|
||||||
|
service.version &&
|
||||||
|
service.type
|
||||||
|
);
|
||||||
|
}
|
||||||
export const status: Writable<any> = writable({
|
export const status: Writable<any> = writable({
|
||||||
application: {
|
application: {
|
||||||
isRunning: false,
|
isRunning: false,
|
||||||
|
@ -164,6 +164,7 @@
|
|||||||
$status.application.isExited = false;
|
$status.application.isExited = false;
|
||||||
$status.application.loading = false;
|
$status.application.loading = false;
|
||||||
$location = null;
|
$location = null;
|
||||||
|
$isDeploymentEnabled = false;
|
||||||
clearInterval(statusInterval);
|
clearInterval(statusInterval);
|
||||||
});
|
});
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
@ -60,19 +60,21 @@
|
|||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { t } from '$lib/translations';
|
import { t } from '$lib/translations';
|
||||||
import { errorNotification, handlerNotFoundLoad } from '$lib/common';
|
import { errorNotification, handlerNotFoundLoad } from '$lib/common';
|
||||||
import { appSession, disabledButton, status, location, setLocation } from '$lib/store';
|
import {
|
||||||
|
appSession,
|
||||||
|
isDeploymentEnabled,
|
||||||
|
status,
|
||||||
|
location,
|
||||||
|
setLocation,
|
||||||
|
checkIfDeploymentEnabledServices
|
||||||
|
} from '$lib/store';
|
||||||
import { onDestroy, onMount } from 'svelte';
|
import { onDestroy, onMount } from 'svelte';
|
||||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||||
const { id } = $page.params;
|
const { id } = $page.params;
|
||||||
|
|
||||||
export let service: any;
|
export let service: any;
|
||||||
|
|
||||||
$disabledButton =
|
$isDeploymentEnabled = checkIfDeploymentEnabledServices($appSession.isAdmin, service);
|
||||||
!$appSession.isAdmin ||
|
|
||||||
!service.fqdn ||
|
|
||||||
!service.destinationDocker ||
|
|
||||||
!service.version ||
|
|
||||||
!service.type;
|
|
||||||
|
|
||||||
let statusInterval: any;
|
let statusInterval: any;
|
||||||
|
|
||||||
@ -133,6 +135,7 @@
|
|||||||
$status.service.isExited = false;
|
$status.service.isExited = false;
|
||||||
$status.service.loading = false;
|
$status.service.loading = false;
|
||||||
$location = null;
|
$location = null;
|
||||||
|
$isDeploymentEnabled = false;
|
||||||
clearInterval(statusInterval);
|
clearInterval(statusInterval);
|
||||||
});
|
});
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
@ -151,141 +154,142 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<nav class="nav-side">
|
<nav class="nav-side">
|
||||||
{#if service.type && service.destinationDockerId && service.version && service.fqdn}
|
{#if $location}
|
||||||
{#if $location}
|
<a
|
||||||
<a
|
id="open"
|
||||||
id="open"
|
href={$location}
|
||||||
href={$location}
|
target="_blank"
|
||||||
target="_blank"
|
class="icons flex items-center bg-transparent text-sm"
|
||||||
class="icons flex items-center bg-transparent text-sm"
|
><svg
|
||||||
><svg
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
class="h-6 w-6"
|
||||||
class="h-6 w-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 d="M11 7h-5a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-5" />
|
|
||||||
<line x1="10" y1="14" x2="20" y2="4" />
|
|
||||||
<polyline points="15 4 20 4 20 9" />
|
|
||||||
</svg></a
|
|
||||||
>
|
>
|
||||||
<Tooltip triggeredBy="#open">Open</Tooltip>
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||||
<div class="border border-stone-700 h-8" />
|
<path d="M11 7h-5a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-5" />
|
||||||
{/if}
|
<line x1="10" y1="14" x2="20" y2="4" />
|
||||||
{#if $status.service.isExited}
|
<polyline points="15 4 20 4 20 9" />
|
||||||
<a
|
</svg></a
|
||||||
id="error"
|
>
|
||||||
href={!$disabledButton ? `/services/${id}/logs` : null}
|
<Tooltip triggeredBy="#open">Open</Tooltip>
|
||||||
class="icons bg-transparent text-sm flex items-center text-red-500 tooltip-error"
|
|
||||||
sveltekit:prefetch
|
|
||||||
>
|
|
||||||
<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" />
|
|
||||||
<path
|
|
||||||
d="M8.7 3h6.6c.3 0 .5 .1 .7 .3l4.7 4.7c.2 .2 .3 .4 .3 .7v6.6c0 .3 -.1 .5 -.3 .7l-4.7 4.7c-.2 .2 -.4 .3 -.7 .3h-6.6c-.3 0 -.5 -.1 -.7 -.3l-4.7 -4.7c-.2 -.2 -.3 -.4 -.3 -.7v-6.6c0 -.3 .1 -.5 .3 -.7l4.7 -4.7c.2 -.2 .4 -.3 .7 -.3z"
|
|
||||||
/>
|
|
||||||
<line x1="12" y1="8" x2="12" y2="12" />
|
|
||||||
<line x1="12" y1="16" x2="12.01" y2="16" />
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
<Tooltip triggeredBy="#error">Service exited with an error!</Tooltip>
|
|
||||||
{/if}
|
|
||||||
{#if $status.service.initialLoading}
|
|
||||||
<button
|
|
||||||
class="icons flex animate-spin items-center space-x-2 bg-transparent text-sm duration-500 ease-in-out"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="h-6 w-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" />
|
|
||||||
<path d="M9 4.55a8 8 0 0 1 6 14.9m0 -4.45v5h5" />
|
|
||||||
<line x1="5.63" y1="7.16" x2="5.63" y2="7.17" />
|
|
||||||
<line x1="4.06" y1="11" x2="4.06" y2="11.01" />
|
|
||||||
<line x1="4.63" y1="15.1" x2="4.63" y2="15.11" />
|
|
||||||
<line x1="7.16" y1="18.37" x2="7.16" y2="18.38" />
|
|
||||||
<line x1="11" y1="19.94" x2="11" y2="19.95" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
{:else if $status.service.isRunning}
|
|
||||||
<button
|
|
||||||
id="stop"
|
|
||||||
on:click={stopService}
|
|
||||||
type="submit"
|
|
||||||
disabled={$disabledButton}
|
|
||||||
class="icons bg-transparent text-sm flex items-center space-x-2 text-red-500"
|
|
||||||
>
|
|
||||||
<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>
|
|
||||||
</button>
|
|
||||||
<Tooltip triggeredBy="#stop">Stop</Tooltip>
|
|
||||||
{:else}
|
|
||||||
<button
|
|
||||||
id="start"
|
|
||||||
on:click={startService}
|
|
||||||
type="submit"
|
|
||||||
disabled={$disabledButton}
|
|
||||||
class="icons bg-transparent text-sm flex items-center space-x-2 text-green-500"
|
|
||||||
><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" />
|
|
||||||
<path d="M7 4v16l13 -8z" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
<Tooltip triggeredBy="#start">Start</Tooltip>
|
|
||||||
{/if}
|
|
||||||
<div class="border border-stone-700 h-8" />
|
<div class="border border-stone-700 h-8" />
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if $status.service.isExited}
|
||||||
|
<a
|
||||||
|
id="error"
|
||||||
|
href={$isDeploymentEnabled ? `/services/${id}/logs` : null}
|
||||||
|
class="icons bg-transparent text-sm flex items-center text-red-500 tooltip-error"
|
||||||
|
sveltekit:prefetch
|
||||||
|
>
|
||||||
|
<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" />
|
||||||
|
<path
|
||||||
|
d="M8.7 3h6.6c.3 0 .5 .1 .7 .3l4.7 4.7c.2 .2 .3 .4 .3 .7v6.6c0 .3 -.1 .5 -.3 .7l-4.7 4.7c-.2 .2 -.4 .3 -.7 .3h-6.6c-.3 0 -.5 -.1 -.7 -.3l-4.7 -4.7c-.2 -.2 -.3 -.4 -.3 -.7v-6.6c0 -.3 .1 -.5 .3 -.7l4.7 -4.7c.2 -.2 .4 -.3 .7 -.3z"
|
||||||
|
/>
|
||||||
|
<line x1="12" y1="8" x2="12" y2="12" />
|
||||||
|
<line x1="12" y1="16" x2="12.01" y2="16" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<Tooltip triggeredBy="#error">Service exited with an error!</Tooltip>
|
||||||
|
{/if}
|
||||||
|
{#if $status.service.initialLoading}
|
||||||
|
<button
|
||||||
|
class="icons flex animate-spin items-center space-x-2 bg-transparent text-sm duration-500 ease-in-out"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="h-6 w-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" />
|
||||||
|
<path d="M9 4.55a8 8 0 0 1 6 14.9m0 -4.45v5h5" />
|
||||||
|
<line x1="5.63" y1="7.16" x2="5.63" y2="7.17" />
|
||||||
|
<line x1="4.06" y1="11" x2="4.06" y2="11.01" />
|
||||||
|
<line x1="4.63" y1="15.1" x2="4.63" y2="15.11" />
|
||||||
|
<line x1="7.16" y1="18.37" x2="7.16" y2="18.38" />
|
||||||
|
<line x1="11" y1="19.94" x2="11" y2="19.95" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
{:else if $status.service.isRunning}
|
||||||
|
<button
|
||||||
|
id="stop"
|
||||||
|
on:click={stopService}
|
||||||
|
type="submit"
|
||||||
|
disabled={!$isDeploymentEnabled}
|
||||||
|
class="icons bg-transparent text-sm flex items-center space-x-2 text-red-500"
|
||||||
|
>
|
||||||
|
<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>
|
||||||
|
</button>
|
||||||
|
<Tooltip triggeredBy="#stop">Stop</Tooltip>
|
||||||
|
{:else}
|
||||||
|
<button
|
||||||
|
id="start"
|
||||||
|
on:click={startService}
|
||||||
|
type="submit"
|
||||||
|
disabled={!$isDeploymentEnabled}
|
||||||
|
class="icons bg-transparent text-sm flex items-center space-x-2 text-green-500"
|
||||||
|
><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" />
|
||||||
|
<path d="M7 4v16l13 -8z" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<Tooltip triggeredBy="#start">Start</Tooltip>
|
||||||
|
{/if}
|
||||||
|
<div class="border border-stone-700 h-8" />
|
||||||
{#if service.type && service.destinationDockerId && service.version}
|
{#if service.type && service.destinationDockerId && service.version}
|
||||||
<a
|
<a
|
||||||
id="configuration"
|
|
||||||
href="/services/{id}"
|
href="/services/{id}"
|
||||||
sveltekit:prefetch
|
sveltekit:prefetch
|
||||||
class="hover:text-yellow-500 rounded"
|
class="hover:text-yellow-500 rounded"
|
||||||
class:text-yellow-500={$page.url.pathname === `/services/${id}`}
|
class:text-yellow-500={$page.url.pathname === `/services/${id}`}
|
||||||
class:bg-coolgray-500={$page.url.pathname === `/services/${id}`}
|
class:bg-coolgray-500={$page.url.pathname === `/services/${id}`}
|
||||||
>
|
>
|
||||||
<button class="icons bg-transparent text-sm disabled:text-red-500">
|
<button
|
||||||
|
id="configuration"
|
||||||
|
disabled={!$isDeploymentEnabled}
|
||||||
|
class="icons bg-transparent text-sm"
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
class="h-6 w-6"
|
class="h-6 w-6"
|
||||||
@ -311,14 +315,17 @@
|
|||||||
>
|
>
|
||||||
<Tooltip triggeredBy="#configuration">Configuration</Tooltip>
|
<Tooltip triggeredBy="#configuration">Configuration</Tooltip>
|
||||||
<a
|
<a
|
||||||
id="secrets"
|
|
||||||
href="/services/{id}/secrets"
|
href="/services/{id}/secrets"
|
||||||
sveltekit:prefetch
|
sveltekit:prefetch
|
||||||
class="hover:text-pink-500 rounded"
|
class="hover:text-pink-500 rounded"
|
||||||
class:text-pink-500={$page.url.pathname === `/services/${id}/secrets`}
|
class:text-pink-500={$page.url.pathname === `/services/${id}/secrets`}
|
||||||
class:bg-coolgray-500={$page.url.pathname === `/services/${id}/secrets`}
|
class:bg-coolgray-500={$page.url.pathname === `/services/${id}/secrets`}
|
||||||
>
|
>
|
||||||
<button class="icons bg-transparent text-sm disabled:text-red-500">
|
<button
|
||||||
|
id="secrets"
|
||||||
|
disabled={!$isDeploymentEnabled}
|
||||||
|
class="icons bg-transparent text-sm "
|
||||||
|
>
|
||||||
<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"
|
||||||
@ -340,14 +347,17 @@
|
|||||||
>
|
>
|
||||||
<Tooltip triggeredBy="#secrets">Secrets</Tooltip>
|
<Tooltip triggeredBy="#secrets">Secrets</Tooltip>
|
||||||
<a
|
<a
|
||||||
id="persistentstorage"
|
|
||||||
href="/services/{id}/storages"
|
href="/services/{id}/storages"
|
||||||
sveltekit:prefetch
|
sveltekit:prefetch
|
||||||
class="hover:text-pink-500 rounded"
|
class="hover:text-pink-500 rounded"
|
||||||
class:text-pink-500={$page.url.pathname === `/services/${id}/storages`}
|
class:text-pink-500={$page.url.pathname === `/services/${id}/storages`}
|
||||||
class:bg-coolgray-500={$page.url.pathname === `/services/${id}/storages`}
|
class:bg-coolgray-500={$page.url.pathname === `/services/${id}/storages`}
|
||||||
>
|
>
|
||||||
<button class="icons bg-transparent text-sm disabled:text-red-500">
|
<button
|
||||||
|
id="persistentstorage"
|
||||||
|
disabled={!$isDeploymentEnabled}
|
||||||
|
class="icons bg-transparent text-sm"
|
||||||
|
>
|
||||||
<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"
|
||||||
@ -368,14 +378,13 @@
|
|||||||
<Tooltip triggeredBy="#persistentstorage">Persistent Storage</Tooltip>
|
<Tooltip triggeredBy="#persistentstorage">Persistent Storage</Tooltip>
|
||||||
<div class="border border-stone-700 h-8" />
|
<div class="border border-stone-700 h-8" />
|
||||||
<a
|
<a
|
||||||
id="logs"
|
href={$isDeploymentEnabled && $status.service.isRunning ? `/services/${id}/logs` : null}
|
||||||
href={!$disabledButton && $status.service.isRunning ? `/services/${id}/logs` : null}
|
|
||||||
sveltekit:prefetch
|
sveltekit:prefetch
|
||||||
class="hover:text-pink-500 rounded"
|
class="hover:text-pink-500 rounded"
|
||||||
class:text-pink-500={$page.url.pathname === `/services/${id}/logs`}
|
class:text-pink-500={$page.url.pathname === `/services/${id}/logs`}
|
||||||
class:bg-coolgray-500={$page.url.pathname === `/services/${id}/logs`}
|
class:bg-coolgray-500={$page.url.pathname === `/services/${id}/logs`}
|
||||||
>
|
>
|
||||||
<button disabled={!$status.service.isRunning} class="icons bg-transparent text-sm">
|
<button id="logs" disabled={!$status.service.isRunning} class="icons bg-transparent text-sm">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
class="h-6 w-6"
|
class="h-6 w-6"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user