]> SALOME platform Git repositories - tools/sat.git/blob - src/xsl/jobs_global_report.xsl
Salome HOME
Produce a global xml status of the command and several particular xml status for...
[tools/sat.git] / src / xsl / jobs_global_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 global 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:#509050; }
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                   }
60     table.summary { width : 100%;
61                     margin:0px;
62                     padding:0px;
63                     border-collapse:collapse;
64                     empty-cells : show;
65                     border : solid 1px;
66                   }
67     td.summary    { border : solid 0px; font-size: medium; }
68     td            { border : solid 1px; }
69     td.small      { border : solid 1px; font-size: small; }
70     th            { font-size: small; border: solid 1px;  }
71     h2            { text-align : center; }
72     h3            { text-align : left; font-size: small; font-weight: normal; }
73     h4            { text-align : left; font-size: small; font-weight: bold; display: inline; }
74     h_err         { text-align : left; font-size: small; font-weight: normal; display: inline;  color: red; }
75     .legend       { text-align : center; } 
76     .def        { font-family: Arial, Verdana, "Times New Roman", Times, serif; background-color:#FFFFCC;}
77    
78 </style>
79
80 <xsl:if test="//JobsReport/infos/@JobsCommandStatus='running'">
81   <meta http-equiv="refresh" content="1"></meta>
82 </xsl:if>
83
84 <script language="JavaScript"><![CDATA[
85       function Toggle(id) {
86         collapseall();
87         var element = document.getElementById(id);
88
89          if ( element.style.display == "none" )
90             element.style.display = "block";
91          else 
92             element.style.display = "none";
93       }
94
95       function collapseall() {
96         var x=document.getElementsByTagName("div");
97         for (i=0;i<x.length;i++)
98         {
99             if ( x[i].id != "matrix" )
100                 x[i].style.display = "none";
101         }
102       }
103     ]]>
104 </script>
105
106 </head>
107
108 <body class="def">
109     <table width="100%">
110         <tr>
111             <td class="summary">
112                 <h2>Jobs global report</h2>
113             </td>
114             <td class="summary" align="right" valign="bottom" width="300">
115                 <xsl:for-each select="//JobsReport/infos">
116                   <span class="note"><xsl:value-of select="@name" />: <xsl:value-of select="@value" /></span>
117                 </xsl:for-each>
118             </td>
119         </tr>
120     </table>
121        
122     <div id="matrix">
123     <table class="summary">
124      
125     <!-- for all machines -->
126     <xsl:for-each select="//JobsReport/hosts_ports/host_port">
127         <xsl:sort select="@name" />
128         <xsl:variable name="curr_host_port" select="@name" />
129         <tr>
130         <td align="center"><xsl:value-of select="$curr_host_port" /></td>
131           <!-- for all jobs -->
132           
133               <!-- get the jobs for the current machine -->
134               <xsl:for-each select="//JobsReport/jobs/job">
135               <xsl:sort select="@name" />
136               
137               <xsl:if test="concat(host/., ':', port/.)=$curr_host_port">
138                   <td align="center" class="small">
139                   <xsl:choose>
140                     <xsl:when test="state/.='SSH connection KO' or state/.='Cancelled'">
141                       <a href="#">
142                         <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
143                         <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
144                         <xsl:attribute name="class">KO2day</xsl:attribute>
145                         <xsl:value-of select="@name"/>
146                       </a>
147                     </xsl:when>
148                     <xsl:when test="contains(state/., 'Not launched')">
149                       <a href="#">
150                         <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
151                         <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
152                         <xsl:attribute name="class">NA2day</xsl:attribute>
153                         <xsl:value-of select="@name"/>
154                       </a>
155                     </xsl:when>
156                     <xsl:when test="contains(state/., 'running')">
157                       <a href="#">
158                         <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
159                         <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
160                         <xsl:attribute name="class">RUNNING2</xsl:attribute>
161                         <xsl:value-of select="@name"/>
162                       </a>
163                     </xsl:when>
164                     <xsl:when test="contains(state/., 'Finished')">
165                       <a href="#">
166                         <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
167                         <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
168                         <xsl:attribute name="class">OK2day</xsl:attribute>
169                         <xsl:value-of select="@name"/>
170                       </a>
171                     </xsl:when>
172                     <xsl:when test="contains(state/., 'Timeout')">
173                       <a href="#">
174                         <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
175                         <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
176                         <xsl:attribute name="class">TO2day</xsl:attribute>
177                         <xsl:value-of select="@name"/>
178                       </a>
179                     </xsl:when>
180                     <xsl:when test="state/.='Not today'">
181                       <a href="#">
182                         <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
183                         <xsl:attribute name="title"><xsl:value-of select="state/."/></xsl:attribute>
184                         <xsl:attribute name="class">NA2</xsl:attribute>
185                         <xsl:value-of select="@name"/>
186                       </a>
187                     </xsl:when>
188                   </xsl:choose>
189                   <!--<xsl:value-of select="state/." />-->
190                   <xsl:if test="not(remote_log_file_path/.='nothing') and state/.!='Not today'">
191                      : 
192                     <a>
193                     <xsl:attribute name="title">remote log</xsl:attribute>
194                     <xsl:attribute name="href"><xsl:value-of select="remote_log_file_path/."/></xsl:attribute>
195                     <xsl:if test="res/.='0'">
196                        <xsl:attribute name="class">OK2day</xsl:attribute>
197                     </xsl:if>
198                     <xsl:if test="res/.='1'">
199                        <xsl:attribute name="class">KO2day</xsl:attribute>
200                     </xsl:if>
201                     <xsl:value-of select="host/."/>/<xsl:value-of select="port/."/>
202                     </a>
203                   </xsl:if> 
204                   <br/>
205                   </td>
206               </xsl:if> 
207               
208               </xsl:for-each>
209           
210         </tr>
211     </xsl:for-each>
212     </table>
213     
214     <h3>
215     <xsl:choose>
216         <xsl:when test="//JobsReport/infos/@JobsCommandStatus='running'">
217             Command status : running <img src="running.gif"></img>
218         </xsl:when>
219         
220         <xsl:otherwise>
221             Command status : <xsl:value-of select="//JobsReport/infos/@JobsCommandStatus/."/>
222         </xsl:otherwise>
223     </xsl:choose>
224     </h3>
225     </div>
226
227     
228     <!-- Loop over the jobs in order to find what job was called in the link "onclick". Display information about that job -->
229     <xsl:for-each select="//JobsReport/jobs/job">
230       <xsl:variable name="curr_job_name" select="@name" />
231       <div style="display:none"><xsl:attribute name="id"><xsl:value-of select="@name"/></xsl:attribute>
232           <!-- Display job name -->
233           <h4>Name : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/@name"/>
234           <br/>
235           <xsl:if test="//JobsReport/jobs/job[@name=$curr_job_name]/state!='Not today'">
236                   <!-- Display the job attributes -->
237                   <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"/>
238                   <br/>
239                   <h4>User : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/user"/>
240                   <br/>
241                   <h4>salomeTools path : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/sat_path"/>
242                   <br/>
243                   <h4>After : </h4>
244                   <a href="#">
245                         <xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/after"/>')</xsl:attribute>
246                         <xsl:attribute name="title">Click to get job information</xsl:attribute>
247                         <xsl:attribute name="class">OK2</xsl:attribute>
248                         <xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/after"/>
249                   </a>
250                   <br/>
251                   <h4>Timeout : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/timeout"/>
252                   <br/>
253                   <h4>Begin : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/begin"/>
254                   <br/>
255                   <h4>End : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/end"/>
256                   <br/>
257                   <h4>Out : </h4><PRE><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/out"/></PRE>
258                   <br/>
259                   <h4>Err : </h4><h_err><PRE><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/err"/></PRE></h_err>
260           </xsl:if>
261           <h4>Status : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/state"/>
262           <br/>
263           <h4>Commands : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/commands"/>
264           <br/>
265       </div>
266     </xsl:for-each>
267
268 </body>
269
270 </html>
271 </xsl:template>
272 </xsl:stylesheet>