From f61bff2fff0d926eb7f320a392f2e5ad002a2223 Mon Sep 17 00:00:00 2001
From: Anbraten <6918444+anbraten@users.noreply.github.com>
Date: Sat, 13 Jul 2024 21:34:35 +0200
Subject: [PATCH] Convert urls in logs to links (#3904)
---
web/src/components/repo/pipeline/PipelineLog.vue | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/web/src/components/repo/pipeline/PipelineLog.vue b/web/src/components/repo/pipeline/PipelineLog.vue
index 4636f2f48..f296c5eff 100644
--- a/web/src/components/repo/pipeline/PipelineLog.vue
+++ b/web/src/components/repo/pipeline/PipelineLog.vue
@@ -180,11 +180,21 @@ function formatTime(time?: number): string {
return time === undefined ? '' : `${time}s`;
}
+function processText(text: string): string {
+ const urlRegex = /https?:\/\/\S+/g;
+ let txt = ansiUp.value.ansi_to_html(`${decode(text)}\n`);
+ txt = txt.replace(
+ urlRegex,
+ (url) => `${url}`,
+ );
+ return txt;
+}
+
function writeLog(line: Partial) {
logBuffer.value.push({
index: line.index ?? 0,
number: (line.index ?? 0) + 1,
- text: ansiUp.value.ansi_to_html(`${decode(line.text ?? '')}\n`),
+ text: processText(line.text ?? ''),
time: line.time ?? 0,
type: null, // TODO: implement way to detect errors and warnings
});