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

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

sipb-xen-www -> invirt-web

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