]> SALOME platform Git repositories - tools/sat.git/blob - src/xsl/jobs_board_report.xsl
Salome HOME
base
[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; }
35     .KO2          { color:#FF0000; }
36     .KF2          { color:#FF8000; }
37     .NA2          { color:#BBBBBB; }
38     .TO2          { color:GoldenRod; }
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="1"></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     Legend :
122     <table class="legend">
123       <td border="0"> 
124           <tr><td>job</td><td>result</td></tr>
125           <tr><td> <xsl:attribute name="class">OK2day</xsl:attribute>success today</td><td> <xsl:attribute name="class">OK2day</xsl:attribute>success today</td></tr>
126           <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>
127           <tr><td> <xsl:attribute name="class">KO2day</xsl:attribute>fail today</td><td> <xsl:attribute name="class">KO2day</xsl:attribute>fail today</td></tr>
128           <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>
129           <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>
130           <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>
131           <tr><td> <xsl:attribute name="class">NA2day</xsl:attribute>To be launched</td></tr>
132           <tr><td> <xsl:attribute name="class">NA2</xsl:attribute>Not today</td></tr>
133           <tr>Missing job: <td> <xsl:attribute name="bgcolor">FFCCCC</xsl:attribute> </td></tr>
134           <tr>Extra job: <td> <xsl:attribute name="bgcolor">FFCCCC</xsl:attribute> Job name </td></tr>
135       </td>
136     </table>
137     <br/>
138
139     <div id="matrix">
140     <table class="summary">
141       <!-- header -->
142       <tr bgcolor="#9acd32">
143       <th></th>
144       <xsl:for-each select="//JobsReport/applications/application">
145         <xsl:sort select="@name" />
146         <th><xsl:value-of select="@name" /></th>
147       </xsl:for-each>
148       </tr>
149       
150       <!-- for all hosts -->
151       <xsl:for-each select="//JobsReport/distributions/dist">
152         <xsl:sort select="@name" />
153         <xsl:variable name="curr_distname" select="@name" />
154         <tr>
155         <td align="center"><xsl:value-of select="$curr_distname" /></td>
156         <!-- for all jobs -->
157         <xsl:for-each select="//JobsReport/applications/application">
158           <xsl:sort select="@name" />
159           <xsl:variable name="curr_appli" select="@name" />
160           <td align="center" class="small">
161               <!-- get the job for current host and current appli -->
162               <xsl:for-each select="//JobsReport/jobs/job">
163               
164                   <xsl:sort select="@name" />
165                   
166                   <xsl:if test="application/.=$curr_appli and distribution/.=$curr_distname and board/.=//JobsReport/board/.">
167                       <!-- Change background color if it is an extra job (not defined in the input csv files) -->
168                       <xsl:if test="extra_job/.='yes'">
169                           <xsl:attribute name="bgcolor">FFCCCC</xsl:attribute>
170                       </xsl:if>
171                       <!-- Get job status and put a link -->
172                       <xsl:choose>
173                             <xsl:when test="state/.='SSH connection KO' or state/.='Cancelled'">
174                               <a href="#">
175                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
176                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
177                                     <xsl:attribute name="class">KO2day</xsl:attribute>
178                                     <xsl:value-of select="@name"/>
179                               </a>
180                             </xsl:when>
181                             <xsl:when test="contains(state/., 'Not launched')">
182                               <a href="#">
183                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
184                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
185                                     <xsl:attribute name="class">NA2day</xsl:attribute>
186                                     <xsl:value-of select="@name"/>
187                               </a>
188                             </xsl:when>
189                             <xsl:when test="contains(state/., 'running')">
190                               <a href="#">
191                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
192                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
193                                     <xsl:attribute name="class">RUNNING2</xsl:attribute>
194                                     <xsl:value-of select="@name"/>
195                               </a>
196                             </xsl:when>
197                             <xsl:when test="contains(state/., 'Finished')">
198                               <a href="#">
199                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
200                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
201                                     <xsl:attribute name="class">OK2day</xsl:attribute>
202                                     <xsl:value-of select="@name"/>
203                               </a>
204                             </xsl:when>
205                             <xsl:when test="contains(state/., 'Timeout')">
206                               <a href="#">
207                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
208                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
209                                     <xsl:attribute name="class">TO2day</xsl:attribute>
210                                     <xsl:value-of select="@name"/>
211                               </a>
212                             </xsl:when>
213                             <xsl:when test="state/.='Not today'">
214                               <a href="#">
215                                     <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
216                                     <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
217                                     <xsl:attribute name="class">NA2</xsl:attribute>
218                                     <xsl:value-of select="@name"/>
219                               </a>
220                             </xsl:when>
221                       </xsl:choose>
222                       <!--<xsl:value-of select="state/." />-->
223                       <xsl:if test="not(remote_log_file_path/.='nothing') and state/.!='Not today'">
224                              : 
225                             <a>
226                                 <xsl:attribute name="title">remote log</xsl:attribute>
227                                 <xsl:attribute name="href"><xsl:value-of select="remote_log_file_path/."/></xsl:attribute>
228                                 <xsl:if test="res/.='0'">
229                                    <xsl:attribute name="class">OK2day</xsl:attribute>
230                                 </xsl:if>
231                                 <xsl:if test="res/.!='0'">
232                                    <xsl:attribute name="class">KO2day</xsl:attribute>
233                                 </xsl:if>
234                                 <xsl:value-of select="host/."/>/<xsl:value-of select="port/."/>
235                             </a>
236                       </xsl:if> 
237                       <br/>
238                       
239
240                   </xsl:if>
241                   
242               </xsl:for-each>
243               
244               <!-- get the missing jobs -->
245               <xsl:for-each select="//JobsReport/missing_jobs/job">    
246                     <xsl:if test="@distribution=$curr_distname and @application=$curr_appli">
247                         <xsl:attribute name="bgcolor">FFCCCC</xsl:attribute>
248                     </xsl:if>
249               </xsl:for-each>
250               
251           </td>
252         </xsl:for-each>
253         </tr>
254       </xsl:for-each>
255     </table>
256     
257     <h3>
258     <xsl:choose>
259         <xsl:when test="//JobsReport/infos/@JobsCommandStatus='running'">
260             Command status : running <img src="running.gif"></img>
261         </xsl:when>
262         
263         <xsl:otherwise>
264             Command status : <xsl:value-of select="//JobsReport/infos/@JobsCommandStatus/."/>
265         </xsl:otherwise>
266     </xsl:choose>
267     </h3>
268     </div>
269
270     
271     <!-- Loop over the jobs in order to find what job was called in the link "onclick". Display information about that job -->
272     <xsl:for-each select="//JobsReport/jobs/job">
273       <xsl:variable name="curr_job_name" select="@name" />
274       <div style="display:none"><xsl:attribute name="id"><xsl:value-of select="@name"/></xsl:attribute>
275           <!-- Display job name -->
276           <h4>Name : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/@name"/>
277           <br/>
278           <xsl:if test="//JobsReport/jobs/job[@name=$curr_job_name]/state!='Not today'">
279                   <!-- Display the job attributes -->
280                   <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"/>
281                   <br/>
282                   <h4>User : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/user"/>
283                   <br/>
284                   <h4>salomeTools path : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/sat_path"/>
285                   <br/>
286                   <h4>After : </h4>
287                   <a href="#">
288                         <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/after"/>')</xsl:attribute>
289                         <xsl:attribute name="title">Click to get job information</xsl:attribute>
290                         <xsl:attribute name="class">OK2</xsl:attribute>
291                         <xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/after"/>
292                   </a>
293                   <br/>
294                   <h4>Timeout : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/timeout"/>
295                   <br/>
296                   <h4>Begin : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/begin"/>
297                   <br/>
298                   <h4>End : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/end"/>
299                   <br/>
300                   <h4>Out : </h4><PRE><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/out"/></PRE>
301                   <br/>
302                   <h4>Err : </h4><h_err><PRE><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/err"/></PRE></h_err>
303           </xsl:if>
304           <h4>Status : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/state"/>
305           <br/>
306           <h4>Commands : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/commands"/>
307           <br/>
308       </div>
309     </xsl:for-each>
310
311 </body>
312
313 </html>
314 </xsl:template>
315 </xsl:stylesheet>