Skip to content

Commit

Permalink
Bold columns connected to the current column
Browse files Browse the repository at this point in the history
  • Loading branch information
bengotow committed Mar 19, 2024
1 parent 3fb3117 commit 346476a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,31 @@ export const AssetColumnNode = ({
assetKey,
column,
selected,
bolded,
}: {
assetKey: AssetKeyInput;
column: AssetColumnLineageLocalColumn;
selected: boolean;
bolded: boolean;
}) => {
const icon = iconForColumnType(column.type ?? '');

return (
<Box margin={{horizontal: 12}} style={{height: 32}} flex={{direction: 'column'}}>
<Box flex={{direction: 'column'}}>
<Tooltip key={column.name} content={column.description || 'No description provided'}>
<ColumnLink
to={assetDetailsPathForKey(assetKey, {view: 'lineage', column: column.name})}
$selected={selected}
>
{icon ? <Icon name={icon} /> : <span style={{width: 16}} />}
<Caption style={{whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>
<Caption
style={{
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
fontWeight: bolded ? 600 : 'initial',
}}
>
{column.name}
</Caption>
</ColumnLink>
Expand All @@ -78,7 +87,7 @@ export const AssetColumnNode = ({

const ColumnLink = styled(Link)<{$selected: boolean}>`
height: 28px;
margin: 2px 0;
margin: 2px 12px;
padding-left: 2px;
padding-right: 4px;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Box, Spinner} from '@dagster-io/ui-components';
import {useRef, useState} from 'react';
import {useMemo, useRef, useState} from 'react';
import styled from 'styled-components';

import {SVGSaveZoomLevel, useLastSavedZoomLevel} from './SavedZoomLevel';
Expand Down Expand Up @@ -39,6 +39,20 @@ export const AssetColumnLineageGraph = ({

useLastSavedZoomLevel(viewportEl, layout, focusedAssetGraphId);

const bolded = useMemo(() => {
const bolded = new Set<string>();
if (!highlighted || !layout) {
return bolded;
}

for (const id of highlighted) {
bolded.add(id);
layout.edges.filter((e) => e.fromId === id).forEach((e) => bolded.add(e.toId));
layout.edges.filter((e) => e.toId === id).forEach((e) => bolded.add(e.fromId));
}
return bolded;
}, [layout, highlighted]);

if (!layout || loading) {
return (
<Box style={{flex: 1}} flex={{alignItems: 'center', justifyContent: 'center'}}>
Expand Down Expand Up @@ -139,6 +153,7 @@ export const AssetColumnLineageGraph = ({
<AssetColumnNode
assetKey={assetKey}
column={col}
bolded={bolded.has(id)}
selected={assetGraphId === focusedAssetGraphId && focusedColumn === column}
/>
</foreignObject>
Expand Down

0 comments on commit 346476a

Please sign in to comment.