From e5c634942cb5d6c709b9bd7df6d263fe1001871d Mon Sep 17 00:00:00 2001 From: omerfbolat Date: Mon, 20 May 2024 17:55:03 +0300 Subject: [PATCH] fix: Dvt-table header if field === 'date' for formating date never to all coding for remove changes fixed --- .../src/components/DvtTable/dvt-table-data.ts | 18 +-- .../src/components/DvtTable/index.tsx | 149 ++++++++---------- 2 files changed, 72 insertions(+), 95 deletions(-) diff --git a/superset-frontend/src/components/DvtTable/dvt-table-data.ts b/superset-frontend/src/components/DvtTable/dvt-table-data.ts index 58cf97900355b..6d49481f994ad 100644 --- a/superset-frontend/src/components/DvtTable/dvt-table-data.ts +++ b/superset-frontend/src/components/DvtTable/dvt-table-data.ts @@ -244,7 +244,7 @@ const TableData = { ], iconExampleData: [ { - date: '2023.05.29 15:53:47 * 03:00', + date: '2023.05.29 15:53:47', tabName: 'Pysical', database: 'PostgreSQL', schema: 'Public', @@ -254,7 +254,7 @@ const TableData = { sql: 'Select', }, { - date: '2023.05.29 15:53:47 * 03:00', + date: '2023.05.29 15:53:47', tabName: 'Pysical', database: 'PostgreSQL', schema: 'Public', @@ -264,7 +264,7 @@ const TableData = { sql: 'Select', }, { - date: '2023.05.29 15:53:47 * 03:00', + date: '2023.05.29 15:53:47', tabName: 'Pysical', database: 'PostgreSQL', schema: 'Public', @@ -274,7 +274,7 @@ const TableData = { sql: 'Select', }, { - date: '2023.05.29 15:53:47 * 03:00', + date: '2023.05.29 15:53:47', tabName: 'Pysical', database: 'PostgreSQL', schema: 'Public', @@ -284,7 +284,7 @@ const TableData = { sql: 'Select', }, { - date: '2023.05.29 15:53:47 * 03:00', + date: '2023.05.29 15:53:47', tabName: 'Pysical', database: 'PostgreSQL', schema: 'Public', @@ -294,7 +294,7 @@ const TableData = { sql: 'Select', }, { - date: '2023.05.29 15:53:47 * 03:00', + date: '2023.05.29 15:53:47', tabName: 'Pysical', database: 'PostgreSQL', schema: 'Public', @@ -304,7 +304,7 @@ const TableData = { sql: 'Select', }, { - date: '2023.05.29 15:53:47 * 03:00', + date: '2023.05.29 15:53:47', tabName: 'Pysical', database: 'PostgreSQL', schema: 'Public', @@ -314,7 +314,7 @@ const TableData = { sql: 'Select', }, { - date: '2023.05.29 15:53:47 * 03:00', + date: '2023.05.29 15:53:47', tabName: 'Pysical', database: 'PostgreSQL', schema: 'Public', @@ -324,7 +324,7 @@ const TableData = { sql: 'Select', }, { - date: '2023.05.29 15:53:47 * 03:00', + date: '2023.05.29 15:53:47', tabName: 'Pysical', database: 'PostgreSQL', schema: 'Public', diff --git a/superset-frontend/src/components/DvtTable/index.tsx b/superset-frontend/src/components/DvtTable/index.tsx index 35f5d1d98e17a..c15c56d846dba 100644 --- a/superset-frontend/src/components/DvtTable/index.tsx +++ b/superset-frontend/src/components/DvtTable/index.tsx @@ -130,19 +130,6 @@ const DvtTable: React.FC = ({ const [openRow, setOpenRow] = useState(null); const [collapseRowId, setCollapseRowId] = useState(''); - const formatDateTime = (dateTimeString: string) => { - const [datePart, timePart] = dateTimeString.split(' '); - const [day, month, year] = datePart.split('.'); - const [hour, minute, second] = timePart.split(':'); - - const formattedDate = `${day}.${month}.${year}`; - const formattedTime = `${hour}:${minute}:${second}`; - - return { - date: formattedDate, - time: formattedTime, - }; - }; const totalFlex = header.reduce( (total, header) => total + (header.flex || 1), 0, @@ -437,80 +424,70 @@ const DvtTable: React.FC = ({ {row[column.field]} )} - {column.field === 'date' ? ( - <> - {formatDateTime(row[column.field]).date} -
- {formatDateTime(row[column.field]).time} - - ) : ( - <> - {column.clicks?.map( - ( - clicks: { - icon: string; - click: (row: any) => void; - colour: string; - popperLabel?: string; - }, - index, - ) => ( - - {clicks.popperLabel && ( - - clicks.click(row)} - fileName={clicks.icon} - iconColor={ - clicks.colour || - supersetTheme.colors.grayscale.dark2 - } - iconSize="xl" - style={{ - marginRight: 3.6, - visibility: column.showHover - ? openRow === rowIndex - ? 'visible' - : 'hidden' - : 'visible', - height: '56px', - display: 'flex', - alignItems: 'center', - }} - /> - - )} - {!clicks.popperLabel && ( - clicks.click(row)} - fileName={clicks.icon} - iconColor={ - clicks.colour || - supersetTheme.colors.grayscale.dark2 - } - iconSize="xl" - style={{ - marginRight: 3.6, - visibility: column.showHover - ? openRow === rowIndex - ? 'visible' - : 'hidden' - : 'visible', - }} - /> - )} - - ), - )} - - {column.field !== 'action' && - !column.input && - !column.editor && - !column.radio && - column.field && - !column.urlField && <>{row[column.field]}} - + {column.clicks?.map( + ( + clicks: { + icon: string; + click: (row: any) => void; + colour: string; + popperLabel?: string; + }, + index, + ) => ( + + {clicks.popperLabel && ( + + clicks.click(row)} + fileName={clicks.icon} + iconColor={ + clicks.colour || + supersetTheme.colors.grayscale.dark2 + } + iconSize="xl" + style={{ + marginRight: 3.6, + visibility: column.showHover + ? openRow === rowIndex + ? 'visible' + : 'hidden' + : 'visible', + height: '56px', + display: 'flex', + alignItems: 'center', + }} + /> + + )} + {!clicks.popperLabel && ( + clicks.click(row)} + fileName={clicks.icon} + iconColor={ + clicks.colour || + supersetTheme.colors.grayscale.dark2 + } + iconSize="xl" + style={{ + marginRight: 3.6, + visibility: column.showHover + ? openRow === rowIndex + ? 'visible' + : 'hidden' + : 'visible', + }} + /> + )} + + ), )} + + {column.field !== 'action' && + !column.input && + !column.editor && + !column.radio && + column.field && + !column.urlField && <>{row[column.field]}} ))}