##// END OF EJS Templates
Task #716: Vista ABS, change_beam button is disabled if operation_mode is automatic, main abs view show current active beam...
Fiorella Quino -
r206:18de62ad8959
parent child
Show More
@@ -1,537 +1,542
1 1 {% extends "dev_conf.html" %}
2 2
3 {% load static %}
4 {% load bootstrap3 %}
5 {% load main_tags %}
6
3 7 {% block extra-menu-actions %}
4 8 <li><a href="{{ dev_conf.get_absolute_url_plot }}" target="_blank"><span class="glyphicon glyphicon-picture" aria-hidden="true"></span> View Patterns </a></li>
5 <!--<li><a href="{{ dev_conf.get_absolute_url_write }}"><span class="glyphicon glyphicon-download" aria-hidden="true"></span> Write</a></li>-->
6 9 {% endblock %}
7 10
8 11 {% block extra-content %}
9 12 <style>
10 13
11 14 .abs {
12 15 border: 2px solid #00334d;
13 16 vertical-align: center;
14 17 display: inline-block;
15 18 }
16 19 .abs tr:nth-child(1){
17 20 border-bottom: 1px dashed #00334d;
18 21 }
19 22 .abs tr{
20 23 border-bottom: 0px solid #00334d;
21 24 }
22 25 .abs td {
23 26 border-right: 1px dashed #00334d;
24 27 text-align: center;
25 28 padding: 5px;
26 29 }
27 30
28 31
29 32 .legend {
30 33 margin-left: 15px;
31 34 display: inline-block;
32 35 border: 2px solid #00334d;
33 36 vertical-align: top;
34 37 }
35 38 .legend th{
36 39 border-bottom: 1px dashed #00334d;
37 40 font-weight: bold;
38 41 vertical-align: center;
39 42 text-align: center;
40 43 }
41 44 .legend td {
42 45 padding: 2px;
43 46 text-align: center;
44 47 }
45 48
46 49
47 50 .north {
48 51 border: 2px solid #00334d;
49 52 vertical-align: center;
50 53 font-weight: bold;
51 54 }
52 55 .north tr{
53 56 border: 1px solid #ffffff;
54 57
55 58 }
56 59 .north td{
57 60 border: 2px solid #e2e2e7;
58 61 text-align: center;
59 62 padding: 1px 15px 1px 15px;
60 63 }
61 64 .north tr:nth-child(even) td:nth-child(n){
62 65 border-bottom: 12px solid #e2e2e7;
63 66 }
64 67 .north td:nth-child(n) {
65 68 border-right: 12px solid #e2e2e7;
66 69 }
67 70 .north td:nth-last-child(4n+1) {
68 71 border-right: 2px solid #e2e2e7;
69 72 }
70 73 .north tr:nth-last-child(1) td:nth-child(n){
71 74 border-bottom: 3px solid #e2e2e7;
72 75 }
73 76
74 77
75 78
76 79 .east {
77 80 border: 2px solid #00334d;
78 81 vertical-align: center;
79 82 font-weight: bold;
80 83 }
81 84 .east tr{
82 85 border: 1px solid #ffffff;
83 86 }
84 87 .east td{
85 88 border: 2px solid #e2e2e7;
86 89 text-align: center;
87 90 padding: 1px 15px 1px 15px;
88 91 }
89 92 .east tr:nth-child(even) td:nth-child(n){
90 93 border-bottom: 12px solid #e2e2e7;
91 94 }
92 95 .east td:nth-child(n) {
93 96 border-right: 12px solid #e2e2e7;
94 97 }
95 98 .east td:nth-last-child(4n+1) {
96 99 border-right: 2px solid #e2e2e7;
97 100 }
98 101 .east tr:nth-last-child(1) td:nth-child(n){
99 102 border-bottom: 3px solid #e2e2e7;
100 103 }
101 104
102 105
103 106
104 107
105 108 .west {
106 109 border: 2px solid #00334d;
107 110 vertical-align: center;
108 111 font-weight: bold;
109 112 }
110 113 .west tr{
111 114 border: 1px solid #ffffff;
112 115 }
113 116 .west td{
114 117 border: 2px solid #e2e2e7;
115 118 text-align: center;
116 119 padding: 1px 15px 1px 15px;
117 120 }
118 121 .west tr:nth-child(even) td:nth-child(n){
119 122 border-bottom: 12px solid #e2e2e7;
120 123 }
121 124 .west td:nth-child(n) {
122 125 border-right: 12px solid #e2e2e7;
123 126 }
124 127 .west td:nth-last-child(4n+1) {
125 128 border-right: 2px solid #e2e2e7;
126 129 }
127 130 .west tr:nth-last-child(1) td:nth-child(n){
128 131 border-bottom: 3px solid #e2e2e7;
129 132 }
130 133
131 134
132 135
133 136
134 137 .south {
135 138 border: 2px solid #00334d;
136 139 vertical-align: center;
137 140 font-weight: bold;
138 141 }
139 142 .south tr{
140 143 border: 1px solid #ffffff;
141 144 }
142 145 .south td{
143 146 border: 2px solid #e2e2e7;
144 147 text-align: center;
145 148 padding: 1px 15px 1px 15px;
146 149 }
147 150 .south tr:nth-child(even) td:nth-child(n){
148 151 border-bottom: 12px solid #e2e2e7;
149 152 }
150 153 .south td:nth-child(n) {
151 154 border-right: 12px solid #e2e2e7;
152 155 }
153 156 .south td:nth-last-child(4n+1) {
154 157 border-right: 2px solid #e2e2e7;
155 158 }
156 159 .south tr:nth-last-child(1) td:nth-child(n){
157 160 border-bottom: 3px solid #e2e2e7;
158 161 }
159 162
160 163
161 164
162 165
163 166 </style>
164 167
165 168
166 169 {% if beams %}
167 170
168 171
169 172
170 173 <h4>Beams:</h4>
171 174 <div class="container">
172 175 <ul class="nav nav-pills">
173 176 {% for beam in beams %}
174 <li >
177 <li {% if active_beam.id == beam.id %} class="active" {% endif %} >
175 178 <a data-toggle="pill" href="#menu{{forloop.counter}}">{{forloop.counter}}</a>
176 179 </li>
177 180 {% endfor %}
178 181 </ul>
179 182
180 183
181 184 <div class="tab-content">
182 185 <div id="home" class="tab-pane fade in active">
183 186 <!---->
184 187 {% if active_beam %}
185 188 <h3>Active Beam: {{active_beam.name}}</h3>
186 189
187 190 <table id="abs_pattern" class="abs">
188 191 <tr>
189 192 <td> <b>North Quarter</b>
190 193 <table class="north ">
191 194 <tr>
192 195 <td {{color_status.1}} title='{{module_messages.1}}'>{{active_beam.get_upvalues.0}}</td> <td {{color_status.2}} title='{{module_messages.2}}'>{{active_beam.get_upvalues.1}}</td> <td {{color_status.3}} title='{{module_messages.3}}'>{{active_beam.get_upvalues.2}}</td> <td {{color_status.4}} title='{{module_messages.4}}'>{{active_beam.get_upvalues.3}}</td>
193 196 </tr>
194 197 <tr>
195 198 <td {{color_status.1}} title='{{module_messages.1}}'>{{active_beam.get_downvalues.0}}</td> <td {{color_status.2}} title='{{module_messages.2}}'>{{active_beam.get_downvalues.1}}</td> <td {{color_status.3}} title='{{module_messages.3}}'>{{active_beam.get_downvalues.2}}</td> <td {{color_status.4}} title='{{module_messages.4}}'>{{active_beam.get_downvalues.3}}</td>
196 199 </tr>
197 200 <tr>
198 201 <td {{color_status.9}} title='{{module_messages.9}}'>{{active_beam.get_upvalues.8}}</td> <td {{color_status.10}} title='{{module_messages.10}}'>{{active_beam.get_upvalues.9}}</td> <td {{color_status.11}} title='{{module_messages.11}}'>{{active_beam.get_upvalues.10}}</td> <td {{color_status.12}} title='{{module_messages.12}}'>{{active_beam.get_upvalues.11}}</td>
199 202 </tr>
200 203 <tr>
201 204 <td {{color_status.9}} title='{{module_messages.9}}'>{{active_beam.get_downvalues.8}}</td> <td {{color_status.10}} title='{{module_messages.10}}'>{{active_beam.get_downvalues.9}}</td> <td {{color_status.11}} title='{{module_messages.11}}'>{{active_beam.get_downvalues.10}}</td> <td {{color_status.12}} title='{{module_messages.12}}'>{{active_beam.get_downvalues.11}}</td>
202 205 </tr>
203 206 <tr>
204 207 <td {{color_status.17}} title='{{module_messages.17}}'>{{active_beam.get_upvalues.16}}</td> <td {{color_status.18}} title='{{module_messages.18}}'>{{active_beam.get_upvalues.17}}</td> <td {{color_status.19}} title='{{module_messages.19}}'>{{active_beam.get_upvalues.18}}</td> <td {{color_status.20}} title='{{module_messages.20}}'>{{active_beam.get_upvalues.19}}</td>
205 208 </tr>
206 209 <tr>
207 210 <td {{color_status.17}} title='{{module_messages.17}}'>{{active_beam.get_downvalues.16}}</td> <td {{color_status.18}} title='{{module_messages.18}}'>{{active_beam.get_downvalues.17}}</td> <td {{color_status.19}} title='{{module_messages.19}}'>{{active_beam.get_downvalues.18}}</td> <td {{color_status.20}} title='{{module_messages.20}}'>{{active_beam.get_downvalues.19}}</td>
208 211 </tr>
209 212 <tr>
210 213 <td {{color_status.25}} title='{{module_messages.25}}'>{{active_beam.get_upvalues.24}}</td> <td {{color_status.26}} title='{{module_messages.26}}'>{{active_beam.get_upvalues.25}}</td> <td {{color_status.27}} title='{{module_messages.27}}'>{{active_beam.get_upvalues.26}}</td> <td {{color_status.28}} title='{{module_messages.28}}'>{{active_beam.get_upvalues.27}}</td>
211 214 </tr>
212 215 <tr>
213 216 <td {{color_status.25}} title='{{module_messages.25}}'>{{active_beam.get_downvalues.24}}</td> <td {{color_status.26}} title='{{module_messages.26}}'>{{active_beam.get_downvalues.25}}</td> <td {{color_status.27}} title='{{module_messages.27}}'>{{active_beam.get_downvalues.26}}</td> <td {{color_status.28}} title='{{module_messages.28}}'>{{active_beam.get_downvalues.27}}</td>
214 217 </tr>
215 218 </table>
216 219 </td>
217 220 <td> <b>East Quarter</b>
218 221 <table class="east ">
219 222 <tr>
220 223 <td {{color_status.5}} title='{{module_messages.5}}'>{{active_beam.get_upvalues.4}}</td> <td {{color_status.6}} title='{{module_messages.6}}'>{{active_beam.get_upvalues.5}}</td> <td {{color_status.7}} title='{{module_messages.7}}'>{{active_beam.get_upvalues.6}}</td> <td {{color_status.8}} title='{{module_messages.8}}'>{{active_beam.get_upvalues.7}}</td>
221 224 </tr>
222 225 <tr>
223 226 <td {{color_status.5}} title='{{module_messages.5}}'>{{active_beam.get_downvalues.4}}</td> <td {{color_status.6}} title='{{module_messages.6}}'>{{active_beam.get_downvalues.5}}</td> <td {{color_status.7}} title='{{module_messages.7}}'>{{active_beam.get_downvalues.6}}</td> <td {{color_status.8}} title='{{module_messages.8}}'>{{active_beam.get_downvalues.7}}</td>
224 227 </tr>
225 228 <tr>
226 229 <td {{color_status.13}} title='{{module_messages.13}}'>{{active_beam.get_upvalues.12}}</td> <td {{color_status.14}} title='{{module_messages.14}}'>{{active_beam.get_upvalues.13}}</td> <td {{color_status.15}} title='{{module_messages.15}}'>{{active_beam.get_upvalues.14}}</td> <td {{color_status.16}} title='{{module_messages.16}}'>{{active_beam.get_upvalues.15}}</td>
227 230 </tr>
228 231 <tr>
229 232 <td {{color_status.13}} title='{{module_messages.13}}'>{{active_beam.get_downvalues.12}}</td> <td {{color_status.14}} title='{{module_messages.14}}'>{{active_beam.get_downvalues.13}}</td> <td {{color_status.15}} title='{{module_messages.15}}'>{{active_beam.get_downvalues.14}}</td> <td {{color_status.16}} title='{{module_messages.16}}'>{{active_beam.get_downvalues.15}}</td>
230 233 </tr>
231 234 <tr>
232 235 <td {{color_status.21}} title='{{module_messages.21}}'>{{active_beam.get_upvalues.20}}</td> <td {{color_status.22}} title='{{module_messages.22}}'>{{active_beam.get_upvalues.21}}</td> <td {{color_status.23}} title='{{module_messages.23}}'>{{active_beam.get_upvalues.22}}</td> <td {{color_status.24}} title='{{module_messages.24}}'>{{active_beam.get_upvalues.23}}</td>
233 236 </tr>
234 237 <tr>
235 238 <td {{color_status.21}} title='{{module_messages.21}}'>{{active_beam.get_downvalues.20}}</td> <td {{color_status.22}} title='{{module_messages.22}}'>{{active_beam.get_downvalues.21}}</td> <td {{color_status.23}} title='{{module_messages.23}}'>{{active_beam.get_downvalues.22}}</td> <td {{color_status.24}} title='{{module_messages.24}}'>{{active_beam.get_downvalues.23}}</td>
236 239 </tr>
237 240 <tr>
238 241 <td {{color_status.29}} title='{{module_messages.29}}'>{{active_beam.get_upvalues.28}}</td> <td {{color_status.30}} title='{{module_messages.30}}'>{{active_beam.get_upvalues.29}}</td> <td {{color_status.31}} title='{{module_messages.31}}'>{{active_beam.get_upvalues.30}}</td> <td {{color_status.32}} title='{{module_messages.32}}'>{{active_beam.get_upvalues.31}}</td>
239 242 </tr>
240 243 <tr>
241 244 <td {{color_status.29}} title='{{module_messages.29}}'>{{active_beam.get_downvalues.28}}</td> <td {{color_status.30}} title='{{module_messages.30}}'>{{active_beam.get_downvalues.29}}</td> <td {{color_status.31}} title='{{module_messages.31}}'>{{active_beam.get_downvalues.30}}</td> <td {{color_status.32}} title='{{module_messages.32}}'>{{active_beam.get_downvalues.31}}</td>
242 245 </tr>
243 246 </table>
244 247 </td>
245 248 </tr>
246 249 <tr>
247 250 <td> <b>West Quarter</b>
248 251 <table class="west ">
249 252 <tr>
250 253 <td {{color_status.33}} title='{{module_messages.33}}'>{{active_beam.get_upvalues.32}}</td> <td {{color_status.34}} title='{{module_messages.34}}'>{{active_beam.get_upvalues.33}}</td> <td {{color_status.35}} title='{{module_messages.35}}'>{{active_beam.get_upvalues.34}}</td> <td {{color_status.36}} title='{{module_messages.36}}'>{{active_beam.get_upvalues.35}}</td>
251 254 </tr>
252 255 <tr>
253 256 <td {{color_status.33}} title='{{module_messages.33}}'>{{active_beam.get_downvalues.32}}</td> <td {{color_status.34}} title='{{module_messages.34}}'>{{active_beam.get_downvalues.33}}</td> <td {{color_status.35}} title='{{module_messages.35}}'>{{active_beam.get_downvalues.34}}</td> <td {{color_status.36}} title='{{module_messages.36}}'>{{active_beam.get_downvalues.35}}</td>
254 257 </tr>
255 258 <tr>
256 259 <td {{color_status.41}} title='{{module_messages.41}}'>{{active_beam.get_upvalues.40}}</td> <td {{color_status.42}} title='{{module_messages.42}}'>{{active_beam.get_upvalues.41}}</td> <td {{color_status.43}} title='{{module_messages.43}}'>{{active_beam.get_upvalues.42}}</td> <td {{color_status.44}} title='{{module_messages.44}}'>{{active_beam.get_upvalues.43}}</td>
257 260 </tr>
258 261 <tr>
259 262 <td {{color_status.41}} title='{{module_messages.41}}'>{{active_beam.get_downvalues.40}}</td> <td {{color_status.42}} title='{{module_messages.42}}'>{{active_beam.get_downvalues.41}}</td> <td {{color_status.43}} title='{{module_messages.43}}'>{{active_beam.get_downvalues.42}}</td> <td {{color_status.44}} title='{{module_messages.44}}'>{{active_beam.get_downvalues.43}}</td>
260 263 </tr>
261 264 <tr>
262 265 <td {{color_status.49}} title='{{module_messages.49}}'>{{active_beam.get_upvalues.48}}</td> <td {{color_status.50}} title='{{module_messages.50}}'>{{active_beam.get_upvalues.49}}</td> <td {{color_status.51}} title='{{module_messages.51}}'>{{active_beam.get_upvalues.50}}</td> <td {{color_status.52}} title='{{module_messages.52}}'>{{active_beam.get_upvalues.51}}</td>
263 266 </tr>
264 267 <tr>
265 268 <td {{color_status.49}} title='{{module_messages.49}}'>{{active_beam.get_downvalues.48}}</td> <td {{color_status.50}} title='{{module_messages.50}}'>{{active_beam.get_downvalues.49}}</td> <td {{color_status.51}} title='{{module_messages.51}}'>{{active_beam.get_downvalues.50}}</td> <td {{color_status.52}} title='{{module_messages.52}}'>{{active_beam.get_downvalues.51}}</td>
266 269 </tr>
267 270 <tr>
268 271 <td {{color_status.57}} title='{{module_messages.57}}'>{{active_beam.get_upvalues.56}}</td> <td {{color_status.58}} title='{{module_messages.58}}'>{{active_beam.get_upvalues.57}}</td> <td {{color_status.59}} title='{{module_messages.59}}'>{{active_beam.get_upvalues.58}}</td> <td {{color_status.60}} title='{{module_messages.60}}'>{{active_beam.get_upvalues.59}}</td>
269 272 </tr>
270 273 <tr>
271 274 <td {{color_status.57}} title='{{module_messages.57}}'>{{active_beam.get_downvalues.56}}</td> <td {{color_status.58}} title='{{module_messages.58}}'>{{active_beam.get_downvalues.57}}</td> <td {{color_status.59}} title='{{module_messages.59}}'>{{active_beam.get_downvalues.58}}</td> <td {{color_status.60}} title='{{module_messages.60}}'>{{active_beam.get_downvalues.59}}</td>
272 275 </tr>
273 276 </table>
274 277 </td>
275 278 <td> <b>South Quarter</b>
276 279 <table class="south ">
277 280 <tr>
278 281 <td {{color_status.37}} title='{{module_messages.37}}'>{{active_beam.get_upvalues.36}}</td> <td {{color_status.38}} title='{{module_messages.38}}'>{{active_beam.get_upvalues.37}}</td> <td {{color_status.39}} title='{{module_messages.39}}'>{{active_beam.get_upvalues.38}}</td> <td {{color_status.40}} title='{{module_messages.40}}'>{{active_beam.get_upvalues.39}}</td>
279 282 </tr>
280 283 <tr>
281 284 <td {{color_status.37}} title='{{module_messages.37}}'>{{active_beam.get_downvalues.36}}</td> <td {{color_status.38}} title='{{module_messages.38}}'>{{active_beam.get_downvalues.37}}</td> <td {{color_status.39}} title='{{module_messages.39}}'>{{active_beam.get_downvalues.38}}</td> <td {{color_status.40}} title='{{module_messages.40}}'>{{active_beam.get_downvalues.39}}</td>
282 285 </tr>
283 286 <tr>
284 287 <td {{color_status.45}} title='{{module_messages.45}}'>{{active_beam.get_upvalues.44}}</td> <td {{color_status.46}} title='{{module_messages.46}}'>{{active_beam.get_upvalues.45}}</td> <td {{color_status.47}} title='{{module_messages.47}}'>{{active_beam.get_upvalues.46}}</td> <td {{color_status.48}} title='{{module_messages.48}}'>{{active_beam.get_upvalues.47}}</td>
285 288 </tr>
286 289 <tr>
287 290 <td {{color_status.45}} title='{{module_messages.45}}'>{{active_beam.get_downvalues.44}}</td> <td {{color_status.46}} title='{{module_messages.46}}'>{{active_beam.get_downvalues.45}}</td> <td {{color_status.47}} title='{{module_messages.47}}'>{{active_beam.get_downvalues.46}}</td> <td {{color_status.48}} title='{{module_messages.48}}'>{{active_beam.get_downvalues.47}}</td>
288 291 </tr>
289 292 <tr>
290 293 <td {{color_status.53}} title='{{module_messages.53}}'>{{active_beam.get_upvalues.52}}</td> <td {{color_status.54}} title='{{module_messages.54}}'>{{active_beam.get_upvalues.53}}</td> <td {{color_status.55}} title='{{module_messages.55}}'>{{active_beam.get_upvalues.54}}</td> <td {{color_status.56}} title='{{module_messages.56}}'>{{active_beam.get_upvalues.55}}</td>
291 294 </tr>
292 295 <tr>
293 296 <td {{color_status.53}} title='{{module_messages.53}}'>{{active_beam.get_downvalues.52}}</td> <td {{color_status.54}} title='{{module_messages.54}}'>{{active_beam.get_downvalues.53}}</td> <td {{color_status.55}} title='{{module_messages.55}}'>{{active_beam.get_downvalues.54}}</td> <td {{color_status.56}} title='{{module_messages.56}}'>{{active_beam.get_downvalues.55}}</td>
294 297 </tr>
295 298 <tr>
296 299 <td {{color_status.61}} title='{{module_messages.61}}'>{{active_beam.get_upvalues.60}}</td> <td {{color_status.62}} title='{{module_messages.62}}'>{{active_beam.get_upvalues.61}}</td> <td {{color_status.63}} title='{{module_messages.63}}'>{{active_beam.get_upvalues.62}}</td> <td {{color_status.64}} title='{{module_messages.64}}'>{{active_beam.get_upvalues.63}}</td>
297 300 </tr>
298 301 <tr>
299 302 <td {{color_status.61}} title='{{module_messages.61}}'>{{active_beam.get_downvalues.60}}</td> <td {{color_status.62}} title='{{module_messages.62}}'>{{active_beam.get_downvalues.61}}</td> <td {{color_status.63}} title='{{module_messages.63}}'>{{active_beam.get_downvalues.62}}</td> <td {{color_status.64}} title='{{module_messages.64}}'>{{active_beam.get_downvalues.63}}</td>
300 303 </tr>
301 304 </table>
302 305 </td>
303 306 </tr>
304 307 </table>
305 308
306 309
307 310
308 311 <table class="legend">
309 312 <tr>
310 313 <th colspan="2">Legend</th>
311 314 </tr>
312 315 <tr>
313 316 <td class="text-danger"><i>RED</i></td><td>Disconnected</td>
314 317 </tr>
315 318 <tr>
316 319 <td class="text-warning"><i>ORANGE</i></td><td>Connected</td>
317 320 </tr>
318 321 <tr>
319 322 <td class="text-success"><i>GREEN</i></td><td>Running </td>
320 323 </tr>
321 324 <!--
322 325 <tr>
323 326 <td colspan="2">
324 327 <button style="margin: 10px;" id="sendbeam" type="button" class="btn btn-default">
325 328 <span class="glyphicon glyphicon-export" aria-hidden="true"></span>
326 329 Change Beam</button>
327 330 </td>
328 331 </tr>
329 332 -->
330 333 </table>
331 334
332 335
333 336
334 337
335 338 {% else %}
336 339 <p><i>This ABS Configuration does not have a current active ABS Beam...<br>
337 340 Please send Beam List to ABS modules. </i></p>
338 341
339 342 {% endif %}
340 343
341 344
342 345 </div>
343 346
344 347
345 348
346 349 {% for beam in beams %}
347 350 <div id="menu{{forloop.counter}}" class="tab-pane fade">
348 351 <h3>{%if active_beam.id == beam.id%}Active Beam: {%endif%}{{beam.name}}</h3>
349 352 <!--<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>-->
350 353 <table id="abs_pattern{{forloop.counter}}" class="abs">
351 354 <tr>
352 355 <td> <b>North Quarter</b>
353 356 <table class="north ">
354 357 <tr>
355 358 <td {{beam.color_status.1}} title='{{beam.module_messages.1}}'>{{beam.get_upvalues.0}}</td> <td {{beam.color_status.2}} title='{{beam.module_messages.2}}'>{{beam.get_upvalues.1}}</td> <td {{beam.color_status.3}} title='{{beam.module_messages.3}}'>{{beam.get_upvalues.2}}</td> <td {{beam.color_status.4}} title='{{beam.module_messages.4}}'>{{beam.get_upvalues.3}}</td>
356 359 </tr>
357 360 <tr>
358 361 <td {{beam.color_status.1}} title='{{beam.module_messages.1}}'>{{beam.get_downvalues.0}}</td> <td {{beam.color_status.2}} title='{{beam.module_messages.2}}'>{{beam.get_downvalues.1}}</td> <td {{beam.color_status.3}} title='{{beam.module_messages.3}}'>{{beam.get_downvalues.2}}</td> <td {{beam.color_status.4}} title='{{beam.module_messages.4}}'>{{beam.get_downvalues.3}}</td>
359 362 </tr>
360 363 <tr>
361 364 <td {{beam.color_status.9}} title='{{beam.module_messages.9}}'>{{beam.get_upvalues.8}}</td> <td {{beam.color_status.10}} title='{{beam.module_messages.10}}'>{{beam.get_upvalues.9}}</td> <td {{beam.color_status.11}} title='{{beam.module_messages.11}}'>{{beam.get_upvalues.10}}</td> <td {{beam.color_status.12}} title='{{beam.module_messages.12}}'>{{beam.get_upvalues.11}}</td>
362 365 </tr>
363 366 <tr>
364 367 <td {{beam.color_status.9}} title='{{beam.module_messages.9}}'>{{beam.get_downvalues.8}}</td> <td {{beam.color_status.10}} title='{{beam.module_messages.10}}'>{{beam.get_downvalues.9}}</td> <td {{beam.color_status.11}} title='{{beam.module_messages.11}}'>{{beam.get_downvalues.10}}</td> <td {{beam.color_status.12}} title='{{beam.module_messages.12}}'>{{beam.get_downvalues.11}}</td>
365 368 </tr>
366 369 <tr>
367 370 <td {{beam.color_status.17}} title='{{beam.module_messages.17}}'>{{beam.get_upvalues.16}}</td> <td {{beam.color_status.18}} title='{{beam.module_messages.18}}'>{{beam.get_upvalues.17}}</td> <td {{beam.color_status.19}} title='{{beam.module_messages.19}}'>{{beam.get_upvalues.18}}</td> <td {{beam.color_status.20}} title='{{beam.module_messages.20}}'>{{beam.get_upvalues.19}}</td>
368 371 </tr>
369 372 <tr>
370 373 <td {{beam.color_status.17}} title='{{beam.module_messages.17}}'>{{beam.get_downvalues.16}}</td> <td {{beam.color_status.18}} title='{{beam.module_messages.18}}'>{{beam.get_downvalues.17}}</td> <td {{beam.color_status.19}} title='{{beam.module_messages.19}}'>{{beam.get_downvalues.18}}</td> <td {{beam.color_status.20}} title='{{beam.module_messages.20}}'>{{beam.get_downvalues.19}}</td>
371 374 </tr>
372 375 <tr>
373 376 <td {{beam.color_status.25}} title='{{beam.module_messages.25}}'>{{beam.get_upvalues.24}}</td> <td {{beam.color_status.26}} title='{{beam.module_messages.26}}'>{{beam.get_upvalues.25}}</td> <td {{beam.color_status.27}} title='{{beam.module_messages.27}}'>{{beam.get_upvalues.26}}</td> <td {{beam.color_status.28}} title='{{beam.module_messages.28}}'>{{beam.get_upvalues.27}}</td>
374 377 </tr>
375 378 <tr>
376 379 <td {{beam.color_status.25}} title='{{beam.module_messages.25}}'>{{beam.get_downvalues.24}}</td> <td {{beam.color_status.26}} title='{{beam.module_messages.26}}'>{{beam.get_downvalues.25}}</td> <td {{beam.color_status.27}} title='{{beam.module_messages.27}}'>{{beam.get_downvalues.26}}</td> <td {{beam.color_status.28}} title='{{beam.module_messages.28}}'>{{beam.get_downvalues.27}}</td>
377 380 </tr>
378 381 </table>
379 382 </td>
380 383 <td> <b>East Quarter</b>
381 384 <table class="east ">
382 385 <tr>
383 386 <td {{beam.color_status.5}} title='{{beam.module_messages.5}}'>{{beam.get_upvalues.4}}</td> <td {{beam.color_status.6}} title='{{beam.module_messages.6}}'>{{beam.get_upvalues.5}}</td> <td {{beam.color_status.7}} title='{{beam.module_messages.7}}'>{{beam.get_upvalues.6}}</td> <td {{beam.color_status.8}} title='{{beam.module_messages.8}}'>{{beam.get_upvalues.7}}</td>
384 387 </tr>
385 388 <tr>
386 389 <td {{beam.color_status.5}} title='{{beam.module_messages.5}}'>{{beam.get_downvalues.4}}</td> <td {{beam.color_status.6}} title='{{beam.module_messages.6}}'>{{beam.get_downvalues.5}}</td> <td {{beam.color_status.7}} title='{{beam.module_messages.7}}'>{{beam.get_downvalues.6}}</td> <td {{beam.color_status.8}} title='{{beam.module_messages.8}}'>{{beam.get_downvalues.7}}</td>
387 390 </tr>
388 391 <tr>
389 392 <td {{beam.color_status.13}} title='{{beam.module_messages.13}}'>{{beam.get_upvalues.12}}</td> <td {{beam.color_status.14}} title='{{beam.module_messages.14}}'>{{beam.get_upvalues.13}}</td> <td {{beam.color_status.15}} title='{{beam.module_messages.15}}'>{{beam.get_upvalues.14}}</td> <td {{beam.color_status.16}} title='{{beam.module_messages.16}}'>{{beam.get_upvalues.15}}</td>
390 393 </tr>
391 394 <tr>
392 395 <td {{beam.color_status.13}} title='{{beam.module_messages.13}}'>{{beam.get_downvalues.12}}</td> <td {{beam.color_status.14}} title='{{beam.module_messages.14}}'>{{beam.get_downvalues.13}}</td> <td {{beam.color_status.15}} title='{{beam.module_messages.15}}'>{{beam.get_downvalues.14}}</td> <td {{beam.color_status.16}} title='{{beam.module_messages.16}}'>{{beam.get_downvalues.15}}</td>
393 396 </tr>
394 397 <tr>
395 398 <td {{beam.color_status.21}} title='{{beam.module_messages.21}}'>{{beam.get_upvalues.20}}</td> <td {{beam.color_status.22}} title='{{beam.module_messages.22}}'>{{beam.get_upvalues.21}}</td> <td {{beam.color_status.23}} title='{{beam.module_messages.23}}'>{{beam.get_upvalues.22}}</td> <td {{beam.color_status.24}} title='{{beam.module_messages.24}}'>{{beam.get_upvalues.23}}</td>
396 399 </tr>
397 400 <tr>
398 401 <td {{beam.color_status.21}} title='{{beam.module_messages.21}}'>{{beam.get_downvalues.20}}</td> <td {{beam.color_status.22}} title='{{beam.module_messages.22}}'>{{beam.get_downvalues.21}}</td> <td {{beam.color_status.23}} title='{{beam.module_messages.23}}'>{{beam.get_downvalues.22}}</td> <td {{beam.color_status.24}} title='{{beam.module_messages.24}}'>{{beam.get_downvalues.23}}</td>
399 402 </tr>
400 403 <tr>
401 404 <td {{beam.color_status.29}} title='{{beam.module_messages.29}}'>{{beam.get_upvalues.28}}</td> <td {{beam.color_status.30}} title='{{beam.module_messages.30}}'>{{beam.get_upvalues.29}}</td> <td {{beam.color_status.31}} title='{{beam.module_messages.31}}'>{{beam.get_upvalues.30}}</td> <td {{beam.color_status.32}} title='{{beam.module_messages.32}}'>{{beam.get_upvalues.31}}</td>
402 405 </tr>
403 406 <tr>
404 407 <td {{beam.color_status.29}} title='{{beam.module_messages.29}}'>{{beam.get_downvalues.28}}</td> <td {{beam.color_status.30}} title='{{beam.module_messages.30}}'>{{beam.get_downvalues.29}}</td> <td {{beam.color_status.31}} title='{{beam.module_messages.31}}'>{{beam.get_downvalues.30}}</td> <td {{beam.color_status.32}} title='{{beam.module_messages.32}}'>{{beam.get_downvalues.31}}</td>
405 408 </tr>
406 409 </table>
407 410 </td>
408 411 </tr>
409 412 <tr>
410 413 <td> <b>West Quarter</b>
411 414 <table class="west ">
412 415 <tr>
413 416 <td {{beam.color_status.33}} title='{{beam.module_messages.33}}'>{{beam.get_upvalues.32}}</td> <td {{beam.color_status.34}} title='{{beam.module_messages.34}}'>{{beam.get_upvalues.33}}</td> <td {{beam.color_status.35}} title='{{beam.module_messages.35}}'>{{beam.get_upvalues.34}}</td> <td {{beam.color_status.36}} title='{{beam.module_messages.36}}'>{{beam.get_upvalues.35}}</td>
414 417 </tr>
415 418 <tr>
416 419 <td {{beam.color_status.33}} title='{{beam.module_messages.33}}'>{{beam.get_downvalues.32}}</td> <td {{beam.color_status.34}} title='{{beam.module_messages.34}}'>{{beam.get_downvalues.33}}</td> <td {{beam.color_status.35}} title='{{beam.module_messages.35}}'>{{beam.get_downvalues.34}}</td> <td {{beam.color_status.36}} title='{{beam.module_messages.36}}'>{{beam.get_downvalues.35}}</td>
417 420 </tr>
418 421 <tr>
419 422 <td {{beam.color_status.41}} title='{{beam.module_messages.41}}'>{{beam.get_upvalues.40}}</td> <td {{beam.color_status.42}} title='{{beam.module_messages.42}}'>{{beam.get_upvalues.41}}</td> <td {{beam.color_status.43}} title='{{beam.module_messages.43}}'>{{beam.get_upvalues.42}}</td> <td {{beam.color_status.44}} title='{{beam.module_messages.44}}'>{{beam.get_upvalues.43}}</td>
420 423 </tr>
421 424 <tr>
422 425 <td {{beam.color_status.41}} title='{{beam.module_messages.41}}'>{{beam.get_downvalues.40}}</td> <td {{beam.color_status.42}} title='{{beam.module_messages.42}}'>{{beam.get_downvalues.41}}</td> <td {{beam.color_status.43}} title='{{beam.module_messages.43}}'>{{beam.get_downvalues.42}}</td> <td {{beam.color_status.44}} title='{{beam.module_messages.44}}'>{{beam.get_downvalues.43}}</td>
423 426 </tr>
424 427 <tr>
425 428 <td {{beam.color_status.49}} title='{{beam.module_messages.49}}'>{{beam.get_upvalues.48}}</td> <td {{beam.color_status.50}} title='{{beam.module_messages.50}}'>{{beam.get_upvalues.49}}</td> <td {{beam.color_status.51}} title='{{beam.module_messages.51}}'>{{beam.get_upvalues.50}}</td> <td {{beam.color_status.52}} title='{{beam.module_messages.52}}'>{{beam.get_upvalues.51}}</td>
426 429 </tr>
427 430 <tr>
428 431 <td {{beam.color_status.49}} title='{{beam.module_messages.49}}'>{{beam.get_downvalues.48}}</td> <td {{beam.color_status.50}} title='{{beam.module_messages.50}}'>{{beam.get_downvalues.49}}</td> <td {{beam.color_status.51}} title='{{beam.module_messages.51}}'>{{beam.get_downvalues.50}}</td> <td {{beam.color_status.52}} title='{{beam.module_messages.52}}'>{{beam.get_downvalues.51}}</td>
429 432 </tr>
430 433 <tr>
431 434 <td {{beam.color_status.57}} title='{{beam.module_messages.57}}'>{{beam.get_upvalues.56}}</td> <td {{beam.color_status.58}} title='{{beam.module_messages.58}}'>{{beam.get_upvalues.57}}</td> <td {{beam.color_status.59}} title='{{beam.module_messages.59}}'>{{beam.get_upvalues.58}}</td> <td {{beam.color_status.60}} title='{{beam.module_messages.60}}'>{{beam.get_upvalues.59}}</td>
432 435 </tr>
433 436 <tr>
434 437 <td {{beam.color_status.57}} title='{{beam.module_messages.57}}'>{{beam.get_downvalues.56}}</td> <td {{beam.color_status.58}} title='{{beam.module_messages.58}}'>{{beam.get_downvalues.57}}</td> <td {{beam.color_status.59}} title='{{beam.module_messages.59}}'>{{beam.get_downvalues.58}}</td> <td {{beam.color_status.60}} title='{{beam.module_messages.60}}'>{{beam.get_downvalues.59}}</td>
435 438 </tr>
436 439 </table>
437 440 </td>
438 441 <td> <b>South Quarter</b>
439 442 <table class="south ">
440 443 <tr>
441 444 <td {{beam.color_status.37}} title='{{beam.module_messages.37}}'>{{beam.get_upvalues.36}}</td> <td {{beam.color_status.38}} title='{{beam.module_messages.38}}'>{{beam.get_upvalues.37}}</td> <td {{beam.color_status.39}} title='{{beam.module_messages.39}}'>{{beam.get_upvalues.38}}</td> <td {{beam.color_status.40}} title='{{beam.module_messages.40}}'>{{beam.get_upvalues.39}}</td>
442 445 </tr>
443 446 <tr>
444 447 <td {{beam.color_status.37}} title='{{beam.module_messages.37}}'>{{beam.get_downvalues.36}}</td> <td {{beam.color_status.38}} title='{{beam.module_messages.38}}'>{{beam.get_downvalues.37}}</td> <td {{beam.color_status.39}} title='{{beam.module_messages.39}}'>{{beam.get_downvalues.38}}</td> <td {{beam.color_status.40}} title='{{beam.module_messages.40}}'>{{beam.get_downvalues.39}}</td>
445 448 </tr>
446 449 <tr>
447 450 <td {{beam.color_status.45}} title='{{beam.module_messages.45}}'>{{beam.get_upvalues.44}}</td> <td {{beam.color_status.46}} title='{{beam.module_messages.46}}'>{{beam.get_upvalues.45}}</td> <td {{beam.color_status.47}} title='{{beam.module_messages.47}}'>{{beam.get_upvalues.46}}</td> <td {{beam.color_status.48}} title='{{beam.module_messages.48}}'>{{beam.get_upvalues.47}}</td>
448 451 </tr>
449 452 <tr>
450 453 <td {{beam.color_status.45}} title='{{beam.module_messages.45}}'>{{beam.get_downvalues.44}}</td> <td {{beam.color_status.46}} title='{{beam.module_messages.46}}'>{{beam.get_downvalues.45}}</td> <td {{beam.color_status.47}} title='{{beam.module_messages.47}}'>{{beam.get_downvalues.46}}</td> <td {{beam.color_status.48}} title='{{beam.module_messages.48}}'>{{beam.get_downvalues.47}}</td>
451 454 </tr>
452 455 <tr>
453 456 <td {{beam.color_status.53}} title='{{beam.module_messages.53}}'>{{beam.get_upvalues.52}}</td> <td {{beam.color_status.54}} title='{{beam.module_messages.54}}'>{{beam.get_upvalues.53}}</td> <td {{beam.color_status.55}} title='{{beam.module_messages.55}}'>{{beam.get_upvalues.54}}</td> <td {{beam.color_status.56}} title='{{beam.module_messages.56}}'>{{beam.get_upvalues.55}}</td>
454 457 </tr>
455 458 <tr>
456 459 <td {{beam.color_status.53}} title='{{beam.module_messages.53}}'>{{beam.get_downvalues.52}}</td> <td {{beam.color_status.54}} title='{{beam.module_messages.54}}'>{{beam.get_downvalues.53}}</td> <td {{beam.color_status.55}} title='{{beam.module_messages.55}}'>{{beam.get_downvalues.54}}</td> <td {{beam.color_status.56}} title='{{beam.module_messages.56}}'>{{beam.get_downvalues.55}}</td>
457 460 </tr>
458 461 <tr>
459 462 <td {{beam.color_status.61}} title='{{beam.module_messages.61}}'>{{beam.get_upvalues.60}}</td> <td {{beam.color_status.62}} title='{{beam.module_messages.62}}'>{{beam.get_upvalues.61}}</td> <td {{beam.color_status.63}} title='{{beam.module_messages.63}}'>{{beam.get_upvalues.62}}</td> <td {{beam.color_status.64}} title='{{beam.module_messages.64}}'>{{beam.get_upvalues.63}}</td>
460 463 </tr>
461 464 <tr>
462 465 <td {{beam.color_status.61}} title='{{beam.module_messages.61}}'>{{beam.get_downvalues.60}}</td> <td {{beam.color_status.62}} title='{{beam.module_messages.62}}'>{{beam.get_downvalues.61}}</td> <td {{beam.color_status.63}} title='{{beam.module_messages.63}}'>{{beam.get_downvalues.62}}</td> <td {{beam.color_status.64}} title='{{beam.module_messages.64}}'>{{beam.get_downvalues.63}}</td>
463 466 </tr>
464 467 </table>
465 468 </td>
466 469 </tr>
467 470 </table>
468 471
469 472 {% if active_beam.id != beam.id %}
470 473 <div style="vertical-align: top; display:inline-block;">
471 474 <button style="" id="send_beam{{forloop.counter}}" type="button" class="btn btn-default">
472 475 <span class="glyphicon glyphicon-export" aria-hidden="true"></span>
473 476 Change Beam</button>
474 477 </div>
475 478 {% endif %}
476 479
477 480
478 481
479 482
480 483 {% if active_beam %}
481 484 {% if active_beam.id == beam.id %}
482 485 <table class="legend">
483 486 <tr>
484 487 <th colspan="2">Legend</th>
485 488 </tr>
486 489 <tr>
487 490 <td class="text-danger"><i>RED</i></td><td>Disconnected</td>
488 491 </tr>
489 492 <tr>
490 493 <td class="text-warning"><i>ORANGE</i></td><td>Connected</td>
491 494 </tr>
492 495 <tr>
493 496 <td class="text-success"><i>GREEN</i></td><td>Running
494 497 </td>
495 498 </tr>
496 499 </table>
497 500
498 501 {% endif %}
499 502 {% endif %}
500 503
501 504
502 505 </div>
503 506
504 507
505 508 {% endfor %}
506 509
507 510
508 511
509 512 </div>
510 513 </div>
511 514
512 515
516 {% else %}
517 <p style="color:#b4bcc2; margin-left: 5%;"><i>No Beams...</i></p>
518 {% endif %}
519
520 {% endblock extra-content %}
513 521
514 522
523
524 {% block extra-js%}
515 525 <script>
516 526 $(document).ready(function() {
517 527
518 528 {% for beam in beams %}
519 $("#send_beam{{forloop.counter}}").click(function() {
520 document.location = "{% url 'url_send_beam' dev_conf.id beam.id %}";
521 });
522 {%endfor%}
523
524 });
525 </script>
526
527 529
530 {% if dev_conf.operation_mode == 1 %}
531 $("#send_beam{{forloop.counter}}").prop('disabled', true)
532 {% else %}
533 $("#send_beam{{forloop.counter}}").click(function() {
534 document.location = "{% url 'url_send_beam' dev_conf.id beam.id %}";
535 });
536 {% endif %}
528 537
538 {% endfor %}
529 539
530
531
532 {% else %}
533 <p style="color:#b4bcc2; margin-left: 5%;"><i>No Beams...</i></p>
534 {% endif %}
535
536
540 });
541 </script>
537 542 {% endblock %}
@@ -1,427 +1,430
1 1 from django.shortcuts import render_to_response
2 2 from django.template import RequestContext
3 3 from django.shortcuts import redirect, render, get_object_or_404
4 4 from django.contrib import messages
5 5 from django.conf import settings
6 6 from django.http import HttpResponse
7 7 from django.core.urlresolvers import reverse
8 8
9 9 from datetime import datetime
10 10 from time import sleep
11 11 import os
12 12
13 13 from apps.main.models import Device, Configuration, Experiment
14 14 from apps.main.views import sidebar
15 15
16 16 from .models import ABSConfiguration, ABSBeam
17 17 from .forms import ABSConfigurationForm, ABSBeamEditForm, ABSBeamAddForm, ABSImportForm
18 18
19 19 from .utils.overJroShow import overJroShow
20 20 from .utils.OverJRO import OverJRO
21 21 # Create your views here.
22 22 import json, ast
23 23
24 24
25 25 def get_values_from_form(form_data):
26 26
27 27 sublistup = []
28 28 sublistdown = []
29 29 subtxlistup = []
30 30 subtxlistdown = []
31 31 subrxlistup = []
32 32 subrxlistdown = []
33 33
34 34 up_values_list = []
35 35 down_values_list = []
36 36 up_txvalues_list = []
37 37 down_txvalues_list = []
38 38 up_rxvalues_list = []
39 39 down_rxvalues_list = []
40 40
41 41 values_list = {}
42 42 cont = 1
43 43
44 44 for i in range(1,65):
45 45 x = float(form_data['abs_up'+str(i)])
46 46 y = float(form_data['abs_down'+str(i)])
47 47 sublistup.append(x)
48 48 sublistdown.append(y)
49 49
50 50 if str(i) in form_data.getlist('uptx_checks'):
51 51 subtxlistup.append(1)
52 52 else:
53 53 subtxlistup.append(0)
54 54 if str(i) in form_data.getlist('downtx_checks'):
55 55 subtxlistdown.append(1)
56 56 else:
57 57 subtxlistdown.append(0)
58 58
59 59 if str(i) in form_data.getlist('uprx_checks'):
60 60 subrxlistup.append(1)
61 61 else:
62 62 subrxlistup.append(0)
63 63 if str(i) in form_data.getlist('downrx_checks'):
64 64 subrxlistdown.append(1)
65 65 else:
66 66 subrxlistdown.append(0)
67 67
68 68 cont = cont+1
69 69
70 70 if cont == 9:
71 71 up_values_list.append(sublistup)
72 72 down_values_list.append(sublistdown)
73 73 sublistup = []
74 74 sublistdown = []
75 75
76 76 up_txvalues_list.append(subtxlistup)
77 77 down_txvalues_list.append(subtxlistdown)
78 78 subtxlistup = []
79 79 subtxlistdown = []
80 80 up_rxvalues_list.append(subrxlistup)
81 81 down_rxvalues_list.append(subrxlistdown)
82 82 subrxlistup = []
83 83 subrxlistdown = []
84 84 cont = 1
85 85
86 86
87 87 list_uesup = []
88 88 list_uesdown = []
89 89 for i in range(1,5):
90 90 if form_data['ues_up'+str(i)] == '':
91 91 list_uesup.append(0.0)
92 92 else:
93 93 list_uesup.append(float(form_data['ues_up'+str(i)]))
94 94
95 95 if form_data['ues_down'+str(i)] == '':
96 96 list_uesdown.append(0.0)
97 97 else:
98 98 list_uesdown.append(float(form_data['ues_down'+str(i)]))
99 99
100 100 onlyrx_list = form_data.getlist('onlyrx')
101 101 only_rx = {}
102 102 if '1' in onlyrx_list:
103 103 only_rx['up'] = True
104 104 else:
105 105 only_rx['up'] = False
106 106 if '2' in onlyrx_list:
107 107 only_rx['down'] = True
108 108 else:
109 109 only_rx['down'] = False
110 110
111 111 antenna = {'antenna_up': up_values_list, 'antenna_down': down_values_list}
112 112 tx = {'up': up_txvalues_list, 'down': down_txvalues_list}
113 113 rx = {'up': up_rxvalues_list, 'down': down_rxvalues_list}
114 114 ues = {'up': list_uesup, 'down': list_uesdown}
115 115 name = str(form_data['beam_name'])
116 116
117 117 beam_data = {'name': name, 'antenna': antenna, 'tx': tx, 'rx': rx, 'ues': ues, 'only_rx': only_rx}
118 118
119 119 return beam_data
120 120
121 121
122 122
123 123 def abs_conf(request, id_conf):
124 124
125 125 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
126 126 beams = ABSBeam.objects.filter(abs_conf=conf)
127 127 active_beam_id = json.loads(conf.active_beam)
128 128
129 129 #------------Colors for Active Beam:-------------
130 130 modules_status = json.loads(conf.module_status)
131 131 module_messages = json.loads(conf.module_messages)
132 132
133 133 color_status = {}
134 134 for status in modules_status:
135 135 if modules_status[status] == 3: #Running background-color: #00cc00;
136 136 color_status[status] = 'class=text-success'#'bgcolor=#00cc00'
137 137 elif modules_status[status] == 1: #Connected background-color: #ee902c;
138 138 color_status[status] = 'class=text-warning'#'bgcolor=#ee902c'
139 139 else: #Disconnected background-color: #ff0000;
140 140 color_status[status] = 'class=text-danger'#'bgcolor=#FF0000'
141 141 #------------------------------------------------
142 142
143 143 kwargs = {}
144 144 #kwargs['status'] = conf.device.get_status_display()
145 145 kwargs['connected_modules'] = str(conf.connected_modules())+'/64'
146 146
147 147 kwargs['dev_conf'] = conf
148 kwargs['dev_conf_keys'] = ['name',]
148 if conf.operation_mode == 0:
149 kwargs['dev_conf_keys'] = ['name', 'operation_mode']
150 else:
151 kwargs['dev_conf_keys'] = ['name', 'operation_mode', 'operation_value']
149 152
150 153 kwargs['title'] = 'ABS Configuration'
151 154 kwargs['suptitle'] = 'Details'
152 155 #kwargs['no_play'] = True
153 156
154 157 kwargs['button'] = 'Edit Configuration'
155 158 #------------------Active Beam-----------------------
156 159 try:
157 160 active_beam_id = active_beam_id['active_beam']
158 161 active_beam = ABSBeam.objects.get(pk=active_beam_id)
159 162 kwargs['active_beam'] = active_beam
160 163 for beam in beams:
161 164 if beam.id == active_beam.id:
162 165 beam.color_status = color_status
163 166 beam.module_messages = module_messages
164 167 except:
165 168 active_beam = ''
166 169 #----------------------------------------------------
167 170 kwargs['beams'] = beams
168 171 kwargs['modules_status'] = modules_status
169 172 kwargs['color_status'] = color_status
170 173 kwargs['module_messages'] = module_messages
171 174
172 175 #kwargs['only_stop'] = True
173 176
174 177 ###### SIDEBAR ######
175 178 kwargs.update(sidebar(conf=conf))
176 179
177 180 return render(request, 'abs_conf.html', kwargs)
178 181
179 182 def abs_conf_edit(request, id_conf):
180 183
181 184 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
182 185
183 186 beams = ABSBeam.objects.filter(abs_conf=conf)
184 187 print beams
185 188
186 189 if request.method=='GET':
187 190 form = ABSConfigurationForm(instance=conf)
188 191
189 192 if request.method=='POST':
190 193 form = ABSConfigurationForm(request.POST, instance=conf)
191 194
192 195 if form.is_valid():
193 196 conf = form.save(commit=False)
194 197 conf.save()
195 198 return redirect('url_abs_conf', id_conf=conf.id)
196 199
197 200 ###### SIDEBAR ######
198 201 kwargs = {}
199 202
200 203 kwargs['dev_conf'] = conf
201 204 #kwargs['id_dev'] = conf.id
202 205 kwargs['id_conf'] = conf.id
203 206 kwargs['form'] = form
204 207 kwargs['abs_beams'] = beams
205 208 kwargs['title'] = 'Device Configuration'
206 209 kwargs['suptitle'] = 'Edit'
207 210 kwargs['button'] = 'Save'
208 211
209 212 kwargs['edit'] = True
210 213
211 214 return render(request, 'abs_conf_edit.html', kwargs)
212 215
213 216
214 217 def import_file(request, id_conf):
215 218
216 219 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
217 220 if request.method=='POST':
218 221 form = ABSImportForm(request.POST, request.FILES)
219 222 if form.is_valid():
220 223 try:
221 224 parms = conf.import_from_file(request.FILES['file_name'])
222 225
223 226 if parms:
224 227 conf.update_from_file(parms)
225 228 messages.success(request, 'Configuration "%s" loaded succesfully' % request.FILES['file_name'])
226 229 return redirect(conf.get_absolute_url_edit())
227 230
228 231 except Exception as e:
229 232 messages.error(request, 'Error parsing file: "%s" - %s' % (request.FILES['file_name'], e))
230 233
231 234 else:
232 235 messages.warning(request, 'Your current configuration will be replaced')
233 236 form = ABSImportForm()
234 237
235 238 kwargs = {}
236 239 kwargs['form'] = form
237 240 kwargs['title'] = 'ABS Configuration'
238 241 kwargs['suptitle'] = 'Import file'
239 242 kwargs['button'] = 'Upload'
240 243 kwargs['previous'] = conf.get_absolute_url()
241 244
242 245 return render(request, 'abs_import.html', kwargs)
243 246
244 247
245 248 def send_beam(request, id_conf, id_beam):
246 249
247 250 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
248 251 beam = get_object_or_404(ABSBeam, pk=id_beam)
249 252 beams_list = ABSBeam.objects.filter(abs_conf=conf)
250 253 #To set this beam as an Active Beam
251 254 beam.set_as_activebeam()
252 255 #To send beam position to abs-modules
253 256 i = 0
254 257 for b in beams_list:
255 258 if b.id == int(id_beam):
256 259 break
257 260 else:
258 261 i += 1
259 262 beam_pos = i + 1 #Estandarizar
260 263 print 'Position: ',beam_pos
261 264 conf.send_beam_num(beam_pos)
262 265
263 266 return redirect('url_abs_conf', conf.id)
264 267
265 268
266 269 def add_beam(request, id_conf):
267 270
268 271 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
269 272 confs = Configuration.objects.all()
270 273
271 274 if request.method=='GET':
272 275 #form = ABSBeamEditForm()
273 276 form = ABSBeamAddForm()
274 277
275 278 if request.method=='POST':
276 279 form = ABSBeamAddForm(request.POST)
277 280
278 281 beam_data = get_values_from_form(request.POST)
279 282
280 283 new_beam = ABSBeam(
281 284 name =beam_data['name'],
282 285 antenna =json.dumps(beam_data['antenna']),
283 286 abs_conf=conf,
284 287 tx =json.dumps(beam_data['tx']),
285 288 rx =json.dumps(beam_data['rx']),
286 289 ues =json.dumps(beam_data['ues']),
287 290 only_rx =json.dumps(beam_data['only_rx'])
288 291 )
289 292 new_beam.save()
290 293 #---Update 6bits configuration and add beam to abs configuration beams list.
291 294 new_beam.modules_6bits()
292 295 #new_beam.add_beam2list()
293 296 messages.success(request, 'Beam: "%s" has been added.' % new_beam.name)
294 297
295 298 return redirect('url_edit_abs_conf', conf.id)
296 299
297 300 ###### SIDEBAR ######
298 301 kwargs = {}
299 302
300 303 #kwargs['dev_conf'] = conf.device
301 304 #kwargs['id_dev'] = conf.device
302 305 kwargs['id_conf'] = conf.id
303 306 kwargs['form'] = form
304 307 kwargs['title'] = 'ABS Beams'
305 308 kwargs['suptitle'] = 'Add Beam'
306 309 kwargs['button'] = 'Add'
307 310 kwargs['no_sidebar'] = True
308 311
309 312 #kwargs['previous'] = conf.get_absolute_url_edit()
310 313 kwargs['edit'] = True
311 314
312 315 return render(request, 'abs_add_beam.html', kwargs)
313 316
314 317
315 318 def edit_beam(request, id_conf, id_beam):
316 319
317 320 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
318 321 beam = get_object_or_404(ABSBeam, pk=id_beam)
319 322
320 323 if request.method=='GET':
321 324 form = ABSBeamEditForm(initial={'beam': beam})
322 325
323 326 if request.method=='POST':
324 327 form = ABSBeamEditForm(request.POST)
325 328
326 329 beam_data = get_values_from_form(request.POST)
327 330
328 331 beam.dict_to_parms(beam_data)
329 332 beam.save()
330 333
331 334 messages.success(request, 'Beam: "%s" has been updated.' % beam.name)
332 335
333 336 return redirect('url_edit_abs_conf', conf.id)
334 337
335 338 ###### SIDEBAR ######
336 339 kwargs = {}
337 340
338 341 kwargs['id_conf'] = conf.id
339 342 kwargs['form'] = form
340 343 kwargs['title'] = 'ABS Beams'
341 344 kwargs['suptitle'] = 'Edit Beam'
342 345 kwargs['button'] = 'Save'
343 346 kwargs['no_sidebar'] = True
344 347
345 348 #kwargs['previous'] = conf.get_absolute_url_edit()
346 349 kwargs['edit'] = True
347 350
348 351 return render(request, 'abs_edit_beam.html', kwargs)
349 352
350 353
351 354
352 355 def remove_beam(request, id_conf, id_beam):
353 356
354 357 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
355 358 beam = get_object_or_404(ABSBeam, pk=id_beam)
356 359
357 360 if request.method=='POST':
358 361 if beam:
359 362 try:
360 363 beam.remove_beamfromlist()
361 364 beam.delete()
362 365 messages.success(request, 'Beam: "%s" has been deleted.' % beam)
363 366 except:
364 367 messages.error(request, 'Unable to delete beam: "%s".' % beam)
365 368
366 369 return redirect('url_edit_abs_conf', conf.id)
367 370
368 371 ###### SIDEBAR ######
369 372 kwargs = {}
370 373
371 374 kwargs['object'] = beam
372 375 kwargs['delete'] = True
373 376 kwargs['title'] = 'Delete'
374 377 kwargs['suptitle'] = 'Beam'
375 378 kwargs['previous'] = conf.get_absolute_url_edit()
376 379 return render(request, 'confirm.html', kwargs)
377 380
378 381
379 382
380 383 def plot_patterns(request, id_conf, id_beam=None):
381 384
382 385 kwargs = {}
383 386 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
384 387 beams = ABSBeam.objects.filter(abs_conf=conf)
385 388
386 389 if id_beam:
387 390 beam = get_object_or_404(ABSBeam, pk=id_beam)
388 391 kwargs['beam'] = beam
389 392
390 393
391 394 ###### SIDEBAR ######
392 395
393 396 kwargs['dev_conf'] = conf.device
394 397 kwargs['id_dev'] = conf.device
395 398 kwargs['id_conf'] = conf.id
396 399 kwargs['abs_beams'] = beams
397 400 kwargs['title'] = 'ABS Patterns'
398 401 kwargs['suptitle'] = conf.name
399 402 kwargs['no_sidebar'] = True
400 403
401 404 return render(request, 'abs_patterns.html', kwargs)
402 405
403 406
404 407 def plot_pattern(request, id_conf, id_beam, antenna):
405 408
406 409 if antenna=='down':
407 410 sleep(3)
408 411
409 412 conf = get_object_or_404(ABSConfiguration, pk=id_conf)
410 413 beam = get_object_or_404(ABSBeam, pk=id_beam)
411 414
412 415 name = conf.experiment.name
413 416
414 417 just_rx = 1 if json.loads(beam.only_rx)[antenna] else 0
415 418 phases = json.loads(beam.antenna)['antenna_{}'.format(antenna)]
416 419 gain_tx = json.loads(beam.tx)[antenna]
417 420 gain_rx = json.loads(beam.rx)[antenna]
418 421 ues = json.loads(beam.ues)[antenna]
419 422
420 423 newOverJro = overJroShow(name)
421 424 fig = newOverJro.plotPattern2(datetime.today(), phases, gain_tx, gain_rx, ues, just_rx)
422 425
423 426 response=HttpResponse(content_type='image/png')
424 427
425 428 fig.canvas.print_png(response)
426 429
427 430 return response
General Comments 0
You need to be logged in to leave comments. Login now