diff options
Diffstat (limited to 'lib/srtgui/templates/mrj_section.html')
-rwxr-xr-x | lib/srtgui/templates/mrj_section.html | 194 |
1 files changed, 194 insertions, 0 deletions
diff --git a/lib/srtgui/templates/mrj_section.html b/lib/srtgui/templates/mrj_section.html new file mode 100755 index 00000000..480dfef2 --- /dev/null +++ b/lib/srtgui/templates/mrj_section.html @@ -0,0 +1,194 @@ +{% load static %} +{% load humanize %} +<script src="{% static 'js/mrjsection.js' %}"></script> + +{% if mru %} + <div id="latest-jobs"> + {% for job in mru %} + <div id="job-instance-{{job.id}}" data-latest-job-result="{{job.id}}" class="alert job-result {% if job.status == job.SUCCESS %}alert-success{% elif job.status == job.ERRORS %}alert-danger{% else %}alert-info{% endif %}"> + <!-- job title --> + <div class="row job-name"> + <div class="col-md-12"> + <small> + {{job.name}}{% if request.user.is_admin %} ({{job.id}}){% endif %} + </small> + </div> + </div> + + <div class="row" data-role="job-status-container"> + <div class="col-md-12"> + Loading... + </div> + </div> + </div> + {% endfor %} + </div> +{% endif %} + +<!-- job main template --> +<script id="job-template" type="text/x-jsrender"> + <div class="col-md-3"> + <!-- only show link for completed jobs --> + <%if state == 'Success' || state == 'Errors'%> + <%:targets%> + <%else%> + <span data-toggle="tooltip" id="job-message-done-<%:id%>" data-role="targets-text" title="Job: <%:targets%>"> + <%:targets%> + </span> + <%/if%> + </div> + + <div data-job-state="<%:state%>"> + <%if state == 'Success' || state == 'Errors'%> + <%include tmpl='#succeeded-or-failed-job-template'/%> + <%else state == 'Cancelling'%> + <%include tmpl='#cancelling-job-template'/%> + <%else state == 'NotStarted'%> + <%include tmpl='#starting-template'/%> + <%else state == 'InProgress'%> + <%include tmpl='#in-progress-job-template'/%> + <%else state == 'Cancelled'%> + <%include tmpl='#cancelled-job-template'/%> + <%/if%> + </div> +</script> + +<!-- queued job --> +<script id="queued-job-template" type="text/x-jsrender"> + <div class="col-md-5"> + <span class="glyphicon glyphicon-question-sign get-help get-help-blue" + title="This job is waiting for the background application to start"> + </span> + + Job queued + </div> + + <div class="col-md-4"> + <!-- cancel button --> + <%include tmpl='#cancel-template'/%> + </div> +</script> + +<!-- in progress job; at least one task finished --> +<script id="in-progress-job-template" type="text/x-jsrender"> + <!-- progress bar and task completion percentage --> + <div data-role="job-status" class="col-md-4 col-md-offset-1 progress-info"> + <!-- progress bar --> + <div class="progress" id="job-pc-done-title-<%:id%>"> + <div id="job-pc-done-bar-<%:id%>" + style="width: <%:tasks_complete_percentage%>%;" + class="progress-bar"> + </div> + </div> + </div> + + <div class="col-md-4 progress-info"> + <!-- task completion percentage --> + <span id="job-pc-done-<%:id%>"><%:tasks_complete_percentage%></span>% of + tasks complete + + <!-- cancel button --> + <%include tmpl='#cancel-template'/%> + </div> +</script> + +<!-- cancelling job --> +<script id="cancelling-job-template" type="text/x-jsrender"> + <div class="col-md-9"> + Cancelling the job ... + </div> +</script> + +<!-- succeeded or failed job --> +<script id="succeeded-or-failed-job-template" type="text/x-jsrender"> + <!-- completed_on --> + <div class="col-md-2"> + <%:completed_on%> + </div> + + <!-- errors --> + <div class="col-md-2"> + <%if errors%> + <span class="glyphicon glyphicon-minus-sign"></span> + <a href="<%:dashboard_errors_url%>" class="alert-link"> + <%:errors%> error<%:errors_pluralise%> + </a> + <%/if%> + </div> + + <!-- warnings --> + <div class="col-md-2"> + <%if warnings%> + <span class="glyphicon glyphicon-warning-sign job-warnings"></span> + <a href="<%:dashboard_warnings_url%>" class="alert-link job-warnings"> + <%:warnings%> warning<%:warnings_pluralise%> + </a> + <%/if%> + </div> + +<!-- <%if errors == 0 and warnings == 0%> + <div class="col-md-2"> + No Errors + </div> + <%/if%> +--> + + <!-- job time --> + <div class="col-md-3"> + Job time: + <span data-role="data-recent-job-jobtime-field"> + <b><%:jobtime%></b> + </span> + <form id="downloadbanner-log" enctype="multipart/form-data" method="post" >{% csrf_token %} + <input type="hidden" name="action" value="download-log"> + <input type="hidden" name="report_path" value="JOBLOG"> + <a href="/srtgui/joblog/<%:id%>" class="glyphicon glyphicon-download-alt submit-download-joblog" x-data="log" target="_blank"></a> + </form> + </div> +</script> + +<!-- cancelled job --> +<script id="cancelled-job-template" type="text/x-jsrender"> + <!-- job cancelled message --> + <div class="col-md-6"> + Job cancelled + </div> +</script> + +<!-- cancel button or no cancel icon --> +<script id="cancel-template" type="text/x-jsrender"> + <!-- cancel button --> + <span class="cancel-job-btn pull-right alert-link" + data-jobrequest-id="<%:id%>" data-request-url="<%:cancel_url%>"> + <span class="glyphicon glyphicon-remove-circle"></span> + Cancel + </span> +</script> + +<script> + $(document).ready(function () { + var ctx = { + } + + try { + mrjSectionInit(ctx); + $('.submit-download-joblog').click(function() { + alert("submit-download-joblog:"+this.getAttribute("x-data")); + $("#downloadbanner-"+this.getAttribute("x-data")).submit(); + }); + } catch (e) { + document.write("Sorry, An error has occurred loading this page"); + console.warn(e); + } + + $('.submit-downloadattachment').click(function() { + $("#downloadbanner-"+this.getAttribute("x-data")).submit(); + }); + + $('.submit-download-joblog').click(function() { + alert("submit-download-joblog:"+this.getAttribute("x-data")); + $("#downloadbanner-job").submit(); + }); + + }); +</script> |