Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Times show in the browser's time zone. Hover over one to see the value the repor

## Services

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

- what production runs and the picked tag;
- how many merge requests or commits and Jira tasks the pick ships;
Expand Down
16 changes: 14 additions & 2 deletions release_scope/_static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ <h2 x-text="t('services')"></h2>
:class="{ deployed: deployed(service), involved: planOf(service), idle: chosen.length && !planOf(service) }"
@toggle="openCount = document.querySelectorAll('details.service[open]').length">
<summary>
<span class="name" x-text="service.project"></span>
<span class="name" :title="service.project" x-text="shortName(service.project)"></span>
<span x-show="service.error" class="bad" x-text="t('failedToCollect')"></span>
<span x-show="!service.error">
<span class="muted prod" x-text="productionRef(service) + ' →'"></span>
Expand Down Expand Up @@ -322,7 +322,7 @@ <h2 x-text="t('services')"></h2>
</template>
<template x-for="entry in unlisted" :key="entry.project">
<div class="service unlisted">
<b x-text="entry.project"></b>
<b :title="entry.project" x-text="shortName(entry.project)"></b>
<span class="cell cell-outside" x-text="t('notInReport')"></span>
<span class="muted" x-text="t('linkedTo')"></span>
<template x-for="key in entry.keys" :key="key"><span class="key" x-text="key"></span></template>
Expand Down Expand Up @@ -852,6 +852,18 @@ <h2 x-text="t('release')"></h2>
get listed() {
return this.report.services.filter((service) => service.error || this.production(service) || service.rows.length);
},
get sharedPrefix() {
const paths = this.listed.map((service) => service.project.split("/"));
if (paths.length < 2) return "";
const shared = paths.reduce((prefix, parts) => {
const end = prefix.findIndex((part, index) => part !== parts[index] || index >= parts.length - 1);
return end === -1 ? prefix : prefix.slice(0, end);
});
return shared.length ? shared.join("/") + "/" : "";
},
shortName(project) {
return this.sharedPrefix && project.startsWith(this.sharedPrefix) ? project.slice(this.sharedPrefix.length) : project;
},
get pickable() {
return this.listed.filter((service) => service.candidates.length);
},
Expand Down
6 changes: 4 additions & 2 deletions tests/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ def test_russian_page_has_no_untranslated_placeholders(page: Page, site: str, er
def test_demo_lists_its_services_and_picks_tags_for_an_issue(page: Page, demo_site: str, errors: list[str]) -> None:
page.goto(demo_site)

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


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


def test_demo_clearing_one_service_pick_unticks_the_issue_in_every_service(
Expand Down
Loading