@@ -15,7 +15,7 CONF_STATES = ( | |||||
15 |
|
15 | |||
16 | EXP_STATES = ( |
|
16 | EXP_STATES = ( | |
17 | (0,'Error'), #RED |
|
17 | (0,'Error'), #RED | |
18 |
(1,'Configur |
|
18 | (1,'Configured'), #BLUE | |
19 | (2,'Running'), #GREEN |
|
19 | (2,'Running'), #GREEN | |
20 | (3,'Waiting'), #YELLOW |
|
20 | (3,'Waiting'), #YELLOW | |
21 | (4,'Not Configured'), #WHITE |
|
21 | (4,'Not Configured'), #WHITE | |
@@ -109,6 +109,20 class Device(models.Model): | |||||
109 | def get_status(self): |
|
109 | def get_status(self): | |
110 | return self.status |
|
110 | return self.status | |
111 |
|
111 | |||
|
112 | @property | |||
|
113 | def status_color(self): | |||
|
114 | color = 'muted' | |||
|
115 | if self.status == 0: | |||
|
116 | color = "danger" | |||
|
117 | elif self.status == 1: | |||
|
118 | color = "warning" | |||
|
119 | elif self.status == 2: | |||
|
120 | color = "info" | |||
|
121 | elif self.status == 3: | |||
|
122 | color = "success" | |||
|
123 | ||||
|
124 | return color | |||
|
125 | ||||
112 | def get_absolute_url(self): |
|
126 | def get_absolute_url(self): | |
113 | return reverse('url_device', args=[str(self.id)]) |
|
127 | return reverse('url_device', args=[str(self.id)]) | |
114 |
|
128 |
@@ -62,7 +62,11 | |||||
62 | <tr class="clickable-row" data-href="{{item.get_absolute_url}}"> |
|
62 | <tr class="clickable-row" data-href="{{item.get_absolute_url}}"> | |
63 | <td>{{ forloop.counter }}</td> |
|
63 | <td>{{ forloop.counter }}</td> | |
64 | {% for key in configuration_keys %} |
|
64 | {% for key in configuration_keys %} | |
65 | <td>{{ item|value:key }}</td> |
|
65 | {% if key == 'device__status' %} | |
|
66 | <td class="text-{{item.device.status_color}}">{{ item|value:key }}</td> | |||
|
67 | {% else %} | |||
|
68 | <td>{{ item|value:key }}</td> | |||
|
69 | {% endif %} | |||
66 | {% endfor %} |
|
70 | {% endfor %} | |
67 | </tr> |
|
71 | </tr> | |
68 | {% endfor %} |
|
72 | {% endfor %} |
@@ -495,7 +495,7 def experiment(request, id_exp): | |||||
495 | kwargs['experiment_keys'] = ['template', 'radar', 'name', 'start_time', 'end_time'] |
|
495 | kwargs['experiment_keys'] = ['template', 'radar', 'name', 'start_time', 'end_time'] | |
496 | kwargs['experiment'] = experiment |
|
496 | kwargs['experiment'] = experiment | |
497 |
|
497 | |||
498 | kwargs['configuration_keys'] = ['name', 'device__device_type', 'device__ip_address', 'device__port_address'] |
|
498 | kwargs['configuration_keys'] = ['name', 'device__device_type', 'device__ip_address', 'device__port_address', 'device__status'] | |
499 | kwargs['configurations'] = configurations |
|
499 | kwargs['configurations'] = configurations | |
500 |
|
500 | |||
501 | kwargs['title'] = 'Experiment' |
|
501 | kwargs['title'] = 'Experiment' |
General Comments 0
You need to be logged in to leave comments.
Login now