mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:18:24 +02:00
use underscorejs templating for queued assignments
This commit is contained in:
parent
e56f4aba0a
commit
ab50432ead
2 changed files with 11 additions and 11 deletions
|
@ -44,6 +44,15 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<script id="queued-template" type="text/template">
|
||||||
|
<% _.each(queued, function(assignment, uuid){ %>
|
||||||
|
<tr>
|
||||||
|
<td><%- assignment.type %></td>
|
||||||
|
<td><%- uuid %></td>
|
||||||
|
<td><%- assignment.pool %></td>
|
||||||
|
</tr>
|
||||||
|
<% }); %>
|
||||||
|
</script>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<!--#include file="footer.html"-->
|
<!--#include file="footer.html"-->
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
// setup the underscore templates
|
// setup the underscore templates
|
||||||
var nodeTemplate = _.template($('#nodes-template').html());
|
var nodeTemplate = _.template($('#nodes-template').html());
|
||||||
|
var queuedTemplate = _.template($('#queued-template').html());
|
||||||
|
|
||||||
// setup a function to grab the assignments
|
// setup a function to grab the assignments
|
||||||
function getNodesAndAssignments() {
|
function getNodesAndAssignments() {
|
||||||
|
@ -36,17 +37,7 @@ $(document).ready(function(){
|
||||||
});
|
});
|
||||||
|
|
||||||
$.getJSON("assignments.json", function(json){
|
$.getJSON("assignments.json", function(json){
|
||||||
queuedTableBody = "";
|
$('#assignments-table tbody').html(queuedTemplate(json));
|
||||||
|
|
||||||
$.each(json.queued, function (uuid, data) {
|
|
||||||
queuedTableBody += "<tr>";
|
|
||||||
queuedTableBody += "<td>" + data.type + "</td>";
|
|
||||||
queuedTableBody += "<td>" + uuid + "</td>";
|
|
||||||
queuedTableBody += "<td>" + (data.pool ? data.pool : "") + "</td>";
|
|
||||||
queuedTableBody += "</tr>";
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#assignments-table tbody').html(queuedTableBody);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue