guests.tx 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. : # The capture is declared private in guests.json, so a reader
  15. : # who cannot edit never receives it -- there is nothing here
  16. : # to remember to guard.
  17. : if ( $post.preview ) {
  18. <a href="<: $post.preview :>" class="undecorated" title="<: $post.title :> (<: $post.state :>)">
  19. <img src="<: $post.preview :>" class="responsive-img guest-screenshot" alt="console of <: $post.title :>" loading="lazy" />
  20. </a>
  21. : }
  22. : } else {
  23. <h3 class='blogtitles'>
  24. <: $post.title :>
  25. <span class="guest-state guest-<: $post.is_active ? 'up' : 'down' :>"><: $post.state :></span>
  26. </h3>
  27. <div class="postData responsive-text" id="postData-<: $post.id :>">
  28. : if ( $post.preview ) {
  29. <a href="<: $post.preview :>" class="undecorated" title="console of <: $post.title :>">
  30. <img src="<: $post.preview :>" class="responsive-img guest-screenshot" alt="console of <: $post.title :>" loading="lazy" />
  31. </a>
  32. <br />
  33. : }
  34. on <: $post.hypervisor_title :> &mdash; <: $post.vcpus :> vCPU
  35. : if ( $can_edit ) {
  36. <br />
  37. <form class="Submissions guest-actions" action="/guest/act" method="POST">
  38. <input type="hidden" name="hypervisor" value="<: $post.hypervisor :>" />
  39. <input type="hidden" name="guest" value="<: $post.domain :>" />
  40. <input type="hidden" name="to" value="<: $route :>" />
  41. : if ( $post.is_active ) {
  42. <button class="coolbutton" type="submit" name="action" value="poweroff">Power Off</button>
  43. : } else {
  44. <button class="coolbutton" type="submit" name="action" value="poweron">Power On</button>
  45. : }
  46. <button class="coolbutton" type="submit" name="action" value="snapshot">Snapshot</button>
  47. <button class="coolbutton guest-destroy" type="submit" name="action" value="destroy"
  48. onclick="return confirm('Destroy <: $post.title :>? This stops the guest immediately.');">Destroy</button>
  49. </form>
  50. : }
  51. </div>
  52. : }
  53. : }
  54. : }
  55. </div>