mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor(server): job repository (#1382)
* refactor(server): job repository * refactor: job repository * chore: generate open-api * fix: job panel * Remove incorrect subtitle Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
f4c90426a5
commit
4cfac47674
34 changed files with 418 additions and 1124 deletions
|
|
@ -1,13 +1,12 @@
|
|||
<script lang="ts">
|
||||
import LoadingSpinner from '$lib/components/shared-components/loading-spinner.svelte';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { JobCounts } from '@api';
|
||||
|
||||
export let title: string;
|
||||
export let subtitle: string;
|
||||
export let buttonTitle = 'Run';
|
||||
export let jobStatus: boolean;
|
||||
export let waitingJobCount: number;
|
||||
export let activeJobCount: number;
|
||||
export let jobCounts: JobCounts;
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
</script>
|
||||
|
|
@ -36,17 +35,23 @@
|
|||
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"
|
||||
>
|
||||
<tr class="text-center flex place-items-center w-full h-[60px]">
|
||||
<td class="text-sm px-2 w-1/3 text-ellipsis">{jobStatus ? 'Active' : 'Idle'}</td>
|
||||
<td class="flex justify-center text-sm px-2 w-1/3 text-ellipsis">
|
||||
{#if activeJobCount !== undefined}
|
||||
{activeJobCount}
|
||||
<td class="text-sm px-2 w-1/3 text-ellipsis">
|
||||
{#if jobCounts}
|
||||
<span>{jobCounts.active > 0 || jobCounts.waiting > 0 ? 'Active' : 'Idle'}</span>
|
||||
{:else}
|
||||
<LoadingSpinner />
|
||||
{/if}
|
||||
</td>
|
||||
<td class="flex justify-center text-sm px-2 w-1/3 text-ellipsis">
|
||||
{#if waitingJobCount !== undefined}
|
||||
{waitingJobCount}
|
||||
{#if jobCounts.active !== undefined}
|
||||
{jobCounts.active}
|
||||
{:else}
|
||||
<LoadingSpinner />
|
||||
{/if}
|
||||
</td>
|
||||
<td class="flex justify-center text-sm px-2 w-1/3 text-ellipsis">
|
||||
{#if jobCounts.waiting !== undefined}
|
||||
{jobCounts.waiting}
|
||||
{:else}
|
||||
<LoadingSpinner />
|
||||
{/if}
|
||||
|
|
@ -59,9 +64,9 @@
|
|||
<button
|
||||
on:click={() => dispatch('click')}
|
||||
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"
|
||||
disabled={jobStatus}
|
||||
disabled={jobCounts.active > 0 && jobCounts.waiting > 0}
|
||||
>
|
||||
{#if jobStatus}
|
||||
{#if jobCounts.active > 0 || jobCounts.waiting > 0}
|
||||
<LoadingSpinner />
|
||||
{:else}
|
||||
{buttonTitle}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue