provisioned_guests.tx 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. <h3 class='blogtitles'>
  11. <: $post.title :>
  12. <span class="tag guest-state guest-<: $post.is_active ? 'up bg-green' : 'down bg-red' :>"><: $post.state :></span>
  13. : if ( $post.is_self ) {
  14. <span class="guest-state guest-self tag" title="the server tCMS is running on">dom0</span>
  15. : }
  16. : if ( !$post.has_recipe ) {
  17. <span class="tag guest-state" title="no recipes.d entry for this guest">unprovisioned</span>
  18. : }
  19. </h3>
  20. <div class="postData responsive-text" id="postData-<: $post.id :>">
  21. : # Declared private in the sidecar, so a reader who cannot edit
  22. : # never receives it -- there is nothing here to remember to guard.
  23. : if ( $post.preview ) {
  24. <a href="<: $post.preview :>" class="undecorated" title="console of <: $post.title :>">
  25. <img src="<: $post.preview :>" class="responsive-img guest-screenshot" alt="console of <: $post.title :>" loading="lazy" />
  26. </a>
  27. <br />
  28. : }
  29. on <: $post.hypervisor_title :> &mdash; <: $post.vcpus :> vCPU
  30. : if ( $can_edit && $post.recipe ) {
  31. <details class="guest-recipe">
  32. <summary>Recipe &mdash; <: $post.recipe_path :></summary>
  33. <pre class="guest-recipe-body"><: $post.recipe :></pre>
  34. </details>
  35. : }
  36. : if ( $can_edit && $post.reprovision_log ) {
  37. <details class="guest-reprovision-log">
  38. <summary>Last reprovision</summary>
  39. <pre class="guest-recipe-body"><: $post.reprovision_log :></pre>
  40. </details>
  41. : }
  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. : # Trog::DataSource::Virt::act() refuses these for the
  49. : # server drawing the page. Not offering them is not the guard.
  50. : # (A semicolon in a Kolon comment ends the statement, so do not.)
  51. : if ( !$post.is_self ) {
  52. : if ( $post.is_active ) {
  53. <button class="coolbutton" type="submit" name="action" value="poweroff">Power Off</button>
  54. : } else {
  55. <button class="coolbutton" type="submit" name="action" value="poweron">Power On</button>
  56. : }
  57. : }
  58. <button class="coolbutton" type="submit" name="action" value="snapshot">Snapshot</button>
  59. : if ( !$post.is_self ) {
  60. <button class="coolbutton guest-destroy" type="submit" name="action" value="destroy"
  61. onclick="return confirm('Destroy <: $post.title :>? This stops the guest immediately.');">Destroy</button>
  62. : }
  63. </form>
  64. : # Separate form, because this one carries a passphrase and has
  65. : # no business sharing a submit with the buttons above.
  66. : if ( $post.can_reprovision ) {
  67. <form class="Submissions guest-reprovision" action="/guest/reprovision" method="POST" autocomplete="off">
  68. <input type="hidden" name="guest" value="<: $post.domain :>" />
  69. <input type="hidden" name="to" value="<: $route :>" />
  70. <label>
  71. Secrets passphrase
  72. <input required class="cooltext" type="password" name="passphrase" autocomplete="off"
  73. title="new_config asks for this on stdin; it is used for this run and not stored" />
  74. </label>
  75. <button class="coolbutton guest-destroy" type="submit"
  76. onclick="return confirm('Reprovision <: $post.title :>? This destroys the guest and builds it again from its recipe. Anything on it the recipe does not describe will not come back.');">Reprovision</button>
  77. </form>
  78. : }
  79. : }
  80. </div>
  81. : }
  82. : }
  83. </div>