styling (again)

This commit is contained in:
Evgenii Alekseev 2021-03-15 22:50:58 +03:00
parent a288986450
commit f35278e978
5 changed files with 30 additions and 8 deletions

View File

@ -23,7 +23,7 @@ optdepends=('aws-cli: sync to s3'
source=("https://github.com/arcan1s/ahriman/releases/download/$pkgver/$pkgname-$pkgver-src.tar.xz" source=("https://github.com/arcan1s/ahriman/releases/download/$pkgver/$pkgname-$pkgver-src.tar.xz"
'ahriman.sysusers' 'ahriman.sysusers'
'ahriman.tmpfiles') 'ahriman.tmpfiles')
sha512sums=('1af6c022bb1cf3bb55cb3ba426673ee73f98bd1a4de2191033a2d09bd73c6afb10c2a14ac3c70daa6ecbf7a62385178005f5276ee6a9942dc295d7c49d7ed412' sha512sums=('119520b7791bf231cfbe0de9f0a2611ff8c3c692e20c60c31b15cd0b0bcfe35a8b527f3003314d51a4af52a5f5e0b6f3b89bcc41c3b8127e2e812d657c505627'
'13718afec2c6786a18f0b223ef8e58dccf0688bca4cdbe203f14071f5031ed20120eb0ce38b52c76cfd6e8b6581a9c9eaa2743eb11abbaca637451a84c33f075' '13718afec2c6786a18f0b223ef8e58dccf0688bca4cdbe203f14071f5031ed20120eb0ce38b52c76cfd6e8b6581a9c9eaa2743eb11abbaca637451a84c33f075'
'55b20f6da3d66e7bbf2add5d95a3b60632df121717d25a993e56e737d14f51fe063eb6f1b38bd81cc32e05db01c0c1d80aaa720c45cde87f238d8b46cdb8cbc4') '55b20f6da3d66e7bbf2add5d95a3b60632df121717d25a993e56e737d14f51fe063eb6f1b38bd81cc32e05db01c0c1d80aaa720c45cde87f238d8b46cdb8cbc4')
backup=('etc/ahriman.ini' backup=('etc/ahriman.ini'

View File

@ -11,7 +11,11 @@
<body> <body>
<div class="root"> <div class="root">
<h1>ahriman {{ version|e }} ({{ architecture|e }})</h1> <h1>ahriman
<img src="https://img.shields.io/badge/version-{{ version|e }}-informational" alt="{{ version|e }}">
<img src="https://img.shields.io/badge/architecture-{{ architecture|e }}-informational" alt="{{ architecture|e }}">
<img src="https://img.shields.io/badge/service%20status-{{ service.status|e }}-{{ service.status_color|e }}" alt="{{ service.status|e }}" title="{{ service.timestamp|e }}">
</h1>
{% include "search-line.jinja2" %} {% include "search-line.jinja2" %}
@ -39,8 +43,6 @@
<footer> <footer>
<ul class="navigation"> <ul class="navigation">
<li class="status" style="text-align: left; padding-right: 32px;">Service status</li>
<li class="status service-{{ service.status|e }}" title="last update at {{ service.timestamp|e }}">{{ service.status|e }}</li>
<li><a href="https://github.com/arcan1s/ahriman" title="sources">ahriman</a></li> <li><a href="https://github.com/arcan1s/ahriman" title="sources">ahriman</a></li>
<li><a href="https://github.com/arcan1s/ahriman/releases" title="releases list">releases</a></li> <li><a href="https://github.com/arcan1s/ahriman/releases" title="releases list">releases</a></li>
<li><a href="https://github.com/arcan1s/ahriman/issues" title="issues tracker">report a bug</a></li> <li><a href="https://github.com/arcan1s/ahriman/issues" title="issues tracker">report a bug</a></li>

View File

@ -46,9 +46,13 @@
</table> </table>
</section> </section>
{% if homepage is not none %} <footer>
<footer><a href="{{ homepage|e }}" title="homepage">Homepage</a></footer> <ul class="navigation">
{% endif %} {% if homepage is not none %}
<li><a href="{{ homepage|e }}" title="homepage">Homepage</a></li>
{% endif %}
</ul>
</footer>
</div> </div>
</body> </body>
</html> </html>

View File

@ -39,6 +39,21 @@ class BuildStatusEnum(Enum):
Failed = 'failed' Failed = 'failed'
Success = 'success' Success = 'success'
def badges_color(self) -> str:
'''
convert itself to shield.io badges color
:return: shields.io color
'''
if self == BuildStatusEnum.Pending:
return 'yellow'
elif self == BuildStatusEnum.Building:
return 'yellow'
elif self == BuildStatusEnum.Failed:
return 'critical'
elif self == BuildStatusEnum.Success:
return 'success'
return 'inactive'
class BuildStatus: class BuildStatus:
''' '''

View File

@ -36,7 +36,7 @@ class IndexView(BaseView):
packages - sorted list of packages properties: base, packages (sorted list), status, packages - sorted list of packages properties: base, packages (sorted list), status,
timestamp, version, web_url. Required timestamp, version, web_url. Required
repository - repository name, string, required repository - repository name, string, required
service - service status properties: status, timestamp. Required service - service status properties: status, status_color, timestamp. Required
version - ahriman version, string, required version - ahriman version, string, required
''' '''
@ -59,6 +59,7 @@ class IndexView(BaseView):
] ]
service = { service = {
'status': self.service.status.status.value, 'status': self.service.status.status.value,
'status_color': self.service.status.status.badges_color(),
'timestamp': self.service.status.timestamp 'timestamp': self.service.status.timestamp
} }