From c4b76049991447421ce22565c0096b8ba6dc1ad4 Mon Sep 17 00:00:00 2001 From: xmo-odoo Date: Wed, 21 Aug 2019 14:15:10 +0200 Subject: [PATCH] [ADD] runbot_merge: staging history per branch Closes #175 --- runbot_merge/controllers/dashboard.py | 15 ++++- runbot_merge/views/templates.xml | 87 ++++++++++++++++++++++++++- 2 files changed, 100 insertions(+), 2 deletions(-) diff --git a/runbot_merge/controllers/dashboard.py b/runbot_merge/controllers/dashboard.py index 5934958a..061ad5c7 100644 --- a/runbot_merge/controllers/dashboard.py +++ b/runbot_merge/controllers/dashboard.py @@ -1,10 +1,23 @@ # -*- coding: utf-8 -*- from odoo.http import Controller, route, request - +LIMIT = 20 class MergebotDashboard(Controller): @route('/runbot_merge', auth="public", type="http", website=True) def dashboard(self): return request.render('runbot_merge.dashboard', { 'projects': request.env['runbot_merge.project'].with_context(active_test=False).sudo().search([]), }) + + @route('/runbot_merge/', auth='public', type='http', website=True) + def stagings(self, branch_id, until=None): + 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) + + return request.render('runbot_merge.branch_stagings', { + 'branch': request.env['runbot_merge.branch'].browse(branch_id).sudo(), + 'stagings': stagings[:LIMIT], + 'next': stagings[-1].staged_at if len(stagings) > LIMIT else None, + }) diff --git a/runbot_merge/views/templates.xml b/runbot_merge/views/templates.xml index 70d6e9b1..d57972e7 100644 --- a/runbot_merge/views/templates.xml +++ b/runbot_merge/views/templates.xml @@ -45,7 +45,11 @@
-

+

+ + + +

+ +
+
+

:

+
+ + + + + + bg-success + bg-danger + bg-info + bg-gray-lighter + + + Cancelled: + Fast Forward Failed + + + + + + + Next > + + +
+
+