Skip to content

Commit f053960

Browse files
fix: wire lineage Export button to SaaS via extension host (#1935)
1 parent 41470c8 commit f053960

3 files changed

Lines changed: 51 additions & 0 deletions

File tree

src/altimate.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,13 @@ export class AltimateRequest {
458458
});
459459
}
460460

461+
async exportLineage(req: { name: string; lineage_data: unknown }) {
462+
return this.fetch<{ url: string }>("dbt/v4/export-lineage", {
463+
method: "POST",
464+
body: JSON.stringify(req),
465+
});
466+
}
467+
461468
async runModeller(req: SQLToModelRequest) {
462469
return this.fetch<SQLToModelResponse>("dbt/v1/sqltomodel", {
463470
method: "POST",

src/webview_provider/newLineagePanel.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,39 @@ export class NewLineagePanel
246246
return;
247247
}
248248

249+
if (command === "exportLineage") {
250+
try {
251+
const body = await this.altimate.exportLineage({
252+
name: params.name,
253+
lineage_data: params.lineage_data,
254+
});
255+
this._panel?.webview.postMessage({
256+
command: "response",
257+
args: { id, syncRequestId, body, status: true },
258+
});
259+
} catch (error) {
260+
this._panel?.webview.postMessage({
261+
command: "response",
262+
args: {
263+
id,
264+
syncRequestId,
265+
error: (error as Error).message,
266+
status: false,
267+
},
268+
});
269+
window.showErrorMessage(
270+
extendErrorWithSupportLinks(
271+
"Could not export lineage: " + (error as Error).message,
272+
),
273+
);
274+
this.telemetry.sendTelemetryError(
275+
"altimateLineageExportLineageError",
276+
error,
277+
);
278+
}
279+
return;
280+
}
281+
249282
if (command === "columnLineage") {
250283
this.handleColumnLineage(args, () => {
251284
this._panel?.webview.postMessage({

webview_panels/src/modules/lineage/LineageView.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ const LineageView = (): JSX.Element | null => {
6767
break;
6868
}
6969
};
70+
// @ts-expect-error TODO: add type generic for executeRequestInSync
71+
ApiHelper.post = async (url: string, data?: Record<string, unknown>) => {
72+
switch (url) {
73+
case "dbt/v4/export-lineage":
74+
return executeRequestInSync("exportLineage", {
75+
args: { params: data ?? {} },
76+
});
77+
default:
78+
break;
79+
}
80+
};
7081
setIsApiHelperInitialized(true);
7182
}, [isComponentsApiInitialized]);
7283

0 commit comments

Comments
 (0)