mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] runbot_merge: filtering options and UX on stagings list
Allow filtering stagings by state (success or failure), and provide a control to explicitly update the staging date limit. Should make it easier to drill through stagings when looking for specific information. Related to #751
This commit is contained in:
parent
5bce73c97d
commit
780e20bfd6
@ -35,19 +35,24 @@ class MergebotDashboard(Controller):
|
|||||||
})
|
})
|
||||||
|
|
||||||
@route('/runbot_merge/<int:branch_id>', auth='public', type='http', website=True, sitemap=False)
|
@route('/runbot_merge/<int:branch_id>', auth='public', type='http', website=True, sitemap=False)
|
||||||
def stagings(self, branch_id, until=None):
|
def stagings(self, branch_id, until=None, state=''):
|
||||||
branch = request.env['runbot_merge.branch'].browse(branch_id).sudo().exists()
|
branch = request.env['runbot_merge.branch'].browse(branch_id).sudo().exists()
|
||||||
if not branch:
|
if not branch:
|
||||||
raise werkzeug.exceptions.NotFound()
|
raise werkzeug.exceptions.NotFound()
|
||||||
|
|
||||||
stagings = request.env['runbot_merge.stagings'].with_context(active_test=False).sudo().search([
|
staging_domain = [('target', '=', branch.id)]
|
||||||
('target', '=', branch.id),
|
if until:
|
||||||
('staged_at', '<=', until) if until else (True, '=', True),
|
staging_domain.append(('staged_at', '<=', until))
|
||||||
], order='staged_at desc', limit=LIMIT+1)
|
if state:
|
||||||
|
staging_domain.append(('state', '=', state))
|
||||||
|
|
||||||
|
stagings = request.env['runbot_merge.stagings'].with_context(active_test=False).sudo().search(staging_domain, order='staged_at desc', limit=LIMIT + 1)
|
||||||
|
|
||||||
return request.render('runbot_merge.branch_stagings', {
|
return request.render('runbot_merge.branch_stagings', {
|
||||||
'branch': branch,
|
'branch': branch,
|
||||||
'stagings': stagings[:LIMIT],
|
'stagings': stagings[:LIMIT],
|
||||||
|
'until': until,
|
||||||
|
'state': state,
|
||||||
'next': stagings[-1].staged_at if len(stagings) > LIMIT else None,
|
'next': stagings[-1].staged_at if len(stagings) > LIMIT else None,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1764,7 +1764,7 @@ class Stagings(models.Model):
|
|||||||
('pending', 'Pending'),
|
('pending', 'Pending'),
|
||||||
('cancelled', "Cancelled"),
|
('cancelled', "Cancelled"),
|
||||||
('ff_failed', "Fast forward failed")
|
('ff_failed', "Fast forward failed")
|
||||||
], default='pending')
|
], default='pending', index=True)
|
||||||
active = fields.Boolean(default=True)
|
active = fields.Boolean(default=True)
|
||||||
|
|
||||||
staged_at = fields.Datetime(default=fields.Datetime.now, index=True)
|
staged_at = fields.Datetime(default=fields.Datetime.now, index=True)
|
||||||
|
@ -199,6 +199,18 @@
|
|||||||
<section class="row">
|
<section class="row">
|
||||||
<h1 class="col-md-12"><t t-esc="branch.project_id.name"/>: <t t-esc="branch.name"/></h1>
|
<h1 class="col-md-12"><t t-esc="branch.project_id.name"/>: <t t-esc="branch.name"/></h1>
|
||||||
</section>
|
</section>
|
||||||
|
<form method="get">
|
||||||
|
<label for="until">Staged before:</label>
|
||||||
|
<input type="datetime-local" name="until" t-att-value="until"/>
|
||||||
|
(UTC)
|
||||||
|
<label for="state">State:</label>
|
||||||
|
<select name="state">
|
||||||
|
<option t-att-selected="'selected' if not state else None"/>
|
||||||
|
<option t-att-selected="'selected' if state == 'success' else None" value="success">Success</option>
|
||||||
|
<option t-att-selected="'selected' if state == 'failure' else None" value="failure">Failure</option>
|
||||||
|
</select>
|
||||||
|
<button type="submit">Apply</button>
|
||||||
|
</form>
|
||||||
<table>
|
<table>
|
||||||
<t t-foreach="stagings" t-as="staging">
|
<t t-foreach="stagings" t-as="staging">
|
||||||
<t t-set="success"
|
<t t-set="success"
|
||||||
@ -270,7 +282,7 @@
|
|||||||
</t>
|
</t>
|
||||||
</table>
|
</table>
|
||||||
<t t-if="next">
|
<t t-if="next">
|
||||||
<a t-attf-href="/runbot_merge/{{branch.id}}?until={{next}}">
|
<a t-attf-href="/runbot_merge/{{branch.id}}?until={{next}}&state={{state}}">
|
||||||
Next >
|
Next >
|
||||||
</a>
|
</a>
|
||||||
</t>
|
</t>
|
||||||
|
Loading…
Reference in New Issue
Block a user