|
1 | 1 | import * as vscode from 'vscode';
|
2 | 2 | import * as fs from 'fs';
|
3 | 3 | import * as path from 'path';
|
4 |
| -import { FileSystemUtils } from "../../filesystemUtils"; |
| 4 | +import { FileSystemUtils } from "../filesystemUtils"; |
5 | 5 | import { Base64 } from 'js-base64';
|
6 | 6 |
|
7 | 7 | class Component {
|
@@ -109,10 +109,10 @@ export class ShowComponentHierarchy {
|
109 | 109 |
|
110 | 110 | try {
|
111 | 111 | const jsContent = this.generateJavascriptContent(nodesJson, rootNodesJson, edgesJson);
|
112 |
| - const outputJsFilename = 'showComponentHierarchy/showComponentHierarchy.js'; |
| 112 | + const outputJsFilename = 'showComponentHierarchy.js'; |
113 | 113 | let htmlContent = this.generateHtmlContent(webview, outputJsFilename);
|
114 | 114 |
|
115 |
| - this.fsUtils.writeFile(this.extensionContext?.asAbsolutePath(path.join('src', 'commands', 'showComponentHierarchy/showComponentHierarchy.html')), htmlContent, () => { }); // For debugging |
| 115 | + this.fsUtils.writeFile(this.extensionContext?.asAbsolutePath(path.join('src', 'commands', 'showComponentHierarchy.html')), htmlContent, () => { }); // For debugging |
116 | 116 | this.fsUtils.writeFile(
|
117 | 117 | this.extensionContext?.asAbsolutePath(path.join('src', 'commands', outputJsFilename)),
|
118 | 118 | jsContent,
|
@@ -236,23 +236,23 @@ export class ShowComponentHierarchy {
|
236 | 236 | }
|
237 | 237 |
|
238 | 238 | private generateJavascriptContent(nodesJson: string, rootNodesJson: string, edgesJson: string): string {
|
239 |
| - const templateJsFilename = 'showComponentHierarchy/showComponentHierarchy_Template.js'; |
240 |
| - let template = fs.readFileSync(this.extensionContext?.asAbsolutePath(path.join('src', 'commands', templateJsFilename)), 'utf8'); |
| 239 | + const templateJsFilename = 'showComponentHierarchy_Template.js'; |
| 240 | + let template = fs.readFileSync(this.extensionContext?.asAbsolutePath(path.join('templates', templateJsFilename)), 'utf8'); |
241 | 241 | let jsContent = template.replace('var nodes = new vis.DataSet([]);', `var nodes = new vis.DataSet([${nodesJson}]);`);
|
242 | 242 | jsContent = jsContent.replace('var rootNodes = [];', `var rootNodes = [${rootNodesJson}];`);
|
243 | 243 | jsContent = jsContent.replace('var edges = new vis.DataSet([]);', `var edges = new vis.DataSet([${edgesJson}]);`);
|
244 | 244 | return jsContent;
|
245 | 245 | }
|
246 | 246 |
|
247 | 247 | private generateHtmlContent(webview: vscode.Webview, outputJsFilename: string): string {
|
248 |
| - const templateHtmlFilename = 'showComponentHierarchy/showComponentHierarchy_Template.html'; |
249 |
| - let htmlContent = fs.readFileSync(this.extensionContext?.asAbsolutePath(path.join('src', 'commands', templateHtmlFilename)), 'utf8'); |
| 248 | + const templateHtmlFilename = 'showComponentHierarchy_Template.html'; |
| 249 | + let htmlContent = fs.readFileSync(this.extensionContext?.asAbsolutePath(path.join('templates', templateHtmlFilename)), 'utf8'); |
250 | 250 |
|
251 |
| - const visPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'src', 'commands', 'showComponentHierarchy/vis-network.min.js'); |
| 251 | + const visPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'javascript', 'vis-network.min.js'); |
252 | 252 | const visUri = webview.asWebviewUri(visPath);
|
253 | 253 | htmlContent = htmlContent.replace('vis-network.min.js', visUri.toString());
|
254 | 254 |
|
255 |
| - const cssPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'src', 'commands', 'showComponentHierarchy/showComponentHierarchy.css'); |
| 255 | + const cssPath = vscode.Uri.joinPath(this.extensionContext.extensionUri, 'stylesheet', 'showComponentHierarchy.css'); |
256 | 256 | const cssUri = webview.asWebviewUri(cssPath);
|
257 | 257 | htmlContent = htmlContent.replace('showComponentHierarchy.css', cssUri.toString());
|
258 | 258 |
|
|
0 commit comments