Skip to content

Commit

Permalink
feat: lineage refactor (#1212)
Browse files Browse the repository at this point in the history
* feat: lineage v2

* fix: lineage interactions

* chore: help button

* fix: action widget buttons

* revert: unnecessary changes

* chore: updated components

* fix: styles

* fix: views code

* fix: updated components

* chore: cleanup

* chore: cleanup

* fix: static lineage integration

* fix: merge issues

* fix: sql visualizer ui issues

* fix: update lib version

* fix: image cleanup

* revert: lib changes

* fix: lineage components (#1311)

* fix: names and types

* WIP

* WIP

* fix: update components

* fix: minor issues

* fix: expand popover ui

* fix: lineae demo

* fix: lineage sidebar updates

* fix: feedback btn for sql lineage

* fix: code block type error

* fix: sql lineage render

* fix: open url

* feat: added final builds

* feat: added final builds

* fix: default expansion

* fix: reset

* fix: ts error and update lib

* fix: OOM

* fix: eslint warning

* fix: new lineage

* feat: lineage migrated to v2

* fix: notification

* feat: added build

* feat: saas init copied

* fix: lineage render

* feat: updated build files

---------

Co-authored-by: Aditya Gajbhiye <AdiGajbhiye@users.noreply.github.com>
Co-authored-by: Aditya <aditya.gajbhiye.20@gmail.com>
Co-authored-by: anandgupta42 <93243293+anandgupta42@users.noreply.github.com>
  • Loading branch information
4 people authored Oct 28, 2024
1 parent ae8f551 commit e6c36ef
Show file tree
Hide file tree
Showing 27 changed files with 6,258 additions and 5,732 deletions.
2 changes: 1 addition & 1 deletion new_lineage_panel/src/service_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const openFile = (url: string) => {
};

export const openURL = (url: string) => {
vscode.postMessage({ command: "openURL", args: { url } });
vscode.postMessage({ command: "openURL", url });
};

export const openChat = () => openURL("https://app.myaltimate.com/contactus");
Expand Down
8 changes: 4 additions & 4 deletions src/altimate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ interface SQLLineageRequest {
session_id: string;
}

export type Details = Record<
export type SqlLineageDetails = Record<
string,
{
name: string;
Expand All @@ -90,9 +90,9 @@ export type Details = Record<
columns: { name: string; datatype?: string; expression?: string }[];
}
>;
type StaticLineageResponse = {
type SqlLineageResponse = {
tableEdges: [string, string][];
details: Details;
details: SqlLineageDetails;
nodePositions?: Record<string, [number, number]>;
};

Expand Down Expand Up @@ -933,7 +933,7 @@ export class AltimateRequest {
}

async sqlLineage(req: SQLLineageRequest) {
return this.fetch<StaticLineageResponse>("dbt/v3/sql_lineage", {
return this.fetch<SqlLineageResponse>("dbt/v3/sql_lineage", {
method: "POST",
body: JSON.stringify(req),
});
Expand Down
2 changes: 1 addition & 1 deletion src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ export class VSCodeCommands implements Disposable {
ViewColumn.Two,
{ retainContextWhenHidden: true, enableScripts: true },
);
this.sqlLineagePanel.resolveWebviewView(panel, lineage);
this.sqlLineagePanel.renderSqlVisualizer(panel, lineage);
} catch (e) {
const errorMessage = (e as Error)?.message;
this.dbtTerminal.error("sqlLineage", errorMessage, e, true);
Expand Down
26 changes: 25 additions & 1 deletion src/webview_provider/altimateWebviewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,17 @@ export class AltimateWebviewProvider implements WebviewViewProvider {
}
}

protected async checkIfWebviewReady() {
return new Promise<void>((resolve) => {
const interval = setInterval(() => {
if (this.isWebviewReady) {
clearInterval(interval);
resolve();
}
}, 500);
});
}

resolveWebviewView(
panel: WebviewView,
context: WebviewViewResolveContext<unknown>,
Expand Down Expand Up @@ -586,6 +597,17 @@ export class AltimateWebviewProvider implements WebviewViewProvider {
),
),
);
const LineageGif = webview.asWebviewUri(
Uri.file(
path.join(
extensionUri.fsPath,
"webview_panels",
"dist",
"assets",
"lineage.gif",
),
),
);
const codiconsUri = webview.asWebviewUri(
Uri.joinPath(
extensionUri,
Expand Down Expand Up @@ -615,12 +637,14 @@ export class AltimateWebviewProvider implements WebviewViewProvider {
<link rel="stylesheet" type="text/css" href="${codiconsUri}">
</head>
<body>
<body class="${this.viewPath.replace(/\//g, "")}">
<div id="root"></div>
<div id="sidebar"></div>
<div id="modal"></div>
<script nonce="${nonce}" >
window.viewPath = "${this.viewPath}";
var spinnerUrl = "${SpinnerUrl}"
var lineageGif = "${LineageGif}"
</script>
<script nonce="${nonce}" type="module" src="${indexJs}"></script>
Expand Down
10 changes: 1 addition & 9 deletions src/webview_provider/lineagePanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class LineagePanel implements WebviewViewProvider, Disposable {
const { command, args } = message;
// common commands
if (command === "openFile") {
const { url } = args;
const url = args.params?.url;
if (!url) {
return;
}
Expand Down Expand Up @@ -173,14 +173,6 @@ export class LineagePanel implements WebviewViewProvider, Disposable {
return;
}

if (command === "openURL") {
if (!args.url) {
return;
}
env.openExternal(Uri.parse(args.url));
return;
}

if (command === "reactError") {
const typeMapper: { [key: string]: string } = {
generic: "Generic",
Expand Down
Loading

0 comments on commit e6c36ef

Please sign in to comment.