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

Last change on this file since 216 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
Line 
1#from skeleton import skeleton
2#extends skeleton
3
4
5#def title
6List of your VMs
7#end def
8
9#def createTable()
10#if $cant_add_vm
11<p>$cant_add_vm</p>
12#else
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
19    <form action="create" method="POST">
20    <input type="hidden" name="back" value="list"/>
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)
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
73<td>#slurp
74#if $machine.uptime
75$machine.uptime#slurp
76#else
77Off#slurp
78#end if
79</td>
80        <td>#slurp
81#if $has_vnc[$machine] == True
82<a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
83#else
84$has_vnc[$machine]
85#end if
86</td>
87        <td>
88          <form action="command" method="post">
89            <input type="hidden" name="back" value="list"/>
90            <input type="hidden" name="machine_id"
91                   value="$machine.machine_id"/>
92<input type="submit" class="button" name="action" value="#slurp
93#if $machine.uptime then 'Shutdown' else 'Power on'
94"/>
95          </form>
96        </td>
97      </tr>
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      #end for
114    </table>
115#end def
116
117
118#def body
119#if not $machines
120<p>You don't currently control any VMs.</p>  
121#else
122    <p>You have the following VMs:</p>
123#end if
124    <p><a href="list">refresh</a></p>
125    <div id="machinelist">
126    $machineList($machines)
127    </div>
128<div id="createtable">
129$createTable()
130</div>
131#end def
Note: See TracBrowser for help on using the repository browser.