[FIX] runbot_merge: also show banners on PR pages

It's likely that the PR pages are seen more commonly than the
dashboard by most users, so add alerts there in case users wonder
what's happening.

Fixes #580
This commit is contained in:
Xavier Morel 2022-06-30 14:33:18 +02:00
parent 2a268d777c
commit 64eeb6142e
4 changed files with 27 additions and 19 deletions

View File

@ -1,5 +1,5 @@
<odoo>
<template id="dashboard" inherit_id="runbot_merge.dashboard">
<template id="alerts" inherit_id="runbot_merge.alerts">
<xpath expr="//div[@id='alerts']">
<t t-set="fpcron" t-value="env(user=1).ref('forwardport.port_forward')"/>
<div t-if="not fpcron.active" class="alert alert-warning col-12" role="alert">

View File

@ -0,0 +1 @@
IMP: show current alerts (disabled crons) on the PR pages

View File

@ -4,3 +4,5 @@ IMP: various UI items
- fix "outstanding forward ports" count
- add date of staging last modification (= success / failure instant)
- correctly retrieve and include fast-forward and unstaging reasons
- show the warnings banner (e.g. staging disabled) on the PR pages, as not all
users routinely visit the main dashboard

View File

@ -57,22 +57,26 @@
</div>
</template>
<template id="alerts">
<div id="alerts" class="row text-center">
<div class="alert alert-light col-md-12 h6 mb-0">
<a href="/runbot_merge/changelog">Changelog</a>
</div>
<t t-set="stagingcron" t-value="env(user=1).ref('runbot_merge.staging_cron')"/>
<div t-if="not stagingcron.active" class="alert alert-warning col-12 mb-0" role="alert">
Staging is disabled, "ready" pull requests will not be staged.
</div>
<t t-set="mergecron" t-value="env(user=1).ref('runbot_merge.merge_cron')"/>
<div t-if="not mergecron.active" class="alert alert-warning col-12 mb-0" role="alert">
Merging is disabled, stagings will not be disabled.
</div>
</div>
</template>
<template id="dashboard" name="mergebot dashboard">
<t t-call="website.layout">
<div id="wrap"><div class="container-fluid">
<div id="alerts" class="row text-center">
<div class="alert alert-light col-md-12 h6 mb-0">
<a href="/runbot_merge/changelog">Changelog</a>
</div>
<t t-set="stagingcron" t-value="env(user=1).ref('runbot_merge.staging_cron')"/>
<div t-if="not stagingcron.active" class="alert alert-warning col-12 mb-0" role="alert">
Staging is disabled, "ready" pull requests will not be staged.
</div>
<t t-set="mergecron" t-value="env(user=1).ref('runbot_merge.merge_cron')"/>
<div t-if="not mergecron.active" class="alert alert-warning col-12 mb-0" role="alert">
Merging is disabled, stagings will not be disabled.
</div>
</div>
<t t-call="runbot_merge.alerts"/>
<section t-foreach="projects.with_context(active_test=False)" t-as="project" class="row">
<h1 class="col-md-12"><t t-esc="project.name"/></h1>
<div class="col-md-12">
@ -385,12 +389,13 @@
<template id="view_pull_request">
<t t-call="website.layout">
<div id="wrap"><div class="container-fluid">
<t t-call="runbot_merge.alerts"/>
<h1>
<a t-att-href="pr.github_url" t-field="pr.display_name">
</a>
<a t-attf-href="/web#view_type=form&amp;model=runbot_merge.pull_requests&amp;id={{pr.id}}"
class="btn btn-sm btn-secondary align-top float-right"
groups="base.group_user">View in backend</a>
<a t-att-href="pr.github_url" t-field="pr.display_name">
</a>
<a t-attf-href="/web#view_type=form&amp;model=runbot_merge.pull_requests&amp;id={{pr.id}}"
class="btn btn-sm btn-secondary align-top float-right"
groups="base.group_user">View in backend</a>
</h1>
<h6>Created by <span t-field="pr.author.display_name"/></h6>
<t t-set="tmpl">