Files
crowdsec-dashy/web/templates/pages/machines.html
T

82 lines
3.1 KiB
HTML

{{template "base" .}}
{{define "content"}}
<div style="max-width:1200px">
<div style="margin-bottom:16px">
<div class="page-title">Machines</div>
<div class="page-sub">CrowdSec agent registrations</div>
</div>
{{if not .CLIAvailable}}
<div class="cli-unavail-banner" style="margin-bottom:16px">
<div>
<strong style="display:block;margin-bottom:4px">cscli unavailable</strong>
Machine management requires the cscli binary. Mount it at the CSCLI_PATH configured in your environment.
</div>
</div>
{{end}}
<div class="panel">
<div class="panel-header">
<span class="panel-title">Machines ({{len .Machines}})</span>
</div>
{{if .Machines}}
<div style="overflow-x:auto">
<table class="data-table">
<thead>
<tr>
<th>Machine ID</th>
<th>IP</th>
<th>Last Heartbeat</th>
<th>Version</th>
<th>Auth</th>
<th>Status</th>
{{if $.CLIAvailable}}<th>Actions</th>{{end}}
</tr>
</thead>
<tbody>
{{range .Machines}}
<tr>
<td style="font-family:'JetBrains Mono',monospace;font-size:12px;font-weight:600" title="{{.MachineID}}">{{truncate .MachineID 32}}</td>
<td style="font-family:'JetBrains Mono',monospace;font-size:12px">{{.IPAddress}}</td>
<td style="font-size:12px;color:var(--muted)">{{truncate .LastHeartbeat 16}}</td>
<td style="font-family:'JetBrains Mono',monospace;font-size:11px;color:var(--muted)">{{.Version}}</td>
<td style="font-size:12px;color:var(--muted)">{{.AuthType}}</td>
<td>
{{if .IsValidated}}
<span class="badge badge-green">validated</span>
{{else}}
<span class="badge badge-amber">pending</span>
{{end}}
</td>
{{if $.CLIAvailable}}
<td style="display:flex;gap:6px;flex-wrap:wrap">
{{if not .IsValidated}}
<form method="POST" action="/machines/validate" style="display:inline">
<input type="hidden" name="_csrf" value="{{$.CSRFToken}}">
<input type="hidden" name="id" value="{{.MachineID}}">
<button type="submit" class="btn-safe-sm" data-confirm="Validate machine {{.MachineID}}?">Validate</button>
</form>
{{end}}
<form method="POST" action="/machines/delete" style="display:inline">
<input type="hidden" name="_csrf" value="{{$.CSRFToken}}">
<input type="hidden" name="id" value="{{.MachineID}}">
<button type="submit" class="btn-danger-sm" data-confirm="Delete machine {{.MachineID}}?">Delete</button>
</form>
</td>
{{end}}
</tr>
{{end}}
</tbody>
</table>
</div>
{{else}}
<div class="empty-state">
<div class="empty-text">No machines registered</div>
<div class="empty-sub">Register an agent: cscli machines add &lt;name&gt; -a</div>
</div>
{{end}}
</div>
</div>
{{end}}