Fix path to gitweb static content
[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   % if on:
15    % if 'monitoring' in config and len(config.monitoring) and 'baseuri' in config.monitoring[0]:
16     <tr><td>CPU history:</td><td><img src="${config.monitoring[0].baseuri}usage.cgi?type=cpu;uuid=${machine.uuid}" alt="Domain CPU usage" /></td></tr>
17    % endif
18   % endif
19 </table>
20 </%def>
21
22 <%def name="commands()">
23 % if on:
24  % if not machine.type.hvm:
25   Console access: type
26   <tt>ssh ${machine.name}@${config.console.hostname}</tt>
27   on Athena. <a href="https://xvm.scripts.mit.edu/wiki/SerialConsole">(more info)</a>
28  % elif has_vnc:
29   <strong><a href="machine/${machine.machine_id}/vnc">Get Console</a></strong>
30  % else:
31   VNC console not enabled; still booting?
32  % endif
33 % endif
34 <%def name="command_button(title, value, cdrom=False, extra='')">
35 <form action="machine/${machine.machine_id}/command/${value}" method="POST">
36   <input type="hidden" name="back" value="info" />
37   <input type="submit" class="button" name="action" value="${title}" ${extra | n}/>
38 % if cdrom:
39   Boot CD: ${self.fn.cdromList()}
40 % endif
41 </form>
42 </%def>
43   <div>
44         % if on:
45         ${command_button("Power off", "destroy")}
46         ${command_button("Shutdown", "shutdown")}
47         ${command_button("Reboot", "reboot", cdrom=True)}
48         % else:
49         ${command_button("Power on", "create", cdrom=True)}
50         % endif
51   </div>
52   <div>
53         ${command_button("Delete VM", "delete", extra='''onclick="return confirm('Are you sure that you want to delete this VM?');"''')}
54   </div>
55 </%def>
56
57 <%def name="modifyForm()">
58 % if err:
59 <p class="error">We had a problem with your request:</p>
60 % elif new_machine:
61 <p>Successfully modified.</p>
62 % endif
63 % if on:
64 (To edit ram, disk size, or machine name, turn off the machine first.)
65 % endif
66 <form action="machine/${machine.machine_id}/modify" method="POST">
67   <table>
68     <tr><td>Description:</td><td colspan="2"><textarea name="description" rows="4" cols="60">${defaults.description}</textarea></td></tr>
69     <tr><td>Owner${self.fn.helppopup("Owner")}:</td><td><input type="text" name="owner", value="${defaults.owner}"/></td></tr>
70 ${self.fn.errorRow('owner', err)}
71     <tr><td>Administrator${self.fn.helppopup("Administrator")}:</td><td><input type="text" name="admin", value="${defaults.administrator}"/></td></tr>
72 ${self.fn.errorRow('administrator', err)}
73     <tr><td>Contact email:</td><td><input type="text" name="contact" value="${defaults.contact}"/></td></tr>
74 ${self.fn.errorRow('contact', err)}
75 % if not on:
76     <tr><td>Machine Name:</td><td><input type="text" name="name" value="${defaults.name}"/>.${config.dns.domains[0]}</td></tr>
77 ${self.fn.errorRow('name', err)}
78     <tr>
79       <td>HVM/ParaVM${self.fn.helppopup('HVM/ParaVM')}</td>
80       <td>${self.fn.vmTypeList(defaults.type)}</td>
81     </tr>
82     <tr><td>Ram:</td><td><input type="text" size=3 name="memory" value="${defaults.memory}"/>MiB (max ${max_mem})</td></tr>
83 ${self.fn.errorRow('memory', err)}
84     <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>
85 ${self.fn.errorRow('disk', err)}
86 % else:
87 ${self.fn.errorRow('name', err)}
88 ${self.fn.errorRow('memory', err)}
89 ${self.fn.errorRow('disk', err)}
90 % endif
91     <tr><td><input type="submit" class="button" name="action" value="Change"/></td></tr>
92   </table>
93 </form>
94 </%def>
95
96 <div id="info">
97   ${infoTable()}
98 </div>
99
100 <h2>Commands</h2>
101 <div id="commands">
102   ${commands()}
103 </div>
104 <h2>Settings</h2>
105 <div id="modify">
106   ${modifyForm()}
107 </div>