From f3c753ad303a40e37dbaefbb6734f35f913d364e Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Wed, 25 Feb 2026 22:15:08 +0100 Subject: [PATCH] chore: style fixes --- .../components/file-browsers/file-browser.tsx | 7 +- .../file-browsers/local-file-browser.tsx | 9 +- .../file-browsers/snapshot-tree-browser.tsx | 9 +- .../file-browsers/volume-file-browser.tsx | 9 +- app/client/components/restore-form.tsx | 24 ++-- app/client/modules/repositories/tabs/info.tsx | 105 +++++++++--------- 6 files changed, 62 insertions(+), 101 deletions(-) diff --git a/app/client/components/file-browsers/file-browser.tsx b/app/client/components/file-browsers/file-browser.tsx index 771a1e7d..ec4dc347 100644 --- a/app/client/components/file-browsers/file-browser.tsx +++ b/app/client/components/file-browsers/file-browser.tsx @@ -134,15 +134,10 @@ export const FileBrowser = (props: FileBrowserProps) => { } const bodyWithScroll = useScrollArea ? {body} : body; - const wrappedBody = treeContainerClassName ? ( -
{bodyWithScroll}
- ) : ( - bodyWithScroll - ); return (
- {wrappedBody} +
{bodyWithScroll}
{showSelectedPathFooter && resolvedSelectedPath && (
{selectedPathLabel}
diff --git a/app/client/components/file-browsers/local-file-browser.tsx b/app/client/components/file-browsers/local-file-browser.tsx index 920ed891..a7cfae7e 100644 --- a/app/client/components/file-browsers/local-file-browser.tsx +++ b/app/client/components/file-browsers/local-file-browser.tsx @@ -30,13 +30,6 @@ export const LocalFileBrowser = ({ initialPath = "/", enabled = true, ...uiProps }, }); - const errorDetails = parseError(error)?.message; - const errorMessage = errorDetails - ? `Failed to load directories: ${errorDetails}` - : error - ? "Failed to load directories" - : undefined; - return ( diff --git a/app/client/components/file-browsers/snapshot-tree-browser.tsx b/app/client/components/file-browsers/snapshot-tree-browser.tsx index 6bc178da..f9983dfd 100644 --- a/app/client/components/file-browsers/snapshot-tree-browser.tsx +++ b/app/client/components/file-browsers/snapshot-tree-browser.tsx @@ -135,13 +135,6 @@ export const SnapshotTreeBrowser = ({ [onSelectionChange, addBasePath, onSingleSelectionKindChange, displayPathKinds], ); - const errorDetails = parseError(error)?.message; - const errorMessage = errorDetails - ? `Failed to load files: ${errorDetails}` - : error - ? "Failed to load files" - : undefined; - return ( diff --git a/app/client/components/restore-form.tsx b/app/client/components/restore-form.tsx index 44536073..40573ebd 100644 --- a/app/client/components/restore-form.tsx +++ b/app/client/components/restore-form.tsx @@ -150,30 +150,22 @@ export function RestoreForm({ repository, snapshotId, returnPath, basePath }: Re ]); const handleDownload = useCallback(() => { - if (selectedPaths.size > 1) { - return; - } + if (selectedPaths.size > 1) return; - const dumpUrl = new URL( + const url = new URL( `/api/v1/repositories/${repository.shortId}/snapshots/${snapshotId}/dump`, window.location.origin, ); - if (selectedPaths.size === 1) { - const [selectedPath] = selectedPaths; - if (selectedPath) { - dumpUrl.searchParams.set("path", selectedPath); - if (selectedPathKind) { - dumpUrl.searchParams.set("kind", selectedPathKind); - } + const [selectedPath] = selectedPaths; + if (selectedPath) { + url.searchParams.set("path", selectedPath); + if (selectedPathKind) { + url.searchParams.set("kind", selectedPathKind); } } - const link = document.createElement("a"); - link.href = dumpUrl.toString(); - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); + window.location.assign(url.toString()); }, [repository.shortId, snapshotId, selectedPathKind, selectedPaths]); const acknowledgeRestoreResult = useCallback(() => { diff --git a/app/client/modules/repositories/tabs/info.tsx b/app/client/modules/repositories/tabs/info.tsx index 2d11ac23..f8567a7b 100644 --- a/app/client/modules/repositories/tabs/info.tsx +++ b/app/client/modules/repositories/tabs/info.tsx @@ -26,6 +26,7 @@ import { DoctorReport } from "../components/doctor-report"; import { parseError } from "~/client/lib/errors"; import { useNavigate } from "@tanstack/react-router"; import { CompressionStatsChart } from "../components/compression-stats-chart"; +import { cn } from "~/client/lib/utils"; type Props = { repository: Repository; @@ -94,6 +95,12 @@ export const RepositoryInfoTabContent = ({ repository }: Props) => { }; const config = repository.config as RepositoryConfig; + const isDoctorRunning = repository.status === "doctor"; + const hasLocalPath = Boolean(effectiveLocalPath); + const hasCaCert = Boolean(config.cacert); + const hasLastError = Boolean(repository.lastError); + const hasInsecureTlsConfig = config.insecureTls !== undefined; + const isTlsValidationDisabled = config.insecureTls === true; return ( <> @@ -112,26 +119,25 @@ export const RepositoryInfoTabContent = ({ repository }: Props) => { Edit - {repository.status === "doctor" ? ( - - ) : ( - - )} + +
- {effectiveLocalPath && ( -
-
Local path
-

{effectiveLocalPath}

-
- )} +
+
Local path
+

{effectiveLocalPath}

+
Created at

{formatDateTime(repository.createdAt)}

@@ -192,40 +196,31 @@ export const RepositoryInfoTabContent = ({ repository }: Props) => {
Last checked

{formatTimeAgo(repository.lastChecked)}

- {config.cacert && ( -
-
CA Certificate
-

- configured -

-
- )} - {"insecureTls" in config && ( -
-
TLS Certificate Validation
-

- {config.insecureTls ? ( - disabled - ) : ( - enabled - )} -

-
- )} +
+
CA Certificate
+

+ configured +

+
+
+
TLS Certificate Validation
+

+ disabled + enabled +

+
- {repository.lastError && ( -
-
-

Last Error

-
-
-

{repository.lastError}

-
+
+
+

Last Error

- )} +
+

{repository.lastError}

+
+

Configuration