coolify/src/routes/services/index.svelte

176 lines
6.5 KiB
Svelte
Raw Normal View History

2022-02-10 14:47:44 +00:00
<script lang="ts">
import PlausibleAnalytics from '$lib/components/svg/services/PlausibleAnalytics.svelte';
import NocoDb from '$lib/components/svg/services/NocoDB.svelte';
import MinIo from '$lib/components/svg/services/MinIO.svelte';
import VsCodeServer from '$lib/components/svg/services/VSCodeServer.svelte';
import Wordpress from '$lib/components/svg/services/Wordpress.svelte';
2022-02-11 14:31:25 +00:00
import VaultWarden from '$lib/components/svg/services/VaultWarden.svelte';
2022-03-02 10:57:03 +00:00
import LanguageTool from '$lib/components/svg/services/LanguageTool.svelte';
2022-03-25 09:36:47 +00:00
import { post } from '$lib/api';
import { goto } from '$app/navigation';
2022-03-27 12:37:32 +00:00
import N8n from '$lib/components/svg/services/N8n.svelte';
import UptimeKuma from '$lib/components/svg/services/UptimeKuma.svelte';
2022-03-27 20:32:31 +00:00
import Ghost from '$lib/components/svg/services/Ghost.svelte';
2022-04-03 12:14:59 +00:00
import { t } from '$lib/translations';
2022-04-02 21:08:27 +00:00
import MeiliSearch from '$lib/components/svg/services/MeiliSearch.svelte';
2022-04-06 18:44:24 +00:00
import { session } from '$app/stores';
2022-04-08 08:35:16 +00:00
import { getDomain } from '$lib/components/common';
2022-04-25 06:54:53 +00:00
import Umami from '$lib/components/svg/services/Umami.svelte';
2022-04-27 13:37:50 +00:00
import Hasura from '$lib/components/svg/services/Hasura.svelte';
2022-04-29 20:25:04 +00:00
import Fider from '$lib/components/svg/services/Fider.svelte';
2022-02-10 14:47:44 +00:00
export let services;
2022-03-25 09:36:47 +00:00
async function newService() {
const { id } = await post('/services/new', {});
return await goto(`/services/${id}`, { replaceState: true });
}
2022-04-07 13:23:32 +00:00
const ownServices = services.filter((service) => {
if (service.teams[0].id === $session.teamId) {
return service;
}
});
const otherServices = services.filter((service) => {
if (service.teams[0].id !== $session.teamId) {
return service;
}
});
2022-02-10 14:47:44 +00:00
</script>
<div class="flex space-x-1 p-6 font-bold">
2022-04-03 12:14:59 +00:00
<div class="mr-4 text-2xl tracking-tight">{$t('index.services')}</div>
2022-03-25 09:36:47 +00:00
<div on:click={newService} class="add-icon cursor-pointer bg-pink-600 hover:bg-pink-500">
2022-02-10 14:47:44 +00:00
<svg
class="w-6"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
><path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M12 6v6m0 0v6m0-6h6m-6 0H6"
/></svg
>
2022-03-25 09:36:47 +00:00
</div>
2022-02-10 14:47:44 +00:00
</div>
2022-05-10 11:40:30 +00:00
<div class="flex-col justify-center">
2022-04-08 12:03:21 +00:00
{#if !services || ownServices.length === 0}
2022-02-10 14:47:44 +00:00
<div class="flex-col">
2022-04-03 12:14:59 +00:00
<div class="text-center text-xl font-bold">{$t('service.no_service')}</div>
2022-02-10 14:47:44 +00:00
</div>
2022-04-08 12:12:06 +00:00
{/if}
{#if ownServices.length > 0 || otherServices.length > 0}
2022-04-07 13:23:32 +00:00
<div class="flex flex-col">
2022-04-08 12:12:06 +00:00
<div class="flex flex-col flex-wrap justify-center px-2 md:flex-row">
2022-04-07 13:23:32 +00:00
{#each ownServices as service}
2022-04-08 12:12:06 +00:00
<a href="/services/{service.id}" class="w-96 p-2 no-underline">
<div class="box-selection group relative hover:bg-pink-600">
2022-04-07 13:23:32 +00:00
{#if service.type === 'plausibleanalytics'}
<PlausibleAnalytics isAbsolute />
{:else if service.type === 'nocodb'}
<NocoDb isAbsolute />
{:else if service.type === 'minio'}
<MinIo isAbsolute />
{:else if service.type === 'vscodeserver'}
<VsCodeServer isAbsolute />
{:else if service.type === 'wordpress'}
<Wordpress isAbsolute />
{:else if service.type === 'vaultwarden'}
<VaultWarden isAbsolute />
{:else if service.type === 'languagetool'}
<LanguageTool isAbsolute />
{:else if service.type === 'n8n'}
<N8n isAbsolute />
{:else if service.type === 'uptimekuma'}
<UptimeKuma isAbsolute />
{:else if service.type === 'ghost'}
<Ghost isAbsolute />
{:else if service.type === 'meilisearch'}
<MeiliSearch isAbsolute />
2022-04-25 06:54:53 +00:00
{:else if service.type === 'umami'}
<Umami isAbsolute />
2022-04-27 13:37:50 +00:00
{:else if service.type === 'hasura'}
<Hasura isAbsolute />
2022-04-29 20:25:04 +00:00
{:else if service.type === 'fider'}
<Fider isAbsolute />
2022-04-07 13:23:32 +00:00
{/if}
2022-04-08 12:12:06 +00:00
<div class="truncate text-center text-xl font-bold">
2022-04-07 13:23:32 +00:00
{service.name}
</div>
2022-04-08 08:35:16 +00:00
{#if $session.teamId === '0' && otherServices.length > 0}
2022-04-08 12:12:06 +00:00
<div class="truncate text-center">{service.teams[0].name}</div>
2022-04-07 13:23:32 +00:00
{/if}
2022-04-08 08:35:16 +00:00
{#if service.fqdn}
2022-04-08 12:03:21 +00:00
<div class="truncate text-center">{getDomain(service.fqdn) || ''}</div>
2022-04-08 08:35:16 +00:00
{/if}
2022-04-07 13:23:32 +00:00
{#if !service.type || !service.fqdn}
2022-04-08 12:12:06 +00:00
<div class="truncate text-center font-bold text-red-500 group-hover:text-white">
{$t('application.configuration.configuration_missing')}
2022-04-07 13:23:32 +00:00
</div>
{/if}
2022-02-10 14:47:44 +00:00
</div>
2022-04-07 13:23:32 +00:00
</a>
{/each}
</div>
{#if otherServices.length > 0 && $session.teamId === '0'}
2022-04-08 12:12:06 +00:00
<div class="px-6 pb-5 pt-10 text-xl font-bold">Other Services</div>
<div class="flex flex-col flex-wrap justify-center px-2 md:flex-row">
2022-04-07 13:23:32 +00:00
{#each otherServices as service}
2022-04-08 12:12:06 +00:00
<a href="/services/{service.id}" class="w-96 p-2 no-underline">
<div class="box-selection group relative hover:bg-pink-600">
2022-04-07 13:23:32 +00:00
{#if service.type === 'plausibleanalytics'}
<PlausibleAnalytics isAbsolute />
{:else if service.type === 'nocodb'}
<NocoDb isAbsolute />
{:else if service.type === 'minio'}
<MinIo isAbsolute />
{:else if service.type === 'vscodeserver'}
<VsCodeServer isAbsolute />
{:else if service.type === 'wordpress'}
<Wordpress isAbsolute />
{:else if service.type === 'vaultwarden'}
<VaultWarden isAbsolute />
{:else if service.type === 'languagetool'}
<LanguageTool isAbsolute />
{:else if service.type === 'n8n'}
<N8n isAbsolute />
{:else if service.type === 'uptimekuma'}
<UptimeKuma isAbsolute />
{:else if service.type === 'ghost'}
<Ghost isAbsolute />
{:else if service.type === 'meilisearch'}
<MeiliSearch isAbsolute />
2022-04-25 06:54:53 +00:00
{:else if service.type === 'umami'}
<Umami isAbsolute />
2022-04-27 13:37:50 +00:00
{:else if service.type === 'hasura'}
<Hasura isAbsolute />
2022-04-29 20:25:04 +00:00
{:else if service.type === 'fider'}
<Fider isAbsolute />
2022-04-07 13:23:32 +00:00
{/if}
2022-04-08 12:12:06 +00:00
<div class="truncate text-center text-xl font-bold">
2022-04-07 13:23:32 +00:00
{service.name}
</div>
{#if $session.teamId === '0'}
2022-04-08 12:12:06 +00:00
<div class="truncate text-center">{service.teams[0].name}</div>
2022-04-07 13:23:32 +00:00
{/if}
2022-04-08 08:35:16 +00:00
{#if service.fqdn}
2022-04-08 12:03:21 +00:00
<div class="truncate text-center">{getDomain(service.fqdn) || ''}</div>
2022-04-08 08:35:16 +00:00
{/if}
2022-04-07 13:23:32 +00:00
{#if !service.type || !service.fqdn}
2022-04-08 12:12:06 +00:00
<div class="truncate text-center font-bold text-red-500 group-hover:text-white">
2022-04-07 13:23:32 +00:00
Configuration missing
</div>
{:else}
<div class="text-center truncate">{service.type}</div>
{/if}
</div>
</a>
{/each}
2022-02-10 14:47:44 +00:00
</div>
2022-04-07 13:23:32 +00:00
{/if}
</div>
2022-02-10 14:47:44 +00:00
{/if}
</div>