projects
/
invirt/packages/invirt-web.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added nc
[invirt/packages/invirt-web.git]
/
code
/
templates
/
list.mako
diff --git
a/code/templates/list.mako
b/code/templates/list.mako
index
b03a04f
..
777134f
100644
(file)
--- a/
code/templates/list.mako
+++ b/
code/templates/list.mako
@@
-9,6
+9,12
@@
VM List
</%def>
VM List
</%def>
+%if os.path.exists("/etc/invirt/motd.html"):
+<div class="result">
+<p class="error">${open('/etc/invirt/motd.html').read()|n}</p>
+</div>
+%endif
+
<%def name="createForm()">
% if cant_add_vm:
<p>${cant_add_vm}</p>
<%def name="createForm()">
% if cant_add_vm:
<p>${cant_add_vm}</p>
@@
-19,6
+25,7
@@
VM List
% elif new_machine:
<p>Congratulations! You successfully created a new VM called ${new_machine}.</p>
% endif
% elif new_machine:
<p>Congratulations! You successfully created a new VM called ${new_machine}.</p>
% endif
+
<form action="create" method="POST">
<input type="hidden" name="back" value="list"/>
<table>
<form action="create" method="POST">
<input type="hidden" name="back" value="list"/>
<table>
@@
-53,19
+60,18
@@
VM List
${self.fn.errorRow('autoinstall', err)}
<tr>
<td>Autoinstall${self.fn.helppopup('Autoinstalls')}</td>
${self.fn.errorRow('autoinstall', err)}
<tr>
<td>Autoinstall${self.fn.helppopup('Autoinstalls')}</td>
- <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"
- onchange="\$('cdromlist').value = ''; \$('vmtype-linux').checked = true">
+ <td><label><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"
+ onchange="$('cdromlist').value = ''; $('vmtype-linux').checked = true" />
${self.fn.autoList(defaults.cdrom, "$('cd_or_auto_auto').checked = true;$('cdromlist').value = '';$('vmtype-linux').checked = true")}
(experimental; 2-3 minutes, and you have a machine with empty root password.)
${self.fn.autoList(defaults.cdrom, "$('cd_or_auto_auto').checked = true;$('cdromlist').value = '';$('vmtype-linux').checked = true")}
(experimental; 2-3 minutes, and you have a machine with empty root password.)
- </input>
+</label></td>
</tr>
<tr>
<td>Boot CD</td>
</tr>
<tr>
<td>Boot CD</td>
- <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked="checked"
- onchange="\$('autoinstalllist').value = ''; \$('vmtype-linux-hvm').checked = true">
+ <td><label><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked="checked"
+ onchange="$('autoinstalllist').value = ''; $('vmtype-linux-hvm').checked = true" />
${self.fn.cdromList(defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")}
${self.fn.cdromList(defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoinstalllist').value = '';$('vmtype-linux-hvm').checked = true")}
-</td>
- </input>
+</label></td>
</tr>
${self.fn.errorRow('cdrom', err)}
${self.fn.errorRow('cdrom', err)}
</tr>
${self.fn.errorRow('cdrom', err)}
${self.fn.errorRow('cdrom', err)}
@@
-75,50
+81,73
@@
${self.fn.cdromList(defaults.cdrom, "$('cd_or_auto_cd').checked = true;$('autoin
</tr>
${self.fn.errorRow('owner', err)}
</table>
</tr>
${self.fn.errorRow('owner', err)}
</table>
- <input type="submit" class="button" value="Create it!"/><br />
+ <input type="submit" class="button" value="Create it!" \
+% if disable_creation:
+ disabled="disabled" \
+% endif
+/> \
+% if disable_creation:
+ <span style="color:red;">VM creation is currently disabled due to lack of disk space.</span> \
+%endif
+<br />
Windows notes: ${self.fn.helppopup('Windows')}
</form>
% endif
</%def>
Windows notes: ${self.fn.helppopup('Windows')}
</form>
% endif
</%def>
-<%def name="machineRow(machine)">
- <tr>
+<%def name="machineRow(machine, dark)">
+<%
+ on = (machine.uptime is not None)
+%>
+ <tr\
+% if dark:
+ class="stripedrow" \
+% endif
+>
<td rowspan="2">
<td rowspan="2">
- <form action="command" method="post">
+ % if on and installing[machine]:
+ <img src="static/power_installing.png" alt="Installing..." />
+ % else:
+ <form action="machine/${machine.machine_id}/command/${'shutdown' if on else 'create'}" method="post">
<input type="hidden" name="back" value="list"/>
<input type="hidden" name="back" value="list"/>
- <input type="hidden" name="machine_id"
- value="${machine.machine_id}"/>
-<input type="submit" class="power ${'on' if machine.uptime else 'off'}" name="action" value="${'Power off' if machine.uptime else 'Power on'}"\
-% if machine.uptime:
+<input type="submit" class="power ${'on' if on else 'off'}" name="action" value="${'Shutdown' if on else 'Power on'}"\
+% if on:
onclick="return confirm('Are you sure you want to power off this VM?');"
% endif
/>
</form>
onclick="return confirm('Are you sure you want to power off this VM?');"
% endif
/>
</form>
+ % endif
</td>
</td>
- <td><a href="info?machine_id=${machine.machine_id}">${machine.name}</a></td>
+ <td><a href="machine/${machine.machine_id}">${machine.name}</a></td>
<td>${machine.memory}M</td>
<td>${machine.owner}</td>
<td>${machine.administrator}</td>
% if machine.nics:
<td>${machine.memory}M</td>
<td>${machine.owner}</td>
<td>${machine.administrator}</td>
% if machine.nics:
- <td>${', '.join(map(lambda x: x.ip, machine.nics))}</td>
+ <td>${', '.join(nic.ip for nic in machine.nics)}</td>
% else:
<td></td>
% endif
<td>\
% else:
<td></td>
% endif
<td>\
-% if machine.uptime:
+% if on:
${datetime.timedelta(seconds=int(machine.uptime))}\
% endif
</td>
<td>\
% if has_vnc[machine] == True:
${datetime.timedelta(seconds=int(machine.uptime))}\
% endif
</td>
<td>\
% if has_vnc[machine] == True:
-<a href="vnc?machine_id=${machine.machine_id}">Console</a>\
+<a href="machine/${machine.machine_id}/vnc">Console</a>\
+% elif has_vnc[machine] == 'ParaVM':
+ParaVM${self.fn.helppopup("ParaVM Console")}
% elif has_vnc[machine] != 'Off':
${has_vnc[machine]}
% endif
</td>
</tr>
% elif has_vnc[machine] != 'Off':
${has_vnc[machine]}
% endif
</td>
</tr>
- <tr>
- <td colspan="7" style="padding-left: 1em; color: #666">${machine.description}</td>
+ <tr\
+% if dark:
+ class="stripedrow" \
+% endif
+>
+ <td colspan="7" style="padding-left: 1em; color: #666">${machine.description|self.fn.module.nl2br}</td>
</tr>
</%def>
</tr>
</%def>
@@
-134,17
+163,10
@@
${has_vnc[machine]}
<th>Uptime</th>
<th>VNC</th>
</tr>
<th>Uptime</th>
<th>VNC</th>
</tr>
-% for machine in machines:
- ${machineRow(machine)}
+% for n, machine in enumerate(machines):
+ ${machineRow(machine, (n%2)==0)}
% endfor
</table>
% endfor
</table>
- <script type="text/javascript" src="/static/stripe.js"></script>
- <script type="text/javascript">
- document.observe("dom:loaded", function() {
- stripe(\$('machinelist').getElementsByTagName('table')[0],
- 'stripedrow');
- });
- </script>
</%def>
<p style="font-size: 125%;"><a href="http://${config.web.hostname}">What is XVM?</a></p>
</%def>
<p style="font-size: 125%;"><a href="http://${config.web.hostname}">What is XVM?</a></p>