Commit 0d93344c authored by Robert Ricci's avatar Robert Ricci

Experimet with re-factoring the dashboard template

The idea is to break it up into smaller pieces to make it easier to
re-arrange.
parent 251f3d0c
require(window.APT_OPTIONS.configObject,
['underscore', 'js/quickvm_sup', 'moment',
'js/lib/text!template/dashboard.html'],
function (_, sup, moment, dashboardString)
'js/lib/text!template/dashboard.html',
'js/lib/text!template/dashboard-recent.html'],
function (_, sup, moment, dashboardString, dashboardRecentString)
{
'use strict';
var isadmin = 0;
var dashboardRecent = _.template(dashboardRecentString);
var dashboardTemplate = _.template(dashboardString);
function initialize()
......@@ -23,7 +26,8 @@ function (_, sup, moment, dashboardString)
console.log(json);
var dashboard_html = dashboardTemplate({"dashboard": json.value,
"isadmin": isadmin});
"isadmin": isadmin,
"dashboardRecent" : dashboardRecent});
$('#page-body').html(dashboard_html);
$('#last-refresh').data("time",new Date());
......
<div class='panel panel-default' id='experiments-latest-panel'>
<div class="panel-heading">
<h5><center>Latest Experiments</center></h5>
</div>
<div class='panel-body panel-body-dashboard'>
<table class="table table-condensed table-bordered table-dashboard"
id='experiments-latest-table'>
<thead>
<tr>
<th>Name</th>
<th>Creator</th>
<th>Profile</th>
<th>Cluster</th>
<th>PCs</th>
<th>Created</th>
</tr>
</thead>
<tbody>
<% _.each(dashboard.latest, function(value, key) { %>
<tr>
<% if (!isadmin) { %>
<td><%- value.name %></td>
<td><%- value.creator %></td>
<% } %>
<% if (isadmin) { %>
<td><a href="status.php?uuid=<%- value.uuid %>">
<%- value.name %></a></td>
<td><a href="https://www.emulab.net/showuser.php3?user=<%- value.creator_idx %>"><%- value.creator %></a></td>
<% } %>
<td><a href="show-profile.php?uuid=<%- value.profile_uuid %>">
<%- value.profile_name %></a></td>
<td><%- value.cluster %></td>
<td><%- value.physnode_count %></td>
<td class="format-date"><%- value.created %></td>
</tr>
<% }); %>
</tbody>
</table>
</div>
</div>
......@@ -77,46 +77,7 @@
</div>
</div>
<div class='col-sm-7'>
<div class='panel panel-default' id='experiments-latest-panel'>
<div class="panel-heading">
<h5><center>Latest Experiments</center></h5>
</div>
<div class='panel-body panel-body-dashboard'>
<table class="table table-condensed table-bordered table-dashboard"
id='experiments-latest-table'>
<thead>
<tr>
<th>Name</th>
<th>Creator</th>
<th>Profile</th>
<th>Cluster</th>
<th>PCs</th>
<th>Created</th>
</tr>
</thead>
<tbody>
<% _.each(dashboard.latest, function(value, key) { %>
<tr>
<% if (!isadmin) { %>
<td><%- value.name %></td>
<td><%- value.creator %></td>
<% } %>
<% if (isadmin) { %>
<td><a href="status.php?uuid=<%- value.uuid %>">
<%- value.name %></a></td>
<td><a href="https://www.emulab.net/showuser.php3?user=<%- value.creator_idx %>"><%- value.creator %></a></td>
<% } %>
<td><a href="show-profile.php?uuid=<%- value.profile_uuid %>">
<%- value.profile_name %></a></td>
<td><%- value.cluster %></td>
<td><%- value.physnode_count %></td>
<td class="format-date"><%- value.created %></td>
</tr>
<% }); %>
</tbody>
</table>
</div>
</div>
<%= dashboardRecent({"dashboard": dashboard, "isadmin": isadmin}) %>
</div>
</div>
<div class='row'>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment