## 1.122.0
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
import * as vscode from "vscode";
|
||||
import { getNonce } from "./getNonce";
|
||||
import { apiBaseUrl } from "./constants";
|
||||
import { PostMessage } from "./PostMessage";
|
||||
import { title } from "process";
|
||||
|
||||
export class WebviewPanelCostOfDelay {
|
||||
/**
|
||||
@ -78,18 +76,21 @@ export class WebviewPanelCostOfDelay {
|
||||
// This happens when the user closes the panel or when the panel is closed programmatically
|
||||
this._panel.onDidDispose(() => this.dispose(), null, this._disposables);
|
||||
|
||||
// // Handle messages from the webview
|
||||
// this._panel.webview.onDidReceiveMessage(
|
||||
// (message) => {
|
||||
// switch (message.command) {
|
||||
// case "alert":
|
||||
// vscode.window.showErrorMessage(message.text);
|
||||
// return;
|
||||
// }
|
||||
// },
|
||||
// null,
|
||||
// this._disposables
|
||||
// );
|
||||
// Handle messages from the webview
|
||||
this._panel.webview.onDidReceiveMessage(
|
||||
(message) => {
|
||||
switch (message.command) {
|
||||
case "alert":
|
||||
vscode.window.showErrorMessage(message.text);
|
||||
return;
|
||||
default:
|
||||
vscode.window.showErrorMessage(message.text);
|
||||
break;
|
||||
}
|
||||
},
|
||||
null,
|
||||
this._disposables
|
||||
);
|
||||
}
|
||||
|
||||
public dispose() {
|
||||
@ -108,29 +109,18 @@ export class WebviewPanelCostOfDelay {
|
||||
|
||||
private async _update(site: string, title: string, view: string) {
|
||||
const webview = this._panel.webview;
|
||||
|
||||
this._panel.webview.html = this._getHtmlForWebview(site, title, view, webview);
|
||||
webview.onDidReceiveMessage(async (postMessage: PostMessage) => {
|
||||
switch (postMessage.type) {
|
||||
case "on-info":
|
||||
if (!postMessage.value)
|
||||
return;
|
||||
vscode.window.showInformationMessage(postMessage.value);
|
||||
break;
|
||||
case "on-error":
|
||||
if (!postMessage.value)
|
||||
return;
|
||||
vscode.window.showErrorMessage(postMessage.value);
|
||||
break;
|
||||
default:
|
||||
vscode.window.showErrorMessage(postMessage.type);
|
||||
break;
|
||||
}
|
||||
webview.onDidReceiveMessage(async (message: string) => {
|
||||
vscode.window.showErrorMessage(message);
|
||||
});
|
||||
}
|
||||
|
||||
private _getHtmlForWebview(site: string, title: string, view: string, webview: vscode.Webview) {
|
||||
const baseUri = 'https://eaf-dev.mes.infineon.com';
|
||||
const scriptUri = 'cod-1-122-0.js?v=2025-04-14-08-10';
|
||||
|
||||
// Use a nonce to only allow a specific script to be run.
|
||||
const nonce = getNonce();
|
||||
|
||||
if (view === 'HTML') {
|
||||
return `<!DOCTYPE html>
|
||||
@ -163,9 +153,6 @@ export class WebviewPanelCostOfDelay {
|
||||
vscode.Uri.joinPath(this._extensionContext.extensionUri, "media", "cost-of-delay.js")
|
||||
);
|
||||
|
||||
// Use a nonce to only allow a specific script to be run.
|
||||
const nonce = getNonce();
|
||||
|
||||
return `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
@ -178,7 +165,7 @@ export class WebviewPanelCostOfDelay {
|
||||
<script nonce="${nonce}" src="${scriptJQueryUri}"></script>
|
||||
<script nonce="${nonce}" src="${scriptSignalRUri}"></script>
|
||||
<script nonce="${nonce}" src="${baseUri}/signalr/hubs"></script>
|
||||
<script nonce="${nonce}" src="${baseUri}/js/cod-b.js?v=2025-01-22-10-49" type="text/javascript"></script>
|
||||
<script nonce="${nonce}" src="${baseUri}/js/${scriptUri}" type="text/javascript"></script>
|
||||
<script nonce="${nonce}">
|
||||
const _webviewSite = '${site}';
|
||||
const _webviewView = '${view}';
|
||||
|
Reference in New Issue
Block a user