Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] runbot: add kanban view and stages to build error page #1071

Draft
wants to merge 1 commit into
base: 18.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions runbot/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'data': [
'templates/dockerfile.xml',
'data/dockerfile_data.xml',
'data/build_error_stage.xml',
'data/build_parse.xml',
'data/error_link.xml',
'data/runbot_build_config_data.xml',
Expand Down
18 changes: 18 additions & 0 deletions runbot/data/build_error_stage.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<odoo>
<record model="runbot.build.error.stage" id="build_error_stage_new">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it would be also smart to have "ignored" or "test-tags" column, which would include tasks with test-tags?

<field name="name">New/Unsolved</field>
<field name="sequence">5</field>
<field name="description">New build error detected by the runbot platform</field>
</record>
<record model="runbot.build.error.stage" id="build_error_stage_solved">
<field name="name">Solved</field>
<field name="sequence">10</field>
<field name="description">Issue should be solved. Will automatically move to the Done state after some time</field>
</record>
<record model="runbot.build.error.stage" id="build_error_stage_done">
<field name="name">Done</field>
<field name="sequence">15</field>
<field name="description">Issue is solved or dissapeared</field>
<field name="fold">True</field>
</record>
</odoo>
13 changes: 13 additions & 0 deletions runbot/models/build_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ def _search(self, operator, value):
return [(f'error_content_ids.{field_name}', operator, value)]
return _search


class BuildErrorStage(models.Model):
_name = 'runbot.build.error.stage'
_description = 'Build Error Stage'
_order = 'sequence'

name = fields.Char(string='Stage Name', required=True, translate=True)
description = fields.Text(string='Stage description', translate=True)
sequence = fields.Integer('Sequence', default=1)
fold = fields.Boolean(string='Folded in Kanban', default=False)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is to work, we will also need to change values of "active" and "tes_tags" every time stage changes to either solved/unsolved/ignored. And vice versa, if user decides to change te value of "active" or "test_tags" fields, we stage should also change based on that.
Otherwise, we will have to manually change the stage of every already solved ticket from unsolved to done.


class BuildError(models.Model):
_name = "runbot.build.error"
_description = "Build error"
Expand All @@ -91,6 +103,7 @@ class BuildError(models.Model):
error_count = fields.Integer("Error count", store=True, compute='_compute_count')
previous_error_id = fields.Many2one('runbot.build.error', string="Already seen error")

stage_id = fields.Many2one('runbot.build.error.stage', required=True, tracking=True, group_expand='_read_group_expand_full', default=lambda self: self.env['runbot.build.error.stage'].search([], limit=1))
responsible = fields.Many2one('res.users', 'Assigned fixer', tracking=True)
customer = fields.Many2one('res.users', 'Customer', tracking=True)
team_id = fields.Many2one('runbot.team', 'Assigned team', tracking=True)
Expand Down
3 changes: 2 additions & 1 deletion runbot/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,5 @@ access_runbot_build_stat_regex_wizard,access_runbot_build_stat_regex_wizard,mode

access_runbot_host_message,access_runbot_host_message,runbot.model_runbot_host_message,runbot.group_runbot_admin,1,0,0,0


access_runbot_build_error_stage_user,access_runbot_build_error_stage_user,runbot.model_runbot_build_error_stage,base.group_user,1,0,0,0
access_runbot_build_error_stage_admin,access_runbot_build_error_stage_admin,runbot.model_runbot_build_error_stage,base.group_user,1,1,1,1
57 changes: 56 additions & 1 deletion runbot/views/build_error_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<field name="model">runbot.build.error</field>
<field name="arch" type="xml">
<form>
<header>
<field name="stage_id" widget="statusbar" options="{'clickable': '1'}"/>
</header>
<sheet>
<widget name="web_ribbon" title="Test-tags" bg_color="bg-danger" invisible="not test_tags"/>
<button name="action_view_errors" string="See all linked errors" type="object" class="oe_highlight"/>
Expand Down Expand Up @@ -326,6 +329,58 @@
<field name="binding_view_types">list</field>
</record>

<record id="build_error_view_kanban" model="ir.ui.view">
<field name="name">runbot.build.error.kanban</field>
<field name="model">runbot.build.error</field>
<field name="arch" type="xml">
<kanban default_group_by="stage_id" quick_create="false" default_order="last_seen_date desc">
<templates>
<t t-name="card">
<main>
<field name="name" class="fw-bold fs-5"/>
<group>
<div style="display: flex; align-items: center;">
<i class="fa fa-clock-o me-2"/>
<field name="first_seen_date" widget="remaining_days"/>
<i class="fa fa-long-arrow-right mx-2 oe_read_only" />
<field name="last_seen_date" widget="remaining_days"/>
</div>

<div class="d-flex align-items-center gap-1">
<i class="fa fa-repeat"/>
<field name="error_count"/>
</div>

<div class="d-flex align-items-center gap-1" style="display: flex; align-items: center;">
<i class="fa fa-code-fork"/>
<field name="version_ids" widget="many2many_tags"/>
</div>
<div class="d-flex align-items-center gap-1" style="display: flex; align-items: center;">
<i class="fa fa-bullseye"/>
<field name="trigger_ids" widget="many2many_tags"/>
</div>
</group>

<footer>
<div class="d-flex align-items-center gap-1">
<field name="activity_ids" widget="kanban_activity"/>
</div>
<div class="d-flex align-items-center gap-1 ms-auto">
<i class="fa fa-users"/>
<field name="team_id"/> <i t-if="!record.team_id.raw_value">no team</i>
<i class="fa fa-address-card"/>
<field name="customer" widget="many2one_avatar_user"/>
<i class="fa fa-wrench "/>
<field name="responsible" widget="many2one_avatar_user"/>
</div>
</footer>
</main>
</t>
</templates>
</kanban>
</field>
</record>

<record id="build_error_view_tree" model="ir.ui.view">
<field name="name">runbot.build.error.list</field>
<field name="model">runbot.build.error</field>
Expand Down Expand Up @@ -467,7 +522,7 @@
<field name="name">Errors</field>
<field name="res_model">runbot.build.error</field>
<field name="path">error</field>
<field name="view_mode">list,form</field>
<field name="view_mode">kanban,list,form</field>
<field name="context">{'search_default_not_fixed_errors': True, 'active_test': False}</field>
</record>

Expand Down