Commit d5a794dd817a30f208e39015fd0f05415ebc1bdb
Exists in
dev
Merge branch 'dev' of https://gitlab.irap.omp.eu/epallier/pyros into dev
Showing
7 changed files
with
509 additions
and
12 deletions
Show diff stats
src/dashboard/templates/dashboard/observation_status.html
... | ... | @@ -96,6 +96,14 @@ |
96 | 96 | overflow: scroll; |
97 | 97 | background-color: black; |
98 | 98 | } |
99 | + | |
100 | + #send_command_tel | |
101 | + { | |
102 | + margin: auto; | |
103 | + display: block; | |
104 | + color: blue; | |
105 | + } | |
106 | + | |
99 | 107 | </style> |
100 | 108 | <div class="element" id=Telescope> |
101 | 109 | <h2><button id="Telescope_button">TELESCOPE</button></h2> |
... | ... | @@ -104,6 +112,11 @@ |
104 | 112 | {% for log in object.cagire_logs.all %} |
105 | 113 | <li>{{log.created}} : {{log.message}}</li> {% endfor %} |
106 | 114 | </ul> |
115 | + {% if not config.global_mode %} | |
116 | + <form action={% url "send_command_to_telescope" %}> | |
117 | + <input id="send_command_tel" type="submit" value="Send Command" /> | |
118 | + </form> | |
119 | + {% endif %} | |
107 | 120 | |
108 | 121 | </div> |
109 | 122 | <div class="element" id=Cagire> |
... | ... | @@ -121,7 +134,6 @@ |
121 | 134 | {% for log in ddrago_r_logs %} |
122 | 135 | <li>{{log.created}} : {{log.message}}</li> {% endfor %} |
123 | 136 | </ul> |
124 | - | |
125 | 137 | </div> |
126 | 138 | <div class="element" id=DDRAGOBLUE> |
127 | 139 | <h2><button id="ddrago_b_button">DDRAGO BLUE</button></h2> | ... | ... |
src/dashboard/templates/dashboard/send_command_telescope.html
0 → 100644
... | ... | @@ -0,0 +1,251 @@ |
1 | +{% extends "base.html" %} | |
2 | +{% load staticfiles%} | |
3 | + | |
4 | +{% block title %} | |
5 | + Send Command to Telescope | |
6 | +{% endblock %} | |
7 | + | |
8 | +{% block content %} | |
9 | +<html lang="en"> | |
10 | +<head> | |
11 | + <meta charset="UTF-8"> | |
12 | + | |
13 | +</head> | |
14 | +<body> | |
15 | + <style> | |
16 | + | |
17 | + .conteneur | |
18 | + { | |
19 | + display: flex; | |
20 | + flex-wrap: wrap-reverse; | |
21 | + justify-content: space-between; | |
22 | + } | |
23 | + .element | |
24 | + { | |
25 | + | |
26 | + margin: auto; | |
27 | + list-style-image: none; | |
28 | + font-family: 'Montserra', sans-serif; | |
29 | + | |
30 | + } | |
31 | + | |
32 | + .element h2 | |
33 | + { | |
34 | + text-align: center; | |
35 | + font-weight: normal; | |
36 | + } | |
37 | + .log | |
38 | + { | |
39 | + font-size: 1.13em; | |
40 | + list-style-image: none; | |
41 | + list-style-type: none; | |
42 | + color: green; | |
43 | + font-weight: bold; | |
44 | + font-family: "Arial"; | |
45 | + height: 500px; | |
46 | + width: 650px; | |
47 | + overflow: scroll; | |
48 | + background-color: black; | |
49 | + } | |
50 | + | |
51 | + #commande | |
52 | + { | |
53 | + font-size: 25px; | |
54 | + } | |
55 | + | |
56 | + | |
57 | + #submit_button | |
58 | + { | |
59 | + display: block; | |
60 | + font-size: 20px; | |
61 | + margin: auto; | |
62 | + } | |
63 | + #expert_mode | |
64 | + { | |
65 | + font-size: 15px; | |
66 | + } | |
67 | +</style> | |
68 | + | |
69 | + <!-- TODO:Passer aux django forms une fois que la grammaire sera fixée --> | |
70 | + | |
71 | + <div class="conteneur"> | |
72 | + <div id="command" class="element"> | |
73 | + <form id=command_form method="POST" action={% url "submit_command_to_telescope" %}> | |
74 | + | |
75 | + <label for="Command"><h2>Select the command</h2></label><br/> | |
76 | + | |
77 | + <select name="comande" id="commande"> | |
78 | + <option value="Command">Command :</option> | |
79 | + <option value="SET">SET</option> | |
80 | + <option value="GET">GET</option> | |
81 | + <option value="DO">DO</option> | |
82 | + </select> | |
83 | + | |
84 | + </form> | |
85 | + <br><br> | |
86 | + <form id="command_form_expert" method="POST" action="{% url "submit_command_to_telescope_expert" %}"> | |
87 | + <label for="Command"><h2>Enter the command in expert mode</h2></label><br/> | |
88 | + <button id="expert_mode" type="button">Expert Mode</button> | |
89 | + {% csrf_token %} | |
90 | + </form> | |
91 | + </div> | |
92 | + <div id="logs" class="element"> | |
93 | + <div id=tele> | |
94 | + <h2>TELESCOPE</h2> | |
95 | + <ul class="log" id="telescope_logs"> | |
96 | + <br> | |
97 | + </ul> | |
98 | + </div> | |
99 | + </div> | |
100 | + </div> | |
101 | + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | |
102 | + <script src="{% static "/js/command_control.js" %}" type=text/javascript></script> | |
103 | + <script> | |
104 | + $( "#command_form" ).submit(function( event ) { | |
105 | + alert( "Handler for .submit() called." ); | |
106 | + event.preventDefault(); | |
107 | + var inputElem = document.createElement('input'); | |
108 | + inputElem.type = 'hidden'; | |
109 | + inputElem.name = 'csrfmiddlewaretoken'; | |
110 | + inputElem.value = '{{ csrf_token }}'; | |
111 | + | |
112 | + document.getElementById("command_form").appendChild(inputElem); | |
113 | + $( "#command_form" ).submit(); | |
114 | +}); | |
115 | + | |
116 | + | |
117 | + </script> | |
118 | + <!-- <script> | |
119 | + var LOGS_REFRESH_FREQUENCE = 2000; //in milliseconds | |
120 | + | |
121 | + jQuery(document).ready(function(){ | |
122 | + | |
123 | + function command_set() | |
124 | + { | |
125 | + var form = $("#command_form"); | |
126 | + var arr = [ | |
127 | + {val : "COORDS_FRAME", text: 'COORDS_FRAME'}, | |
128 | + {val : 'FOCUS', text: 'FOCUS'}, | |
129 | + {val : 'ROTATOR', text: 'ROTATOR'}, | |
130 | + {val : 'MOVE_MODE', text: 'MOVE_MODE'} | |
131 | + ]; | |
132 | + | |
133 | + var sel = $('<select>', {id:"param1"}).appendTo('#command_form'); | |
134 | + $(arr).each(function() { | |
135 | + sel.append($("<option>").attr('value',this.val).text(this.text)); | |
136 | + sel.css("font-size", "25px"); | |
137 | + }); | |
138 | + | |
139 | + var arr = [ | |
140 | + {val: "Hadec", text: 'Hadec'}, | |
141 | + {val: 'Radec', text: 'Radec'}, | |
142 | + {val: 'Altaz', text: 'Altaz'} | |
143 | + ]; | |
144 | + var type = '<select>'; | |
145 | + | |
146 | + var sel = $(type, {id:"param2"}).appendTo('#command_form'); | |
147 | + $(arr).each(function() { | |
148 | + sel.append($("<option>").attr('value',this.val).text(this.text)); | |
149 | + sel.css("font-size", "25px"); | |
150 | + }); | |
151 | + | |
152 | + $("#param1").change(function () { | |
153 | + var length = form.children().length; | |
154 | + for (var i = 4; i < length; i++) { | |
155 | + $("#command_form").children().last().remove(); | |
156 | + } | |
157 | + | |
158 | + if ($("#param1").find(":selected").text() === "ROTATOR") { | |
159 | + var arr = [ | |
160 | + {val: "NONE", text: 'NONE'}, | |
161 | + {val: 'SYNCHRO', text: 'SYNCHRO'}, | |
162 | + {val: 'TRACKING', text: 'TRACKING'} | |
163 | + ]; | |
164 | + } | |
165 | + | |
166 | + else if ($("#param1").find(":selected").text() === "MOVE_MODE") { | |
167 | + var arr = [ | |
168 | + {val: "Goto", text: 'Goto'}, | |
169 | + {val: 'Track', text: 'Track'}, | |
170 | + {val: 'GotoTrack', text: 'GotoTrack'} | |
171 | + ]; | |
172 | + } | |
173 | + else if ($("#param1").find(":selected").text() === "COORDS_FRAME") { | |
174 | + var arr = [ | |
175 | + {val: "Hadec", text: 'Hadec'}, | |
176 | + {val: 'Radec', text: 'Radec'}, | |
177 | + {val: 'Altaz', text: 'Altaz'} | |
178 | + ]; | |
179 | + } | |
180 | + | |
181 | + var type = '<select>'; | |
182 | + if ($("#param1").find(":selected").text() === "FOCUS") | |
183 | + type = "<input type='number' step='any' />"; | |
184 | + | |
185 | + var sel = $(type, {id:"param2"}).appendTo('#command_form'); | |
186 | + $(arr).each(function() { | |
187 | + sel.append($("<option>").attr('value',this.val).text(this.text)); | |
188 | + sel.css("font-size", "25px"); | |
189 | + }); | |
190 | + | |
191 | + }); | |
192 | + } | |
193 | + | |
194 | + | |
195 | + $("#commande").change(function() { | |
196 | + | |
197 | + var form = $("#command_form"); | |
198 | + var length = form.children().length; | |
199 | + | |
200 | + for (var i = 3; i < length; i++) { | |
201 | + form.children().last().remove(); | |
202 | + } | |
203 | + | |
204 | + if ($("#commande").find(":selected").val() === "SET") | |
205 | + command_set(); | |
206 | + | |
207 | + | |
208 | + }); | |
209 | + //$("#command_form").append(param1); | |
210 | + | |
211 | + | |
212 | + | |
213 | + | |
214 | + | |
215 | + interval_telescope = setInterval(function() {ajax_request("telescope", "telescope_list");}, LOGS_REFRESH_FREQUENCE); | |
216 | + | |
217 | + function ajax_request(){ | |
218 | + var telescope_url ="/devices/update_telescope_logs"; | |
219 | + $.ajax({ | |
220 | + url: telescope_url, | |
221 | + type: 'get', | |
222 | + dataType: 'text', | |
223 | + success: function(data) | |
224 | + { | |
225 | + var obj = JSON.parse(data); | |
226 | + if (obj) { | |
227 | + var listDiv = document.getElementById('telescope_logs'); | |
228 | + listDiv.innerHTML = ''; | |
229 | + for (var tmp in obj) { | |
230 | + var li = document.createElement('li'); | |
231 | + li.innerHTML = obj[tmp]['fields']['created'] + ": " + obj[tmp]['fields']['message']; // Use innerHTML to set the text | |
232 | + listDiv.appendChild(li); | |
233 | + } | |
234 | + } | |
235 | + }, | |
236 | + error: function() | |
237 | + { | |
238 | + console.log('Ajax error: GET request failed\n'); | |
239 | + } | |
240 | + | |
241 | + }); | |
242 | + | |
243 | + } | |
244 | +}); | |
245 | + | |
246 | + | |
247 | +</script> --> | |
248 | + | |
249 | +</body> | |
250 | +</html> | |
251 | +{% endblock %} | ... | ... |
src/dashboard/urls.py
... | ... | @@ -20,6 +20,9 @@ urlpatterns = [ |
20 | 20 | url(r'^quotas$', views.quotas, name="quotas"), |
21 | 21 | url(r'^observation_status/retrieve_env', views.retrieve_env, name='retrieve_env'), |
22 | 22 | url(r'^retrieve_env_navbar', views.retrieve_env_navbar, name='retrieve_env_navbar'), |
23 | + url(r'^observation_status/send_command_to_telescope/submit_expert', views.submit_command_to_telescope_expert, name='submit_command_to_telescope_expert'), | |
24 | + url(r'^observation_status/send_command_to_telescope/submit', views.submit_command_to_telescope, name='submit_command_to_telescope'), | |
25 | + url(r'^observation_status/send_command_to_telescope', views.send_command_to_telescope, name='send_command_to_telescope'), | |
23 | 26 | |
24 | 27 | #url(r'^retrieve_observation_status$', views.retrieve_observation_status, name="retrieve_observation_status"), |
25 | 28 | ] | ... | ... |
src/dashboard/views.py
... | ... | @@ -14,6 +14,9 @@ from django.shortcuts import get_object_or_404 |
14 | 14 | from django.utils.decorators import method_decorator |
15 | 15 | from django.urls import reverse_lazy, reverse |
16 | 16 | from django.http import Http404 |
17 | +import json | |
18 | +from django.views.decorators.csrf import requires_csrf_token | |
19 | + | |
17 | 20 | |
18 | 21 | log = l.setupLogger("dashboard", "dashboard") |
19 | 22 | |
... | ... | @@ -166,4 +169,26 @@ def change_globalMode(request): |
166 | 169 | config.save() |
167 | 170 | return redirect('index') |
168 | 171 | except Config.DoesNotExist: |
169 | - return redirect('index') | |
170 | 172 | \ No newline at end of file |
173 | + return redirect('index') | |
174 | + | |
175 | +@login_required | |
176 | +def send_command_to_telescope(request): | |
177 | + return render(request, "dashboard/send_command_telescope.html") | |
178 | + | |
179 | +@login_required | |
180 | +def submit_command_to_telescope(request): | |
181 | + import json | |
182 | + if request.method == 'POST': | |
183 | + param = request.POST.get("comande") | |
184 | + return HttpResponse(json.dumps({'message': "Command send OK"})) | |
185 | + | |
186 | +@login_required | |
187 | +def submit_command_to_telescope_expert(request): | |
188 | + import os | |
189 | + if request.method == 'POST': | |
190 | + param = request.POST.get("commande_expert") | |
191 | + if param: | |
192 | + os.system("echo " + param + " >> contenu") | |
193 | + return HttpResponse(json.dumps({'message': "Command send OK"})) | |
194 | + return HttpResponse(json.dumps({'message': "Missing command data"})) | |
195 | + return redirect('submit_command_to_telescope') | |
171 | 196 | \ No newline at end of file | ... | ... |
src/devices/views.py
1 | -from django.shortcuts import render | |
2 | -from common.models import Log | |
1 | +from django.shortcuts import render, get_object_or_404 | |
2 | +from common.models import Log, Config | |
3 | 3 | from django.http import HttpResponse |
4 | 4 | from django.core import serializers |
5 | 5 | from django.contrib.auth.decorators import login_required |
... | ... | @@ -43,12 +43,10 @@ def observation_status(request): |
43 | 43 | ''' |
44 | 44 | Called by the dashboard system page with ajax request every seconds, to get the logs and print them |
45 | 45 | ''' |
46 | + config = get_object_or_404(Config, id=1) | |
46 | 47 | if request.is_ajax(): |
47 | 48 | telescope_logs = Log.objects.filter(agent='Telescope').order_by('-created') |
48 | 49 | cagire_logs = Log.objects.filter(agent='CameraNIR').order_by('-created') |
49 | 50 | ddrago_b_logs = Log.objects.filter(agent='CameraVIS').order_by('-created') |
50 | 51 | ddrago_r_logs = Log.objects.filter(agent='CameraVIS').order_by('-created') |
51 | - logs = telescope_logs + cagire_logs + ddrago_r_logs + ddrago_b_logs | |
52 | - return render('dashboard/observation_status.html', {logs: object}) | |
53 | - else: | |
54 | - return render(request, "dashboard/observation_status.html") | |
55 | 52 | \ No newline at end of file |
53 | + return render(request, 'dashboard/observation_status.html', locals()) | ... | ... |
... | ... | @@ -0,0 +1,209 @@ |
1 | +var LOGS_REFRESH_FREQUENCE = 2000; //in milliseconds | |
2 | +var expert_mode = false; | |
3 | + | |
4 | +jQuery(document).ready(function(){ | |
5 | + | |
6 | + function command_set() | |
7 | + { | |
8 | + var form = $("#command_form"); | |
9 | + var arr = [ | |
10 | + {val : "COORDS_FRAME", text: 'COORDS_FRAME'}, | |
11 | + {val : 'FOCUS', text: 'FOCUS'}, | |
12 | + {val : 'ROTATOR', text: 'ROTATOR'}, | |
13 | + {val : 'MOVE_MODE', text: 'MOVE_MODE'} | |
14 | + ]; | |
15 | + | |
16 | + var sel = $('<select>', {name: "param1", id:"param1"}).appendTo('#command_form'); | |
17 | + $(arr).each(function() { | |
18 | + sel.append($("<option>").attr('value',this.val).text(this.text)); | |
19 | + sel.css("font-size", "25px"); | |
20 | + }); | |
21 | + | |
22 | + var arr = [ | |
23 | + {val: "Hadec", text: 'Hadec'}, | |
24 | + {val: 'Radec', text: 'Radec'}, | |
25 | + {val: 'Altaz', text: 'Altaz'} | |
26 | + ]; | |
27 | + var type = "<select>"; | |
28 | + | |
29 | + var sel = $(type, {id:"param2", name:"param2"}).appendTo('#command_form'); | |
30 | + $(arr).each(function() { | |
31 | + sel.append($("<option>").attr('value',this.val).text(this.text)); | |
32 | + sel.css("font-size", "25px"); | |
33 | + }); | |
34 | + | |
35 | + $("#param1").change(function () { | |
36 | + var length = form.children().length; | |
37 | + for (var i = 4; i < length; i++) { | |
38 | + $("#command_form").children().last().remove(); | |
39 | + } | |
40 | + | |
41 | + if ($("#param1").find(":selected").text() === "ROTATOR") { | |
42 | + var arr = [ | |
43 | + {val: "NONE", text: 'NONE'}, | |
44 | + {val: 'SYNCHRO', text: 'SYNCHRO'}, | |
45 | + {val: 'TRACKING', text: 'TRACKING'} | |
46 | + ]; | |
47 | + } | |
48 | + | |
49 | + else if ($("#param1").find(":selected").text() === "MOVE_MODE") { | |
50 | + var arr = [ | |
51 | + {val: "Goto", text: 'Goto'}, | |
52 | + {val: 'Track', text: 'Track'}, | |
53 | + {val: 'GotoTrack', text: 'GotoTrack'} | |
54 | + ]; | |
55 | + } | |
56 | + else if ($("#param1").find(":selected").text() === "COORDS_FRAME") { | |
57 | + var arr = [ | |
58 | + {val: "Hadec", text: 'Hadec'}, | |
59 | + {val: 'Radec', text: 'Radec'}, | |
60 | + {val: 'Altaz', text: 'Altaz'} | |
61 | + ]; | |
62 | + } | |
63 | + | |
64 | + var type = '<select name=param2">'; | |
65 | + if ($("#param1").find(":selected").text() === "FOCUS") | |
66 | + type = "<input name='param2' type='number' step='any' />"; | |
67 | + | |
68 | + var sel = $(type, {id:"param2"}).appendTo('#command_form'); | |
69 | + $(arr).each(function() { | |
70 | + sel.append($("<option>").attr('value',this.val).text(this.text)); | |
71 | + sel.css("font-size", "25px"); | |
72 | + }); | |
73 | + $('<br><br>').appendTo("#command_form"); | |
74 | + $('<input>', {id:"submit_button", type:"submit", value:"SEND"}).appendTo('#command_form'); | |
75 | + | |
76 | + }); | |
77 | + } | |
78 | + | |
79 | + | |
80 | + function command_get() | |
81 | + { | |
82 | + var arr = [ | |
83 | + {val: "POSITION", text: 'POSITION'}, | |
84 | + {val: 'STATUS', text: 'STATUS'}, | |
85 | + {val: 'SETUP', text: 'SETUP'} | |
86 | + ]; | |
87 | + var sel = $('<select>', {id:"param1", name:"param1"}).appendTo('#command_form'); | |
88 | + $(arr).each(function() { | |
89 | + sel.append($("<option>").attr('value',this.val).text(this.text)); | |
90 | + sel.css("font-size", "25px"); | |
91 | + }); | |
92 | + } | |
93 | + | |
94 | + function command_do() | |
95 | + { | |
96 | + var arr = [ | |
97 | + {val: "START", text: 'START'}, | |
98 | + {val: 'ABORT', text: 'ABORT'}, | |
99 | + {val: 'HOMING', text: 'HOMING'}, | |
100 | + {val: 'DOORS', text: 'DOORS'}, | |
101 | + {val: 'STOP', text: 'STOP'} | |
102 | + ]; | |
103 | + | |
104 | + var sel = $('<select>', {id:"param1", name:"param1"}).appendTo('#command_form'); | |
105 | + $(arr).each(function() { | |
106 | + sel.append($("<option>").attr('value',this.val).text(this.text)); | |
107 | + sel.css("font-size", "25px"); | |
108 | + }); | |
109 | + | |
110 | + $("#param1").change(function () { | |
111 | + var length = $("#command_form").children().length; | |
112 | + for (var i = 4; i < length; i++) { | |
113 | + $("#command_form").children().last().remove(); | |
114 | + } | |
115 | + if ($("#param1").find(":selected").text() === "DOORS") | |
116 | + { | |
117 | + var selected = $('<select>', {id:"param2", name:"param2"}).appendTo('#command_form'); | |
118 | + selected.append($("<option>").attr('value','OPEN').text('OPEN')); | |
119 | + selected.append($("<option>").attr('value','CLOSE').text('CLOSE')); | |
120 | + selected.css("font-size", "25px"); | |
121 | + } | |
122 | + | |
123 | + $('<br><br>').appendTo("#command_form"); | |
124 | + $('<input>', {id:"submit_button", type:"submit", value:"SEND"}).appendTo('#command_form'); | |
125 | + | |
126 | + }); | |
127 | + | |
128 | + } | |
129 | + | |
130 | + $("#commande").change(function() { | |
131 | + | |
132 | + var form = $("#command_form"); | |
133 | + var length = form.children().length; | |
134 | + | |
135 | + for (var i = 3; i < length; i++) { | |
136 | + form.children().last().remove(); | |
137 | + } | |
138 | + | |
139 | + var selected_command = $("#commande").find(":selected").val(); | |
140 | + if ( selected_command === "SET") | |
141 | + command_set(); | |
142 | + else if (selected_command === "GET") | |
143 | + command_get(); | |
144 | + else if (selected_command === "DO") | |
145 | + command_do(); | |
146 | + $('<br><br>').appendTo("#command_form"); | |
147 | + $('<input>', {id:"submit_button", type:"submit", value:"SEND"}).appendTo('#command_form'); | |
148 | + | |
149 | + }); | |
150 | + //$("#command_form").append(param1); | |
151 | + | |
152 | +$("#expert_mode").click(function(){ | |
153 | + if (!expert_mode) | |
154 | + { | |
155 | + expert_mode = true; | |
156 | + $("#command_form_expert").append("<input id='input_command_expert' type='text' name='commande_expert'>"); | |
157 | + $('<input>', {id:"submit_button_expert", type:"submit", value:"SEND"}).appendTo('#command_form_expert'); | |
158 | + } | |
159 | + else { | |
160 | + $("#input_command_expert").remove(); | |
161 | + $("#submit_button_expert").remove(); | |
162 | + expert_mode = false; | |
163 | + } | |
164 | + //$("#command_form").remove(); | |
165 | +}); | |
166 | + | |
167 | +$("#command_form_expert").submit(function(event){ | |
168 | + | |
169 | + event.preventDefault(); | |
170 | + $.post('/dashboard/observation_status/send_command_to_telescope/submit_expert', $(this).serialize(), function(data){ | |
171 | + var obj = JSON.parse(data); | |
172 | + console.log(obj.message); | |
173 | + .fail(function() { | |
174 | + alert( "An error occured" ); | |
175 | + }) | |
176 | + }); | |
177 | +}); | |
178 | + | |
179 | + | |
180 | + | |
181 | + interval_telescope = setInterval(function() {ajax_request("telescope", "telescope_list");}, LOGS_REFRESH_FREQUENCE); | |
182 | + | |
183 | + function ajax_request(){ | |
184 | + var telescope_url ="/devices/update_telescope_logs"; | |
185 | + $.ajax({ | |
186 | + url: telescope_url, | |
187 | + type: 'get', | |
188 | + dataType: 'text', | |
189 | + success: function(data) | |
190 | + { | |
191 | + var obj = JSON.parse(data); | |
192 | + if (obj) { | |
193 | + var listDiv = document.getElementById('telescope_logs'); | |
194 | + listDiv.innerHTML = ''; | |
195 | + for (var tmp in obj) { | |
196 | + var li = document.createElement('li'); | |
197 | + li.innerHTML = obj[tmp]['fields']['created'] + ": " + obj[tmp]['fields']['message']; // Use innerHTML to set the text | |
198 | + listDiv.appendChild(li); | |
199 | + } | |
200 | + } | |
201 | + }, | |
202 | + error: function() | |
203 | + { | |
204 | + console.log('Ajax error: GET request failed\n'); | |
205 | + } | |
206 | + | |
207 | + }); | |
208 | + } | |
209 | +}); | ... | ... |
src/misc/templates/base.html
... | ... | @@ -20,7 +20,7 @@ |
20 | 20 | <link rel="stylesheet" href={% static "bootstrap/font-awesome/css/font-awesome.min.css" %}> |
21 | 21 | |
22 | 22 | <!-- Page Specific CSS --> |
23 | - <link rel="stylesheet" href="http://cdn.oesmith.co.uk/morris-0.4.3.min.css"> | |
23 | + <!-- <link rel="stylesheet" href="http://cdn.oesmith.co.uk/morris-0.4.3.min.css"> --> | |
24 | 24 | |
25 | 25 | <!-- JsTree --> |
26 | 26 | <link rel="stylesheet" href={% static "bootstrap/dist/themes/default/style.min.css" %}> |
... | ... | @@ -120,7 +120,7 @@ a { |
120 | 120 | <script> |
121 | 121 | var TOO_STRONG_WIND = 60; //Totally arbitrary values, just for demonstration |
122 | 122 | var MAX_CLOUD_VALUE = 1; |
123 | - var REFRESH_ICONS_FREQUENCE_MILLISECONDS = 1000; | |
123 | + var REFRESH_ICONS_FREQUENCE_MILLISECONDS = 60000; | |
124 | 124 | var MAX_RAIN_RATE = 10; |
125 | 125 | |
126 | 126 | $( document ).ready(function() { |
... | ... | @@ -159,7 +159,6 @@ a { |
159 | 159 | _img.width = 30; |
160 | 160 | _img.height = 30; |
161 | 161 | _img.id ="weather_img"; |
162 | - console.log(weather_status[0]['fields']['global_status']); | |
163 | 162 | if(parseInt(weather_status[0]['fields']['rain']) > MAX_RAIN_RATE) |
164 | 163 | _img.src = "{% static 'media/rain_new.png' %}"; |
165 | 164 | else if (parseInt(weather_status[0]['fields']['cloud']) > MAX_CLOUD_VALUE) |
... | ... | @@ -231,7 +230,7 @@ a { |
231 | 230 | |
232 | 231 | <!-- Page Specific Plugins --> |
233 | 232 | <script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script> |
234 | - <script src="http://cdn.oesmith.co.uk/morris-0.4.3.min.js"></script> | |
233 | + <!-- <script src="http://cdn.oesmith.co.uk/morris-0.4.3.min.js"></script> --> | |
235 | 234 | <script src={% static "bootstrap/js/morris/chart-data-morris.js" %}></script> |
236 | 235 | <script src={% static "bootstrap/js/tablesorter/jquery.tablesorter.js" %}></script> |
237 | 236 | <script src={% static "bootstrap/js/tablesorter/tables.js" %}></script> | ... | ... |