Restructure dashboard project for docker deploying
[pharos.git] / tools / pharos-dashboard / src / dashboard / templatetags / jenkins_filters.py
1 ##############################################################################
2 # Copyright (c) 2016 Max Breitenfeldt and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10
11 from django.template.defaultfilters import register
12
13
14 @register.filter
15 def jenkins_job_color(job_result):
16     if job_result == 'SUCCESS':
17         return '#5cb85c'
18     if job_result == 'FAILURE':
19         return '#d9534f'
20     if job_result == 'UNSTABLE':
21         return '#EDD62B'
22     return '#646F73'  # job is still building
23
24
25 @register.filter
26 def jenkins_status_color(slave_status):
27     if slave_status == 'offline':
28         return '#d9534f'
29     if slave_status == 'online':
30         return '#5cb85c'
31     if slave_status == 'online / idle':
32         return '#5bc0de'
33
34
35 @register.filter
36 def jenkins_job_blink(job_result):
37     if job_result == '':  # job is still building
38         return 'class=blink_me'