Commit e3ef4881e4bd5e2969f2b4b30c3c85b93f9b535e

Authored by theopuhl
1 parent eebd68b3
Exists in dev

Database changes (Enum + operator states)

src/common/models.py
... ... @@ -821,11 +821,14 @@ class WeatherWatchHistory(models.Model):
821 821  
822 822 class Config(models.Model):
823 823 SCHEDULER_STATE = (
824   - ('0', 'init'),
825   - ('1', 'sleeping'),
826   - ('2', 'startup'),
827   - ('3', 'observing'),
828   - ('4', 'shutdown'),
  824 + ('0', 'starting'),
  825 + ('1', 'passive'),
  826 + ('2', 'Init'),
  827 + ('3', 'Standby'),
  828 + ('4', 'Scheduler startup'),
  829 + ('5', 'Scheduler'),
  830 + ('6', 'Scheduler closing'),
  831 + ('7', 'Passive'),
829 832 )
830 833 id = models.IntegerField(default='1', primary_key=True)
831 834 latitude = models.FloatField(default=1)
... ... @@ -842,7 +845,7 @@ class Config(models.Model):
842 845 global_mode = models.BooleanField(default='True')
843 846 ack = models.BooleanField(default='False')
844 847 bypass = models.BooleanField(default='True')
845   - scheduler_state = models.CharField(max_length=1, choices=SCHEDULER_STATE, default=0)
  848 + pyros_state = models.CharField(max_length=1, choices=SCHEDULER_STATE, default=0)
846 849 force_passive_mode = models.BooleanField(default='False')
847 850 plc_timeout_seconds = models.PositiveIntegerField(default=60)
848 851  
... ...
src/dashboard/templates/dashboard/index.html
... ... @@ -109,7 +109,7 @@
109 109 <a href="{% url "states" %}">
110 110 <div class="all-info">
111 111 <h3>Observatory</h3>
112   - <img src="{% static "media/state.png" %}" alt="html5" height="200" width="200"/>
  112 + <img src="{% static "media/state.png" %}" alt="html5" height="200" width="200"/>
113 113 </div></a>
114 114 </div>
115 115 </li>
... ...
src/dashboard/templates/dashboard/operator_state.html
... ... @@ -91,12 +91,9 @@
91 91 </div>
92 92 <br><br><br>
93 93 <div class="text-center">
  94 +
94 95 <a id="button" class="btn btn-primary btn-lg" href="{% url "change_globalMode" %}" onclick="return confirm('Are you sure you want to switch the controller mode ?')"> {% global_mode_state request %} </a>
95   - <br> <a id="button" class="btn btn-primary btn-lg" href="{% url "change_ack" %}" onclick="return confirm('Are you sure you want to acknowledge for the next night ?')"> {% ack request %} </a>
96   - {% if config.bypass == True %}
97   - <br> <a id="button" class="btn btn-danger btn-lg" href="{% url "change_bypass" %}" onclick="return confirm('Are you sure you want to bypass the Plc ?')"> {% bypass request %} </a>
98   - {% else %}
99   - <br> <a id="button" class="btn btn-primary btn-lg" href="{% url "change_bypass" %}" onclick="return confirm('Are you sure you want to remove the plc bypass')"> {% bypass request %} </a>
  96 + <br> <a id="button" class="btn btn-danger btn-lg" href="{% url "change_bypass" %}" onclick="return confirm('Are you sure you want to bypass the Plc ?')"> {% bypass request %} </a>
100 97 {% endif %}
101 98 </div>
102 99  
... ...
src/dashboard/views.py
... ... @@ -31,10 +31,6 @@ def index(request):
31 31 return render(request, 'dashboard/index.html', {'level': request.user.user_level.priority, 'base_template' : "base.html", 'weather_img': "normal"}) # return the initial view (the dashboard's one)
32 32 return render(request, 'dashboard/index.html', {'level': 0, 'base_template' : "base_unlogged.html", 'weather_img': "red"}) # return the initial view (the dashboard's one)
33 33  
34   -#@login_required
35   -#def observation_status(request):
36   - # return render(request, 'dashboard/observation_status.html')
37   -
38 34 def retrieve_env(request):
39 35 '''
40 36 TODO: integrate Alain's code do determine day/night with sunelev and switch to utc time when the plc will use it
... ... @@ -175,7 +171,6 @@ def proposal(request):
175 171 return render(request, 'dashboard/proposal.html', {'proposal_info' : proposal_info, 'nb_info_proposal' : nb_info_proposal})
176 172  
177 173 @login_required
178   -@superuser_only
179 174 def configUpdate(request):
180 175 instance = get_object_or_404(Config, id=1)
181 176 form = ConfigForm(request.POST or None, instance=instance)
... ...