Commit da2bc0a1 authored by Timothe Litt's avatar Timothe Litt
Browse files

Fix ISC-Bugs 45340: Statschannel XSL for zones, Traffic

In ISC-Bugs 45340, I wrote:

The Statistics channel offers links to Zones and Traffic.
Both produce valid data, but display as blank pages with
a web browser.

Zones never had XSL (I provided the original
implementation, but punted on the XSL).

Traffic has XSL, but it wasn't updated to reflect the
split between IPv4 and IPv6 data.

I've picked up enough XSL to fix my original omission,
and as penance for my sloth, fixed the Traffic bug as well.
parent e0222812
......@@ -15,6 +15,15 @@
<xsl:template match="statistics[@version=&quot;3.11&quot;]">
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript">
$(function($) {
var wid=0;
$('table.zones').each(function(i) { if( $(this).width() > wid ) wid = $(this).width(); return true; });
$('table.zones').css('min-width', wid );
});
</script>
<xsl:if test="system-property('xsl:vendor')!='Transformiix'">
<!-- Non Mozilla specific markup -->
<script type="text/javascript" src="https://www.google.com/jsapi"/>
......@@ -221,6 +230,22 @@
background-color: rgb(1,169,206);
color: #ffffff;
}
table.zones {
border: 1px solid grey;
}
table.zones td {
text-align: right;
font-family: monospace;
}
table.zones td:nth-child(2) {
text-align: center;
}
table.zones td:nth-child(3) {
text-align: left;
}
table.zones tr:hover{
background-color: #99ddff;
}
td, th {
padding-right: 5px;
......@@ -319,6 +344,30 @@
</tr>
</table>
<br/>
<xsl:if test="views/view/zones/zone">
<h2>Configured zones</h2>
<xsl:for-each select="views/view">
<h3>View <xsl:value-of select="@name"/></h3>
<table class="zones">
<thead><tr><th>Zone</th><th>Class</th><th>Type</th><th>Serial</th></tr></thead>
<tbody>
<xsl:for-each select="zones/zone">
<xsl:variable name="css-class15">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when>
<xsl:otherwise>odd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr class="{$css-class15}">
<td><xsl:value-of select="@name"/></td>
<td><xsl:value-of select="@rdataclass"/></td>
<td><xsl:value-of select="type"/></td>
<td><xsl:value-of select="serial"/></td></tr>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>
</xsl:if>
<xsl:if test="server/counters[@type=&quot;opcode&quot;]/counter[. &gt; 0]">
<xsl:if test="system-property('xsl:vendor')!='Transformiix'">
<h2>Incoming Requests by DNS Opcode</h2>
......@@ -611,13 +660,13 @@
<br/>
</xsl:if>
</xsl:for-each>
<xsl:if test="traffic/udp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0] or traffic/udp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0] or traffic/tcp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0] or traffic/tcp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0]">
<xsl:if test="traffic//udp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0] or traffic//udp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0] or traffic//tcp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0] or traffic//tcp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0]">
<h2>Traffic Size Statistics</h2>
</xsl:if>
<xsl:if test="traffic/udp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0]">
<xsl:if test="traffic//udp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0]">
<h4>UDP Requests Received</h4>
<table class="counters">
<xsl:for-each select="traffic/udp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0]">
<xsl:for-each select="traffic//udp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0]">
<xsl:variable name="css-class7">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when>
......@@ -625,6 +674,7 @@
</xsl:choose>
</xsl:variable>
<tr class="{$css-class7}">
<th><xsl:value-of select="local-name(../../..)"/></th>
<th>
<xsl:value-of select="@name"/>
</th>
......@@ -636,10 +686,10 @@
</table>
<br/>
</xsl:if>
<xsl:if test="traffic/udp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0]">
<xsl:if test="traffic//udp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0]">
<h4>UDP Responses Sent</h4>
<table class="counters">
<xsl:for-each select="traffic/udp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0]">
<xsl:for-each select="traffic//udp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0]">
<xsl:variable name="css-class7">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when>
......@@ -647,6 +697,7 @@
</xsl:choose>
</xsl:variable>
<tr class="{$css-class7}">
<th><xsl:value-of select="local-name(../../..)"/></th>
<th>
<xsl:value-of select="@name"/>
</th>
......@@ -658,10 +709,10 @@
</table>
<br/>
</xsl:if>
<xsl:if test="traffic/tcp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0]">
<xsl:if test="traffic//tcp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0]">
<h4>TCP Requests Received</h4>
<table class="counters">
<xsl:for-each select="traffic/tcp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0]">
<xsl:for-each select="traffic//tcp/counters[@type=&quot;request-size&quot;]/counter[.&gt;0]">
<xsl:variable name="css-class7">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when>
......@@ -669,6 +720,7 @@
</xsl:choose>
</xsl:variable>
<tr class="{$css-class7}">
<th><xsl:value-of select="local-name(../../..)"/></th>
<th>
<xsl:value-of select="@name"/>
</th>
......@@ -680,10 +732,10 @@
</table>
<br/>
</xsl:if>
<xsl:if test="traffic/tcp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0]">
<xsl:if test="traffic//tcp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0]">
<h4>TCP Responses Sent</h4>
<table class="counters">
<xsl:for-each select="traffic/tcp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0]">
<xsl:for-each select="traffic//tcp/counters[@type=&quot;response-size&quot;]/counter[.&gt;0]">
<xsl:variable name="css-class7">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when>
......@@ -691,6 +743,7 @@
</xsl:choose>
</xsl:variable>
<tr class="{$css-class7}">
<th><xsl:value-of select="local-name(../../..)"/></th>
<th>
<xsl:value-of select="@name"/>
</th>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment