2022-10-06 11:25:54 -05:00
|
|
|
<script lang="ts">
|
|
|
|
|
import LoadingSpinner from '$lib/components/shared-components/loading-spinner.svelte';
|
2023-01-26 22:50:22 -06:00
|
|
|
import SelectionSearch from 'svelte-material-icons/SelectionSearch.svelte';
|
|
|
|
|
import Play from 'svelte-material-icons/Play.svelte';
|
|
|
|
|
import AllInclusive from 'svelte-material-icons/AllInclusive.svelte';
|
2023-02-22 18:53:08 +01:00
|
|
|
import { locale } from '$lib/stores/preferences.store';
|
2022-10-06 11:25:54 -05:00
|
|
|
import { createEventDispatcher } from 'svelte';
|
2023-03-20 11:55:28 -04:00
|
|
|
import { JobCountsDto } from '@api';
|
2022-10-06 11:25:54 -05:00
|
|
|
|
|
|
|
|
export let title: string;
|
|
|
|
|
export let subtitle: string;
|
2023-03-20 11:55:28 -04:00
|
|
|
export let jobCounts: JobCountsDto;
|
2023-01-26 22:50:22 -06:00
|
|
|
/**
|
|
|
|
|
* Show options to run job on all assets of just missing ones
|
|
|
|
|
*/
|
|
|
|
|
export let showOptions = true;
|
|
|
|
|
|
|
|
|
|
$: isRunning = jobCounts.active > 0 || jobCounts.waiting > 0;
|
2023-01-09 22:35:37 +02:00
|
|
|
|
2022-10-06 11:25:54 -05:00
|
|
|
const dispatch = createEventDispatcher();
|
2023-01-26 22:50:22 -06:00
|
|
|
|
2023-03-20 11:55:28 -04:00
|
|
|
const run = (force: boolean) => {
|
|
|
|
|
dispatch('click', { force });
|
2023-01-26 22:50:22 -06:00
|
|
|
};
|
2022-10-06 11:25:54 -05:00
|
|
|
</script>
|
|
|
|
|
|
2023-01-26 22:50:22 -06:00
|
|
|
<div class="flex justify-between rounded-3xl bg-gray-100 dark:bg-immich-dark-gray">
|
|
|
|
|
<div id="job-info" class="w-[70%] p-9">
|
|
|
|
|
<div class="flex flex-col gap-2">
|
|
|
|
|
<div class="text-xl font-semibold text-immich-primary dark:text-immich-dark-primary">
|
|
|
|
|
{title.toUpperCase()}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{#if subtitle.length > 0}
|
|
|
|
|
<div class="text-sm dark:text-white">{subtitle}</div>
|
|
|
|
|
{/if}
|
|
|
|
|
<div class="text-sm dark:text-white"><slot /></div>
|
|
|
|
|
|
|
|
|
|
<div class="flex w-full mt-4">
|
|
|
|
|
<div
|
|
|
|
|
class="flex place-items-center justify-between bg-immich-primary dark:bg-immich-dark-primary text-white dark:text-immich-dark-gray w-full rounded-tl-lg rounded-bl-lg py-4 pl-4 pr-6"
|
|
|
|
|
>
|
|
|
|
|
<p>Active</p>
|
|
|
|
|
<p class="text-2xl">
|
2023-01-21 23:13:36 -05:00
|
|
|
{#if jobCounts.active !== undefined}
|
2023-02-22 18:53:08 +01:00
|
|
|
{jobCounts.active.toLocaleString($locale)}
|
2023-01-09 22:35:37 +02:00
|
|
|
{:else}
|
|
|
|
|
<LoadingSpinner />
|
|
|
|
|
{/if}
|
2023-01-26 22:50:22 -06:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
class="flex place-items-center justify-between bg-gray-200 text-immich-dark-bg dark:bg-gray-700 dark:text-immich-gray w-full rounded-tr-lg rounded-br-lg py-4 pr-4 pl-6"
|
|
|
|
|
>
|
|
|
|
|
<p class="text-2xl">
|
2023-01-21 23:13:36 -05:00
|
|
|
{#if jobCounts.waiting !== undefined}
|
2023-02-22 18:53:08 +01:00
|
|
|
{jobCounts.waiting.toLocaleString($locale)}
|
2023-01-09 22:35:37 +02:00
|
|
|
{:else}
|
|
|
|
|
<LoadingSpinner />
|
|
|
|
|
{/if}
|
2023-01-26 22:50:22 -06:00
|
|
|
</p>
|
|
|
|
|
<p>Waiting</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-10-06 11:25:54 -05:00
|
|
|
</div>
|
2023-01-26 22:50:22 -06:00
|
|
|
<div id="job-action" class="flex flex-col">
|
|
|
|
|
{#if isRunning}
|
|
|
|
|
<button
|
|
|
|
|
class="job-play-button bg-gray-300/90 dark:bg-gray-600/90 rounded-br-3xl rounded-tr-3xl disabled:cursor-not-allowed"
|
|
|
|
|
disabled
|
|
|
|
|
>
|
2022-10-06 11:25:54 -05:00
|
|
|
<LoadingSpinner />
|
2023-01-26 22:50:22 -06:00
|
|
|
</button>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if !isRunning}
|
|
|
|
|
{#if showOptions}
|
|
|
|
|
<button
|
|
|
|
|
class="job-play-button bg-gray-300 dark:bg-gray-600 rounded-tr-3xl"
|
|
|
|
|
on:click={() => run(true)}
|
|
|
|
|
>
|
|
|
|
|
<AllInclusive size="18" /> ALL
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
class="job-play-button bg-gray-300/90 dark:bg-gray-600/90 rounded-br-3xl"
|
|
|
|
|
on:click={() => run(false)}
|
|
|
|
|
>
|
|
|
|
|
<SelectionSearch size="18" /> MISSING
|
|
|
|
|
</button>
|
2022-10-06 11:25:54 -05:00
|
|
|
{:else}
|
2023-01-26 22:50:22 -06:00
|
|
|
<button
|
|
|
|
|
class="job-play-button bg-gray-300/90 dark:bg-gray-600/90 rounded-br-3xl rounded-tr-3xl"
|
|
|
|
|
on:click={() => run(true)}
|
|
|
|
|
>
|
|
|
|
|
<Play size="48" />
|
|
|
|
|
</button>
|
2022-10-06 11:25:54 -05:00
|
|
|
{/if}
|
2023-01-26 22:50:22 -06:00
|
|
|
{/if}
|
2022-10-06 11:25:54 -05:00
|
|
|
</div>
|
|
|
|
|
</div>
|