@futo-org/backups-orchestrator-ui 1.16.0 → 1.18.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/dialogs/CancelJobModal.svelte +1 -1
- package/dist/components/backups/metrics-history/MetricsHistoryModal.svelte +8 -0
- package/dist/components/integrations/immich/ImmichManageBackupOverview.svelte +9 -6
- package/dist/components/integrations/immich/ImmichOnboardingSetupFlow.svelte +22 -12
- package/dist/components/integrations/immich/settings/ImmichSettingsBackupContents.svelte +1 -1
- package/dist/components/integrations/immich/settings/ImmichSettingsSchedule.svelte +14 -85
- package/dist/components/integrations/immich/settings/ImmichSettingsStorage.svelte +1 -1
- package/dist/components/onboarding/steps/OnboardingStep4FirstBackup.svelte +42 -2
- package/dist/components/onboarding/steps/OnboardingStep4FirstBackup.svelte.d.ts +4 -1
- package/dist/components/onboarding/steps/OnboardingStepBetaDisclaimer.svelte +1 -1
- package/dist/components/schedules/ScheduleEditor.svelte +326 -0
- package/dist/components/schedules/ScheduleEditor.svelte.d.ts +7 -0
- package/dist/components/schedules/ScheduleList.svelte +1 -1
- package/dist/components/schedules/dialogs/ConfigureScheduleModal.svelte +5 -22
- package/dist/components/schedules/dialogs/CreateScheduleModal.svelte +6 -23
- package/dist/fetch-client.d.ts +8 -0
- package/dist/locales/en-XA.js +1 -1
- package/dist/locales/en-XA.po +148 -24
- package/dist/locales/en.js +1 -1
- package/dist/locales/en.po +149 -25
- package/dist/services/immich.integration.service.js +2 -1
- package/dist/services/integrations.service.d.ts +1 -1
- package/dist/services/integrations.service.js +1 -1
- package/dist/services/schedule.service.d.ts +1 -1
- package/dist/services/schedule.service.js +14 -6
- package/dist/services/snapshot.service.js +2 -2
- package/dist/utils/cron.d.ts +15 -0
- package/dist/utils/cron.js +42 -0
- package/package.json +3 -3
|
@@ -4,7 +4,7 @@ import { queryClient } from '../query-client';
|
|
|
4
4
|
import { handleError } from '../utils/handle-error';
|
|
5
5
|
import { createMutation, createQuery } from '@tanstack/svelte-query';
|
|
6
6
|
import { gt } from 'svelte-i18n-lingui';
|
|
7
|
-
export const IMMICH_DEFAULT_CRON = '
|
|
7
|
+
export const IMMICH_DEFAULT_CRON = '@daily';
|
|
8
8
|
export const integrationsKeys = {
|
|
9
9
|
all: ['integrations'],
|
|
10
10
|
};
|
|
@@ -6,7 +6,7 @@ import { gt } from 'svelte-i18n-lingui';
|
|
|
6
6
|
export declare const scheduleKeys: {
|
|
7
7
|
all: readonly ["schedules"];
|
|
8
8
|
};
|
|
9
|
-
export declare const useSchedules: () => import("@tanstack/svelte-query").CreateQueryResult<sdk.
|
|
9
|
+
export declare const useSchedules: () => import("@tanstack/svelte-query").CreateQueryResult<sdk.ScheduleListResponseDto, Error>;
|
|
10
10
|
export declare const useScheduleEventHandler: () => {
|
|
11
11
|
onScheduleCreate(event: SocketEvent<{
|
|
12
12
|
schedule: ScheduleDto;
|
|
@@ -13,28 +13,36 @@ export const scheduleKeys = {
|
|
|
13
13
|
};
|
|
14
14
|
export const useSchedules = () => createQuery(() => ({
|
|
15
15
|
queryKey: scheduleKeys.all,
|
|
16
|
-
queryFn: () => futoBackupsGetSchedules()
|
|
16
|
+
queryFn: () => futoBackupsGetSchedules(),
|
|
17
17
|
}), () => queryClient);
|
|
18
18
|
export const useScheduleEventHandler = () => {
|
|
19
19
|
return {
|
|
20
20
|
onScheduleCreate(event) {
|
|
21
21
|
queryClient.setQueryData(scheduleKeys.all, (data) => {
|
|
22
|
-
return data
|
|
22
|
+
return data
|
|
23
|
+
? { ...data, schedules: [...data.schedules, event.data.schedule] }
|
|
24
|
+
: void 0;
|
|
23
25
|
});
|
|
24
26
|
},
|
|
25
27
|
onScheduleUpdate(event) {
|
|
26
28
|
queryClient.setQueryData(scheduleKeys.all, (data) => {
|
|
27
29
|
return data
|
|
28
|
-
?
|
|
29
|
-
|
|
30
|
-
: entry)
|
|
30
|
+
? {
|
|
31
|
+
...data,
|
|
32
|
+
schedules: data.schedules.map((entry) => entry.id === event.data.scheduleId
|
|
33
|
+
? { ...entry, ...event.data.schedule }
|
|
34
|
+
: entry),
|
|
35
|
+
}
|
|
31
36
|
: void 0;
|
|
32
37
|
});
|
|
33
38
|
},
|
|
34
39
|
onScheduleDelete(event) {
|
|
35
40
|
queryClient.setQueryData(scheduleKeys.all, (data) => {
|
|
36
41
|
return data
|
|
37
|
-
?
|
|
42
|
+
? {
|
|
43
|
+
...data,
|
|
44
|
+
schedules: data.schedules.filter((entry) => entry.id !== event.data.scheduleId),
|
|
45
|
+
}
|
|
38
46
|
: void 0;
|
|
39
47
|
});
|
|
40
48
|
},
|
|
@@ -89,7 +89,7 @@ export const handleGetSnapshotListing = async (id, snapshotId, path) => {
|
|
|
89
89
|
export const getSnapshotActions = (repositoryId, snapshot, t, immich) => {
|
|
90
90
|
const removeSnapshot = useRemoveSnapshot(repositoryId);
|
|
91
91
|
const Restore = {
|
|
92
|
-
title: t(msg `Restore files
|
|
92
|
+
title: t(msg `Restore files…`),
|
|
93
93
|
icon: mdiBackupRestore,
|
|
94
94
|
onAction: () => void modalManager.open(RestoreSnapshotModal, {
|
|
95
95
|
repository: repositoryId,
|
|
@@ -97,7 +97,7 @@ export const getSnapshotActions = (repositoryId, snapshot, t, immich) => {
|
|
|
97
97
|
}),
|
|
98
98
|
};
|
|
99
99
|
const Rollback = {
|
|
100
|
-
title: t(msg `
|
|
100
|
+
title: t(msg `Roll back Immich to this snapshot…`),
|
|
101
101
|
icon: mdiHistory,
|
|
102
102
|
onAction: () => void modalManager.open(RollbackSnapshotModal, {
|
|
103
103
|
repository: repositoryId,
|
package/dist/utils/cron.d.ts
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
+
import type { ScheduleDefaultsDto } from '../fetch-client';
|
|
1
2
|
export declare const runsMoreThanHourly: (cron: string) => boolean;
|
|
3
|
+
export declare const schedulePresets: readonly ["daily", "weekly", "monthly"];
|
|
4
|
+
export type SchedulePreset = (typeof schedulePresets)[number];
|
|
5
|
+
export declare const toSchedulePreset: (cron: string) => "daily" | "weekly" | "monthly" | undefined;
|
|
6
|
+
export declare const isValidCron: (cron: string) => boolean;
|
|
7
|
+
export declare const resolveCron: (cron: string, defaults: Record<SchedulePreset, string> | undefined) => string;
|
|
8
|
+
export declare const withTimeZone: (text: string, tz: string) => string;
|
|
9
|
+
export declare const describeCron: (expression: string, tz: string) => string;
|
|
10
|
+
export declare const formatTime: (hour: number, minute: number) => string;
|
|
11
|
+
export declare const toDefaultWindow: (expression: string) => {
|
|
12
|
+
start: string;
|
|
13
|
+
end: string;
|
|
14
|
+
days: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const describeSchedule: (cron: string, defaults: ScheduleDefaultsDto, tz: string) => string;
|
package/dist/utils/cron.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { validateCronExpression } from 'cron';
|
|
2
|
+
import cronstrue from 'cronstrue';
|
|
3
|
+
import { DateTime } from 'luxon';
|
|
4
|
+
import { gt } from 'svelte-i18n-lingui';
|
|
1
5
|
const MINUTES_PER_HOUR = 60;
|
|
2
6
|
const expandMinutes = (field) => {
|
|
3
7
|
const minutes = new Set();
|
|
@@ -16,3 +20,41 @@ export const runsMoreThanHourly = (cron) => {
|
|
|
16
20
|
const [minute = ''] = cron.trim().split(/\s+/);
|
|
17
21
|
return expandMinutes(minute).size > 1;
|
|
18
22
|
};
|
|
23
|
+
export const schedulePresets = ['daily', 'weekly', 'monthly'];
|
|
24
|
+
export const toSchedulePreset = (cron) => schedulePresets.find((preset) => cron === `@${preset}`);
|
|
25
|
+
export const isValidCron = (cron) => validateCronExpression(cron).valid;
|
|
26
|
+
export const resolveCron = (cron, defaults) => {
|
|
27
|
+
const preset = toSchedulePreset(cron);
|
|
28
|
+
return (preset && defaults?.[preset]) ?? cron;
|
|
29
|
+
};
|
|
30
|
+
export const withTimeZone = (text, tz) => tz === DateTime.local().zoneName
|
|
31
|
+
? text
|
|
32
|
+
: `${text} (${tz.replaceAll('_', ' ')})`;
|
|
33
|
+
export const describeCron = (expression, tz) => {
|
|
34
|
+
const description = cronstrue.toString(expression, { verbose: true });
|
|
35
|
+
return withTimeZone(description.charAt(0).toLowerCase() + description.slice(1), tz);
|
|
36
|
+
};
|
|
37
|
+
export const formatTime = (hour, minute) => [hour, minute].map((part) => String(part).padStart(2, '0')).join(':');
|
|
38
|
+
export const toDefaultWindow = (expression) => {
|
|
39
|
+
const [, hour, ...days] = expression.split(' ');
|
|
40
|
+
const start = Number(hour);
|
|
41
|
+
return {
|
|
42
|
+
start: formatTime(start, 0),
|
|
43
|
+
end: formatTime((start + 1) % 24, 0),
|
|
44
|
+
days: cronstrue
|
|
45
|
+
.toString(['0', '0', ...days].join(' '), { verbose: true })
|
|
46
|
+
.split(', ')
|
|
47
|
+
.slice(1)
|
|
48
|
+
.join(', '),
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export const describeSchedule = (cron, defaults, tz) => {
|
|
52
|
+
const preset = toSchedulePreset(cron);
|
|
53
|
+
if (!preset) {
|
|
54
|
+
return describeCron(cron, tz);
|
|
55
|
+
}
|
|
56
|
+
return withTimeZone(gt({
|
|
57
|
+
message: 'between {start} and {end}, {days}',
|
|
58
|
+
values: toDefaultWindow(defaults[preset]),
|
|
59
|
+
}), tz);
|
|
60
|
+
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@futo-org/backups-orchestrator-ui",
|
|
3
3
|
"repository": "https://github.com/futo-org/backups",
|
|
4
4
|
"description": "Backups orchestrator (UI library)",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.18.0",
|
|
6
6
|
"license": "Source First License 1.1",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"@mdi/js": "^7.4.47",
|
|
64
64
|
"@oazapfts/runtime": "^1.2.0",
|
|
65
65
|
"@tanstack/svelte-query": "^6.3.1",
|
|
66
|
-
"cron
|
|
66
|
+
"cron": "^4.4.0",
|
|
67
67
|
"cronstrue": "^3.27.0",
|
|
68
68
|
"lodash.debounce": "^4.0.8",
|
|
69
69
|
"luxon": "^3.7.2",
|
|
70
70
|
"socket.io-client": "^4.8.3",
|
|
71
71
|
"svelte-i18n-lingui": "^0.2.2",
|
|
72
|
-
"@futo-org/backups-api-client": "^1.
|
|
72
|
+
"@futo-org/backups-api-client": "^1.18.0"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|
|
75
75
|
"dev": "vite dev --port 5174",
|