Subversion Repositories bacoAlunos

Rev

Rev 1310 | Rev 1327 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1312 jmachado 1
<%@ page import="jomm.utils.MessageResources" %>
1076 jmachado 2
<%@ page import="pt.estgp.estgweb.domain.JobServiceTaskImpl" %>
1312 jmachado 3
<%@ page import="pt.estgp.estgweb.utils.ConfigProperties" %>
1076 jmachado 4
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
5
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
6
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
7
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
8
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
9
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
10
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
11
<%@ taglib prefix="hmlt" uri="http://jakarta.apache.org/struts/tags-html" %>
12
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
13
<jsp:useBean id="SchedulleTasksForm" type="pt.estgp.estgweb.web.form.configuration.SchedulleTasksForm" scope="request"/>
14
<jomm:messages/>
15
<html:errors/>
16
 
1077 jmachado 17
<!--<jsp:include page="/layout/scriptsBootstrapSoft.jsp"/>-->
1076 jmachado 18
 
19
 
20
<script>
21
 
22
    function updateStatus()
23
    {
24
        $.getJSON( "<%=request.getContextPath()%>/admin/schedullerTasksJson?service=loadLog&id=${SchedulleTasksForm.jobServiceTask.id}", function( data ) {
25
 
26
            $("#serviceStartDateFormated").html(data.serviceStartDateFormated);
27
            $("#serviceLastUpdateDateFormated").html(data.serviceLastUpdateDateFormated);
28
            $("#serviceFinishDateFormated").html(data.serviceFinishDateFormated);
29
            <%
30
                for(JobServiceTaskImpl.JobStatus jS : JobServiceTaskImpl.JobStatus.values())
31
                {
32
            %>
33
                    if(data.status == "<%=jS.name()%>")
34
                    {
35
                        $("#status").html("<%=MessageResources.getInstance(request).getMessage("job.status."+jS.name())%>");
36
                    }
37
            <%
38
                }
39
            %>
40
            $("#status").attr("class", "jobStatus"+data.status);(data.status);
41
            $("#progress").html(data.progress + "%");
42
            $(".progress-bar").css("width",data.progress + "%");
43
            $(".progress-bar").attr("aria-valuenow",data.progress);
44
            $(".progress-bar").html(data.progress + "%");
45
 
1082 jmachado 46
            if(data.status == "STARTED" || data.status == "PENDING")
1076 jmachado 47
                setTimeout("updateStatus()",2000);
48
        });
49
 
50
    }
51
    $(document).ready(function(){
52
        updateStatus();
53
 
54
    });
55
</script>
56
 
57
<%
58
 
59
%>
60
 
61
 
62
<div class="container-fluid">
63
    <div class="panel panel-default">
64
        <div class="panel-heading">
65
            <bean:message key="configuration.taskLog"/>
66
        </div>
67
        <div class="panel-body">
1085 jmachado 68
            <table class="tablesorter tablesortersimple">
1076 jmachado 69
                <thead>
70
                    <tr>
71
                        <th><bean:message key="configuration.task"/></th>
72
                        <th>Iniciado</th>
73
                        <th>Última Atualização</th>
74
                        <th>Terminado</th>
75
                        <th>Criado por</th>
76
                        <th>Parametros</th>
77
                        <th>Status</th>
78
                        <th>Progresso</th>
79
                    </tr>
80
                </thead>
81
                <tbody>
82
                        <tr>
83
                            <td><bean:message key="targetService.${SchedulleTasksForm.jobServiceTask.targetService}"/></td>
84
                            <td id="serviceStartDateFormated">${SchedulleTasksForm.jobServiceTask.serviceStartDateFormated}</td>
85
                            <td id="serviceLastUpdateDateFormated">${SchedulleTasksForm.jobServiceTask.serviceLastUpdateDateFormated}</td>
86
                            <td id="serviceFinishDateFormated">${SchedulleTasksForm.jobServiceTask.serviceFinishDateFormated}</td>
87
                            <td>${SchedulleTasksForm.jobServiceTask.createdBy.username}</td>
88
                            <td>
89
                                <table cellspacing="0" cellspadding="0">
90
                                    <logic:iterate id="taskParam" name="SchedulleTasksForm" property="jobServiceTask.serviceTaskParameters" type="pt.estgp.estgweb.domain.JobServiceTaskParameter">
91
                                       <tr>
92
                                           <td>
1312 jmachado 93
                                               <bean:message key="task.param.${taskParam.name}"/>
1076 jmachado 94
                                           </td>
95
                                           <td>
1312 jmachado 96
                                               <logic:equal value="JOB_institution_KEY" name="taskParam" property="name">
97
                                                   <%=ConfigProperties.getProperty("institution.code.prefix." + taskParam.getObject())%>
98
                                               </logic:equal>
99
                                               <logic:notEqual value="JOB_institution_KEY" name="taskParam" property="name">
100
                                                   ${taskParam.object}
101
                                               </logic:notEqual>
1076 jmachado 102
                                           </td>
103
                                        </tr>
104
                                    </logic:iterate>
105
                                </table>
106
                            </td>
107
                            <logic:notEmpty name="SchedulleTasksForm" property="jobServiceTask">
108
                                <td id="status" class="jobStatus${SchedulleTasksForm.jobServiceTask.status}">
109
                                    <bean:message key="job.status.${SchedulleTasksForm.jobServiceTask.status}"/>
110
                                </td>
111
                                <td id="progress" style="text-align: right">
112
                                    ${SchedulleTasksForm.jobServiceTask.progress} %
113
                                </td>
114
                            </logic:notEmpty>
115
                            <logic:empty name="SchedulleTasksForm" property="jobServiceTask">
116
                                <td></td>
117
                                <td></td>
118
                            </logic:empty>
119
                        </tr>
120
                </tbody>
121
 
122
            </table>
123
            <div class="progress">
124
                <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0"
125
                     aria-valuemin="0" aria-valuemax="100" style="width:0%">
126
                    70%
127
                </div>
128
            </div>
129
            <div id="screens"></div>
130
            <a href="<%=request.getContextPath()%>/logServiceStream/${SchedulleTasksForm.jobServiceTask.logFilePath}">Download Log Completo</a>
131
        </div>
132
    </div>
133
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/logtailer/logtail.js"></script>
134
 
135
    <style>
136
 
137
        .header {
138
            background-color: #ccc;
139
            padding: 0.5em;
140
            font-family: sans-serif;
141
        }
142
 
143
        .header .buttons {
144
            float: right;
145
        }
146
 
147
        .header h2 {
148
            margin: 0;
149
        }
150
 
151
        .screen {
1312 jmachado 152
            height: 512px;
1076 jmachado 153
            background-color: black;
154
            padding: 4px;
155
            overflow: auto;
156
            margin-bottom: 20px;
157
        }
158
 
159
        .screen div {
160
            padding: 0;
161
            margin: 0;
162
            border: 0;
163
            background-color: black;
164
            color: #bbb;
165
            line-height: 1.2;
166
            white-space: pre-wrap;
167
            font-family: monospace;
168
        }
169
    </style>
170
    <script>
171
        $(document).ready(function(){
172
            //
173
            // this is a list of logs we want to tail on this page. make sure these
174
            // point to your own server instead of mine ;)
175
            //
176
            var logs = {
1079 jmachado 177
                'Messages'	: '<%=request.getContextPath()%>/logServiceStream/${SchedulleTasksForm.jobServiceTask.logFilePath}'
1076 jmachado 178
            };
179
            //
180
            // for each one we create a log_handler() object, passed it a title,
181
            // log URL and a parent element to put the log tailer into.
182
            //
183
            for (var i in logs){
184
                new log_handler(i, logs[i], $('#screens'));
185
            }
186
        });
187
    </script>
188
 
189
 
190
 
191
</div>