| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <!-- Generated by the tCMS Post Type Wizard. Regenerating this type will overwrite any hand edits. -->
- <div class="post <: $style :> <: $tiled ? 'tile' : '' :>">
- : if ( !$post.addpost ) {
- : if ( $post.unreachable ) {
- <h3 class='blogtitles'><: $post.title :></h3>
- <div class="postData responsive-text">
- Could not reach this hypervisor: <: $post.state :>
- </div>
- : } else {
- <h3 class='blogtitles'>
- <: $post.title :>
- <span class="tag guest-state guest-<: $post.is_active ? 'up bg-green' : 'down bg-red' :>"><: $post.state :></span>
- : if ( $post.is_self ) {
- <span class="guest-state guest-self tag" title="the server tCMS is running on">dom0</span>
- : }
- : if ( !$post.has_recipe ) {
- <span class="tag guest-state" title="no recipes.d entry for this guest">unprovisioned</span>
- : }
- : # Nothing waits on the process which reprovisions, so its own
- : # status file is the only account of it there is.
- : if ( $post.reprovision_state ) {
- <span class="tag guest-state reprovision-<: $post.reprovision_state :>"
- title="<: $post.reprovision_by ? 'asked for by ' ~ $post.reprovision_by : '' :>">
- <: $post.reprovision_status :>
- </span>
- : }
- </h3>
- <div class="postData responsive-text" id="postData-<: $post.id :>">
- : # Declared private in the sidecar, so a reader who cannot edit
- : # never receives it -- there is nothing here to remember to guard.
- : if ( $post.preview ) {
- <a href="<: $post.preview :>" class="undecorated" title="console of <: $post.title :>">
- <img src="<: $post.preview :>" class="responsive-img guest-screenshot" alt="console of <: $post.title :>" loading="lazy" />
- </a>
- <br />
- : }
- on <: $post.hypervisor_title :> — <: $post.vcpus :> vCPU
- : if ( $can_edit && $post.recipe ) {
- <details class="guest-recipe">
- <summary>Recipe — <: $post.recipe_path :></summary>
- <pre class="guest-recipe-body"><: $post.recipe :></pre>
- </details>
- : }
- : if ( $can_edit && $post.reprovision_log ) {
- <details class="guest-reprovision-log">
- <summary>
- Last reprovision — <: $post.reprovision_status :>
- : if ( $post.reprovision_exit ) {
- (exit <: $post.reprovision_exit :>)
- : }
- </summary>
- <pre class="guest-recipe-body"><: $post.reprovision_log :></pre>
- : if ( $post.reprovision_log_href ) {
- <a href="<: $post.reprovision_log_href :>" class="coolbutton" target="_blank" rel="noopener">Read the whole log</a>
- : }
- </details>
- : }
- : if ( $can_edit ) {
- <br />
- <form class="Submissions guest-actions" action="/guest/act" method="POST">
- <input type="hidden" name="hypervisor" value="<: $post.hypervisor :>" />
- <input type="hidden" name="guest" value="<: $post.domain :>" />
- <input type="hidden" name="to" value="<: $route :>" />
- : # Trog::DataSource::Virt::act() refuses these for the
- : # server drawing the page. Not offering them is not the guard.
- : # (A semicolon in a Kolon comment ends the statement, so do not.)
- : if ( !$post.is_self ) {
- : if ( $post.is_active ) {
- <button class="coolbutton" type="submit" name="action" value="poweroff">Power Off</button>
- : } else {
- <button class="coolbutton" type="submit" name="action" value="poweron">Power On</button>
- : }
- : }
- <button class="coolbutton" type="submit" name="action" value="snapshot">Snapshot</button>
- : if ( !$post.is_self ) {
- <button class="coolbutton guest-destroy" type="submit" name="action" value="destroy"
- onclick="return confirm('Destroy <: $post.title :>? This stops the guest immediately.');">Destroy</button>
- : }
- </form>
- : # Separate form, because this one carries a passphrase and has
- : # no business sharing a submit with the buttons above.
- : # can_reprovision is false while one is running, so this is
- : # the only thing drawn for a guest mid-provision.
- : if ( $post.is_reprovisioning ) {
- <p class="guest-reprovisioning">
- Reprovisioning now
- : if ( $post.reprovision_by ) {
- — started by <: $post.reprovision_by :>
- : }
- : if ( $post.reprovision_log_href ) {
- — <a href="<: $post.reprovision_log_href :>" target="_blank" rel="noopener">watch the log</a>
- : }
- </p>
- : }
- : if ( $post.can_reprovision ) {
- <form class="Submissions guest-reprovision" action="/guest/reprovision" method="POST" autocomplete="off">
- <input type="hidden" name="guest" value="<: $post.domain :>" />
- <input type="hidden" name="to" value="<: $route :>" />
- : # The passphrase is asked for in the popover rather than
- : # sat in the page, so nothing is typed until Reprovision is
- : # pressed, and the confirmation is a button you have to hit
- : # rather than a confirm() nobody reads. The popover stays
- : # inside the form, so the passphrase is submitted with it.
- : # popovertarget as well as the command attributes, since a
- : # browser which has popover but not invoker commands would
- : # otherwise have no way to open this at all. Where both are
- : # understood the command wins and the target is ignored, so
- : # they do not fight.
- <button class="coolbutton guest-destroy" type="button"
- command="show-popover" commandfor="reprovision-<: $post.id :>"
- popovertarget="reprovision-<: $post.id :>" popovertargetaction="show">Reprovision</button>
- : # A browser old enough to have neither draws this inline and
- : # submits it, which is the form this replaced, minus the
- : # confirmation.
- <div popover id="reprovision-<: $post.id :>" class="guest-reprovision-popover">
- <p class="guest-reprovision-warning">
- 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.
- </p>
- <label>
- Secrets passphrase
- <input required autofocus class="cooltext" type="password" name="passphrase" autocomplete="off"
- title="the provisioner asks for this on stdin; it is used for this run and not stored" />
- </label>
- <div class="guest-reprovision-actions">
- <button class="coolbutton" type="button"
- command="hide-popover" commandfor="reprovision-<: $post.id :>"
- popovertarget="reprovision-<: $post.id :>" popovertargetaction="hide">Cancel</button>
- <button class="coolbutton guest-destroy" type="submit">Reprovision it</button>
- </div>
- </div>
- </form>
- : }
- : }
- </div>
- : }
- : }
- </div>
|