source: trunk/packages/invirt-web/code/templates/list.tmpl @ 1841

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

select para/hvm when radio buttons for autoinstall/boot cd are chosen, not just specific choices

File size: 5.0 KB
Line 
1#from skeleton import skeleton
2#from invirt.config import structs as config
3#extends skeleton
4#import datetime
5
6
7#def title
8VM List
9#end def
10
11#def createForm()
12#if $cant_add_vm
13<p>$cant_add_vm</p>
14#else
15<h2>Create a new VM</h2>
16#if $err
17<p class="error">We had a problem with your request:</p>
18#else if $varExists('new_machine')
19<p>Congratulations! You successfully created a new VM called $new_machine.</p>
20#end if
21    <form action="create" method="POST">
22    <input type="hidden" name="back" value="list"/>
23      <table>
24#filter None
25      $errorRow('create', $err)
26#end filter
27        <tr>
28          <td>Name</td>
29          <td><input type="text" name="name" value="$defaults.name"/>.${config.dns.domains[0]}</td>
30        </tr>
31#filter None
32$errorRow('name', $err)
33#end filter
34        <tr>
35          <td>Description</td>
36          <td><textarea name="description" rows="4" cols="60">$defaults.description</textarea></td>
37        </tr>
38#filter None
39$errorRow('description', $err)
40#end filter
41        <tr>
42          <td>Memory</td>
43          <td><input type="text" name="memory" value="$defaults.memory" size=3/> MiB ($max_memory max)</td>
44        </tr>
45#filter None
46$errorRow('memory', $err)
47#end filter
48        <tr>
49          <td>Disk</td>
50          <td><input type="text" name="disksize" value="$defaults.disk" size=3/> GiB (${"%0.1f" % ($max_disk-0.05)} max)</td>
51        </tr>
52#filter None
53$errorRow('disk', $err)
54#end filter
55        <tr>
56          <td>HVM/ParaVM#slurp
57#filter None
58$helppopup('HVM/ParaVM')#slurp
59#end filter
60</td>
61          <td>
62#filter None
63$vmTypeList($defaults.type)
64#end filter
65</td>
66        </tr>
67#filter None
68$errorRow('vmtype', $err)
69#end filter
70#filter None
71$errorRow('autoinstall', $err)
72#end filter
73        <tr>
74          <td>Autoinstall#slurp
75#filter None
76$helppopup('Autoinstalls')#slurp
77#end filter
78</td>
79          <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"
80                 onchange="\$('cdromlist').value = ''; \$('vmtype-linux').checked = true">
81#filter None
82$autoList($defaults.cdrom, "$('cd_or_auto_auto').checked = true;$('cdromlist').value = '';$('vmtype-linux').checked = true")
83              (experimental; 2-3 minutes, and you have a machine with empty root password.)
84#end filter
85          </input>
86        </tr>
87        <tr>
88          <td>Boot CD</td>
89          <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked
90                onchange="\$('autoinstalllist').value = ''; \$('vmtype-linux-hvm').checked = true">
91#filter None
92$cdromList($defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")
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!"/><br />
108      Windows notes: #slurp
109#filter None
110$helppopup('Windows')#slurp
111#end filter
112    </form>
113#end if
114#end def
115
116#def machineRow($machine)
117      <tr>
118        <td rowspan="2">
119          <form action="command" method="post">
120            <input type="hidden" name="back" value="list"/>
121            <input type="hidden" name="machine_id"
122                   value="$machine.machine_id"/>
123<input type="submit" class="power #slurp
124#if $machine.uptime then 'on' else 'off'
125" name="action" value="#slurp
126#if $machine.uptime then 'Power off' else 'Power on'
127"/>
128          </form>
129        </td>
130        <td><a href="info?machine_id=$machine.machine_id">$machine.name</a></td>
131        <td>${machine.memory}M</td>
132        <td>$machine.owner</td>
133        <td>$machine.administrator</td>
134#if $machine.nics
135#set $nic = $machine.nics[0]
136        <td>$nic.ip</td>
137#else
138        <td></td>
139#end if
140<td>#slurp
141#if $machine.uptime
142${datetime.timedelta(seconds=int(machine.uptime))}#slurp
143#end if
144</td>
145        <td>#slurp
146#if $has_vnc[$machine] == True
147<a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
148#else if $has_vnc[$machine] != 'Off'
149#filter None
150$has_vnc[$machine]
151#end filter
152#end if
153</td>
154      </tr>
155      <tr>
156        <td colspan="7" style="padding-left: 1em; color: #666">$machine.description</td>
157      </tr>
158#end def
159
160#def machineList($machines)
161    <table cellspacing="0" cellpadding="2">
162      <tr>
163        <th></th>
164        <th>Name</th>
165        <th>Memory</th>
166        <th>Owner#slurp
167#filter None
168$helppopup('Owner')#slurp
169#end filter
170</th>
171        <th>Administrator#slurp
172#filter None
173$helppopup('Administrator')#slurp
174#end filter
175</th>
176        <th>IP</th>
177        <th>Uptime</th>
178        <th>VNC</th>
179      </tr>
180      #for $machine in $machines:
181    #filter None
182        $machineRow($machine)
183    #end filter
184      #end for
185    </table>
186    <script type="text/javascript" src="/static/stripe.js"></script>
187    <script type="text/javascript">
188        document.observe("dom:loaded", function() {
189            stripe(\$('machinelist').getElementsByTagName('table')[0],
190                   'stripedrow');
191        });
192    </script>
193#end def
194
195
196#def body
197<p style="font-size: 125%;"><a href="http://${config.web.hostname}">What is XVM?</a></p>
198#if not $machines
199<p>You don't currently control any VMs.</p>  
200#end if
201    <p><a href="list">refresh</a></p>
202    <div id="machinelist">
203    #filter None
204    $machineList($machines)
205    #end filter
206    </div>
207#filter None
208$createForm()
209#end filter
210#end def
Note: See TracBrowser for help on using the repository browser.