guests.tx 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!-- Generated by the tCMS Post Type Wizard. Regenerating this type will overwrite any hand edits. -->
  2. <div class="post <: $style :> <: $tiled ? 'tile' : '' :>">
  3. : if ( !$post.addpost ) {
  4. : if ( $post.unreachable ) {
  5. <h3 class='blogtitles'><: $post.title :></h3>
  6. <div class="postData responsive-text">
  7. Could not reach this hypervisor: <: $post.state :>
  8. </div>
  9. : } else {
  10. : if ( $tiled ) {
  11. <p class="midtitle">
  12. <: $post.title :>
  13. <span class="tag guest-state guest-<: $post.is_active ? 'up bg-green' : 'down bg-red' :>"><: $post.state :></span>
  14. : if ( $post.is_self ) {
  15. <span class="guest-state guest-self tag" title="the server tCMS is running on">dom0</span>
  16. : }
  17. </p>
  18. : # The capture is declared private in guests.json, so a reader
  19. : # who cannot edit never receives it -- there is nothing here
  20. : # to remember to guard.
  21. : if ( $post.preview ) {
  22. <a href="<: $post.preview :>" class="undecorated" title="<: $post.title :> (<: $post.state :>)">
  23. <img src="<: $post.preview :>" class="responsive-img guest-screenshot" alt="console of <: $post.title :>" loading="lazy" />
  24. </a>
  25. : }
  26. : } else {
  27. <h3 class='blogtitles'>
  28. <: $post.title :>
  29. <span class="tag guest-state guest-<: $post.is_active ? 'up bg-green' : 'down bg-red' :>"><: $post.state :></span>
  30. : if ( $post.is_self ) {
  31. <span class="guest-state guest-self tag" title="the server tCMS is running on">dom0</span>
  32. : }
  33. </h3>
  34. <div class="postData responsive-text" id="postData-<: $post.id :>">
  35. : if ( $post.preview ) {
  36. <a href="<: $post.preview :>" class="undecorated" title="console of <: $post.title :>">
  37. <img src="<: $post.preview :>" class="responsive-img guest-screenshot" alt="console of <: $post.title :>" loading="lazy" />
  38. </a>
  39. <br />
  40. : }
  41. on <: $post.hypervisor_title :> &mdash; <: $post.vcpus :> vCPU
  42. : if ( $can_edit ) {
  43. <br />
  44. <form class="Submissions guest-actions" action="/guest/act" method="POST">
  45. <input type="hidden" name="hypervisor" value="<: $post.hypervisor :>" />
  46. <input type="hidden" name="guest" value="<: $post.domain :>" />
  47. <input type="hidden" name="to" value="<: $route :>" />
  48. : # This guest is the server drawing the page, so the two
  49. : # controls that would take it down are not offered.
  50. : # Trog::DataSource::Virt::act() refuses them too -- see
  51. : # there for why hiding them is not the guard.
  52. : if ( !$post.is_self ) {
  53. : if ( $post.is_active ) {
  54. <button class="coolbutton" type="submit" name="action" value="poweroff">Power Off</button>
  55. : } else {
  56. <button class="coolbutton" type="submit" name="action" value="poweron">Power On</button>
  57. : }
  58. : }
  59. <button class="coolbutton" type="submit" name="action" value="snapshot">Snapshot</button>
  60. : if ( !$post.is_self ) {
  61. <button class="coolbutton guest-destroy" type="submit" name="action" value="destroy"
  62. onclick="return confirm('Destroy <: $post.title :>? This stops the guest immediately.');">Destroy</button>
  63. : }
  64. </form>
  65. : }
  66. </div>
  67. : }
  68. : }
  69. : }
  70. </div>