From c9d966a95ce798e9e926d24b7d6ea3ac18720a8c Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Wed, 31 Jan 2024 10:40:32 +0100 Subject: [PATCH] [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). --- runbot/models/build_error.py | 19 +++++++++++++++++++ runbot/models/ir_logging.py | 2 +- runbot/views/build_error_views.xml | 1 + runbot/views/error_log_views.xml | 14 +++++--------- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/runbot/models/build_error.py b/runbot/models/build_error.py index 3bec114b..2263611b 100644 --- a/runbot/models/build_error.py +++ b/runbot/models/build_error.py @@ -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" diff --git a/runbot/models/ir_logging.py b/runbot/models/ir_logging.py index eaf45743..53f443cc 100644 --- a/runbot/models/ir_logging.py +++ b/runbot/models/ir_logging.py @@ -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): diff --git a/runbot/views/build_error_views.xml b/runbot/views/build_error_views.xml index f80ab77f..7f0e2d47 100644 --- a/runbot/views/build_error_views.xml +++ b/runbot/views/build_error_views.xml @@ -9,6 +9,7 @@
+
diff --git a/runbot/views/error_log_views.xml b/runbot/views/error_log_views.xml index bc5c7304..2bd23ec1 100644 --- a/runbot/views/error_log_views.xml +++ b/runbot/views/error_log_views.xml @@ -65,15 +65,12 @@ - + - - + + - - + @@ -82,8 +79,7 @@ Error Logs runbot.error.log tree,form - - {'search_default_sticky_bundles': True, 'search_default_failed_builds': True, 'search_default_log_date': True} + {'search_default_sticky_bundles': True, 'search_default_failed_builds': True, 'search_default_filter_create_date': True}