5af29bb1fe12df5eb53ad3a34c3bb0d38e021ec0
[invirt/packages/invirt-web.git] / code / templates / info.mako
1 <%page expression_filter="h"/>
2 <%inherit file="skeleton.mako" />
3
4 <%def name="title()">
5 Info on ${machine.name}
6 </%def>
7
8 <%def name="infoTable()">
9 <h2>Info</h2>
10 <table>
11   % for key, value in fields:
12   <tr><td>${key}:</td><td>${value}</td></tr>
13   % endfor
14 </table>
15 </%def>
16
17 <%def name="commands()">
18 % if on:
19  % if not machine.type.hvm:
20   Console access: type
21   <tt>ssh ${machine.name}@${config.console.hostname}</tt>
22   on Athena. <a href="https://xvm.scripts.mit.edu/wiki/SerialConsole">(more info)</a>
23  % elif has_vnc:
24   <strong><a href="machine/${machine.machine_id}/vnc">Get Console</a></strong>
25  % else:
26   VNC console not enabled; still booting?
27  % endif
28 % endif
29 <form action="command" method="POST">
30   <input type="hidden" name="back" value="info"/>
31   <input type="hidden" name="machine_id" value="${machine.machine_id}"/>
32   <div>
33         % if on:
34         <button type="submit" class="button" name="action" value="Power off">Power off (hard)</button>
35         <button type="submit" class="button" name="action" value="Shutdown">Shut down</button>
36         <input type="submit" class="button" name="action" value="Reboot"/>
37         % else:
38         <input type="submit" class="button" name="action" value="Power on"/>
39         % endif
40   </div>
41   <div>
42     Boot CD:
43 ${self.fn.cdromList()}
44   </div>
45   <div>
46       <input type="submit" class="button" name="action" value="Delete VM" onclick="return confirm('Are you sure that you want to delete this VM?');"/>
47   </div>
48 </form>
49 </%def>
50
51 <%def name="modifyForm()">
52 % if err:
53 <p class="error">We had a problem with your request:</p>
54 % elif new_machine:
55 <p>Successfully modified.</p>
56 % endif
57 % if on:
58 (To edit ram, disk size, or machine name, turn off the machine first.)
59 % endif
60 <form action="modify" method="POST">
61   <input type="hidden" name="machine_id" value="${defaults.machine_id}"/>
62   <table>
63     <tr><td>Description:</td><td colspan="2"><textarea name="description" rows="4" cols="60">${defaults.description}</textarea></td></tr>
64     <tr><td>Owner${self.fn.helppopup("Owner")}:</td><td><input type="text" name="owner", value="${defaults.owner}"/></td></tr>
65 ${self.fn.errorRow('owner', err)}
66     <tr><td>Administrator${self.fn.helppopup("Administrator")}:</td><td><input type="text" name="admin", value="${defaults.administrator}"/></td></tr>
67 ${self.fn.errorRow('administrator', err)}
68     <tr><td>Contact email:</td><td><input type="text" name="contact" value="${defaults.contact}"/></td></tr>
69 ${self.fn.errorRow('contact', err)}
70 % if not on:
71     <tr><td>Machine Name:</td><td><input type="text" name="name" value="${defaults.name}"/>.${config.dns.domains[0]}</td></tr>
72 ${self.fn.errorRow('name', err)}
73     <tr>
74       <td>HVM/ParaVM${self.fn.helppopup('HVM/ParaVM')}</td>
75       <td>${self.fn.vmTypeList(defaults.type)}</td>
76     </tr>
77     <tr><td>Ram:</td><td><input type="text" size=3 name="memory" value="${defaults.memory}"/>MiB (max ${max_mem})</td></tr>
78 ${self.fn.errorRow('memory', err)}
79     <tr><td>Disk:</td><td><input type="text" size=3 name="disksize" value="${defaults.disk}"/>GiB (max ${max_disk})</td><td>WARNING: Modifying disk size may corrupt your data.</td></tr>
80 ${self.fn.errorRow('disk', err)}
81 % else:
82 ${self.fn.errorRow('name', err)}
83 ${self.fn.errorRow('memory', err)}
84 ${self.fn.errorRow('disk', err)}
85 % endif
86     <tr><td><input type="submit" class="button" name="action" value="Change"/></td></tr>
87   </table>
88 </form>
89 </%def>
90
91 <div id="info">
92   ${infoTable()}
93 </div>
94
95 <h2>Commands</h2>
96 <div id="commands">
97   ${commands()}
98 </div>
99 <h2>Settings</h2>
100 <div id="modify">
101   ${modifyForm()}
102 </div>