Subversion Repositories bacoAlunos

Rev

Rev 1077 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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