Skip to content

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

fix: preserve database environment badge padding at narrow widths (#21582)

p0ny66858a8f1a0e
diff --git a/frontend/src/components/DatabaseTargetDisplay.test.tsx b/frontend/src/components/DatabaseTargetDisplay.test.tsx
index c3ded9ce47..5ae0fef366 100644
--- a/frontend/src/components/DatabaseTargetDisplay.test.tsx
+++ b/frontend/src/components/DatabaseTargetDisplay.test.tsx
@@ -247,10 +247,11 @@ describe("DatabaseTargetDisplay", () => {
expect(environment?.className).toContain("max-w-24");
expect(instance?.className).toContain("max-w-40");
expect(database?.className).toContain("flex-1");
- expect(database?.className).toContain("min-w-12");
+ expect(database?.className).toContain("min-w-0");
+ expect(database?.className).toContain("basis-12");
});
- it("uses overflow-aware tooltips for truncated identity names", () => {
+ it("uses overflow-aware identity tooltips and exposes the full environment name", async () => {
act(() => {
root.render(
<DatabaseTargetDisplay
@@ -263,12 +264,21 @@ describe("DatabaseTargetDisplay", () => {
expect(
container.querySelector('[data-testid="ellipsis-prod-instance"]')
).toBeTruthy();
- expect(
- container.querySelector('[data-testid="ellipsis-Production"]')
- ).toBeTruthy();
expect(
container.querySelector('[data-testid="ellipsis-app"]')
).toBeTruthy();
+
+ const environment = container.querySelector(
+ '[data-testid="environment-label"]'
+ );
+ await act(async () => {
+ environment?.parentElement?.dispatchEvent(
+ new FocusEvent("focusin", { bubbles: true })
+ );
+ });
+ expect(
+ document.getElementById("bb-react-layer-overlay")?.textContent
+ ).toBe("Production");
});
it("can hide optional database metadata", () => {
@@ -308,7 +318,8 @@ describe("DatabaseTargetDisplay", () => {
expect(rootElement?.className).toContain("text-base");
expect(engineIcon?.className).toContain("h-5");
- expect(database?.className).toContain("min-w-16");
+ expect(database?.className).toContain("min-w-0");
+ expect(database?.className).toContain("basis-16");
});
it("falls back to the raw target when the target is not a database", () => {
diff --git a/frontend/src/components/DatabaseTargetDisplay.tsx b/frontend/src/components/DatabaseTargetDisplay.tsx
index 5293b0ca20..639829a8c4 100644
--- a/frontend/src/components/DatabaseTargetDisplay.tsx
+++ b/frontend/src/components/DatabaseTargetDisplay.tsx
@@ -3,6 +3,7 @@ import { EngineIcon } from "@/components/EngineIcon";
import { EnvironmentLabel } from "@/components/EnvironmentLabel";
import { HighlightLabelText } from "@/components/HighlightLabelText";
import { EllipsisText } from "@/components/ui/ellipsis-text";
+import { Tooltip } from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
import { useAppStore } from "@/stores/app";
import { isValidDatabaseName } from "@/types";
@@ -22,14 +23,14 @@ const sizeClasses: Record<
}
> = {
sm: {
- database: "min-w-12",
+ database: "min-w-0 basis-12",
environment: "max-w-24",
icon: "h-4 w-4",
instance: "max-w-40",
root: "text-sm",
},
md: {
- database: "min-w-16",
+ database: "min-w-0 basis-16",
environment: "max-w-28",
icon: "h-5 w-5",
instance: "max-w-48",
@@ -132,12 +133,19 @@ export function DatabaseTargetDisplay({
</span>
)}
{showEnvironment && environment?.title && (
- <EllipsisText
- text={environment.title}
- className={cn("mr-1 min-w-0 shrink", classes.environment)}
+ <Tooltip
+ content={environment.title}
+ render={
+ <span
+ className={cn(
+ "mr-1 inline-flex min-w-8 shrink",
+ classes.environment
+ )}
+ />
+ }
>
- <EnvironmentLabel environment={environment} />
- </EllipsisText>
+ <EnvironmentLabel environment={environment} className="max-w-full" />
+ </Tooltip>
)}
<EllipsisText
text={databaseName}
diff --git a/frontend/src/routes/project/plan-detail/components/PlanTargetDisplay.test.tsx b/frontend/src/routes/project/plan-detail/components/PlanTargetDisplay.test.tsx
index 5f84f738d2..7a6d6a4d2f 100644
--- a/frontend/src/routes/project/plan-detail/components/PlanTargetDisplay.test.tsx
+++ b/frontend/src/routes/project/plan-detail/components/PlanTargetDisplay.test.tsx
@@ -142,7 +142,8 @@ describe("PlanTargetDisplay", () => {
expect(environment?.className).toContain("max-w-24");
expect(instance?.className).toContain("max-w-40");
expect(database?.className).toContain("flex-1");
- expect(database?.className).toContain("min-w-12");
+ expect(database?.className).toContain("min-w-0");
+ expect(database?.className).toContain("basis-12");
});
it("can hide optional database metadata", () => {
@@ -182,7 +183,8 @@ describe("PlanTargetDisplay", () => {
expect(rootElement?.className).toContain("text-base");
expect(engineIcon?.className).toContain("h-5");
- expect(database?.className).toContain("min-w-16");
+ expect(database?.className).toContain("min-w-0");
+ expect(database?.className).toContain("basis-16");
});
it("falls back to the raw target when the target is not a database", () => {