From 6c64bbb49b8b2a1da38c392387f914cc8a2ae49c Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Thu, 12 Dec 2019 01:03:12 +0100 Subject: [PATCH] [IMP] runbot: improve build log view Co-authored-by: Xavier-Do --- runbot/controllers/frontend.py | 19 +---- runbot/models/build.py | 2 + runbot/static/src/less/runbot.less | 8 ++ runbot/templates/build.xml | 128 ++++++++++++----------------- 4 files changed, 65 insertions(+), 92 deletions(-) diff --git a/runbot/controllers/frontend.py b/runbot/controllers/frontend.py index cd3e13fa..4ad29ddf 100644 --- a/runbot/controllers/frontend.py +++ b/runbot/controllers/frontend.py @@ -160,28 +160,14 @@ class Runbot(Controller): if not build.exists(): return request.not_found() - # other builds - build_ids = Build.search([('branch_id', '=', build.branch_id.id)], limit=100) - other_builds = Build.browse(build_ids) - domain = [('build_id', '=', build.real_build.id)] - log_type = request.params.get('type', '') - if log_type: - domain.append(('type', '=', log_type)) - level = request.params.get('level', '') - if level: - domain.append(('level', '=', level.upper())) - if search: - domain.append(('message', 'ilike', search)) - logging_ids = Logging.sudo().search(domain, limit=10000) + show_rebuild_button = Build.search([('branch_id', '=', build.branch_id.id), ('parent_id', '=', False)], limit=1) == build context = { 'repo': build.repo_id, 'build': build, 'fqdn': fqdn(), 'br': {'branch': build.branch_id}, - 'logs': Logging.sudo().browse(logging_ids).ids, - 'other_builds': other_builds.ids, - 'bu_index': 0 if build == build_ids[0] else -1 + 'show_rebuild_button': show_rebuild_button, } return request.render("runbot.build", context) @@ -357,4 +343,3 @@ class Runbot(Controller): context = {'pager': pager, 'builds': builds} return request.render("runbot.branch", context) - diff --git a/runbot/models/build.py b/runbot/models/build.py index b3e1b14d..29629ceb 100644 --- a/runbot/models/build.py +++ b/runbot/models/build.py @@ -49,6 +49,8 @@ class runbot_build(models.Model): committer_email = fields.Char('Committer Email') subject = fields.Text('Subject') sequence = fields.Integer('Sequence') + log_ids = fields.One2many('ir.logging', 'build_id', string='Logs') + error_log_ids = fields.One2many('ir.logging', 'build_id', domain=[('level', 'in', ['WARNING', 'ERROR', 'CRITICAL'])], string='Error Logs') # state machine diff --git a/runbot/static/src/less/runbot.less b/runbot/static/src/less/runbot.less index 5b6d1634..dbad1694 100644 --- a/runbot/static/src/less/runbot.less +++ b/runbot/static/src/less/runbot.less @@ -2,3 +2,11 @@ border-top: 2px solid #666; font-weight: bold; } + +[data-toggle="collapse"] .fa:before { + content: "\f139"; +} + +[data-toggle="collapse"].collapsed .fa:before { + content: "\f13a"; +} diff --git a/runbot/templates/build.xml b/runbot/templates/build.xml index 749e1f66..1aa8b790 100644 --- a/runbot/templates/build.xml +++ b/runbot/templates/build.xml @@ -42,7 +42,7 @@ - + @@ -66,7 +66,7 @@
  • Connect
  • - + Rebuild @@ -105,6 +105,17 @@ +