Skip to content

Commit

Permalink
Merge pull request #1277 from DalgoT4D/data-insights-review-issues
Browse files Browse the repository at this point in the history
Data insights review issues
  • Loading branch information
Ishankoradia authored Oct 16, 2024
2 parents a372576 + ceefa49 commit 60f6e4d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 25 deletions.
7 changes: 6 additions & 1 deletion src/components/Explore/Explore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@ export const Explore = () => {
<Tabs
value={selectedTab}
onChange={handleTabChange}
sx={{ display: 'flex', alignItems: 'center', height: '100%' }}
sx={{
display: 'flex',
alignItems: 'center',
height: '100%',
paddingLeft: '28px',
}}
>
<Tab label="Preview" value="preview" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,16 @@ const PreviewPane = ({ height }: { height: number }) => {
alignItems: 'center',
display: 'flex',
justifyContent: 'space-between',
padding: '5px',
padding: '8px 8px 8px 44px',
}}
>
<Typography variant="body1" fontWeight="bold" padding="10px">
<Typography variant="body1" fontWeight="bold">
{modelToPreview?.input_name}
</Typography>
<Button
onClick={handleTableDataDownload}
variant="contained"
sx={{ padding: '5px' }}
sx={{ padding: '5px ' }}
disabled={downloadInProgress}
data-testid="downloadbutton"
>
Expand All @@ -215,15 +215,15 @@ const PreviewPane = ({ height }: { height: number }) => {
<TableHead>
{getHeaderGroups().map((headerGroup: any) => (
<TableRow key={headerGroup.id}>
{headerGroup.headers.map((header: any) => (
{headerGroup.headers.map((header: any, i: number) => (
<TableCell
key={header.id}
colSpan={header.colSpan}
sx={{
backgroundColor: '#F5FAFA',
border: '1px solid #dddddd',
borderLeft: 'unset',
padding: '8px',
padding: i == 0 ? '8px 0 8px 40px' : '8px',
textAlign: 'left',
fontWeight: 700,
color: 'rgba(15, 36, 64, 0.57)',
Expand All @@ -250,14 +250,14 @@ const PreviewPane = ({ height }: { height: number }) => {
{getRowModel().rows.map((row: any) => {
return (
<TableRow key={row.id} sx={{ boxShadow: 'unset' }}>
{row.getVisibleCells().map((cell: any) => (
{row.getVisibleCells().map((cell: any, i: number) => (
<TableCell
key={cell.id}
sx={{
fontWeight: 600,
borderBottom: '1px solid #dddddd',
borderRight: '1px solid #dddddd',

padding: i === 0 ? '8px 40px 8px 44px' : '8px',
textAlign: 'left',
fontSize: '0.8rem',
}}
Expand Down Expand Up @@ -295,7 +295,7 @@ const PreviewPane = ({ height }: { height: number }) => {
height: height,
}}
>
Select a table to view
Select a table from the left pane to view
</Box>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export const StatisticsPane: React.FC<StatisticsPaneProps> = ({ height }) => {
{
accessorKey: 'name',
header: 'Column name',
size: 150,
size: 160,
enableSorting: true,
},
{
Expand Down Expand Up @@ -424,8 +424,8 @@ export const StatisticsPane: React.FC<StatisticsPaneProps> = ({ height }) => {
alignItems: 'center',
}}
>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Typography variant="body1" fontWeight="bold" padding="10px">
<Box sx={{ display: 'flex', alignItems: 'center', padding: '6px 8px 6px 44px' }}>
<Typography variant="body1" fontWeight="bold">
{modelToPreview?.input_name}
</Typography>
<Box
Expand Down Expand Up @@ -473,15 +473,16 @@ export const StatisticsPane: React.FC<StatisticsPaneProps> = ({ height }) => {
<TableHead>
{getHeaderGroups().map((headerGroup) => (
<TableRow key={headerGroup.id}>
{headerGroup.headers.map((header) => (
{headerGroup.headers.map((header, i) => (
<TableCell
key={header.id}
colSpan={header.colSpan}
sx={{
width: header.column.columnDef.size,
backgroundColor: '#F5FAFA',
border: '1px solid #dddddd',
padding: '8px',
padding: i == 0 ? '8px 8px 8px 40px' : '8px',

textAlign: 'left',
fontWeight: 700,
color: 'rgba(15, 36, 64, 0.57)',
Expand Down Expand Up @@ -516,7 +517,7 @@ export const StatisticsPane: React.FC<StatisticsPaneProps> = ({ height }) => {
height: '180px',
}}
>
{row.getVisibleCells().map((cell) => {
{row.getVisibleCells().map((cell, i) => {
return (
<TableCell
key={cell.id}
Expand All @@ -526,6 +527,7 @@ export const StatisticsPane: React.FC<StatisticsPaneProps> = ({ height }) => {
textAlign: 'left',
borderBottom: '1px solid #ddd',
fontSize: '0.8rem',
padding: i == 0 ? '8px 8px 8px 46px' : '8px',
}}
>
{cell.getValue() !== undefined ? (
Expand Down Expand Up @@ -578,7 +580,7 @@ export const StatisticsPane: React.FC<StatisticsPaneProps> = ({ height }) => {
height: debouncedHeight,
}}
>
Select a table to view
Select a table from the left pane to view
</Box>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ describe('PreviewPane Component', () => {
});
});

test('renders "Select a table to view" message when no table is selected', () => {
test('renders "Select a table from the left pane to view " message when no table is selected', () => {
usePreviewAction.mockReturnValue({ previewAction: { type: 'clear-preview' } });

render(<PreviewPane height={600} />);

expect(screen.getByText('Select a table to view')).toBeInTheDocument();
expect(screen.getByText('Select a table from the left pane to view ')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('StatisticsPane', () => {
);

// Check for the message when no model is selected
expect(screen.getByText(/Select a table to view/i)).toBeInTheDocument();
expect(screen.getByText(/Select a table from the left pane to view /i)).toBeInTheDocument();
});

it('should resolve when status is completed', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { trimString } from '@/utils/common';
import Image from 'next/image';
import ReplayIcon from '@mui/icons-material/Replay';
import { GlobalContext } from '@/contexts/ContextProvider';
import SyncIcon from '@/assets/icons/sync.svg';
import styles from '@/styles/Common.module.css';

const Node = ({ node, style, dragHandle, handleSyncClick, isSyncing }: any) => {
const globalContext = useContext(GlobalContext);
Expand All @@ -24,6 +22,11 @@ const Node = ({ node, style, dragHandle, handleSyncClick, isSyncing }: any) => {
const data: DbtSourceModel = node.data;
let name: string | JSX.Element = !node.isLeaf ? data.schema : data.input_name;
name = trimString(name, stringLengthWithWidth);
useEffect(() => {
if (!node.isLeaf && node.level === 0 && !node.isOpen) {
node.toggle();
}
}, [node]);

return (
<Box
Expand All @@ -36,7 +39,7 @@ const Node = ({ node, style, dragHandle, handleSyncClick, isSyncing }: any) => {
width: (250 * width) / 270 + 'px',
opacity: permissions.includes('can_create_dbt_model') ? 1 : 0.5,
}}
onClick={() => (node.isLeaf ? undefined : node.toggle())}
onClick={() => (node.isLeaf || node.level === 0 ? undefined : node.toggle())}
>
{node.isLeaf ? (
<Image src={TocIcon} alt="Toc icon" />
Expand Down Expand Up @@ -120,15 +123,14 @@ const ProjectTree = ({
};
});

setProjectTreeData([{ id: '0', schema: 'Store', children: treeData }]);
setProjectTreeData([{ id: '0', schema: 'Schemas', children: treeData }]);
};

useEffect(() => {
if (dbtSourceModels) {
constructAndSetProjectTreeData(dbtSourceModels);
}
}, [dbtSourceModels]);

return (
<Box
sx={{
Expand Down
2 changes: 1 addition & 1 deletion src/components/TransformWorkflow/FlowEditor/FlowEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const LowerSection = ({
<Tabs
value={selectedTab}
onChange={handleTabChange}
sx={{ display: 'flex', alignItems: 'center', height: '100%' }}
sx={{ display: 'flex', alignItems: 'center', height: '100%', paddingLeft: '28px' }}
>
<Tab label="Preview" value="preview" />
<Tab label="Logs" value="logs" />
Expand Down

0 comments on commit 60f6e4d

Please sign in to comment.