From 27a2d92be4c9d44fe5333dc2352080606df08e00 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 2 Feb 2023 11:56:51 +0100 Subject: [PATCH 1/5] cmd/hiveview: improve error highlight --- cmd/hiveview/assets/lib/app-suite.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/hiveview/assets/lib/app-suite.js b/cmd/hiveview/assets/lib/app-suite.js index 0f42a034f7..2aa209d0da 100644 --- a/cmd/hiveview/assets/lib/app-suite.js +++ b/cmd/hiveview/assets/lib/app-suite.js @@ -163,9 +163,11 @@ function formatTestLog(suiteData, test) { } function highlightErrorsInTestOutput(content) { - return content.replace(/(ERROR|FAIL|Error)(:)?.*/, function (m) { - return '' + m + ''; - }); + let p = /\b(error|fail(ed)?|can't launch node)\b/i + if (p.test(content)) { + return '' + content + ''; + } + return content; } // showSuiteName displays the suite title. From 676e84e6084363665618bb0d6f145cf2f7d2f009 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 2 Feb 2023 11:59:07 +0100 Subject: [PATCH 2/5] cmd/hiveview: fix trim of /results/ in log title --- cmd/hiveview/assets/lib/app-viewer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/hiveview/assets/lib/app-viewer.js b/cmd/hiveview/assets/lib/app-viewer.js index 8d40a43b3b..f91c6a308a 100644 --- a/cmd/hiveview/assets/lib/app-viewer.js +++ b/cmd/hiveview/assets/lib/app-viewer.js @@ -4,7 +4,7 @@ import * as app from './app.js' function navigate() { app.init(); - + // Check for line number in hash. var line = null; if (window.location.hash.substr(1, 1) == "L") { @@ -151,12 +151,13 @@ function appendLine(contentArea, gutter, number, text) { // fetchFile loads up a new file to view function fetchFile(url, line /* optional jump to line */ ) { + let resultsRE = new RegExp("^" + app.resultsRoot); $.ajax({ xhr: loader.newXhrWithProgressBar, url: url, dataType: "text", success: function(data) { - let title = url.replace("^"+app.resultsRoot, ''); + let title = url.replace(resultsRE, ''); showTitle(null, title); showFileContent(data, url); setHL(line, true); From 30abfcbc3e593c36feb401d94a7b7e2fe8beb270 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 2 Feb 2023 14:30:43 +0100 Subject: [PATCH 3/5] cmd/hiveview: improve line highlight in viewer --- cmd/hiveview/assets/lib/app-viewer.js | 2 +- cmd/hiveview/assets/lib/viewer.css | 103 ++++++++++++++++++++++++++ cmd/hiveview/assets/viewer.html | 71 ++---------------- 3 files changed, 110 insertions(+), 66 deletions(-) create mode 100644 cmd/hiveview/assets/lib/viewer.css diff --git a/cmd/hiveview/assets/lib/app-viewer.js b/cmd/hiveview/assets/lib/app-viewer.js index f91c6a308a..d995b8fa26 100644 --- a/cmd/hiveview/assets/lib/app-viewer.js +++ b/cmd/hiveview/assets/lib/app-viewer.js @@ -144,7 +144,7 @@ function appendLine(contentArea, gutter, number, text) { num.setAttribute("line", number.toString()); gutter.appendChild(num); - let line = document.createElement("span") + let line = document.createElement("pre") line.innerText = text + "\n"; contentArea.appendChild(line); } diff --git a/cmd/hiveview/assets/lib/viewer.css b/cmd/hiveview/assets/lib/viewer.css new file mode 100644 index 0000000000..a3487ba915 --- /dev/null +++ b/cmd/hiveview/assets/lib/viewer.css @@ -0,0 +1,103 @@ +h3 { + word-wrap: anywhere; +} + +#load-progress-bar-container { + margin: 8px 0; +} + +#viewer { + display: flex; + flex-wrap: nowrap; + background-color: #fff; + border: 1px solid #d1d5da; + border-radius: 3px; + width: 100%; + font-size: 14px; +} + +#viewer-header { + margin: 8px 0 0 0; + padding: 8px 16px; + background-color: #f6f8fa; + border: 1px solid #d1d5da; + border-bottom: none; + border-top-left-radius: 3px; + border-top-right-radius: 3px; + font-size: 80%; +} + +#gutter { + flex: 1 0 3em; + z-index: 20; + position: relative; +} + +#file-content-container { + overflow-x: auto; + flex: 99 0 auto; + width: 90%; + z-index: 10; + position: relative; +} + +#file-content pre { + border: 0; + margin: 0; + overflow: visible; + padding: 0 0 0 8px; + font-size: 13px; + line-height: 18px; +} + +.num { + display: block; + height: 18px; + line-height: 18px; + font-size: 11px; + border-right: 1px solid #d1d5da; + color: #bbb; + padding: 0 5px; + text-align: right; + box-sizing: border-box; + margin-left: 4px; + scroll-margin: 10em 0 0 0; + + -webkit-user-select: none; /* Safari */ + user-select: none; +} + +.num::before { + content: attr(line); + position: relative; + z-index: 20; +} + +.num.highlighted { + display: flex; + justify-content: end; + align-items: center; + border: solid #a8a8a8; + border-width: 1px 0 1px 1px; + border-radius: 2px 2px 2px 2px; +} + +.num.highlighted::before { + margin-right: -7px; +} + +.num.highlighted::after { + content: ''; + box-sizing: border-box; + display: block; + margin-right: -9px; + height: 17px; + width: 17px; + border-radius: 0 2px 2px 2px; + background-color: #fffaea; + border: solid #a8a8a8; + border-width: 0 1px 1px 0; + transform: rotate(-45deg); + clip-path: inset(5px 0 0 5px); + z-index: 10; +} diff --git a/cmd/hiveview/assets/viewer.html b/cmd/hiveview/assets/viewer.html index 416283e899..63639225ce 100644 --- a/cmd/hiveview/assets/viewer.html +++ b/cmd/hiveview/assets/viewer.html @@ -6,68 +6,7 @@ - - +