Subversion Repositories bacoAlunos

Rev

Rev 1085 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@ page import="jomm.dao.impl.AbstractDao" %>
<%@ page import="pt.estgp.estgweb.domain.JobServiceTaskScheduler" %>
<%@ page import="pt.estgp.estgweb.domain.dao.DaoFactory" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.domain.JobServiceTaskImpl" %>
<%@ page import="jomm.utils.MessageResources" %>
<%@ 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/>

<!--<jsp:include page="/layout/scriptsBootstrapSoft.jsp"/>-->


<script>

    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);
        });

    }
    $(document).ready(function(){
        updateStatus();

    });
</script>

<%

%>


<div class="container-fluid">
    <div class="panel panel-default">
        <div class="panel-heading">
            <bean:message key="configuration.taskLog"/>
        </div>
        <div class="panel-body">
            <table class="tablesorter tablesortersimple">
                <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>
                                            ${taskParam.name}
                                           </td>
                                           <td>
                                            ${taskParam.object}
                                           </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">
                <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 id="screens"></div>
            <a href="<%=request.getContextPath()%>/logServiceStream/${SchedulleTasksForm.jobServiceTask.logFilePath}">Download Log Completo</a>
        </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 .buttons {
            float: right;
        }

        .header h2 {
            margin: 0;
        }

        .screen {
            height: 200px;
            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;
        }
    </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>



</div>