Commit ae04c9dda61950f0027ea4df386a82549f4c7eb6

Authored by Patrick Maeght
1 parent ca736263
Exists in dev

__init__

src/dashboard/urls.py
... ... @@ -11,7 +11,6 @@ urlpatterns = [
11 11 path('routines', views.routines, name="routines"),
12 12 path('weather', views.weather, name="weather"),
13 13 path('weather/current', views.weather_current, name="weather_current"),
14   - path('weather/config', views.weather_config, name="weather_config"),
15 14 path('site', views.site, name="site"),
16 15 path('site/current', views.site_current, name="site_current"),
17 16 path('proposal', views.proposal, name='proposal'),
... ...
src/dashboard/views.py
... ... @@ -267,6 +267,7 @@ def weather_current(request):
267 267 def weather_config(request):
268 268 """ PM 20180926 prototype without database
269 269 http://127.0.0.1:8000/dashboard/weather/config
  270 + Moved to monitoring
270 271 """
271 272 try:
272 273 # Import PLC status sensor parser
... ...
src/monitoring/urls.py
1 1 from django.conf.urls import url
  2 +from django.urls import path
2 3 from . import views
3 4  
4 5 urlpatterns = [
  6 + path('', views.index, name='index'),
  7 + path('weather/config', views.weather_config, name="weather_config"),
5 8 ]
... ...
src/monitoring/views.py
  1 +from django.http import HttpResponse
1 2 from django.shortcuts import render
2 3  
3 4 # Create your views here.
  5 +
  6 +def index(request):
  7 + return HttpResponse("Hello, world. You're at the polls index.")
  8 +
  9 +def weather_config(request):
  10 + """ PM 20180926 prototype without database
  11 + http://127.0.0.1:8000/dashboard/weather/config
  12 + Moved to monitoring
  13 + """
  14 + try:
  15 + # Import PLC status sensor parser
  16 + from monitoring.plc_checker import PlcChecker
  17 + # Parse PLC status in colibri-new-fixed-2.json
  18 + #colibri_json = open("../simulators/plc/colibri-new-fixed-2.json")
  19 + #colibri_struct = json.load(colibri_json)
  20 + #plc_status = colibri_struct["statuses"][1]["entities"][0]
  21 + plc_checker = PlcChecker()
  22 + _struct = {"origin":plc_checker.origin, "sensors_table":plc_checker.sensors_table}
  23 + # Return template with sensors list
  24 + return render(request, 'dashboard/config_weather.html', {'weather_config' : _struct, 'base_template' : "base.html"})
  25 + except Config.DoesNotExist:
  26 + return render(request, 'dashboard/config_weather.html', {'weather_info' : None})
... ...
src/pyros/__init__.py 0 → 100644
No preview for this file type