From 5ccb6e0866eeda6cb9d06af4e522d2fd7a483dba Mon Sep 17 00:00:00 2001 From: yyassi-heartex <104568407+yyassi-heartex@users.noreply.github.com> Date: Wed, 17 Jan 2024 08:26:43 -0500 Subject: [PATCH] feat: DIA-820: [FE] Make List type columns display as intended type with out the ability for users to change type for Data Discovery (#289) --- src/components/Common/Table/TableHead/TableHead.js | 7 +++++-- src/components/Common/TableOld/TableHead/TableHead.js | 7 +++++-- src/components/MainView/DataView/DataView.js | 6 +++++- src/components/MainView/DataViewOld/Table.js | 6 +++++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/components/Common/Table/TableHead/TableHead.js b/src/components/Common/Table/TableHead/TableHead.js index e3576aa2..f650ba87 100644 --- a/src/components/Common/Table/TableHead/TableHead.js +++ b/src/components/Common/Table/TableHead/TableHead.js @@ -18,6 +18,7 @@ import { TableContext, TableElem } from "../TableContext"; import { getStyle } from "../utils"; import "./TableHead.styl"; import { FF_DEV_2984, FF_DEV_3873, FF_LOPS_E_10, isFF } from "../../../../utils/feature-flags"; +import { getRoot } from "mobx-state-tree"; const { Block, Elem } = BemWithSpecifiContext(); @@ -120,9 +121,11 @@ const ColumnRenderer = observer( ); } + const root = getRoot(column.original); + const isDE = root.SDK.type === "DE"; const canOrder = sortingEnabled && column.original?.canOrder; const Decoration = decoration?.get?.(column); - const extra = columnHeaderExtra + const extra = !isDE && columnHeaderExtra ? columnHeaderExtra(column, Decoration) : null; const content = Decoration?.content @@ -158,7 +161,7 @@ const ColumnRenderer = observer( onResizeFinished={(width) => onResize?.(column, width)} onReset={() => onReset?.(column)} > - {column.parent ? ( + {!isDE && column.parent ? ( onResize?.(column, width)} onReset={() => onReset?.(column)} > - {column.parent ? ( + {!isDE && column.parent ? ( col.type === "Image", + resolver: (col) => col.type === "Image" && col.original && getRoot(col.original)?.SDK?.type !== 'DE', style: { width: 150, justifyContent: "center" }, }, + { + resolver: (col) => col.type === "Image" && col.original && getRoot(col.original)?.SDK?.type === 'DE', + style: { width: 150 }, + }, { resolver: (col) => ["Date", "Datetime"].includes(col.type), style: { width: 240 }, diff --git a/src/components/MainView/DataViewOld/Table.js b/src/components/MainView/DataViewOld/Table.js index 04924098..5f696544 100644 --- a/src/components/MainView/DataViewOld/Table.js +++ b/src/components/MainView/DataViewOld/Table.js @@ -247,9 +247,13 @@ export const DataView = injector( }, }, { - resolver: (col) => col.type === "Image", + resolver: (col) => col.type === "Image" && col.original && getRoot(col.original)?.SDK?.type !== 'DE', style: { width: 150, justifyContent: "center" }, }, + { + resolver: (col) => col.type === "Image" && col.original && getRoot(col.original)?.SDK?.type === 'DE', + style: { width: 150 }, + }, { resolver: (col) => ["Date", "Datetime"].includes(col.type), style: { width: 240 },