Skip to content

Commit f42868e

Browse files
committed
[IMP] runbot: add kanban view and stages to build error page
Introduce a kanban view to the runbot build error records. Kanban cards show the most valuable field with relevant icons. The concept of "state" was also introduced for the build error model. Currently there is 4 states: 1. New: default state for any new error build 2. Solved: when the issue should be solved 3. Ignored: build error currently ignored (test-tags) 4. Done: When the issue stop happening Certain states change automatically based as handled in a cron Generally, any not-ignored on-going task end up in done after some period of time if it is not seen for some time ( see full details in function `_update_stage`). The other state are expected to be used by the user. For instance after fixing an underteministic error the user can change the state from new -> solved so that it is moved to done if the build error is not seen for 7 days (instead of 15 if it was in new).
1 parent 7896428 commit f42868e

File tree

4 files changed

+90
-2
lines changed

4 files changed

+90
-2
lines changed

runbot/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'author': "Odoo SA",
77
'website': "http://runbot.odoo.com",
88
'category': 'Website',
9-
'version': '5.10',
9+
'version': '5.11',
1010
'application': True,
1111
'depends': ['base', 'base_automation', 'website'],
1212
'data': [
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
def migrate(cr, version):
3+
# Archived build errors are set are considered solved
4+
cr.execute("""
5+
UPDATE runbot_build_error
6+
SET state = 'solved'
7+
WHERE active = false
8+
""")
9+
# Build errors with test_tags are set to Ignored
10+
cr.execute("""
11+
UPDATE runbot_build_error
12+
SET state = 'ignored'
13+
WHERE test_tags is not null
14+
""")

runbot/models/build_error.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ class BuildError(models.Model):
105105
error_count = fields.Integer("Error count", store=True, compute='_compute_count')
106106
previous_error_id = fields.Many2one('runbot.build.error', string="Already seen error")
107107

108+
state = fields.Selection([
109+
('new', 'New/Unsolved'),
110+
('solved', 'Solved'),
111+
('ignored', 'Ignored'),
112+
], default='new', tracking=True, group_expand=True,
113+
help="New: Error is new and not yet solved.\n"
114+
"Solved: Error should be solved.\n"
115+
"Ignored: Error is ignored"
116+
)
108117
responsible = fields.Many2one('res.users', 'Assigned fixer', tracking=True)
109118
customer = fields.Many2one('res.users', 'Customer', tracking=True)
110119
team_id = fields.Many2one('runbot.team', 'Assigned team', tracking=True)
@@ -586,6 +595,15 @@ def action_link_errors(self):
586595
base_error = self_sorted[0]
587596
base_error._merge(self_sorted - base_error)
588597

598+
@api.model
599+
def _read_group_fill_results(self, domain, groupby, annoted_aggregates, read_group_result, read_group_order=None):
600+
# Override to fold ignored state
601+
read_groups = super()._read_group_fill_results(domain, groupby, annoted_aggregates, read_group_result, read_group_order)
602+
for read_group in read_groups:
603+
if read_group.get('state', False) == 'ignored':
604+
read_group['__fold'] = True
605+
return read_groups
606+
589607

590608
class BuildErrorContent(models.Model):
591609

runbot/views/build_error_views.xml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<field name="model">runbot.build.error</field>
66
<field name="arch" type="xml">
77
<form>
8+
<header>
9+
<field name="state" widget="statusbar" options="{'clickable': '1'}"/>
10+
</header>
811
<sheet>
912
<div name="button_box">
1013
<button class="oe_stat_button" type="object" icon="fa-exclamation-circle" name="action_get_build_link_record">
@@ -329,6 +332,59 @@
329332
<field name="binding_view_types">list</field>
330333
</record>
331334

335+
<record id="build_error_view_kanban" model="ir.ui.view">
336+
<field name="name">runbot.build.error.kanban</field>
337+
<field name="model">runbot.build.error</field>
338+
<field name="arch" type="xml">
339+
<kanban default_group_by="state" quick_create="false" default_order="last_seen_date desc">
340+
<templates>
341+
<t t-name="card">
342+
<widget name="web_ribbon" title="Test-tags" bg_color="bg-danger" invisible="not test_tags"/>
343+
<field name="name" class="fw-bold fs-5"/>
344+
<group>
345+
<div class="d-flex align-items-center">
346+
<i class="fa fa-clock-o me-2" title="Date interval from first seen to last seen"/>
347+
<field name="first_seen_date" widget="remaining_days"/>
348+
<i class="fa fa-long-arrow-right mx-2 oe_read_only" title="to"/>
349+
<field name="last_seen_date" widget="remaining_days"/>
350+
</div>
351+
352+
<div class="d-flex align-items-center gap-1">
353+
<i class="fa fa-repeat" title="Number of occurence"/>
354+
<field name="error_count"/>
355+
</div>
356+
357+
<div class="d-flex align-items-center gap-1">
358+
<i class="fa fa-code-fork" title="Concerned Odoo versions"/>
359+
<field name="version_ids" widget="many2many_tags"/>
360+
</div>
361+
<div class="d-flex align-items-center gap-1">
362+
<i class="fa fa-bullseye" title="Triggers"/>
363+
<field name="trigger_ids" widget="many2many_tags"/>
364+
</div>
365+
</group>
366+
367+
<footer>
368+
<div class="d-flex align-items-center gap-1">
369+
<field name="activity_ids" widget="kanban_activity"/>
370+
</div>
371+
<div class="d-flex align-items-center gap-1 ms-auto">
372+
<i class="fa fa-random text-danger" title="inconsistant" invisible="not random"/>
373+
<i class="fa fa-users" title="Responsible team"/>
374+
<field name="team_id"/> <i t-if="!record.team_id.raw_value">no team</i>
375+
<i class="fa fa-address-card" title="Investigator"/>
376+
<field name="customer" widget="many2one_avatar_user"/>
377+
<i class="fa fa-wrench" title="Solver"/>
378+
<field name="responsible" widget="many2one_avatar_user"/>
379+
<field name="fixing_pr_url" widget="url" text="PR" invisible="not fixing_pr_url"/>
380+
</div>
381+
</footer>
382+
</t>
383+
</templates>
384+
</kanban>
385+
</field>
386+
</record>
387+
332388
<record id="build_error_view_tree" model="ir.ui.view">
333389
<field name="name">runbot.build.error.list</field>
334390
<field name="model">runbot.build.error</field>
@@ -478,7 +534,7 @@
478534
<field name="name">Errors</field>
479535
<field name="res_model">runbot.build.error</field>
480536
<field name="path">error</field>
481-
<field name="view_mode">list,form</field>
537+
<field name="view_mode">list,kanban,form</field>
482538
<field name="context">{'search_default_not_fixed_errors': True, 'active_test': False}</field>
483539
</record>
484540

0 commit comments

Comments
 (0)