@futo-org/backups-orchestrator-ui 1.8.1 → 1.9.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.
- package/dist/components/backups/BackupItem.svelte +11 -0
- package/dist/components/backups/BackupStatus.svelte +16 -6
- package/dist/components/backups/BackupStatus.svelte.d.ts +1 -2
- package/dist/components/backups/BackupTaskMonitor.svelte +2 -2
- package/dist/components/backups/dialogs/CancelJobModal.svelte +59 -0
- package/dist/components/backups/dialogs/CancelJobModal.svelte.d.ts +8 -0
- package/dist/components/backups/dialogs/RemoveDeletedRepositoryModal.svelte +39 -0
- package/dist/components/backups/dialogs/RemoveDeletedRepositoryModal.svelte.d.ts +6 -0
- package/dist/components/backups/dialogs/RestoreSnapshotModal.svelte +2 -2
- package/dist/components/backups/dialogs/SelectRepositoryModal.svelte +35 -17
- package/dist/components/backups/dialogs/ViewStatusModal.svelte +61 -62
- package/dist/components/backups/dialogs/ViewStatusModal.svelte.d.ts +1 -1
- package/dist/components/backups/metrics-history/MetricsHistoryModal.svelte +2 -7
- package/dist/components/backups/run-history/RepositoryRunHistory.svelte +10 -10
- package/dist/components/backups/run-history/RepositoryRunHistoryItem.svelte +43 -18
- package/dist/components/backups/run-history/RepositoryRunHistoryItem.svelte.d.ts +2 -2
- package/dist/components/backups/run-history/RepositoryRunHistoryPage.svelte +17 -16
- package/dist/components/backups/snapshots-list/RepositorySnapshotsList.svelte +2 -2
- package/dist/components/backups/snapshots-list/RepositorySnapshotsPage.svelte +2 -2
- package/dist/components/integrations/immich/ImmichBackupSettingsPage.svelte +2 -0
- package/dist/components/integrations/immich/ImmichManageBackupOverview.svelte +7 -3
- package/dist/components/integrations/immich/settings/ImmichSettingsBackupContents.svelte +0 -1
- package/dist/components/integrations/immich/settings/ImmichSettingsSchedule.svelte +0 -1
- package/dist/components/jobs/JobProgressLabel.svelte +30 -0
- package/dist/components/jobs/JobProgressLabel.svelte.d.ts +6 -0
- package/dist/components/onboarding/restore-point-flow/RestorePointFlow3ConfirmRestore.svelte +4 -4
- package/dist/components/onboarding/restore-point-flow/RestorePointFlow4Restore.svelte +32 -20
- package/dist/components/onboarding/restore-point-flow/RestorePointFlow4Restore.svelte.d.ts +1 -2
- package/dist/components/schedules/dialogs/ConfigureScheduleModal.svelte +6 -1
- package/dist/components/schedules/dialogs/CreateScheduleModal.svelte +7 -2
- package/dist/components/settings/GlobalSettings.svelte +2 -0
- package/dist/components/settings/SettingsSupportMode.svelte +154 -0
- package/dist/components/settings/SettingsSupportMode.svelte.d.ts +3 -0
- package/dist/components/test/dashboard/Dashboard.svelte +0 -3
- package/dist/components/util/RelativeTime.svelte +8 -1
- package/dist/components/util/RelativeTime.svelte.d.ts +1 -0
- package/dist/fetch-client.d.ts +110 -59
- package/dist/fetch-client.js +70 -49
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -3
- package/dist/locales/en-XA.js +1 -1
- package/dist/locales/en-XA.po +209 -30
- package/dist/locales/en.js +1 -1
- package/dist/locales/en.po +210 -31
- package/dist/services/immich.integration.service.d.ts +6 -3
- package/dist/services/immich.integration.service.js +5 -4
- package/dist/services/job.service.d.ts +42 -0
- package/dist/services/job.service.js +146 -0
- package/dist/services/repository.service.d.ts +2 -2
- package/dist/services/repository.service.js +37 -2
- package/dist/services/snapshot.service.d.ts +5 -9
- package/dist/services/snapshot.service.js +2 -3
- package/dist/services/supportMode.service.d.ts +8 -0
- package/dist/services/supportMode.service.js +19 -0
- package/dist/utils/cron.d.ts +1 -0
- package/dist/utils/cron.js +18 -0
- package/dist/utils/repository.d.ts +4 -0
- package/dist/utils/repository.js +15 -0
- package/dist/utils/supportMode.d.ts +2 -0
- package/dist/utils/supportMode.js +2 -0
- package/package.json +2 -2
- package/dist/components/test/dashboard/ActiveJobs.svelte +0 -393
- package/dist/components/test/dashboard/ActiveJobs.svelte.d.ts +0 -3
- package/dist/services/log.service.svelte.d.ts +0 -67
- package/dist/services/log.service.svelte.js +0 -123
- package/dist/services/runHistory.service.d.ts +0 -37
- package/dist/services/runHistory.service.js +0 -102
- package/dist/services/task.service.d.ts +0 -3
- package/dist/services/task.service.js +0 -21
|
@@ -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 {
|
|
5
|
-
import {
|
|
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
|
-
|
|
15
|
+
job: JobDto;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const {
|
|
19
|
-
const { ViewLog, DownloadLog } = $derived(
|
|
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 (
|
|
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 "
|
|
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
|
|
99
|
-
{$t`
|
|
100
|
-
{:else if
|
|
101
|
-
{$t`
|
|
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
|
|
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 {
|
|
1
|
+
import type { JobDto } from "../../../fetch-client";
|
|
2
2
|
type Props = {
|
|
3
|
-
|
|
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 {
|
|
8
|
+
import type { JobDto, LocalRepositoryDto } from "../../../fetch-client";
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 =
|
|
26
|
-
const {
|
|
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" | "
|
|
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: "
|
|
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 = (
|
|
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 `${
|
|
95
|
+
return `${job.name} ${job.status}`.toLowerCase().includes(term);
|
|
95
96
|
};
|
|
96
97
|
|
|
97
98
|
const filtered = $derived(
|
|
98
99
|
(query.data ?? [])
|
|
99
|
-
.filter((
|
|
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.
|
|
104
|
-
: +new Date(a.
|
|
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 {
|
|
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
|
|
131
|
-
<RepositoryRunHistoryItem {
|
|
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 {
|
|
29
|
+
const { onJobUpdate } = useSnapshotEventHandler();
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
|
-
<OnEvents {
|
|
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 {
|
|
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 {
|
|
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
|
-
?
|
|
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"}
|
|
@@ -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,30 @@
|
|
|
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 { t } from "svelte-i18n-lingui";
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
jobId: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const { jobId }: Props = $props();
|
|
15
|
+
|
|
16
|
+
// svelte-ignore state_referenced_locally
|
|
17
|
+
const query = useJob(jobId);
|
|
18
|
+
const progress = $derived(query.data?.progress);
|
|
19
|
+
const { onJobUpdate, onJobTick } = useJobEventHandler();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<OnEvents {onJobUpdate} {onJobTick} />
|
|
23
|
+
|
|
24
|
+
{#if progress}
|
|
25
|
+
· <span class="tabular-nums">{Math.round(progress.percentDone * 100)}%</span> · {getRemainingText(progress)}
|
|
26
|
+
{:else if query.data?.status === "queued"}
|
|
27
|
+
· {$t`Waiting to start`}
|
|
28
|
+
{:else}
|
|
29
|
+
· {$t`Preparing…`}
|
|
30
|
+
{/if}
|
package/dist/components/onboarding/restore-point-flow/RestorePointFlow3ConfirmRestore.svelte
CHANGED
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
snapshot.paths.filter((path) => !path.includes("yucca")),
|
|
59
59
|
);
|
|
60
60
|
|
|
61
|
-
let
|
|
61
|
+
let jobId: string | undefined = $state();
|
|
62
62
|
|
|
63
63
|
async function handleRestore() {
|
|
64
|
-
({
|
|
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
|
|
77
|
-
<RestorePointFlow4Restore {onFinish} {
|
|
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,73 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import OnEvents from "../../util/OnEvents.svelte";
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
getRemainingText,
|
|
5
|
+
isJobFinished,
|
|
6
|
+
useJob,
|
|
7
|
+
useJobEventHandler,
|
|
8
|
+
type JobUpdateEvent,
|
|
9
|
+
} from "../../../services/job.service";
|
|
5
10
|
import { Alert, Modal, ModalBody, ProgressBar, Stack, Text } from "@immich/ui";
|
|
6
|
-
import { onDestroy } from "svelte";
|
|
7
11
|
import { t } from "svelte-i18n-lingui";
|
|
8
12
|
|
|
9
13
|
type Props = {
|
|
10
14
|
onFinish: () => void;
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
logId: string;
|
|
16
|
+
jobId: string;
|
|
14
17
|
};
|
|
15
18
|
|
|
16
|
-
const { onFinish,
|
|
19
|
+
const { onFinish, jobId }: Props = $props();
|
|
17
20
|
|
|
18
21
|
// svelte-ignore state_referenced_locally
|
|
19
|
-
const
|
|
20
|
-
|
|
22
|
+
const jobQuery = useJob(jobId);
|
|
23
|
+
const job = $derived(jobQuery.data);
|
|
24
|
+
const progress = $derived(job?.progress?.percentDone ?? 0);
|
|
25
|
+
const errors = $derived(job?.outcome?.errors ?? []);
|
|
26
|
+
const currentFiles = $derived(jobQuery.data?.progress?.currentFiles ?? []);
|
|
27
|
+
const jobEventHandler = useJobEventHandler();
|
|
21
28
|
|
|
22
|
-
const
|
|
23
|
-
|
|
29
|
+
const onJobUpdate = (event: JobUpdateEvent) => {
|
|
30
|
+
jobEventHandler.onJobUpdate(event);
|
|
31
|
+
if (event.data.jobId === jobId && (event.data.job.status === "complete" || event.data.job.status === "warn")) {
|
|
24
32
|
onFinish();
|
|
25
33
|
}
|
|
26
34
|
};
|
|
27
35
|
</script>
|
|
28
36
|
|
|
29
|
-
<OnEvents {
|
|
37
|
+
<OnEvents {onJobUpdate} onJobTick={jobEventHandler.onJobTick} />
|
|
30
38
|
|
|
31
39
|
<Modal focusOnOpen
|
|
32
|
-
title={
|
|
40
|
+
title={job?.status === "cancelled"
|
|
41
|
+
? $t`Restore cancelled`
|
|
42
|
+
: errors.length > 0 || job?.status === "failed"
|
|
43
|
+
? $t`Restore failed`
|
|
44
|
+
: $t`Restoring`}
|
|
33
45
|
size="small"
|
|
34
|
-
onClose={
|
|
46
|
+
onClose={isJobFinished(job?.status) ? onFinish : undefined}
|
|
35
47
|
>
|
|
36
48
|
<ModalBody>
|
|
37
49
|
<Stack gap={2}>
|
|
38
|
-
{#each
|
|
50
|
+
{#each errors as error}
|
|
39
51
|
<Alert color="danger">{error}</Alert>
|
|
40
52
|
{/each}
|
|
41
53
|
|
|
42
54
|
<ProgressBar
|
|
43
|
-
|
|
55
|
+
{progress}
|
|
44
56
|
aria-label={$t`Restore progress`}
|
|
45
|
-
valueLabel={`${Math.round(
|
|
57
|
+
valueLabel={`${Math.round(progress * 100)}%`}
|
|
46
58
|
size="large"
|
|
47
59
|
>
|
|
48
60
|
<Text
|
|
49
61
|
size="small"
|
|
50
|
-
class={
|
|
62
|
+
class={progress > 0.5 ? "text-light" : "text-dark"}
|
|
51
63
|
>
|
|
52
|
-
{
|
|
64
|
+
{getRemainingText(jobQuery.data?.progress)}
|
|
53
65
|
</Text>
|
|
54
66
|
</ProgressBar>
|
|
55
67
|
|
|
56
|
-
{#if
|
|
68
|
+
{#if currentFiles.length > 0}
|
|
57
69
|
<Stack gap={1}>
|
|
58
|
-
{#each
|
|
70
|
+
{#each currentFiles as file}
|
|
59
71
|
<Text size="tiny" class="break-all">{file}</Text>
|
|
60
72
|
{/each}
|
|
61
73
|
</Stack>
|
|
@@ -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
|
|
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("
|
|
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
|
|
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>
|