From d17b920fcfcf6c5727c18ed64055604b0d7c9a6b Mon Sep 17 00:00:00 2001 From: Mohamed Marrouchi Date: Fri, 21 Mar 2025 13:40:51 +0100 Subject: [PATCH 1/2] feat: add grid display for NLU values based on types of NLU entity --- .../components/nlp/components/NlpValue.tsx | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/nlp/components/NlpValue.tsx b/frontend/src/components/nlp/components/NlpValue.tsx index 1864eb43..f43fc53f 100644 --- a/frontend/src/components/nlp/components/NlpValue.tsx +++ b/frontend/src/components/nlp/components/NlpValue.tsx @@ -81,6 +81,7 @@ export const NlpValues = ({ entityId }: { entityId: string }) => { }, }); const [selectedNlpValues, setSelectedNlpValues] = useState([]); + const shouldIncludeSynonyms = nlpEntity?.lookups.includes("keywords"); const actionColumns = useActionColumns( EntityType.NLP_VALUE, [ @@ -102,6 +103,19 @@ export const NlpValues = ({ entityId }: { entityId: string }) => { ], t("label.operations"), ); + const synonymsColumn = { + flex: 3, + field: "synonyms", + headerName: t("label.synonyms"), + sortable: true, + renderCell: (params) => { + return params.row?.expressions?.map((exp, index) => ( + + )); + }, + disableColumnMenu: true, + renderHeader, + }; const columns: GridColDef[] = [ { flex: 3, @@ -111,20 +125,7 @@ export const NlpValues = ({ entityId }: { entityId: string }) => { disableColumnMenu: true, renderHeader, }, - { - flex: 3, - field: "synonyms", - headerName: t("label.synonyms"), - sortable: true, - renderCell: (params) => { - return params.row?.expressions?.map((exp, index) => ( - - )); - }, - disableColumnMenu: true, - renderHeader, - }, - + ...(shouldIncludeSynonyms ? [synonymsColumn] : []), { maxWidth: 140, field: "createdAt", From e0486fcece3a48451a0e1ef5e89b73947b1b8bee Mon Sep 17 00:00:00 2001 From: Mohamed Marrouchi Date: Fri, 21 Mar 2025 13:44:41 +0100 Subject: [PATCH 2/2] feat: re-adapt display condition --- frontend/src/components/nlp/components/NlpValue.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/nlp/components/NlpValue.tsx b/frontend/src/components/nlp/components/NlpValue.tsx index f43fc53f..7e9b38e3 100644 --- a/frontend/src/components/nlp/components/NlpValue.tsx +++ b/frontend/src/components/nlp/components/NlpValue.tsx @@ -81,7 +81,7 @@ export const NlpValues = ({ entityId }: { entityId: string }) => { }, }); const [selectedNlpValues, setSelectedNlpValues] = useState([]); - const shouldIncludeSynonyms = nlpEntity?.lookups.includes("keywords"); + const shouldIncludeSynonyms = !nlpEntity?.lookups.includes("trait"); const actionColumns = useActionColumns( EntityType.NLP_VALUE, [