Skip to content

Commit d9f5fbc

Browse files
committed
temp
1 parent ca58880 commit d9f5fbc

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { Popover } from '@headlessui/react'
3636
import ModelLineageDetails from './ModelLineageDetails'
3737
import { Divider } from '@/components/divider/Divider'
3838
import { type ModelLineageApiLineageModelNameGet200 } from '@/api/client'
39+
import { SettingsControl } from './SettingsControl'
3940
import './Graph.css'
4041

4142
const WITH_COLUMNS_LIMIT = 30
@@ -203,6 +204,7 @@ function ModelColumnLineage(): JSX.Element {
203204
showControls,
204205
handleError,
205206
setActiveNodes,
207+
setWithColumns,
206208
} = useLineageFlow()
207209

208210
const { setCenter } = useReactFlow()
@@ -386,7 +388,18 @@ function ModelColumnLineage(): JSX.Element {
386388
<Controls
387389
className="bg-light p-1 rounded-md !border-none !shadow-lg"
388390
showInteractive={false}
389-
/>
391+
>
392+
<SettingsControl
393+
settings={{
394+
showColumns: withColumns,
395+
}}
396+
onSettingChange={(setting, value) => {
397+
if (setting === 'showColumns') {
398+
setWithColumns(value)
399+
}
400+
}}
401+
/>
402+
</Controls>
390403
<Background
391404
variant={BackgroundVariant.Cross}
392405
gap={32}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { Fragment, useState } from 'react'
2+
import { Menu, Transition } from '@headlessui/react'
3+
import { CogIcon } from '@heroicons/react/24/solid'
4+
import { CheckIcon } from '@heroicons/react/24/outline'
5+
import clsx from 'clsx'
6+
7+
interface SettingsControlProps {
8+
settings: {
9+
showColumns: boolean
10+
}
11+
onSettingChange: (setting: string, value: boolean) => void
12+
}
13+
14+
export function SettingsControl({
15+
settings,
16+
onSettingChange,
17+
}: SettingsControlProps): JSX.Element {
18+
return (
19+
<Menu as="div" className="relative">
20+
<Menu.Button className="react-flow__controls-button" title="Settings">
21+
<CogIcon className="h-3 w-3" aria-hidden="true" />
22+
</Menu.Button>
23+
<Transition
24+
as={Fragment}
25+
enter="transition ease-out duration-100"
26+
enterFrom="transform opacity-0 scale-95"
27+
enterTo="transform opacity-100 scale-100"
28+
leave="transition ease-in duration-75"
29+
leaveFrom="transform opacity-100 scale-100"
30+
leaveTo="transform opacity-0 scale-95"
31+
>
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">
33+
<div className="px-1 py-1">
34+
<Menu.Item>
35+
{({ active }) => (
36+
<button
37+
className={clsx(
38+
'group flex w-full items-center rounded-md px-2 py-2 text-sm',
39+
active
40+
? 'bg-primary-10 text-primary-500'
41+
: 'text-neutral-700 dark:text-neutral-300'
42+
)}
43+
onClick={() => onSettingChange('showColumns', !settings.showColumns)}
44+
>
45+
<span className="flex-1 text-left">Show Columns</span>
46+
{settings.showColumns && (
47+
<CheckIcon className="h-4 w-4 text-primary-500" aria-hidden="true" />
48+
)}
49+
</button>
50+
)}
51+
</Menu.Item>
52+
</div>
53+
</Menu.Items>
54+
</Transition>
55+
</Menu>
56+
)
57+
}

0 commit comments

Comments
 (0)