source: trunk/web/templates/list.tmpl @ 217

Last change on this file since 217 was 207, checked in by ecprice, 17 years ago

Removed the Javascript, since I realized that

  • The way it was was worthless
  • The architecture has serious trouble supporting useful js
File size: 2.8 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>
30          <td><input type="text" name="memory" value="$defaults.memory" size=3/> megabytes ($max_memory max)</td>
31        </tr>
32$errorRow('memory', $err)
33        <tr>
34          <td>Disk</td>
35          <td><input type="text" name="disk" value="$defaults.disk" size=3/> gigabytes (${"%0.1f" % ($max_disk-0.05)} max)</td>
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)
54      </table>
55      <input type="submit" class="button" value="Create it!"/>
56    </form>
57#end if
58#end def
59
60#def machineRow($machine)
[113]61      <tr>
62        <td><a href="info?machine_id=$machine.machine_id">$machine.name</a></td>
63        <td>${machine.memory}M</td>
64        <td>$machine.owner</td>
65#if $machine.nics
66#set $nic = $machine.nics[0]
67        <td>$nic.ip</td>
68        <td>$nic.hostname</td>
69#else
70        <td></td>
71        <td></td>
72#end if
[133]73<td>#slurp
[205]74#if $machine.uptime
75$machine.uptime#slurp
[133]76#else
77Off#slurp
78#end if
79</td>
80        <td>#slurp
[144]81#if $has_vnc[$machine] == True
[133]82<a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
83#else
[144]84$has_vnc[$machine]
[133]85#end if
86</td>
[113]87        <td>
[207]88          <form action="command" method="post">
89            <input type="hidden" name="back" value="list"/>
[113]90            <input type="hidden" name="machine_id"
91                   value="$machine.machine_id"/>
[205]92<input type="submit" class="button" name="action" value="#slurp
93#if $machine.uptime then 'Shutdown' else 'Power on'
94"/>
[113]95          </form>
96        </td>
97      </tr>
[205]98#end def
99
100#def machineList($machines)
101    <table>
102      <tr>
103        <td>Name</td>
104        <td>Memory</td>
105        <td>owner</td>
106        <td>IP</td>
107        <td>Hostname</td>
108        <td>Uptime</td>
109        <td>VNC</td>
110        <td></td>
111      #for $machine in $machines:
112        $machineRow($machine)
[113]113      #end for
114    </table>
[205]115#end def
116
117
118#def body
119#if not $machines
120<p>You don't currently control any VMs.</p>  
[144]121#else
[205]122    <p>You have the following VMs:</p>
[144]123#end if
[207]124    <p><a href="list">refresh</a></p>
[205]125    <div id="machinelist">
126    $machineList($machines)
127    </div>
128<div id="createtable">
129$createTable()
130</div>
[113]131#end def
Note: See TracBrowser for help on using the repository browser.