@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
|
@@ -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">
|
|
@@ -36,7 +37,6 @@
|
|
|
36
37
|
errors?: string[];
|
|
37
38
|
details?: Snippet;
|
|
38
39
|
currentFiles?: string[];
|
|
39
|
-
advanced?: Snippet;
|
|
40
40
|
onRetry?: () => void;
|
|
41
41
|
onCancel?: () => void;
|
|
42
42
|
};
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
errors = [],
|
|
53
53
|
details,
|
|
54
54
|
currentFiles = [],
|
|
55
|
-
advanced,
|
|
56
55
|
onRetry,
|
|
57
56
|
onCancel,
|
|
58
57
|
}: Props = $props();
|
|
@@ -87,6 +86,12 @@
|
|
|
87
86
|
forget: msg`Pruning old backups was cancelled`,
|
|
88
87
|
};
|
|
89
88
|
|
|
89
|
+
const interrupted: Record<BackupStatusType, string> = {
|
|
90
|
+
backup: msg`Your backup was interrupted`,
|
|
91
|
+
restore: msg`Your restore was interrupted`,
|
|
92
|
+
forget: msg`Pruning old backups was interrupted`,
|
|
93
|
+
};
|
|
94
|
+
|
|
90
95
|
const cancelLabels: Record<BackupStatusType, string> = {
|
|
91
96
|
backup: msg`Cancel backup`,
|
|
92
97
|
restore: msg`Cancel restore`,
|
|
@@ -124,6 +129,9 @@
|
|
|
124
129
|
case "cancelled": {
|
|
125
130
|
return $t(cancelled[type]);
|
|
126
131
|
}
|
|
132
|
+
case "interrupted": {
|
|
133
|
+
return $t(interrupted[type]);
|
|
134
|
+
}
|
|
127
135
|
case "complete": {
|
|
128
136
|
return $t(succeeded[type]);
|
|
129
137
|
}
|
|
@@ -144,7 +152,9 @@
|
|
|
144
152
|
const titleColor = $derived(
|
|
145
153
|
backupState === "complete"
|
|
146
154
|
? "success"
|
|
147
|
-
: backupState === "warned" ||
|
|
155
|
+
: backupState === "warned" ||
|
|
156
|
+
backupState === "cancelled" ||
|
|
157
|
+
backupState === "interrupted"
|
|
148
158
|
? "warning"
|
|
149
159
|
: backupState === "failed"
|
|
150
160
|
? "danger"
|
|
@@ -155,7 +165,8 @@
|
|
|
155
165
|
backupState === "complete" ||
|
|
156
166
|
backupState === "warned" ||
|
|
157
167
|
backupState === "failed" ||
|
|
158
|
-
backupState === "cancelled"
|
|
168
|
+
backupState === "cancelled" ||
|
|
169
|
+
backupState === "interrupted",
|
|
159
170
|
);
|
|
160
171
|
</script>
|
|
161
172
|
|
|
@@ -247,5 +258,4 @@
|
|
|
247
258
|
</Stack>
|
|
248
259
|
{/if}
|
|
249
260
|
|
|
250
|
-
{@render advanced?.()}
|
|
251
261
|
</Stack>
|
|
@@ -1,5 +1,5 @@
|
|
|
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;
|
|
@@ -12,7 +12,6 @@ type Props = {
|
|
|
12
12
|
errors?: string[];
|
|
13
13
|
details?: Snippet;
|
|
14
14
|
currentFiles?: string[];
|
|
15
|
-
advanced?: Snippet;
|
|
16
15
|
onRetry?: () => void;
|
|
17
16
|
onCancel?: () => void;
|
|
18
17
|
};
|
|
@@ -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,10 +4,13 @@
|
|
|
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";
|
|
12
15
|
import {
|
|
13
16
|
CloseButton,
|
|
@@ -26,41 +29,40 @@
|
|
|
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 {
|
|
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);
|
|
44
45
|
|
|
45
46
|
let now = $state(DateTime.now());
|
|
46
47
|
const tick = setInterval(() => (now = DateTime.now()), 1000);
|
|
47
48
|
|
|
48
49
|
onDestroy(() => {
|
|
49
50
|
clearInterval(tick);
|
|
50
|
-
log.destroy();
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
+
const kind = $derived(job ? jobKinds[job.name] : "backup");
|
|
53
54
|
const type: BackupStatusType = $derived(
|
|
54
|
-
|
|
55
|
+
kind === "syncMetrics" ? "backup" : kind,
|
|
55
56
|
);
|
|
56
57
|
|
|
57
58
|
const backupState: BackupStatusState = $derived.by(() => {
|
|
58
|
-
if (!
|
|
59
|
+
if (!job) {
|
|
59
60
|
return "connecting";
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
switch (
|
|
63
|
-
case "
|
|
63
|
+
switch (job.status) {
|
|
64
|
+
case "queued":
|
|
65
|
+
case "running": {
|
|
64
66
|
return "running";
|
|
65
67
|
}
|
|
66
68
|
case "failed": {
|
|
@@ -69,6 +71,9 @@
|
|
|
69
71
|
case "cancelled": {
|
|
70
72
|
return "cancelled";
|
|
71
73
|
}
|
|
74
|
+
case "incomplete": {
|
|
75
|
+
return "interrupted";
|
|
76
|
+
}
|
|
72
77
|
case "warn": {
|
|
73
78
|
return "warned";
|
|
74
79
|
}
|
|
@@ -79,10 +84,10 @@
|
|
|
79
84
|
});
|
|
80
85
|
|
|
81
86
|
const duration = $derived(
|
|
82
|
-
|
|
87
|
+
job?.start
|
|
83
88
|
? formatDuration(
|
|
84
|
-
(
|
|
85
|
-
DateTime.fromISO(
|
|
89
|
+
(job.end ? DateTime.fromISO(job.end) : now).toMillis() -
|
|
90
|
+
DateTime.fromISO(job.start).toMillis(),
|
|
86
91
|
"long",
|
|
87
92
|
)
|
|
88
93
|
: "",
|
|
@@ -129,6 +134,12 @@
|
|
|
129
134
|
values: { name: $t(titles[type].done) },
|
|
130
135
|
});
|
|
131
136
|
}
|
|
137
|
+
case "interrupted": {
|
|
138
|
+
return $t({
|
|
139
|
+
message: "{name} interrupted",
|
|
140
|
+
values: { name: $t(titles[type].done) },
|
|
141
|
+
});
|
|
142
|
+
}
|
|
132
143
|
default: {
|
|
133
144
|
return $t(titles[type].running);
|
|
134
145
|
}
|
|
@@ -136,7 +147,7 @@
|
|
|
136
147
|
});
|
|
137
148
|
</script>
|
|
138
149
|
|
|
139
|
-
<OnEvents {
|
|
150
|
+
<OnEvents {onJobUpdate} {onJobTick} />
|
|
140
151
|
|
|
141
152
|
<Modal
|
|
142
153
|
size="medium"
|
|
@@ -156,72 +167,60 @@
|
|
|
156
167
|
{title}
|
|
157
168
|
{type}
|
|
158
169
|
state={backupState}
|
|
159
|
-
progress={
|
|
160
|
-
start={
|
|
170
|
+
progress={job?.progress?.percentDone ?? (summary ? 1 : 0)}
|
|
171
|
+
start={job?.start}
|
|
161
172
|
{duration}
|
|
162
|
-
remaining={
|
|
163
|
-
errors={
|
|
164
|
-
currentFiles={
|
|
173
|
+
remaining={getRemainingText(job?.progress)}
|
|
174
|
+
errors={job?.outcome?.errors}
|
|
175
|
+
currentFiles={job?.progress?.currentFiles}
|
|
165
176
|
onRetry={retry}
|
|
166
|
-
onCancel={
|
|
177
|
+
onCancel={job ? () => void handleCancelJob(job.id, type) : undefined}
|
|
167
178
|
>
|
|
168
179
|
{#snippet details()}
|
|
169
|
-
{#if
|
|
180
|
+
{#if summary?.type === "backup"}
|
|
170
181
|
{$t({
|
|
171
182
|
message: "{count} items backed up",
|
|
172
183
|
values: {
|
|
173
|
-
count:
|
|
184
|
+
count: summary.totalFilesProcessed.toLocaleString(),
|
|
174
185
|
},
|
|
175
186
|
})} ·
|
|
176
187
|
{$t({
|
|
177
188
|
message: "{count} new items",
|
|
178
|
-
values: { count:
|
|
189
|
+
values: { count: summary.filesNew.toLocaleString() },
|
|
179
190
|
})}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
{/if}
|
|
184
|
-
{:else if log.summary && type === "restore"}
|
|
191
|
+
·
|
|
192
|
+
<FormatBytes bytes={summary.totalBytesProcessed} /> {$t`processed`}
|
|
193
|
+
{:else if summary?.type === "restore"}
|
|
185
194
|
{$t({
|
|
186
195
|
message: "{count} items restored",
|
|
187
|
-
values: { count:
|
|
188
|
-
})}{#if
|
|
196
|
+
values: { count: summary.filesRestored.toLocaleString() },
|
|
197
|
+
})}{#if summary.filesSkipped}
|
|
189
198
|
· {$t({
|
|
190
199
|
message: "{count} skipped",
|
|
191
|
-
values: { count:
|
|
200
|
+
values: { count: summary.filesSkipped.toLocaleString() },
|
|
192
201
|
})}
|
|
193
202
|
{/if}
|
|
194
|
-
{
|
|
195
|
-
|
|
196
|
-
{
|
|
197
|
-
{:else if type === "forget"}
|
|
198
|
-
{$plural(log.pruned.removed, {
|
|
203
|
+
· <FormatBytes bytes={summary.bytesRestored} /> {$t`restored`}
|
|
204
|
+
{:else if summary?.type === "prune"}
|
|
205
|
+
{$plural(summary.removed, {
|
|
199
206
|
one: "# backup removed",
|
|
200
207
|
other: "# backups removed",
|
|
201
208
|
})} ·
|
|
202
209
|
{$t({
|
|
203
210
|
message: "{count} kept",
|
|
204
|
-
values: { count:
|
|
211
|
+
values: { count: summary.kept.toLocaleString() },
|
|
205
212
|
})}
|
|
206
213
|
{/if}
|
|
207
214
|
{/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
215
|
</BackupStatus>
|
|
216
|
+
|
|
217
|
+
{#if supportCode}
|
|
218
|
+
<Text size="small" color="muted" class="mt-4">
|
|
219
|
+
{$t({
|
|
220
|
+
message: "Support code: {code}. Share it with FUTO support so they can find this run's logs.",
|
|
221
|
+
values: { code: supportCode },
|
|
222
|
+
})}
|
|
223
|
+
</Text>
|
|
224
|
+
{/if}
|
|
226
225
|
</ModalBody>
|
|
227
226
|
</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>
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import Suspense from "../../util/Suspense.svelte";
|
|
6
6
|
import type { LocalRepositoryDto } from "../../../fetch-client";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "../../../services/
|
|
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 =
|
|
24
|
-
const {
|
|
23
|
+
const query = useJobs(() => repository.id, "repository-backup");
|
|
24
|
+
const { onJobCreate, onJobUpdate } = useJobEventHandler();
|
|
25
25
|
</script>
|
|
26
26
|
|
|
27
|
-
<OnEvents {
|
|
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(
|
|
42
|
-
{#each
|
|
43
|
-
<RepositoryRunHistoryItem {
|
|
41
|
+
{#snippet children(jobs)}
|
|
42
|
+
{#each jobs.slice(0, limit) as job (job.id)}
|
|
43
|
+
<RepositoryRunHistoryItem {job} />
|
|
44
44
|
{/each}
|
|
45
45
|
|
|
46
|
-
{#if
|
|
46
|
+
{#if jobs.length === 0}
|
|
47
47
|
<StackListPlaceholder>{$t`No recent backups`}</StackListPlaceholder>
|
|
48
48
|
{/if}
|
|
49
49
|
{/snippet}
|