function update

This commit is contained in:
2026-05-19 04:30:14 +00:00
parent 1293bafffa
commit 3f82dfd9e9
13 changed files with 8080 additions and 152 deletions
+59 -20
View File
@@ -16,28 +16,61 @@
</div>
{{else}}
<div class="panel" style="margin-bottom:16px">
<div class="panel-header">
<span class="panel-title">Add Entry</span>
</div>
<div class="panel-body">
<form method="POST" action="/allowlist/add">
<input type="hidden" name="_csrf" value="{{.CSRFToken}}">
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:16px;margin-bottom:16px">
<div>
<label class="field-label">Allowlist Name</label>
<input class="field-input" type="text" name="list" placeholder="default" required>
<div style="display:grid;grid-template-columns:2fr 1fr;gap:16px;margin-bottom:16px">
<div class="panel">
<div class="panel-header"><span class="panel-title">Add IPs to Allowlist</span></div>
<div class="panel-body">
<form method="POST" action="/allowlist/add">
<input type="hidden" name="_csrf" value="{{.CSRFToken}}">
<div style="display:grid;gap:12px;margin-bottom:16px">
<div>
<label class="field-label">Allowlist Name</label>
<input class="field-input" type="text" name="list" placeholder="default" required
list="list-names">
{{if .Lists}}
<datalist id="list-names">
{{range .Lists}}<option value="{{.Name}}">{{end}}
</datalist>
{{end}}
<div style="font-size:11px;color:var(--muted);margin-top:4px">
If the list does not exist it will be created automatically.
</div>
</div>
<div>
<label class="field-label">Comment (optional)</label>
<input class="field-input" type="text" name="comment" placeholder="e.g. trusted office IP">
</div>
<div>
<label class="field-label">IP Addresses / CIDR Ranges</label>
<textarea class="field-input" name="value" rows="5"
placeholder="One per line, or comma-separated:&#10;1.2.3.4&#10;192.168.0.0/24&#10;8.8.8.8, 8.8.4.4"
required style="resize:vertical;font-family:'JetBrains Mono',monospace;font-size:12px"></textarea>
</div>
</div>
<div>
<label class="field-label">Value (IP or CIDR)</label>
<input class="field-input" type="text" name="value" placeholder="1.2.3.4 or 1.2.3.0/24" required>
<div style="display:flex;justify-content:flex-end">
<button type="submit" class="btn-primary">Add to Allowlist</button>
</div>
</div>
<div style="display:flex;justify-content:flex-end">
<button type="submit" class="btn-primary">Add to Allowlist</button>
</div>
</form>
</form>
</div>
</div>
<div class="panel">
<div class="panel-header"><span class="panel-title">Create New List</span></div>
<div class="panel-body">
<form method="POST" action="/allowlist/create">
<input type="hidden" name="_csrf" value="{{.CSRFToken}}">
<div style="margin-bottom:16px">
<label class="field-label">List Name</label>
<input class="field-input" type="text" name="name" placeholder="mylist" required>
</div>
<div style="display:flex;justify-content:flex-end">
<button type="submit" class="btn-secondary">Create List</button>
</div>
</form>
</div>
</div>
</div>
{{if .Lists}}
@@ -46,6 +79,12 @@
<div class="panel-header">
<span class="panel-title">{{.Name}}</span>
{{if .Description}}<span style="font-size:12px;color:var(--muted)">{{.Description}}</span>{{end}}
<form method="POST" action="/allowlist/delete-list" style="margin-left:auto">
<input type="hidden" name="_csrf" value="{{$.CSRFToken}}">
<input type="hidden" name="name" value="{{.Name}}">
<button type="submit" class="btn-danger-sm"
data-confirm="Delete entire allowlist '{{.Name}}'? This cannot be undone.">Delete List</button>
</form>
</div>
{{if .Items}}
<table class="data-table">
@@ -88,7 +127,7 @@
<div class="panel">
<div class="empty-state">
<div class="empty-text">No allowlists found</div>
<div class="empty-sub">Create an allowlist with cscli allowlists create, then add entries above</div>
<div class="empty-sub">Use "Create New List" above, or type a list name in the Add form — it will be created automatically.</div>
</div>
</div>
{{end}}