[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() |
---|
[430] | 9 | <h2>Info</h2> |
---|
[133] | 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() |
---|
[301] | 18 | <form action="command" method="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 | |
---|
[430] | 23 | <tr><td colspan=3> |
---|
[133] | 24 | #if $on |
---|
| 25 | #if $has_vnc |
---|
[430] | 26 | <strong><a href="vnc?machine_id=$machine.machine_id">Get Console</a></strong> |
---|
[133] | 27 | #else |
---|
[430] | 28 | VNC console not enabled; still booting? |
---|
[133] | 29 | #end if |
---|
| 30 | #else |
---|
| 31 | |
---|
| 32 | #end if |
---|
| 33 | </td></tr> |
---|
| 34 | <tr> |
---|
| 35 | #if $on |
---|
[430] | 36 | <td><button type="submit" class="button" name="action" value="Power off">Power off (hard)</button></td> |
---|
[436] | 37 | <td><button type="submit" class="button" name="action" value="Shutdown">Shut down</button></td> |
---|
[207] | 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> |
---|
[447] | 43 | <td>#slurp |
---|
| 44 | #filter None |
---|
| 45 | $cdromList()#slurp |
---|
| 46 | #end filter |
---|
| 47 | </td> |
---|
[133] | 48 | </tr> |
---|
| 49 | <tr> |
---|
[205] | 50 | <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] | 51 | </tr> |
---|
| 52 | </table> |
---|
| 53 | </form> |
---|
[205] | 54 | #end def |
---|
| 55 | |
---|
| 56 | #def modifyForm() |
---|
| 57 | #if $err |
---|
| 58 | <p class="error">We had a problem with your request:</p> |
---|
| 59 | #else if $varExists('new_machine') |
---|
| 60 | <p>Successfully modified.</p> |
---|
| 61 | #end if |
---|
[133] | 62 | #if $on |
---|
[166] | 63 | (To edit ram, disk size, or machine name, turn off the machine first.) |
---|
[133] | 64 | #end if |
---|
[207] | 65 | <form action="modify" method="POST"> |
---|
[205] | 66 | <input type="hidden" name="machine_id" value="$defaults.machine_id"/> |
---|
[133] | 67 | <table> |
---|
[609] | 68 | <tr><td>Description:</td><td colspan="2"><textarea name="description" rows="4" cols="60">$defaults.description</textarea></td></tr> |
---|
[447] | 69 | <tr><td>Owner#slurp |
---|
| 70 | #filter None |
---|
[539] | 71 | $helppopup("Owner")#slurp |
---|
[447] | 72 | #end filter |
---|
| 73 | :</td><td><input type="text" name="owner", value="$defaults.owner"/></td></tr> |
---|
| 74 | #filter None |
---|
[205] | 75 | $errorRow('owner', $err) |
---|
[447] | 76 | #end filter |
---|
| 77 | <tr><td>Administrator#slurp |
---|
| 78 | #filter None |
---|
[539] | 79 | $helppopup("Administrator")#slurp |
---|
[447] | 80 | #end filter |
---|
[572] | 81 | :</td><td><input type="text" name="admin", value="$defaults.administrator"/></td></tr> |
---|
[447] | 82 | #filter None |
---|
[205] | 83 | $errorRow('administrator', $err) |
---|
[447] | 84 | #end filter |
---|
[205] | 85 | <tr><td>Contact email:</td><td><input type="text" name="contact" value="$defaults.contact"/></td></tr> |
---|
[447] | 86 | #filter None |
---|
[205] | 87 | $errorRow('contact', $err) |
---|
[447] | 88 | #end filter |
---|
[133] | 89 | #if not $on |
---|
[205] | 90 | <tr><td>Machine Name:</td><td><input type="text" name="name" value="$defaults.name"/></td></tr> |
---|
[447] | 91 | #filter None |
---|
[205] | 92 | $errorRow('name', $err) |
---|
[447] | 93 | #end filter |
---|
[440] | 94 | <tr> |
---|
[447] | 95 | <td>HVM/ParaVM#slurp |
---|
| 96 | #filter None |
---|
[539] | 97 | $helppopup('HVM/ParaVM')#slurp |
---|
[447] | 98 | #end filter |
---|
| 99 | </td> |
---|
| 100 | <td>#slurp |
---|
| 101 | #filter None |
---|
| 102 | $vmTypeList($defaults.type)#slurp |
---|
| 103 | #end filter |
---|
| 104 | </td> |
---|
[440] | 105 | </tr> |
---|
[211] | 106 | <tr><td>Ram:</td><td><input type="text" size=3 name="memory" value="$defaults.memory"/>MiB (max $max_mem)</td></tr> |
---|
[447] | 107 | #filter None |
---|
[205] | 108 | $errorRow('memory', $err) |
---|
[447] | 109 | #end filter |
---|
[572] | 110 | <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> |
---|
[447] | 111 | #filter None |
---|
[205] | 112 | $errorRow('disk', $err) |
---|
[447] | 113 | #end filter |
---|
[205] | 114 | #else |
---|
[447] | 115 | #filter None |
---|
[205] | 116 | $errorRow('name', $err) |
---|
| 117 | $errorRow('memory', $err) |
---|
| 118 | $errorRow('disk', $err) |
---|
[447] | 119 | #end filter |
---|
[133] | 120 | #end if |
---|
| 121 | <tr><td><input type="submit" class="button" name="action" value="Change"/></td></tr> |
---|
| 122 | </table> |
---|
| 123 | </form> |
---|
[205] | 124 | #end def |
---|
[133] | 125 | |
---|
[205] | 126 | #def body |
---|
| 127 | <div id="info"> |
---|
[447] | 128 | #filter None |
---|
[205] | 129 | $infoTable() |
---|
[447] | 130 | #end filter |
---|
[205] | 131 | </div> |
---|
| 132 | |
---|
[430] | 133 | <h2>Commands</h2> |
---|
[205] | 134 | <div id="commands"> |
---|
[447] | 135 | #filter None |
---|
[205] | 136 | $commands() |
---|
[447] | 137 | #end filter |
---|
[205] | 138 | </div> |
---|
[430] | 139 | <h2>Settings</h2> |
---|
[205] | 140 | <div id="modify"> |
---|
[447] | 141 | #filter None |
---|
[205] | 142 | $modifyForm() |
---|
[447] | 143 | #end filter |
---|
[205] | 144 | </div> |
---|
[113] | 145 | #end def |
---|