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

Last change on this file since 1697 was 1693, checked in by broder, 16 years ago

Switch to HVM if user selects a CD, and ParaVM if user selects an
autoinstaller

File size: 4.8 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('Autoinstall')#slurp
77#end filter
78</td>
79          <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto">
80#filter None
81$autoList($defaults.cdrom, "$('cd_or_auto_auto').checked = true;$('cdromlist').value = '';$('vmtype-linux').checked = true")
82              (experimental; 2-3 minutes, and you have a machine with empty root password.)
83#end filter
84          </input>
85        </tr>
86        <tr>
87          <td>Boot CD</td>
88          <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked>
89#filter None
90$cdromList($defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")
91#end filter
92</td>
93          </input>
94        </tr>
95$errorRow('cdrom', $err)
96$errorRow('cdrom', $err)
97        <tr>
98          <td>Owner</td>
99          <td><input type="text" name="owner" value="$defaults.owner"/></td>
100        </tr>
101#filter None
102        $errorRow('owner', $err)
103#end filter
104      </table>
105      <input type="submit" class="button" value="Create it!"/><br />
106      Windows notes: #slurp
107#filter None
108$helppopup('Windows')#slurp
109#end filter
110    </form>
111#end if
112#end def
113
114#def machineRow($machine)
115      <tr>
116        <td rowspan="2">
117          <form action="command" method="post">
118            <input type="hidden" name="back" value="list"/>
119            <input type="hidden" name="machine_id"
120                   value="$machine.machine_id"/>
121<input type="submit" class="power #slurp
122#if $machine.uptime then 'on' else 'off'
123" name="action" value="#slurp
124#if $machine.uptime then 'Power off' else 'Power on'
125"/>
126          </form>
127        </td>
128        <td><a href="info?machine_id=$machine.machine_id">$machine.name</a></td>
129        <td>${machine.memory}M</td>
130        <td>$machine.owner</td>
131        <td>$machine.administrator</td>
132#if $machine.nics
133#set $nic = $machine.nics[0]
134        <td>$nic.ip</td>
135#else
136        <td></td>
137#end if
138<td>#slurp
139#if $machine.uptime
140${datetime.timedelta(seconds=int(machine.uptime))}#slurp
141#end if
142</td>
143        <td>#slurp
144#if $has_vnc[$machine] == True
145<a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp
146#else if $has_vnc[$machine] != 'Off'
147#filter None
148$has_vnc[$machine]
149#end filter
150#end if
151</td>
152      </tr>
153      <tr>
154        <td colspan="7" style="padding-left: 1em; color: #666">$machine.description</td>
155      </tr>
156#end def
157
158#def machineList($machines)
159    <table cellspacing="0" cellpadding="2">
160      <tr>
161        <th></th>
162        <th>Name</th>
163        <th>Memory</th>
164        <th>Owner#slurp
165#filter None
166$helppopup('Owner')#slurp
167#end filter
168</th>
169        <th>Administrator#slurp
170#filter None
171$helppopup('Administrator')#slurp
172#end filter
173</th>
174        <th>IP</th>
175        <th>Uptime</th>
176        <th>VNC</th>
177      </tr>
178      #for $machine in $machines:
179    #filter None
180        $machineRow($machine)
181    #end filter
182      #end for
183    </table>
184    <script type="text/javascript" src="/static/stripe.js"></script>
185    <script type="text/javascript">
186        document.observe("dom:loaded", function() {
187            stripe(\$('machinelist').getElementsByTagName('table')[0],
188                   'stripedrow');
189        });
190    </script>
191#end def
192
193
194#def body
195<p style="font-size: 125%;"><a href="http://${config.web.hostname}">What is XVM?</a></p>
196#if not $machines
197<p>You don't currently control any VMs.</p>  
198#end if
199    <p><a href="list">refresh</a></p>
200    <div id="machinelist">
201    #filter None
202    $machineList($machines)
203    #end filter
204    </div>
205#filter None
206$createForm()
207#end filter
208#end def
Note: See TracBrowser for help on using the repository browser.