mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 15:35:46 +07:00
[IMP] runbot: search build errors in build error logs
When managing build errors, it's sometimes useful to search for other occurrences of the error in all the build logs. Although it's possible to do it manually, the operation is tedious. With this commit, a button is added on the error page to automatically perform the search for the same error in all the build error logs (sql view).
This commit is contained in:
parent
31d3d9d0b4
commit
c9d966a95c
@ -373,6 +373,25 @@ class BuildError(models.Model):
|
||||
record.team_id = team
|
||||
|
||||
|
||||
def action_search_ir_logs(self):
|
||||
self.ensure_one()
|
||||
context = {
|
||||
'search_default_type': 'server',
|
||||
'search_default_message': self.cleaned_content,
|
||||
'search_default_filter_create_date': True,
|
||||
'search_default_filter_sticky_bundles': True,
|
||||
'search_default_filter_failed_builds': True
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': 'Search Error In Build Error Views',
|
||||
'view_mode': 'tree',
|
||||
'res_model': 'runbot.error.log',
|
||||
'target': 'fullscreen',
|
||||
'context': context,
|
||||
}
|
||||
|
||||
|
||||
class BuildErrorTag(models.Model):
|
||||
|
||||
_name = "runbot.build.error.tag"
|
||||
|
@ -189,7 +189,7 @@ class RunbotErrorLog(models.Model):
|
||||
JOIN
|
||||
runbot_build bu ON l.build_id = bu.id
|
||||
WHERE
|
||||
l.level = 'ERROR'
|
||||
l.level in ('ERROR', 'WARNING')
|
||||
)""")
|
||||
|
||||
def action_goto_build(self):
|
||||
|
@ -9,6 +9,7 @@
|
||||
<widget name="web_ribbon" title="Test-tags" bg_color="bg-danger" attrs="{'invisible': [('test_tags', '=', False)]}"/>
|
||||
<widget name="web_ribbon" title="Linked to another error" bg_color="bg-warning" attrs="{'invisible': [('parent_id', '=', False)]}"/>
|
||||
<header>
|
||||
<button name="action_search_ir_logs" string="Search Error Logs" type="object" groups="runbot.group_runbot_admin"/>
|
||||
</header>
|
||||
<group name="build_error_group" string="Base info" col="2">
|
||||
<field name="content" readonly="1"/>
|
||||
|
@ -65,15 +65,12 @@
|
||||
<field name="name" string="Module"/>
|
||||
<field name="func"/>
|
||||
<field name="build_id"/>
|
||||
<filter string="Failed builds" name="failed_builds" domain="[('global_state', '=', 'done'), ('global_result', '=', 'ko')]"/>
|
||||
<filter string="Failed builds" name="filter_failed_builds" domain="[('global_state', '=', 'done'), ('global_result', '=', 'ko')]"/>
|
||||
<separator/>
|
||||
<filter string="Master bundle" name="master_bundle" domain="[('bundle_ids.name', '=', 'master')]"/>
|
||||
<filter string="Sticky bundles" name="sticky_bundles" domain="[('sticky', '=', True)]"/>
|
||||
<filter string="Master bundle" name="filter_master_bundle" domain="[('bundle_ids.name', '=', 'master')]"/>
|
||||
<filter string="Sticky bundles" name="filter_sticky_bundles" domain="[('sticky', '=', True)]"/>
|
||||
<separator/>
|
||||
<!-- <filter name="filter_log_create_date" date="log_create_date" string="Log Date" default_period="last_7_days"/> -->
|
||||
<filter string="Last 7 Days" name="log_date" domain="[
|
||||
('log_create_date', '>=', (datetime.datetime.combine(context_today() + relativedelta(days=-7), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')),
|
||||
('log_create_date', '<', (datetime.datetime.combine(context_today(), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"/>
|
||||
<filter name="filter_create_date" string="Create Date" date="log_create_date" default_period="this_month"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
@ -82,8 +79,7 @@
|
||||
<field name="name">Error Logs</field>
|
||||
<field name="res_model">runbot.error.log</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<!-- <field name="context">{'search_default_sticky_bundles': True, 'search_default_failed_builds': True, 'time_ranges': {'field': 'log_create_date', 'range': 'last_7_days'},}</field> -->
|
||||
<field name="context">{'search_default_sticky_bundles': True, 'search_default_failed_builds': True, 'search_default_log_date': True}</field>
|
||||
<field name="context">{'search_default_sticky_bundles': True, 'search_default_failed_builds': True, 'search_default_filter_create_date': True}</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user