Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: unify ui detail (#20341)

ecmadao444b66c8d0e7
diff --git a/frontend/src/react/components/DatabaseGroupForm.tsx b/frontend/src/react/components/DatabaseGroupForm.tsx
index e2074b9783..47194f22cc 100644
--- a/frontend/src/react/components/DatabaseGroupForm.tsx
+++ b/frontend/src/react/components/DatabaseGroupForm.tsx
@@ -247,7 +247,7 @@ export function DatabaseGroupForm({
{!readonly && (
<div className="sticky bottom-0 z-10">
- <div className="flex justify-end w-full pt-4 pb-2 px-4 border-t border-block-border bg-background gap-x-3">
+ <div className="flex justify-end w-full pt-4 pb-2 px-4 border-t border-block-border bg-background gap-x-4">
<Button variant="outline" onClick={onDismiss}>
{t("common.cancel")}
</Button>
diff --git a/frontend/src/react/components/ProjectTable.tsx b/frontend/src/react/components/ProjectTable.tsx
index d5ed9307e3..2e3a8a71fd 100644
--- a/frontend/src/react/components/ProjectTable.tsx
+++ b/frontend/src/react/components/ProjectTable.tsx
@@ -141,7 +141,7 @@ export function ProjectTable({
return (
<Table className={className}>
<TableHeader>
- <TableRow>
+ <TableRow className="bg-control-bg">
{showSelection ? (
<TableHead
className="w-12 cursor-pointer"
diff --git a/frontend/src/react/components/database/DatabaseTableView.tsx b/frontend/src/react/components/database/DatabaseTableView.tsx
index 0dc43cd8a3..5cad42ceab 100644
--- a/frontend/src/react/components/database/DatabaseTableView.tsx
+++ b/frontend/src/react/components/database/DatabaseTableView.tsx
@@ -283,7 +283,7 @@ export function DatabaseTableView({
const { widths, totalWidth, onResizeStart } = useColumnWidths(columns);
return (
- <div className="overflow-x-auto border-y border-block-border">
+ <div className="overflow-x-auto border rounded-sm">
<Table className="table-fixed" style={{ minWidth: `${totalWidth}px` }}>
<colgroup>
{widths.map((w, i) => (
@@ -291,7 +291,7 @@ export function DatabaseTableView({
))}
</colgroup>
<TableHeader>
- <TableRow>
+ <TableRow className="bg-control-bg">
{columns.map((col, colIdx) => {
const colSortKey = col.sortKey;
const sortActive = Boolean(
diff --git a/frontend/src/react/components/instance/InstanceFormButtons.tsx b/frontend/src/react/components/instance/InstanceFormButtons.tsx
index bb855abd23..313b8ff246 100644
--- a/frontend/src/react/components/instance/InstanceFormButtons.tsx
+++ b/frontend/src/react/components/instance/InstanceFormButtons.tsx
@@ -509,7 +509,7 @@ export function InstanceFormButtons({
{connectionFailureDialog}
<div
className={cn(
- "w-full py-4 border-t border-block-border flex justify-between bg-background",
+ "w-full py-4 border-t border-block-border flex justify-end items-center gap-x-4 bg-background",
className
)}
>
@@ -522,16 +522,14 @@ export function InstanceFormButtons({
{t("common.cancel")}
</Button>
)}
- <div className="flex items-center gap-x-2">
- <Button
- disabled={
- !allowCreate || state.isRequesting || state.isTestingConnection
- }
- onClick={tryCreate}
- >
- {state.isRequesting ? t("common.creating") : t("common.create")}
- </Button>
- </div>
+ <Button
+ disabled={
+ !allowCreate || state.isRequesting || state.isTestingConnection
+ }
+ onClick={tryCreate}
+ >
+ {state.isRequesting ? t("common.creating") : t("common.create")}
+ </Button>
</div>
</>
);
@@ -545,7 +543,7 @@ export function InstanceFormButtons({
{connectionFailureDialog}
<div
className={cn(
- "w-full mt-4 py-4 border-t border-block-border flex justify-between bg-background",
+ "w-full mt-4 py-4 border-t border-block-border flex justify-end items-center gap-x-4 bg-background",
className
)}
>
@@ -556,25 +554,23 @@ export function InstanceFormButtons({
>
{t("common.cancel")}
</Button>
- <div className="flex items-center gap-x-2">
- <Button
- variant="ghost"
- disabled={!allowUpdate || state.isRequesting || !allowEdit}
- onClick={testConnectionForCurrentEditingDS}
- >
- {state.isTestingConnection
- ? t("instance.testing-connection")
- : t("instance.test-connection")}
- </Button>
- <Button
- disabled={
- !allowUpdate || state.isRequesting || state.isTestingConnection
- }
- onClick={doUpdate}
- >
- {state.isRequesting ? t("common.updating") : t("common.update")}
- </Button>
- </div>
+ <Button
+ variant="ghost"
+ disabled={!allowUpdate || state.isRequesting || !allowEdit}
+ onClick={testConnectionForCurrentEditingDS}
+ >
+ {state.isTestingConnection
+ ? t("instance.testing-connection")
+ : t("instance.test-connection")}
+ </Button>
+ <Button
+ disabled={
+ !allowUpdate || state.isRequesting || state.isTestingConnection
+ }
+ onClick={doUpdate}
+ >
+ {state.isRequesting ? t("common.updating") : t("common.update")}
+ </Button>
</div>
</>
);
diff --git a/frontend/src/react/components/release/ReleaseFileTable.tsx b/frontend/src/react/components/release/ReleaseFileTable.tsx
index 2d987aa248..5fef469556 100644
--- a/frontend/src/react/components/release/ReleaseFileTable.tsx
+++ b/frontend/src/react/components/release/ReleaseFileTable.tsx
@@ -1,6 +1,7 @@
import type { MouseEvent } from "react";
import { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
+import { Button } from "@/react/components/ui/button";
import { Checkbox } from "@/react/components/ui/checkbox";
import {
Table,
@@ -93,48 +94,68 @@ export function ReleaseFileTable({
};
const rowCursor = rowClickable || showSelection ? "cursor-pointer" : "";
+ // Show the "Detail" affordance only when the row itself opens a detail
+ // panel — in selection mode the row click toggles the checkbox instead.
+ const showDetailButton = !showSelection && rowClickable && !!onRowClick;
return (
- <Table>
- <TableHeader>
- <TableRow>
- {showSelection && <TableHead className="w-10" />}
- <TableHead className="w-40">{t("common.version")}</TableHead>
- <TableHead className="w-16">{t("common.type")}</TableHead>
- <TableHead className="w-32">
- {t("database.revision.filename")}
- </TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {files.map((file) => {
- const checked = selectedPaths.has(file.path);
- return (
- <TableRow
- key={file.path}
- className={cn(rowCursor)}
- onClick={(e) => handleRowClick(file, e)}
- >
- {showSelection && (
- <TableCell
- className="w-10"
- onClick={(e) => e.stopPropagation()}
- >
- <Checkbox
- checked={checked}
- onCheckedChange={(checked) =>
- handleCheckboxChange(file, checked)
- }
- />
- </TableCell>
- )}
- <TableCell className="truncate">{file.version}</TableCell>
- <TableCell>{typeText}</TableCell>
- <TableCell className="truncate">{file.path || "-"}</TableCell>
- </TableRow>
- );
- })}
- </TableBody>
- </Table>
+ <div className="w-full border rounded-sm overflow-hidden">
+ <Table>
+ <TableHeader>
+ <TableRow className="bg-control-bg">
+ {showSelection && <TableHead className="w-10" />}
+ <TableHead className="w-40">{t("common.version")}</TableHead>
+ <TableHead className="w-16">{t("common.type")}</TableHead>
+ <TableHead className="w-32">
+ {t("database.revision.filename")}
+ </TableHead>
+ {showDetailButton && <TableHead className="w-24" />}
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {files.map((file) => {
+ const checked = selectedPaths.has(file.path);
+ return (
+ <TableRow
+ key={file.path}
+ className={cn(rowCursor)}
+ onClick={(e) => handleRowClick(file, e)}
+ >
+ {showSelection && (
+ <TableCell
+ className="w-10"
+ onClick={(e) => e.stopPropagation()}
+ >
+ <Checkbox
+ checked={checked}
+ onCheckedChange={(checked) =>
+ handleCheckboxChange(file, checked)
+ }
+ />
+ </TableCell>
+ )}
+ <TableCell className="truncate">{file.version}</TableCell>
+ <TableCell>{typeText}</TableCell>
+ <TableCell className="truncate">{file.path || "-"}</TableCell>
+ {showDetailButton && (
+ <TableCell className="text-right">
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={(e) => {
+ e.stopPropagation();
+ onRowClick?.(file, e);
+ }}
+ >
+ {t("common.detail")}
+ </Button>
+ </TableCell>
+ )}
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
+ </div>
);
}
diff --git a/frontend/src/react/hooks/useUnsavedChangesGuard.ts b/frontend/src/react/hooks/useUnsavedChangesGuard.ts
new file mode 100644
index 0000000000..06b352e85f
--- /dev/null
+++ b/frontend/src/react/hooks/useUnsavedChangesGuard.ts
@@ -0,0 +1,48 @@
+import { useEffect, useRef } from "react";
+import { useTranslation } from "react-i18next";
+import { router } from "@/router";
+
+/**
+ * Warn the user before they lose unsaved edits.
+ *
+ * - Browser refresh / tab close: fires the native `beforeunload` prompt.
+ * - In-app Vue router navigation (sidebar links, back button, etc.):
+ * shows a `window.confirm` with `common.leave-without-saving` and aborts
+ * the navigation if the user cancels.
+ *
+ * Pass the current dirty boolean — it's stored in a ref each render so the
+ * listeners always observe the latest value without re-binding.
+ */
+export function useUnsavedChangesGuard(isDirty: boolean): void {
+ const { t } = useTranslation();
+ const dirtyRef = useRef(isDirty);
+ dirtyRef.current = isDirty;
+
+ useEffect(() => {
+ const handleBeforeUnload = (e: BeforeUnloadEvent) => {
+ if (dirtyRef.current) {
+ e.preventDefault();
+ // Older browsers (and some WebKit builds) still require returnValue
+ // to be set for the unload confirmation to fire; preventDefault alone
+ // is enough on modern Chrome/Firefox but not universal.
+ e.returnValue = "";
+ }
+ };
+ window.addEventListener("beforeunload", handleBeforeUnload);
+
+ const removeGuard = router.beforeEach((_to, _from, next) => {
+ if (dirtyRef.current) {
+ if (!window.confirm(t("common.leave-without-saving"))) {
+ next(false);
+ return;
+ }
+ }
+ next();
+ });
+
+ return () => {
+ window.removeEventListener("beforeunload", handleBeforeUnload);
+ removeGuard();
+ };
+ }, [t]);
+}
diff --git a/frontend/src/react/pages/project/ProjectMaskingExemptionCreatePage.tsx b/frontend/src/react/pages/project/ProjectMaskingExemptionCreatePage.tsx
index 028f26cde7..b3ebeabc3f 100644
--- a/frontend/src/react/pages/project/ProjectMaskingExemptionCreatePage.tsx
+++ b/frontend/src/react/pages/project/ProjectMaskingExemptionCreatePage.tsx
@@ -424,15 +424,13 @@ export function ProjectMaskingExemptionCreatePage({
{/* Footer */}
<div className="sticky bottom-0 z-10 border-t bg-background">
- <div className="flex justify-end items-center px-4 py-3">
- <div className="flex items-center gap-x-2">
- <Button variant="outline" onClick={onDismiss}>
- {t("common.cancel")}
- </Button>
- <Button disabled={submitDisabled || processing} onClick={onSubmit}>
- {t("common.confirm")}
- </Button>
- </div>
+ <div className="flex justify-end items-center gap-x-4 px-4 py-3">
+ <Button variant="outline" onClick={onDismiss}>
+ {t("common.cancel")}
+ </Button>
+ <Button disabled={submitDisabled || processing} onClick={onSubmit}>
+ {t("common.confirm")}
+ </Button>
</div>
</div>
diff --git a/frontend/src/react/pages/project/ProjectPlanDashboardPage.tsx b/frontend/src/react/pages/project/ProjectPlanDashboardPage.tsx
index ade1f23a45..9e7bdb0153 100644
--- a/frontend/src/react/pages/project/ProjectPlanDashboardPage.tsx
+++ b/frontend/src/react/pages/project/ProjectPlanDashboardPage.tsx
@@ -35,6 +35,14 @@ import {
SheetHeader,
SheetTitle,
} from "@/react/components/ui/sheet";
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "@/react/components/ui/table";
import { Tooltip } from "@/react/components/ui/tooltip";
import { useEscapeKey } from "@/react/hooks/useEscapeKey";
import { PagedTableFooter, usePagedData } from "@/react/hooks/usePagedData";
@@ -380,35 +388,25 @@ function PlanTable({ plans, projectId }: { plans: Plan[]; projectId: string }) {
return (
<div className="overflow-x-auto">
- <table className="w-full text-sm min-w-[1000px]">
- <thead>
- <tr className="border-b text-left text-control-light">
- <th className="py-2 px-4 font-medium min-w-80">
- {t("issue.table.name")}
- </th>
- <th className="py-2 px-4 font-medium w-50">
- {t("plan.checks.self")}
- </th>
- <th className="py-2 px-4 font-medium w-35">
- {t("plan.navigator.review")}
- </th>
- <th className="py-2 px-4 font-medium w-65">
+ <Table className="min-w-[1000px]">
+ <TableHeader>
+ <TableRow className="bg-control-bg">
+ <TableHead className="min-w-80">{t("issue.table.name")}</TableHead>
+ <TableHead className="w-50">{t("plan.checks.self")}</TableHead>
+ <TableHead className="w-35">{t("plan.navigator.review")}</TableHead>
+ <TableHead className="w-65">
{t("rollout.stage.self", { count: 2 })}
- </th>
- <th className="py-2 px-4 font-medium w-38">
- {t("issue.table.updated")}
- </th>
- <th className="py-2 px-4 font-medium w-38">
- {t("issue.table.creator")}
- </th>
- </tr>
- </thead>
- <tbody>
+ </TableHead>
+ <TableHead className="w-38">{t("issue.table.updated")}</TableHead>
+ <TableHead className="w-38">{t("issue.table.creator")}</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
{plans.map((plan) => (
<PlanRow key={plan.name} plan={plan} projectId={projectId} />
))}
- </tbody>
- </table>
+ </TableBody>
+ </Table>
</div>
);
}
@@ -505,15 +503,12 @@ function PlanRow({ plan, projectId }: { plan: Plan; projectId: string }) {
};
return (
- <tr
- className={cn(
- "border-b cursor-pointer hover:bg-control-bg",
- isDeleted && "opacity-60"
- )}
+ <TableRow
+ className={cn("cursor-pointer", isDeleted && "opacity-60")}
onClick={onRowClick}
>
{/* Title */}
- <td className="py-2 px-4">
+ <TableCell>
<div className="flex items-center gap-x-2 overflow-hidden">
<span className="whitespace-nowrap text-control opacity-60">
{extractPlanUID(plan.name)}
@@ -534,10 +529,10 @@ function PlanRow({ plan, projectId }: { plan: Plan; projectId: string }) {
</span>
)}
</div>
- </td>
+ </TableCell>
{/* Checks */}
- <td className="py-2 px-4">
+ <TableCell>
{hasAnyCheck ? (
<div className="flex items-center gap-3 flex-wrap">
{checkSummary.running > 0 && (
@@ -568,19 +563,19 @@ function PlanRow({ plan, projectId }: { plan: Plan; projectId: string }) {
) : (
<span className="text-control-light">-</span>
)}
- </td>
+ </TableCell>
{/* Approval */}
- <td className="py-2 px-4">
+ <TableCell>
{approvalTag ? (
<StatusTag label={approvalTag.label} variant={approvalTag.variant} />
) : (
<span className="text-control-light">-</span>
)}
- </td>
+ </TableCell>
{/* Stages */}
- <td className="py-2 px-4">
+ <TableCell>
{plan.rolloutStageSummaries.length === 0 ? (
<span className="text-control-light">-</span>
) : (
@@ -608,24 +603,24 @@ function PlanRow({ plan, projectId }: { plan: Plan; projectId: string }) {
})}
</div>
)}
- </td>
+ </TableCell>
{/* Updated */}
- <td className="py-2 px-4">
+ <TableCell>
<Tooltip content={formatAbsoluteDateTime(updateTimeTs * 1000)}>
<span className="text-control-light whitespace-nowrap">
{humanizeTs(updateTimeTs)}
</span>
</Tooltip>
- </td>
+ </TableCell>
{/* Creator */}
- <td className="py-2 px-4">
+ <TableCell>
<div className="flex items-center gap-x-1.5">
<span className="text-sm truncate">{creator.title}</span>
</div>
- </td>
- </tr>
+ </TableCell>
+ </TableRow>
);
}
diff --git a/frontend/src/react/pages/project/ProjectReleaseDashboardPage.tsx b/frontend/src/react/pages/project/ProjectReleaseDashboardPage.tsx
index 60a19a329a..7e16054eed 100644
--- a/frontend/src/react/pages/project/ProjectReleaseDashboardPage.tsx
+++ b/frontend/src/react/pages/project/ProjectReleaseDashboardPage.tsx
@@ -203,7 +203,7 @@ function ReleaseTable({ releases }: { releases: Release[] }) {
<div className="overflow-x-auto">
<Table>
<TableHeader>
- <TableRow>
+ <TableRow className="bg-control-bg">
<TableHead className="w-75">{t("common.name")}</TableHead>
<TableHead>{t("release.files")}</TableHead>
<TableHead className="w-32">{t("common.created-at")}</TableHead>
diff --git a/frontend/src/react/pages/project/ProjectReleaseDetailPage.tsx b/frontend/src/react/pages/project/ProjectReleaseDetailPage.tsx
index 3771208ed2..8b2aead07a 100644
--- a/frontend/src/react/pages/project/ProjectReleaseDetailPage.tsx
+++ b/frontend/src/react/pages/project/ProjectReleaseDetailPage.tsx
@@ -232,7 +232,7 @@ function ReleaseBasicInfo({
vcsType !== undefined && vcsType !== VCSType.VCS_TYPE_UNSPECIFIED && vcsUrl;
return (
- <div className="flex flex-row items-center pl-4 gap-4">
+ <div className="flex flex-row items-center pl-1 gap-4">
<div className="flex items-center gap-1">
<Clock4 className="size-4 text-control-light" />
{createTime !== undefined && (
diff --git a/frontend/src/react/pages/project/ProjectSettingsPage.tsx b/frontend/src/react/pages/project/ProjectSettingsPage.tsx
index d77fa96934..ed4e53dfd3 100644
--- a/frontend/src/react/pages/project/ProjectSettingsPage.tsx
+++ b/frontend/src/react/pages/project/ProjectSettingsPage.tsx
@@ -1150,7 +1150,7 @@ export function ProjectSettingsPage() {
{/* ============================================================= */}
{allowEdit && isDirty && (
<div className="sticky bottom-0 z-10">
- <div className="flex justify-between w-full py-4 border-t border-block-border bg-background">
+ <div className="flex justify-end gap-x-4 w-full py-4 border-t border-block-border bg-background">
<Button variant="outline" onClick={revert}>
{t("common.cancel")}
</Button>
diff --git a/frontend/src/react/pages/project/ProjectWebhookForm.tsx b/frontend/src/react/pages/project/ProjectWebhookForm.tsx
index 82a6367f00..a0830d1c77 100644
--- a/frontend/src/react/pages/project/ProjectWebhookForm.tsx
+++ b/frontend/src/react/pages/project/ProjectWebhookForm.tsx
@@ -560,40 +560,38 @@ export function ProjectWebhookForm({
{/* Footer */}
<div className="w-full sticky bottom-0 z-10">
<div className="w-full py-4 px-4 border-t border-block-border bg-background">
- <div className="flex justify-end">
- <div className="flex items-center gap-x-2">
- {create ? (
- <Button variant="outline" onClick={cancel}>
- {t("common.cancel")}
+ <div className="flex justify-end items-center gap-x-4">
+ {create ? (
+ <Button variant="outline" onClick={cancel}>
+ {t("common.cancel")}
+ </Button>
+ ) : (
+ valueChanged && (
+ <Button variant="outline" onClick={discardChanges}>
+ {t("common.discard-changes")}
+ </Button>
+ )
+ )}
+ {allowEdit &&
+ (create ? (
+ <Button
+ disabled={!allowCreate || loading}
+ onClick={createWebhook}
+ >
+ {t("common.create")}
</Button>
) : (
- valueChanged && (
- <Button variant="outline" onClick={discardChanges}>
- {t("common.discard-changes")}
- </Button>
- )
- )}
- {allowEdit &&
- (create ? (
- <Button
- disabled={!allowCreate || loading}
- onClick={createWebhook}
- >
- {t("common.create")}
- </Button>
- ) : (
- <Button
- disabled={
- loading ||
- !valueChanged ||
- state.notificationTypes.length === 0
- }
- onClick={updateWebhook}
- >
- {t("common.update")}
- </Button>
- ))}
- </div>
+ <Button
+ disabled={
+ loading ||
+ !valueChanged ||
+ state.notificationTypes.length === 0
+ }
+ onClick={updateWebhook}
+ >
+ {t("common.update")}
+ </Button>
+ ))}
</div>
</div>
</div>
diff --git a/frontend/src/react/pages/settings/EnvironmentsPage.tsx b/frontend/src/react/pages/settings/EnvironmentsPage.tsx
index bc32c4195c..8aeca93e9b 100644
--- a/frontend/src/react/pages/settings/EnvironmentsPage.tsx
+++ b/frontend/src/react/pages/settings/EnvironmentsPage.tsx
@@ -56,6 +56,7 @@ import {
TabsTrigger,
} from "@/react/components/ui/tabs";
import { useEnvironmentList } from "@/react/hooks/useAppState";
+import { useUnsavedChangesGuard } from "@/react/hooks/useUnsavedChangesGuard";
import { useVueState } from "@/react/hooks/useVueState";
import { cn } from "@/react/lib/utils";
import { useAppStore } from "@/react/stores/app";
@@ -964,7 +965,7 @@ function EnvironmentDetail({
{/* Sticky bottom buttons */}
{canEdit && hasChanges && (
- <div className="sticky bottom-0 bg-white py-2 px-2 border-t border-block-border flex items-center justify-between gap-x-2">
+ <div className="sticky -bottom-2 bg-white py-4 px-4 border-t border-block-border flex items-center justify-end gap-x-4">
<Button variant="outline" onClick={revert}>
{t("common.cancel")}
</Button>
@@ -1496,30 +1497,8 @@ export function EnvironmentsPage() {
return () => window.removeEventListener("hashchange", onHashChange);
}, [environmentListKey, t]);
- // Guard browser refresh/close
- useEffect(() => {
- const handler = (e: BeforeUnloadEvent) => {
- if (detailDirtyRef.current) {
- e.preventDefault();
- }
- };
- window.addEventListener("beforeunload", handler);
- return () => window.removeEventListener("beforeunload", handler);
- }, []);
-
- // Guard Vue router navigation (sidebar links, etc.)
- useEffect(() => {
- const removeGuard = router.beforeEach((_to, _from, next) => {
- if (detailDirtyRef.current) {
- if (!window.confirm(t("common.leave-without-saving"))) {
- next(false);
- return;
- }
- }
- next();
- });
- return removeGuard;
- }, [t]);
+ // Guard browser refresh/close + in-app router navigation
+ useUnsavedChangesGuard(detailDirty);
const selectTab = (id: string) => {
if (id === selectedId) return;
@@ -1595,7 +1574,7 @@ export function EnvironmentsPage() {
};
return (
- <div className="py-4 w-full h-full flex flex-col gap-4">
+ <div className="pt-4 w-full h-full flex flex-col gap-4">
<Tabs
value={selectedId}
onValueChange={(v) => selectTab(v as string)}
diff --git a/frontend/src/react/pages/settings/InstanceDetailPage.tsx b/frontend/src/react/pages/settings/InstanceDetailPage.tsx
index 46edf7597c..84ae38b8d2 100644
--- a/frontend/src/react/pages/settings/InstanceDetailPage.tsx
+++ b/frontend/src/react/pages/settings/InstanceDetailPage.tsx
@@ -25,6 +25,7 @@ import {
InstanceFormProvider,
InstanceRoleTable,
InstanceSyncButton,
+ useInstanceFormContext,
} from "@/react/components/instance";
import { Alert } from "@/react/components/ui/alert";
import {
@@ -33,6 +34,7 @@ import {
TabsPanel,
TabsTrigger,
} from "@/react/components/ui/tabs";
+import { useUnsavedChangesGuard } from "@/react/hooks/useUnsavedChangesGuard";
import { useVueState } from "@/react/hooks/useVueState";
import {
pushNotification,
@@ -415,6 +417,7 @@ export function InstanceDetailPage({ instanceId }: { instanceId: string }) {
<InstanceFormProvider instance={instance}>
<InstanceFormBody />
<InstanceFormButtons className="sticky bottom-0 z-10" />
+ <UnsavedChangesGuard />
</InstanceFormProvider>
</TabsPanel>
@@ -485,3 +488,9 @@ export function InstanceDetailPage({ instanceId }: { instanceId: string }) {
</div>
);
}
+
+function UnsavedChangesGuard() {
+ const { valueChanged } = useInstanceFormContext();
+ useUnsavedChangesGuard(valueChanged);
+ return null;
+}
diff --git a/frontend/src/react/pages/settings/InstancesPage.tsx b/frontend/src/react/pages/settings/InstancesPage.tsx
index 25d7e0d61d..8a12854fcf 100644
--- a/frontend/src/react/pages/settings/InstancesPage.tsx
+++ b/frontend/src/react/pages/settings/InstancesPage.tsx
@@ -1140,7 +1140,7 @@ export function InstancesPage() {
</PermissionGuard>
</div>
- <div className="overflow-x-auto border-y border-block-border">
+ <div className="overflow-x-auto border rounded-sm">
<Table className="table-fixed" style={{ minWidth: `${totalWidth}px` }}>
<colgroup>
{widths.map((w, i) => (
@@ -1148,7 +1148,7 @@ export function InstancesPage() {
))}
</colgroup>
<TableHeader>
- <TableRow>
+ <TableRow className="bg-control-bg">
{columns.map((col, colIdx) => (
<TableHead
key={col.key}
diff --git a/frontend/src/react/pages/settings/ProjectsPage.tsx b/frontend/src/react/pages/settings/ProjectsPage.tsx
index 0a3425df17..28297bde05 100644
--- a/frontend/src/react/pages/settings/ProjectsPage.tsx
+++ b/frontend/src/react/pages/settings/ProjectsPage.tsx
@@ -635,7 +635,7 @@ export function ProjectsPage() {
</PermissionGuard>
</div>
- <div className="overflow-x-auto border-y border-block-border">
+ <div className="overflow-x-auto border rounded-sm">
<ProjectTable
className="min-w-[700px]"
projectList={projects}
diff --git a/frontend/src/react/pages/settings/SQLReviewDetailPage.tsx b/frontend/src/react/pages/settings/SQLReviewDetailPage.tsx
index 9e3228885e..aba0f810e9 100644
--- a/frontend/src/react/pages/settings/SQLReviewDetailPage.tsx
+++ b/frontend/src/react/pages/settings/SQLReviewDetailPage.tsx
@@ -365,7 +365,7 @@ export function SQLReviewDetailPage({
{/* Sticky save bar when rules changed */}
{rulesUpdated && (
- <div className="w-full mt-4 py-2 border-t border-control-border flex justify-between bg-background sticky bottom-0 z-10">
+ <div className="w-full mt-4 py-2 border-t border-control-border flex justify-end gap-x-4 bg-background sticky bottom-0 z-10">
<Button variant="outline" onClick={onCancelChanges}>
{t("common.cancel")}
</Button>
diff --git a/frontend/src/react/pages/settings/SemanticTypesPage.tsx b/frontend/src/react/pages/settings/SemanticTypesPage.tsx
index bf5cc219df..535d3d928d 100644
--- a/frontend/src/react/pages/settings/SemanticTypesPage.tsx
+++ b/frontend/src/react/pages/settings/SemanticTypesPage.tsx
@@ -364,10 +364,10 @@ export function SemanticTypesPage() {
{t("settings.sensitive-data.semantic-types.label")}
</p>
- <div className="border border-control-border rounded-sm">
+ <div className="border rounded-sm overflow-hidden">
<Table>
<TableHeader>
- <TableRow>
+ <TableRow className="bg-control-bg">
<TableHead className="w-20 text-center">
{t("settings.sensitive-data.semantic-types.table.icon")}
</TableHead>
@@ -988,10 +988,10 @@ function SemanticTemplateDrawer({
<p className="text-sm text-control-placeholder mb-4">
{t("settings.sensitive-data.semantic-types.template.description")}
</p>
- <div className="border border-control-border rounded-sm overflow-hidden">
+ <div className="border rounded-sm overflow-hidden">
<Table>
<TableHeader>
- <TableRow>
+ <TableRow className="bg-control-bg">
<TableHead>ID</TableHead>
<TableHead>
{t(
diff --git a/frontend/src/react/pages/settings/general/GeneralPage.tsx b/frontend/src/react/pages/settings/general/GeneralPage.tsx
index 6bf28f4d0e..7d5a4ff20c 100644
--- a/frontend/src/react/pages/settings/general/GeneralPage.tsx
+++ b/frontend/src/react/pages/settings/general/GeneralPage.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
import { PermissionGuard } from "@/react/components/PermissionGuard";
import { Button } from "@/react/components/ui/button";
import { useServerState } from "@/react/hooks/useAppState";
-import { router } from "@/router";
+import { useUnsavedChangesGuard } from "@/react/hooks/useUnsavedChangesGuard";
import { pushNotification } from "@/store";
import { hasWorkspacePermissionV2 } from "@/utils";
import { AccountSection } from "./AccountSection";
@@ -133,29 +133,7 @@ export function GeneralPage() {
}, [t]);
// Route change guard — both browser close and in-app navigation
- useEffect(() => {
- const handleBeforeUnload = (e: BeforeUnloadEvent) => {
- if (allRefs.some((ref) => ref.current?.isDirty())) {
- e.preventDefault();
- }
- };
- window.addEventListener("beforeunload", handleBeforeUnload);
-
- const removeGuard = router.beforeEach((_to, _from, next) => {
- if (allRefs.some((ref) => ref.current?.isDirty())) {
- if (!window.confirm(t("common.leave-without-saving"))) {
- next(false);
- return;
- }
- }
- next();
- });
-
- return () => {
- window.removeEventListener("beforeunload", handleBeforeUnload);
- removeGuard();
- };
- }, []);
+ useUnsavedChangesGuard(isDirty);
// Hash scroll on mount
useEffect(() => {
@@ -230,7 +208,7 @@ export function GeneralPage() {
{isDirty && (
<div className="sticky bottom-0 z-10 -mb-4">
- <div className="flex justify-between w-full py-4 border-t border-block-border bg-background">
+ <div className="flex justify-end gap-x-4 w-full py-4 border-t border-block-border bg-background">
<Button variant="outline" onClick={handleRevert}>
{t("common.cancel")}
</Button>
diff --git a/frontend/src/react/pages/settings/profile/ProfilePage.tsx b/frontend/src/react/pages/settings/profile/ProfilePage.tsx
index a7ad4afe8b..960437612f 100644
--- a/frontend/src/react/pages/settings/profile/ProfilePage.tsx
+++ b/frontend/src/react/pages/settings/profile/ProfilePage.tsx
@@ -23,6 +23,7 @@ import {
} from "@/react/components/ui/dropdown-menu";
import { FeatureModal } from "@/react/components/ui/feature-modal";
import { Input } from "@/react/components/ui/input";
+import { useUnsavedChangesGuard } from "@/react/hooks/useUnsavedChangesGuard";
import { useVueState } from "@/react/hooks/useVueState";
import { RegenerateRecoveryCodesView } from "@/react/pages/settings/two-factor/RegenerateRecoveryCodesView";
import { router } from "@/router";
@@ -192,32 +193,7 @@ export function ProfilePage({ principalEmail }: ProfilePageProps) {
const cancelEditRef = useRef<() => void>(() => {});
// Route change guard
- useEffect(() => {
- const shouldGuard = editing && allowSaveEdit;
-
- const handleBeforeUnload = (e: BeforeUnloadEvent) => {
- if (shouldGuard) {
- e.preventDefault();
- e.returnValue = "";
- }
- };
- window.addEventListener("beforeunload", handleBeforeUnload);
-
- const removeGuard = router.beforeEach((_to, _from, next) => {
- if (shouldGuard) {
- if (!window.confirm(t("common.leave-without-saving"))) {
- next(false);
- return;
- }
- }
- next();
- });
-
- return () => {
- window.removeEventListener("beforeunload", handleBeforeUnload);
- removeGuard();
- };
- }, [editing, allowSaveEdit]);
+ useUnsavedChangesGuard(editing && allowSaveEdit);
// Document title
useEffect(() => {