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

Last change on this file since 448 was 448, checked in by price, 16 years ago

restore autoinstaller in web interface

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