@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.
- package/dist/components/backups/BackupItem.svelte +11 -0
- package/dist/components/backups/BackupStatus.svelte +23 -7
- package/dist/components/backups/BackupStatus.svelte.d.ts +2 -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 +63 -70
- 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 +35 -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 +35 -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 +12 -11
- package/dist/components/util/RelativeTime.svelte.d.ts +1 -0
- package/dist/fetch-client.d.ts +111 -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 +222 -30
- package/dist/locales/en.js +1 -1
- package/dist/locales/en.po +223 -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 +159 -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/now.d.ts +1 -0
- package/dist/utils/now.js +6 -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
|
@@ -80,6 +80,17 @@
|
|
|
80
80
|
<Badge size="tiny" color="warning">
|
|
81
81
|
{$t`Warnings`} <RelativeTime time={repository.metrics.lastBackup!} />
|
|
82
82
|
</Badge>
|
|
83
|
+
{:else if outcome === "cancelled"}
|
|
84
|
+
<Badge size="tiny" color="warning">
|
|
85
|
+
{$t`Cancelled`} <RelativeTime time={repository.metrics.lastBackup!} />
|
|
86
|
+
</Badge>
|
|
87
|
+
{:else if outcome === "incomplete"}
|
|
88
|
+
<Badge size="tiny" color="warning">
|
|
89
|
+
{$t`Interrupted`}
|
|
90
|
+
{#if repository.metrics.lastBackup}
|
|
91
|
+
<RelativeTime time={repository.metrics.lastBackup} />
|
|
92
|
+
{/if}
|
|
93
|
+
</Badge>
|
|
83
94
|
{:else if outcome === "complete"}
|
|
84
95
|
<Badge size="tiny" color="success">
|
|
85
96
|
{$t`Successful`} <RelativeTime time={repository.metrics.lastBackup!} />
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
| "complete"
|
|
8
8
|
| "warned"
|
|
9
9
|
| "failed"
|
|
10
|
-
| "cancelled"
|
|
10
|
+
| "cancelled"
|
|
11
|
+
| "interrupted";
|
|
11
12
|
</script>
|
|
12
13
|
|
|
13
14
|
<script lang="ts">
|
|
@@ -30,13 +31,13 @@
|
|
|
30
31
|
type: BackupStatusType;
|
|
31
32
|
state: BackupStatusState;
|
|
32
33
|
progress?: number;
|
|
34
|
+
scanning?: boolean;
|
|
33
35
|
start?: string;
|
|
34
36
|
duration?: string;
|
|
35
37
|
remaining?: string;
|
|
36
38
|
errors?: string[];
|
|
37
39
|
details?: Snippet;
|
|
38
40
|
currentFiles?: string[];
|
|
39
|
-
advanced?: Snippet;
|
|
40
41
|
onRetry?: () => void;
|
|
41
42
|
onCancel?: () => void;
|
|
42
43
|
};
|
|
@@ -46,13 +47,13 @@
|
|
|
46
47
|
type,
|
|
47
48
|
state: backupState,
|
|
48
49
|
progress = 0,
|
|
50
|
+
scanning = false,
|
|
49
51
|
start,
|
|
50
52
|
duration,
|
|
51
53
|
remaining,
|
|
52
54
|
errors = [],
|
|
53
55
|
details,
|
|
54
56
|
currentFiles = [],
|
|
55
|
-
advanced,
|
|
56
57
|
onRetry,
|
|
57
58
|
onCancel,
|
|
58
59
|
}: Props = $props();
|
|
@@ -87,6 +88,12 @@
|
|
|
87
88
|
forget: msg`Pruning old backups was cancelled`,
|
|
88
89
|
};
|
|
89
90
|
|
|
91
|
+
const interrupted: Record<BackupStatusType, string> = {
|
|
92
|
+
backup: msg`Your backup was interrupted`,
|
|
93
|
+
restore: msg`Your restore was interrupted`,
|
|
94
|
+
forget: msg`Pruning old backups was interrupted`,
|
|
95
|
+
};
|
|
96
|
+
|
|
90
97
|
const cancelLabels: Record<BackupStatusType, string> = {
|
|
91
98
|
backup: msg`Cancel backup`,
|
|
92
99
|
restore: msg`Cancel restore`,
|
|
@@ -124,6 +131,9 @@
|
|
|
124
131
|
case "cancelled": {
|
|
125
132
|
return $t(cancelled[type]);
|
|
126
133
|
}
|
|
134
|
+
case "interrupted": {
|
|
135
|
+
return $t(interrupted[type]);
|
|
136
|
+
}
|
|
127
137
|
case "complete": {
|
|
128
138
|
return $t(succeeded[type]);
|
|
129
139
|
}
|
|
@@ -131,6 +141,10 @@
|
|
|
131
141
|
return $t(warned[type]);
|
|
132
142
|
}
|
|
133
143
|
default: {
|
|
144
|
+
if (scanning) {
|
|
145
|
+
return phase;
|
|
146
|
+
}
|
|
147
|
+
|
|
134
148
|
return $t({
|
|
135
149
|
message: "{phase} · {percent}%",
|
|
136
150
|
values: { phase, percent: Math.round(progress * 100) },
|
|
@@ -144,7 +158,9 @@
|
|
|
144
158
|
const titleColor = $derived(
|
|
145
159
|
backupState === "complete"
|
|
146
160
|
? "success"
|
|
147
|
-
: backupState === "warned" ||
|
|
161
|
+
: backupState === "warned" ||
|
|
162
|
+
backupState === "cancelled" ||
|
|
163
|
+
backupState === "interrupted"
|
|
148
164
|
? "warning"
|
|
149
165
|
: backupState === "failed"
|
|
150
166
|
? "danger"
|
|
@@ -155,7 +171,8 @@
|
|
|
155
171
|
backupState === "complete" ||
|
|
156
172
|
backupState === "warned" ||
|
|
157
173
|
backupState === "failed" ||
|
|
158
|
-
backupState === "cancelled"
|
|
174
|
+
backupState === "cancelled" ||
|
|
175
|
+
backupState === "interrupted",
|
|
159
176
|
);
|
|
160
177
|
</script>
|
|
161
178
|
|
|
@@ -194,7 +211,7 @@
|
|
|
194
211
|
<ProgressBar
|
|
195
212
|
{progress}
|
|
196
213
|
aria-label={phase}
|
|
197
|
-
valueLabel={`${Math.round(progress * 100)}%`}
|
|
214
|
+
valueLabel={scanning ? phase : `${Math.round(progress * 100)}%`}
|
|
198
215
|
shape="round"
|
|
199
216
|
size="small"
|
|
200
217
|
class="bg-primary-100 border-none"
|
|
@@ -247,5 +264,4 @@
|
|
|
247
264
|
</Stack>
|
|
248
265
|
{/if}
|
|
249
266
|
|
|
250
|
-
{@render advanced?.()}
|
|
251
267
|
</Stack>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export type BackupStatusType = "backup" | "restore" | "forget";
|
|
2
|
-
export type BackupStatusState = "connecting" | "running" | "complete" | "warned" | "failed" | "cancelled";
|
|
2
|
+
export type BackupStatusState = "connecting" | "running" | "complete" | "warned" | "failed" | "cancelled" | "interrupted";
|
|
3
3
|
import type { Snippet } from "svelte";
|
|
4
4
|
type Props = {
|
|
5
5
|
title: string;
|
|
6
6
|
type: BackupStatusType;
|
|
7
7
|
state: BackupStatusState;
|
|
8
8
|
progress?: number;
|
|
9
|
+
scanning?: boolean;
|
|
9
10
|
start?: string;
|
|
10
11
|
duration?: string;
|
|
11
12
|
remaining?: string;
|
|
12
13
|
errors?: string[];
|
|
13
14
|
details?: Snippet;
|
|
14
15
|
currentFiles?: string[];
|
|
15
|
-
advanced?: Snippet;
|
|
16
16
|
onRetry?: () => void;
|
|
17
17
|
onCancel?: () => void;
|
|
18
18
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import OnEvents from "../util/OnEvents.svelte";
|
|
3
|
-
import {
|
|
3
|
+
import { useBackupJobMonitor } from "../../services/job.service";
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
|
-
<OnEvents {...
|
|
6
|
+
<OnEvents {...useBackupJobMonitor()} />
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BackupStatusType } from "../BackupStatus.svelte";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
HStack,
|
|
6
|
+
Modal,
|
|
7
|
+
ModalBody,
|
|
8
|
+
ModalFooter,
|
|
9
|
+
Text,
|
|
10
|
+
} from "@immich/ui";
|
|
11
|
+
import { msg, t } from "svelte-i18n-lingui";
|
|
12
|
+
|
|
13
|
+
type Props = {
|
|
14
|
+
type: BackupStatusType;
|
|
15
|
+
onClose: (confirmed: boolean) => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const { type, onClose }: Props = $props();
|
|
19
|
+
|
|
20
|
+
const titles: Record<BackupStatusType, string> = {
|
|
21
|
+
backup: msg`Cancel this backup?`,
|
|
22
|
+
restore: msg`Cancel this restore?`,
|
|
23
|
+
forget: msg`Cancel this prune?`,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const prompts: Record<BackupStatusType, string> = {
|
|
27
|
+
backup: msg`Progress since the last snapshot will be lost.`,
|
|
28
|
+
restore: msg`The restore will stop and will need to be started again.`,
|
|
29
|
+
forget: msg`Pruning will stop and will need to be started again.`,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const confirmLabels: Record<BackupStatusType, string> = {
|
|
33
|
+
backup: msg`Cancel backup`,
|
|
34
|
+
restore: msg`Cancel restore`,
|
|
35
|
+
forget: msg`Cancel prune`,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const dismissLabels: Record<BackupStatusType, string> = {
|
|
39
|
+
backup: msg`Keep backing up`,
|
|
40
|
+
restore: msg`Keep restoring`,
|
|
41
|
+
forget: msg`Keep pruning`,
|
|
42
|
+
};
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<Modal title={$t(titles[type])} size="small" onClose={() => onClose(false)}>
|
|
46
|
+
<ModalBody>
|
|
47
|
+
<Text>{$t(prompts[type])}</Text>
|
|
48
|
+
</ModalBody>
|
|
49
|
+
<ModalFooter>
|
|
50
|
+
<HStack>
|
|
51
|
+
<Button color="danger" onclick={() => onClose(true)}>
|
|
52
|
+
{$t(confirmLabels[type])}
|
|
53
|
+
</Button>
|
|
54
|
+
<Button variant="ghost" onclick={() => onClose(false)}>
|
|
55
|
+
{$t(dismissLabels[type])}
|
|
56
|
+
</Button>
|
|
57
|
+
</HStack>
|
|
58
|
+
</ModalFooter>
|
|
59
|
+
</Modal>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BackupStatusType } from "../BackupStatus.svelte";
|
|
2
|
+
type Props = {
|
|
3
|
+
type: BackupStatusType;
|
|
4
|
+
onClose: (confirmed: boolean) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const CancelJobModal: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type CancelJobModal = ReturnType<typeof CancelJobModal>;
|
|
8
|
+
export default CancelJobModal;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
HStack,
|
|
5
|
+
Modal,
|
|
6
|
+
ModalBody,
|
|
7
|
+
ModalFooter,
|
|
8
|
+
Text,
|
|
9
|
+
} from "@immich/ui";
|
|
10
|
+
import { t } from "svelte-i18n-lingui";
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
onClose: (confirmed: boolean) => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const { onClose }: Props = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<Modal
|
|
20
|
+
title={$t`Repository no longer on FUTO Backups`}
|
|
21
|
+
size="small"
|
|
22
|
+
onClose={() => onClose(false)}
|
|
23
|
+
>
|
|
24
|
+
<ModalBody>
|
|
25
|
+
<Text>
|
|
26
|
+
{$t`This repository no longer exists on FUTO Backups. Remove it from this machine? Local settings (paths, schedules) will be removed; no backup data is affected.`}
|
|
27
|
+
</Text>
|
|
28
|
+
</ModalBody>
|
|
29
|
+
<ModalFooter>
|
|
30
|
+
<HStack>
|
|
31
|
+
<Button color="danger" onclick={() => onClose(true)}>
|
|
32
|
+
{$t`Remove from this machine`}
|
|
33
|
+
</Button>
|
|
34
|
+
<Button variant="ghost" onclick={() => onClose(false)}>
|
|
35
|
+
{$t`Cancel`}
|
|
36
|
+
</Button>
|
|
37
|
+
</HStack>
|
|
38
|
+
</ModalFooter>
|
|
39
|
+
</Modal>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
onClose: (confirmed: boolean) => void;
|
|
3
|
+
};
|
|
4
|
+
declare const RemoveDeletedRepositoryModal: import("svelte").Component<Props, {}, "">;
|
|
5
|
+
type RemoveDeletedRepositoryModal = ReturnType<typeof RemoveDeletedRepositoryModal>;
|
|
6
|
+
export default RemoveDeletedRepositoryModal;
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
mutation.mutate(
|
|
45
45
|
{ repositoryId: repository, snapshotId: snapshot, options: dto },
|
|
46
46
|
{
|
|
47
|
-
onSuccess: ({
|
|
47
|
+
onSuccess: ({ jobId }) => {
|
|
48
48
|
onClose();
|
|
49
49
|
|
|
50
50
|
modalManager.open(ViewStatusModal, {
|
|
51
|
-
|
|
51
|
+
jobId,
|
|
52
52
|
});
|
|
53
53
|
},
|
|
54
54
|
},
|
|
@@ -4,16 +4,23 @@
|
|
|
4
4
|
import StackListPlaceholder from "../../ui/StackListPlaceholder.svelte";
|
|
5
5
|
import Suspense from "../../util/Suspense.svelte";
|
|
6
6
|
import { useInspectRepositories } from "../../../services/repository.service";
|
|
7
|
+
import {
|
|
8
|
+
isRestorable,
|
|
9
|
+
latestSnapshot,
|
|
10
|
+
sortRestoreCandidates,
|
|
11
|
+
} from "../../../utils/repository";
|
|
7
12
|
import {
|
|
8
13
|
Button,
|
|
14
|
+
FormatBytes,
|
|
9
15
|
HStack,
|
|
10
16
|
Modal,
|
|
11
17
|
ModalBody,
|
|
12
18
|
ModalFooter,
|
|
13
19
|
Stack,
|
|
14
20
|
} from "@immich/ui";
|
|
21
|
+
import { DateTime } from "luxon";
|
|
15
22
|
import type { Snippet } from "svelte";
|
|
16
|
-
import { t } from "svelte-i18n-lingui";
|
|
23
|
+
import { plural, t } from "svelte-i18n-lingui";
|
|
17
24
|
|
|
18
25
|
type Props = {
|
|
19
26
|
title?: string;
|
|
@@ -38,15 +45,7 @@
|
|
|
38
45
|
// svelte-ignore state_referenced_locally
|
|
39
46
|
const query = useInspectRepositories(backendId);
|
|
40
47
|
|
|
41
|
-
const sortedRepositories = $derived(
|
|
42
|
-
query.data?.toSorted((a, b) => {
|
|
43
|
-
const validA = a.snapshots !== undefined;
|
|
44
|
-
const validB = b.snapshots !== undefined;
|
|
45
|
-
return validA !== validB
|
|
46
|
-
? Number(validB) - Number(validA)
|
|
47
|
-
: Number(b.name.includes("Immich")) - Number(a.name.includes("Immich"));
|
|
48
|
-
}),
|
|
49
|
-
);
|
|
48
|
+
const sortedRepositories = $derived(sortRestoreCandidates(query.data ?? []));
|
|
50
49
|
</script>
|
|
51
50
|
|
|
52
51
|
<Modal title={title ?? $t`Select Backup`} size="small" onClose={onCancel}>
|
|
@@ -56,31 +55,50 @@
|
|
|
56
55
|
|
|
57
56
|
<StackList>
|
|
58
57
|
<Suspense {query}>
|
|
59
|
-
{#each sortedRepositories
|
|
60
|
-
{@const accessible = repository.snapshots !== undefined}
|
|
58
|
+
{#each sortedRepositories as repository (repository.id)}
|
|
61
59
|
{@const snapshots = repository.snapshots ?? []}
|
|
60
|
+
{@const latest = latestSnapshot(snapshots)}
|
|
62
61
|
|
|
63
62
|
<StackListOption
|
|
64
63
|
title={repository.name}
|
|
65
|
-
disabled={!
|
|
64
|
+
disabled={!isRestorable(repository)}
|
|
66
65
|
onclick={() => onSelect(repository.id)}
|
|
67
66
|
>
|
|
68
|
-
{#if
|
|
67
|
+
{#if repository.snapshots === undefined}
|
|
69
68
|
{$t`Can't access, is your recovery key correct?`}
|
|
70
|
-
{:else if
|
|
69
|
+
{:else if latest}
|
|
71
70
|
{$t({
|
|
72
71
|
message: "Last backup: {date}",
|
|
73
72
|
values: {
|
|
74
|
-
date:
|
|
73
|
+
date: DateTime.fromISO(latest.time).toLocaleString(
|
|
74
|
+
DateTime.DATETIME_MED,
|
|
75
|
+
),
|
|
75
76
|
},
|
|
76
77
|
})}
|
|
77
78
|
{:else}
|
|
78
79
|
{$t`No backups yet`}
|
|
79
80
|
{/if}
|
|
81
|
+
|
|
82
|
+
<span class="block">
|
|
83
|
+
{#if latest}
|
|
84
|
+
{$plural(snapshots.length, {
|
|
85
|
+
one: "# backup",
|
|
86
|
+
other: "# backups",
|
|
87
|
+
})}
|
|
88
|
+
{#if latest.summary}
|
|
89
|
+
· <FormatBytes bytes={latest.summary.totalBytes} />
|
|
90
|
+
{/if}
|
|
91
|
+
·
|
|
92
|
+
{/if}
|
|
93
|
+
{$t({
|
|
94
|
+
message: "ID {id}",
|
|
95
|
+
values: { id: repository.id.slice(0, 8) },
|
|
96
|
+
})}
|
|
97
|
+
</span>
|
|
80
98
|
</StackListOption>
|
|
81
99
|
{/each}
|
|
82
100
|
|
|
83
|
-
{#if
|
|
101
|
+
{#if sortedRepositories.length === 0}
|
|
84
102
|
<StackListPlaceholder>{$t`No backups found.`}</StackListPlaceholder>
|
|
85
103
|
{/if}
|
|
86
104
|
</Suspense>
|
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
type BackupStatusType,
|
|
5
5
|
} from "../BackupStatus.svelte";
|
|
6
6
|
import OnEvents from "../../util/OnEvents.svelte";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import {
|
|
8
|
+
getRemainingText,
|
|
9
|
+
handleCancelJob,
|
|
10
|
+
jobKinds,
|
|
11
|
+
useJob,
|
|
12
|
+
useJobEventHandler,
|
|
13
|
+
} from "../../../services/job.service";
|
|
11
14
|
import { formatDuration } from "../../../utils/format";
|
|
15
|
+
import { now } from "../../../utils/now";
|
|
12
16
|
import {
|
|
13
17
|
CloseButton,
|
|
14
18
|
FormatBytes,
|
|
@@ -22,45 +26,36 @@
|
|
|
22
26
|
Text,
|
|
23
27
|
} from "@immich/ui";
|
|
24
28
|
import { DateTime } from "luxon";
|
|
25
|
-
import { onDestroy } from "svelte";
|
|
26
29
|
import { msg, plural, t } from "svelte-i18n-lingui";
|
|
27
30
|
|
|
28
31
|
type Props = {
|
|
29
|
-
|
|
32
|
+
jobId: string;
|
|
30
33
|
onClose: () => void;
|
|
31
34
|
onRetry?: () => void;
|
|
32
35
|
};
|
|
33
36
|
|
|
34
|
-
const {
|
|
37
|
+
const { jobId, onClose, onRetry }: Props = $props();
|
|
35
38
|
|
|
36
|
-
const advanced = options.advanced;
|
|
37
|
-
const showAdvanced = $derived($advanced);
|
|
38
|
-
// svelte-ignore state_referenced_locally
|
|
39
|
-
const log = createLogObserver(logId);
|
|
40
39
|
// svelte-ignore state_referenced_locally
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const tick = setInterval(() => (now = DateTime.now()), 1000);
|
|
47
|
-
|
|
48
|
-
onDestroy(() => {
|
|
49
|
-
clearInterval(tick);
|
|
50
|
-
log.destroy();
|
|
51
|
-
});
|
|
40
|
+
const jobQuery = useJob(jobId);
|
|
41
|
+
const job = $derived(jobQuery.data);
|
|
42
|
+
const { onJobUpdate, onJobTick } = useJobEventHandler();
|
|
43
|
+
const summary = $derived(job?.outcome?.summary);
|
|
44
|
+
const supportCode = $derived(job?.outcome?.support?.sessionId);
|
|
52
45
|
|
|
46
|
+
const kind = $derived(job ? jobKinds[job.name] : "backup");
|
|
53
47
|
const type: BackupStatusType = $derived(
|
|
54
|
-
|
|
48
|
+
kind === "syncMetrics" ? "backup" : kind,
|
|
55
49
|
);
|
|
56
50
|
|
|
57
51
|
const backupState: BackupStatusState = $derived.by(() => {
|
|
58
|
-
if (!
|
|
52
|
+
if (!job) {
|
|
59
53
|
return "connecting";
|
|
60
54
|
}
|
|
61
55
|
|
|
62
|
-
switch (
|
|
63
|
-
case "
|
|
56
|
+
switch (job.status) {
|
|
57
|
+
case "queued":
|
|
58
|
+
case "running": {
|
|
64
59
|
return "running";
|
|
65
60
|
}
|
|
66
61
|
case "failed": {
|
|
@@ -69,6 +64,9 @@
|
|
|
69
64
|
case "cancelled": {
|
|
70
65
|
return "cancelled";
|
|
71
66
|
}
|
|
67
|
+
case "incomplete": {
|
|
68
|
+
return "interrupted";
|
|
69
|
+
}
|
|
72
70
|
case "warn": {
|
|
73
71
|
return "warned";
|
|
74
72
|
}
|
|
@@ -79,10 +77,10 @@
|
|
|
79
77
|
});
|
|
80
78
|
|
|
81
79
|
const duration = $derived(
|
|
82
|
-
|
|
80
|
+
job?.start
|
|
83
81
|
? formatDuration(
|
|
84
|
-
(
|
|
85
|
-
DateTime.fromISO(
|
|
82
|
+
(job.end ? DateTime.fromISO(job.end).toMillis() : $now) -
|
|
83
|
+
DateTime.fromISO(job.start).toMillis(),
|
|
86
84
|
"long",
|
|
87
85
|
)
|
|
88
86
|
: "",
|
|
@@ -129,6 +127,12 @@
|
|
|
129
127
|
values: { name: $t(titles[type].done) },
|
|
130
128
|
});
|
|
131
129
|
}
|
|
130
|
+
case "interrupted": {
|
|
131
|
+
return $t({
|
|
132
|
+
message: "{name} interrupted",
|
|
133
|
+
values: { name: $t(titles[type].done) },
|
|
134
|
+
});
|
|
135
|
+
}
|
|
132
136
|
default: {
|
|
133
137
|
return $t(titles[type].running);
|
|
134
138
|
}
|
|
@@ -136,7 +140,7 @@
|
|
|
136
140
|
});
|
|
137
141
|
</script>
|
|
138
142
|
|
|
139
|
-
<OnEvents {
|
|
143
|
+
<OnEvents {onJobUpdate} {onJobTick} />
|
|
140
144
|
|
|
141
145
|
<Modal
|
|
142
146
|
size="medium"
|
|
@@ -156,72 +160,61 @@
|
|
|
156
160
|
{title}
|
|
157
161
|
{type}
|
|
158
162
|
state={backupState}
|
|
159
|
-
progress={
|
|
160
|
-
|
|
163
|
+
progress={job?.progress?.percentDone ?? (summary ? 1 : 0)}
|
|
164
|
+
scanning={job?.progress?.scanning}
|
|
165
|
+
start={job?.start}
|
|
161
166
|
{duration}
|
|
162
|
-
remaining={
|
|
163
|
-
errors={
|
|
164
|
-
currentFiles={
|
|
167
|
+
remaining={getRemainingText(job?.progress, $now)}
|
|
168
|
+
errors={job?.outcome?.errors}
|
|
169
|
+
currentFiles={job?.progress?.currentFiles}
|
|
165
170
|
onRetry={retry}
|
|
166
|
-
onCancel={
|
|
171
|
+
onCancel={job ? () => void handleCancelJob(job.id, type) : undefined}
|
|
167
172
|
>
|
|
168
173
|
{#snippet details()}
|
|
169
|
-
{#if
|
|
174
|
+
{#if summary?.type === "backup"}
|
|
170
175
|
{$t({
|
|
171
176
|
message: "{count} items backed up",
|
|
172
177
|
values: {
|
|
173
|
-
count:
|
|
178
|
+
count: summary.totalFilesProcessed.toLocaleString(),
|
|
174
179
|
},
|
|
175
180
|
})} ·
|
|
176
181
|
{$t({
|
|
177
182
|
message: "{count} new items",
|
|
178
|
-
values: { count:
|
|
183
|
+
values: { count: summary.filesNew.toLocaleString() },
|
|
179
184
|
})}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
{/if}
|
|
184
|
-
{:else if log.summary && type === "restore"}
|
|
185
|
+
·
|
|
186
|
+
<FormatBytes bytes={summary.totalBytesProcessed} /> {$t`processed`}
|
|
187
|
+
{:else if summary?.type === "restore"}
|
|
185
188
|
{$t({
|
|
186
189
|
message: "{count} items restored",
|
|
187
|
-
values: { count:
|
|
188
|
-
})}{#if
|
|
190
|
+
values: { count: summary.filesRestored.toLocaleString() },
|
|
191
|
+
})}{#if summary.filesSkipped}
|
|
189
192
|
· {$t({
|
|
190
193
|
message: "{count} skipped",
|
|
191
|
-
values: { count:
|
|
194
|
+
values: { count: summary.filesSkipped.toLocaleString() },
|
|
192
195
|
})}
|
|
193
196
|
{/if}
|
|
194
|
-
{
|
|
195
|
-
|
|
196
|
-
{
|
|
197
|
-
{:else if type === "forget"}
|
|
198
|
-
{$plural(log.pruned.removed, {
|
|
197
|
+
· <FormatBytes bytes={summary.bytesRestored} /> {$t`restored`}
|
|
198
|
+
{:else if summary?.type === "prune"}
|
|
199
|
+
{$plural(summary.removed, {
|
|
199
200
|
one: "# backup removed",
|
|
200
201
|
other: "# backups removed",
|
|
201
202
|
})} ·
|
|
202
203
|
{$t({
|
|
203
204
|
message: "{count} kept",
|
|
204
|
-
values: { count:
|
|
205
|
+
values: { count: summary.kept.toLocaleString() },
|
|
205
206
|
})}
|
|
206
207
|
{/if}
|
|
207
208
|
{/snippet}
|
|
208
|
-
|
|
209
|
-
{#snippet advanced()}
|
|
210
|
-
{#if showAdvanced}
|
|
211
|
-
<Stack gap={1}>
|
|
212
|
-
<Heading tag="h3" size="small">{$t`Event Log`}</Heading>
|
|
213
|
-
<Scrollable class="h-80 overflow-x-hidden">
|
|
214
|
-
<Stack gap={1}>
|
|
215
|
-
{#each log.events as event, index (index)}
|
|
216
|
-
<Text size="tiny" class="font-mono select-all">
|
|
217
|
-
{JSON.stringify(event)}
|
|
218
|
-
</Text>
|
|
219
|
-
{/each}
|
|
220
|
-
</Stack>
|
|
221
|
-
</Scrollable>
|
|
222
|
-
</Stack>
|
|
223
|
-
{/if}
|
|
224
|
-
{/snippet}
|
|
225
209
|
</BackupStatus>
|
|
210
|
+
|
|
211
|
+
{#if supportCode}
|
|
212
|
+
<Text size="small" color="muted" class="mt-4">
|
|
213
|
+
{$t({
|
|
214
|
+
message: "Support code: {code}. Share it with FUTO support so they can find this run's logs.",
|
|
215
|
+
values: { code: supportCode },
|
|
216
|
+
})}
|
|
217
|
+
</Text>
|
|
218
|
+
{/if}
|
|
226
219
|
</ModalBody>
|
|
227
220
|
</Modal>
|
|
@@ -180,13 +180,8 @@
|
|
|
180
180
|
{/if}
|
|
181
181
|
|
|
182
182
|
{#snippet trailing()}
|
|
183
|
-
<Text
|
|
184
|
-
|
|
185
|
-
size="small"
|
|
186
|
-
class="shrink-0"
|
|
187
|
-
title={isoDate(entry.createdAt)}
|
|
188
|
-
>
|
|
189
|
-
<RelativeTime time={entry.createdAt} />
|
|
183
|
+
<Text color="secondary" size="small" class="shrink-0">
|
|
184
|
+
<RelativeTime time={entry.createdAt} absolute />
|
|
190
185
|
</Text>
|
|
191
186
|
{/snippet}
|
|
192
187
|
</StackListItem>
|