mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[FIX] runbot_merge: bugs in log of branch stagings (in frontend)
- Some batches in a few stagings are apparently empty (e.g. batch 71771 from staging 32511), the listing was not resilient to such issues. Update the code to suppress the display of empty batches. - The possibility of accessing `/runbot_merge/<id>` with a non-existent branch had not been considered and triggered a rendering error in the template. Fixes #630, fixes #631
This commit is contained in:
parent
c3b90454a2
commit
c85735870a
@ -19,13 +19,17 @@ class MergebotDashboard(Controller):
|
|||||||
|
|
||||||
@route('/runbot_merge/<int:branch_id>', auth='public', type='http', website=True)
|
@route('/runbot_merge/<int:branch_id>', auth='public', type='http', website=True)
|
||||||
def stagings(self, branch_id, until=None):
|
def stagings(self, branch_id, until=None):
|
||||||
|
branch = request.env['runbot_merge.branch'].browse(branch_id).sudo().exists()
|
||||||
|
if not branch:
|
||||||
|
raise werkzeug.exceptions.NotFound()
|
||||||
|
|
||||||
stagings = request.env['runbot_merge.stagings'].with_context(active_test=False).sudo().search([
|
stagings = request.env['runbot_merge.stagings'].with_context(active_test=False).sudo().search([
|
||||||
('target', '=', branch_id),
|
('target', '=', branch.id),
|
||||||
('staged_at', '<=', until) if until else (True, '=', True),
|
('staged_at', '<=', until) if until else (True, '=', True),
|
||||||
], order='staged_at desc', limit=LIMIT+1)
|
], order='staged_at desc', limit=LIMIT+1)
|
||||||
|
|
||||||
return request.render('runbot_merge.branch_stagings', {
|
return request.render('runbot_merge.branch_stagings', {
|
||||||
'branch': request.env['runbot_merge.branch'].browse(branch_id).sudo(),
|
'branch': branch,
|
||||||
'stagings': stagings[:LIMIT],
|
'stagings': stagings[:LIMIT],
|
||||||
'next': stagings[-1].staged_at if len(stagings) > LIMIT else None,
|
'next': stagings[-1].staged_at if len(stagings) > LIMIT else None,
|
||||||
})
|
})
|
||||||
|
@ -248,8 +248,8 @@
|
|||||||
<t t-foreach="staging.batch_ids"
|
<t t-foreach="staging.batch_ids"
|
||||||
t-as="batch">
|
t-as="batch">
|
||||||
<t t-set="first_pr"
|
<t t-set="first_pr"
|
||||||
t-value="batch.prs[-1]"/>
|
t-value="batch.prs[-1:]"/>
|
||||||
<li class="dropdown">
|
<li class="dropdown" t-if="first_pr">
|
||||||
<button class="btn btn-link dropdown-toggle"
|
<button class="btn btn-link dropdown-toggle"
|
||||||
type="button"
|
type="button"
|
||||||
data-toggle="dropdown"
|
data-toggle="dropdown"
|
||||||
|
Loading…
Reference in New Issue
Block a user