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

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

restore autoinstaller in web interface

File size: 4.4 KB
RevLine 
[113]1#from skeleton import skeleton
2#extends skeleton
3
[205]4
[113]5#def title
[422]6VM List
[113]7#end def
8
[425]9#def createForm()
[205]10#if $cant_add_vm
11<p>$cant_add_vm</p>
[113]12#else
[425]13<h2>Create a new VM</h2>
[205]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>
[447]22#filter None
[205]23      $errorRow('create', $err)
[447]24#end filter
[205]25        <tr>
26          <td>Name</td>
27          <td><input type="text" name="name" value="$defaults.name"/></td>
28        </tr>
[447]29#filter None
[205]30$errorRow('name', $err)
[447]31#end filter
[205]32        <tr>
33          <td>Memory</td>
[229]34          <td><input type="text" name="memory" value="$defaults.memory" size=3/> MiB ($max_memory max)</td>
[205]35        </tr>
[447]36#filter None
[205]37$errorRow('memory', $err)
[447]38#end filter
[205]39        <tr>
40          <td>Disk</td>
[229]41          <td><input type="text" name="disk" value="$defaults.disk" size=3/> GiB (${"%0.1f" % ($max_disk-0.05)} max)</td>
[205]42        </tr>
[447]43#filter None
[205]44$errorRow('disk', $err)
[447]45#end filter
[440]46        <tr>
[447]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>
[440]57        </tr>
[447]58#filter None
[205]59$errorRow('vmtype', $err)
[447]60#end filter
[448]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>
[447]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 = ''")
[443]79              (experimental; 1-2 minutes, and you have a machine; root pw is 'password'.)
[447]80#end filter
[443]81          </input>
[448]82        </tr>-->
[228]83        <tr>
[443]84          <td>Boot CD</td>
[447]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>
[443]90          </input>
[340]91        </tr>
92$errorRow('cdrom', $err)
[443]93$errorRow('cdrom', $err)
[340]94        <tr>
[228]95          <td>Owner</td>
96          <td><input type="text" name="owner" value="$defaults.owner"/></td>
97        </tr>
[447]98#filter None
[228]99        $errorRow('owner', $err)
[447]100#end filter
[205]101      </table>
102      <input type="submit" class="button" value="Create it!"/>
103    </form>
104#end if
105#end def
106
107#def machineRow($machine)
[113]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>
[234]112        <td>$machine.administrator</td>
[113]113#if $machine.nics
114#set $nic = $machine.nics[0]
115        <td>$nic.ip</td>
116#else
117        <td></td>
118#end if
[133]119<td>#slurp
[205]120#if $machine.uptime
121$machine.uptime#slurp
[133]122#end if
123</td>
124        <td>#slurp
[144]125#if $has_vnc[$machine] == True
[133]126<a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
[424]127#else if $has_vnc[$machine] != 'Off'
[447]128#filter None
[144]129$has_vnc[$machine]
[447]130#end filter
[133]131#end if
132</td>
[113]133        <td>
[207]134          <form action="command" method="post">
135            <input type="hidden" name="back" value="list"/>
[113]136            <input type="hidden" name="machine_id"
137                   value="$machine.machine_id"/>
[205]138<input type="submit" class="button" name="action" value="#slurp
[228]139#if $machine.uptime then 'Power off' else 'Power on'
[205]140"/>
[113]141          </form>
142        </td>
143      </tr>
[205]144#end def
145
146#def machineList($machines)
147    <table>
148      <tr>
[424]149        <th>Name</th>
150        <th>Memory</th>
[447]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>
[424]161        <th>IP</th>
162        <th>Uptime</th>
163        <th>VNC</th>
164        <th></th>
165      </tr>
[205]166      #for $machine in $machines:
[447]167    #filter None
[205]168        $machineRow($machine)
[447]169    #end filter
[113]170      #end for
171    </table>
[205]172#end def
173
174
175#def body
[423]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>
[205]177#if not $machines
178<p>You don't currently control any VMs.</p>  
[144]179#end if
[207]180    <p><a href="list">refresh</a></p>
[205]181    <div id="machinelist">
[447]182    #filter None
[205]183    $machineList($machines)
[447]184    #end filter
[205]185    </div>
[447]186#filter None
[425]187$createForm()
[447]188#end filter
[113]189#end def
Note: See TracBrowser for help on using the repository browser.