More fun with snapshots.
[handlervirt.git] / default.xsl
blobce8689119eaed2e8998e487e309d86b94b60cc65
1 <?xml version="1.0"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3 <xsl:output method="html" indent="yes"/>
4 <xsl:template match="/domain">
5 <br />
6 <img src="/images/{./os/type}.png" alt="{./os/type}" style="float: left;"/>
7 <xsl:choose>
8 <xsl:when test="@id &gt; 0">
9 <a href="/virt/{translate(./name,'_', '/')}/virDomainShutdown" style="background-image: url('/images/power.png'); background-repeat: no-repeat; display: block; width: 45px; height: 47px; font-size: 0; float: left;">Shutdown</a>
10 <a href="/virt/{translate(./name,'_', '/')}/virDomainReboot" style="background-image: url('/images/reboot.png'); background-repeat: no-repeat; display: block; width: 45px; height: 47px; font-size: 0; float: left;">Reboot</a>
11 <a href="/virt/{translate(./name,'_', '/')}/virDomainSave" style="background-image: url('/images/restore.png'); background-repeat: no-repeat; display: block; width: 45px; height: 47px; font-size: 0; float: left;">Snapshot</a>
12 </xsl:when>
13 <xsl:otherwise>
14 <a href="/virt/{translate(./name,'_', '/')}/virDomainCreate" style="background-image: url('/images/power.png'); background-repeat: no-repeat; display: block; width: 45px; height: 47px; font-size: 0; float: left;">Create</a>
16 <xsl:variable name="snapshots" select="concat('/virt/', translate(./name,'_', '/'), '/virDomainGetXMLSnapshots')" />
17 <xsl:choose>
18 <xsl:when test= "count(document($snapshots)/snapshots/*) &gt; 0">
19 <a href="/virt/{translate(./name,'_', '/')}/virDomainRestore" style="background-image: url('/images/restore.png'); background-repeat: no-repeat; display: block; width: 45px; height: 47px; font-size: 0; float: left;">Snapshot</a>
20 </xsl:when>
21 </xsl:choose>
22 </xsl:otherwise>
23 </xsl:choose>
25 <h1 style="clear: both;" ><xsl:value-of select="translate(./name,'_', ' ')"/></h1>
26 <img src="/virt/{translate(./name,'_', '/')}/virGraphLoad" alt="Load of {substring-after(./name,'_')}" />
27 <img src="/virt/{translate(./name,'_', '/')}/virGraphInterface" alt="Traffic of {substring-after(./name,'_')}" />
29 </xsl:template>
31 <xsl:template match="domain">
32 <xsl:choose>
33 <xsl:when test="@status = 'running'">
34 <xsl:variable name="color" select="'background-color: #0f0;'" />
35 <a href="/virt/{translate(./name,'_', '/')}" style="float: left; margin: 0.2em; font-size: 1em; display: block; width: 7em; height: 7em; text-align: center; border: 1px black solid; vertical-align: middle; {$color} text-decoration: none;"><xsl:value-of select="substring-before(./name,'_')"/><br /><xsl:value-of select="substring-after(./name,'_')"/></a>
36 </xsl:when>
37 <xsl:when test="@status = 'running'">
38 <xsl:variable name="color" select="'background-color: #000;'" />
39 <a href="/virt/{translate(./name,'_', '/')}" style="float: left; margin: 0.2em; font-size: 1em; display: block; width: 7em; height: 7em; text-align: center; border: 1px black solid; vertical-align: middle; {$color} text-decoration: none;"><xsl:value-of select="substring-before(./name,'_')"/><br /><xsl:value-of select="substring-after(./name,'_')"/></a>
40 </xsl:when>
41 <xsl:otherwise>
42 <xsl:variable name="color" select="'background-color: #fef;'" />
43 <a href="/virt/{translate(./name,'_', '/')}" style="float: left; margin: 0.2em; font-size: 1em; display: block; width: 7em; height: 7em; text-align: center; border: 1px black solid; vertical-align: middle; {$color} text-decoration: none;"><xsl:value-of select="substring-before(./name,'_')"/><br /><xsl:value-of select="substring-after(./name,'_')"/></a>
44 </xsl:otherwise>
45 </xsl:choose>
46 </xsl:template>
48 <xsl:template match="/">
49 <html xmlns="http://www.w3.org/1999/xhtml">
50 <head>
51 <title>VPS; Do you need an other argument to migrate?</title>
52 <link rel="stylesheet" type="text/css" href="/css/default.css" />
53 </head>
54 <body>
55 <img src="/images/vps.png" alt="VPS" />
56 <xsl:apply-templates />
57 </body>
58 </html>
59 </xsl:template>
60 </xsl:stylesheet>