Skip to content

Commit c412ac9

Browse files
authored
Drop the shared group path from service names (#49)
1 parent 9349e6b commit c412ac9

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

‎docs/page.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Times show in the browser's time zone. Hover over one to see the value the repor
1616

1717
## Services
1818

19-
Each service is one line. It shows:
19+
Each service is one line, named without the group path all services share, such as `api` for `shop/api`.
20+
Hover over a name to see the full path. It shows:
2021

2122
- what production runs and the picked tag;
2223
- how many merge requests or commits and Jira tasks the pick ships;

‎release_scope/_static/index.html‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ <h2 x-text="t('services')"></h2>
183183
:class="{ deployed: deployed(service), involved: planOf(service), idle: chosen.length && !planOf(service) }"
184184
@toggle="openCount = document.querySelectorAll('details.service[open]').length">
185185
<summary>
186-
<span class="name" x-text="service.project"></span>
186+
<span class="name" :title="service.project" x-text="shortName(service.project)"></span>
187187
<span x-show="service.error" class="bad" x-text="t('failedToCollect')"></span>
188188
<span x-show="!service.error">
189189
<span class="muted prod" x-text="productionRef(service) + ' →'"></span>
@@ -322,7 +322,7 @@ <h2 x-text="t('services')"></h2>
322322
</template>
323323
<template x-for="entry in unlisted" :key="entry.project">
324324
<div class="service unlisted">
325-
<b x-text="entry.project"></b>
325+
<b :title="entry.project" x-text="shortName(entry.project)"></b>
326326
<span class="cell cell-outside" x-text="t('notInReport')"></span>
327327
<span class="muted" x-text="t('linkedTo')"></span>
328328
<template x-for="key in entry.keys" :key="key"><span class="key" x-text="key"></span></template>
@@ -852,6 +852,18 @@ <h2 x-text="t('release')"></h2>
852852
get listed() {
853853
return this.report.services.filter((service) => service.error || this.production(service) || service.rows.length);
854854
},
855+
get sharedPrefix() {
856+
const paths = this.listed.map((service) => service.project.split("/"));
857+
if (paths.length < 2) return "";
858+
const shared = paths.reduce((prefix, parts) => {
859+
const end = prefix.findIndex((part, index) => part !== parts[index] || index >= parts.length - 1);
860+
return end === -1 ? prefix : prefix.slice(0, end);
861+
});
862+
return shared.length ? shared.join("/") + "/" : "";
863+
},
864+
shortName(project) {
865+
return this.sharedPrefix && project.startsWith(this.sharedPrefix) ? project.slice(this.sharedPrefix.length) : project;
866+
},
855867
get pickable() {
856868
return this.listed.filter((service) => service.candidates.length);
857869
},

‎tests/test_browser.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ def test_russian_page_has_no_untranslated_placeholders(page: Page, site: str, er
114114
def test_demo_lists_its_services_and_picks_tags_for_an_issue(page: Page, demo_site: str, errors: list[str]) -> None:
115115
page.goto(demo_site)
116116

117-
expect(page.locator("details.service .name")).to_have_text(["shop/admin", "shop/api", "shop/web", "shop/worker"])
117+
names = page.locator("details.service .name")
118+
expect(names).to_have_text(["admin", "api", "web", "worker"])
119+
expect(names.first).to_have_attribute("title", "shop/admin")
118120
expect(page.locator(".issue-row code")).to_have_count(6)
119121
_issue(page, "SHOP-38").check()
120122
expect(page).to_have_url(re.compile(r"#issues=SHOP-38&shop/api=2\.5\.0&shop/web=1\.9\.0$"))
@@ -172,7 +174,7 @@ def test_an_address_with_an_older_pick_unticks_the_issues_it_misses(page: Page,
172174

173175

174176
def _demo_service(page: Page, project: str) -> Locator:
175-
return page.locator("details.service", has=page.locator(".name", has_text=project))
177+
return page.locator("details.service", has=page.locator(f'.name[title="{project}"]'))
176178

177179

178180
def test_demo_clearing_one_service_pick_unticks_the_issue_in_every_service(

0 commit comments

Comments
 (0)