source: branches/wsgi/packages/sipb-xen-www/code/templates/list.tmpl @ 2190

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

spelling

File size: 4.7 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#if $can_clone
65          <td><input type="checkbox" name="clone_from" id="clone_from" value="ice3" onchange="onclone(event)"/>
66              (experimental; 1-2 minutes, and you have an etch machine; root pw is 'password'.)
67              <script type='text/javascript'>function onclone(e){ document.getElementById('cdromlist').value = ''; }</script></td>
68#else
69          <td><input type="checkbox" name="clone_from" id="clone_from" value="ice3" disabled="disabled"/> Image cloning is currently disabled for maintenance</td>
70#end if
71        </tr>
72#filter None
73$errorRow('autoinstall', $err)
74#end filter
75        <!--<tr>
76          <td>Autoinstall#slurp
77#filter None
78$helppopup('Autoinstall')#slurp
79#end filter
80</td>
81          <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto">
82#filter None
83$autoList($defaults.cdrom, "document.getElementById('cd_or_auto_auto').checked = true;document.getElementById('cdromlist').value = ''")
84              (experimental; 1-2 minutes, and you have a machine; root pw is 'password'.)
85#end filter
86          </input>
87        </tr>-->
88        <tr>
89          <td>Boot CD</td>
90          <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked>
91#filter None
92$cdromList($defaults.cdrom, "document.getElementById('cd_or_auto_cd').checked = true;document.getElementById('autoinstalllist').value = ''")
93#end filter
94</td>
95          </input>
96        </tr>
97$errorRow('cdrom', $err)
98$errorRow('cdrom', $err)
99        <tr>
100          <td>Owner</td>
101          <td><input type="text" name="owner" value="$defaults.owner"/></td>
102        </tr>
103#filter None
104        $errorRow('owner', $err)
105#end filter
106      </table>
107      <input type="submit" class="button" value="Create it!"/>
108    </form>
109#end if
110#end def
111
112#def machineRow($machine)
113      <tr>
114        <td><a href="info?machine_id=$machine.machine_id">$machine.name</a></td>
115        <td>${machine.memory}M</td>
116        <td>$machine.owner</td>
117        <td>$machine.administrator</td>
118#if $machine.nics
119#set $nic = $machine.nics[0]
120        <td>$nic.ip</td>
121#else
122        <td></td>
123#end if
124<td>#slurp
125#if $machine.uptime
126${datetime.timedelta(seconds=int(machine.uptime))}#slurp
127#end if
128</td>
129        <td>#slurp
130#if $has_vnc[$machine] == True
131<a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
132#else if $has_vnc[$machine] != 'Off'
133#filter None
134$has_vnc[$machine]
135#end filter
136#end if
137</td>
138        <td>
139          <form action="command" method="post">
140            <input type="hidden" name="back" value="list"/>
141            <input type="hidden" name="machine_id"
142                   value="$machine.machine_id"/>
143<input type="submit" class="button" name="action" value="#slurp
144#if $machine.uptime then 'Power off' else 'Power on'
145"/>
146          </form>
147        </td>
148      </tr>
149#end def
150
151#def machineList($machines)
152    <table>
153      <tr>
154        <th>Name</th>
155        <th>Memory</th>
156        <th>Owner#slurp
157#filter None
158$helppopup('Owner')#slurp
159#end filter
160</th>
161        <th>Administrator#slurp
162#filter None
163$helppopup('Administrator')#slurp
164#end filter
165</th>
166        <th>IP</th>
167        <th>Uptime</th>
168        <th>VNC</th>
169        <th></th>
170      </tr>
171      #for $machine in $machines:
172    #filter None
173        $machineRow($machine)
174    #end filter
175      #end for
176    </table>
177#end def
178
179
180#def body
181<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>
182#if not $machines
183<p>You don't currently control any VMs.</p>  
184#end if
185    <p><a href="list">refresh</a></p>
186    <div id="machinelist">
187    #filter None
188    $machineList($machines)
189    #end filter
190    </div>
191#filter None
192$createForm()
193#end filter
194#end def
Note: See TracBrowser for help on using the repository browser.