diff options
author | CruiseDevice | 2018-10-29 18:59:04 +0530 |
---|---|---|
committer | CruiseDevice | 2018-10-29 18:59:04 +0530 |
commit | dc1b49fc5ef5803160f0b0df5f8076e77e37926d (patch) | |
tree | 5ab83b7086fff95b51aa63ed4c94c8691c78d684 /sbhs/templates/dashboard | |
parent | 152b4a9c34398cc1a6530ee5c3830f57436b0a27 (diff) | |
download | sbhs_server-dc1b49fc5ef5803160f0b0df5f8076e77e37926d.tar.gz sbhs_server-dc1b49fc5ef5803160f0b0df5f8076e77e37926d.tar.bz2 sbhs_server-dc1b49fc5ef5803160f0b0df5f8076e77e37926d.zip |
Add moderator features
- Add form to update userboard.
- Management command for adding online boards.
- Add conditions for booking slots.
- Add features to test, update and reset boards.
Diffstat (limited to 'sbhs/templates/dashboard')
-rw-r--r-- | sbhs/templates/dashboard/dashboard_index.html | 10 | ||||
-rw-r--r-- | sbhs/templates/dashboard/profile.html | 45 | ||||
-rw-r--r-- | sbhs/templates/dashboard/test_boards.html | 143 | ||||
-rw-r--r-- | sbhs/templates/dashboard/update_mid.html | 12 |
4 files changed, 64 insertions, 146 deletions
diff --git a/sbhs/templates/dashboard/dashboard_index.html b/sbhs/templates/dashboard/dashboard_index.html index ccbba77..9155781 100644 --- a/sbhs/templates/dashboard/dashboard_index.html +++ b/sbhs/templates/dashboard/dashboard_index.html @@ -8,7 +8,6 @@ <script src="{% static 'js/jquery-ui.js' %}"></script> <link rel="stylesheet" type="text/css" href="{% static 'css/jquery.datetimepicker.css' %}"/> <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}"/> - <script type="text/javascript" src = "https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script> {% endblock %} {% block content %} <br> @@ -36,15 +35,6 @@ <li> <a href="{% url 'logs_folder_index' %}">Download Experiment Directory</a> </li> - <li> - <a href="{% url 'turn_on_all_boards' %}">Turn On all Boards</a> - </li> - <li> - <a href="{% url 'turn_off_all_boards' %}">Turn Off all Boards</a> - </li> - <li> - <a href="{% url 'book_all_suser_slots' %}">Book all Slots</a> - </li> </ul> </div> diff --git a/sbhs/templates/dashboard/profile.html b/sbhs/templates/dashboard/profile.html index 8a055df..fe999f6 100644 --- a/sbhs/templates/dashboard/profile.html +++ b/sbhs/templates/dashboard/profile.html @@ -9,8 +9,7 @@ <script type="{% static 'js/jquery-ui.js' %}"></script> <link rel="stylesheet" type="text/css" href="{% static 'css/jquery.datetimepicker.css' %}"/> <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}"/> - <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.css" /> - <script src="//cdnjs.cloudflare.com/ajax/libs/dygraph/2.1.0/dygraph.min.js"></script> + <script type="text/javascript" src = "{% static 'js/dygraph-combined.js' %}"></script> {% endblock %} {% block main %} <div class = "row"> @@ -25,25 +24,25 @@ </div> </div> <script> - (function(){ - var h = new Dygraph( - document.getElementById("heat"), - "{{ heat }}", - { - valueRange: [0,100] - } - ); - var f = new Dygraph( - document.getElementById("fan"), - "{{ fan }}", - { - valueRange: [0,100] - } - ); - var t = new Dygraph( - document.getElementById("temp"), - "{{ temp }}" - ); - })(); -</script> +(function(){ + var h = new Dygraph( + document.getElementById("heat"), + "{{ heat }}", + { + valueRange: [0,100] + } + ); + var f = new Dygraph( + document.getElementById("fan"), + "{{ fan }}", + { + valueRange: [0,100] + } + ); + var t = new Dygraph( + document.getElementById("temp"), + "{{ temp }}" + ); +})(); + </script> {% endblock %}
\ No newline at end of file diff --git a/sbhs/templates/dashboard/test_boards.html b/sbhs/templates/dashboard/test_boards.html index 11362df..c9a6330 100644 --- a/sbhs/templates/dashboard/test_boards.html +++ b/sbhs/templates/dashboard/test_boards.html @@ -17,129 +17,50 @@ <div class = "container"> <div class = "row"> <div class = "span7"> + {% if dead_servers %} + <div class="alert alert-danger"> + These SBHS servers did not respond - <br/> + <strong>{{dead_servers|join:", "}}</strong> + </div> + + {% endif %} <table class = "table table-striped" id = "tableId"> <thead> <tr> <th>Board MID</th> <th>Status</th> <th>Occupied</th> + <th>Temperature</th> + <th>Set Heat</th> + <th>Set Fan</th> + <th>Action</th> </tr> </thead> <tbody> - {% for board in boards %} - <tr style="cursor:pointer;" title="Test/Monitor board" data-toggle="modal" data-target="#myModal"> - <td>{{board.mid}}</td> - <td> - <span class = "label label-{% if board.online %}success{% else %}danger{% endif %}">{% if board.online %}Online{% else %}Offline{% endif %}</span> - </td> - <td> - {% vacant_slot slot_history.start_time slot_history.end_time now as slot_status %} - {% if slot_status == "vacant" %} - <p class="label label-{% if board.online %}success{% else %}danger{% endif %}">{% if board.online %}Vacant{% else %}Not available{% endif %}</p> - {% elif slot_status == "occupied" %} - <p class = "label label-danger">Occupied</p> - {% endif %} - - </td> - </tr> + {% for device in all_devices %} + <form class = "form-horizontal" action = "{% url 'update_board_values' device.board.mid %}" method="POST" name="form_{{device.board.mid}}" autocomplete="off"> + {% csrf_token %} + <tr> + <td>{{device.board.mid}}</td> + <td><span style="cursor: pointer;" class = "label label-{% if device.board.online %}success{% else %}danger{% endif %}"> + {% if device.board.online %}Online{% else %}Offline{% endif %}</span></td> + {% check_board_occupancy device.board.mid as slot_status %} + <td><span style="cursor: pointer;" class = "label label-{% if slot_status %}danger{% else %}success{% endif %}"> + {% if slot_status %}Occupied{% else %}Vacant{% endif %}</span></td> + <td>{{device.temp.temp}}</td> + <td><input type="text" name="set_heat" id="set_heat_{{device.board.mid}}"/></td> + <td><input type="text" name="set_fan" id="set_fan_{{device.board.mid}}"/></td> + <td><button class="btn btn-primary"> Submit </button></td> + </tr> + </form> {% endfor %} </tbody> </table> + <br/><br/> + <form class = "form-horizontal" action = "" method="POST" autocomplete="off"> + {% csrf_token %} + <center><button class = "btn btn-primary" name="reset_all" value="reset_all">Reset all boards</button></center> + </form> </div> - - <!-- Modal code starts here --> - - <div id="myModal" class="modal fade test-modal" id="" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button> - <h3>Test Board</h3> - </div> - <div id="orderDetails" class="modal-body"> - <div class = "input-group"> - <input type="text" class = "form-control" id = temp" disabled = "true"name=""> - <span class = "input-group-btn"> - <button class = "btn btn-primary" onclick="getTemp()">Get Temperature</button> - </span> - </div> - <br> - <div class = "input-group"> - Heater Input: <input type="number" size="3" min="0" max="250" id="heater-val"> - Fan Input: <input type="number" size="3" min="0" max="250" id="fan-val" name=""> - <span class = "input-group-btn"> - <button class = "btn btn-primary" onclick="setParams()">Set Parameters</button> - </span> - </div> - <br> - <div class = "input-group"> - <span class = "input-group-btn"> - <button class = "btn btn-primary" onclick="resetParams()">Reset Parameters</button> - </span> - </div> - </div> - <div class="modal-footer"> - <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> - </div> - </div> - </div> - </div> - - <!-- Modal code ends here --> - - <!-- Modal code starts here --> - - <div id="myModal" class="modal fade monitor-modal" id="" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> - <div class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button> - <h3>Monitor Experiment</h3> - </div> - <div id="orderDetails" class="modal-body"> - <div class = "input-group"> - <strong><p id = "username"></p></strong> - <p id = "log-data" style="word-spacing:4em"></p> - <span class = "input-group-btn"> - <button class = "btn btn-primary" onclick="getLogs()">Refresh Logs</button> - </span> - </div> - </div> - <div class="modal-footer"> - <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> - </div> - </div> - </div> - </div> - - <!-- Modal code ends here --> - </div> -</div> -<script type="text/javascript"> - $("#tableId").on("click", "tr", function(e) { - $("#tableId").find("tr.highlight").removeClass("highlight"); - $(this).addClass("highlight"); - - label = e.currentTarget.getElementsByClassName("label")[1]; - console.log(label) - isSelectedMachineVacant = label.className.indexOf("label-success") > -1; - console.log(isSelectedMachineVacant); - - if (isSelectedMachineVacant) { - $("#temp").val(""); - $("#fan-val").val(""); - $("#heater-val").val(""); - $(".test-modal").modal('show'); - } - else { - $(".test-modal").modal('hide'); - $(".montor-modal").modal('show'); - getLogs(); - } - }); - function getLogs(){ - console.log('hello from getLogs'); - } -</script> {% endblock %}
\ No newline at end of file diff --git a/sbhs/templates/dashboard/update_mid.html b/sbhs/templates/dashboard/update_mid.html index ea2eb4d..1fa3435 100644 --- a/sbhs/templates/dashboard/update_mid.html +++ b/sbhs/templates/dashboard/update_mid.html @@ -1,9 +1,17 @@ {% extends 'dashboard/dashboard_index.html' %} +{% load crispy_forms_tags %} {% block title %} Update MID {% endblock %} {% block main %} - <div> - <h4>Update MID</h4> + <div class = "container"> + <div class = "row"> + <form class = "form-horizontal" action = "" method="POST" autocomplete="off"> + {% csrf_token %} + {{form | crispy}} + <br> + <button class="btn btn-primary" type="submit" name='update_mid' value='update_mid'>Update Mid</button><br/> + </form> + </div> </div> {% endblock %}
\ No newline at end of file |