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

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

Use joins, new xmlist.py

File size: 4.5 KB
Line 
1#from skeleton import skeleton
2#extends skeleton
3#import datetime
4
5
6#def title
7VM List
8#end def
9
10#def createForm()
11#if $cant_add_vm
12<p>$cant_add_vm</p>
13#else
14<h2>Create a new VM</h2>
15#if $err
16<p class="error">We had a problem with your request:</p>
17#else if $varExists('new_machine')
18<p>Congratulations! You successfully created a new VM called $new_machine.</p>
19#end if
20    <form action="create" method="POST">
21    <input type="hidden" name="back" value="list"/>
22      <table>
23#filter None
24      $errorRow('create', $err)
25#end filter
26        <tr>
27          <td>Name</td>
28          <td><input type="text" name="name" value="$defaults.name"/></td>
29        </tr>
30#filter None
31$errorRow('name', $err)
32#end filter
33        <tr>
34          <td>Memory</td>
35          <td><input type="text" name="memory" value="$defaults.memory" size=3/> MiB ($max_memory max)</td>
36        </tr>
37#filter None
38$errorRow('memory', $err)
39#end filter
40        <tr>
41          <td>Disk</td>
42          <td><input type="text" name="disk" value="$defaults.disk" size=3/> GiB (${"%0.1f" % ($max_disk-0.05)} max)</td>
43        </tr>
44#filter None
45$errorRow('disk', $err)
46#end filter
47        <tr>
48          <td>HVM/ParaVM#slurp
49#filter None
50$helppopup('hvm_paravm')#slurp
51#end filter
52</td>
53          <td>
54#filter None
55$vmTypeList($defaults.type)
56#end filter
57</td>
58        </tr>
59#filter None
60$errorRow('vmtype', $err)
61#end filter
62        <tr>
63          <td>Clone image?</td>
64          <td><input type="checkbox" name="clone_from" id="clone_from" value="ice3" onchange="onclone(event)"/>
65              (experimental; 1-2 minutes, and you have an etch machine; root pw is 'password'.)
66              <script type='text/javascript'>function onclone(e){ document.getElementById('cdromlist').value = ''; }</script></td>
67        </tr>
68#filter None
69$errorRow('autoinstall', $err)
70#end filter
71        <!--<tr>
72          <td>Autoinstall#slurp
73#filter None
74$helppopup('autoinstall')#slurp
75#end filter
76</td>
77          <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto">
78#filter None
79$autoList($defaults.cdrom, "document.getElementById('cd_or_auto_auto').checked = true;document.getElementById('cdromlist').value = ''")
80              (experimental; 1-2 minutes, and you have a machine; root pw is 'password'.)
81#end filter
82          </input>
83        </tr>-->
84        <tr>
85          <td>Boot CD</td>
86          <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked>
87#filter None
88$cdromList($defaults.cdrom, "document.getElementById('cd_or_auto_cd').checked = true;document.getElementById('autoinstalllist').value = ''")
89#end filter
90</td>
91          </input>
92        </tr>
93$errorRow('cdrom', $err)
94$errorRow('cdrom', $err)
95        <tr>
96          <td>Owner</td>
97          <td><input type="text" name="owner" value="$defaults.owner"/></td>
98        </tr>
99#filter None
100        $errorRow('owner', $err)
101#end filter
102      </table>
103      <input type="submit" class="button" value="Create it!"/>
104    </form>
105#end if
106#end def
107
108#def machineRow($machine)
109      <tr>
110        <td><a href="info?machine_id=$machine.machine_id">$machine.name</a></td>
111        <td>${machine.memory}M</td>
112        <td>$machine.owner</td>
113        <td>$machine.administrator</td>
114#if $machine.nics
115#set $nic = $machine.nics[0]
116        <td>$nic.ip</td>
117#else
118        <td></td>
119#end if
120<td>#slurp
121#if $machine.uptime
122${datetime.timedelta(seconds=int(machine.uptime))}#slurp
123#end if
124</td>
125        <td>#slurp
126#if $has_vnc[$machine] == True
127<a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
128#else if $has_vnc[$machine] != 'Off'
129#filter None
130$has_vnc[$machine]
131#end filter
132#end if
133</td>
134        <td>
135          <form action="command" method="post">
136            <input type="hidden" name="back" value="list"/>
137            <input type="hidden" name="machine_id"
138                   value="$machine.machine_id"/>
139<input type="submit" class="button" name="action" value="#slurp
140#if $machine.uptime then 'Power off' else 'Power on'
141"/>
142          </form>
143        </td>
144      </tr>
145#end def
146
147#def machineList($machines)
148    <table>
149      <tr>
150        <th>Name</th>
151        <th>Memory</th>
152        <th>Owner#slurp
153#filter None
154$helppopup('owner')#slurp
155#end filter
156</th>
157        <th>Administrator#slurp
158#filter None
159$helppopup('administrator')#slurp
160#end filter
161</th>
162        <th>IP</th>
163        <th>Uptime</th>
164        <th>VNC</th>
165        <th></th>
166      </tr>
167      #for $machine in $machines:
168    #filter None
169        $machineRow($machine)
170    #end filter
171      #end for
172    </table>
173#end def
174
175
176#def body
177<p style="font-size: 125%;">SIPB Virtual Servers is an <strong>alpha service</strong>.  <a href="/static/about.html">What does this mean?</a></p>
178#if not $machines
179<p>You don't currently control any VMs.</p>  
180#end if
181    <p><a href="list">refresh</a></p>
182    <div id="machinelist">
183    #filter None
184    $machineList($machines)
185    #end filter
186    </div>
187#filter None
188$createForm()
189#end filter
190#end def
Note: See TracBrowser for help on using the repository browser.