source: trunk/packages/sipb-xen-www/code/templates/list.tmpl @ 341

Last change on this file since 341 was 340, checked in by price, 17 years ago

expose cloning autoinstaller in web interface

File size: 3.3 KB
RevLine 
[113]1#from skeleton import skeleton
2#extends skeleton
3
[205]4
[113]5#def title
6List of your VMs
7#end def
8
[205]9#def createTable()
10#if $cant_add_vm
11<p>$cant_add_vm</p>
[113]12#else
[205]13<p>Create a new VM:</p>
14#if $err
15<p class="error">We had a problem with your request:</p>
16#else if $varExists('new_machine')
17<p>Congratulations! You successfully created a new VM called $new_machine.</p>
18#end if
[207]19    <form action="create" method="POST">
20    <input type="hidden" name="back" value="list"/>
[205]21      <table>
22      $errorRow('create', $err)
23        <tr>
24          <td>Name</td>
25          <td><input type="text" name="name" value="$defaults.name"/></td>
26        </tr>
27$errorRow('name', $err)
28        <tr>
29          <td>Memory</td>
[229]30          <td><input type="text" name="memory" value="$defaults.memory" size=3/> MiB ($max_memory max)</td>
[205]31        </tr>
32$errorRow('memory', $err)
33        <tr>
34          <td>Disk</td>
[229]35          <td><input type="text" name="disk" value="$defaults.disk" size=3/> GiB (${"%0.1f" % ($max_disk-0.05)} max)</td>
[205]36        </tr>
37$errorRow('disk', $err)
38        <tr>
39          <td>HVM/ParaVM$helppopup('hvm_paravm')</td>
40          <td>
41#for $value, $name in (('hvm', 'HVM'), ('paravm', 'ParaVM'))
42   <input #slurp
43#if $defaults.vmtype == $value then 'checked' else ''
44 type="radio" name="vmtype" value="$value">$name</input>
45#end for
46          </td>
47        </tr>
48$errorRow('vmtype', $err)
49        <tr>
50          <td>Boot CD</td>
51          <td>$cdromList($cdroms, $defaults.cdrom)</td>
52        </tr>
53$errorRow('cdrom', $err)
[228]54        <tr>
[340]55          <td>Clone image?</td>
56          <td><input type="checkbox" name="clone_from" value="ice3"/>
57              (experimental; 1-2 minutes, and you have an etch machine; root pw is 'password'.)</td>
58        </tr>
59$errorRow('cdrom', $err)
60        <tr>
[228]61          <td>Owner</td>
62          <td><input type="text" name="owner" value="$defaults.owner"/></td>
63        </tr>
64        $errorRow('owner', $err)
[205]65      </table>
66      <input type="submit" class="button" value="Create it!"/>
67    </form>
68#end if
69#end def
70
71#def machineRow($machine)
[113]72      <tr>
73        <td><a href="info?machine_id=$machine.machine_id">$machine.name</a></td>
74        <td>${machine.memory}M</td>
75        <td>$machine.owner</td>
[234]76        <td>$machine.administrator</td>
[113]77#if $machine.nics
78#set $nic = $machine.nics[0]
79        <td>$nic.ip</td>
80#else
81        <td></td>
82#end if
[133]83<td>#slurp
[205]84#if $machine.uptime
85$machine.uptime#slurp
[133]86#else
87Off#slurp
88#end if
89</td>
90        <td>#slurp
[144]91#if $has_vnc[$machine] == True
[133]92<a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
93#else
[144]94$has_vnc[$machine]
[133]95#end if
96</td>
[113]97        <td>
[207]98          <form action="command" method="post">
99            <input type="hidden" name="back" value="list"/>
[113]100            <input type="hidden" name="machine_id"
101                   value="$machine.machine_id"/>
[205]102<input type="submit" class="button" name="action" value="#slurp
[228]103#if $machine.uptime then 'Power off' else 'Power on'
[205]104"/>
[113]105          </form>
106        </td>
107      </tr>
[205]108#end def
109
110#def machineList($machines)
111    <table>
112      <tr>
113        <td>Name</td>
114        <td>Memory</td>
[228]115        <td>Owner</td>
[234]116        <td>Administrator</td>
[205]117        <td>IP</td>
118        <td>Uptime</td>
119        <td>VNC</td>
120        <td></td>
121      #for $machine in $machines:
122        $machineRow($machine)
[113]123      #end for
124    </table>
[205]125#end def
126
127
128#def body
[280]129<p style="font-size: 125%;"><strong>Note:</strong> sipb-xen is a very alpha service. <a href="/static/about.html">What does this mean?</a></p>
[205]130#if not $machines
131<p>You don't currently control any VMs.</p>  
[144]132#else
[205]133    <p>You have the following VMs:</p>
[144]134#end if
[207]135    <p><a href="list">refresh</a></p>
[205]136    <div id="machinelist">
137    $machineList($machines)
138    </div>
139<div id="createtable">
140$createTable()
141</div>
[113]142#end def
Note: See TracBrowser for help on using the repository browser.