From 688a142a62ef7080d600b86b3667a09c353559be Mon Sep 17 00:00:00 2001 From: Ethan Kaplan Date: Tue, 17 Dec 2024 10:21:03 -0800 Subject: [PATCH 1/2] MAT-7937 add returntype to definitions table --- .../definitions/Definitions.tsx | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx b/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx index 14099fb3..f7b38eae 100644 --- a/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx +++ b/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx @@ -84,13 +84,17 @@ const Definitions = ({ managePagination(); }, [definitions, currentPage, currentLimit]); - const showEditDefinitionDialog = (index) => { + const populateReturnType = (index) => { const rowModal = table.getRow(index).original; const returnTypes = getCqlDefinitionReturnTypes(); - const returnType = returnTypes - ? returnTypes[_.camelCase(rowModal.name)] - : undefined; - setSelectedDefinition({ ...rowModal, returnType: returnType }); + return returnTypes ? returnTypes[_.camelCase(rowModal.name)] : undefined; + }; + + const showEditDefinitionDialog = (index) => { + setSelectedDefinition({ + ...table.getRow(index).original, + returnType: populateReturnType(index), + }); }; // table data @@ -102,6 +106,14 @@ const Definitions = ({ header: "Name", accessorKey: "name", }, + { + header: "Return Type", + accessorKey: "returnType", + cell: (row: any) => { + const returnTypeShow = populateReturnType(row.cell.row.id); + return
{returnTypeShow == "NA" ? "" : returnTypeShow}
; + }, + }, { header: "Comment", accessorKey: "comment", From 4cc1cb5e59aacf1a0f32cf45e3a6958ae1b669c1 Mon Sep 17 00:00:00 2001 From: Ethan Kaplan Date: Fri, 20 Dec 2024 08:30:31 -0800 Subject: [PATCH 2/2] MAT-7937 better name for function --- .../definitionsSection/definitions/Definitions.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx b/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx index f7b38eae..6965f6c8 100644 --- a/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx +++ b/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx @@ -84,7 +84,7 @@ const Definitions = ({ managePagination(); }, [definitions, currentPage, currentLimit]); - const populateReturnType = (index) => { + const getReturnType = (index) => { const rowModal = table.getRow(index).original; const returnTypes = getCqlDefinitionReturnTypes(); return returnTypes ? returnTypes[_.camelCase(rowModal.name)] : undefined; @@ -93,7 +93,7 @@ const Definitions = ({ const showEditDefinitionDialog = (index) => { setSelectedDefinition({ ...table.getRow(index).original, - returnType: populateReturnType(index), + returnType: getReturnType(index), }); }; @@ -110,7 +110,7 @@ const Definitions = ({ header: "Return Type", accessorKey: "returnType", cell: (row: any) => { - const returnTypeShow = populateReturnType(row.cell.row.id); + const returnTypeShow = getReturnType(row.cell.row.id); return
{returnTypeShow == "NA" ? "" : returnTypeShow}
; }, },