[FIX] runbot_merge: more frontend templates

af016f4239 did a half-assed job and
didn't fix the one test which actually checks the dashboard.

TBF I was in a bit of a hurry trying to make the mergebot work and be
presentable again, but still...
This commit is contained in:
Xavier Morel 2022-11-30 12:44:25 +01:00
parent 7cdf77ce18
commit 3e2db48786
2 changed files with 16 additions and 17 deletions

View File

@ -105,10 +105,11 @@ def test_trivial_flow(env, repo, page, users, config):
}
p = html.fromstring(page('/runbot_merge'))
s = p.cssselect('.staging div.dropdown li')
assert len(s) == 2
assert s[1].get('class') == 'bg-success'
assert s[1][0].text.strip() == '{}: ci/runbot'.format(repo.name)
s = p.cssselect('.staging div.dropdown a')
assert len(s) == 2, "not logged so only *required* statuses"
for e, status in zip(s, ['legal/cla', 'ci/runbot']):
assert set(e.classes) == {'dropdown-item', 'bg-success'}
assert e.text_content().strip() == f'{repo.name}: {status}'
assert st.state == 'success'
assert pr_id.state == 'merged'

View File

@ -29,20 +29,18 @@
<t t-raw="0"/>
<span class="caret"></span>
</button>
<ul class="dropdown-menu staging-statuses">
<li >
<a groups="runbot_merge.group_admin"
class="dropdown-item" role="menuitem"
t-attf-href="/web#id={{staging.id}}&amp;view_type=form&amp;model=runbot_merge.stagings"
target="new">
Open Staging
</a>
</li>
<div class="dropdown-menu staging-statuses">
<a groups="runbot_merge.group_admin"
class="dropdown-item" role="menuitem"
t-attf-href="/web#id={{staging.id}}&amp;view_type=form&amp;model=runbot_merge.stagings"
target="new">
Open Staging
</a>
<t t-set="statuses" t-value="{(r, c): (s, t) for r, c, s, t in staging.statuses}"/>
<t t-foreach="repo_statuses._for_staging(staging)" t-as="req">
<t t-set="st" t-value="statuses.get((req.repo_id.name, req.context)) or (None, None)"/>
<a t-att-href="st[1]" target="new" role="menuitem" t-attf-class="
dropdown-menu
dropdown-item
{{'bg-success' if st[0] == 'success'
else 'bg-danger' if st[0] in ('error', 'failure')
else 'bg-info' if st[0]
@ -50,7 +48,7 @@
<t t-esc="req.repo_id.name"/>: <t t-esc="req.context"/>
</a>
</t>
</ul>
</div>
</div>
</template>
@ -256,14 +254,14 @@
<t t-esc="first_pr.label"/>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<div class="dropdown-menu">
<t t-foreach="batch.prs" t-as="pr">
<t t-call="runbot_merge.link-pr">
<t t-set="target">new</t>
<t t-set="classes">dropdown-item</t>
</t>
</t>
</ul>
</div>
</li>
</t>
</ul>