Salome HOME
begin fix sat test
[tools/sat.git] / src / xsl / jobs_board_report.xsl
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
5 <xsl:template match="/">
6 <html>
7 <head>
8 <title>Jobs <xsl:value-of select="//JobsReport/board/."/> report</title>
9 <style type="text/css">
10     <!-- styles for commands results -->
11     .OKday        { background-color:#20FF20; }
12     .OKweek       { background-color:#90EE90; font-size: 11px; }
13     .OKmonth      { background-color:#90EE90; font-size: 10px; }
14     .OKold        { background-color:#90EE90; font-size: 9px; }
15
16     .KOday        { background-color:#F20000; }
17     .KOweek       { background-color:#FFC0CB; font-size: 11px; }
18     .KOmonth      { background-color:#FFC0CB; font-size: 10px; }
19     .KOold        { background-color:#FFC0CB; font-size: 9px; }
20
21     .KFday        { background-color:#FFA500; }
22     .KFweek       { background-color:#FAC86D; font-size: 11px; }
23     .KFmonth      { background-color:#FAC86D; font-size: 10px; }
24     .KFold        { background-color:#FAC86D; font-size: 9px; }
25
26     .NAday        { background-color:#BBBBBB; }
27     .NAweek       { background-color:#BFBFBF; font-size: 11px; }
28     .NAmonth      { background-color:#CACACA; font-size: 10px; }
29     .NAold        { background-color:#CFCFCF; font-size: 9px; }
30
31     .label        { font-weight: bold; }
32
33     <!-- styles for links in matrix -->
34     .OK2          { color:#00AA00; font-weight: normal;}
35     .KO2          { color:#FF0000; font-weight: normal;}
36     .KF2          { color:#FF8000; font-weight: normal;}
37     .NA2          { color:#BBBBBB; font-weight: normal;}
38     .TO2          { color:GoldenRod; font-weight: normal;}
39     .RUNNING2     { color:LightSeaGreen; font-weight: bold; }
40     .OK2day       { color:#00AA00; font-weight: bold; }
41     .KO2day       { color:#FF0000; font-weight: bold; }
42     .KF2day       { color:#FF8000; font-weight: bold; }
43     .NA2day       { color:#BBBBBB; font-weight: bold; }
44     .TO2day       { color:GoldenRod; font-weight: bold; }
45
46     .new          { background-color:#FF5500; }
47     .day          { background-color:#F0E25A; font-size: small; }
48     .week         { background-color:#E0E0E0; font-size: small; }
49     .month        { background-color:#C0C0C0; font-size: small; }
50     .old          { background-color:#A0A0A0; font-size: small; }
51     .lnk          { font-size: 12px; }
52     .lnk a        { text-decoration: none; }
53     .note         { text-align : right; font-style: italic; font-size: small; }
54     table.legend  { margin:0px;
55                     padding:5px;
56                     border-collapse:collapse;
57                     empty-cells : show;
58                     border : solid 1px;
59                     font-size: xx-small;
60                   }
61     table.summary { width : 100%;
62                     margin:0px;
63                     padding:0px;
64                     border-collapse:collapse;
65                     empty-cells : show;
66                     border : solid 1px;
67                   }
68     td.summary    { border : solid 0px; font-size: medium; }
69     td            { border : solid 1px; }
70     td.small      { border : solid 1px; font-size: small; }
71     th            { font-size: small; border: solid 1px;  }
72     h2            { text-align : center; }
73     h3            { text-align : left; font-size: small; font-weight: normal; }
74     h4            { text-align : left; font-size: small; font-weight: bold; display: inline; }
75     h_err         { text-align : left; font-size: small; font-weight: normal; display: inline;  color: red; }
76     .legend       { text-align : center; } 
77     .def        { font-family: Arial, Verdana, "Times New Roman", Times, serif;}
78    
79 </style>
80
81 <xsl:if test="//JobsReport/infos/@JobsCommandStatus='running'">
82   <meta http-equiv="refresh" content="120"></meta>
83 </xsl:if>
84
85 <script language="JavaScript"><![CDATA[
86       function Toggle(id) {
87         collapseall();
88         var element = document.getElementById(id);
89
90          if ( element.style.display == "none" )
91             element.style.display = "block";
92          else 
93             element.style.display = "none";
94       }
95
96       function collapseall() {
97         var x=document.getElementsByTagName("div");
98         for (i=0;i<x.length;i++)
99         {
100             if ( x[i].id != "matrix" )
101                 x[i].style.display = "none";
102         }
103       }
104     ]]>
105 </script>
106
107 </head>
108
109 <body class="def">
110     <table width="100%">
111         <tr>
112             <td class="summary">
113                 <h2>Compilation report <xsl:value-of select="//JobsReport/board/."/></h2>
114             </td>
115             <td class="summary" align="right" valign="bottom" width="300">
116                 <span class="note"><xsl:value-of select="//JobsReport/infos/@name" />: <xsl:value-of select="//JobsReport/infos/@value" /></span>
117             </td>
118         </tr>
119     </table>
120
121     <a href="#">
122         <xsl:attribute name="onclick">javascript:Toggle('legend')</xsl:attribute>
123         <xsl:attribute name="title">legend</xsl:attribute>
124         legend
125     </a>
126     <br/>
127     <a href="#">
128         <xsl:attribute name="onclick">javascript:Toggle('history')</xsl:attribute>
129         <xsl:attribute name="title">history</xsl:attribute>
130         history
131     </a>
132     <br/>
133     <br/>
134     
135     <div id="matrix">
136     <table class="summary">
137       <!-- header -->
138       <tr bgcolor="#9acd32">
139       <th></th>
140       <xsl:for-each select="//JobsReport/applications/application">
141         <!--<xsl:sort select="@name" />-->
142         <th><xsl:value-of select="@name" /></th>
143       </xsl:for-each>
144       </tr>
145       
146       <!-- for all hosts -->
147       <xsl:for-each select="//JobsReport/distributions/dist">
148         <xsl:sort select="@name" />
149         <xsl:variable name="curr_distname" select="@name" />
150         <tr>
151         <td align="center"><xsl:value-of select="$curr_distname" /></td>
152         <!-- for all jobs -->
153         <xsl:for-each select="//JobsReport/applications/application">
154           <!--<xsl:sort select="@name" />-->
155           <xsl:variable name="curr_appli" select="@name" />
156           <td align="center" class="small">
157               <!-- get the job for current host and current appli -->
158               <xsl:for-each select="//JobsReport/jobs/job">
159               
160                   <xsl:sort select="@name" />
161                   <xsl:variable name="curr_job_name" select="@name" />
162                   <xsl:if test="application/.=$curr_appli and distribution/.=$curr_distname and board/.=//JobsReport/board/.">
163                       <!-- Change background color if it is an extra job (not defined in the input csv files) -->
164                       <xsl:if test="extra_job/.='yes'">
165                           <xsl:attribute name="bgcolor">FFCCCC</xsl:attribute>
166                       </xsl:if>
167                       <!-- Get job status and put a link -->
168                       <xsl:choose>
169                             <xsl:when test="state/.='SSH connection KO' or state/.='Cancelled'">
170                               <a href="#">
171                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
172                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
173                                     <xsl:attribute name="class">KO2day</xsl:attribute>
174                                     <xsl:value-of select="@name"/>
175                               </a>
176                             </xsl:when>
177                             <xsl:when test="contains(state/., 'Not launched')">
178                               <a href="#">
179                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
180                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
181                                     <xsl:attribute name="class">NA2day</xsl:attribute>
182                                     <xsl:value-of select="@name"/>
183                               </a>
184                             </xsl:when>
185                             <xsl:when test="contains(state/., 'running')">
186                               <a href="#">
187                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
188                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
189                                     <xsl:attribute name="class">RUNNING2</xsl:attribute>
190                                     <xsl:value-of select="@name"/>
191                               </a>
192                             </xsl:when>
193                             <xsl:when test="contains(state/., 'Finished')">
194                               <a href="#">
195                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
196                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
197                                     <xsl:attribute name="class">OK2day</xsl:attribute>
198                                     job
199                               </a>
200                             </xsl:when>
201                             <xsl:when test="contains(state/., 'Timeout')">
202                               <a href="#">
203                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
204                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
205                                     <xsl:attribute name="class">TO2day</xsl:attribute>
206                                     job
207                               </a>
208                             </xsl:when>
209                             <xsl:when test="state/.='Not today'">
210                               <a href="#">
211                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
212                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
213                                     <xsl:attribute name="class">NA2</xsl:attribute>
214                                     job
215                               </a>
216                             </xsl:when>
217                       </xsl:choose>
218                       <!--<xsl:value-of select="state/." />-->
219                       <xsl:if test="not(remote_log_file_path/.='nothing') and state/.!='Not today'">
220                              - 
221                             <a>
222                                 <xsl:attribute name="title">Begin : <xsl:value-of select="begin/."/>&#xA;End :    <xsl:value-of select="end/."/> </xsl:attribute>
223                                 <xsl:attribute name="href"><xsl:value-of select="remote_log_file_path/."/></xsl:attribute>
224                                 <xsl:if test="res/.='0'">
225                                    <xsl:attribute name="class">OK2day</xsl:attribute>
226                                 </xsl:if>
227                                 <xsl:if test="res/.!='0'">
228                                    <xsl:attribute name="class">KO2day</xsl:attribute>
229                                 </xsl:if>
230                                 <xsl:value-of select="host/."/>
231                                 <xsl:if test="port/.!='22'">
232                                  / <xsl:value-of select="port/."/>
233                                 </xsl:if>
234                             </a>
235                       </xsl:if>
236                     <xsl:if test="state/.='Not today'">
237                          - 
238                         <xsl:for-each select="//JobsReport/jobs/job[@name=$curr_job_name]/history/link">
239                         <xsl:sort select="@date" order="descending" />
240                         <xsl:if test="@last='yes'">
241                           <h4>
242                             <a>
243                               <xsl:attribute name="title">
244                                   <xsl:value-of select="concat(substring(@date, 7, 2), '/', substring(@date, 5, 2), '/', substring(@date,1,4))"/>
245                               </xsl:attribute>
246                               <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
247                               <xsl:if test="@res='0'">
248                                   <xsl:attribute name="class">OK2</xsl:attribute>
249                               </xsl:if>
250                               <xsl:if test="@res!='0'">
251                                   <xsl:attribute name="class">KO2</xsl:attribute>
252                               </xsl:if>
253                               <xsl:value-of select="../../host"/>
254                             </a>
255                           </h4>
256                         </xsl:if> 
257                         </xsl:for-each>
258                       </xsl:if>
259               <!--Add the link to the tests if there is any -->
260               <xsl:if test="(test_log_file_path) and (test_log_file_path/*)">
261               -     
262                 <xsl:for-each select="//JobsReport/jobs/job[@name=$curr_job_name]/test_log_file_path/path">
263                   <a>
264                                   <xsl:attribute name="title"><xsl:value-of select="@nb_fails"/> fails</xsl:attribute>
265                                   <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
266                                   <xsl:if test="@res='0'">
267                                       <xsl:attribute name="class">OK2day</xsl:attribute>
268                                   </xsl:if>
269                                   <xsl:if test="@res!='0'">
270                                       <xsl:attribute name="class">KO2day</xsl:attribute>
271                                   </xsl:if>
272                       test
273                   </a>
274                 </xsl:for-each>
275                       </xsl:if>              
276                       <br/>
277                       
278
279                   </xsl:if>
280                   
281               </xsl:for-each>
282               
283               <!-- get the missing jobs -->
284               <xsl:for-each select="//JobsReport/missing_jobs/job">    
285                     <xsl:if test="@distribution=$curr_distname and @application=$curr_appli">
286                         <xsl:attribute name="bgcolor">ffb8b8</xsl:attribute>
287                     </xsl:if>
288               </xsl:for-each>
289               <!-- get the missing jobs not today -->
290               <xsl:for-each select="//JobsReport/missing_jobs_not_today/job">    
291                     <xsl:if test="@distribution=$curr_distname and @application=$curr_appli">
292                         <xsl:attribute name="bgcolor">ffdbdb</xsl:attribute>
293                     </xsl:if>
294               </xsl:for-each>
295               
296           </td>
297         </xsl:for-each>
298         </tr>
299       </xsl:for-each>
300     </table>
301     
302     <h3>
303     <xsl:choose>
304         <xsl:when test="//JobsReport/infos/@JobsCommandStatus='running'">
305             Command status : running <img src="running.gif"></img>
306         </xsl:when>
307         
308         <xsl:otherwise>
309             Command status : <xsl:value-of select="//JobsReport/infos/@JobsCommandStatus/."/>
310         </xsl:otherwise>
311     </xsl:choose>
312     </h3>
313     </div>
314     <span class="note">input file: <xsl:value-of select="//JobsReport/@input_file" /></span>
315
316     <!-- Loop over the jobs in order to find what job was called in the link "onclick". Display information about that job -->
317     <xsl:for-each select="//JobsReport/jobs/job">
318       <xsl:variable name="curr_job_name" select="@name" />
319       <div style="display:none"><xsl:attribute name="id"><xsl:value-of select="@name"/></xsl:attribute>
320           <!-- Display job name -->
321           <h4>Name : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/@name"/>
322           <br/>
323           <xsl:if test="//JobsReport/jobs/job[@name=$curr_job_name]/state!='Not today'">
324                   <!-- Display the job attributes -->
325                   <h4>Hostname/port : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/host"/>/<xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/port"/>
326                   <br/>
327                   <h4>User : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/user"/>
328                   <br/>
329           </xsl:if>
330           <!-- Display history -->
331           <h4>History : </h4>
332           <br/>
333           <xsl:for-each select="//JobsReport/jobs/job[@name=$curr_job_name]/history/link">
334             <xsl:sort select="@date" order="descending" />
335             <h4>
336               <a>
337                 <xsl:attribute name="title">remote log</xsl:attribute>
338                 <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
339                 <xsl:if test="@res='0'">
340                     <xsl:attribute name="class">OK2</xsl:attribute>
341                 </xsl:if>
342                 <xsl:if test="@res!='0'">
343                     <xsl:attribute name="class">KO2</xsl:attribute>
344                 </xsl:if>
345                 <xsl:value-of select="@date"/>
346               </a>
347             </h4>
348             <br/>
349           </xsl:for-each>
350           <xsl:if test="//JobsReport/jobs/job[@name=$curr_job_name]/state!='Not today'">
351                   <h4>salomeTools path : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/sat_path"/>
352                   <br/>
353                   <h4>After : </h4>
354                   <a href="#">
355                         <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/after"/>')</xsl:attribute>
356                         <xsl:attribute name="title">Click to get job information</xsl:attribute>
357                         <xsl:attribute name="class">OK2</xsl:attribute>
358                         <xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/after"/>
359                   </a>
360                   <br/>
361                   <h4>Timeout : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/timeout"/>
362                   <br/>
363                   <h4>Begin : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/begin"/>
364                   <br/>
365                   <h4>End : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/end"/>
366                   <br/>
367                   <h4>Out : </h4><PRE><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/out"/></PRE>
368                   <br/>
369                   <h4>Err : </h4><h_err><PRE><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/err"/></PRE></h_err>
370           </xsl:if>
371           <h4>Status : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/state"/>
372           <br/>
373           <h4>Commands : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/commands"/>
374           <br/>
375       </div>
376     </xsl:for-each>
377
378     <div style="display:none"><xsl:attribute name="id">legend</xsl:attribute>
379       <td border="0"> 
380             <tr><td>job</td><td>result</td></tr>
381             <tr><td> <xsl:attribute name="class">OK2day</xsl:attribute>success today</td><td> <xsl:attribute name="class">OK2day</xsl:attribute>success today</td></tr>
382             <tr><td> <xsl:attribute name="class">OK2</xsl:attribute>success not today</td><td> <xsl:attribute name="class">OK2</xsl:attribute>success not today</td></tr>
383             <tr><td> <xsl:attribute name="class">KO2day</xsl:attribute>fail today</td><td> <xsl:attribute name="class">KO2day</xsl:attribute>fail today</td></tr>
384             <tr><td> <xsl:attribute name="class">KO2</xsl:attribute>fail not today</td><td> <xsl:attribute name="class">KO2</xsl:attribute>fail not today</td></tr>
385             <tr><td> <xsl:attribute name="class">TO2day</xsl:attribute>timeout today</td><td> <xsl:attribute name="class">KF2day</xsl:attribute>known failure today</td></tr>
386             <tr><td> <xsl:attribute name="class">RUNNING2</xsl:attribute>running</td><td> <xsl:attribute name="class">KF2</xsl:attribute>known failure not today</td></tr>
387             <tr><td> <xsl:attribute name="class">NA2day</xsl:attribute>To be launched</td></tr>
388             <tr><td> <xsl:attribute name="class">NA2</xsl:attribute>Not today</td></tr>
389             <tr>Missing job: <td> <xsl:attribute name="bgcolor">FFCCCC</xsl:attribute> </td></tr>
390             <tr>Extra job: <td> <xsl:attribute name="bgcolor">FFCCCC</xsl:attribute> Job name </td></tr>
391         </td>
392     </div>
393
394     <div style="display:none"><xsl:attribute name="id">history</xsl:attribute>
395       <xsl:for-each select="//JobsReport/history/link">
396         <xsl:sort select="@date" order="descending" />
397         <h4>
398           <a>
399             <xsl:attribute name="title">old board</xsl:attribute>
400             <xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
401             <xsl:value-of select="@date"/>
402           </a>
403         </h4>
404         <br/>
405       </xsl:for-each>
406     </div>
407     
408 </body>
409
410 </html>
411 </xsl:template>
412 </xsl:stylesheet>