Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/webview/helm-chart/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@
<body>
<div class="box" id="root"></div>
<script src="%SCRIPT%" ></script>
<link rel="stylesheet" href="%STYLE%"></link>
</body>
</html>
43 changes: 21 additions & 22 deletions src/webview/helm-chart/helmChartLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,12 @@ function helmChartMessageListener(event: any): void {
}

export default class HelmChartLoader {
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type

static get extensionPath() {
return vscode.extensions.getExtension(ExtensionID).extensionPath
}

// eslint-disable-next-line @typescript-eslint/require-await
static async loadView(title: string, url?: string): Promise<vscode.WebviewPanel> {
static async loadView(title: string): Promise<vscode.WebviewPanel> {
const localResourceRoot = vscode.Uri.file(path.join(HelmChartLoader.extensionPath, 'out', 'helmChartViewer'));
if (panel) {
// If we already have a panel, show it in the target column
Expand All @@ -154,10 +153,11 @@ export default class HelmChartLoader {
});
panel.iconPath = vscode.Uri.file(path.join(HelmChartLoader.extensionPath, 'images/helm/helm.svg'));
panel.webview.html = await loadWebviewHtml('helmChartViewer', panel);
const messageDisposable = panel.webview.onDidReceiveMessage(helmChartMessageListener);
panel.onDidDispose(() => {
messageDisposable.dispose();
panel = undefined;
});
panel.webview.onDidReceiveMessage(helmChartMessageListener);
}
await getHelmCharts();
return panel;
Expand All @@ -170,25 +170,24 @@ export default class HelmChartLoader {
}

async function getHelmCharts(): Promise<void> {
if (helmCharts.length === 0) {
const cliData = await Helm.getHelmRepos();
if (!cliData.error && !cliData.stderr) {
const helmRepos = JSON.parse(cliData.stdout) as HelmRepo[];
void panel?.webview.postMessage(
{
action: 'getHelmRepos',
data: {
helmRepos
}
helmCharts.length = 0;
const cliData = await Helm.getHelmRepos();
if (!cliData.error && !cliData.stderr) {
const helmRepos = JSON.parse(cliData.stdout) as HelmRepo[];
void panel?.webview.postMessage(
{
action: 'getHelmRepos',
data: {
helmRepos
}
);
helmRepos.forEach((helmRepo: HelmRepo) => {
let url = helmRepo.url;
url = url.endsWith('/') ? url : url.concat('/');
url = url.concat('index.yaml');
void fetchURL(helmRepo, url);
});
}
}
);
helmRepos.forEach((helmRepo: HelmRepo) => {
let url = helmRepo.url;
url = url.endsWith('/') ? url : url.concat('/');
url = url.concat('index.yaml');
void fetchURL(helmRepo, url);
});
}
}

Expand Down