From 507f4e37e365b7e14a17d245c040fdbc0fea46b7 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Tue, 14 May 2024 15:14:42 +0200 Subject: [PATCH] [IMP] runbot: custom trigger view Somme trigger may have an important depth and nightly result can be long to check. A custom view was already done for upgrade nightly, but this is hidden and the same logic could be applied to the distro builds, ... This commit adds a custom view on the trigger and related controller to display a custom view for a trigger. --- runbot/controllers/frontend.py | 7 +++++++ runbot/models/repo.py | 7 +++++++ runbot/templates/batch.xml | 7 +++++++ runbot/templates/utils.xml | 1 + runbot/views/repo_views.xml | 1 + 5 files changed, 23 insertions(+) diff --git a/runbot/controllers/frontend.py b/runbot/controllers/frontend.py index 10914be9..38b13229 100644 --- a/runbot/controllers/frontend.py +++ b/runbot/controllers/frontend.py @@ -655,3 +655,10 @@ class Runbot(Controller): bundle.sudo().no_build = bool(value) _logger.info('Bundle %s no_build set to %s by %s', bundle.name, bool(value), request.env.user.name) return werkzeug.utils.redirect(f'/runbot/bundle/{bundle_id}') + + @route(['/runbot/trigger/report/'], type='http', auth='user', website=True, sitemap=False) + def report_view(self, trigger_id=None, **kwargs): + return request.render("runbot.trigger_report", { + 'trigger': trigger_id, + 'project': trigger_id.project_id, + }) diff --git a/runbot/models/repo.py b/runbot/models/repo.py index 11bdd8aa..6fa8608d 100644 --- a/runbot/models/repo.py +++ b/runbot/models/repo.py @@ -88,6 +88,13 @@ class Trigger(models.Model): team_ids = fields.Many2many('runbot.team', string="Runbot Teams", help="Teams responsible of this trigger, mainly usefull for nightly") active = fields.Boolean("Active", default=True) + report_view_id = fields.Many2one('ir.ui.view', + help="custom view to render result", + string='Docker Template', + domain=[('type', '=', 'qweb')], + context={'default_type': 'qweb', 'default_arch_base': ''}, + ) + @api.depends('config_id.step_order_ids.step_id.make_stats') def _compute_has_stats(self): for trigger in self: diff --git a/runbot/templates/batch.xml b/runbot/templates/batch.xml index 7ecadecc..d9a14531 100644 --- a/runbot/templates/batch.xml +++ b/runbot/templates/batch.xml @@ -162,5 +162,12 @@ + + diff --git a/runbot/templates/utils.xml b/runbot/templates/utils.xml index 7745f462..48db9a66 100644 --- a/runbot/templates/utils.xml +++ b/runbot/templates/utils.xml @@ -219,6 +219,7 @@ +