2022-10-06 11:25:54 -05:00
|
|
|
<script lang="ts">
|
|
|
|
|
import LoadingSpinner from '$lib/components/shared-components/loading-spinner.svelte';
|
|
|
|
|
import { createEventDispatcher } from 'svelte';
|
|
|
|
|
|
|
|
|
|
export let title: string;
|
|
|
|
|
export let subtitle: string;
|
|
|
|
|
export let buttonTitle = 'Run';
|
|
|
|
|
export let jobStatus: boolean;
|
|
|
|
|
export let waitingJobCount: number;
|
|
|
|
|
export let activeJobCount: number;
|
2023-01-09 22:35:37 +02:00
|
|
|
|
2022-10-06 11:25:54 -05:00
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
|
</script>
|
|
|
|
|
|
2022-10-26 11:10:48 -05:00
|
|
|
<div class="flex border-b pb-5 dark:border-b-immich-dark-gray">
|
2022-10-06 11:25:54 -05:00
|
|
|
<div class="w-[70%]">
|
2022-12-20 22:00:47 -06:00
|
|
|
<h1 class="text-immich-primary dark:text-immich-dark-primary text-sm font-semibold">
|
|
|
|
|
{title.toUpperCase()}
|
|
|
|
|
</h1>
|
2022-10-26 11:10:48 -05:00
|
|
|
<p class="text-sm mt-1 dark:text-immich-dark-fg">{subtitle}</p>
|
|
|
|
|
<p class="text-sm dark:text-immich-dark-fg">
|
2022-10-06 11:25:54 -05:00
|
|
|
<slot />
|
|
|
|
|
</p>
|
2022-10-25 21:41:46 -05:00
|
|
|
<table class="text-left w-full mt-5">
|
2022-10-06 11:25:54 -05:00
|
|
|
<!-- table header -->
|
2022-10-25 21:41:46 -05:00
|
|
|
<thead
|
2022-10-26 11:10:48 -05:00
|
|
|
class="border rounded-md mb-2 dark:bg-immich-dark-gray dark:border-immich-dark-gray bg-immich-primary/10 flex text-immich-primary dark:text-immich-dark-primary w-full h-12"
|
2022-10-25 21:41:46 -05:00
|
|
|
>
|
2022-10-06 11:25:54 -05:00
|
|
|
<tr class="flex w-full place-items-center">
|
|
|
|
|
<th class="text-center w-1/3 font-medium text-sm">Status</th>
|
|
|
|
|
<th class="text-center w-1/3 font-medium text-sm">Active</th>
|
|
|
|
|
<th class="text-center w-1/3 font-medium text-sm">Waiting</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
2022-10-26 11:10:48 -05:00
|
|
|
<tbody
|
2022-11-09 05:41:45 -06:00
|
|
|
class="overflow-y-auto rounded-md w-full max-h-[320px] block border bg-white dark:border-immich-dark-gray dark:bg-immich-dark-gray/75 dark:text-immich-dark-fg"
|
2022-10-26 11:10:48 -05:00
|
|
|
>
|
|
|
|
|
<tr class="text-center flex place-items-center w-full h-[60px]">
|
2022-10-06 11:25:54 -05:00
|
|
|
<td class="text-sm px-2 w-1/3 text-ellipsis">{jobStatus ? 'Active' : 'Idle'}</td>
|
2023-01-09 22:35:37 +02:00
|
|
|
<td class="flex justify-center text-sm px-2 w-1/3 text-ellipsis">
|
|
|
|
|
{#if activeJobCount !== undefined}
|
|
|
|
|
{activeJobCount}
|
|
|
|
|
{:else}
|
|
|
|
|
<LoadingSpinner />
|
|
|
|
|
{/if}
|
|
|
|
|
</td>
|
|
|
|
|
<td class="flex justify-center text-sm px-2 w-1/3 text-ellipsis">
|
|
|
|
|
{#if waitingJobCount !== undefined}
|
|
|
|
|
{waitingJobCount}
|
|
|
|
|
{:else}
|
|
|
|
|
<LoadingSpinner />
|
|
|
|
|
{/if}
|
|
|
|
|
</td>
|
2022-10-06 11:25:54 -05:00
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="w-[30%] flex place-items-center place-content-end">
|
|
|
|
|
<button
|
|
|
|
|
on:click={() => dispatch('click')}
|
2022-10-26 11:10:48 -05:00
|
|
|
class="px-6 py-3 text-sm bg-immich-primary dark:bg-immich-dark-primary font-medium rounded-2xl hover:bg-immich-primary/50 transition-all hover:cursor-pointer disabled:cursor-not-allowed shadow-sm text-immich-bg dark:text-immich-dark-gray"
|
2022-10-06 11:25:54 -05:00
|
|
|
disabled={jobStatus}
|
|
|
|
|
>
|
|
|
|
|
{#if jobStatus}
|
|
|
|
|
<LoadingSpinner />
|
|
|
|
|
{:else}
|
|
|
|
|
{buttonTitle}
|
|
|
|
|
{/if}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|