[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.
This commit is contained in:
Xavier-Do 2024-05-14 15:14:42 +02:00 committed by Christophe Monniez
parent 2a18cd7f3d
commit 507f4e37e3
5 changed files with 23 additions and 0 deletions

View File

@ -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/<model("runbot.trigger"):trigger_id>'], 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,
})

View File

@ -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': '<t></t>'},
)
@api.depends('config_id.step_order_ids.step_id.make_stats')
def _compute_has_stats(self):
for trigger in self:

View File

@ -162,5 +162,12 @@
</t>
</t>
</template>
<template id="runbot.trigger_report">
<t t-call="runbot.layout">
<t t-call="{{trigger.report_view_id.key}}">
</t>
</t>
</template>
</data>
</odoo>

View File

@ -219,6 +219,7 @@
<span t-else="" t-attf-class="btn btn-default disabled slot_name">
<span t-esc="slot.trigger_id.name"/>
</span>
<a t-if="slot.trigger_id.report_view_id" title="View last trigger report" t-attf-href="/runbot/trigger/report/{{slot.trigger_id.id}}" class="fa fa-eye btn btn-info"/>
<a t-if="bu.local_state == 'running' and bu.database_ids" t-attf-href="/runbot/run/{{bu.id}}" class="fa fa-sign-in btn btn-info"/>
<a t-if="bu.static_run" t-att-href="bu.static_run" class="fa fa-sign-in btn btn-info"/>
<t t-if="bu" t-call="runbot.build_menu"/>

View File

@ -17,6 +17,7 @@
<field name="category_id" required='1'/>
<field name="project_id" default=""/>
<field name="config_id"/>
<field name="report_view_id"/>
</group>
<group>
<field name="description"/>