Commit 66cdb71a by Sarina Canelake

Merge pull request #6609 from mitocw/bdero/fix-detailed-gitlogs

Collapsible import logs in sysadmin dashboard
parents a6fc9ab6 a6dc7061
...@@ -12,6 +12,23 @@ ...@@ -12,6 +12,23 @@
<%static:css group='style-course'/> <%static:css group='style-course'/>
<script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.axislabels.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.axislabels.js')}"></script>
<script>
$(function() {
$(".toggle-import-log").click(function(e) {
var self = $(this);
var id = self.data("import-log");
$("#import-log-" + id).toggle({
duration: 200
});
if (self.html() === "[ + ]") {
self.html("[ &#8722; ]");
} else {
self.html("[ + ]");
}
e.preventDefault();
});
});
</script>
</%block> </%block>
<style type="text/css"> <style type="text/css">
a.active-section { a.active-section {
...@@ -42,6 +59,9 @@ table.stat_table td { ...@@ -42,6 +59,9 @@ table.stat_table td {
border-color: #666666; border-color: #666666;
background-color: #ffffff; background-color: #ffffff;
} }
.import-log {
display: none;
}
a.selectedmode { background-color: yellow; } a.selectedmode { background-color: yellow; }
...@@ -82,11 +102,11 @@ textarea { ...@@ -82,11 +102,11 @@ textarea {
%endif %endif
%endif %endif
<table class="stat_table"> <table class="stat_table" width="100%">
<thead> <thead>
<tr> <tr>
<th>${_('Date')}</th> <th width="15%">${_('Date')}</th>
<th>${_('Course ID')}</th> <th width="15%">${_('Course ID')}</th>
## Translators: Git is a version-control system; see http://git-scm.com/about ## Translators: Git is a version-control system; see http://git-scm.com/about
<th>${_('Git Action')}</th> <th>${_('Git Action')}</th>
</tr> </tr>
...@@ -96,11 +116,11 @@ textarea { ...@@ -96,11 +116,11 @@ textarea {
if course_id == None: if course_id == None:
logs = cilset[:10] logs = cilset[:10]
else: else:
logs = cilset[:2] logs = cilset[:5]
cil = None cil = None
%> %>
% for cil in logs: % for index, cil in enumerate(logs):
<% <%
# Appropriate datetime string for current locale and timezone # Appropriate datetime string for current locale and timezone
date = get_time_display(cil.created.replace(tzinfo=UTC), date = get_time_display(cil.created.replace(tzinfo=UTC),
...@@ -108,27 +128,38 @@ textarea { ...@@ -108,27 +128,38 @@ textarea {
%> %>
<tr> <tr>
<td>${date}</td> <td>${date}</td>
<td><a href="${reverse('gitlogs_detail', kwargs={'course_id': unicode(cil.course_id)})}">${cil.course_id | h}</a></td> <td>
<td>${cil.git_log}</td> <a href="${reverse('gitlogs_detail', kwargs={'course_id': unicode(cil.course_id)})}">
</tr> ${cil.course_id | h}
%endfor </a>
## Show the full log if viewing information about a specific course </td>
%if course_id is not None: <td>
<tr> %if course_id is not None:
<td colspan="3"> <a class="toggle-import-log" data-import-log="${index}" href="#">[ + ]</a>
<pre> %endif
%if cil is not None: ${cil.git_log}
${cil.import_log | h}
%else:
## Translators: git is a version-control system; see http://git-scm.com/about
${_('No git import logs have been recorded for this course.')}
%endif
</pre>
</td> </td>
</tr> </tr>
%endif
## Show the full log of the latest import if viewing logs for a specific course
%if course_id is not None:
<tr class="import-log" id="import-log-${index}">
<td colspan="3">
<pre>
${cil.import_log | h}
</pre>
</td>
</tr>
%endif
%endfor
</tbody> </tbody>
</table> </table>
## If viewing a single course and there are no logs available, let the user know
%if course_id is not None and cil is None:
## Translators: git is a version-control system; see http://git-scm.com/about
${_('No git import logs have been recorded for this course.')}
%endif
</section> </section>
</div> </div>
</section> </section>
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