Skip to content

Commit

Permalink
Enhancement for Webview Theme and Icon (#177)
Browse files Browse the repository at this point in the history
* Enhance theme for heap & system view tracing

* Added espressif icon for panels
  • Loading branch information
pwmb authored Sep 24, 2020
1 parent 9b521c4 commit 18cd192
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/coverage/coverageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import { sep, join } from "path";
import * as vscode from "vscode";
import { appendIdfAndToolsToPath, spawn } from "../utils";
import { appendIdfAndToolsToPath, extensionContext, spawn } from "../utils";
import { OutputChannel } from "../logger/outputChannel";
import { Logger } from "../logger/logger";
import * as idfConf from "../idfConfiguration";
Expand Down Expand Up @@ -198,6 +198,9 @@ export async function previewReport(dirPath: string) {
"Coverage report",
column
);
gcovHtmlPanel.iconPath = vscode.Uri.file(
join(extensionContext.extensionPath, "media", "espressif_icon.png")
);
gcovHtmlPanel.webview.html = reportHtml;
gcovHtmlPanel.onDidDispose(() => (gcovHtmlPanel = undefined));
} catch (e) {
Expand Down
3 changes: 3 additions & 0 deletions src/espIdf/menuconfig/MenuconfigPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ export class MenuConfigPanel {
path.join(extensionPath, "dist", "views", "menuconfig-bundle.js")
)
);
this.panel.iconPath = vscode.Uri.file(
path.join(extensionPath, "media", "espressif_icon.png")
);
this.panel.webview.html = this.createMenuconfigHtml(scriptPath);

ConfserverProcess.registerListener(this.updateConfigValues);
Expand Down
3 changes: 3 additions & 0 deletions src/espIdf/size/idfSizePanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ export class IDFSizePanel {
IDFSizePanel.currentPanel = undefined;
}
private initWebview() {
this._panel.iconPath = vscode.Uri.file(
path.join(this._extensionPath, "media", "espressif_icon.png")
);
this._panel.webview.html = this.getHtmlContent();
this._panel.webview.postMessage(this._webviewData);
this._panel.onDidDispose(this.disposeWebview, null, this._disposables);
Expand Down
3 changes: 3 additions & 0 deletions src/espIdf/tracing/appTracePanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ export class AppTracePanel {
}

private initWebview() {
this._panel.iconPath = vscode.Uri.file(
path.join(this._extensionPath, "media", "espressif_icon.png")
);
this._panel.webview.html = this.getHtmlContent();
this.sendCommandToWebview("initialLoad", this._traceData);
this._panel.onDidDispose(this.disposeWebview, null, this._disposables);
Expand Down
3 changes: 3 additions & 0 deletions src/espIdf/tracing/system-view/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export class SystemViewPanel {
null,
this.disposable
);
this.panel.iconPath = Uri.file(
join(extensionPath, "media", "espressif_icon.png")
);
this.initWebView();
setTimeout(() => {
this.sendCommandToWebview("initialLoad", this.traceData);
Expand Down
3 changes: 3 additions & 0 deletions src/examples/ExamplesPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export class ExamplesPlanel {
path.join(extensionPath, "dist", "views", "examples-bundle.js")
)
);
this.panel.iconPath = vscode.Uri.file(
path.join(extensionPath, "media", "espressif_icon.png")
);
this.panel.webview.html = createExamplesHtml(scriptPath);

this.panel.onDidDispose(() => this.dispose(), null, this.disposables);
Expand Down
3 changes: 3 additions & 0 deletions src/onboarding/OnboardingPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ export class OnBoardingPanel {
path.join(extensionPath, "dist", "views", "onboarding-bundle.js")
)
);
this.panel.iconPath = vscode.Uri.file(
path.join(extensionPath, "media", "espressif_icon.png")
);
this.panel.webview.html = createOnboardingHtml(scriptPath);

this.panel.onDidDispose(() => this.dispose(), null, this.disposables);
Expand Down
3 changes: 2 additions & 1 deletion src/views/system-view/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ export default class App extends Vue {
}
</script>

<style>
<style lang="scss">
@import "../commons/espCommons.scss";
html,
body {
height: 100vh;
Expand Down
11 changes: 11 additions & 0 deletions src/views/tracing/components/Plot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ const Plot = Vue.extend({
};
},
mounted() {
// Set theme color for plot
const style = window.getComputedStyle(document.documentElement);
const bgColor = style.getPropertyValue("--vscode-editor-background");
const fontColor = style.getPropertyValue("--vscode-editor-foreground");
this.layout.paper_bgcolor = bgColor;
this.layout.plot_bgcolor = bgColor;
this.layout.font = {
color: fontColor,
};
Plotly.newPlot("plot", this.chart, this.layout, this.chartProp);
const plot = document.getElementById("plot") as any;
plot.on("plotly_click", (d) => {
Expand Down

0 comments on commit 18cd192

Please sign in to comment.