Skip to content

Commit d67988d

Browse files
committed
Turn URLs in collector messages into links
1 parent ddd664f commit d67988d

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ as one line: what production runs, the picked tag, how many merge requests or co
119119
with the ones allowed to fail counted apart, and a mark when the range was cut at `RELEASE_SCOPE_MAX_COMMITS`.
120120
Opening a line shows the service's environments, warnings, merge requests that are not merged yet, and its rows with
121121
tags and their pipelines, merge requests or commits, Jira keys with their status, environments, and failed jobs; rows
122-
out of scope are dimmed. Links open in a new tab. Each tag has a **pick** button:
122+
out of scope are dimmed. Links, including the GitLab settings pages that warnings and errors point to, open in a new tab. Each tag has a **pick** button:
123123
picking it highlights the rows it ships and closes the line again. A `--jira` report starts with each service's
124124
release tag picked. Services with neither a production deployment nor rows are left out of the page.
125125

‎release_scope/_static/index.html‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ <h1 x-text="report.jira_scope.length ? t('titleIssues', { keys: report.jira_scop
116116
</template>
117117
</ul>
118118
<template x-for="item in problems" :key="item.text">
119-
<p class="bad message" x-text="message(item)"></p>
119+
<p class="bad message"><template x-for="(part, index) in messageParts(item)" :key="index"><span><template x-if="part.url"><a :href="part.url" x-text="part.text"></a></template><template x-if="!part.url"><span x-text="part.text"></span></template></span></template></p>
120120
</template>
121121

122122
<h2 x-text="t('services')"></h2>
@@ -143,9 +143,9 @@ <h2 x-text="t('services')"></h2>
143143
<span> · <span x-text="item.name"></span> <a :href="item.deployment_url" x-text="item.ref"></a></span>
144144
</template>
145145
</p>
146-
<p x-show="service.error" class="bad message" x-text="service.error && message(service.error)"></p>
146+
<p x-show="service.error" class="bad message"><template x-for="(part, index) in messageParts(service.error)" :key="index"><span><template x-if="part.url"><a :href="part.url" x-text="part.text"></a></template><template x-if="!part.url"><span x-text="part.text"></span></template></span></template></p>
147147
<template x-for="warning in service.warnings" :key="warning.text">
148-
<p class="warn message" x-text="message(warning)"></p>
148+
<p class="warn message"><template x-for="(part, index) in messageParts(warning)" :key="index"><span><template x-if="part.url"><a :href="part.url" x-text="part.text"></a></template><template x-if="!part.url"><span x-text="part.text"></span></template></span></template></p>
149149
</template>
150150
<p x-show="service.release && service.release.pending_merge_requests.length">
151151
<span x-text="t('notMerged')"></span>
@@ -530,6 +530,12 @@ <h3 x-text="t('releasePost')"></h3>
530530
const render = MESSAGES[this.lang] && MESSAGES[this.lang][item.code];
531531
return render ? render(item.params) : item.text;
532532
},
533+
messageParts(item) {
534+
if (!item) return [];
535+
return this.message(item)
536+
.split(/(https?:\/\/\S+?)(?=[.,;:)]*(?:\s|$))/)
537+
.map((text, index) => ({ text, url: index % 2 ? text : "" }));
538+
},
533539
setLang(lang) {
534540
this.lang = lang;
535541
document.documentElement.lang = lang;

0 commit comments

Comments
 (0)