Rev 1349 | Rev 1404 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@ page import="jomm.utils.MessageResources" %>
<%@ page import="pt.estgp.estgweb.domain.JobServiceTaskImpl" %>
<%@ page import="pt.estgp.estgweb.utils.ConfigProperties" %>
<%@ page import="jomm.utils.BytesUtils" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<%@ taglib prefix="hmlt" uri="http://jakarta.apache.org/struts/tags-html" %>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
<jsp:useBean id="SchedulleTasksForm" type="pt.estgp.estgweb.web.form.configuration.SchedulleTasksForm" scope="request"/>
<jomm:messages/>
<html:errors/>
<%
String logid = "log" + BytesUtils.generateHexKey();
%>
<%--
TaskLog styles
normal or nothing in attribute
task-log-xs (only progress bar and log link download url)
task-log-sm (only progress bar,screen log small and log download url)
task-log-md (table info, progress bar, screen log small and log download url)
task-log-lg (panel title, table info, progress bar, screen log small and log download url)
---%>
<style>
.task-log.task-log-xs *.task-log-panel > .panel-heading,
.task-log.task-log-sm *.task-log-panel > .panel-heading,
.task-log.task-log-md *.task-log-panel > .panel-heading
{
display: none !important;
}
.task-log.task-log-xs *.task-log-table,
.task-log.task-log-sm *.task-log-table
{
display: none !important;
}
.task-log.task-log-sm *.task-log-screens
{
height: 50px !important;
font-size: 0.8em !important;
}
/*.task-log.task-log-sm *.task-log-screens-toogle,
.task-log.task-log-md *.task-log-screens-toogle,
.task-log.task-log-lg *.task-log-screens-toogle
{
display: none !important;
}*/
.task-log.task-log-sm *.task-log-screens .screen,
.task-log.task-log-xs *.task-log-screens .screen
{
height: 150px !important;
width: 100%;
font-size: 0.7em !important;
}
.task-log.task-log-sm .fullscreen *.task-log-screens .screen, /*Estilos pra a maximização da janela*/
.task-log.task-log-xs .fullscreen *.task-log-screens .screen
{
height: 300px !important;
width: 100%;
font-size: 0.85em !important;
}
.task-log.task-log-sm *.task-log-screens .header h2, .task-log-sm .task-log-screens .header a,
.task-log.task-log-xs *.task-log-screens .header h2, .task-log-xs .task-log-screens .header a{
font-size: 0.7em !important;
}
</style>
<script>
$(document).ready(function(){
$("*.task-log-screens").addClass("in");
$(".task-log.task-log-xs *.task-log-screens").removeClass("in");
/*
$(".task-log-xs .task-log-panel .panel .panel-heading").remove();
$(".task-log-sm .task-log-panel .panel .panel-heading").remove();
$(".task-log-md .task-log-panel .panel .panel-heading").remove();
$(".task-log-xs .task-log-table").remove();
$(".task-log-sm .task-log-table").remove();
$(".task-log-xs .task-log-screens").remove();
*/
});
</script>
<script>
/****START PROGRESS BAR*******/
$(document).ready(function(){
updateStatus();
});
/****************************/
var startStatus = "";
function updateStatus()
{
$.getJSON( "<%=request.getContextPath()%>/admin/schedullerTasksJson?service=loadLog&id=${SchedulleTasksForm.jobServiceTask.id}", function( data ) {
$("#serviceStartDateFormated").html(data.serviceStartDateFormated);
$("#serviceLastUpdateDateFormated").html(data.serviceLastUpdateDateFormated);
$("#serviceFinishDateFormated").html(data.serviceFinishDateFormated);
<%
for(JobServiceTaskImpl.JobStatus jS : JobServiceTaskImpl.JobStatus.values())
{
%>
if(data.status == "<%=jS.name()%>")
{
$("#status").html("<%=MessageResources.getInstance(request).getMessage("job.status."+jS.name())%>");
}
<%
}
%>
$("#status").attr("class", "jobStatus"+data.status);(data.status);
$("#progress").html(data.progress + "%");
$(".progress-bar").css("width",data.progress + "%");
$(".progress-bar").attr("aria-valuenow",data.progress);
$(".progress-bar").html(data.progress + "%");
if(data.status == "STARTED" || data.status == "PENDING")
setTimeout("updateStatus()",2000);
if(startStatus == "")
startStatus = data.status;
if(data.progress >= 100 && startStatus != data.status)
{
if($("#<%=logid%>").closest('.task-log').length > 0)
window.location.href = $("#<%=logid%>").closest('.task-log').data("href");
}
});
}
</script>
<%
%>
<div class="panel panel-default task-log-panel" id="task-maximize-panel">
<div class="panel-heading">
<bean:message key="configuration.taskLog"/>
</div>
<div class="panel-body">
<table class="tablesorter tablesortersimple task-log-table">
<thead>
<tr>
<th><bean:message key="configuration.task"/></th>
<th>Iniciado</th>
<th>Última Atualização</th>
<th>Terminado</th>
<th>Criado por</th>
<th>Parametros</th>
<th>Status</th>
<th>Progresso</th>
</tr>
</thead>
<tbody>
<tr>
<td><bean:message key="targetService.${SchedulleTasksForm.jobServiceTask.targetService}"/></td>
<td id="serviceStartDateFormated">${SchedulleTasksForm.jobServiceTask.serviceStartDateFormated}</td>
<td id="serviceLastUpdateDateFormated">${SchedulleTasksForm.jobServiceTask.serviceLastUpdateDateFormated}</td>
<td id="serviceFinishDateFormated">${SchedulleTasksForm.jobServiceTask.serviceFinishDateFormated}</td>
<td>${SchedulleTasksForm.jobServiceTask.createdBy.username}</td>
<td>
<table cellspacing="0" cellspadding="0">
<logic:iterate id="taskParam" name="SchedulleTasksForm" property="jobServiceTask.serviceTaskParameters" type="pt.estgp.estgweb.domain.JobServiceTaskParameter">
<tr>
<td>
<bean:message key="task.param.${taskParam.name}"/>
</td>
<td>
<logic:equal value="JOB_institution_KEY" name="taskParam" property="name">
<%=ConfigProperties.getProperty("institution.code.prefix." + taskParam.getObject())%>
</logic:equal>
<logic:notEqual value="JOB_institution_KEY" name="taskParam" property="name">
<logic:equal value="JOB_questionario_courseList_KEY" name="taskParam" property="name">
<a href="#" data-href="<%=request.getContextPath()%>/admin/questionarios/pedagogicoEstudante/cursosJobInfo.jsp?jobId=${SchedulleTasksForm.jobServiceTask.id}" data-title="Listagem de Cursos da Tarefa de Atribuição" data-toggle="modal" data-target="#modalAjaxRequest">
Lista Cursos
</a>
</logic:equal>
<logic:notEqual value="JOB_questionario_courseList_KEY" name="taskParam" property="name">
${taskParam.object}
</logic:notEqual>
</logic:notEqual>
</td>
</tr>
</logic:iterate>
</table>
</td>
<logic:notEmpty name="SchedulleTasksForm" property="jobServiceTask">
<td id="status" class="jobStatus${SchedulleTasksForm.jobServiceTask.status}">
<bean:message key="job.status.${SchedulleTasksForm.jobServiceTask.status}"/>
</td>
<td id="progress" style="text-align: right">
${SchedulleTasksForm.jobServiceTask.progress} %
</td>
</logic:notEmpty>
<logic:empty name="SchedulleTasksForm" property="jobServiceTask">
<td></td>
<td></td>
</logic:empty>
</tr>
</tbody>
</table>
<div class="progress task-log-progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0"
aria-valuemin="0" aria-valuemax="100" style="width:0%">
70%
</div>
</div>
<div class="task-log-screens-toogle">
<button type="button" class="btn btn-default" data-toggle="collapse" data-target="#<%=logid%>">Mostrar Log</button>
<button class="maximize-button btn btn-default" data-target="#task-maximize-panel" type="button">Maximizar/Minimizar</button>
</div>
<div id="<%=logid%>" class="task-log-screens collapse">
<div id="screens"></div>
<a href="<%=request.getContextPath()%>/logServiceStream/${SchedulleTasksForm.jobServiceTask.logFilePath}">Download Log Completo</a>
</div>
</div>
</div>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/logtailer/logtail.js"></script>
<style>
.header {
background-color: #ccc;
padding: 0.5em;
font-family: sans-serif;
}
.header h2{
font-size: 1em;
}
.header .buttons {
float: right;
}
.header h2 {
margin: 0;
}
.screen {
height: 512px;
background-color: black;
padding: 4px;
overflow: auto;
margin-bottom: 20px;
}
.screen div {
padding: 0;
margin: 0;
border: 0;
background-color: black;
color: #bbb;
line-height: 1.2;
white-space: pre-wrap;
font-family: monospace;
font-size: 0.7em;
}
</style>
<script>
$(document).ready(function(){
//
// this is a list of logs we want to tail on this page. make sure these
// point to your own server instead of mine ;)
//
var logs = {
'Messages' : '<%=request.getContextPath()%>/logServiceStream/${SchedulleTasksForm.jobServiceTask.logFilePath}'
};
//
// for each one we create a log_handler() object, passed it a title,
// log URL and a parent element to put the log tailer into.
//
for (var i in logs){
new log_handler(i, logs[i], $('#screens'));
}
});
</script>