guests.tx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <div class="post <: $style :> <: $tiled ? 'tile' : '' :>">
  2. : if ( !$post.addpost ) {
  3. : if ( $post.unreachable ) {
  4. <h3 class='blogtitles'><: $post.title :></h3>
  5. <div class="postData responsive-text">
  6. Could not reach this hypervisor: <: $post.state :>
  7. </div>
  8. : } else {
  9. : if ( $tiled ) {
  10. <p class="midtitle">
  11. <: $post.title :>
  12. <span class="guest-state guest-<: $post.is_active ? 'up' : 'down' :>"><: $post.state :></span>
  13. </p>
  14. : # A console capture is admin-only: the route that serves it
  15. : # requires the admin acl, so anyone else gets a broken image.
  16. : if ( $can_edit ) {
  17. <a href="<: $post.preview :>" class="undecorated" title="<: $post.title :> (<: $post.state :>)">
  18. <img src="<: $post.preview :>" class="responsive-img guest-screenshot" alt="console of <: $post.title :>" loading="lazy" />
  19. </a>
  20. : }
  21. : } else {
  22. <h3 class='blogtitles'>
  23. <: $post.title :>
  24. <span class="guest-state guest-<: $post.is_active ? 'up' : 'down' :>"><: $post.state :></span>
  25. </h3>
  26. <div class="postData responsive-text" id="postData-<: $post.id :>">
  27. : if ( $can_edit ) {
  28. <a href="<: $post.preview :>" class="undecorated" title="console of <: $post.title :>">
  29. <img src="<: $post.preview :>" class="responsive-img guest-screenshot" alt="console of <: $post.title :>" loading="lazy" />
  30. </a>
  31. <br />
  32. : }
  33. on <: $post.hypervisor_title :> &mdash; <: $post.vcpus :> vCPU
  34. : if ( $can_edit ) {
  35. <br />
  36. <form class="Submissions guest-actions" action="/guest/act" method="POST">
  37. <input type="hidden" name="hypervisor" value="<: $post.hypervisor :>" />
  38. <input type="hidden" name="guest" value="<: $post.domain :>" />
  39. <input type="hidden" name="to" value="<: $route :>" />
  40. : if ( $post.is_active ) {
  41. <button class="coolbutton" type="submit" name="action" value="poweroff">Power Off</button>
  42. : } else {
  43. <button class="coolbutton" type="submit" name="action" value="poweron">Power On</button>
  44. : }
  45. <button class="coolbutton" type="submit" name="action" value="snapshot">Snapshot</button>
  46. <button class="coolbutton guest-destroy" type="submit" name="action" value="destroy"
  47. onclick="return confirm('Destroy <: $post.title :>? This stops the guest immediately.');">Destroy</button>
  48. </form>
  49. : }
  50. </div>
  51. : }
  52. : }
  53. : }
  54. </div>