@futo-org/backups-orchestrator-ui 1.8.1 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/components/backups/BackupItem.svelte +11 -0
  2. package/dist/components/backups/BackupStatus.svelte +23 -7
  3. package/dist/components/backups/BackupStatus.svelte.d.ts +2 -2
  4. package/dist/components/backups/BackupTaskMonitor.svelte +2 -2
  5. package/dist/components/backups/dialogs/CancelJobModal.svelte +59 -0
  6. package/dist/components/backups/dialogs/CancelJobModal.svelte.d.ts +8 -0
  7. package/dist/components/backups/dialogs/RemoveDeletedRepositoryModal.svelte +39 -0
  8. package/dist/components/backups/dialogs/RemoveDeletedRepositoryModal.svelte.d.ts +6 -0
  9. package/dist/components/backups/dialogs/RestoreSnapshotModal.svelte +2 -2
  10. package/dist/components/backups/dialogs/SelectRepositoryModal.svelte +35 -17
  11. package/dist/components/backups/dialogs/ViewStatusModal.svelte +63 -70
  12. package/dist/components/backups/dialogs/ViewStatusModal.svelte.d.ts +1 -1
  13. package/dist/components/backups/metrics-history/MetricsHistoryModal.svelte +2 -7
  14. package/dist/components/backups/run-history/RepositoryRunHistory.svelte +10 -10
  15. package/dist/components/backups/run-history/RepositoryRunHistoryItem.svelte +43 -18
  16. package/dist/components/backups/run-history/RepositoryRunHistoryItem.svelte.d.ts +2 -2
  17. package/dist/components/backups/run-history/RepositoryRunHistoryPage.svelte +17 -16
  18. package/dist/components/backups/snapshots-list/RepositorySnapshotsList.svelte +2 -2
  19. package/dist/components/backups/snapshots-list/RepositorySnapshotsPage.svelte +2 -2
  20. package/dist/components/integrations/immich/ImmichBackupSettingsPage.svelte +2 -0
  21. package/dist/components/integrations/immich/ImmichManageBackupOverview.svelte +7 -3
  22. package/dist/components/integrations/immich/settings/ImmichSettingsBackupContents.svelte +0 -1
  23. package/dist/components/integrations/immich/settings/ImmichSettingsSchedule.svelte +0 -1
  24. package/dist/components/jobs/JobProgressLabel.svelte +35 -0
  25. package/dist/components/jobs/JobProgressLabel.svelte.d.ts +6 -0
  26. package/dist/components/onboarding/restore-point-flow/RestorePointFlow3ConfirmRestore.svelte +4 -4
  27. package/dist/components/onboarding/restore-point-flow/RestorePointFlow4Restore.svelte +35 -20
  28. package/dist/components/onboarding/restore-point-flow/RestorePointFlow4Restore.svelte.d.ts +1 -2
  29. package/dist/components/schedules/dialogs/ConfigureScheduleModal.svelte +6 -1
  30. package/dist/components/schedules/dialogs/CreateScheduleModal.svelte +7 -2
  31. package/dist/components/settings/GlobalSettings.svelte +2 -0
  32. package/dist/components/settings/SettingsSupportMode.svelte +154 -0
  33. package/dist/components/settings/SettingsSupportMode.svelte.d.ts +3 -0
  34. package/dist/components/test/dashboard/Dashboard.svelte +0 -3
  35. package/dist/components/util/RelativeTime.svelte +12 -11
  36. package/dist/components/util/RelativeTime.svelte.d.ts +1 -0
  37. package/dist/fetch-client.d.ts +111 -59
  38. package/dist/fetch-client.js +70 -49
  39. package/dist/index.d.ts +1 -3
  40. package/dist/index.js +1 -3
  41. package/dist/locales/en-XA.js +1 -1
  42. package/dist/locales/en-XA.po +222 -30
  43. package/dist/locales/en.js +1 -1
  44. package/dist/locales/en.po +223 -31
  45. package/dist/services/immich.integration.service.d.ts +6 -3
  46. package/dist/services/immich.integration.service.js +5 -4
  47. package/dist/services/job.service.d.ts +42 -0
  48. package/dist/services/job.service.js +159 -0
  49. package/dist/services/repository.service.d.ts +2 -2
  50. package/dist/services/repository.service.js +37 -2
  51. package/dist/services/snapshot.service.d.ts +5 -9
  52. package/dist/services/snapshot.service.js +2 -3
  53. package/dist/services/supportMode.service.d.ts +8 -0
  54. package/dist/services/supportMode.service.js +19 -0
  55. package/dist/utils/cron.d.ts +1 -0
  56. package/dist/utils/cron.js +18 -0
  57. package/dist/utils/now.d.ts +1 -0
  58. package/dist/utils/now.js +6 -0
  59. package/dist/utils/repository.d.ts +4 -0
  60. package/dist/utils/repository.js +15 -0
  61. package/dist/utils/supportMode.d.ts +2 -0
  62. package/dist/utils/supportMode.js +2 -0
  63. package/package.json +2 -2
  64. package/dist/components/test/dashboard/ActiveJobs.svelte +0 -393
  65. package/dist/components/test/dashboard/ActiveJobs.svelte.d.ts +0 -3
  66. package/dist/services/log.service.svelte.d.ts +0 -67
  67. package/dist/services/log.service.svelte.js +0 -123
  68. package/dist/services/runHistory.service.d.ts +0 -37
  69. package/dist/services/runHistory.service.js +0 -102
  70. package/dist/services/task.service.d.ts +0 -3
  71. package/dist/services/task.service.js +0 -21
@@ -5,9 +5,9 @@
5
5
  import Suspense from "../../util/Suspense.svelte";
6
6
  import type { LocalRepositoryDto } from "../../../fetch-client";
7
7
  import {
8
- useRunEventHandler,
9
- useRunHistory,
10
- } from "../../../services/runHistory.service";
8
+ useJobEventHandler,
9
+ useJobs,
10
+ } from "../../../services/job.service";
11
11
  import { Button } from "@immich/ui";
12
12
  import RepositoryRunHistoryItem from "./RepositoryRunHistoryItem.svelte";
13
13
  import { t } from "svelte-i18n-lingui";
@@ -20,11 +20,11 @@
20
20
 
21
21
  let { repository, limit = 5, onViewAll }: Props = $props();
22
22
 
23
- const query = useRunHistory(() => repository.id);
24
- const { onRunCreate, onRunUpdate } = useRunEventHandler();
23
+ const query = useJobs(() => repository.id, "repository-backup");
24
+ const { onJobCreate, onJobUpdate } = useJobEventHandler();
25
25
  </script>
26
26
 
27
- <OnEvents {onRunCreate} {onRunUpdate} />
27
+ <OnEvents {onJobCreate} {onJobUpdate} />
28
28
 
29
29
  <StackList>
30
30
  {#snippet title()}
@@ -38,12 +38,12 @@
38
38
  {/snippet}
39
39
 
40
40
  <Suspense {query}>
41
- {#snippet children(runs)}
42
- {#each runs.slice(0, limit) as run (run.id)}
43
- <RepositoryRunHistoryItem {run} />
41
+ {#snippet children(jobs)}
42
+ {#each jobs.slice(0, limit) as job (job.id)}
43
+ <RepositoryRunHistoryItem {job} />
44
44
  {/each}
45
45
 
46
- {#if runs.length === 0}
46
+ {#if jobs.length === 0}
47
47
  <StackListPlaceholder>{$t`No recent backups`}</StackListPlaceholder>
48
48
  {/if}
49
49
  {/snippet}
@@ -1,8 +1,8 @@
1
1
  <script lang="ts">
2
2
  import StackListItem from "../../ui/StackListItem.svelte";
3
3
  import RelativeTime from "../../util/RelativeTime.svelte";
4
- import type { RunDto } from "../../../fetch-client";
5
- import { getRunActions } from "../../../services/runHistory.service";
4
+ import type { JobDto } from "../../../fetch-client";
5
+ import { getJobActions, jobKinds } from "../../../services/job.service";
6
6
  import { Icon } from "@immich/ui";
7
7
  import {
8
8
  mdiCloudCheckOutline,
@@ -12,11 +12,13 @@
12
12
  import { t, msg } from "svelte-i18n-lingui";
13
13
 
14
14
  type Props = {
15
- run: RunDto;
15
+ job: JobDto;
16
16
  };
17
17
 
18
- const { run }: Props = $props();
19
- const { ViewLog, DownloadLog } = $derived(getRunActions(run, $t));
18
+ const { job }: Props = $props();
19
+ const { ViewLog, DownloadLog, DownloadSupportLog } = $derived(
20
+ getJobActions(job, $t),
21
+ );
20
22
 
21
23
  const nouns = {
22
24
  restore: {
@@ -26,16 +28,17 @@
26
28
  },
27
29
  forget: { name: msg`prune`, running: msg`Prune`, done: msg`Pruned` },
28
30
  backup: { name: msg`backup`, running: msg`Backup`, done: msg`Backed up` },
31
+ syncMetrics: {
32
+ name: msg`metrics sync`,
33
+ running: msg`Metrics sync`,
34
+ done: msg`Metrics synced`,
35
+ },
29
36
  };
30
37
 
31
- const noun = $derived(
32
- run.type === "restore" || run.type === "forget"
33
- ? nouns[run.type]
34
- : nouns.backup,
35
- );
38
+ const noun = $derived(nouns[jobKinds[job.name]]);
36
39
 
37
40
  const status = $derived.by(() => {
38
- switch (run.status) {
41
+ switch (job.status) {
39
42
  case "failed": {
40
43
  return {
41
44
  title: $t({
@@ -56,6 +59,16 @@
56
59
  icon: mdiCloudOffOutline,
57
60
  } as const;
58
61
  }
62
+ case "incomplete": {
63
+ return {
64
+ title: $t({
65
+ message: "Interrupted {noun}",
66
+ values: { noun: $t(noun.name) },
67
+ }),
68
+ color: "warning",
69
+ icon: mdiCloudOffOutline,
70
+ } as const;
71
+ }
59
72
  case "warn": {
60
73
  return {
61
74
  title: $t({
@@ -66,7 +79,17 @@
66
79
  icon: mdiCloudCheckOutline,
67
80
  } as const;
68
81
  }
69
- case "incomplete": {
82
+ case "queued": {
83
+ return {
84
+ title: $t({
85
+ message: "{running} queued",
86
+ values: { running: $t(noun.running) },
87
+ }),
88
+ color: "primary",
89
+ icon: mdiCloudSyncOutline,
90
+ } as const;
91
+ }
92
+ case "running": {
70
93
  return {
71
94
  title: $t({
72
95
  message: "{running} in progress",
@@ -90,16 +113,18 @@
90
113
  });
91
114
  </script>
92
115
 
93
- <StackListItem title={status.title} color={status.color} actions={[ViewLog, DownloadLog]}>
116
+ <StackListItem title={status.title} color={status.color} actions={[ViewLog, DownloadLog, DownloadSupportLog]}>
94
117
  {#snippet icon()}
95
118
  <Icon icon={status.icon} />
96
119
  {/snippet}
97
120
 
98
- {#if run.status === "incomplete"}
99
- {$t`Started`} <RelativeTime time={run.start} />
100
- {:else if run.status === "failed" || run.status === "cancelled"}
101
- {$t`Attempted`} {#if run.end}<RelativeTime time={run.end} />{/if}
121
+ {#if job.status === "queued"}
122
+ {$t`Queued`} <RelativeTime time={job.queuedAt} absolute />
123
+ {:else if job.status === "running"}
124
+ {$t`Started`} <RelativeTime time={job.start ?? job.queuedAt} absolute />
125
+ {:else if job.status === "failed" || job.status === "cancelled" || job.status === "incomplete"}
126
+ {$t`Attempted`} <RelativeTime time={job.start ?? job.queuedAt} absolute />
102
127
  {:else}
103
- {$t(noun.done)} {#if run.end}<RelativeTime time={run.end} />{/if}
128
+ {$t(noun.done)} {#if job.end}<RelativeTime time={job.end} absolute />{/if}
104
129
  {/if}
105
130
  </StackListItem>
@@ -1,6 +1,6 @@
1
- import type { RunDto } from "../../../fetch-client";
1
+ import type { JobDto } from "../../../fetch-client";
2
2
  type Props = {
3
- run: RunDto;
3
+ job: JobDto;
4
4
  };
5
5
  declare const RepositoryRunHistoryItem: import("svelte").Component<Props, {}, "">;
6
6
  type RepositoryRunHistoryItem = ReturnType<typeof RepositoryRunHistoryItem>;
@@ -5,11 +5,12 @@
5
5
  import StackListPlaceholder from "../../ui/StackListPlaceholder.svelte";
6
6
  import OnEvents from "../../util/OnEvents.svelte";
7
7
  import Suspense from "../../util/Suspense.svelte";
8
- import type { LocalRepositoryDto, RunDto } from "../../../fetch-client";
8
+ import type { JobDto, LocalRepositoryDto } from "../../../fetch-client";
9
9
  import {
10
- useRunEventHandler,
11
- useRunHistory,
12
- } from "../../../services/runHistory.service";
10
+ isJobFinished,
11
+ useJobEventHandler,
12
+ useJobs,
13
+ } from "../../../services/job.service";
13
14
  import { Stack, type ActionItem } from "@immich/ui";
14
15
  import { mdiRadioboxBlank, mdiRadioboxMarked } from "@mdi/js";
15
16
  import RepositoryRunHistoryItem from "./RepositoryRunHistoryItem.svelte";
@@ -22,12 +23,12 @@
22
23
 
23
24
  let { repository, pageSize = 10 }: Props = $props();
24
25
 
25
- const query = useRunHistory(() => repository.id);
26
- const { onRunCreate, onRunUpdate } = useRunEventHandler();
26
+ const query = useJobs(() => repository.id, "repository-backup");
27
+ const { onJobCreate, onJobUpdate } = useJobEventHandler();
27
28
 
28
29
  let search = $state("");
29
30
  let newestFirst = $state(true);
30
- let status = $state<"all" | "complete" | "warn" | "failed" | "incomplete">(
31
+ let status = $state<"all" | "complete" | "warn" | "failed" | "in-progress">(
31
32
  "all",
32
33
  );
33
34
  let page = $state(1);
@@ -52,7 +53,7 @@
52
53
  { value: "complete", title: msg`Successful only` },
53
54
  { value: "warn", title: msg`With warnings only` },
54
55
  { value: "failed", title: msg`Failed only` },
55
- { value: "incomplete", title: msg`In progress only` },
56
+ { value: "in-progress", title: msg`In progress only` },
56
57
  ];
57
58
 
58
59
  const tick = (selected: boolean) =>
@@ -84,24 +85,24 @@
84
85
  ),
85
86
  });
86
87
 
87
- const matches = (run: RunDto) => {
88
+ const matches = (job: JobDto) => {
88
89
  const term = search.trim().toLowerCase();
89
90
 
90
91
  if (!term) {
91
92
  return true;
92
93
  }
93
94
 
94
- return `${run.type} ${run.status}`.toLowerCase().includes(term);
95
+ return `${job.name} ${job.status}`.toLowerCase().includes(term);
95
96
  };
96
97
 
97
98
  const filtered = $derived(
98
99
  (query.data ?? [])
99
- .filter((run) => status === "all" || run.status === status)
100
+ .filter((job) => status === "all" || (status === "in-progress" ? !isJobFinished(job.status) : job.status === status))
100
101
  .filter(matches)
101
102
  .toSorted((a, b) =>
102
103
  newestFirst
103
- ? +new Date(b.start) - +new Date(a.start)
104
- : +new Date(a.start) - +new Date(b.start),
104
+ ? +new Date(b.queuedAt) - +new Date(a.queuedAt)
105
+ : +new Date(a.queuedAt) - +new Date(b.queuedAt),
105
106
  ),
106
107
  );
107
108
 
@@ -114,7 +115,7 @@
114
115
  );
115
116
  </script>
116
117
 
117
- <OnEvents {onRunCreate} {onRunUpdate} />
118
+ <OnEvents {onJobCreate} {onJobUpdate} />
118
119
 
119
120
  <Stack gap={4}>
120
121
  <ListToolbar
@@ -127,8 +128,8 @@
127
128
 
128
129
  <StackList>
129
130
  <Suspense {query}>
130
- {#each visible as run (run.id)}
131
- <RepositoryRunHistoryItem {run} />
131
+ {#each visible as job (job.id)}
132
+ <RepositoryRunHistoryItem {job} />
132
133
  {/each}
133
134
 
134
135
  {#if filtered.length === 0}
@@ -26,10 +26,10 @@
26
26
  const { advanced } = options;
27
27
  // svelte-ignore state_referenced_locally
28
28
  const query = useSnapshots(repository.id);
29
- const { onRunUpdate } = useSnapshotEventHandler();
29
+ const { onJobUpdate } = useSnapshotEventHandler();
30
30
  </script>
31
31
 
32
- <OnEvents {onRunUpdate} />
32
+ <OnEvents {onJobUpdate} />
33
33
 
34
34
  <StackList>
35
35
  {#snippet title()}
@@ -26,7 +26,7 @@
26
26
 
27
27
  // svelte-ignore state_referenced_locally
28
28
  const query = useSnapshots(repository.id);
29
- const { onRunUpdate } = useSnapshotEventHandler();
29
+ const { onJobUpdate } = useSnapshotEventHandler();
30
30
 
31
31
  let search = $state("");
32
32
  let newestFirst = $state(true);
@@ -91,7 +91,7 @@
91
91
  );
92
92
  </script>
93
93
 
94
- <OnEvents {onRunUpdate} />
94
+ <OnEvents {onJobUpdate} />
95
95
 
96
96
  <Stack gap={4}>
97
97
  <ListToolbar placeholder={$t`Search snapshots`} {search} {onSearch} {sort} />
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import SettingsSupportMode from "../../settings/SettingsSupportMode.svelte";
2
3
  import { Container } from "@immich/ui";
3
4
  import ImmichConfiguredGate from "./ImmichConfiguredGate.svelte";
4
5
  import ImmichSettingsBackupContents from "./settings/ImmichSettingsBackupContents.svelte";
@@ -20,6 +21,7 @@
20
21
  <ImmichSettingsSchedule />
21
22
  <ImmichSettingsBandwidth />
22
23
  <ImmichSettingsStorage />
24
+ <SettingsSupportMode />
23
25
  </Container>
24
26
  {/snippet}
25
27
  </ImmichConfiguredGate>
@@ -1,12 +1,13 @@
1
1
  <script lang="ts">
2
+ import JobProgressLabel from "../../jobs/JobProgressLabel.svelte";
2
3
  import StackList from "../../ui/StackList.svelte";
3
4
  import StackListItem from "../../ui/StackListItem.svelte";
4
5
  import RelativeTime from "../../util/RelativeTime.svelte";
5
6
  import type { LocalRepositoryDto, ScheduleDto } from "../../../fetch-client";
6
7
  import type { ImmichBackupStatus } from "../../../services/immich.integration.service";
8
+ import { handleCancelJob } from "../../../services/job.service";
7
9
  import { handleCreateBackup } from "../../../services/repository.service";
8
10
  import { handleResumeSchedule } from "../../../services/schedule.service";
9
- import { handleCancelTask } from "../../../services/task.service";
10
11
  import { Button, FormatBytes, Icon } from "@immich/ui";
11
12
  import {
12
13
  mdiAlert,
@@ -84,8 +85,8 @@
84
85
  class="whitespace-nowrap"
85
86
  leadingIcon={running ? mdiStopCircleOutline : mdiCloudUploadOutline}
86
87
  onclick={() =>
87
- void (running
88
- ? handleCancelTask(repository.id)
88
+ void (status.kind === "running"
89
+ ? handleCancelJob(status.jobId, "backup")
89
90
  : handleCreateBackup(repository.id))}
90
91
  >
91
92
  {running ? $t`Cancel backup` : $t`Back up now`}
@@ -101,6 +102,9 @@
101
102
  {$t`Backup is missing on the service.`}
102
103
  {:else if status.kind === "running"}
103
104
  {$t`Backup in progress`}
105
+ {#key status.jobId}
106
+ <JobProgressLabel jobId={status.jobId} />
107
+ {/key}
104
108
  {:else if status.kind === "failed"}
105
109
  {$t`Last backup failed`} <RelativeTime time={status.lastBackup} />
106
110
  {:else if status.kind === "warn"}
@@ -190,7 +190,6 @@
190
190
  name: repository.name,
191
191
  worm: repository.worm,
192
192
  cron: schedule.cron,
193
- retentionPolicy: repository.configuration?.retentionPolicy ?? null,
194
193
  dataFolders: [...folders],
195
194
  backupConfiguration,
196
195
  libraries:
@@ -141,7 +141,6 @@
141
141
  dataFolders: integration.configuration.dataFolders,
142
142
  backupConfiguration: integration.configuration.backupConfiguration,
143
143
  libraries: integration.configuration.libraries,
144
- retentionPolicy: repository.configuration?.retentionPolicy ?? null,
145
144
  cron,
146
145
  paused: !enabled,
147
146
  });
@@ -0,0 +1,35 @@
1
+ <script lang="ts">
2
+ import OnEvents from "../util/OnEvents.svelte";
3
+ import {
4
+ getRemainingText,
5
+ useJob,
6
+ useJobEventHandler,
7
+ } from "../../services/job.service";
8
+ import { now } from "../../utils/now";
9
+ import { t } from "svelte-i18n-lingui";
10
+
11
+ type Props = {
12
+ jobId: string;
13
+ };
14
+
15
+ const { jobId }: Props = $props();
16
+
17
+ // svelte-ignore state_referenced_locally
18
+ const query = useJob(jobId);
19
+ const progress = $derived(query.data?.progress);
20
+ const { onJobUpdate, onJobTick } = useJobEventHandler();
21
+ </script>
22
+
23
+ <OnEvents {onJobUpdate} {onJobTick} />
24
+
25
+ {#if progress}
26
+ {#if !progress.scanning}
27
+ &middot;
28
+ <span class="tabular-nums">{Math.round(progress.percentDone * 100)}%</span>
29
+ {/if}
30
+ &middot; {getRemainingText(progress, $now)}
31
+ {:else if query.data?.status === "queued"}
32
+ &middot; {$t`Waiting to start`}
33
+ {:else}
34
+ &middot; {$t`Preparing…`}
35
+ {/if}
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ jobId: string;
3
+ };
4
+ declare const JobProgressLabel: import("svelte").Component<Props, {}, "">;
5
+ type JobProgressLabel = ReturnType<typeof JobProgressLabel>;
6
+ export default JobProgressLabel;
@@ -58,10 +58,10 @@
58
58
  snapshot.paths.filter((path) => !path.includes("yucca")),
59
59
  );
60
60
 
61
- let logId: string | undefined = $state();
61
+ let jobId: string | undefined = $state();
62
62
 
63
63
  async function handleRestore() {
64
- ({ logId } = await handleRestoreFromPoint(
64
+ ({ jobId } = await handleRestoreFromPoint(
65
65
  repository.id,
66
66
  snapshot.id,
67
67
  repository.backends!.primary.id,
@@ -73,8 +73,8 @@
73
73
  }
74
74
  </script>
75
75
 
76
- {#if logId}
77
- <RestorePointFlow4Restore {onFinish} {logId} taskId={repository.id} />
76
+ {#if jobId}
77
+ <RestorePointFlow4Restore {onFinish} {jobId} />
78
78
  {:else}
79
79
  <Modal focusOnOpen title={$t`Confirm restore from snapshot`} size="small" onClose={onBack}>
80
80
  <ModalBody>
@@ -1,61 +1,76 @@
1
1
  <script lang="ts">
2
2
  import OnEvents from "../../util/OnEvents.svelte";
3
- import type { SocketEvent } from "../../../events";
4
- import { createLogObserver } from "../../../services/log.service.svelte";
3
+ import {
4
+ getRemainingText,
5
+ isJobFinished,
6
+ useJob,
7
+ useJobEventHandler,
8
+ type JobUpdateEvent,
9
+ } from "../../../services/job.service";
10
+ import { now } from "../../../utils/now";
5
11
  import { Alert, Modal, ModalBody, ProgressBar, Stack, Text } from "@immich/ui";
6
- import { onDestroy } from "svelte";
7
12
  import { t } from "svelte-i18n-lingui";
8
13
 
9
14
  type Props = {
10
15
  onFinish: () => void;
11
16
 
12
- taskId: string;
13
- logId: string;
17
+ jobId: string;
14
18
  };
15
19
 
16
- const { onFinish, taskId, logId }: Props = $props();
20
+ const { onFinish, jobId }: Props = $props();
17
21
 
18
22
  // svelte-ignore state_referenced_locally
19
- const log = createLogObserver(logId);
20
- onDestroy(() => log.destroy());
23
+ const jobQuery = useJob(jobId);
24
+ const job = $derived(jobQuery.data);
25
+ const progress = $derived(job?.progress?.percentDone ?? 0);
26
+ const errors = $derived(job?.outcome?.errors ?? []);
27
+ const currentFiles = $derived(jobQuery.data?.progress?.currentFiles ?? []);
28
+ const jobEventHandler = useJobEventHandler();
21
29
 
22
- const onTaskEnd = (event: SocketEvent<{ parentId: string }>) => {
23
- if (event.data.parentId === taskId && log.errors.length === 0) {
30
+ const onJobUpdate = (event: JobUpdateEvent) => {
31
+ jobEventHandler.onJobUpdate(event);
32
+ if (event.data.jobId === jobId && (event.data.job.status === "complete" || event.data.job.status === "warn")) {
24
33
  onFinish();
25
34
  }
26
35
  };
27
36
  </script>
28
37
 
29
- <OnEvents {onTaskEnd} />
38
+ <OnEvents {onJobUpdate} onJobTick={jobEventHandler.onJobTick} />
30
39
 
31
40
  <Modal focusOnOpen
32
- title={log.errors.length > 0 ? $t`Restore failed` : $t`Restoring`}
41
+ title={job?.status === "cancelled"
42
+ ? $t`Restore cancelled`
43
+ : errors.length > 0 || job?.status === "failed"
44
+ ? $t`Restore failed`
45
+ : $t`Restoring`}
33
46
  size="small"
34
- onClose={log.errors.length > 0 ? onFinish : undefined}
47
+ onClose={isJobFinished(job?.status) ? onFinish : undefined}
35
48
  >
36
49
  <ModalBody>
37
50
  <Stack gap={2}>
38
- {#each log.errors as error}
51
+ {#each errors as error}
39
52
  <Alert color="danger">{error}</Alert>
40
53
  {/each}
41
54
 
42
55
  <ProgressBar
43
- progress={log.status.progress}
56
+ {progress}
44
57
  aria-label={$t`Restore progress`}
45
- valueLabel={`${Math.round(log.status.progress * 100)}%`}
58
+ valueLabel={jobQuery.data?.progress?.scanning
59
+ ? $t`Preparing restore`
60
+ : `${Math.round(progress * 100)}%`}
46
61
  size="large"
47
62
  >
48
63
  <Text
49
64
  size="small"
50
- class={log.status.progress > 0.5 ? "text-light" : "text-dark"}
65
+ class={progress > 0.5 ? "text-light" : "text-dark"}
51
66
  >
52
- {log.status.text}
67
+ {getRemainingText(jobQuery.data?.progress, $now)}
53
68
  </Text>
54
69
  </ProgressBar>
55
70
 
56
- {#if log.status.currentFiles.length > 0}
71
+ {#if currentFiles.length > 0}
57
72
  <Stack gap={1}>
58
- {#each log.status.currentFiles as file}
73
+ {#each currentFiles as file}
59
74
  <Text size="tiny" class="break-all">{file}</Text>
60
75
  {/each}
61
76
  </Stack>
@@ -1,7 +1,6 @@
1
1
  type Props = {
2
2
  onFinish: () => void;
3
- taskId: string;
4
- logId: string;
3
+ jobId: string;
5
4
  };
6
5
  declare const RestorePointFlow4Restore: import("svelte").Component<Props, {}, "">;
7
6
  type RestorePointFlow4Restore = ReturnType<typeof RestorePointFlow4Restore>;
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { ScheduleDto } from "../../../fetch-client";
3
3
  import { useUpdateSchedule } from "../../../services/schedule.service";
4
+ import { runsMoreThanHourly } from "../../../utils/cron";
4
5
  import { Field, FormModal, HelperText, Input, Stack } from "@immich/ui";
5
6
  import validate from "cron-validate";
6
7
  import RepositoryPicker from "../RepositoryPicker.svelte";
@@ -53,7 +54,11 @@
53
54
  <Input bind:value={cron} />
54
55
  {#if cronInvalid}
55
56
  <HelperText color="danger"
56
- >{$t`Enter a valid cron expression, for example */15 * * * *`}</HelperText
57
+ >{$t`Enter a valid cron expression, for example 0 3 * * *`}</HelperText
58
+ >
59
+ {:else if runsMoreThanHourly(cron)}
60
+ <HelperText color="warning"
61
+ >{$t`This schedule runs more than once an hour. A * in the minute field runs a backup every minute.`}</HelperText
57
62
  >
58
63
  {/if}
59
64
  </Field>
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { useCreateSchedule } from "../../../services/schedule.service";
3
+ import { runsMoreThanHourly } from "../../../utils/cron";
3
4
  import { Field, FormModal, HelperText, Input, Stack } from "@immich/ui";
4
5
  import validate from "cron-validate";
5
6
  import RepositoryPicker from "../RepositoryPicker.svelte";
@@ -12,7 +13,7 @@
12
13
  const { onClose }: Props = $props();
13
14
 
14
15
  let name = $state("");
15
- let cron = $state("*/15 * * * *");
16
+ let cron = $state("0 3 * * *");
16
17
  let repositories = $state<string[]>([]);
17
18
 
18
19
  const cronInvalid = $derived(validate(cron).isError());
@@ -51,7 +52,11 @@
51
52
  <Input bind:value={cron} />
52
53
  {#if cronInvalid}
53
54
  <HelperText color="danger"
54
- >{$t`Enter a valid cron expression, for example */15 * * * *`}</HelperText
55
+ >{$t`Enter a valid cron expression, for example 0 3 * * *`}</HelperText
56
+ >
57
+ {:else if runsMoreThanHourly(cron)}
58
+ <HelperText color="warning"
59
+ >{$t`This schedule runs more than once an hour. A * in the minute field runs a backup every minute.`}</HelperText
55
60
  >
56
61
  {/if}
57
62
  </Field>
@@ -1,8 +1,10 @@
1
1
  <script lang="ts">
2
2
  import { Container } from "@immich/ui";
3
3
  import SettingsBackends from "./SettingsBackends.svelte";
4
+ import SettingsSupportMode from "./SettingsSupportMode.svelte";
4
5
  </script>
5
6
 
6
7
  <Container size="large" center>
7
8
  <SettingsBackends />
9
+ <SettingsSupportMode />
8
10
  </Container>