From 9529b4bab9fb0de00ac8569054e1d7787cd3b818 Mon Sep 17 00:00:00 2001 From: Thiago Dallacqua Date: Thu, 24 Oct 2024 11:59:51 -0300 Subject: [PATCH] refactor: Update columnType check in FilterField component feat: Introduce special characters as separators in removeColumnTypePrefix function --- .../src/components/FilterForm/components/FilterField.tsx | 4 ++-- webui/react/src/utils/flatRun.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/webui/react/src/components/FilterForm/components/FilterField.tsx b/webui/react/src/components/FilterForm/components/FilterField.tsx index bfec25266b8..4bf8bad36ee 100644 --- a/webui/react/src/components/FilterForm/components/FilterField.tsx +++ b/webui/react/src/components/FilterForm/components/FilterField.tsx @@ -72,8 +72,8 @@ const FilterField = ({ const users = Loadable.getOrElse([], useObservable(userStore.getUsers())); const resourcePools = Loadable.getOrElse([], useObservable(clusterStore.resourcePools)); const currentColumn = useMemo( - () => columns.find((c) => c.column === field.columnName), - [columns, field.columnName], + () => columns.find((c) => c.type === field.type && c.column === field.columnName), + [columns, field.columnName, field.type], ); const columnType = useMemo(() => { diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index cbf0803ac87..0f127972e97 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -122,7 +122,8 @@ export const removeColumnTypePrefix = (columnName: V1ColumnType): string => { return columnName.replace('COLUMN_TYPE_', ''); }; -/// wanna know why this separator is used? see https://hpe-aiatscale.atlassian.net/browse/ET-785 +/// we want to use special characters as "separators" to prevent user input to match with such when creating the arbitrary metadata +export const COLUMN_SEPARATOR = '␟'; export const METADATA_SEPARATOR = '\u241F' as const; // TODO: unify after merging PR 10052 export const formatColumnKey = (col: ProjectColumn, required = false): string => {