Skip to content

Commit b043f25

Browse files
authored
chore(vscode): delete unused code (#4885)
1 parent 0a41cc8 commit b043f25

File tree

3 files changed

+6
-150
lines changed

3 files changed

+6
-150
lines changed

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

Lines changed: 3 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import React, {
2-
useEffect,
3-
useMemo,
4-
useState,
5-
useCallback,
6-
Fragment,
7-
useRef,
8-
} from 'react'
1+
import React, { useEffect, useMemo, useCallback } from 'react'
92
import { Handle, Position, useUpdateNodeInternals } from 'reactflow'
103
import 'reactflow/dist/base.css'
114
import { mergeLineageWithColumns, mergeConnections } from './help'
@@ -20,18 +13,12 @@ import {
2013
} from '@/utils/index'
2114
import { EnumSide, type Side } from './types'
2215
import { NoSymbolIcon } from '@heroicons/react/24/solid'
23-
import {
24-
InformationCircleIcon,
25-
ClockIcon,
26-
ExclamationCircleIcon,
27-
} from '@heroicons/react/24/outline'
16+
import { ClockIcon, ExclamationCircleIcon } from '@heroicons/react/24/outline'
2817
import clsx from 'clsx'
2918
import {
3019
type ColumnDescription,
3120
type ColumnLineageApiLineageModelNameColumnNameGet200,
3221
type LineageColumn,
33-
type LineageColumnSource,
34-
type LineageColumnExpression,
3522
} from '@/api/client'
3623
import Loading from '@/components/loading/Loading'
3724
import Spinner from '@/components/logo/Spinner'
@@ -41,21 +28,19 @@ import {
4128
type ModelSQLMeshModel,
4229
} from '@/domain/sqlmesh-model'
4330
import { useLineageFlow } from './context'
44-
import { Popover, Transition } from '@headlessui/react'
4531
import { useApiColumnLineage } from '@/api/index'
4632
import SourceList from '@/components/sourceList/SourceList'
4733
import type { Lineage } from '@/domain/lineage'
4834
import type { ModelName } from '@/domain/models'
4935
import type { Column } from '@/domain/column'
5036

51-
export default function ModelColumns({
37+
export function ModelColumns({
5238
nodeId,
5339
columns,
5440
disabled,
5541
className,
5642
limit = 5,
5743
withHandles = false,
58-
withSource = false,
5944
withDescription = true,
6045
maxHeight = '50vh',
6146
}: {
@@ -65,7 +50,6 @@ export default function ModelColumns({
6550
className?: string
6651
limit?: number
6752
withHandles?: boolean
68-
withSource?: boolean
6953
withDescription?: boolean
7054
maxHeight?: string
7155
}): JSX.Element {
@@ -224,17 +208,6 @@ export default function ModelColumns({
224208
}
225209
withHandles={withHandles}
226210
withDescription={withDescription}
227-
expression={
228-
withSource
229-
? getColumnFromLineage(lineage, nodeId, column.name)
230-
?.expression
231-
: undefined
232-
}
233-
source={
234-
withSource
235-
? getColumnFromLineage(lineage, nodeId, column.name)?.source
236-
: undefined
237-
}
238211
isEmpty={
239212
isNotNil(getColumnFromLineage(lineage, nodeId, column.name)) &&
240213
Object.keys(
@@ -273,17 +246,6 @@ export default function ModelColumns({
273246
}
274247
withHandles={withHandles}
275248
withDescription={withDescription}
276-
expression={
277-
withSource
278-
? getColumnFromLineage(lineage, nodeId, column.name)
279-
?.expression
280-
: undefined
281-
}
282-
source={
283-
withSource
284-
? getColumnFromLineage(lineage, nodeId, column.name)?.source
285-
: undefined
286-
}
287249
isEmpty={
288250
isNotNil(getColumnFromLineage(lineage, nodeId, column.name)) &&
289251
Object.keys(
@@ -330,17 +292,6 @@ export default function ModelColumns({
330292
}
331293
withHandles={withHandles}
332294
withDescription={withDescription}
333-
expression={
334-
withSource
335-
? getColumnFromLineage(lineage, nodeId, item.name)
336-
?.expression
337-
: undefined
338-
}
339-
source={
340-
withSource
341-
? getColumnFromLineage(lineage, nodeId, item.name)?.source
342-
: undefined
343-
}
344295
isEmpty={
345296
isNotNil(getColumnFromLineage(lineage, nodeId, item.name)) &&
346297
Object.keys(
@@ -373,8 +324,6 @@ function ModelColumn({
373324
selectManually,
374325
withHandles = false,
375326
withDescription = true,
376-
source,
377-
expression,
378327
}: {
379328
id: string
380329
nodeId: string
@@ -385,8 +334,6 @@ function ModelColumn({
385334
hasRight?: boolean
386335
isEmpty?: boolean
387336
withHandles?: boolean
388-
source?: LineageColumnSource
389-
expression?: LineageColumnExpression
390337
withDescription?: boolean
391338
updateColumnLineage: (
392339
lineage: ColumnLineageApiLineageModelNameColumnNameGet200,
@@ -447,12 +394,6 @@ function ModelColumn({
447394
disabled={disabled}
448395
className="px-2"
449396
>
450-
{isNotNil(source) && (
451-
<ColumnSource
452-
source={source}
453-
expression={expression}
454-
/>
455-
)}
456397
<ColumnStatus
457398
isFetching={isFetching}
458399
isError={isError}
@@ -644,90 +585,6 @@ function ColumnStatus({
644585
)
645586
}
646587

647-
function ColumnSource({
648-
// source,
649-
expression,
650-
}: {
651-
source: LineageColumnSource
652-
expression?: LineageColumnExpression
653-
}): JSX.Element {
654-
const elSourceContainer = useRef<HTMLDivElement>(null)
655-
// const { handleClickModel } = useLineageFlow()
656-
657-
// const modelExtensions = useSQLMeshModelExtensions(undefined, model => {
658-
// handleClickModel?.(model.name)
659-
// })
660-
661-
const [isShowing, setIsShowing] = useState(false)
662-
663-
useEffect(() => {
664-
if (isShowing) {
665-
scrollToExpression()
666-
}
667-
}, [isShowing, expression])
668-
669-
function scrollToExpression(): void {
670-
// NOTE: This is a hack to scroll to the expression
671-
// and should be replaced with a code mirror extension
672-
setTimeout(() => {
673-
const lines = Array.from(
674-
elSourceContainer.current?.querySelector('[role="textbox"].cm-content')
675-
?.children ?? [],
676-
)
677-
678-
for (const node of lines) {
679-
if (node.textContent?.trim() === expression) {
680-
node.scrollIntoView({
681-
behavior: 'smooth',
682-
block: 'center',
683-
inline: 'nearest',
684-
})
685-
setTimeout(() => node.classList.add('sqlmesh-expression'), 500)
686-
return
687-
}
688-
}
689-
}, 300)
690-
}
691-
692-
return (
693-
<Popover
694-
onMouseLeave={() => setIsShowing(false)}
695-
onMouseOver={() => setIsShowing(true)}
696-
className="flex"
697-
>
698-
<InformationCircleIcon
699-
className={clsx(
700-
'inline-block mr-3 w-4 h-4',
701-
isShowing ? 'text-inherit' : 'text-prose',
702-
)}
703-
/>
704-
<Transition
705-
show={isShowing}
706-
as={Fragment}
707-
enter="transition ease-out duration-200"
708-
enterFrom="opacity-0 -translate-y-[40%]"
709-
enterTo="opacity-100 -translate-y-[50%]"
710-
leave="transition ease-in duration-150"
711-
leaveFrom="opacity-100 -translate-y-[50%]"
712-
leaveTo="opacity-0 -translate-y-[40%]"
713-
>
714-
<Popover.Panel
715-
ref={elSourceContainer}
716-
className="fixed -translate-x-[100%] -translate-y-[50%] z-10 content transform cursor-pointer rounded-lg bg-theme border-4 border-neutral-200 dark:border-neutral-600"
717-
onClick={e => e.stopPropagation()}
718-
>
719-
{/* <CodeEditorDefault
720-
content={source as string}
721-
type={EnumFileExtensions.SQL}
722-
className="w-full h-[25rem] text-xs rounded-lg scrollbar scrollbar--vertical scrollbar--horizontal overflow-auto max-w-[40rem]"
723-
extensions={modelExtensions}
724-
/> */}
725-
</Popover.Panel>
726-
</Transition>
727-
</Popover>
728-
)
729-
}
730-
731588
function getColumnFromLineage(
732589
lineage: Record<string, Lineage>,
733590
nodeId: string,

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { ModelType, type Model } from '@/api/client'
55
import { useLineageFlow } from './context'
66
import { type GraphNodeData } from './help'
77
import { Position, type NodeProps } from 'reactflow'
8-
import ModelNodeHeaderHandles from './ModelNodeHeaderHandles'
9-
import ModelColumns from './ModelColumns'
8+
import { ModelNodeHeaderHandles } from './ModelNodeHeaderHandles'
9+
import { ModelColumns } from './ModelColumns'
1010
import { fromAPIColumn, type Column } from '@/domain/column'
1111

1212
export const EnumLineageNodeModelType = {
@@ -229,7 +229,6 @@ export default function ModelNode({
229229
columns={columns}
230230
disabled={shouldDisableColumns}
231231
withHandles={true}
232-
withSource={true}
233232
withDescription={false}
234233
maxHeight="10rem"
235234
/>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { ArrowRightCircleIcon } from '@heroicons/react/24/solid'
88
import clsx from 'clsx'
99
import { type LineageNodeModelType } from './ModelNode'
1010

11-
export default function ModelNodeHeaderHandles({
11+
export function ModelNodeHeaderHandles({
1212
id,
1313
className,
1414
hasLeft = false,

0 commit comments

Comments
 (0)