]> SALOME platform Git repositories - tools/sat.git/blob - src/xsl/job_report.xsl
Salome HOME
link to remote machine logs in the matrix of jobs command
[tools/sat.git] / src / xsl / job_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 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     .OK2day       { color:#00AA00; font-weight: bold; }
39     .KO2day       { color:#FF0000; font-weight: bold; }
40     .KF2day       { color:#FF8000; font-weight: bold; }
41     .NA2day       { color:#BBBBBB; font-weight: bold; }
42
43     .new          { background-color:#FF5500; }
44     .day          { background-color:#F0E25A; font-size: small; }
45     .week         { background-color:#E0E0E0; font-size: small; }
46     .month        { background-color:#C0C0C0; font-size: small; }
47     .old          { background-color:#A0A0A0; font-size: small; }
48     .lnk          { font-size: 12px; }
49     .lnk a        { text-decoration: none; }
50     .note         { text-align : right; font-style: italic; font-size: small; }
51     table.legend  { margin:0px;
52                     padding:5px;
53                     border-collapse:collapse;
54                     empty-cells : show;
55                     border : solid 1px;
56                   }
57     table.summary { width : 100%;
58                     margin:0px;
59                     padding:0px;
60                     border-collapse:collapse;
61                     empty-cells : show;
62                     border : solid 1px;
63                   }
64     td.summary    { border : solid 0px; font-size: medium; }
65     td            { border : solid 1px; }
66     td.small      { border : solid 1px; font-size: small; }
67     th            { font-size: small; border: solid 1px;  }
68     h2            { text-align : center; }
69     h3            { text-align : left; font-size: small; font-weight: normal; }
70     h4            { text-align : left; font-size: small; font-weight: bold; display: inline; }
71     h_err         { text-align : left; font-size: small; font-weight: normal; display: inline;  color: red; }
72     .legend       { text-align : center; } 
73     .def        { font-family: Arial, Verdana, "Times New Roman", Times, serif;}
74    
75 </style>
76
77 <xsl:if test="//JobsReport/infos/@JobsCommandStatus='running'">
78   <meta http-equiv="refresh" content="1"></meta>
79 </xsl:if>
80
81 <script language="JavaScript"><![CDATA[
82       function Toggle(id) {
83         collapseall();
84         var element = document.getElementById(id);
85
86          if ( element.style.display == "none" )
87             element.style.display = "block";
88          else 
89             element.style.display = "none";
90       }
91
92       function collapseall() {
93         var x=document.getElementsByTagName("div");
94         for (i=0;i<x.length;i++)
95         {
96             if ( x[i].id != "matrix" )
97                 x[i].style.display = "none";
98         }
99       }
100     ]]>
101 </script>
102
103 </head>
104
105 <body class="def">
106     <table width="100%">
107         <tr>
108             <td class="summary">
109                 <h2>Jobs Report</h2>
110             </td>
111             <td class="summary" align="right" valign="bottom" width="300">
112                 <xsl:for-each select="//JobsReport/infos">
113                   <span class="note"><xsl:value-of select="@name" />: <xsl:value-of select="@value" /></span>
114                 </xsl:for-each>
115             </td>
116         </tr>
117     </table>
118        
119     <div id="matrix">
120     <table class="summary">
121       <!-- header -->
122       <tr bgcolor="#9acd32">
123       <th></th>
124       <xsl:for-each select="//JobsReport/applications/application">
125         <xsl:sort select="@name" />
126         <th><xsl:value-of select="@name" /></th>
127       </xsl:for-each>
128       </tr>
129       
130       <!-- for all hosts -->
131       <xsl:for-each select="//JobsReport/distributions/dist">
132         <xsl:sort select="@name" />
133         <xsl:variable name="curr_distname" select="@name" />
134         <tr>
135         <td align="center"><xsl:value-of select="$curr_distname" /></td>
136         <!-- for all jobs -->
137         <xsl:for-each select="//JobsReport/applications/application">
138           <xsl:sort select="@name" />
139           <xsl:variable name="curr_appli" select="@name" />
140           <td align="center" class="small">
141               <!-- get the job for current host and current appli -->
142               <xsl:for-each select="//JobsReport/jobs/job">
143                   <xsl:sort select="@name" />
144                   <xsl:if test="application/.=$curr_appli and distribution/.=$curr_distname">
145                       <a href="#"><xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@name"/>')</xsl:attribute>
146                       <xsl:value-of select="@name"/></a>&#160; : 
147                       <xsl:value-of select="state/." />
148                       <xsl:if test="not(remote_log_file_path/.='nothing')">
149                             <a>
150                                 <xsl:attribute name="title">remote log</xsl:attribute>
151                                 <xsl:attribute name="href"><xsl:value-of select="remote_log_file_path/."/></xsl:attribute>
152                                 remote log
153                             </a>
154                       </xsl:if> 
155                       <br/>
156                   </xsl:if> 
157                   
158               </xsl:for-each>
159           </td>
160         </xsl:for-each>
161         </tr>
162       </xsl:for-each>
163     </table>
164     
165     <h3>
166     <xsl:choose>
167         <xsl:when test="//JobsReport/infos/@JobsCommandStatus='running'">
168             Command status : running <img src="running.gif"></img>
169         </xsl:when>
170         
171         <xsl:otherwise>
172             Command status : <xsl:value-of select="//JobsReport/infos/@JobsCommandStatus/."/>
173         </xsl:otherwise>
174     </xsl:choose>
175     </h3>
176     </div>
177
178     
179     <!-- Loop over the jobs in order to find what job was called in the link "onclick". Display information about that job -->
180     <xsl:for-each select="//JobsReport/jobs/job">
181       <xsl:variable name="curr_job_name" select="@name" />
182       <div style="display:none"><xsl:attribute name="id"><xsl:value-of select="@name"/></xsl:attribute>
183           <!-- Display job name -->
184           <h4>Name : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/@name"/>
185           <br/>
186           <!-- Display the job attributes -->
187           <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"/>
188           <br/>
189           <h4>User : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/user"/>
190           <br/>
191           <h4>Timeout : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/timeout"/>
192           <br/>
193           <h4>Begin : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/begin"/>
194           <br/>
195           <h4>End : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/end"/>
196           <br/>
197           <h4>Commands : </h4><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/commands"/>
198           <br/>
199           <h4>Out : </h4><PRE><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/out"/></PRE>
200           <br/>
201           <h4>Err : </h4><h_err><PRE><xsl:value-of select="//JobsReport/jobs/job[@name=$curr_job_name]/err"/></PRE></h_err>
202       </div>
203     </xsl:for-each>
204
205 </body>
206
207 </html>
208 </xsl:template>
209 </xsl:stylesheet>