diff --git a/runbot/controllers/frontend.py b/runbot/controllers/frontend.py index eada071d..af0ae038 100644 --- a/runbot/controllers/frontend.py +++ b/runbot/controllers/frontend.py @@ -64,6 +64,8 @@ def route(routes, **kw): response.qcontext['nb_build_errors'] = nb_build_errors response.qcontext['nb_assigned_errors'] = nb_assigned_errors response.qcontext['nb_team_errors'] = nb_team_errors + if 'page_info_state' not in response.qcontext: + response.qcontext['page_info_state'] = 'ok' return response return response_wrap return decorator @@ -215,6 +217,7 @@ class Runbot(Controller): 'pager': pager, 'project': bundle.project_id, 'title': 'Bundle %s' % bundle.name, + 'page_info_state': bundle.last_batch._get_global_result(), } return request.render('runbot.bundle', context) @@ -239,7 +242,8 @@ class Runbot(Controller): context = { 'batch': batch, 'project': batch.bundle_id.project_id, - 'title': 'Batch %s (%s)' % (batch.id, batch.bundle_id.name) + 'title': 'Batch %s (%s)' % (batch.id, batch.bundle_id.name), + 'page_info_state': batch._get_global_result(), } return request.render('runbot.batch', context) @@ -330,6 +334,7 @@ class Runbot(Controller): 'project': build.params_id.trigger_id.project_id, 'title': 'Build %s' % build.id, 'siblings': siblings, + 'page_info_state': build.global_result, # following logic is not the most efficient but good enough 'prev_ko': next((b for b in reversed(siblings) if b.id < build.id and b.global_result != 'ok'), Build), 'prev_bu': next((b for b in reversed(siblings) if b.id < build.id), Build), diff --git a/runbot/models/batch.py b/runbot/models/batch.py index 5df699d5..22a5a754 100644 --- a/runbot/models/batch.py +++ b/runbot/models/batch.py @@ -57,6 +57,16 @@ class Batch(models.Model): def _get_formated_age(self): return s2human_long(self.age) + def _get_global_result(self): + """Returns the worst result from the related builds and logs""" + self.ensure_one() + batch_result = 'warn' if any(log.level != 'INFO' for log in self.log_ids) else 'ok' + if self.state == 'skipped': + batch_result = 'skipped' + return self.env['runbot.build']._get_worst_result([ + batch_result, *self.slot_ids.build_id.mapped('global_result'), + ]) + def _url(self): self.ensure_one() return "/runbot/batch/%s" % self.id diff --git a/runbot/static/src/img/icon_killed.png b/runbot/static/src/img/icon_killed.png new file mode 100644 index 00000000..fb70bc3f Binary files /dev/null and b/runbot/static/src/img/icon_killed.png differ diff --git a/runbot/static/src/img/icon_killed.svg b/runbot/static/src/img/icon_killed.svg new file mode 100644 index 00000000..b86fc336 --- /dev/null +++ b/runbot/static/src/img/icon_killed.svg @@ -0,0 +1,8 @@ + + + + + diff --git a/runbot/static/src/img/icon_ko.png b/runbot/static/src/img/icon_ko.png new file mode 100644 index 00000000..7268fdd7 Binary files /dev/null and b/runbot/static/src/img/icon_ko.png differ diff --git a/runbot/static/src/img/icon_ko.svg b/runbot/static/src/img/icon_ko.svg new file mode 100644 index 00000000..d6dd181d --- /dev/null +++ b/runbot/static/src/img/icon_ko.svg @@ -0,0 +1,8 @@ + + + + + diff --git a/runbot/static/src/img/icon_ok.png b/runbot/static/src/img/icon_ok.png new file mode 100644 index 00000000..971d0bf8 Binary files /dev/null and b/runbot/static/src/img/icon_ok.png differ diff --git a/runbot/static/src/img/icon_ok.svg b/runbot/static/src/img/icon_ok.svg new file mode 100644 index 00000000..e11c0a16 --- /dev/null +++ b/runbot/static/src/img/icon_ok.svg @@ -0,0 +1,8 @@ + + + + + diff --git a/runbot/static/src/img/icon_skipped.png b/runbot/static/src/img/icon_skipped.png new file mode 100644 index 00000000..a21e8930 Binary files /dev/null and b/runbot/static/src/img/icon_skipped.png differ diff --git a/runbot/static/src/img/icon_skipped.svg b/runbot/static/src/img/icon_skipped.svg new file mode 100644 index 00000000..392c9841 --- /dev/null +++ b/runbot/static/src/img/icon_skipped.svg @@ -0,0 +1,8 @@ + + + + + diff --git a/runbot/static/src/img/icon_warn.png b/runbot/static/src/img/icon_warn.png new file mode 100644 index 00000000..8f091682 Binary files /dev/null and b/runbot/static/src/img/icon_warn.png differ diff --git a/runbot/static/src/img/icon_warn.svg b/runbot/static/src/img/icon_warn.svg new file mode 100644 index 00000000..9074f5f3 --- /dev/null +++ b/runbot/static/src/img/icon_warn.svg @@ -0,0 +1,8 @@ + + + + + diff --git a/runbot/templates/utils.xml b/runbot/templates/utils.xml index 33acd1aa..ad48381c 100644 --- a/runbot/templates/utils.xml +++ b/runbot/templates/utils.xml @@ -19,6 +19,26 @@ + + + + + + + + + + + + + + + + + + + +