[IMP] runbot: show state in favicon
Until now the favicon was handled by the `/favicon.ico` route made available by `website`. This commit adds the different favicons and logic to be able to display the state of the current page through it.
@ -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),
|
||||
|
@ -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
|
||||
|
BIN
runbot/static/src/img/icon_killed.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
8
runbot/static/src/img/icon_killed.svg
Normal file
@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<path id="background" style="fill: #ced4da;" d="M0 0 L512 0 L512 512 L0 512"/>
|
||||
<!-- Font Awesome Free 5.15.4 by
|
||||
@fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC
|
||||
BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
|
||||
<path id="icon" style="fill: #212529; transform: scale(0.67); transform-origin: center"
|
||||
d="M256 8C119.034 8 8 119.033 8 256s111.034 248 248 248 248-111.034 248-248S392.967 8 256 8zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676zM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 776 B |
BIN
runbot/static/src/img/icon_ko.png
Normal file
After Width: | Height: | Size: 1002 B |
8
runbot/static/src/img/icon_ko.svg
Normal file
@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<path id="background" style="fill: #f2dede;" d="M0 0 L512 0 L512 512 L0 512" />
|
||||
<!-- Font Awesome Free 5.15.4 by
|
||||
@fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC
|
||||
BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
|
||||
<path id="icon" style="fill: #dc3545; transform: scale(0.67); transform-origin: center;"
|
||||
d="M0 56v240c0 13.255 10.745 24 24 24h80c13.255 0 24-10.745 24-24V56c0-13.255-10.745-24-24-24H24C10.745 32 0 42.745 0 56zm40 200c0-13.255 10.745-24 24-24s24 10.745 24 24-10.745 24-24 24-24-10.745-24-24zm272 256c-20.183 0-29.485-39.293-33.931-57.795-5.206-21.666-10.589-44.07-25.393-58.902-32.469-32.524-49.503-73.967-89.117-113.111a11.98 11.98 0 0 1-3.558-8.521V59.901c0-6.541 5.243-11.878 11.783-11.998 15.831-.29 36.694-9.079 52.651-16.178C256.189 17.598 295.709.017 343.995 0h2.844c42.777 0 93.363.413 113.774 29.737 8.392 12.057 10.446 27.034 6.148 44.632 16.312 17.053 25.063 48.863 16.382 74.757 17.544 23.432 19.143 56.132 9.308 79.469l.11.11c11.893 11.949 19.523 31.259 19.439 49.197-.156 30.352-26.157 58.098-59.553 58.098H350.723C358.03 364.34 384 388.132 384 430.548 384 504 336 512 312 512z" />
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
BIN
runbot/static/src/img/icon_ok.png
Normal file
After Width: | Height: | Size: 1012 B |
8
runbot/static/src/img/icon_ok.svg
Normal file
@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<path id="background" style="fill: #dff0d8;" d="M0 0 L512 0 L512 512 L0 512"/>
|
||||
<!-- Font Awesome Free 5.15.4 by
|
||||
@fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC
|
||||
BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
|
||||
<path id="icon" style="fill: #30703a; transform: scale(0.67); transform-origin: center;"
|
||||
d="M104 224H24c-13.255 0-24 10.745-24 24v240c0 13.255 10.745 24 24 24h80c13.255 0 24-10.745 24-24V248c0-13.255-10.745-24-24-24zM64 472c-13.255 0-24-10.745-24-24s10.745-24 24-24 24 10.745 24 24-10.745 24-24 24zM384 81.452c0 42.416-25.97 66.208-33.277 94.548h101.723c33.397 0 59.397 27.746 59.553 58.098.084 17.938-7.546 37.249-19.439 49.197l-.11.11c9.836 23.337 8.237 56.037-9.308 79.469 8.681 25.895-.069 57.704-16.382 74.757 4.298 17.598 2.244 32.575-6.148 44.632C440.202 511.587 389.616 512 346.839 512l-2.845-.001c-48.287-.017-87.806-17.598-119.56-31.725-15.957-7.099-36.821-15.887-52.651-16.178-6.54-.12-11.783-5.457-11.783-11.998v-213.77c0-3.2 1.282-6.271 3.558-8.521 39.614-39.144 56.648-80.587 89.117-113.111 14.804-14.832 20.188-37.236 25.393-58.902C282.515 39.293 291.817 0 312 0c24 0 72 8 72 81.452z" />
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
BIN
runbot/static/src/img/icon_skipped.png
Normal file
After Width: | Height: | Size: 1012 B |
8
runbot/static/src/img/icon_skipped.svg
Normal file
@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<path id="background" style="fill: #ced4da;" d="M0 0 L512 0 L512 512 L0 512"/>
|
||||
<!-- Font Awesome Free 5.15.4 by
|
||||
@fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC
|
||||
BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
|
||||
<path id="icon" style="fill: #212529; transform: scale(0.67); transform-origin: center"
|
||||
d="M512 76v360c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12V284.1L276.5 440.6c-20.6 17.2-52.5 2.8-52.5-24.6V284.1L52.5 440.6C31.9 457.8 0 443.4 0 416V96c0-27.4 31.9-41.7 52.5-24.6L224 226.8V96c0-27.4 31.9-41.7 52.5-24.6L448 226.8V76c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12z" />
|
||||
</svg>
|
After Width: | Height: | Size: 723 B |
BIN
runbot/static/src/img/icon_warn.png
Normal file
After Width: | Height: | Size: 1016 B |
8
runbot/static/src/img/icon_warn.svg
Normal file
@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 576">
|
||||
<path id="background" style="fill: #fff9e6;" d="M0 0 L576 0 L576 576 L0 576"/>
|
||||
<!-- Font Awesome Free 5.15.4 by
|
||||
@fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC
|
||||
BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
|
||||
<path id="icon" style="fill: #ffc107; transform: scale(0.67); transform-origin: center;"
|
||||
d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z" />
|
||||
</svg>
|
After Width: | Height: | Size: 903 B |
@ -19,6 +19,26 @@
|
||||
<meta http-equiv="refresh" t-att-content="refresh"/>
|
||||
</t>
|
||||
|
||||
<t t-if="not page_info_state or page_info_state == 'ok' or page_info_state not in ('warn', 'ko', 'skipped', 'killed', 'manually_killed')">
|
||||
<link rel="icon" type="image/png" href="/runbot/static/src/img/icon_ok.png"/>
|
||||
<link rel="icon" type="image/svg+xml" href="/runbot/static/src/img/icon_ok.svg"/>
|
||||
</t>
|
||||
<t t-elif="page_info_state == 'ko'">
|
||||
<link rel="icon" type="image/png" href="/runbot/static/src/img/icon_ko.png"/>
|
||||
<link rel="icon" type="image/svg+xml" href="/runbot/static/src/img/icon_ko.svg"/>
|
||||
</t>
|
||||
<t t-elif="page_info_state == 'warn'">
|
||||
<link rel="icon" type="image/png" href="/runbot/static/src/img/icon_warn.png"/>
|
||||
<link rel="icon" type="image/svg+xml" href="/runbot/static/src/img/icon_warn.svg"/>
|
||||
</t>
|
||||
<t t-elif="page_info_state == 'skipped'">
|
||||
<link rel="icon" type="image/png" href="/runbot/static/src/img/icon_skipped.png"/>
|
||||
<link rel="icon" type="image/svg+xml" href="/runbot/static/src/img/icon_skipped.svg"/>
|
||||
</t>
|
||||
<t t-elif="page_info_state == 'killed' or page_info_state == 'manually_killed'">
|
||||
<link rel="icon" type="image/png" href="/runbot/static/src/img/icon_killed.png"/>
|
||||
<link rel="icon" type="image/svg+xml" href="/runbot/static/src/img/icon_killed.svg"/>
|
||||
</t>
|
||||
</head>
|
||||
<body>
|
||||
<t t-out="0"/>
|
||||
|