blob: 11362dffa60099a206dd1b3be15194dc9ff1f7bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
{% extends 'dashboard/dashboard_index.html' %}
{% load staticfiles %}
{% load custom_filter %}
{% block title %}
Test Boards
{% endblock %}
{% block style_block %}
<style type="text/css">
.highlight{
background-color: lightblue;
}
</style>
{% endblock %}
{% block main %}
<div class = "container">
<div class = "row">
<div class = "span7">
<table class = "table table-striped" id = "tableId">
<thead>
<tr>
<th>Board MID</th>
<th>Status</th>
<th>Occupied</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>
{% endfor %}
</tbody>
</table>
</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 %}
|