2022-10-06 11:25:54 -05:00
|
|
|
<script lang="ts">
|
2023-07-01 00:50:47 -04:00
|
|
|
import Badge from '$lib/components/elements/badge.svelte';
|
2024-09-19 18:20:09 -04:00
|
|
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
2023-10-25 09:48:25 -04:00
|
|
|
import Icon from '$lib/components/elements/icon.svelte';
|
2024-02-14 08:09:49 -05:00
|
|
|
import { locale } from '$lib/stores/preferences.store';
|
2024-02-14 06:38:57 -08:00
|
|
|
import { JobCommand, type JobCommandDto, type JobCountsDto, type QueueStatusDto } from '@immich/sdk';
|
2023-10-25 09:48:25 -04:00
|
|
|
import {
|
|
|
|
|
mdiAlertCircle,
|
|
|
|
|
mdiAllInclusive,
|
|
|
|
|
mdiClose,
|
|
|
|
|
mdiFastForward,
|
2024-10-03 21:58:28 -04:00
|
|
|
mdiImageRefreshOutline,
|
2023-10-25 09:48:25 -04:00
|
|
|
mdiPause,
|
|
|
|
|
mdiPlay,
|
|
|
|
|
mdiSelectionSearch,
|
|
|
|
|
} from '@mdi/js';
|
2024-11-02 16:49:07 +01:00
|
|
|
import { type Component } from 'svelte';
|
2024-09-19 18:20:09 -04:00
|
|
|
import { t } from 'svelte-i18n';
|
2024-02-14 08:09:49 -05:00
|
|
|
import JobTileButton from './job-tile-button.svelte';
|
|
|
|
|
import JobTileStatus from './job-tile-status.svelte';
|
2022-10-06 11:25:54 -05:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
export let title: string;
|
2024-02-02 04:18:00 +01:00
|
|
|
export let subtitle: string | undefined;
|
2024-11-02 16:49:07 +01:00
|
|
|
export let description: Component | undefined;
|
2023-07-01 00:50:47 -04:00
|
|
|
export let jobCounts: JobCountsDto;
|
|
|
|
|
export let queueStatus: QueueStatusDto;
|
2023-10-25 09:48:25 -04:00
|
|
|
export let icon: string;
|
2023-08-18 00:55:26 -04:00
|
|
|
export let disabled = false;
|
2023-01-26 22:50:22 -06:00
|
|
|
|
2024-10-03 21:58:28 -04:00
|
|
|
export let allText: string | undefined;
|
|
|
|
|
export let refreshText: string | undefined;
|
2023-07-01 00:50:47 -04:00
|
|
|
export let missingText: string;
|
2024-09-19 18:20:09 -04:00
|
|
|
export let onCommand: (command: JobCommandDto) => void;
|
feat(server): xmp sidecar metadata (#2466)
* initial commit for XMP sidecar support
* Added support for 'missing' metadata files to include those without sidecar files, now detects sidecar files in the filesystem for media already ingested but the sidecar was created afterwards
* didn't mean to commit default log level during testing
* new sidecar logic for video metadata as well
* Added xml mimetype for sidecars only
* don't need capture group for this regex
* wrong default value reverted
* simplified the move here - keep it in the same try catch since the outcome is to move the media back anyway
* simplified setter logic
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* simplified logic per suggestions
* sidecar is now its own queue with a discover and sync, updated UI for the new job queueing
* queue a sidecar job for every asset based on discovery or sync, though the logic is almost identical aside from linking the sidecar
* now queue sidecar jobs for each assset, though logic is mostly the same between discovery and sync
* simplified logic of filename extraction and asset instantiation
* not sure how that got deleted..
* updated code per suggestions and comments in the PR
* stat was not being used, removed the variable set
* better type checking, using in-scope variables for exif getter instead of passing in every time
* removed commented out test
* ran and resolved all lints, formats, checks, and tests
* resolved suggested change in PR
* made getExifProperty more dynamic with multiple possible args for fallbacks, fixed typo, used generic in function for better type checking
* better error handling and moving files back to positions on move or save failure
* regenerated api
* format fixes
* Added XMP documentation
* documentation typo
* Merged in main
* missed merge conflict
* more changes due to a merge
* Resolving conflicts
* added icon for sidecar jobs
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
2023-05-24 21:59:30 -04:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
$: waitingCount = jobCounts.waiting + jobCounts.paused + jobCounts.delayed;
|
|
|
|
|
$: isIdle = !queueStatus.isActive && !queueStatus.isPaused;
|
2024-10-03 21:58:28 -04:00
|
|
|
$: multipleButtons = allText || refreshText;
|
2023-01-09 22:35:37 +02:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
const commonClasses = 'flex place-items-center justify-between w-full py-2 sm:py-4 pr-4 pl-6';
|
2022-10-06 11:25:54 -05:00
|
|
|
</script>
|
|
|
|
|
|
2023-04-17 18:18:49 +02:00
|
|
|
<div
|
2023-07-18 13:19:39 -05:00
|
|
|
class="flex flex-col overflow-hidden rounded-2xl bg-gray-100 dark:bg-immich-dark-gray sm:flex-row sm:rounded-[35px]"
|
2023-04-17 18:18:49 +02:00
|
|
|
>
|
2023-07-18 13:19:39 -05:00
|
|
|
<div class="flex w-full flex-col">
|
2023-07-01 00:50:47 -04:00
|
|
|
{#if queueStatus.isPaused}
|
2024-06-04 21:53:00 +02:00
|
|
|
<JobTileStatus color="warning">{$t('paused')}</JobTileStatus>
|
2023-07-01 00:50:47 -04:00
|
|
|
{:else if queueStatus.isActive}
|
2024-06-04 21:53:00 +02:00
|
|
|
<JobTileStatus color="success">{$t('active')}</JobTileStatus>
|
2023-07-01 00:50:47 -04:00
|
|
|
{/if}
|
|
|
|
|
<div class="flex flex-col gap-2 p-5 sm:p-7 md:p-9">
|
|
|
|
|
<div class="flex items-center gap-4 text-xl font-semibold text-immich-primary dark:text-immich-dark-primary">
|
2023-07-18 13:19:39 -05:00
|
|
|
<span class="flex items-center gap-2">
|
2023-10-25 09:48:25 -04:00
|
|
|
<Icon path={icon} size="1.25em" class="hidden shrink-0 sm:block" />
|
2023-07-01 00:50:47 -04:00
|
|
|
{title.toUpperCase()}
|
|
|
|
|
</span>
|
|
|
|
|
<div class="flex gap-2">
|
|
|
|
|
{#if jobCounts.failed > 0}
|
|
|
|
|
<Badge color="primary">
|
2024-05-04 18:29:50 +00:00
|
|
|
<div class="flex flex-row gap-1">
|
|
|
|
|
<span class="text-sm">
|
2024-06-12 12:54:40 +02:00
|
|
|
{$t('admin.jobs_failed', { values: { jobCount: jobCounts.failed.toLocaleString($locale) } })}
|
2024-05-04 18:29:50 +00:00
|
|
|
</span>
|
|
|
|
|
<CircleIconButton
|
|
|
|
|
color="primary"
|
|
|
|
|
icon={mdiClose}
|
2024-06-04 21:53:00 +02:00
|
|
|
title={$t('clear_message')}
|
2024-05-04 18:29:50 +00:00
|
|
|
size="12"
|
|
|
|
|
padding="1"
|
2024-09-19 18:20:09 -04:00
|
|
|
on:click={() => onCommand({ command: JobCommand.ClearFailed, force: false })}
|
2024-05-04 18:29:50 +00:00
|
|
|
/>
|
|
|
|
|
</div>
|
2023-07-01 00:50:47 -04:00
|
|
|
</Badge>
|
|
|
|
|
{/if}
|
2023-12-08 18:19:42 -06:00
|
|
|
{#if jobCounts.delayed > 0}
|
2023-07-01 00:50:47 -04:00
|
|
|
<Badge color="secondary">
|
2023-12-05 10:07:20 +08:00
|
|
|
<span class="text-sm">
|
2024-06-12 12:54:40 +02:00
|
|
|
{$t('admin.jobs_delayed', { values: { jobCount: jobCounts.delayed.toLocaleString($locale) } })}
|
2023-12-05 10:07:20 +08:00
|
|
|
</span>
|
2023-07-01 00:50:47 -04:00
|
|
|
</Badge>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-01-26 22:50:22 -06:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
{#if subtitle}
|
2023-07-18 13:19:39 -05:00
|
|
|
<div class="whitespace-pre-line text-sm dark:text-white">{subtitle}</div>
|
2023-07-01 00:50:47 -04:00
|
|
|
{/if}
|
2023-01-26 22:50:22 -06:00
|
|
|
|
2024-06-08 11:57:18 +02:00
|
|
|
{#if description}
|
2023-07-01 00:50:47 -04:00
|
|
|
<div class="text-sm dark:text-white">
|
2024-06-08 11:57:18 +02:00
|
|
|
<svelte:component this={description} />
|
2023-07-01 00:50:47 -04:00
|
|
|
</div>
|
|
|
|
|
{/if}
|
2023-06-07 12:10:31 -04:00
|
|
|
|
2023-07-18 13:19:39 -05:00
|
|
|
<div class="mt-2 flex w-full max-w-md flex-col sm:flex-row">
|
2023-07-01 00:50:47 -04:00
|
|
|
<div
|
2023-07-18 13:19:39 -05:00
|
|
|
class="{commonClasses} rounded-t-lg bg-immich-primary text-white dark:bg-immich-dark-primary dark:text-immich-dark-gray sm:rounded-l-lg sm:rounded-r-none"
|
2023-07-01 00:50:47 -04:00
|
|
|
>
|
2024-06-04 21:53:00 +02:00
|
|
|
<p>{$t('active')}</p>
|
2023-07-01 00:50:47 -04:00
|
|
|
<p class="text-2xl">
|
|
|
|
|
{jobCounts.active.toLocaleString($locale)}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2023-01-26 22:50:22 -06:00
|
|
|
|
2023-07-01 00:50:47 -04:00
|
|
|
<div
|
2023-07-18 13:19:39 -05:00
|
|
|
class="{commonClasses} flex-row-reverse rounded-b-lg bg-gray-200 text-immich-dark-bg dark:bg-gray-700 dark:text-immich-gray sm:rounded-l-none sm:rounded-r-lg"
|
2023-07-01 00:50:47 -04:00
|
|
|
>
|
|
|
|
|
<p class="text-2xl">
|
|
|
|
|
{waitingCount.toLocaleString($locale)}
|
|
|
|
|
</p>
|
2024-06-04 21:53:00 +02:00
|
|
|
<p>{$t('waiting')}</p>
|
2023-07-01 00:50:47 -04:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-07-18 13:19:39 -05:00
|
|
|
<div class="flex w-full flex-row overflow-hidden sm:w-32 sm:flex-col">
|
2023-08-18 00:55:26 -04:00
|
|
|
{#if disabled}
|
|
|
|
|
<JobTileButton
|
|
|
|
|
disabled={true}
|
|
|
|
|
color="light-gray"
|
2024-09-19 18:20:09 -04:00
|
|
|
on:click={() => onCommand({ command: JobCommand.Start, force: false })}
|
2023-08-18 00:55:26 -04:00
|
|
|
>
|
2024-06-12 12:54:40 +02:00
|
|
|
<Icon path={mdiAlertCircle} size="36" />
|
|
|
|
|
{$t('disabled').toUpperCase()}
|
2023-08-18 00:55:26 -04:00
|
|
|
</JobTileButton>
|
2024-10-03 21:58:28 -04:00
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if !disabled && !isIdle}
|
2023-07-01 00:50:47 -04:00
|
|
|
{#if waitingCount > 0}
|
2024-09-19 18:20:09 -04:00
|
|
|
<JobTileButton color="gray" on:click={() => onCommand({ command: JobCommand.Empty, force: false })}>
|
2024-06-12 12:54:40 +02:00
|
|
|
<Icon path={mdiClose} size="24" />
|
|
|
|
|
{$t('clear').toUpperCase()}
|
2023-07-01 00:50:47 -04:00
|
|
|
</JobTileButton>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if queueStatus.isPaused}
|
|
|
|
|
{@const size = waitingCount > 0 ? '24' : '48'}
|
2024-09-19 18:20:09 -04:00
|
|
|
<JobTileButton color="light-gray" on:click={() => onCommand({ command: JobCommand.Resume, force: false })}>
|
2023-07-01 00:50:47 -04:00
|
|
|
<!-- size property is not reactive, so have to use width and height -->
|
2024-06-12 12:54:40 +02:00
|
|
|
<Icon path={mdiFastForward} {size} />
|
|
|
|
|
{$t('resume').toUpperCase()}
|
2023-07-01 00:50:47 -04:00
|
|
|
</JobTileButton>
|
|
|
|
|
{:else}
|
2024-09-19 18:20:09 -04:00
|
|
|
<JobTileButton color="light-gray" on:click={() => onCommand({ command: JobCommand.Pause, force: false })}>
|
2024-06-12 12:54:40 +02:00
|
|
|
<Icon path={mdiPause} size="24" />
|
|
|
|
|
{$t('pause').toUpperCase()}
|
2023-07-01 00:50:47 -04:00
|
|
|
</JobTileButton>
|
|
|
|
|
{/if}
|
2024-10-03 21:58:28 -04:00
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if !disabled && multipleButtons && isIdle}
|
|
|
|
|
{#if allText}
|
|
|
|
|
<JobTileButton color="dark-gray" on:click={() => onCommand({ command: JobCommand.Start, force: true })}>
|
|
|
|
|
<Icon path={mdiAllInclusive} size="24" />
|
|
|
|
|
{allText}
|
|
|
|
|
</JobTileButton>
|
|
|
|
|
{/if}
|
|
|
|
|
{#if refreshText}
|
|
|
|
|
<JobTileButton color="gray" on:click={() => onCommand({ command: JobCommand.Start, force: undefined })}>
|
|
|
|
|
<Icon path={mdiImageRefreshOutline} size="24" />
|
|
|
|
|
{refreshText}
|
|
|
|
|
</JobTileButton>
|
|
|
|
|
{/if}
|
2024-09-19 18:20:09 -04:00
|
|
|
<JobTileButton color="light-gray" on:click={() => onCommand({ command: JobCommand.Start, force: false })}>
|
2023-10-25 09:48:25 -04:00
|
|
|
<Icon path={mdiSelectionSearch} size="24" />
|
2023-07-01 00:50:47 -04:00
|
|
|
{missingText}
|
|
|
|
|
</JobTileButton>
|
2024-10-03 21:58:28 -04:00
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if !disabled && !multipleButtons && isIdle}
|
2024-09-19 18:20:09 -04:00
|
|
|
<JobTileButton color="light-gray" on:click={() => onCommand({ command: JobCommand.Start, force: false })}>
|
2024-06-12 12:54:40 +02:00
|
|
|
<Icon path={mdiPlay} size="48" />
|
|
|
|
|
{$t('start').toUpperCase()}
|
2023-07-01 00:50:47 -04:00
|
|
|
</JobTileButton>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
2022-10-06 11:25:54 -05:00
|
|
|
</div>
|