Skip to content

Commit 2f833be

Browse files
committed
temp
1 parent 353b447 commit 2f833be

4 files changed

Lines changed: 70 additions & 4 deletions

File tree

vscode/react/src/App.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,10 @@
6565
@apply outline-none ring-offset-2 ring-4;
6666
}
6767
}
68+
69+
:root {
70+
--color-graph-edge-secondary: blue;
71+
--color-graph-edge-main: red;
72+
--color-graph-edge-selected: green;
73+
--color-graph-edge-direct: yellow;
74+
}

vscode/react/src/components/graph/Graph.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ react-flow__attribution {
1313
}
1414
.lineage__column-source b {
1515
font-weight: 900;
16-
color: var(--color-primary);
16+
/* color: var(--color-primary); */
17+
color: black;
1718
}
1819
.react-flow__edge {
1920
pointer-events: none !important;

vscode/react/src/pages/lineage.tsx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
QueryClientProvider,
66
} from '@tanstack/react-query'
77
import { useApiModels } from '@/api'
8-
import LineageFlowProvider from '@/components/graph/context'
8+
import LineageFlowProvider, { useLineageFlow } from '@/components/graph/context'
99
import { ModelLineage } from '@/components/graph/ModelLineage'
1010
import { useVSCode } from '@/hooks/vscode'
1111
import React from 'react'
@@ -108,9 +108,39 @@ export function LineageComponentFromWeb({
108108
handleError={handleError}
109109
models={models}
110110
showControls={false}
111-
>
112-
<ModelLineage model={model} />
111+
> <UpdateLineageFocus>
112+
<ModelLineage model={model} />
113+
</UpdateLineageFocus>
113114
</LineageFlowProvider>
114115
</div>
115116
)
116117
}
118+
119+
export function UpdateLineageFocus({ children }: { children: React.ReactNode }) {
120+
const lineageFlow = useLineageFlow()
121+
122+
React.useEffect(() => {
123+
const handleMessage = (event: MessageEvent) => {
124+
// Ensure the message is from VSCode
125+
if (event.data && event.data.key === 'vscode_send') {
126+
const payload = event.data.payload
127+
switch (payload.key) {
128+
case 'changeFocusOnFile':
129+
console.log('Changing focus to file:', payload.payload.path)
130+
// Implement your focus change logic here
131+
// TODO NEED TO PASS THE FQN of the model not the path
132+
lineageFlow.setMainNode(payload.payload.path)
133+
break
134+
default:
135+
console.error('Unhandled message type in lineage page:', payload.key)
136+
}
137+
}
138+
}
139+
window.addEventListener('message', handleMessage)
140+
return () => {
141+
window.removeEventListener('message', handleMessage)
142+
}
143+
}, [])
144+
145+
return children
146+
}

vscode/react/src/style/variants.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,31 @@ export const EnumVariant = {
2121
} as const
2222

2323
export type Variant = (typeof EnumVariant)[keyof typeof EnumVariant]
24+
25+
26+
interface Model {
27+
test: string
28+
}
29+
30+
Model.do_something(model)
31+
const do_something = (model: Model) => {
32+
model.test = 'test'
33+
}
34+
35+
vscpde.postMessage()
36+
37+
class ModelClass {
38+
test: string
39+
40+
constructor(test: string) {
41+
this.test = test
42+
}
43+
44+
static do_something(model: Model) {
45+
model.test = 'test'
46+
}
47+
48+
do_something() {
49+
this.test = 'test'
50+
}
51+
}

0 commit comments

Comments
 (0)