[113] | 1 | #from skeleton import skeleton |
---|
| 2 | #extends skeleton |
---|
| 3 | |
---|
| 4 | #def title |
---|
[133] | 5 | Info on $machine.name |
---|
[113] | 6 | #end def |
---|
| 7 | |
---|
[205] | 8 | #def infoTable() |
---|
[133] | 9 | <p>Info on ${machine.name}:</p> |
---|
| 10 | <table> |
---|
| 11 | #for $key, $value in $fields |
---|
| 12 | <tr><td>$key:</td><td>$value</td></tr> |
---|
| 13 | #end for |
---|
| 14 | </table> |
---|
[205] | 15 | #end def |
---|
[133] | 16 | |
---|
[205] | 17 | #def commands() |
---|
[135] | 18 | <form action="command" action="POST"> |
---|
[207] | 19 | <input type="hidden" name="back" value="info"/> |
---|
[133] | 20 | <input type="hidden" name="machine_id" value="$machine.machine_id"/> |
---|
| 21 | <table> |
---|
| 22 | |
---|
| 23 | <tr><td> |
---|
| 24 | #if $on |
---|
| 25 | #if $has_vnc |
---|
| 26 | <a href="vnc?machine_id=$machine.machine_id">Console</a> |
---|
| 27 | #else |
---|
| 28 | VNC is not enabled |
---|
| 29 | #end if |
---|
| 30 | #else |
---|
| 31 | |
---|
| 32 | #end if |
---|
| 33 | </td></tr> |
---|
| 34 | <tr> |
---|
| 35 | #if $on |
---|
[207] | 36 | <td><input type="submit" class="button" name="action" value="Power off"/></td> |
---|
| 37 | <td><input type="submit" class="button" name="action" value="Shutdown"/></td> |
---|
| 38 | <td><input type="submit" class="button" name="action" value="Reboot"/></td> |
---|
[133] | 39 | #else |
---|
[207] | 40 | <td><input type="submit" class="button" name="action" value="Power on"/></td> |
---|
[133] | 41 | #end if |
---|
| 42 | <td>Boot CD:</td> |
---|
[205] | 43 | <td>$cdromList($cdroms)</td> |
---|
[133] | 44 | </tr> |
---|
| 45 | <tr> |
---|
[205] | 46 | <td><input type="submit" class="button" name="action" value="Delete VM" onclick="return confirm('Are you sure that you want to delete this VM?');"/></td> |
---|
[133] | 47 | </tr> |
---|
| 48 | </table> |
---|
| 49 | </form> |
---|
[205] | 50 | #end def |
---|
| 51 | |
---|
| 52 | #def modifyForm() |
---|
| 53 | #if $err |
---|
| 54 | <p class="error">We had a problem with your request:</p> |
---|
| 55 | #else if $varExists('new_machine') |
---|
| 56 | <p>Successfully modified.</p> |
---|
| 57 | #end if |
---|
[133] | 58 | #if $on |
---|
[166] | 59 | (To edit ram, disk size, or machine name, turn off the machine first.) |
---|
[133] | 60 | #end if |
---|
| 61 | </p> |
---|
[207] | 62 | <form action="modify" method="POST"> |
---|
[205] | 63 | <input type="hidden" name="machine_id" value="$defaults.machine_id"/> |
---|
[133] | 64 | <table> |
---|
[205] | 65 | <tr><td>Owner${helppopup("owner")}:</td><td><input type="text" name="owner", value="$defaults.owner"/></td></tr> |
---|
| 66 | $errorRow('owner', $err) |
---|
| 67 | <tr><td>Administrator${helppopup("administrator")}:</td><td><input type="text" name="administrator", value="$defaults.administrator"/></td></tr> |
---|
| 68 | $errorRow('administrator', $err) |
---|
| 69 | <tr><td>Contact email:</td><td><input type="text" name="contact" value="$defaults.contact"/></td></tr> |
---|
| 70 | $errorRow('contact', $err) |
---|
[133] | 71 | #if $machine.nics |
---|
[205] | 72 | <tr><td>Hostname:</td><td><input type="text" name="hostname" value="$defaults.hostname"/>.servers.csail.mit.edu</td></tr> |
---|
[133] | 73 | #end if |
---|
[205] | 74 | $errorRow('hostname', $err) |
---|
[133] | 75 | #if not $on |
---|
[205] | 76 | <tr><td>Machine Name:</td><td><input type="text" name="name" value="$defaults.name"/></td></tr> |
---|
| 77 | $errorRow('name', $err) |
---|
[211] | 78 | <tr><td>Ram:</td><td><input type="text" size=3 name="memory" value="$defaults.memory"/>MiB (max $max_mem)</td></tr> |
---|
[205] | 79 | $errorRow('memory', $err) |
---|
[211] | 80 | <tr><td>Disk:</td><td><input type="text" size=3 name="disk" value="$defaults.disk"/>GiB (max $max_disk)</td><td>WARNING: Modifying disk size may corrupt your data.</td></tr> |
---|
[205] | 81 | $errorRow('disk', $err) |
---|
| 82 | #else |
---|
| 83 | $errorRow('name', $err) |
---|
| 84 | $errorRow('memory', $err) |
---|
| 85 | $errorRow('disk', $err) |
---|
[133] | 86 | #end if |
---|
| 87 | <tr><td><input type="submit" class="button" name="action" value="Change"/></td></tr> |
---|
| 88 | </table> |
---|
| 89 | </form> |
---|
[205] | 90 | #end def |
---|
[133] | 91 | |
---|
[205] | 92 | #def body |
---|
| 93 | <h1>Info</h1> |
---|
| 94 | <div id="info"> |
---|
| 95 | $infoTable() |
---|
| 96 | </div> |
---|
| 97 | |
---|
| 98 | <p>Commands:</p> |
---|
| 99 | <div id="commands"> |
---|
| 100 | $commands() |
---|
| 101 | </div> |
---|
| 102 | <p>Change settings: |
---|
| 103 | <div id="modify"> |
---|
| 104 | $modifyForm() |
---|
| 105 | </div> |
---|
[113] | 106 | #end def |
---|