| 1 | {{define "fleetdetail"}}{{template "top" .}} |
| 2 | {{if .Flash}}<p class="banner">{{.Flash}}</p>{{end}} |
| 3 | {{if .FlashErr}}<p class="banner error">{{.FlashErr}}</p>{{end}} |
| 4 | <div class="pagehead"> |
| 5 | <p class="eyebrow">Fleet · {{.Account.Name}}</p> |
| 6 | <h1>{{.FleetDetail.Name}}</h1> |
| 7 | <p class="lede">Your own boxes, dialling this console — and the apps placed on them.</p> |
| 8 | </div> |
| 9 | <p class="small">Data bucket <code>{{.FleetDetail.Bucket}}</code></p> |
| 10 | |
| 11 | {{if .RotatedToken}} |
| 12 | <div class="banner"> |
| 13 | <p><strong>New token for {{.FleetDetail.Name}}/{{.RotatedLabel}}:</strong> <code>{{.RotatedToken}}</code></p> |
| 14 | <p class="small">(shown once — the console does not store or re-show the plaintext)</p> |
| 15 | <p class="small">ROTATION IS NOT REVOCATION: this refuses the box's NEXT dial-in with the OLD |
| 16 | token, but does NOT evict a channel it already holds — a COMPROMISED box needs Detach, not |
| 17 | another Rotate.</p> |
| 18 | </div> |
| 19 | {{end}} |
| 20 | |
| 21 | <h2>Boxes</h2> |
| 22 | {{if .FleetBoxes}} |
| 23 | <div class="tablewrap"> |
| 24 | <table> |
| 25 | <tr> |
| 26 | <th>Label</th><th>Status</th><th>Tags</th><th>Tunnel</th> |
| 27 | <th>Memory free</th><th>Load</th><th>Disk free</th><th>Release</th> |
| 28 | {{if .IsOwner}}<th></th>{{end}} |
| 29 | </tr> |
| 30 | {{range .FleetBoxes}} |
| 31 | <tr> |
| 32 | <td>{{.Label}}</td> |
| 33 | <td>{{.Status}}</td> |
| 34 | <td>{{range .Tags}}<span class="chip chip-env">{{.}}</span> {{end}}{{if not .Tags}}—{{end}}</td> |
| 35 | {{if .Reachable}} |
| 36 | <td>{{emptyOrDash .Tunnel}}</td> |
| 37 | <td>{{if .Metrics}}{{bytesOrDash .Metrics.MemAvailBytes}} / {{bytesOrDash .Metrics.MemTotalBytes}}{{else}}—{{end}}</td> |
| 38 | <td>{{if .Metrics}}{{loadOrDash .Metrics.Load1}}{{else}}—{{end}}</td> |
| 39 | <td>{{if .Metrics}}{{bytesOrDash .Metrics.DiskFreeBytes}}{{else}}—{{end}}</td> |
| 40 | <td>{{if .Metrics}}{{emptyOrDash .Metrics.Release}}{{else}}—{{end}}</td> |
| 41 | {{else if .Age}} |
| 42 | <td colspan="5"><span class="chip chip-down">unreachable</span> last heartbeat {{.Age}} ago</td> |
| 43 | {{else}} |
| 44 | <td colspan="5" class="small">no heartbeat yet — unreachable (age unknown)</td> |
| 45 | {{end}} |
| 46 | {{if $.IsOwner}} |
| 47 | <td> |
| 48 | <form method="post" action="{{$.Base}}/fleets/{{$.FleetDetail.Name}}/rotate"> |
| 49 | <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| 50 | <input type="hidden" name="label" value="{{.Label}}"> |
| 51 | <button type="submit" class="linkish">Rotate token</button> |
| 52 | </form> |
| 53 | <form method="post" action="{{$.Base}}/fleets/{{$.FleetDetail.Name}}/detach"> |
| 54 | <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| 55 | <input type="hidden" name="label" value="{{.Label}}"> |
| 56 | <button type="submit" class="linkish danger">Detach</button> |
| 57 | </form> |
| 58 | <form method="post" action="{{$.Base}}/fleets/{{$.FleetDetail.Name}}/tags"> |
| 59 | <input type="hidden" name="csrf" value="{{$.CSRF}}"> |
| 60 | <input type="hidden" name="label" value="{{.Label}}"> |
| 61 | <input type="text" name="tags" value="{{join .Tags ","}}" size="14" placeholder="office,free"> |
| 62 | <button type="submit" class="linkish">Tag</button> |
| 63 | </form> |
| 64 | </td> |
| 65 | {{end}} |
| 66 | </tr> |
| 67 | {{end}} |
| 68 | </table> |
| 69 | </div> |
| 70 | <p class="small">Rotating a token refuses that box's NEXT dial-in with the old credential but does |
| 71 | not evict a channel it already holds; a compromised box needs Detach instead.</p> |
| 72 | {{else}}<p class="small">No boxes registered to this fleet yet — add one with <code>carlos fleets add-box</code>.</p>{{end}} |
| 73 | |
| 74 | <h2>Placed apps</h2> |
| 75 | {{if .FleetApps}} |
| 76 | <div class="tablewrap"> |
| 77 | <table> |
| 78 | <tr><th>App</th><th>Hosts</th></tr> |
| 79 | {{range .FleetApps}} |
| 80 | <tr> |
| 81 | <td><a href="{{$.Nav}}/apps/{{.App}}">{{.App}}</a></td> |
| 82 | <td>{{range .Hosts}}<code>{{.}}</code> {{end}}</td> |
| 83 | </tr> |
| 84 | {{end}} |
| 85 | </table> |
| 86 | </div> |
| 87 | {{else}}<p class="small">No apps placed on this fleet yet — <code>carlos apps place</code> sends one here.</p>{{end}} |
| 88 | |
| 89 | {{if and .IsOwner .FleetPlaceableApps}} |
| 90 | <h3>Place an app here</h3> |
| 91 | <form method="post" action="{{.Base}}/fleets/{{.FleetDetail.Name}}/place" class="settings-row"> |
| 92 | <input type="hidden" name="csrf" value="{{.CSRF}}"> |
| 93 | <label class="visually-hidden" for="place-app">App to place on this fleet</label> |
| 94 | <select id="place-app" name="app"> |
| 95 | {{range .FleetPlaceableApps}}<option value="{{.}}">{{.}}</option>{{end}} |
| 96 | </select> |
| 97 | <button type="submit" class="btn-sm">Move</button> |
| 98 | </form> |
| 99 | <p class="small">Moving changes where that app <em>serves</em>. Data does not move: |
| 100 | hibernated instance state stays in the old placement's bucket.</p> |
| 101 | {{end}} |
| 102 | {{template "bottom" .}}{{end}} |
| 103 | |