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

Last change on this file since 421 was 418, checked in by price, 17 years ago

sipb-xen -> SIPB Virtual Servers externally

I'm open to other names, but 'sipb-xen' is unenlightening to outsiders,
and awkward if we ever change virtualization platforms.

File size: 3.5 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>
[406]56          <td><input type="checkbox" name="clone_from" id="clone_from" value="ice3" onchange="onclone(event)"/>
57              (experimental; 1-2 minutes, and you have an etch machine; root pw is 'password'.)
58              <script type='text/javascript'>function onclone(e){ document.getElementById('cdromlist').value = ''; }</script></td>
[340]59        </tr>
60$errorRow('cdrom', $err)
61        <tr>
[228]62          <td>Owner</td>
63          <td><input type="text" name="owner" value="$defaults.owner"/></td>
64        </tr>
65        $errorRow('owner', $err)
[205]66      </table>
67      <input type="submit" class="button" value="Create it!"/>
68    </form>
69#end if
70#end def
71
72#def machineRow($machine)
[113]73      <tr>
74        <td><a href="info?machine_id=$machine.machine_id">$machine.name</a></td>
75        <td>${machine.memory}M</td>
76        <td>$machine.owner</td>
[234]77        <td>$machine.administrator</td>
[113]78#if $machine.nics
79#set $nic = $machine.nics[0]
80        <td>$nic.ip</td>
81#else
82        <td></td>
83#end if
[133]84<td>#slurp
[205]85#if $machine.uptime
86$machine.uptime#slurp
[133]87#else
88Off#slurp
89#end if
90</td>
91        <td>#slurp
[144]92#if $has_vnc[$machine] == True
[133]93<a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
94#else
[144]95$has_vnc[$machine]
[133]96#end if
97</td>
[113]98        <td>
[207]99          <form action="command" method="post">
100            <input type="hidden" name="back" value="list"/>
[113]101            <input type="hidden" name="machine_id"
102                   value="$machine.machine_id"/>
[205]103<input type="submit" class="button" name="action" value="#slurp
[228]104#if $machine.uptime then 'Power off' else 'Power on'
[205]105"/>
[113]106          </form>
107        </td>
108      </tr>
[205]109#end def
110
111#def machineList($machines)
112    <table>
113      <tr>
114        <td>Name</td>
115        <td>Memory</td>
[228]116        <td>Owner</td>
[234]117        <td>Administrator</td>
[205]118        <td>IP</td>
119        <td>Uptime</td>
120        <td>VNC</td>
121        <td></td>
122      #for $machine in $machines:
123        $machineRow($machine)
[113]124      #end for
125    </table>
[205]126#end def
127
128
129#def body
[418]130<p style="font-size: 125%;"><strong>Note:</strong> SIPB Virtual Servers is a very alpha service. <a href="/static/about.html">What does this mean?</a></p>
[205]131#if not $machines
132<p>You don't currently control any VMs.</p>  
[144]133#else
[205]134    <p>You have the following VMs:</p>
[144]135#end if
[207]136    <p><a href="list">refresh</a></p>
[205]137    <div id="machinelist">
138    $machineList($machines)
139    </div>
140<div id="createtable">
141$createTable()
142</div>
[113]143#end def
Note: See TracBrowser for help on using the repository browser.