Commit b4f00f20ba52ef5129f59426ed4b397c8131c7d1

Authored by Patrick Maeght
1 parent 25c7f6db
Exists in dev

weather config update

src/core/pyros_django/misc/static/js/weather_config.js
... ... @@ -29,10 +29,11 @@ var config_weather = {
29 29 },
30 30 update_weather: function(data) {
31 31 $.getJSON("config/update?data=" + data)
32   - .fail(function () {
33   - console.log('Ajax error: GET request failed\n');
  32 + .fail(function (){ alert('Error');
  33 + console.log('Ajax error: GET request failed\n');
34 34 })
35   - .done(function(_data) { alert('OK'); });
  35 + //.done(function(_data) { alert('OK'); });
  36 + .done(function(_data) {});
36 37 }
37 38  
38 39 }
39 40 \ No newline at end of file
... ...
src/core/pyros_django/monitoring/views.py
... ... @@ -37,12 +37,12 @@ def weather_config_update(request):
37 37 cmd_name, cmd_args = request.GET["data"].split(" ", 1)
38 38 # ['nom', 'monitoring_name actuel', 'id(json path) du capteur', 'nouveau monitoring_name']
39 39 # <class 'list'>: ['monitor_name_switch', 'None', 'Came:/S/N_A5EM:/Power_input', 'Rain_boolean']
40   -
  40 + #a = 5/0
41 41 Command.send_command('Dashboard', 'AgentM', cmd_name, cmd_args)
42 42  
43 43 #TODO: Pour l'instant, on ne recupere pas encore ce retour
44 44  
45 45 return HttpResponse('{"update":"OK"}', content_type="application/json")
46 46 except:
47   - return HttpResponse('{"update":"ERROR"}', content_type="application/json")
  47 + return HttpResponse('{"update":"ERROR"}', content_type="application/json", status="500")
48 48  
... ...