Skip to content

Commit a36bfd7

Browse files
authored
[FIX] dropdown cell text color + current value on relationship filter form (#5796)
* fix wrong text color in dropdown cell caused by chromium bug * Set current filter value when opening relationship form
1 parent 81aa36e commit a36bfd7

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

frontend/app/src/entities/nodes/object/ui/filters/attribute-filter-form.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export function AttributeFilterForm({ attributeSchema, onSuccess }: AttributeFil
8282
handleSubmit(formData);
8383
onSuccess?.();
8484
}}
85+
data-testid="attribute-filter-form"
8586
>
8687
{condition === FILTER_CONDITION.CONTAINS && (
8788
<FormField

frontend/app/src/entities/nodes/object/ui/filters/relationship-filter-form.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@ export function RelationshipFilterForm({
9696
handleSubmit(formData as FormData);
9797
onSuccess?.();
9898
}}
99+
data-testid="relationship-filter-form"
99100
>
100101
{condition === "is any of" && (
101102
<FormField
102103
name="relationships"
104+
defaultValue={currentFilter?.value}
103105
render={({ field }) => {
104106
const value = field.value as RelationshipNode[] | undefined;
105107

frontend/app/src/entities/nodes/object/ui/object-table/cells/dropdown-cell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function DropdownCell({ dropdown }: { dropdown: Dropdown }) {
88
dropdown.color
99
? {
1010
backgroundColor: dropdown.color,
11-
color: `lch(from ${dropdown.color} calc((50 - l) * infinity) 0 0)`, // https://x.com/devongovett/status/1863733091409461256
11+
color: `lch(from ${dropdown.color} calc((50 - l) * 999) 0 0)`, // https://x.com/devongovett/status/1863733091409461256
1212
}
1313
: undefined
1414
}

frontend/app/src/entities/nodes/object/ui/object-table/cells/generics/kind-header-cell.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ export function KindHeaderCell({ schema }: { schema: iGenericSchema }) {
2525

2626
return (
2727
<Popover open={showFilters} onOpenChange={setShowFilters}>
28-
<PopoverTrigger
29-
className={classNames(cellsStyle, cellHeaderStyle)}
30-
data-testid="table-header-cell"
31-
>
28+
<PopoverTrigger className={classNames(cellsStyle, cellHeaderStyle)}>
3229
<Icon icon="mdi:code-json" className="text-stone-400" />
3330
<span className="truncate mr-2">Kind</span>
3431
<Icon

frontend/app/tests/e2e/objects/object-filters.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ test.describe("Object filters", () => {
3434
await expect(page.getByRole("link", { name: "atl1-edge1" })).toBeVisible();
3535
await expect(page.getByRole("link", { name: "den1-edge1" })).toBeVisible();
3636
await expect(page.getByRole("link", { name: "atl1-core1" })).not.toBeVisible();
37+
38+
await page.getByRole("button", { name: "Role" }).click();
39+
await expect(page.getByTestId("attribute-filter-form")).toContainText("Edge Router");
3740
});
3841

3942
await test.step("filter using a relationship of cardinality one", async () => {
@@ -47,6 +50,9 @@ test.describe("Object filters", () => {
4750
await expect(page.getByRole("link", { name: "atl1-edge1" })).toBeVisible();
4851
await expect(page.getByRole("link", { name: "den1-edge1" })).not.toBeVisible();
4952
await expect(page.getByRole("link", { name: "atl1-core1" })).not.toBeVisible();
53+
54+
await page.getByRole("button", { name: "Site" }).click();
55+
await expect(page.getByTestId("relationship-filter-form")).toContainText("atl1×");
5056
});
5157

5258
await test.step("remove an attribute filter", async () => {
@@ -72,6 +78,9 @@ test.describe("Object filters", () => {
7278
await expect(page.getByRole("link", { name: "atl1-core1" })).toBeVisible();
7379
await expect(page.getByRole("link", { name: "atl1-edge1" })).not.toBeVisible();
7480
await expect(page.getByRole("link", { name: "den1-edge1" })).not.toBeVisible();
81+
82+
await page.getByRole("button", { name: "Tags" }).click();
83+
await expect(page.getByTestId("relationship-filter-form")).toContainText("blue×");
7584
});
7685

7786
await test.step("clear all filters", async () => {
@@ -100,6 +109,9 @@ test.describe("Object filters", () => {
100109
await expect(page.getByLabel("Kind contains InfraInterfaceL3")).toBeVisible();
101110
await expect(page.getByTestId("object-items")).toContainText("Interface L3");
102111
await expect(page.getByTestId("object-items")).not.toContainText("Interface L2");
112+
113+
await page.getByRole("button", { name: "Kind", exact: true }).click();
114+
await expect(page.getByLabel("kind", { exact: true })).toContainText("Interface L3 Infra");
103115
});
104116

105117
await test.step("clear kind filter", async () => {

0 commit comments

Comments
 (0)