From d64f0d3126706dae6727424364ca34d2f0f3f367 Mon Sep 17 00:00:00 2001 From: "Wei-Chun, Chang" Date: Wed, 27 Sep 2023 11:51:02 +0800 Subject: [PATCH] Adjust skip datasource data type to fit convention Signed-off-by: Wei-Chun, Chang --- .../components/Reports/ReportContextBar.tsx | 59 +++++++++---------- .../TableList/TableColumnSchemaList.tsx | 10 +++- static_report/src/pages/CRTableDetailPage.tsx | 16 +++-- static_report/src/pages/SRTableDetailPage.tsx | 7 ++- 4 files changed, 53 insertions(+), 39 deletions(-) diff --git a/static_report/src/components/Reports/ReportContextBar.tsx b/static_report/src/components/Reports/ReportContextBar.tsx index af5b2ea30..0da172059 100644 --- a/static_report/src/components/Reports/ReportContextBar.tsx +++ b/static_report/src/components/Reports/ReportContextBar.tsx @@ -1,12 +1,4 @@ -import { - Box, - Flex, - FlexProps, - Icon, - Link, - Text, - Tooltip, -} from '@chakra-ui/react'; +import { Box, Flex, FlexProps, Link, Text, Tooltip } from '@chakra-ui/react'; import { ReactNode } from 'react'; import { BiPlug } from 'react-icons/bi'; import { BsGearWideConnected } from 'react-icons/bs'; @@ -42,7 +34,8 @@ export function ReportContextBar({ let gitBranch: string | undefined = undefined; let githubPr: string | undefined = undefined; let githubPrUrl: string | undefined = undefined; - let reportFrom: string | undefined = undefined; + let baseFrom: string | undefined = undefined; + let targetFrom: string | undefined = undefined; let skipDataSource: boolean | undefined = false; if (data) { @@ -52,9 +45,9 @@ export function ReportContextBar({ version = report.version; gitBranch = report.datasource?.git_branch; skipDataSource = report.datasource?.skip_datasource; - reportFrom = report.datasource?.skip_datasource - ? 'Manifest File' - : report.datasource.type; + baseFrom = report.datasource?.skip_datasource + ? 'Manifest file' + : `${report.datasource.type} connection`; } else { const report = data as ComparisonReportSchema; const fallback = report.input ?? report.base; @@ -82,18 +75,12 @@ export function ReportContextBar({ report.base?.datasource.skip_datasource || report.input?.datasource.skip_datasource; - const baseFrom = report.base?.datasource.skip_datasource - ? 'Manifest File' - : report.base?.datasource.type; - const targetFrom = report.input?.datasource.skip_datasource - ? 'Manifest File' - : report.input?.datasource.type; - - if (baseFrom !== targetFrom) { - reportFrom = `${baseFrom} ↔ ${targetFrom}`; - } else { - reportFrom = baseFrom; - } + baseFrom = report.base?.datasource.skip_datasource + ? 'Manifest file' + : `${report.base?.datasource.type} connection`; + targetFrom = report.input?.datasource.skip_datasource + ? 'Manifest file' + : `${report.input?.datasource.type} connection`; } } @@ -104,17 +91,29 @@ export function ReportContextBar({ label="Connect PipeRider to your datasource for full schema info" placement="top-start" > - + ) : ( - + ); }; const showReportSource = ( - reportFrom: string | undefined, + singleOnly: boolean | undefined, + baseFrom: string | undefined, + targetFrom: string | undefined, skipDataSource: boolean | undefined, ) => { + let source: string | undefined = undefined; + if (singleOnly) { + source = baseFrom; + } else { + if (baseFrom !== targetFrom) { + source = `${baseFrom} ↔ ${targetFrom}`; + } else { + source = baseFrom; + } + } return ( {showIcon(skipDataSource)} @@ -125,7 +124,7 @@ export function ReportContextBar({ textOverflow="ellipsis" overflow="hidden" > - source: {reportFrom} + source: {source} ); @@ -206,7 +205,7 @@ export function ReportContextBar({ )} - {showReportSource(reportFrom, skipDataSource)} + {showReportSource(singleOnly, baseFrom, targetFrom, skipDataSource)} {actionArea && {actionArea}} diff --git a/static_report/src/components/Tables/TableList/TableColumnSchemaList.tsx b/static_report/src/components/Tables/TableList/TableColumnSchemaList.tsx index 15bd60689..6422e6b41 100644 --- a/static_report/src/components/Tables/TableList/TableColumnSchemaList.tsx +++ b/static_report/src/components/Tables/TableList/TableColumnSchemaList.tsx @@ -24,11 +24,13 @@ import { CompColEntryItem } from '../../../lib'; interface Props extends Comparable { columns?: CompColEntryItem[]; visibleDetail?: boolean; //for reuse in other pages + skipDataSource?: boolean; } export function TableColumnSchemaList({ columns, singleOnly, visibleDetail = false, + skipDataSource, }: Props) { const isNotSingle = !singleOnly; @@ -101,7 +103,9 @@ export function TableColumnSchemaList({ borderRight={isNotSingle ? '1px solid lightgray' : ''} > - {baseColumn?.schema_type ?? NO_VALUE} + {skipDataSource + ? '-' + : baseColumn?.schema_type ?? NO_VALUE} {isNotSingle ? ( @@ -128,7 +132,9 @@ export function TableColumnSchemaList({ } > - {targetColumn?.schema_type ?? NO_VALUE} + {skipDataSource + ? '-' + : targetColumn?.schema_type ?? NO_VALUE} diff --git a/static_report/src/pages/CRTableDetailPage.tsx b/static_report/src/pages/CRTableDetailPage.tsx index b778a4817..3011ad107 100644 --- a/static_report/src/pages/CRTableDetailPage.tsx +++ b/static_report/src/pages/CRTableDetailPage.tsx @@ -210,7 +210,11 @@ export default function CRTableDetailPage() { - + @@ -247,7 +251,7 @@ function ComparableGridHeader() { ); } -function TableColumnSchemaCompList({ tableEntry }) { +function TableColumnSchemaCompList({ tableEntry, skipBase, skipTarget }) { const [ , { base: baseTableColEntry, target: targetTableColEntry }, @@ -300,7 +304,7 @@ function TableColumnSchemaCompList({ tableEntry }) { borderRightColor="gray.200" > - {baseColumn?.schema_type ?? NO_VALUE} + {skipBase ? '-' : baseColumn?.schema_type ?? NO_VALUE} @@ -320,7 +324,9 @@ function TableColumnSchemaCompList({ tableEntry }) { - {targetColumn?.schema_type ?? NO_VALUE} + {skipTarget + ? '-' + : targetColumn?.schema_type ?? NO_VALUE} @@ -369,7 +375,7 @@ function TableColumnSchemaCompList({ tableEntry }) { - {column?.schema_type ?? NO_VALUE} + {skipBase ? '-' : column?.schema_type ?? NO_VALUE} diff --git a/static_report/src/pages/SRTableDetailPage.tsx b/static_report/src/pages/SRTableDetailPage.tsx index 690e5bf65..12a4f23f8 100644 --- a/static_report/src/pages/SRTableDetailPage.tsx +++ b/static_report/src/pages/SRTableDetailPage.tsx @@ -13,7 +13,6 @@ import { TableColumnHeader } from '../components/Tables/TableColumnHeader'; import { useReportStore } from '../utils/store'; import { useTableRoute } from '../utils/routes'; import { SkipDataSource } from '../components/Common/SkipDataSource'; -import { sk } from 'date-fns/locale'; export default function SRTableDetailPage() { let { tableName, uniqueId } = useTableRoute(); @@ -88,7 +87,11 @@ export default function SRTableDetailPage() { - + );