diff --git a/runbot_merge/controllers/dashboard.py b/runbot_merge/controllers/dashboard.py index 8a173c77..b06ee8bf 100644 --- a/runbot_merge/controllers/dashboard.py +++ b/runbot_merge/controllers/dashboard.py @@ -35,19 +35,24 @@ class MergebotDashboard(Controller): }) @route('/runbot_merge/', 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() if not branch: raise werkzeug.exceptions.NotFound() - stagings = request.env['runbot_merge.stagings'].with_context(active_test=False).sudo().search([ - ('target', '=', branch.id), - ('staged_at', '<=', until) if until else (True, '=', True), - ], order='staged_at desc', limit=LIMIT+1) + staging_domain = [('target', '=', branch.id)] + if until: + staging_domain.append(('staged_at', '<=', until)) + 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', { 'branch': branch, 'stagings': stagings[:LIMIT], + 'until': until, + 'state': state, 'next': stagings[-1].staged_at if len(stagings) > LIMIT else None, }) diff --git a/runbot_merge/models/pull_requests.py b/runbot_merge/models/pull_requests.py index 5b3c23d5..d9b63411 100644 --- a/runbot_merge/models/pull_requests.py +++ b/runbot_merge/models/pull_requests.py @@ -1764,7 +1764,7 @@ class Stagings(models.Model): ('pending', 'Pending'), ('cancelled', "Cancelled"), ('ff_failed', "Fast forward failed") - ], default='pending') + ], default='pending', index=True) active = fields.Boolean(default=True) staged_at = fields.Datetime(default=fields.Datetime.now, index=True) diff --git a/runbot_merge/views/templates.xml b/runbot_merge/views/templates.xml index 34b403a7..1a5fd4a1 100644 --- a/runbot_merge/views/templates.xml +++ b/runbot_merge/views/templates.xml @@ -199,6 +199,18 @@

:

+
+ + + (UTC) + + + +
- + Next >