Skip to content

Commit

Permalink
Adjust skip datasource data type to fit convention
Browse files Browse the repository at this point in the history
Signed-off-by: Wei-Chun, Chang <[email protected]>
  • Loading branch information
wcchang1115 committed Sep 27, 2023
1 parent c0b0a75 commit 5322fb5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 23 deletions.
26 changes: 11 additions & 15 deletions static_report/src/components/Reports/ReportContextBar.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -53,7 +45,7 @@ export function ReportContextBar({
gitBranch = report.datasource?.git_branch;
skipDataSource = report.datasource?.skip_datasource;
reportFrom = report.datasource?.skip_datasource
? 'Manifest File'
? 'Manifest file'
: report.datasource.type;
} else {
const report = data as ComparisonReportSchema;
Expand Down Expand Up @@ -83,10 +75,10 @@ export function ReportContextBar({
report.input?.datasource.skip_datasource;

const baseFrom = report.base?.datasource.skip_datasource
? 'Manifest File'
? 'Manifest file'
: report.base?.datasource.type;
const targetFrom = report.input?.datasource.skip_datasource
? 'Manifest File'
? 'Manifest file'
: report.input?.datasource.type;

if (baseFrom !== targetFrom) {
Expand All @@ -104,17 +96,21 @@ export function ReportContextBar({
label="Connect PipeRider to your datasource for full schema info"
placement="top-start"
>
<Icon as={FiInfo} />
<FiInfo />
</Tooltip>
) : (
<Icon as={TbBuildingWarehouse} />
<TbBuildingWarehouse />
);
};

const showReportSource = (
reportFrom: string | undefined,
skipDataSource: boolean | undefined,
) => {
let source = reportFrom;
if (reportFrom !== undefined && reportFrom !== 'Manifest file') {
source = `${reportFrom} connection`;
}
return (
<Flex alignItems={'center'} gap={2} flex="1" overflow="hidden">
{showIcon(skipDataSource)}
Expand All @@ -125,7 +121,7 @@ export function ReportContextBar({
textOverflow="ellipsis"
overflow="hidden"
>
source: {reportFrom}
source: {source}
</Text>
</Flex>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -101,7 +103,9 @@ export function TableColumnSchemaList({
borderRight={isNotSingle ? '1px solid lightgray' : ''}
>
<Text as={'span'} fontSize={'xs'}>
{baseColumn?.schema_type ?? NO_VALUE}
{skipDataSource
? '-'
: baseColumn?.schema_type ?? NO_VALUE}
</Text>
</Td>
{isNotSingle ? (
Expand Down
17 changes: 12 additions & 5 deletions static_report/src/pages/CRTableDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ export default function CRTableDetailPage() {
<VStack spacing={10}>
<SeparateView title="Table Statistics" Comp={TableGeneralStats} />
<MergedView title="Schema">
<TableColumnSchemaCompList tableEntry={currentTableEntry} />
<TableColumnSchemaCompList
tableEntry={currentTableEntry}
skipDataSource
/>
</MergedView>
<SeparateView title="Duplicate Rows" Comp={DupedTableRowsWidget} />
</VStack>
Expand Down Expand Up @@ -247,7 +250,7 @@ function ComparableGridHeader() {
);
}

function TableColumnSchemaCompList({ tableEntry }) {
function TableColumnSchemaCompList({ tableEntry, skipDataSource }) {
const [
,
{ base: baseTableColEntry, target: targetTableColEntry },
Expand Down Expand Up @@ -300,7 +303,9 @@ function TableColumnSchemaCompList({ tableEntry }) {
borderRightColor="gray.200"
>
<Text as={'span'} fontSize={'xs'}>
{baseColumn?.schema_type ?? NO_VALUE}
{skipDataSource
? '-'
: baseColumn?.schema_type ?? NO_VALUE}
</Text>
</Td>

Expand All @@ -320,7 +325,9 @@ function TableColumnSchemaCompList({ tableEntry }) {
</Td>
<Td color={metadata?.mismatched ? 'red.500' : 'inherit'}>
<Text as={'span'} fontSize={'xs'}>
{targetColumn?.schema_type ?? NO_VALUE}
{skipDataSource
? '-'
: targetColumn?.schema_type ?? NO_VALUE}
</Text>
</Td>
</Tr>
Expand Down Expand Up @@ -369,7 +376,7 @@ function TableColumnSchemaCompList({ tableEntry }) {
</Td>
<Td>
<Text as={'span'} fontSize={'xs'}>
{column?.schema_type ?? NO_VALUE}
{skipDataSource ? '-' : column?.schema_type ?? NO_VALUE}
</Text>
</Td>
</Tr>
Expand Down
3 changes: 1 addition & 2 deletions static_report/src/pages/SRTableDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -88,7 +87,7 @@ export default function SRTableDetailPage() {
</VStack>

<Divider orientation="vertical" />
<TableColumnSchemaList columns={columns} singleOnly />
<TableColumnSchemaList columns={columns} singleOnly skipDataSource />
</Grid>
</>
);
Expand Down

0 comments on commit 5322fb5

Please sign in to comment.