Skip to content

Commit 029cd7d

Browse files
authored
Mark only the Jira keys a change does not mention (#54)
1 parent 586c550 commit 029cd7d

4 files changed

Lines changed: 25 additions & 20 deletions

File tree

‎demo/scenario.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class DemoIssue:
190190
summary="Search products by SKU",
191191
status="Ready for release",
192192
category="done",
193-
links=(f"{ENDPOINT}/shop/web/-/merge_requests/99",),
193+
links=(f"{ENDPOINT}/shop/web/-/merge_requests/99", f"{ENDPOINT}/shop/api/-/merge_requests/54"),
194194
),
195195
DemoIssue(
196196
key="SHOP-35",

‎docs/page.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Opening a line shows:
3939
- a link to create the next tag on the head, when rows have no tag yet;
4040
- the rows, each with its tags and their pipelines, its merge requests or commits with when they were merged or
4141
committed, Jira keys with their status, the time each environment first ran it, and failed jobs. Rows out of scope
42-
are dimmed. Each Jira key says why the row carries it: `named` when the merge request or commit mentions it,
43-
`linked` when the Jira issue links to the change, or both.
42+
are dimmed. A key the merge request or commit does not mention, which the row carries only because the Jira
43+
issue links to the change, is underlined with a dashed line and marked `via Jira`; hover over it for the reason.
4444

4545
Links open in a new tab, including the GitLab settings pages that warnings and errors point to.
4646

‎release_scope/_static/index.html‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@
127127
.issue-row.chosen { background: color-mix(in srgb, var(--accent) 10%, transparent); }
128128
.issue-row code { font-weight: 500; }
129129
.gaps ul { margin: 4px 0 12px; padding-left: 18px; }
130+
.row-key.via-jira > a { text-decoration: underline dashed; text-underline-offset: 3px; }
131+
.link-icon { width: 13px; height: 13px; margin-right: 2px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
130132
.issue-row .summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
131133
.issue-row .reach { grid-column: 3 / -1; display: flex; gap: 4px; overflow: hidden; white-space: nowrap; }
132134
.rider-mark { padding: 0 6px; border: 1px dashed var(--warn); border-radius: 999px; color: var(--warn); font-size: 11px; white-space: nowrap; }
@@ -285,9 +287,10 @@ <h2 x-text="t('services')"></h2>
285287
</td>
286288
<td>
287289
<template x-for="key in row.jira_keys" :key="key.key">
288-
<div class="row-key">
290+
<div class="row-key" :class="{ 'via-jira': viaJira(key) }"
291+
:title="viaJira(key) ? t('viaJiraTitle', { change: changeLabel(row), key: key.key }) : ''">
289292
<a :href="key.url" x-text="key.key"></a>
290-
<span class="muted via" :title="t('viaTitle')" x-text="viaText(key)"></span>
293+
<span x-show="viaJira(key)" class="muted via"><svg class="link-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M9 15l6-6"/><path d="M11 6l.46-.54a5 5 0 0 1 7.07 7.07L18 13"/><path d="M13 18l-.4.53a5 5 0 0 1-7.07-7.07L6 11"/></svg><span x-text="t('viaJira')"></span></span>
291294
<span x-show="issue(key.key)" :class="statusClass(issue(key.key))" x-text="issue(key.key) && issue(key.key).status"></span>
292295
<span x-text="issue(key.key) ? issue(key.key).summary : ''"></span>
293296
</div>
@@ -561,9 +564,8 @@ <h2 x-text="t('release')"></h2>
561564
planNoTag: "{keys}: no tag yet.",
562565
planElsewhere: "{items}, nothing to pick",
563566
groupRelated: "Related",
564-
viaNamed: "named",
565-
viaLinked: "linked",
566-
viaTitle: "named: the merge request or commit mentions the key; linked: the Jira issue links to this change",
567+
viaJira: "via Jira",
568+
viaJiraTitle: "Not mentioned in {change}. {key} links to it in Jira.",
567569
taskFrom: "from {items}",
568570
gapsTitle: "Left behind by these picks:",
569571
gapNeeds: "needs {tag}",
@@ -670,9 +672,8 @@ <h2 x-text="t('release')"></h2>
670672
planNoTag: "{keys}: тега ещё нет.",
671673
planElsewhere: "{items}, выбирать нечего",
672674
groupRelated: "Связанные",
673-
viaNamed: "в тексте",
674-
viaLinked: "по ссылке",
675-
viaTitle: "в тексте: ключ упомянут в MR или коммите; по ссылке: задача в Jira ссылается на это изменение",
675+
viaJira: "через Jira",
676+
viaJiraTitle: "{change} не упоминает задачу. {key} ссылается на это изменение в Jira.",
676677
taskFrom: "из {items}",
677678
gapsTitle: "Не войдёт с этими тегами:",
678679
gapNeeds: "нужен {tag}",
@@ -954,8 +955,8 @@ <h2 x-text="t('release')"></h2>
954955
changeLabel(row) {
955956
return row.merge_requests.length ? row.merge_requests.map((item) => "!" + item.iid).join(" ") : row.commits[0].short_sha;
956957
},
957-
viaText(key) {
958-
return key.via.map((source) => this.t(source === "named" ? "viaNamed" : "viaLinked")).join(", ");
958+
viaJira(key) {
959+
return !key.via.includes("named");
959960
},
960961
relationLabel(relation) {
961962
if (relation.kind === "parent") return this.t("relationParent");

‎tests/test_browser.py‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,20 @@ def test_demo_service_rows_line_up_with_and_without_a_pick(page: Page, demo_site
313313
assert errors == []
314314

315315

316-
def test_row_keys_say_whether_the_change_names_them_or_jira_links_them(
317-
page: Page, site: str, errors: list[str]
316+
def test_demo_only_a_key_the_change_does_not_mention_is_marked_as_via_jira(
317+
page: Page, demo_site: str, errors: list[str]
318318
) -> None:
319-
page.goto(site)
319+
page.goto(demo_site)
320320

321-
page.locator("details.service summary").click()
321+
api: typing.Final = _demo_service(page, "shop/api")
322+
api.locator("summary").click()
322323

323-
row_key: typing.Final = page.locator(".row-key", has=page.locator("a", has_text="SHOP-12")).first
324-
expect(row_key.locator(".via")).to_have_text("named, linked")
325-
expect(page.locator(".row-key", has=page.locator("a", has_text="SHOP-9")).locator(".via")).to_have_text("named")
324+
linked: typing.Final = api.locator(".row-key.via-jira")
325+
expect(linked).to_have_count(1)
326+
expect(linked.locator("a")).to_have_text("SHOP-33")
327+
expect(linked.locator(".via")).to_have_text("via Jira")
328+
expect(linked).to_have_attribute("title", "Not mentioned in !54. SHOP-33 links to it in Jira.")
329+
expect(api.locator(".row-key", has=page.locator("a", has_text="SHOP-38")).locator(".via")).to_be_hidden()
326330
assert errors == []
327331

328332

0 commit comments

Comments
 (0)