Skip to content

Commit

Permalink
chore: Refactored createMessageHandler and added error logs as sugges…
Browse files Browse the repository at this point in the history
…ted by code rabbit.

Co-authored-by: Erik Wiens <[email protected]>
  • Loading branch information
Christopher-R-Perkins and ErikWiens committed Jul 15, 2024
1 parent 5594a86 commit e238f28
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions src/commands/pipelines/DagRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,13 @@ export default class DagRenderer {
break;
}

case 'artifactUrl': {
if (deploymentType === 'cloud') {
const uri = vscode.Uri.parse(
`${dashboardUrl}/artifact-versions/${message.id}?tab=overview`
);
vscode.env.openExternal(uri);
break;
}
const uri = vscode.Uri.parse(runUrl);
vscode.env.openExternal(uri);
case 'artifactUrl':
this.openArtifactUrl(message.id, dashboardUrl, deploymentType, runUrl);
break;
}

case 'stepUrl': {
const uri = vscode.Uri.parse(runUrl);
vscode.env.openExternal(uri);
case 'stepUrl':
this.openStepUrl(runUrl);
break;
}
}
};
}
Expand All @@ -153,6 +142,7 @@ export default class DagRenderer {
vscode.commands.executeCommand('zenmlPanelView.focus');
} catch (e) {
vscode.window.showErrorMessage(`Unable to retrieve step ${id}: ${e}`);
console.error(e);
}
}

Expand Down Expand Up @@ -181,9 +171,27 @@ export default class DagRenderer {
vscode.commands.executeCommand('zenmlPanelView.focus');
} catch (e) {
vscode.window.showErrorMessage(`Unable to retrieve artifact version ${id}: ${e}`);
console.error(e);
}
}

private openArtifactUrl(
id: string,
dashboardUrl: string,
deploymentType: string,
runUrl: string
): void {
const uri = vscode.Uri.parse(
deploymentType === 'cloud' ? `${dashboardUrl}/artifact-versions/${id}?tab=overview` : runUrl
);
vscode.env.openExternal(uri);
}

private openStepUrl(runUrl: string): void {
const uri = vscode.Uri.parse(runUrl);
vscode.env.openExternal(uri);
}

private async renderDag(panel: vscode.WebviewPanel, node: PipelineTreeItem) {
const client = LSClient.getInstance();

Expand Down

0 comments on commit e238f28

Please sign in to comment.