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 <suzmue@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/media/vulncheckView.css b/media/vulncheckView.css
index 6cef736..67035ab 100644
--- a/media/vulncheckView.css
+++ b/media/vulncheckView.css
@@ -3,12 +3,13 @@
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------*/
-.log,
+.debug,
.info {
font-weight: lighter;
padding-bottom: 1em;
}
+.log,
.vuln {
text-align: left;
padding-bottom: 1em;
diff --git a/media/vulncheckView.js b/media/vulncheckView.js
index d95e7d5..f03f61d 100644
--- a/media/vulncheckView.js
+++ b/media/vulncheckView.js
@@ -13,6 +13,7 @@
const logContainer = /** @type {HTMLElement} */ (document.querySelector('.log'));
const vulnsContainer = /** @type {HTMLElement} */ (document.querySelector('.vulns'));
const unaffectingContainer = /** @type {HTMLElement} */ (document.querySelector('.unaffecting'));
+ const debugContainer = /** @type {HTMLElement} */ (document.querySelector('.debug'));
vulnsContainer.addEventListener('click', (event) => {
let node = event && event.target;
@@ -91,28 +92,20 @@
}
errorContainer.style.display = 'none';
- logContainer.innerHTML = '';
- const runLog = document.createElement('table');
const timeinfo = (startDate, durationMillisec) => {
if (!startDate) { return '' }
return durationMillisec ? `${startDate} (took ${durationMillisec} msec)` : `${startDate}`;
}
+ debugContainer.innerHTML = `Analyzed at: ${timeinfo(json.Start, json.Duration)}`;
const vulns = json.Vuln || [];
const affecting = vulns.filter((v) => v.CallStackSummaries?.length);
const unaffecting = vulns.filter((v) => !v.CallStackSummaries?.length);
- runLog.innerHTML = `
-<tr><td>Dir:</td><td>${json.Dir || ''}</td></tr>
-<tr><td>Pattern:</td><td>${json.Pattern || ''}</td></tr>
-<tr><td>Analyzed at:</td><td>${timeinfo(json.Start, json.Duration)}</td></tr>
-<tr><td>Found</td><td>${affecting?.length || 0} known vulnerabilities</td></tr>`;
- if (unaffecting?.length > 0) {
- runLog.innerHTML += `<tr><td>Found</td><td>${unaffecting.length} informational vulnerabilities</td></tr>`
- }
-
- logContainer.appendChild(runLog);
-
+ logContainer.innerHTML = `
+<pre>cd ${json.Dir || ''}; govulncheck ${json.Pattern || ''}</pre>
+Found ${affecting?.length || 0} known vulnerabilities.`;
+
vulnsContainer.innerHTML = '';
affecting.forEach((vuln) => {
const element = document.createElement('div');
diff --git a/src/goVulncheck.ts b/src/goVulncheck.ts
index 8e5a74f..5e1e6e8 100644
--- a/src/goVulncheck.ts
+++ b/src/goVulncheck.ts
@@ -108,6 +108,7 @@
<div class="log"></div>
<div class="vulns"></div>
<div class="unaffecting"></div>
+ <div class="debug"></div>
<script nonce="${nonce}" src="${scriptUri}"></script>
</body>
</html>`;