mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-14 22:45:47 +00:00
styling (again)
This commit is contained in:
@ -39,6 +39,21 @@ class BuildStatusEnum(Enum):
|
||||
Failed = 'failed'
|
||||
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:
|
||||
'''
|
||||
|
@ -36,7 +36,7 @@ class IndexView(BaseView):
|
||||
packages - sorted list of packages properties: base, packages (sorted list), status,
|
||||
timestamp, version, web_url. 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
|
||||
'''
|
||||
|
||||
@ -59,6 +59,7 @@ class IndexView(BaseView):
|
||||
]
|
||||
service = {
|
||||
'status': self.service.status.status.value,
|
||||
'status_color': self.service.status.status.badges_color(),
|
||||
'timestamp': self.service.status.timestamp
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user