From 30ab1405eb014ad34ac4231debfd4988cfb59d70 Mon Sep 17 00:00:00 2001 From: Radoslaw Szwajkowski Date: Fri, 10 May 2024 15:58:08 +0200 Subject: [PATCH] Add label styling for tag group Additional changes: fix problem with chip groups disappearing when other filter type was chosen. Signed-off-by: Radoslaw Szwajkowski --- .../MultiselectFilterControl.tsx | 107 ++++++++++-------- .../applications-table/applications-table.tsx | 2 +- 2 files changed, 61 insertions(+), 48 deletions(-) diff --git a/client/src/app/components/FilterToolbar/MultiselectFilterControl.tsx b/client/src/app/components/FilterToolbar/MultiselectFilterControl.tsx index 737efcdcb3..702b092d96 100644 --- a/client/src/app/components/FilterToolbar/MultiselectFilterControl.tsx +++ b/client/src/app/components/FilterToolbar/MultiselectFilterControl.tsx @@ -2,6 +2,7 @@ import * as React from "react"; import { Badge, Button, + Label, MenuToggle, MenuToggleElement, Select, @@ -54,7 +55,7 @@ export const MultiselectFilterControl = ({ .includes(inputValue?.trim().toLowerCase() ?? "") ); - const groups = [ + const [firstGroup, ...otherGroups] = [ ...new Set([ ...(category.selectOptions ?.map(({ groupLabel }) => groupLabel) @@ -225,60 +226,72 @@ export const MultiselectFilterControl = ({ return ( <> - {groups.reduce( - (acc, groupName) => ( + {[ + onFilterClear(chip)} + deleteChipGroup={() => onFilterClearAll(firstGroup)} + categoryName={firstGroup} + key={firstGroup} + showToolbarItem={showToolbarItem} + > + + , + ...otherGroups.map((groupName) => ( onFilterClear(chip)} deleteChipGroup={() => onFilterClearAll(groupName)} categoryName={groupName} - showToolbarItem={showToolbarItem} + key={groupName} + showToolbarItem={false} > - {acc} + {" "} - ), - - )} + )), + ]} ); }; diff --git a/client/src/app/pages/applications/applications-table/applications-table.tsx b/client/src/app/pages/applications/applications-table/applications-table.tsx index c15b6be390..faa1b01bdc 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -462,7 +462,7 @@ export const ApplicationsTable: React.FC = () => { }) + "...", selectOptions: tagItems.map(({ name, tagName, categoryName }) => ({ value: name, - label: name, + label: tagName, chipLabel: tagName, groupLabel: categoryName, })),