Skip to content

Commit 17f6b7a

Browse files
committed
media/vulncheckView.js: simplify the run log section.
Instead of the table view, use text. For example, ``` cd /test/dir; govulncheck ./... Found N known vulnerabilities. ``` Move the timing info at the end of the report to avoid distraction. Change-Id: I1187c2b2a16f653f979ccd335c144f2d85911929 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/429475 Reviewed-by: Suzy Mueller <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
1 parent 8cef5ae commit 17f6b7a

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

media/vulncheckView.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
* Licensed under the MIT License. See LICENSE in the project root for license information.
44
*--------------------------------------------------------*/
55

6-
.log,
6+
.debug,
77
.info {
88
font-weight: lighter;
99
padding-bottom: 1em;
1010
}
1111

12+
.log,
1213
.vuln {
1314
text-align: left;
1415
padding-bottom: 1em;

media/vulncheckView.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
const logContainer = /** @type {HTMLElement} */ (document.querySelector('.log'));
1414
const vulnsContainer = /** @type {HTMLElement} */ (document.querySelector('.vulns'));
1515
const unaffectingContainer = /** @type {HTMLElement} */ (document.querySelector('.unaffecting'));
16+
const debugContainer = /** @type {HTMLElement} */ (document.querySelector('.debug'));
1617

1718
vulnsContainer.addEventListener('click', (event) => {
1819
let node = event && event.target;
@@ -91,28 +92,20 @@
9192
}
9293
errorContainer.style.display = 'none';
9394

94-
logContainer.innerHTML = '';
95-
const runLog = document.createElement('table');
9695
const timeinfo = (startDate, durationMillisec) => {
9796
if (!startDate) { return '' }
9897
return durationMillisec ? `${startDate} (took ${durationMillisec} msec)` : `${startDate}`;
9998
}
99+
debugContainer.innerHTML = `Analyzed at: ${timeinfo(json.Start, json.Duration)}`;
100100

101101
const vulns = json.Vuln || [];
102102
const affecting = vulns.filter((v) => v.CallStackSummaries?.length);
103103
const unaffecting = vulns.filter((v) => !v.CallStackSummaries?.length);
104104

105-
runLog.innerHTML = `
106-
<tr><td>Dir:</td><td>${json.Dir || ''}</td></tr>
107-
<tr><td>Pattern:</td><td>${json.Pattern || ''}</td></tr>
108-
<tr><td>Analyzed at:</td><td>${timeinfo(json.Start, json.Duration)}</td></tr>
109-
<tr><td>Found</td><td>${affecting?.length || 0} known vulnerabilities</td></tr>`;
110-
if (unaffecting?.length > 0) {
111-
runLog.innerHTML += `<tr><td>Found</td><td>${unaffecting.length} informational vulnerabilities</td></tr>`
112-
}
113-
114-
logContainer.appendChild(runLog);
115-
105+
logContainer.innerHTML = `
106+
<pre>cd ${json.Dir || ''}; govulncheck ${json.Pattern || ''}</pre>
107+
Found ${affecting?.length || 0} known vulnerabilities.`;
108+
116109
vulnsContainer.innerHTML = '';
117110
affecting.forEach((vuln) => {
118111
const element = document.createElement('div');

src/goVulncheck.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export class VulncheckResultViewProvider implements vscode.CustomTextEditorProvi
108108
<div class="log"></div>
109109
<div class="vulns"></div>
110110
<div class="unaffecting"></div>
111+
<div class="debug"></div>
111112
<script nonce="${nonce}" src="${scriptUri}"></script>
112113
</body>
113114
</html>`;

0 commit comments

Comments
 (0)