From 3541c326bf37054514725fc17ffd60d6bbdc887e Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Thu, 11 Jul 2024 15:42:50 -0700 Subject: [PATCH] feat: auto links url for simple logs. fixes #3063 (#3100) --- assets/components/LogViewer/SimpleLogItem.vue | 12 ++++- .../__snapshots__/EventSource.spec.ts.snap | 50 +++++++++---------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/assets/components/LogViewer/SimpleLogItem.vue b/assets/components/LogViewer/SimpleLogItem.vue index 9e6ee9d8..e7399881 100644 --- a/assets/components/LogViewer/SimpleLogItem.vue +++ b/assets/components/LogViewer/SimpleLogItem.vue @@ -5,8 +5,8 @@
markSearch(ansiConvertor.toHtml(value)); +const urlPattern = /(https?:\/\/[^\s]+)/g; +const linkify = (text: string) => + text.replace(urlPattern, (url) => `${url}`); + diff --git a/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap b/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap index 57c922b2..c44943cc 100644 --- a/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap +++ b/assets/components/LogViewer/__snapshots__/EventSource.spec.ts.snap @@ -3,15 +3,15 @@ exports[` > render html correctly > should render dates with 12 hour style 1`] = ` "