@futo-org/backups-orchestrator-ui 0.14.1 → 0.15.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.
@@ -13,9 +13,10 @@
13
13
 
14
14
  type Props = {
15
15
  repository: LocalRepositoryDto;
16
+ immich?: boolean;
16
17
  };
17
18
 
18
- let { repository }: Props = $props();
19
+ let { repository, immich = false }: Props = $props();
19
20
 
20
21
  const { advanced } = options;
21
22
  // svelte-ignore state_referenced_locally
@@ -35,7 +36,11 @@
35
36
  <Text class="text-center py-6" color="muted">No backups yet</Text>
36
37
  {:else}
37
38
  {#each snapshots as snapshot (snapshot.id)}
38
- <RepositorySnapshotsListItem repositoryId={repository.id} {snapshot} />
39
+ <RepositorySnapshotsListItem
40
+ repositoryId={repository.id}
41
+ {snapshot}
42
+ {immich}
43
+ />
39
44
  {/each}
40
45
  {/if}
41
46
  {/snippet}
@@ -1,6 +1,7 @@
1
1
  import type { LocalRepositoryDto } from "../../../fetch-client";
2
2
  type Props = {
3
3
  repository: LocalRepositoryDto;
4
+ immich?: boolean;
4
5
  };
5
6
  declare const RepositorySnapshotsList: import("svelte").Component<Props, {}, "">;
6
7
  type RepositorySnapshotsList = ReturnType<typeof RepositorySnapshotsList>;
@@ -8,15 +8,16 @@
8
8
  type Props = {
9
9
  repositoryId: string;
10
10
  snapshot: SnapshotDto;
11
+ immich?: boolean;
11
12
  };
12
13
 
13
- const { repositoryId, snapshot }: Props = $props();
14
- const { Restore, Delete } = $derived(
15
- getSnapshotActions(repositoryId, snapshot),
14
+ const { repositoryId, snapshot, immich = false }: Props = $props();
15
+ const { Restore, Rollback, Delete } = $derived(
16
+ getSnapshotActions(repositoryId, snapshot, immich),
16
17
  );
17
18
  </script>
18
19
 
19
- <StackListItem actions={[Restore, Delete]}>
20
+ <StackListItem actions={[Restore, Rollback, Delete]}>
20
21
  <HStack>
21
22
  <RelativeTime time={snapshot.time} />
22
23
 
@@ -2,6 +2,7 @@ import type { SnapshotDto } from "../../../fetch-client";
2
2
  type Props = {
3
3
  repositoryId: string;
4
4
  snapshot: SnapshotDto;
5
+ immich?: boolean;
5
6
  };
6
7
  declare const RepositorySnapshotsListItem: import("svelte").Component<Props, {}, "">;
7
8
  type RepositorySnapshotsListItem = ReturnType<typeof RepositorySnapshotsListItem>;
@@ -70,7 +70,7 @@
70
70
  <ImmichManageBackupOverview {repository} {schedule} />
71
71
  <BackendsList {repository} />
72
72
  <RepositoryRunHistory {repository} />
73
- <RepositorySnapshotsList {repository} />
73
+ <RepositorySnapshotsList {repository} immich />
74
74
  </Stack>
75
75
  {/if}
76
76
  </Container>
@@ -82,6 +82,11 @@ export type ConfigureImmichIntegrationRequestDto = {
82
82
  libraries: "all" | string[];
83
83
  retentionPolicy?: (RetentionPolicyDto) | null;
84
84
  };
85
+ export type ImmichRollbackRequestDto = {
86
+ repositoryId: string;
87
+ snapshotId: string;
88
+ backupFileName?: string;
89
+ };
85
90
  export type BootstrapStatus = "not-ready" | "ready" | "error";
86
91
  export type TelemetryLevel = "full" | "none";
87
92
  export type OnboardingStatusResponseDto = {
@@ -269,6 +274,7 @@ export declare function getFileListing({ path }?: {
269
274
  }, opts?: Oazapfts.RequestOpts): Promise<FilesystemListingResponseDto>;
270
275
  export declare function getIntegrations(opts?: Oazapfts.RequestOpts): Promise<IntegrationsResponseDto>;
271
276
  export declare function configureImmichIntegration(configureImmichIntegrationRequestDto: ConfigureImmichIntegrationRequestDto, opts?: Oazapfts.RequestOpts): Promise<never>;
277
+ export declare function startImmichRollback(immichRollbackRequestDto: ImmichRollbackRequestDto, opts?: Oazapfts.RequestOpts): Promise<never>;
272
278
  export declare function onboardingStatus(opts?: Oazapfts.RequestOpts): Promise<OnboardingStatusResponseDto>;
273
279
  export declare function currentRecoveryKey(opts?: Oazapfts.RequestOpts): Promise<CurrentRecoveryKeyResponse>;
274
280
  export declare function importRecoveryKey(importRecoveryKeyRequest: ImportRecoveryKeyRequest, opts?: Oazapfts.RequestOpts): Promise<never>;
@@ -56,6 +56,13 @@ export function configureImmichIntegration(configureImmichIntegrationRequestDto,
56
56
  body: configureImmichIntegrationRequestDto
57
57
  })));
58
58
  }
59
+ export function startImmichRollback(immichRollbackRequestDto, opts) {
60
+ return oazapfts.ok(oazapfts.fetchText("/api/yucca/integrations/immich/rollback", oazapfts.json({
61
+ ...opts,
62
+ method: "POST",
63
+ body: immichRollbackRequestDto
64
+ })));
65
+ }
59
66
  export function onboardingStatus(opts) {
60
67
  return oazapfts.ok(oazapfts.fetchJson("/api/yucca/onboarding", {
61
68
  ...opts
@@ -22,8 +22,10 @@ export declare const useRestoreSnapshot: () => import("@tanstack/svelte-query").
22
22
  }, unknown>;
23
23
  export declare const handleRestoreFromPoint: (repositoryId: string, snapshotId: string, backendId: string, options: RepositorySnapshotRestoreFromPointRequestDto) => Promise<sdk.LogResponseDto>;
24
24
  export declare const handleForgetSnapshot: (repositoryId: string, snapshotId: string) => Promise<void>;
25
+ export declare const useRollbackSnapshot: () => import("@tanstack/svelte-query").CreateMutationResult<never, Error, sdk.ImmichRollbackRequestDto, unknown>;
25
26
  export declare const handleGetSnapshotListing: (id: string, snapshotId: string, path?: string) => Promise<sdk.FilesystemListingResponseDto>;
26
- export declare const getSnapshotActions: (repositoryId: string, snapshot: SnapshotDto) => {
27
+ export declare const getSnapshotActions: (repositoryId: string, snapshot: SnapshotDto, immich?: boolean) => {
27
28
  Restore: ActionItem;
29
+ Rollback: ActionItem;
28
30
  Delete: ActionItem;
29
31
  };
@@ -5,7 +5,7 @@ import { getSnapshots, } from '../fetch-client';
5
5
  import { queryClient } from '../query-client';
6
6
  import { handleError } from '../utils/handle-error';
7
7
  import { modalManager, toastManager } from '@immich/ui';
8
- import { mdiBackupRestore, mdiDeleteOutline } from '@mdi/js';
8
+ import { mdiBackupRestore, mdiDeleteOutline, mdiHistory } from '@mdi/js';
9
9
  import { createMutation, createQuery } from '@tanstack/svelte-query';
10
10
  export const snapshotKeys = {
11
11
  byRepository: (id) => ['snapshots', id],
@@ -68,6 +68,10 @@ export const handleForgetSnapshot = async (repositoryId, snapshotId) => {
68
68
  });
69
69
  }
70
70
  };
71
+ export const useRollbackSnapshot = () => createMutation(() => ({
72
+ mutationFn: (dto) => sdk.startImmichRollback(dto),
73
+ onError: (error) => handleError(error, 'Failed to start rollback'),
74
+ }), () => queryClient);
71
75
  export const handleGetSnapshotListing = async (id, snapshotId, path) => {
72
76
  try {
73
77
  return await sdk.getSnapshotListing(id, snapshotId, { path });
@@ -77,8 +81,9 @@ export const handleGetSnapshotListing = async (id, snapshotId, path) => {
77
81
  throw error;
78
82
  }
79
83
  };
80
- export const getSnapshotActions = (repositoryId, snapshot) => {
84
+ export const getSnapshotActions = (repositoryId, snapshot, immich) => {
81
85
  const removeSnapshot = useRemoveSnapshot(repositoryId);
86
+ const rollback = useRollbackSnapshot();
82
87
  const Restore = {
83
88
  title: 'Restore',
84
89
  icon: mdiBackupRestore,
@@ -87,6 +92,12 @@ export const getSnapshotActions = (repositoryId, snapshot) => {
87
92
  snapshot: snapshot.id,
88
93
  }),
89
94
  };
95
+ const Rollback = {
96
+ title: 'Rollback',
97
+ icon: mdiHistory,
98
+ onAction: () => rollback.mutate({ repositoryId, snapshotId: snapshot.id }),
99
+ $if: () => immich === true,
100
+ };
90
101
  const Delete = {
91
102
  title: 'Delete',
92
103
  icon: mdiDeleteOutline,
@@ -104,5 +115,5 @@ export const getSnapshotActions = (repositoryId, snapshot) => {
104
115
  removeSnapshot(snapshot.id);
105
116
  },
106
117
  };
107
- return { Restore, Delete };
118
+ return { Restore, Rollback, Delete };
108
119
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@futo-org/backups-orchestrator-ui",
3
3
  "repository": "https://github.com/immich-app/yucca",
4
4
  "description": "Backups orchestrator (UI library)",
5
- "version": "0.14.1",
5
+ "version": "0.15.0",
6
6
  "license": "Source First License 1.1",
7
7
  "files": [
8
8
  "dist",
@@ -64,7 +64,7 @@
64
64
  "lodash.debounce": "^4.0.8",
65
65
  "luxon": "^3.7.2",
66
66
  "socket.io-client": "^4.8.3",
67
- "@futo-org/backups-api-client": "^0.14.1"
67
+ "@futo-org/backups-api-client": "^0.15.0"
68
68
  },
69
69
  "scripts": {
70
70
  "dev": "vite dev --port 5174",