diff --git a/.gitignore b/.gitignore index 6d1d89b2..f5ebc411 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ playwright/temp # OpenAPI error logs openapi-ts-error-*.log .output +tmp/ diff --git a/app/client/api-client/types.gen.ts b/app/client/api-client/types.gen.ts index 9ac44460..8e135a75 100644 --- a/app/client/api-client/types.gen.ts +++ b/app/client/api-client/types.gen.ts @@ -841,7 +841,7 @@ export type ListRepositoriesResponses = { } | { backend: "local"; - name: string; + path: string; cacert?: string; customPassword?: string; downloadLimit?: { @@ -851,7 +851,6 @@ export type ListRepositoriesResponses = { }; insecureTls?: boolean; isExistingRepository?: boolean; - path?: string; uploadLimit?: { unit?: "Gbps" | "Kbps" | "Mbps"; value?: number; @@ -1034,7 +1033,7 @@ export type CreateRepositoryData = { } | { backend: "local"; - name: string; + path: string; cacert?: string; customPassword?: string; downloadLimit?: { @@ -1044,7 +1043,6 @@ export type CreateRepositoryData = { }; insecureTls?: boolean; isExistingRepository?: boolean; - path?: string; uploadLimit?: { unit?: "Gbps" | "Kbps" | "Mbps"; value?: number; @@ -1279,7 +1277,7 @@ export type GetRepositoryResponses = { } | { backend: "local"; - name: string; + path: string; cacert?: string; customPassword?: string; downloadLimit?: { @@ -1289,7 +1287,6 @@ export type GetRepositoryResponses = { }; insecureTls?: boolean; isExistingRepository?: boolean; - path?: string; uploadLimit?: { unit?: "Gbps" | "Kbps" | "Mbps"; value?: number; @@ -1387,6 +1384,172 @@ export type GetRepositoryResponse = GetRepositoryResponses[keyof GetRepositoryRe export type UpdateRepositoryData = { body?: { compressionMode?: "auto" | "max" | "off"; + config?: + | { + accessKeyId: string; + backend: "r2"; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + } + | { + accessKeyId: string; + backend: "s3"; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + } + | { + accountKey: string; + accountName: string; + backend: "azure"; + container: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + endpointSuffix?: string; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + } + | { + backend: "gcs"; + bucket: string; + credentialsJson: string; + projectId: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + } + | { + backend: "local"; + path: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + } + | { + backend: "rclone"; + path: string; + remote: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + } + | { + backend: "rest"; + url: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + password?: string; + path?: string; + uploadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + username?: string; + } + | { + backend: "sftp"; + host: string; + path: string; + privateKey: string; + user: string; + port?: number; + skipHostKeyCheck?: boolean; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + knownHosts?: string; + uploadLimit?: { + unit?: "Gbps" | "Kbps" | "Mbps"; + value?: number; + enabled?: boolean; + }; + }; name?: string; }; path: { @@ -1397,6 +1560,10 @@ export type UpdateRepositoryData = { }; export type UpdateRepositoryErrors = { + /** + * Invalid repository update payload + */ + 400: unknown; /** * Repository not found */ @@ -1499,7 +1666,7 @@ export type UpdateRepositoryResponses = { } | { backend: "local"; - name: string; + path: string; cacert?: string; customPassword?: string; downloadLimit?: { @@ -1509,7 +1676,6 @@ export type UpdateRepositoryResponses = { }; insecureTls?: boolean; isExistingRepository?: boolean; - path?: string; uploadLimit?: { unit?: "Gbps" | "Kbps" | "Mbps"; value?: number; @@ -2077,7 +2243,7 @@ export type ListBackupSchedulesResponses = { } | { backend: "local"; - name: string; + path: string; cacert?: string; customPassword?: string; downloadLimit?: { @@ -2087,7 +2253,6 @@ export type ListBackupSchedulesResponses = { }; insecureTls?: boolean; isExistingRepository?: boolean; - path?: string; uploadLimit?: { unit?: "Gbps" | "Kbps" | "Mbps"; value?: number; @@ -2460,7 +2625,7 @@ export type GetBackupScheduleResponses = { } | { backend: "local"; - name: string; + path: string; cacert?: string; customPassword?: string; downloadLimit?: { @@ -2470,7 +2635,6 @@ export type GetBackupScheduleResponses = { }; insecureTls?: boolean; isExistingRepository?: boolean; - path?: string; uploadLimit?: { unit?: "Gbps" | "Kbps" | "Mbps"; value?: number; @@ -2824,7 +2988,7 @@ export type GetBackupScheduleForVolumeResponses = { } | { backend: "local"; - name: string; + path: string; cacert?: string; customPassword?: string; downloadLimit?: { @@ -2834,7 +2998,6 @@ export type GetBackupScheduleForVolumeResponses = { }; insecureTls?: boolean; isExistingRepository?: boolean; - path?: string; uploadLimit?: { unit?: "Gbps" | "Kbps" | "Mbps"; value?: number; @@ -3400,7 +3563,7 @@ export type GetScheduleMirrorsResponses = { } | { backend: "local"; - name: string; + path: string; cacert?: string; customPassword?: string; downloadLimit?: { @@ -3410,7 +3573,6 @@ export type GetScheduleMirrorsResponses = { }; insecureTls?: boolean; isExistingRepository?: boolean; - path?: string; uploadLimit?: { unit?: "Gbps" | "Kbps" | "Mbps"; value?: number; @@ -3620,7 +3782,7 @@ export type UpdateScheduleMirrorsResponses = { } | { backend: "local"; - name: string; + path: string; cacert?: string; customPassword?: string; downloadLimit?: { @@ -3630,7 +3792,6 @@ export type UpdateScheduleMirrorsResponses = { }; insecureTls?: boolean; isExistingRepository?: boolean; - path?: string; uploadLimit?: { unit?: "Gbps" | "Kbps" | "Mbps"; value?: number; diff --git a/app/client/components/snapshots-table.tsx b/app/client/components/snapshots-table.tsx index f87d7110..bcd96847 100644 --- a/app/client/components/snapshots-table.tsx +++ b/app/client/components/snapshots-table.tsx @@ -172,8 +172,8 @@ export const SnapshotsTable = ({ snapshots, repositoryId, backups }: Props) => {
{backupSchedule?.name}
diff --git a/app/client/modules/repositories/tabs/info.tsx b/app/client/modules/repositories/tabs/info.tsx
index 41c1c66a..b19170c3 100644
--- a/app/client/modules/repositories/tabs/info.tsx
+++ b/app/client/modules/repositories/tabs/info.tsx
@@ -1,33 +1,27 @@
import { useMutation } from "@tanstack/react-query";
import { useState } from "react";
import { toast } from "sonner";
-import { Check, Save, Square, Stethoscope, Trash2, Unlock } from "lucide-react";
+import { Pencil, Square, Stethoscope, Trash2, Unlock } from "lucide-react";
import { Card } from "~/client/components/ui/card";
import { Button } from "~/client/components/ui/button";
-import { Input } from "~/client/components/ui/input";
-import { Label } from "~/client/components/ui/label";
-import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "~/client/components/ui/select";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
- AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "~/client/components/ui/alert-dialog";
import type { Repository } from "~/client/lib/types";
-import { REPOSITORY_BASE } from "~/client/lib/constants";
import { formatDateTime, formatTimeAgo } from "~/client/lib/datetime";
import {
cancelDoctorMutation,
deleteRepositoryMutation,
startDoctorMutation,
unlockRepositoryMutation,
- updateRepositoryMutation,
} from "~/client/api-client/@tanstack/react-query.gen";
-import type { CompressionMode, RepositoryConfig } from "~/schemas/restic";
+import type { RepositoryConfig } from "~/schemas/restic";
import { DoctorReport } from "../components/doctor-report";
import { parseError } from "~/client/lib/errors";
import { useNavigate } from "@tanstack/react-router";
@@ -37,38 +31,16 @@ type Props = {
};
const getEffectiveLocalPath = (repository: Repository): string | null => {
- if (repository.type !== "local") return null;
- const config = repository.config as { name: string; path?: string; isExistingRepository?: boolean };
-
- if (config.isExistingRepository) {
- return config.path ?? null;
- }
-
- const basePath = config.path || REPOSITORY_BASE;
- return `${basePath}/${config.name}`;
+ if (repository.config.backend !== "local") return null;
+ return repository.config.path;
};
export const RepositoryInfoTabContent = ({ repository }: Props) => {
- const [name, setName] = useState(repository.name);
- const [compressionMode, setCompressionMode] = useState