Blame view

src/misc/templates/base.html 13.5 KB
94082e77   haribo   Date: 03/06/2016
1
2
3
4
5
<!DOCTYPE html>
<html lang="en">
<head>

    {% load staticfiles %}
94082e77   haribo   Date: 03/06/2016
6
7
8
9
10
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Control center for the SVOM French GFT">
    <meta name="author" content="CNRS-IRAP">
e7876d61   Patrick Maeght   colibrifavicon
11
    <link rel="icon" type="image/png" href="../public/static/media/colibrifavicon.png" />
94082e77   haribo   Date: 03/06/2016
12
    
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
13
    <title >Colibri Control Center</title>
94082e77   haribo   Date: 03/06/2016
14
15
16
17
18
19
20
21

    <!-- Bootstrap core CSS -->
    <link href={% static "bootstrap/css/bootstrap.css" %} rel="stylesheet">

    <link href={% static "bootstrap/css/sb-admin.css" %} rel="stylesheet">
    <link rel="stylesheet" href={% static "bootstrap/font-awesome/css/font-awesome.min.css" %}>

    <!-- Page Specific CSS -->
ba1d1f2b   Quentin Durand   implémentation Fr...
22
    <!--    <link rel="stylesheet" href="http://cdn.oesmith.co.uk/morris-0.4.3.min.css"> -->
94082e77   haribo   Date: 03/06/2016
23
24
    
    <!-- JsTree -->
6dc0b213   theophile.puhl@epitech.eu   Création du dashb...
25
26
27
    <link rel="stylesheet" href={% static "bootstrap/dist/themes/default/style.min.css" %}>
    <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">
94082e77   haribo   Date: 03/06/2016
28
29
	
	{% block head %}
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
30
31
32
33
34
35
	<style> 
  #title {
    font-family: 'Montserra', sans-serif; 
    font-size: 50px;
  }
  </style>
94082e77   haribo   Date: 03/06/2016
36
37
38
39
40
	{% endblock %}

</head>

<body>
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
41
<style>
17096d96   theophile.puhl@epitech.eu   Fixing Merge Issues
42

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
43
44
45
#page-wrapper {
  padding: 15px 60px;
}
d5fce214   theopuhl   Dashboard color c...
46

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
47
48
#wrapper {
  padding-left: 10%;
17096d96   theophile.puhl@epitech.eu   Fixing Merge Issues
49
  
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
50
51
52
53
54
}

.side-nav {
  margin-left: -200px;
  left: 200px;
9f5133c2   Unknown   Implmentation of ...
55
  width: 125px;
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
56
57
58
59
}

a {
  font-family: 'Montserra', sans-serif;
94082e77   haribo   Date: 03/06/2016
60

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
61
62
63
}

#fas {
d5fce214   theopuhl   Dashboard color c...
64
  size: 18px;
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
65
}
d5fce214   theopuhl   Dashboard color c...
66

17096d96   theophile.puhl@epitech.eu   Fixing Merge Issues
67
68
#profile
{
d5fce214   theopuhl   Dashboard color c...
69
    font-size: 17px;
17096d96   theophile.puhl@epitech.eu   Fixing Merge Issues
70
}
fca58359   Unknown   Updating site tim...
71

fca58359   Unknown   Updating site tim...
72
73
#hour
{
d5fce214   theopuhl   Dashboard color c...
74
75
76
77
    color: black;
    font-size: 14px;
}

6973f7df   Quentin Durand   PLC STATE + MODE
78
79
#plc_state
{
c830a3bc   Quentin Durand   PLC ACK + plc tim...
80
    color: black;
6973f7df   Quentin Durand   PLC STATE + MODE
81
82
83
    font-size: 18px;
}

d5fce214   theopuhl   Dashboard color c...
84
85
#signout {
    color: black;
fca58359   Unknown   Updating site tim...
86
}
d5fce214   theopuhl   Dashboard color c...
87
88
89
90
91
92

.nav>li>a:focus, .nav>li>a:hover {
        text-decoration: none;
        background-color: transparent !important;
}

d10a07d4   theopuhl   Update Images
93
94
95
96
#topbar {
    -webkit-transition: background-color 800ms linear;
    -ms-transition: background-color 800ms linear;
    transition: background-color 800ms linear;
6aec6155   theopuhl   Majordome algorit...
97
98
99
100
    height: 100%;
}
#text_globalmode {
    font-size: 14px;
fc957772   Quentin Durand   Control command P...
101
    color: black;
fca58359   Unknown   Updating site tim...
102
}
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
103
</style>
fca58359   Unknown   Updating site tim...
104

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
105
{% load tags %}
d3a69adc   theopuhl   Change name to ch...
106
107
108
109
110
111
{% get_level "USER_LEVEL_TAS" as USER_LEVEL_TAC %}
{% get_level "USER_LEVEL_OBSERVER" as USER_LEVEL_OBSERVER %}
{% get_level "USER_LEVEL_IE" as USER_LEVEL_IE %}
{% get_level "USER_LEVEL_OPERATOR" as USER_LEVEL_OPERATOR %}
{% get_level "USER_LEVEL_SUPEROPERATOR" as USER_LEVEL_SUPEROPERATOR %}
{% get_level "USER_LEVEL_PI" as USER_LEVEL_PI %}
a58163bb   theopuhl   New page Simulator
112
{% get_level "USER_LEVEL_PI" as USER_LEVEL_SYSADMIN %}
94082e77   haribo   Date: 03/06/2016
113
114
115
<div id="wrapper">

      <!-- Sidebar -->
6aec6155   theopuhl   Majordome algorit...
116
      <nav class="navbar navbar-inverse navbar-fixed-top navbar-expand-lg" role="navigation">
94082e77   haribo   Date: 03/06/2016
117
118
      <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
e7876d61   Patrick Maeght   colibrifavicon
119
            <img alt="" src="../public/static/media/colibrifavicon.png">
3e870366   Patrick Maeght   colibrifavicon
120
            <a class="navbar-brand" href={% url "index" %} style="color: black;">Colibri Control Center</a>
94082e77   haribo   Date: 03/06/2016
121
        </div>
76dfa189   Unknown   Adding devices lo...
122
123
124
125
           <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>



94082e77   haribo   Date: 03/06/2016
126
        <!-- Collect the nav links, forms, and other content for toggling -->
d5fce214   theopuhl   Dashboard color c...
127
        <!-- #f9ff93 #6b69f3-->
d10a07d4   theopuhl   Update Images
128
        <div id="topbar" class="collapse navbar-collapse navbar-ex1-collapse navbar-dark bg-primary">
d5fce214   theopuhl   Dashboard color c...
129
        <ul class="nav navbar-nav side-nav navbar-dark bg-primary" id="navbar_list">
2c61f856   theopuhl   Url change to pat...
130
            <li><a href="{% url "weather" %}">Weather</a></li>
d3a69adc   theopuhl   Change name to ch...
131
            {% if USER_LEVEL >= USER_LEVEL_IE %}
2c61f856   theopuhl   Url change to pat...
132
133
134
135
136
                <li><a href="{% url "site" %}">State</a></li>
                <li><a href="{% url "site" %}">Observatory</a></li>
            {% else %}
                <li><a href="{% url "site" %}">Observatory</a></li>
            {% endif %}
d3a69adc   theopuhl   Change name to ch...
137
            {% if USER_LEVEL >= USER_LEVEL_IE %}
2c61f856   theopuhl   Url change to pat...
138
139
140
                <li><a href="{% url "observation_status" %}">Tel & Inst</a></li>
            {% endif %}
            <li><a href="#">Webcams</a></li>
d3a69adc   theopuhl   Change name to ch...
141
            {% if USER_LEVEL >= USER_LEVEL_OBSERVER %}
2c61f856   theopuhl   Url change to pat...
142
143
144
                <li><a href="{% url "proposal" %}">Proposal</a></li>
            {% endif %}
            <li><a href="{% url "requests_list" %}">Request</a></li>
3dbda6a0   haribo   Date: 17/06/2016
145
            <li><a href="{% url "alerts_list" %}">Alerts</a></li>
2c61f856   theopuhl   Url change to pat...
146
147
            <li><a href="{% url "current_schedule" %}">Schedule</a></li>
            <li><a href="#">Images</a></li>
1b9ba1f6   Quentin Durand   Little update on ...
148
            <li><a href="{% url "system" %}">System</a></li>
94082e77   haribo   Date: 03/06/2016
149
          </ul>
6aec6155   theopuhl   Majordome algorit...
150
          <ul class="nav navbar-nav navbar-right navbar-user navbar-expand-lg">
6973f7df   Quentin Durand   PLC STATE + MODE
151
              <li><a id="plc_state"></a></li>
d10a07d4   theopuhl   Update Images
152
            <li><a class="nav-brand" id="hour">Sun elevation :</a></li>
5f7e4955   Quentin Durand   Add some commands...
153
            <li><a class="nav-brand" id="day_night" ><img id="day_night_img"></a></li>
d66e0d93   Quentin Durand   observatory statu...
154
             <li><a class="nav-brand" id="observatory_state" href="{% url "site" %}"><img id="obs_state_img"></a></li>
d5fce214   theopuhl   Dashboard color c...
155
            <li><a class="nav-brand" id="wind" href="{% url "weather" %}"><img id="wind_img"></a></li>
6973f7df   Quentin Durand   PLC STATE + MODE
156
            <li><a class="nav-brand" id="weather" href="{% url "weather" %}"><img id="weather_img"></a></li>
fc957772   Quentin Durand   Control command P...
157
            <li><a class="nav-brand" id="globalmode" style="color: black;"> <p id="text_globalmode"  >{% global_mode  request %} </p></a>
c830a3bc   Quentin Durand   PLC ACK + plc tim...
158

e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
159
            <li>
d5fce214   theopuhl   Dashboard color c...
160
                <a class="nav-brand" href="{% url "profile" %}" style="color: black;"><i id="profile" class="fas fa-cog "></i></a>              
94082e77   haribo   Date: 03/06/2016
161
            </li>
e31b2208   theophile.puhl@epitech.eu   Severals Changes ...
162
            <li>
d5fce214   theopuhl   Dashboard color c...
163
              <a id="signout" href="{% url "user_logout" %}" ><i class="fa fa-power-off"></i> Log Out</a>             
94082e77   haribo   Date: 03/06/2016
164
            </li>
76dfa189   Unknown   Adding devices lo...
165

94082e77   haribo   Date: 03/06/2016
166
          </ul>
757a9ae5   Unknown   fixing js in base...
167
            <script>
76dfa189   Unknown   Adding devices lo...
168
169
              var TOO_STRONG_WIND = 60; //Totally arbitrary values, just for demonstration
              var MAX_CLOUD_VALUE = 1;
40ee3b96   Quentin Durand   adding sunelevati...
170
              var REFRESH_ICONS_FREQUENCE_MILLISECONDS = 1000;
76dfa189   Unknown   Adding devices lo...
171
172
              var MAX_RAIN_RATE = 10;

c830a3bc   Quentin Durand   PLC ACK + plc tim...
173
174
              var check_change = true;

fca58359   Unknown   Updating site tim...
175
              $( document ).ready(function() {
40ee3b96   Quentin Durand   adding sunelevati...
176
177
              //get_hour();
              //setInterval(function() {get_hour();}, 900);
40ee3b96   Quentin Durand   adding sunelevati...
178
              function set_elev(sun_elev)
fca58359   Unknown   Updating site tim...
179
              {
40ee3b96   Quentin Durand   adding sunelevati...
180
                  $("#hour").text("Sun elevation : " + sun_elev);
fca58359   Unknown   Updating site tim...
181
              }
fca58359   Unknown   Updating site tim...
182

9f5133c2   Unknown   Implmentation of ...
183
              function change_color(elevation, elev_threshold)
fca58359   Unknown   Updating site tim...
184
              {
d10a07d4   theopuhl   Update Images
185
                  var color = "";
9f5133c2   Unknown   Implmentation of ...
186
                  if (elevation >= elev_threshold)
d10a07d4   theopuhl   Update Images
187
188
189
190
                    color = "#f9ff93";
                  else
                    color = "#6b69f3";
                $("#topbar").css("background-color", color);
fca58359   Unknown   Updating site tim...
191
              }
9f5133c2   Unknown   Implmentation of ...
192
              function info_plc(is_safe, mode, ack, timeout, max_plc_timeout)
6973f7df   Quentin Durand   PLC STATE + MODE
193
              {
6973f7df   Quentin Durand   PLC STATE + MODE
194
195
196
197
                  var safe = "UNSAFE";
                  if (is_safe)
                      safe = "SAFE";

c830a3bc   Quentin Durand   PLC ACK + plc tim...
198
                  if (ack) {
fc957772   Quentin Durand   Control command P...
199
                      ack = "ACK: OK";
c830a3bc   Quentin Durand   PLC ACK + plc tim...
200
201
202
203
204
205
206
207
208
209
210
                      if (!check_change)
                          window.location.reload(true);
                      check_change = true;
                  }
                  else
                  {
                      ack = "STAFF ACK: KO";
                      $("#plc_state").css("background-color", "red");
                      check_change = false;
                  }

fc957772   Quentin Durand   Control command P...
211
                  $("#plc_state").text("PLC: " + mode + '\u00A0\u00A0\u00A0\u00A0\u00A0' + safe + '\u00A0\u00A0\u00A0\u00A0\u00A0' + ack);
9f5133c2   Unknown   Implmentation of ...
212
213
214
215
216
217
                   $("#plc_state").css("color", "black");
                   if (timeout > max_plc_timeout)
                  {
                      $("#plc_state").text("Connection to PLC LOST");
                      $("#plc_state").css("color", "red");
                  }
6973f7df   Quentin Durand   PLC STATE + MODE
218
219
              }

76dfa189   Unknown   Adding devices lo...
220
221
222
223
224
              ajax_request();
              interval = setInterval(function() {ajax_request();}, REFRESH_ICONS_FREQUENCE_MILLISECONDS);

              function ajax_request() {
                  $.get("{% url 'retrieve_env_navbar' %}", function (weather_status) {
d5fce214   theopuhl   Dashboard color c...
225
                    if (weather_status)
76dfa189   Unknown   Adding devices lo...
226
                      {
bb697c31   Unknown   Auto stash before...
227
                          var sunelev = parseFloat(weather_status[0]['sunelev']);
9f5133c2   Unknown   Implmentation of ...
228
229
230
231
                          var max_sunelev = parseInt(weather_status[0]['max_sunelev']);

                          set_elev(sunelev);
                          change_color(sunelev, max_sunelev);
6aec6155   theopuhl   Majordome algorit...
232
                          $("#text_globalmode").text(weather_status[0]["pyros_mode"]);
bb697c31   Unknown   Auto stash before...
233
                          var _img_day_night = document.createElement('img');
9f5133c2   Unknown   Implmentation of ...
234
                          if (sunelev >= max_sunelev)
d5fce214   theopuhl   Dashboard color c...
235
                              _img_day_night.src ="{% static 'media/rising_sun.png' %}";
76dfa189   Unknown   Adding devices lo...
236
                          else
d5fce214   theopuhl   Dashboard color c...
237
                              _img_day_night.src ="{% static 'media/moon.png' %}";
5f7e4955   Quentin Durand   Add some commands...
238
239
                          _img_day_night.width = 22;
                          _img_day_night.height = 22;
76dfa189   Unknown   Adding devices lo...
240
241
                          _img_day_night.id ="day_night_img";
                          _img_day_night.alt="html5";
6b16badb   Quentin Durand   Fix unitests + ne...
242
                           $("#day_night_img").replaceWith(_img_day_night);
76dfa189   Unknown   Adding devices lo...
243

d66e0d93   Quentin Durand   observatory statu...
244
245
246
247
248

                           var _img = document.createElement('img');
                          _img.width = 18;
                          _img.height = 18;
                          _img.id ="obs_state_img";
19e26d9c   Quentin Durand   adding observator...
249
250
251
                          if (parseInt(weather_status[0]["plc_timeout"]) > parseInt(weather_status[0]["max_plc_timeout"]))
                              _img.src = "{% static 'media/observatory_off.png' %}";
                          else if (weather_status[0]["sitewatch_global_status"] === "OK")
d66e0d93   Quentin Durand   observatory statu...
252
253
254
255
256
257
                               _img.src = "{% static 'media/observatory.png' %}";
                          else
                              _img.src = "{% static 'media/observatory_red.png' %}";
                          _img.alt = "html5";
                          $("#obs_state_img").replaceWith(_img);

1b9ba1f6   Quentin Durand   Little update on ...
258

76dfa189   Unknown   Adding devices lo...
259
                          var _img = document.createElement('img');
d5fce214   theopuhl   Dashboard color c...
260
261
                          _img.width = 18;
                          _img.height = 18;
76dfa189   Unknown   Adding devices lo...
262
                          _img.id ="weather_img";
9f5133c2   Unknown   Implmentation of ...
263
264
265
                          if (parseInt(weather_status[0]["plc_timeout"]) > parseInt(weather_status[0]["max_plc_timeout"]))
                               _img.src = "{% static 'media/rain_no_plc.png' %}";
                          else if(parseInt(weather_status[0]['fields']['rain']) > MAX_RAIN_RATE)
d5fce214   theopuhl   Dashboard color c...
266
                              _img.src = "{% static 'media/rain.png' %}";
76dfa189   Unknown   Adding devices lo...
267
                          else if (parseInt(weather_status[0]['fields']['cloud']) > MAX_CLOUD_VALUE)
d5fce214   theopuhl   Dashboard color c...
268
                              _img.src = "{% static 'media/cloud.png' %}";
76dfa189   Unknown   Adding devices lo...
269
                          else
d5fce214   theopuhl   Dashboard color c...
270
271
272
                              _img.src = "{% static 'media/sun.png' %}";
                              _img.width = 18;
                              _img.height = 18;
76dfa189   Unknown   Adding devices lo...
273
274
275
276
                              _img.alt = "html5";
                          $("#weather_img").replaceWith(_img);

                          var _im = document.createElement('img');
d5fce214   theopuhl   Dashboard color c...
277
278
                          _im.width = 18;
                          _im.height = 18;
76dfa189   Unknown   Adding devices lo...
279
                          _im.id="wind_img";
9f5133c2   Unknown   Implmentation of ...
280
281
282
                          if (parseInt(weather_status[0]["plc_timeout"]) > parseInt(weather_status[0]["max_plc_timeout"]))
                              _im.src = "{% static 'media/wind_no_plc.png' %}";
                          else if (parseInt(weather_status[0]['fields']['wind']) >= TOO_STRONG_WIND)
d5fce214   theopuhl   Dashboard color c...
283
                            _im.src = "{% static 'media/wind.png' %}";
76dfa189   Unknown   Adding devices lo...
284
                          else
d5fce214   theopuhl   Dashboard color c...
285
                            _im.src= "{% static 'media/windsock_nowind.png' %}";
76dfa189   Unknown   Adding devices lo...
286
                          $("#wind_img").replaceWith(_im);
40ee3b96   Quentin Durand   adding sunelevati...
287

9f5133c2   Unknown   Implmentation of ...
288
289
290
                          info_plc(weather_status[0]["is_safe"], weather_status[0]["plc_mode"],
                              weather_status[0]["ACK"], parseInt(weather_status[0]["plc_timeout"]),
                              parseInt(weather_status[0]["max_plc_timeout"]) );
76dfa189   Unknown   Adding devices lo...
291
292
293
294
295
                      }
                  }, 'json')
                      .fail(function () {
                          console.log('Ajax error: GET request failed\n');
                      })
fca58359   Unknown   Updating site tim...
296
              }});
76dfa189   Unknown   Adding devices lo...
297
          </script>
757a9ae5   Unknown   fixing js in base...
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322

        </div><!-- /.navbar-collapse -->

      </nav>

      <div id="page-wrapper">
      
      
      	<div class="row">      	
			<center><h2 id="title">{% block title %}  {% endblock %}</h2></center>
		</div>
	
		{% block content %}
		   
		   
		{% endblock %}
        

      </div><!-- /#page-wrapper -->

    </div><!-- /#wrapper -->

        <!-- Javascript function refreshing weather icons on the navbar -->


94082e77   haribo   Date: 03/06/2016
323
324
325
326
327
    
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
fca58359   Unknown   Updating site tim...
328
329
330
331
    <script  src="{% static "/js/moment.min.js" %}"></script>
    <script  src="{% static "/js/moment-timezone.min.js" %}"></script>
    <script  src="{% static "/js/moment-timezone-with-data.min.js" %}"></script>

94082e77   haribo   Date: 03/06/2016
332
333
334
335

    <script src={% static "bootstrap/js/bootstrap.min.js" %}></script>

    <!-- JavaScript -->
e6dd9964   haribo   Date: 19/07/2016
336
337
{#    <script src={% static "bootstrap/js/jquery-1.10.2.js" %}></script>#}
{#    <script src={% static "bootstrap/js/bootstrap.js" %}></script>#}
94082e77   haribo   Date: 03/06/2016
338
339
340
341
        <script src={% static "bootstrap/js/jquery.formset.js" %}></script>

    <!-- Page Specific Plugins -->
    <script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
ba1d1f2b   Quentin Durand   implémentation Fr...
342
    <!--    <script src="http://cdn.oesmith.co.uk/morris-0.4.3.min.js"></script>    -->
94082e77   haribo   Date: 03/06/2016
343
344
345
346
    <script src={% static "bootstrap/js/morris/chart-data-morris.js" %}></script>
    <script src={% static "bootstrap/js/tablesorter/jquery.tablesorter.js" %}></script>
    <script src={% static "bootstrap/js/tablesorter/tables.js" %}></script>
    
6dc0b213   theophile.puhl@epitech.eu   Création du dashb...
347
    
94082e77   haribo   Date: 03/06/2016
348
349
</body>
</html>