-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: lineage refactor #1212
feat: lineage refactor #1212
Changes from 46 commits
4bd8d9c
b0d6aaa
fb048de
1da70b0
0bc6223
b6ba6f1
bee9382
d1fcb2d
9382b8f
da68973
e0c3649
b4bbbc0
9fe65ea
13dcce1
fbec974
b3d8b2f
d7e3061
c8c38ad
2f82023
d82bd80
17e599b
5143e9a
2df32ef
1aa310c
f9910a4
96be3e5
1ef1ba4
3eff7ba
b5fde33
6f6c6b6
e2d7702
c3a4989
72c638b
02e407e
edf489a
6284060
c5fb15e
7f268e2
8aa3e75
dff48f1
16232b1
f685076
67fd4f8
ce8762d
d27a9b8
747de74
f2cdd96
a28d423
bbd65e4
3bcb5ae
b2b4e73
f182728
8519f62
ebdafe9
c1c03fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -524,6 +524,17 @@ export class AltimateWebviewProvider implements WebviewViewProvider { | |
} | ||
} | ||
|
||
protected async checkIfWebviewReady() { | ||
return new Promise<void>((resolve) => { | ||
const interval = setInterval(() => { | ||
if (this.isWebviewReady) { | ||
clearInterval(interval); | ||
resolve(); | ||
} | ||
}, 500); | ||
}); | ||
} | ||
Comment on lines
+526
to
+535
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider optimizing the webview ready check The
Here's a suggested implementation: protected async checkIfWebviewReady(timeout = 30000): Promise<void> {
return new Promise<void>((resolve, reject) => {
const startTime = Date.now();
const check = () => {
if (this.isWebviewReady) {
resolve();
} else if (Date.now() - startTime > timeout) {
reject(new Error('Timeout waiting for webview to be ready'));
} else {
setTimeout(check, 500);
}
};
check();
});
} This implementation will reject the promise if the webview isn't ready within the specified timeout (default 30 seconds). |
||
|
||
resolveWebviewView( | ||
panel: WebviewView, | ||
context: WebviewViewResolveContext<unknown>, | ||
|
@@ -587,6 +598,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, | ||
|
@@ -616,12 +638,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> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
} | ||
|
@@ -173,14 +173,6 @@ export class LineagePanel implements WebviewViewProvider, Disposable { | |
return; | ||
} | ||
|
||
if (command === "openURL") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is handled via altimateWebviewProvider |
||
if (!args.url) { | ||
return; | ||
} | ||
env.openExternal(Uri.parse(args.url)); | ||
return; | ||
} | ||
|
||
if (command === "reactError") { | ||
const typeMapper: { [key: string]: string } = { | ||
generic: "Generic", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Incomplete method renaming detected.
The method
resolveWebviewView
still exists in multiple files, indicating that the renaming torenderSqlVisualizer
was not fully propagated. To maintain code consistency and prevent potential issues, please ensure that all instances ofresolveWebviewView
are updated accordingly.Affected files:
src/webview_provider/lineagePanel.ts
src/webview_provider/altimateWebviewProvider.ts
src/webview_provider/sqlLineagePanel.ts
src/webview_provider/queryResultPanel.ts
src/webview_provider/newDocsGenPanel.ts
src/webview_provider/docsEditPanel.ts
src/webview_provider/modelGraphViewPanel.ts
🔗 Analysis chain
Improved method naming for better clarity.
The renaming of
resolveWebviewView
torenderSqlVisualizer
enhances code readability by more accurately describing the method's purpose. This change is a step in the right direction for maintaining clear and self-documenting code.To ensure consistency across the codebase, let's verify if this method has been renamed in all relevant files:
Correction needed for file type specification in search scripts.
The initial shell scripts failed because
rg
does not recognizetypescript
as a valid file type. To resolve this, we'll use the correct file type identifierts
for TypeScript files.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 330
Script:
Length of output: 1138