Skip to content

Commit c37feb6

Browse files
committed
feat(vscode): allow users to turn off/on columns in graph
1 parent d9f5fbc commit c37feb6

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

vscode/react/src/components/graph/ModelLineage.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,14 +390,8 @@ function ModelColumnLineage(): JSX.Element {
390390
showInteractive={false}
391391
>
392392
<SettingsControl
393-
settings={{
394-
showColumns: withColumns,
395-
}}
396-
onSettingChange={(setting, value) => {
397-
if (setting === 'showColumns') {
398-
setWithColumns(value)
399-
}
400-
}}
393+
showColumns={withColumns}
394+
onWithColumnsChange={setWithColumns}
401395
/>
402396
</Controls>
403397
<Background

vscode/react/src/components/graph/ModelNode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export default function ModelNode({
141141
const isModelExternal = nodeType === EnumLineageNodeModelType.external
142142
const isModelSeed = nodeType === EnumLineageNodeModelType.seed
143143
const isModelUnknown = nodeType === EnumLineageNodeModelType.unknown
144-
const showColumns = isArrayNotEmpty(columns) && isFalse(hasHighlightedNodes)
144+
const showColumns = nodeData.withColumns && isArrayNotEmpty(columns) && isFalse(hasHighlightedNodes)
145145
const isActiveNode =
146146
selectedNodes.size > 0 || activeNodes.size > 0 || withConnected
147147
? isSelected ||

vscode/react/src/components/graph/SettingsControl.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ import { CheckIcon } from '@heroicons/react/24/outline'
55
import clsx from 'clsx'
66

77
interface SettingsControlProps {
8-
settings: {
9-
showColumns: boolean
10-
}
11-
onSettingChange: (setting: string, value: boolean) => void
8+
showColumns: boolean
9+
onWithColumnsChange: (value: boolean) => void
1210
}
1311

1412
export function SettingsControl({
15-
settings,
16-
onSettingChange,
13+
showColumns,
14+
onWithColumnsChange,
1715
}: SettingsControlProps): JSX.Element {
1816
return (
1917
<Menu as="div" className="relative">
@@ -29,7 +27,7 @@ export function SettingsControl({
2927
leaveFrom="transform opacity-100 scale-100"
3028
leaveTo="transform opacity-0 scale-95"
3129
>
32-
<Menu.Items className="absolute bottom-full mb-2 right-0 w-56 origin-bottom-right divide-y divide-neutral-100 dark:divide-neutral-800 rounded-md bg-theme shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none z-50">
30+
<Menu.Items className="absolute bottom-full mb-2 left-0 w-56 origin-bottom-left divide-y divide-neutral-100 dark:divide-neutral-800 rounded-md bg-theme shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none z-50">
3331
<div className="px-1 py-1">
3432
<Menu.Item>
3533
{({ active }) => (
@@ -40,10 +38,10 @@ export function SettingsControl({
4038
? 'bg-primary-10 text-primary-500'
4139
: 'text-neutral-700 dark:text-neutral-300'
4240
)}
43-
onClick={() => onSettingChange('showColumns', !settings.showColumns)}
41+
onClick={() => onWithColumnsChange(!showColumns)}
4442
>
4543
<span className="flex-1 text-left">Show Columns</span>
46-
{settings.showColumns && (
44+
{showColumns && (
4745
<CheckIcon className="h-4 w-4 text-primary-500" aria-hidden="true" />
4846
)}
4947
</button>

0 commit comments

Comments
 (0)