summaryrefslogtreecommitdiff
path: root/sbhs/templates
diff options
context:
space:
mode:
Diffstat (limited to 'sbhs/templates')
-rw-r--r--sbhs/templates/dashboard/dashboard_index.html10
-rw-r--r--sbhs/templates/dashboard/profile.html45
-rw-r--r--sbhs/templates/dashboard/test_boards.html143
-rw-r--r--sbhs/templates/dashboard/update_mid.html12
-rw-r--r--sbhs/templates/nav.html0
-rw-r--r--sbhs/templates/slot/create_slot.html (renamed from sbhs/templates/slot/new.html)26
6 files changed, 89 insertions, 147 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
diff --git a/sbhs/templates/nav.html b/sbhs/templates/nav.html
deleted file mode 100644
index e69de29..0000000
--- a/sbhs/templates/nav.html
+++ /dev/null
diff --git a/sbhs/templates/slot/new.html b/sbhs/templates/slot/create_slot.html
index 2713396..dc76382 100644
--- a/sbhs/templates/slot/new.html
+++ b/sbhs/templates/slot/create_slot.html
@@ -45,8 +45,30 @@
</form>
+ <div class = "tab-content col-md-10">
+ <table class = "table table-striped">
+ <thead>
+ <tr>
+ <th>
+ Sr.No
+ </th>
+ <th>
+ Already Booked Slots
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for slot in board_all_booked_slots %}
+ <tr>
+ <td>{{forloop.counter}}</td>
+ <td>{{slot.start_time}} : {{slot.end_time}} </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
</div>
- <div class = "tab-pane" id="tab_b">
+ <div class = "tab-pane col-md-10" id="tab_b">
<form action="" method="POST">
{%csrf_token %}
<table class="table table-striped">
@@ -59,6 +81,7 @@
<b><th>Action</th></b>
</tr>
</thead>
+ <tbody>
{% for h in history %}
<tr>
{%if h.start_time >= now %}
@@ -79,6 +102,7 @@
{% endif %}
</tr>
{% endfor %}
+ </tbody>
</table>
<button class="btn btn-danger" type="submit" name="delete" value="delete">Delete</button>
</form>