@futo-org/backups-orchestrator-ui 0.46.0 → 0.47.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/backends/BackendItem.svelte +17 -13
- package/dist/components/backends/BackendsList.svelte +4 -3
- package/dist/components/backends/dialogs/CreateLocalBackendModal.svelte +6 -5
- package/dist/components/backends/dialogs/OAuthDeviceFlowModal.svelte +3 -2
- package/dist/components/backends/dialogs/SelectBackendModal.svelte +7 -6
- package/dist/components/backups/BackupItem.svelte +13 -12
- package/dist/components/backups/BackupStatus.svelte +45 -40
- package/dist/components/backups/BackupsList.svelte +6 -5
- package/dist/components/backups/dialogs/ConfigureRepositoryModal.svelte +9 -8
- package/dist/components/backups/dialogs/CreateRepositoryModal.svelte +8 -4
- package/dist/components/backups/dialogs/ImportRepositoryModal.svelte +5 -4
- package/dist/components/backups/dialogs/ReconfigureRepositoryBackendModal.svelte +3 -3
- package/dist/components/backups/dialogs/RestoreSnapshotModal.svelte +16 -15
- package/dist/components/backups/dialogs/RollbackSnapshotModal.svelte +9 -8
- package/dist/components/backups/dialogs/SelectRepositoryModal.svelte +13 -7
- package/dist/components/backups/dialogs/ViewStatusModal.svelte +50 -19
- package/dist/components/backups/metrics-history/MetricsHistoryModal.svelte +37 -21
- package/dist/components/backups/run-history/RepositoryRunHistory.svelte +4 -3
- package/dist/components/backups/run-history/RepositoryRunHistoryItem.svelte +32 -12
- package/dist/components/backups/run-history/RepositoryRunHistoryPage.svelte +16 -14
- package/dist/components/backups/run-history/RunHistoryModal.svelte +5 -1
- package/dist/components/backups/snapshots-list/RepositorySnapshotsList.svelte +5 -4
- package/dist/components/backups/snapshots-list/RepositorySnapshotsListItem.svelte +15 -5
- package/dist/components/backups/snapshots-list/RepositorySnapshotsPage.svelte +7 -6
- package/dist/components/backups/snapshots-list/SnapshotsListModal.svelte +5 -1
- package/dist/components/dashboard/DashboardAvgBackupTime.svelte +2 -1
- package/dist/components/dashboard/DashboardBackupHealth.svelte +14 -10
- package/dist/components/dashboard/DashboardCurrentUsage.svelte +2 -1
- package/dist/components/dashboard/DashboardDailyBackupTime.svelte +2 -1
- package/dist/components/dashboard/DashboardInstall.svelte +3 -2
- package/dist/components/dashboard/DashboardRecentBackups.svelte +9 -4
- package/dist/components/dashboard/DashboardTotalStored.svelte +7 -2
- package/dist/components/integrations/immich/ImmichBackupsAdminNavButton.svelte +2 -1
- package/dist/components/integrations/immich/ImmichBackupsSidebarItem.svelte +15 -14
- package/dist/components/integrations/immich/ImmichDatabaseDumpAlert.svelte +6 -5
- package/dist/components/integrations/immich/ImmichManageBackupOverview.svelte +15 -14
- package/dist/components/integrations/immich/ImmichManageBackupPage.svelte +3 -2
- package/dist/components/integrations/immich/ImmichOnboardingSetupFlow.svelte +2 -1
- package/dist/components/integrations/immich/settings/ImmichSettingsBackupContents.svelte +32 -31
- package/dist/components/integrations/immich/settings/ImmichSettingsBandwidth.svelte +34 -44
- package/dist/components/integrations/immich/settings/ImmichSettingsSchedule.svelte +16 -15
- package/dist/components/integrations/immich/settings/ImmichSettingsStorage.svelte +19 -18
- package/dist/components/onboarding/OnboardingBootstrapError.svelte +5 -4
- package/dist/components/onboarding/OnboardingLogin.svelte +4 -4
- package/dist/components/onboarding/RecoveryKeyDisplay.svelte +5 -4
- package/dist/components/onboarding/SampleOnboarding.svelte +4 -3
- package/dist/components/onboarding/dialogs/BackupsRecoveryKeyModal.svelte +4 -3
- package/dist/components/onboarding/restore-point-flow/RestorePointFlow.svelte +2 -1
- package/dist/components/onboarding/restore-point-flow/RestorePointFlow2SelectSnapshot.svelte +8 -4
- package/dist/components/onboarding/restore-point-flow/RestorePointFlow3ConfirmRestore.svelte +9 -8
- package/dist/components/onboarding/restore-point-flow/RestorePointFlow4Restore.svelte +2 -1
- package/dist/components/onboarding/stages/OnboardingStageBackupServices.svelte +9 -6
- package/dist/components/onboarding/stages/OnboardingStageKeyImport.svelte +6 -5
- package/dist/components/onboarding/stages/OnboardingStageTelemetry.svelte +6 -7
- package/dist/components/onboarding/steps/OnboardingStep1FinishSetup.svelte +12 -11
- package/dist/components/onboarding/steps/OnboardingStep2ConnectAccount.svelte +13 -12
- package/dist/components/onboarding/steps/OnboardingStep3SaveRecoveryKey.svelte +5 -4
- package/dist/components/onboarding/steps/OnboardingStep4FirstBackup.svelte +8 -8
- package/dist/components/onboarding/upsell/UpsellBackupFeaturesGrid.svelte +11 -14
- package/dist/components/onboarding/upsell/UpsellBackupFeaturesGrid.svelte.d.ts +2 -17
- package/dist/components/onboarding/upsell/UpsellExplainFutoBackups.svelte +10 -5
- package/dist/components/onboarding/upsell/UpsellFrequentlyAskedQuestions.svelte +2 -1
- package/dist/components/onboarding/upsell/UpsellFutoBackupsBadge.svelte +2 -1
- package/dist/components/onboarding/upsell/UpsellHowItWorks.svelte +10 -10
- package/dist/components/onboarding/upsell/UpsellProtectYourImmichLibrary.svelte +14 -11
- package/dist/components/schedules/RepositoryPicker.svelte +8 -7
- package/dist/components/schedules/ScheduleItem.svelte +6 -5
- package/dist/components/schedules/ScheduleList.svelte +4 -3
- package/dist/components/schedules/dialogs/ConfigureScheduleModal.svelte +4 -3
- package/dist/components/schedules/dialogs/CreateScheduleModal.svelte +7 -3
- package/dist/components/settings/SettingsBackends.svelte +3 -2
- package/dist/components/settings/SettingsBilling.svelte +13 -12
- package/dist/components/settings/SettingsNotifications.svelte +11 -10
- package/dist/components/ui/PageLayout.svelte +3 -2
- package/dist/components/ui/Pagination.svelte +4 -3
- package/dist/components/ui/PathListField.svelte +5 -4
- package/dist/components/ui/PathPickerField.svelte +4 -3
- package/dist/components/ui/PathPickerModal.svelte +16 -13
- package/dist/components/ui/StackListItem.svelte +2 -1
- package/dist/components/util/DeviceFlowAction.svelte +3 -2
- package/dist/components/util/DeviceFlowCode.svelte +4 -3
- package/dist/components/util/RelativeTime.svelte +2 -1
- package/dist/i18n.d.ts +3 -0
- package/dist/i18n.js +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/locales/en-XA.d.ts +2 -0
- package/dist/locales/en-XA.js +1 -0
- package/dist/locales/en-XA.po +2198 -0
- package/dist/locales/en.d.ts +2 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/en.po +2446 -0
- package/dist/services/backend.service.d.ts +2 -1
- package/dist/services/backend.service.js +6 -5
- package/dist/services/config.service.d.ts +12 -1
- package/dist/services/config.service.js +22 -1
- package/dist/services/deviceFlow.service.svelte.js +6 -5
- package/dist/services/filesystem.service.js +2 -1
- package/dist/services/immich.integration.service.d.ts +2 -1
- package/dist/services/immich.integration.service.js +7 -6
- package/dist/services/integrations.service.js +4 -3
- package/dist/services/log.service.svelte.js +9 -3
- package/dist/services/onboarding.service.js +8 -7
- package/dist/services/repository.service.d.ts +2 -1
- package/dist/services/repository.service.js +19 -18
- package/dist/services/runHistory.service.d.ts +2 -1
- package/dist/services/runHistory.service.js +5 -4
- package/dist/services/schedule.service.d.ts +2 -1
- package/dist/services/schedule.service.js +18 -17
- package/dist/services/session.service.js +2 -1
- package/dist/services/snapshot.service.d.ts +2 -1
- package/dist/services/snapshot.service.js +15 -14
- package/dist/services/task.service.js +3 -2
- package/dist/utils/format.js +10 -8
- package/dist/utils/handle-error.js +2 -1
- package/package.json +12 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SocketEvent } from '../events';
|
|
2
2
|
import { type BackendDto, type CreateLocalBackendRequestDto, type LocalRepositoryDto, type RepositoryBackendDto } from '../fetch-client';
|
|
3
3
|
import { type ActionItem } from '@immich/ui';
|
|
4
|
+
import { gt } from 'svelte-i18n-lingui';
|
|
4
5
|
export declare const backendKeys: {
|
|
5
6
|
all: readonly ["backends"];
|
|
6
7
|
};
|
|
@@ -15,7 +16,7 @@ export declare const handleSetupLocalStorage: (onCreate?: (backendId: string) =>
|
|
|
15
16
|
export declare const useCreateLocalBackend: () => import("@tanstack/svelte-query").CreateMutationResult<import("../fetch-client").BackendResponseDto, Error, CreateLocalBackendRequestDto, unknown>;
|
|
16
17
|
export declare const handleReconfigureRepositoryBackend: (repository: LocalRepositoryDto) => Promise<void>;
|
|
17
18
|
export declare const handleRemoveRepositoryBackend: (_backend: BackendDto, _repositoryBackend: RepositoryBackendDto) => void;
|
|
18
|
-
export declare const getBackendActions: (repository: LocalRepositoryDto | undefined, backend: BackendDto, repositoryBackend?: RepositoryBackendDto & {
|
|
19
|
+
export declare const getBackendActions: (repository: LocalRepositoryDto | undefined, backend: BackendDto, t: typeof gt, repositoryBackend?: RepositoryBackendDto & {
|
|
19
20
|
primary?: boolean;
|
|
20
21
|
}, onLogin?: () => void) => {
|
|
21
22
|
LoginAgain: ActionItem;
|
|
@@ -8,6 +8,7 @@ import { handleError } from '../utils/handle-error';
|
|
|
8
8
|
import { modalManager } from '@immich/ui';
|
|
9
9
|
import { mdiLogin } from '@mdi/js';
|
|
10
10
|
import { createMutation, createQuery } from '@tanstack/svelte-query';
|
|
11
|
+
import { gt, msg } from 'svelte-i18n-lingui';
|
|
11
12
|
export const backendKeys = {
|
|
12
13
|
all: ['backends'],
|
|
13
14
|
};
|
|
@@ -39,7 +40,7 @@ export const handleSetupLocalStorage = (onCreate) => {
|
|
|
39
40
|
};
|
|
40
41
|
export const useCreateLocalBackend = () => createMutation(() => ({
|
|
41
42
|
mutationFn: (dto) => createLocalBackend(dto),
|
|
42
|
-
onError: (error) => handleError(error,
|
|
43
|
+
onError: (error) => handleError(error, gt `Failed to create local backend`),
|
|
43
44
|
}), () => queryClient);
|
|
44
45
|
export const handleReconfigureRepositoryBackend = async (repository) => {
|
|
45
46
|
await modalManager.show(ReconfigureRepositoryBackendModal, {
|
|
@@ -49,16 +50,16 @@ export const handleReconfigureRepositoryBackend = async (repository) => {
|
|
|
49
50
|
export const handleRemoveRepositoryBackend = (_backend, _repositoryBackend) => {
|
|
50
51
|
alert('TODO: implement me when multi-repository-backend support is added');
|
|
51
52
|
};
|
|
52
|
-
export const getBackendActions = (repository, backend, repositoryBackend, onLogin) => {
|
|
53
|
+
export const getBackendActions = (repository, backend, t, repositoryBackend, onLogin) => {
|
|
53
54
|
const LoginAgain = {
|
|
54
55
|
icon: mdiLogin,
|
|
55
|
-
title:
|
|
56
|
+
title: t(msg `Login again`),
|
|
56
57
|
onAction: () => onLogin?.(),
|
|
57
58
|
$if: () => backend.type === 'yucca' && !backend.isOnline,
|
|
58
59
|
};
|
|
59
60
|
const Reconfigure = {
|
|
60
61
|
icon: mdiLogin,
|
|
61
|
-
title:
|
|
62
|
+
title: t(msg `Reconfigure`),
|
|
62
63
|
onAction: () => void handleReconfigureRepositoryBackend(repository),
|
|
63
64
|
$if: () => repositoryBackend
|
|
64
65
|
? backend.isOnline &&
|
|
@@ -68,7 +69,7 @@ export const getBackendActions = (repository, backend, repositoryBackend, onLogi
|
|
|
68
69
|
};
|
|
69
70
|
const Remove = {
|
|
70
71
|
icon: mdiLogin,
|
|
71
|
-
title:
|
|
72
|
+
title: t(msg `Remove`),
|
|
72
73
|
onAction: () => void handleRemoveRepositoryBackend(backend, repositoryBackend),
|
|
73
74
|
$if: () => repositoryBackend
|
|
74
75
|
? backend.isOnline &&
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import { type ConfigUpdateRequestDto } from '../fetch-client';
|
|
1
|
+
import { type BandwidthDto, type ConfigUpdateRequestDto } from '../fetch-client';
|
|
2
2
|
export declare const configKeys: {
|
|
3
3
|
all: readonly ["config"];
|
|
4
4
|
};
|
|
5
|
+
export declare const defaultQuietHoursStart = "22:00";
|
|
6
|
+
export declare const defaultQuietHoursEnd = "06:00";
|
|
7
|
+
export type BandwidthForm = {
|
|
8
|
+
mbps?: number;
|
|
9
|
+
quiet: boolean;
|
|
10
|
+
quietStart: string;
|
|
11
|
+
quietEnd: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const toBandwidthForm: ({ bytesPerSec, quietHours, }: BandwidthDto) => BandwidthForm;
|
|
14
|
+
export declare const toBytesPerSec: (mbps?: number) => number;
|
|
15
|
+
export declare const toBandwidthDto: ({ mbps, quiet, quietStart, quietEnd, }: BandwidthForm) => BandwidthDto;
|
|
5
16
|
export declare const useConfig: () => import("@tanstack/svelte-query").CreateQueryResult<import("../fetch-client").ConfigResponseDto, Error>;
|
|
6
17
|
export declare const useUpdateConfig: () => import("@tanstack/svelte-query").CreateMutationResult<import("../fetch-client").ConfigResponseDto, Error, ConfigUpdateRequestDto, unknown>;
|
|
@@ -2,9 +2,30 @@ import { getConfig, updateConfig, } from '../fetch-client';
|
|
|
2
2
|
import { queryClient } from '../query-client';
|
|
3
3
|
import { handleError } from '../utils/handle-error';
|
|
4
4
|
import { createMutation, createQuery } from '@tanstack/svelte-query';
|
|
5
|
+
import { gt } from 'svelte-i18n-lingui';
|
|
5
6
|
export const configKeys = {
|
|
6
7
|
all: ['config'],
|
|
7
8
|
};
|
|
9
|
+
const bytesPerSecPerMbps = 125_000;
|
|
10
|
+
export const defaultQuietHoursStart = '22:00';
|
|
11
|
+
export const defaultQuietHoursEnd = '06:00';
|
|
12
|
+
export const toBandwidthForm = ({ bytesPerSec, quietHours, }) => {
|
|
13
|
+
const [quietStart = defaultQuietHoursStart, quietEnd = defaultQuietHoursEnd] = quietHours?.split('-') ?? [];
|
|
14
|
+
return {
|
|
15
|
+
mbps: bytesPerSec ? bytesPerSec / bytesPerSecPerMbps : undefined,
|
|
16
|
+
quiet: Boolean(quietHours),
|
|
17
|
+
quietStart,
|
|
18
|
+
quietEnd,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export const toBytesPerSec = (mbps = 0) => Math.max(0, Math.ceil(mbps)) * bytesPerSecPerMbps;
|
|
22
|
+
export const toBandwidthDto = ({ mbps, quiet, quietStart, quietEnd, }) => {
|
|
23
|
+
const bytesPerSec = toBytesPerSec(mbps);
|
|
24
|
+
return {
|
|
25
|
+
bytesPerSec,
|
|
26
|
+
quietHours: bytesPerSec && quiet ? `${quietStart}-${quietEnd}` : undefined,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
8
29
|
export const useConfig = () => createQuery(() => ({
|
|
9
30
|
queryKey: configKeys.all,
|
|
10
31
|
queryFn: () => getConfig(),
|
|
@@ -12,5 +33,5 @@ export const useConfig = () => createQuery(() => ({
|
|
|
12
33
|
export const useUpdateConfig = () => createMutation(() => ({
|
|
13
34
|
mutationFn: (dto) => updateConfig(dto),
|
|
14
35
|
onSuccess: (config) => queryClient.setQueryData(configKeys.all, config),
|
|
15
|
-
onError: (error) => handleError(error,
|
|
36
|
+
onError: (error) => handleError(error, gt `Failed to save settings`),
|
|
16
37
|
}), () => queryClient);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { startDeviceFlow, } from './session.service';
|
|
2
|
+
import { gt, msg } from 'svelte-i18n-lingui';
|
|
2
3
|
const failures = {
|
|
3
|
-
NOT_CONNECTED:
|
|
4
|
-
DEVICE_FLOW_FAILED:
|
|
5
|
-
WRONG_ACCOUNT:
|
|
6
|
-
UNKNOWN:
|
|
4
|
+
NOT_CONNECTED: msg `This instance is not connected to a FUTO Backups account yet.`,
|
|
5
|
+
DEVICE_FLOW_FAILED: msg `Login was cancelled or timed out.`,
|
|
6
|
+
WRONG_ACCOUNT: msg `That account does not own this instance. Log in with the account it was connected with.`,
|
|
7
|
+
UNKNOWN: msg `Could not reach FUTO Backups. Check your connection.`,
|
|
7
8
|
};
|
|
8
9
|
export function createDeviceFlow(kind, handlers) {
|
|
9
10
|
const state = $state({
|
|
@@ -47,7 +48,7 @@ export function createDeviceFlow(kind, handlers) {
|
|
|
47
48
|
stop();
|
|
48
49
|
state.pending = false;
|
|
49
50
|
state.userCode = undefined;
|
|
50
|
-
state.error = failures[event.reason ?? 'UNKNOWN'];
|
|
51
|
+
state.error = gt(failures[event.reason ?? 'UNKNOWN']);
|
|
51
52
|
handlers.onFailure?.(state.error);
|
|
52
53
|
break;
|
|
53
54
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { sdk } from '..';
|
|
2
2
|
import { handleError } from '../utils/handle-error';
|
|
3
|
+
import { gt } from 'svelte-i18n-lingui';
|
|
3
4
|
export const handleGetFileListing = async (path) => {
|
|
4
5
|
try {
|
|
5
6
|
return await sdk.getFileListing({ path });
|
|
6
7
|
}
|
|
7
8
|
catch (error) {
|
|
8
|
-
handleError(error,
|
|
9
|
+
handleError(error, gt `Failed to load directory listing`);
|
|
9
10
|
throw error;
|
|
10
11
|
}
|
|
11
12
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ActionItem } from '@immich/ui';
|
|
2
2
|
import { type ConfigureImmichDatabaseDumpRequestDto } from '../fetch-client';
|
|
3
|
-
|
|
3
|
+
import { gt } from 'svelte-i18n-lingui';
|
|
4
|
+
export declare const getBackupPageActions: (repositoryId: string | undefined, onConfigure: () => void, t: typeof gt) => {
|
|
4
5
|
Configure: ActionItem;
|
|
5
6
|
ViewRecoveryKey: ActionItem;
|
|
6
7
|
BackUpNow: ActionItem;
|
|
@@ -7,19 +7,20 @@ import { handleError } from '../utils/handle-error';
|
|
|
7
7
|
import { getBackupOutcome } from '../utils/backup-status';
|
|
8
8
|
import { createMutation, createQuery } from '@tanstack/svelte-query';
|
|
9
9
|
import { handleCreateBackup } from './repository.service';
|
|
10
|
-
|
|
10
|
+
import { gt, msg } from 'svelte-i18n-lingui';
|
|
11
|
+
export const getBackupPageActions = (repositoryId, onConfigure, t) => {
|
|
11
12
|
const Configure = {
|
|
12
|
-
title:
|
|
13
|
+
title: t(msg `Configure`),
|
|
13
14
|
icon: mdiCogOutline,
|
|
14
15
|
onAction: onConfigure,
|
|
15
16
|
};
|
|
16
17
|
const ViewRecoveryKey = {
|
|
17
|
-
title:
|
|
18
|
+
title: t(msg `View recovery key`),
|
|
18
19
|
icon: mdiKeyOutline,
|
|
19
20
|
onAction: () => void modalManager.show(BackupsRecoveryKeyModal, {}),
|
|
20
21
|
};
|
|
21
22
|
const BackUpNow = {
|
|
22
|
-
title:
|
|
23
|
+
title: t(msg `Back up now`),
|
|
23
24
|
icon: mdiCloudUploadOutline,
|
|
24
25
|
onAction: () => void handleCreateBackup(repositoryId),
|
|
25
26
|
$if: () => typeof repositoryId === 'string',
|
|
@@ -94,7 +95,7 @@ export const useConfigureImmichDatabaseDump = () => createMutation(() => ({
|
|
|
94
95
|
...data,
|
|
95
96
|
databaseDump: data.databaseDump && { ...data.databaseDump, ...dto },
|
|
96
97
|
})),
|
|
97
|
-
onError: (error) => handleError(error,
|
|
98
|
+
onError: (error) => handleError(error, gt `Failed to update Immich database dump settings`),
|
|
98
99
|
}), () => queryClient);
|
|
99
100
|
export const useIgnoreImmichDatabaseDumpWarning = () => createMutation(() => ({
|
|
100
101
|
mutationFn: () => ignoreImmichDatabaseDumpWarning(),
|
|
@@ -102,5 +103,5 @@ export const useIgnoreImmichDatabaseDumpWarning = () => createMutation(() => ({
|
|
|
102
103
|
...data,
|
|
103
104
|
databaseDumpWarningIgnored: true,
|
|
104
105
|
})),
|
|
105
|
-
onError: (error) => handleError(error,
|
|
106
|
+
onError: (error) => handleError(error, gt `Failed to ignore Immich database dump warning`),
|
|
106
107
|
}), () => queryClient);
|
|
@@ -3,6 +3,7 @@ import { configureImmichIntegration, getIntegrations, } from '../fetch-client';
|
|
|
3
3
|
import { queryClient } from '../query-client';
|
|
4
4
|
import { handleError } from '../utils/handle-error';
|
|
5
5
|
import { createMutation, createQuery } from '@tanstack/svelte-query';
|
|
6
|
+
import { gt } from 'svelte-i18n-lingui';
|
|
6
7
|
export const IMMICH_DEFAULT_CRON = '0 3 * * *';
|
|
7
8
|
export const integrationsKeys = {
|
|
8
9
|
all: ['integrations'],
|
|
@@ -18,13 +19,13 @@ export const useIntegrationEventHandler = () => ({
|
|
|
18
19
|
});
|
|
19
20
|
export const useConfigureImmichIntegration = () => createMutation(() => ({
|
|
20
21
|
mutationFn: (dto) => configureImmichIntegration(dto),
|
|
21
|
-
onError: (error) => handleError(error,
|
|
22
|
+
onError: (error) => handleError(error, gt `Failed to save backup settings`),
|
|
22
23
|
}), () => queryClient);
|
|
23
24
|
export const useConfigureAndStartImmichIntegration = () => createMutation(() => ({
|
|
24
25
|
mutationFn: async () => {
|
|
25
26
|
const { immichState } = await getIntegrations();
|
|
26
27
|
if (!immichState) {
|
|
27
|
-
throw new Error(
|
|
28
|
+
throw new Error(gt `No Immich instance detected.`);
|
|
28
29
|
}
|
|
29
30
|
const { repositoryId } = await configureImmichIntegration({
|
|
30
31
|
name: 'Immich',
|
|
@@ -36,5 +37,5 @@ export const useConfigureAndStartImmichIntegration = () => createMutation(() =>
|
|
|
36
37
|
});
|
|
37
38
|
return { repositoryId };
|
|
38
39
|
},
|
|
39
|
-
onError: (error) => handleError(error,
|
|
40
|
+
onError: (error) => handleError(error, gt `Failed to create backup`),
|
|
40
41
|
}), () => queryClient);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { getProvider } from '../providers';
|
|
2
2
|
import { formatDuration } from '../utils/format';
|
|
3
3
|
import debounce from 'lodash.debounce';
|
|
4
|
+
import { gt } from 'svelte-i18n-lingui';
|
|
4
5
|
const formatErrorEvent = (event) => {
|
|
5
6
|
const text = (typeof event.error === 'string' ? event.error : event.error?.message) ??
|
|
6
7
|
event.message ??
|
|
7
|
-
|
|
8
|
+
gt `Unknown error`;
|
|
8
9
|
const context = [event.during, event.item].filter(Boolean).join(' ');
|
|
9
10
|
return context ? `${context}: ${text}` : text;
|
|
10
11
|
};
|
|
@@ -39,8 +40,13 @@ export function createLogObserver(logId) {
|
|
|
39
40
|
(event.bytes_done && event.total_bytes
|
|
40
41
|
? event.bytes_done < event.total_bytes
|
|
41
42
|
: event.percent_done < 100)
|
|
42
|
-
?
|
|
43
|
-
|
|
43
|
+
? gt({
|
|
44
|
+
message: '{duration} remaining',
|
|
45
|
+
values: {
|
|
46
|
+
duration: formatDuration(event.seconds_remaining * 1000),
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
: gt `Nearly done.`,
|
|
44
50
|
currentFiles: event.current_files ?? [],
|
|
45
51
|
};
|
|
46
52
|
flush();
|
|
@@ -2,6 +2,7 @@ import { sdk } from '..';
|
|
|
2
2
|
import { queryClient } from '../query-client';
|
|
3
3
|
import { handleError } from '../utils/handle-error';
|
|
4
4
|
import { createMutation, createQuery } from '@tanstack/svelte-query';
|
|
5
|
+
import { gt } from 'svelte-i18n-lingui';
|
|
5
6
|
export const recoveryKeyKeys = {
|
|
6
7
|
all: ['recovery-key'],
|
|
7
8
|
};
|
|
@@ -14,7 +15,7 @@ export const handleOnboardingStatus = async () => {
|
|
|
14
15
|
return await sdk.onboardingStatus();
|
|
15
16
|
}
|
|
16
17
|
catch (error) {
|
|
17
|
-
handleError(error,
|
|
18
|
+
handleError(error, gt `Failed to load onboarding status`);
|
|
18
19
|
throw error;
|
|
19
20
|
}
|
|
20
21
|
};
|
|
@@ -23,7 +24,7 @@ export const handleCurrentRecoveryKey = async () => {
|
|
|
23
24
|
return await sdk.currentRecoveryKey();
|
|
24
25
|
}
|
|
25
26
|
catch (error) {
|
|
26
|
-
handleError(error,
|
|
27
|
+
handleError(error, gt `Failed to load recovery key`);
|
|
27
28
|
throw error;
|
|
28
29
|
}
|
|
29
30
|
};
|
|
@@ -32,7 +33,7 @@ export const handleConfirmRecoveryKey = async () => {
|
|
|
32
33
|
await sdk.confirmRecoveryKey();
|
|
33
34
|
}
|
|
34
35
|
catch (error) {
|
|
35
|
-
handleError(error,
|
|
36
|
+
handleError(error, gt `Failed to confirm recovery key`);
|
|
36
37
|
throw error;
|
|
37
38
|
}
|
|
38
39
|
};
|
|
@@ -41,7 +42,7 @@ export const handleImportRecoveryKey = async (dto) => {
|
|
|
41
42
|
await sdk.importRecoveryKey(dto);
|
|
42
43
|
}
|
|
43
44
|
catch (error) {
|
|
44
|
-
handleError(error,
|
|
45
|
+
handleError(error, gt `Failed to import recovery key`);
|
|
45
46
|
throw error;
|
|
46
47
|
}
|
|
47
48
|
};
|
|
@@ -50,15 +51,15 @@ export const handleSkipOnboardingExtraConfig = async () => {
|
|
|
50
51
|
await sdk.skipOnboardingExtraConfig();
|
|
51
52
|
}
|
|
52
53
|
catch (error) {
|
|
53
|
-
handleError(error,
|
|
54
|
+
handleError(error, gt `Failed to save preferences`);
|
|
54
55
|
throw error;
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
export const useEnableTelemetry = () => createMutation(() => ({
|
|
58
59
|
mutationFn: () => sdk.enableTelemetry(),
|
|
59
|
-
onError: (error) => handleError(error,
|
|
60
|
+
onError: (error) => handleError(error, gt `Failed to save preferences`),
|
|
60
61
|
}), () => queryClient);
|
|
61
62
|
export const useReportError = () => createMutation(() => ({
|
|
62
63
|
mutationFn: () => sdk.reportError(),
|
|
63
|
-
onError: (error) => handleError(error,
|
|
64
|
+
onError: (error) => handleError(error, gt `Failed to report error`),
|
|
64
65
|
}), () => queryClient);
|
|
@@ -2,6 +2,7 @@ import { sdk } from '..';
|
|
|
2
2
|
import { SocketEvent } from '../events';
|
|
3
3
|
import { type InspectedLocalRepositoryDto, type LocalRepositoryDto, type RepositoryUpdateRequestDto } from '../fetch-client';
|
|
4
4
|
import { type ActionItem } from '@immich/ui';
|
|
5
|
+
import { gt } from 'svelte-i18n-lingui';
|
|
5
6
|
export declare const repositoryKeys: {
|
|
6
7
|
all: readonly ["repositories"];
|
|
7
8
|
inspect: (backendId?: string) => readonly ["repositories", "inspect", string | undefined];
|
|
@@ -40,7 +41,7 @@ export declare const handleCreateBackup: (id: string) => Promise<sdk.LogResponse
|
|
|
40
41
|
export declare const handlePruneRepository: (id: string) => Promise<sdk.LogResponseDto>;
|
|
41
42
|
export declare const handleDeleteRepository: (repositoryId: string, local?: boolean) => Promise<void>;
|
|
42
43
|
export declare const handleDisableWormRepository: (repositoryId: string, local?: boolean) => Promise<void>;
|
|
43
|
-
export declare const getRepositoryActions: (repository: LocalRepositoryDto, local?: boolean) => {
|
|
44
|
+
export declare const getRepositoryActions: (repository: LocalRepositoryDto, t: typeof gt, local?: boolean) => {
|
|
44
45
|
BackupNow: ActionItem;
|
|
45
46
|
Snapshots: ActionItem;
|
|
46
47
|
History: ActionItem;
|
|
@@ -14,6 +14,7 @@ import { createTicket } from '@futo-org/backups-api-client';
|
|
|
14
14
|
import { modalManager, toastManager } from '@immich/ui';
|
|
15
15
|
import { mdiCog, mdiFormatListBulletedType, mdiHistory, mdiImport, mdiListStatus, mdiPlay, mdiTrashCan, } from '@mdi/js';
|
|
16
16
|
import { createMutation, createQuery } from '@tanstack/svelte-query';
|
|
17
|
+
import { gt, msg } from 'svelte-i18n-lingui';
|
|
17
18
|
export const repositoryKeys = {
|
|
18
19
|
all: ['repositories'],
|
|
19
20
|
inspect: (backendId) => ['repositories', 'inspect', backendId],
|
|
@@ -63,23 +64,23 @@ export const useCheckImportRepository = (id, backendId) => createQuery(() => ({
|
|
|
63
64
|
}), () => queryClient);
|
|
64
65
|
export const useCreateRepository = () => createMutation(() => ({
|
|
65
66
|
mutationFn: (dto) => sdk.createRepository(dto),
|
|
66
|
-
onError: (error) => handleError(error,
|
|
67
|
+
onError: (error) => handleError(error, gt `Failed to create repository`),
|
|
67
68
|
}), () => queryClient);
|
|
68
69
|
export const useImportRepository = () => createMutation(() => ({
|
|
69
70
|
mutationFn: ({ id, backendId }) => sdk.importRepository(id, backendId),
|
|
70
|
-
onError: (error) => handleError(error,
|
|
71
|
+
onError: (error) => handleError(error, gt `Failed to import repository`),
|
|
71
72
|
}), () => queryClient);
|
|
72
73
|
export const useUpdateRepository = () => createMutation(() => ({
|
|
73
74
|
mutationFn: ({ id, dto, local = false, }) => (local ? sdk.updateRepository(id, dto) : updateRepository(id, dto)),
|
|
74
|
-
onError: (error) => handleError(error,
|
|
75
|
+
onError: (error) => handleError(error, gt `Failed to update repository`),
|
|
75
76
|
}), () => queryClient);
|
|
76
77
|
export const useReconfigureRepositoryPrimaryBackend = () => createMutation(() => ({
|
|
77
78
|
mutationFn: ({ id, backendId }) => reconfigureRepositoryPrimaryBackend(id, { backendId }),
|
|
78
|
-
onError: (error) => handleError(error,
|
|
79
|
+
onError: (error) => handleError(error, gt `Failed to reconfigure backend`),
|
|
79
80
|
}), () => queryClient);
|
|
80
81
|
export const handleCreateBackup = async (id) => {
|
|
81
82
|
try {
|
|
82
|
-
toastManager.info(
|
|
83
|
+
toastManager.info(gt `Started backup`);
|
|
83
84
|
const response = await sdk.createBackup(id);
|
|
84
85
|
void modalManager.open(ViewStatusModal, {
|
|
85
86
|
logId: response.logId,
|
|
@@ -88,13 +89,13 @@ export const handleCreateBackup = async (id) => {
|
|
|
88
89
|
return response;
|
|
89
90
|
}
|
|
90
91
|
catch (error) {
|
|
91
|
-
handleError(error,
|
|
92
|
+
handleError(error, gt `Failed to start backup`);
|
|
92
93
|
throw error;
|
|
93
94
|
}
|
|
94
95
|
};
|
|
95
96
|
export const handlePruneRepository = async (id) => {
|
|
96
97
|
try {
|
|
97
|
-
toastManager.info(
|
|
98
|
+
toastManager.info(gt `Cleaning up old backups`);
|
|
98
99
|
const response = await sdk.pruneRepository(id);
|
|
99
100
|
void modalManager.open(ViewStatusModal, {
|
|
100
101
|
logId: response.logId,
|
|
@@ -103,7 +104,7 @@ export const handlePruneRepository = async (id) => {
|
|
|
103
104
|
return response;
|
|
104
105
|
}
|
|
105
106
|
catch (error) {
|
|
106
|
-
handleError(error,
|
|
107
|
+
handleError(error, gt `Failed to start cleanup`);
|
|
107
108
|
throw error;
|
|
108
109
|
}
|
|
109
110
|
};
|
|
@@ -117,7 +118,7 @@ export const handleDeleteRepository = async (repositoryId, local) => {
|
|
|
117
118
|
window.open(redirectTo, '_blank');
|
|
118
119
|
}
|
|
119
120
|
catch (error) {
|
|
120
|
-
handleError(error,
|
|
121
|
+
handleError(error, gt `Failed to start deletion`);
|
|
121
122
|
throw error;
|
|
122
123
|
}
|
|
123
124
|
};
|
|
@@ -131,33 +132,33 @@ export const handleDisableWormRepository = async (repositoryId, local) => {
|
|
|
131
132
|
window.open(redirectTo, '_blank');
|
|
132
133
|
}
|
|
133
134
|
catch (error) {
|
|
134
|
-
handleError(error,
|
|
135
|
+
handleError(error, gt `Failed to start disable write-only process`);
|
|
135
136
|
throw error;
|
|
136
137
|
}
|
|
137
138
|
};
|
|
138
|
-
export const getRepositoryActions = (repository, local) => {
|
|
139
|
+
export const getRepositoryActions = (repository, t, local) => {
|
|
139
140
|
const online = Boolean(repository.configuration && repository.backends?.primary.online);
|
|
140
141
|
const configured = Boolean(repository.configuration);
|
|
141
142
|
const BackupNow = {
|
|
142
|
-
title:
|
|
143
|
+
title: t(msg `Back up now`),
|
|
143
144
|
icon: mdiPlay,
|
|
144
145
|
onAction: () => void handleCreateBackup(repository.id),
|
|
145
146
|
$if: () => online,
|
|
146
147
|
};
|
|
147
148
|
const Snapshots = {
|
|
148
|
-
title:
|
|
149
|
+
title: t(msg `Snapshots`),
|
|
149
150
|
icon: mdiFormatListBulletedType,
|
|
150
151
|
onAction: () => void modalManager.open(SnapshotsListModal, { repository }),
|
|
151
152
|
$if: () => online,
|
|
152
153
|
};
|
|
153
154
|
const History = {
|
|
154
|
-
title:
|
|
155
|
+
title: t(msg `Logs`),
|
|
155
156
|
icon: mdiListStatus,
|
|
156
157
|
onAction: () => void modalManager.open(RunHistoryModal, { repository }),
|
|
157
158
|
$if: () => configured,
|
|
158
159
|
};
|
|
159
160
|
const Configure = {
|
|
160
|
-
title:
|
|
161
|
+
title: t(msg `Configure`),
|
|
161
162
|
icon: mdiCog,
|
|
162
163
|
onAction: () => void modalManager.open(ConfigureRepositoryModal, {
|
|
163
164
|
repository: { ...repository, configuration: repository.configuration },
|
|
@@ -165,19 +166,19 @@ export const getRepositoryActions = (repository, local) => {
|
|
|
165
166
|
$if: () => configured,
|
|
166
167
|
};
|
|
167
168
|
const Import = {
|
|
168
|
-
title:
|
|
169
|
+
title: t(msg `Import`),
|
|
169
170
|
icon: mdiImport,
|
|
170
171
|
onAction: () => void modalManager.open(ImportRepositoryModal, { repository }),
|
|
171
172
|
$if: () => Boolean(repository.backends && !repository.configuration),
|
|
172
173
|
};
|
|
173
174
|
const MetricsHistory = {
|
|
174
|
-
title:
|
|
175
|
+
title: t(msg `Metrics history`),
|
|
175
176
|
icon: mdiHistory,
|
|
176
177
|
onAction: () => void modalManager.open(MetricsHistoryModal, { repository }),
|
|
177
178
|
$if: () => !repository.backends,
|
|
178
179
|
};
|
|
179
180
|
const Delete = {
|
|
180
|
-
title:
|
|
181
|
+
title: t(msg `Delete repository`),
|
|
181
182
|
icon: mdiTrashCan,
|
|
182
183
|
onAction: () => void handleDeleteRepository(repository.id, local),
|
|
183
184
|
$if: () => !repository.backends || repository.backends.primary.type === 'yucca',
|
|
@@ -2,6 +2,7 @@ import { sdk } from '..';
|
|
|
2
2
|
import { SocketEvent } from '../events';
|
|
3
3
|
import { type RunDto } from '../fetch-client';
|
|
4
4
|
import { type ActionItem } from '@immich/ui';
|
|
5
|
+
import { gt } from 'svelte-i18n-lingui';
|
|
5
6
|
export declare const runHistoryKeys: {
|
|
6
7
|
byRepository: (id: string) => readonly ["runHistory", string];
|
|
7
8
|
};
|
|
@@ -21,7 +22,7 @@ export declare const useRunEventHandler: () => {
|
|
|
21
22
|
}>): void;
|
|
22
23
|
};
|
|
23
24
|
export declare const handleGetRunHistory: (id: string) => Promise<sdk.RunHistoryResponseDto>;
|
|
24
|
-
export declare const getRunActions: (run: RunDto) => {
|
|
25
|
+
export declare const getRunActions: (run: RunDto, t: typeof gt) => {
|
|
25
26
|
ViewLog: ActionItem;
|
|
26
27
|
DownloadLog: ActionItem;
|
|
27
28
|
};
|
|
@@ -7,6 +7,7 @@ import { queryClient } from '../query-client';
|
|
|
7
7
|
import { handleError } from '../utils/handle-error';
|
|
8
8
|
import { modalManager } from '@immich/ui';
|
|
9
9
|
import { createQuery } from '@tanstack/svelte-query';
|
|
10
|
+
import { gt, msg } from 'svelte-i18n-lingui';
|
|
10
11
|
export const runHistoryKeys = {
|
|
11
12
|
byRepository: (id) => ['runHistory', id],
|
|
12
13
|
};
|
|
@@ -43,17 +44,17 @@ export const handleGetRunHistory = async (id) => {
|
|
|
43
44
|
return await sdk.getRunHistory(id);
|
|
44
45
|
}
|
|
45
46
|
catch (error) {
|
|
46
|
-
handleError(error,
|
|
47
|
+
handleError(error, gt `Failed to load run history`);
|
|
47
48
|
throw error;
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
|
-
export const getRunActions = (run) => {
|
|
51
|
+
export const getRunActions = (run, t) => {
|
|
51
52
|
const ViewLog = {
|
|
52
|
-
title:
|
|
53
|
+
title: t(msg `View Log`),
|
|
53
54
|
onAction: () => void modalManager.open(ViewStatusModal, { logId: run.id }),
|
|
54
55
|
};
|
|
55
56
|
const DownloadLog = {
|
|
56
|
-
title:
|
|
57
|
+
title: t(msg `Download Full Log`),
|
|
57
58
|
onAction: () => window.open(`${getProvider().baseUrl}/api/yucca/logs/${run.id}/download`, '_blank'),
|
|
58
59
|
};
|
|
59
60
|
return { ViewLog, DownloadLog };
|
|
@@ -2,6 +2,7 @@ import { sdk } from '..';
|
|
|
2
2
|
import { type ScheduleDto, type ScheduleUpdateRequestDto } from '../fetch-client';
|
|
3
3
|
import { SocketEvent } from '../events';
|
|
4
4
|
import { type ActionItem } from '@immich/ui';
|
|
5
|
+
import { gt } from 'svelte-i18n-lingui';
|
|
5
6
|
export declare const scheduleKeys: {
|
|
6
7
|
all: readonly ["schedules"];
|
|
7
8
|
};
|
|
@@ -27,7 +28,7 @@ export declare const useUpdateSchedule: () => import("@tanstack/svelte-query").C
|
|
|
27
28
|
export declare const handlePauseSchedule: (id: string, name: string) => Promise<void>;
|
|
28
29
|
export declare const handleResumeSchedule: (id: string, name: string) => Promise<void>;
|
|
29
30
|
export declare const handleRemoveSchedule: (id: string, name: string) => Promise<void>;
|
|
30
|
-
export declare const getScheduleActions: (schedule: ScheduleDto) => {
|
|
31
|
+
export declare const getScheduleActions: (schedule: ScheduleDto, t: typeof gt) => {
|
|
31
32
|
Resume: ActionItem;
|
|
32
33
|
Pause: ActionItem;
|
|
33
34
|
Configure: ActionItem;
|