Skip to content

Commit d2d8c2f

Browse files
authored
fix(vscode): allow undoing clicking of lineage columns (#4876)
1 parent 2507f67 commit d2d8c2f

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
import clsx from 'clsx'
2929
import {
3030
type ColumnDescription,
31-
type Column,
3231
type ColumnLineageApiLineageModelNameColumnNameGet200,
3332
type LineageColumn,
3433
type LineageColumnSource,
@@ -47,6 +46,7 @@ import { useApiColumnLineage } from '@/api/index'
4746
import SourceList from '@/components/sourceList/SourceList'
4847
import type { Lineage } from '@/domain/lineage'
4948
import type { ModelName } from '@/domain/models'
49+
import type { Column } from '@/domain/column'
5050

5151
export default function ModelColumns({
5252
nodeId,
@@ -207,7 +207,7 @@ export default function ModelColumns({
207207
id={toID(nodeId, column.name)}
208208
nodeId={nodeId}
209209
column={column}
210-
disabled={true}
210+
disabled={disabled}
211211
updateColumnLineage={updateColumnLineage}
212212
removeEdges={removeEdges}
213213
isActive={true}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ 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 { type Column } from '@/api/client'
98
import ModelNodeHeaderHandles from './ModelNodeHeaderHandles'
109
import ModelColumns from './ModelColumns'
10+
import { fromAPIColumn, type Column } from '@/domain/column'
1111

1212
export const EnumLineageNodeModelType = {
1313
...ModelType,
@@ -53,7 +53,7 @@ export default function ModelNode({
5353
const modelsArray = Object.values(models)
5454
const decodedId = decodeURIComponent(id)
5555
const model = modelsArray.find((m: Model) => m.fqn === decodedId)
56-
const modelColumns = model?.columns ?? []
56+
const modelColumns = model?.columns?.map(fromAPIColumn) ?? []
5757

5858
Object.keys(lineage[decodedId]?.columns ?? {}).forEach((column: string) => {
5959
const found = modelColumns.find(({ name }: any) => {
@@ -65,7 +65,9 @@ export default function ModelNode({
6565
})
6666

6767
if (isNil(found)) {
68-
modelColumns.push({ name: column, type: EnumColumnType.UNKNOWN })
68+
modelColumns.push(
69+
fromAPIColumn({ name: column, type: EnumColumnType.UNKNOWN }),
70+
)
6971
}
7072
})
7173

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type Column, type Model } from '@/api/client'
1+
import { type Model } from '@/api/client'
22
import {
33
createContext,
44
useState,
@@ -11,6 +11,7 @@ import { EnumSide } from './types'
1111
import { type Node } from 'reactflow'
1212
import type { Lineage } from '@/domain/lineage'
1313
import type { ModelSQLMeshModel } from '@/domain/sqlmesh-model'
14+
import type { Column } from '@/domain/column'
1415

1516
export interface Connections {
1617
left: string[]

vscode/react/src/domain/column.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { type Column as APIColumn } from '@/api/client'
2+
import { type Branded } from '@bus/brand'
3+
4+
export type ColumnName = Branded<string, 'ColumnName'>
5+
6+
export type Column = {
7+
name: ColumnName
8+
type: string
9+
description?: string
10+
}
11+
12+
export function fromAPIColumn(column: APIColumn): Column {
13+
return {
14+
name: column.name as ColumnName,
15+
type: column.type,
16+
description: column.description ?? undefined,
17+
}
18+
}

0 commit comments

Comments
 (0)