diff --git a/internal/web/render_test.go b/internal/web/render_test.go
index d3b3459..3efcef1 100644
--- a/internal/web/render_test.go
+++ b/internal/web/render_test.go
@@ -138,3 +138,61 @@ func TestRenderUnknownPage(t *testing.T) {
t.Errorf("status = %d, want 500", rec.Code)
}
}
+
+// The browser sorts IP columns by comparing these keys as plain strings, so
+// their byte order has to be the addresses' numeric order.
+func TestIPSortKeyOrdersNumerically(t *testing.T) {
+ ordered := []string{
+ "10.0.0.2",
+ "10.0.0.9",
+ "10.0.0.10",
+ "10.0.1.0/16",
+ "10.0.1.0/24",
+ "192.168.1.1",
+ "192.168.1.100",
+ "255.255.255.255",
+ // every IPv6 value follows every IPv4 one, including those that are
+ // numerically below the IPv4-mapped range
+ "::/0",
+ "::1",
+ "::ffff:10.0.0.1",
+ "2001:db8::1",
+ "2001:db8::a",
+ "2001:db8::10",
+ }
+ for i := 1; i < len(ordered); i++ {
+ a, b := ipSortKey(ordered[i-1]), ipSortKey(ordered[i])
+ if a >= b {
+ t.Errorf("ipSortKey(%q) = %q is not below ipSortKey(%q) = %q", ordered[i-1], a, ordered[i], b)
+ }
+ }
+ if a, b := ipSortKey("10.0.0.1"), ipSortKey("::ffff:10.0.0.1"); a == b {
+ t.Errorf("10.0.0.1 and its IPv4-mapped IPv6 form share the key %q", a)
+ }
+ if got := ipSortKey("not-an-ip"); got != "not-an-ip" {
+ t.Errorf("unparseable input: got %q, want it unchanged", got)
+ }
+}
+
+// Every table header that can be sorted is marked for app.js, and the cells
+// under an IP column carry the server-built key rather than relying on text.
+func TestRenderSortableHeaders(t *testing.T) {
+ s := &Server{tmpls: parseTemplates(), version: "dev"}
+ rec := httptest.NewRecorder()
+ s.render(rec, httptest.NewRequest(http.MethodGet, "/", nil), "subnets", pageData{
+ Title: "Subnets",
+ Data: []subnetRow{{ID: 1, CIDR: "10.0.0.0/24", Name: "lan", ScanEnabled: true, ScanIntervalSec: 300, LastScanAt: 1700000000}, {ID: 2, CIDR: "10.0.1.0/24"}},
+ })
+ body := rec.Body.String()
+ for _, want := range []string{
+ `
CIDR | `,
+ `Last scan | `,
+ `data-v="` + ipSortKey("10.0.0.0/24") + `"`,
+ `data-v="1700000000"`, // a real scan time sorts by its timestamp
+ `data-v=""`, // "never" sorts as empty, i.e. last
+ } {
+ if !strings.Contains(body, want) {
+ t.Errorf("subnets page: missing %q", want)
+ }
+ }
+}
diff --git a/internal/web/router.go b/internal/web/router.go
index c3add17..84f3405 100644
--- a/internal/web/router.go
+++ b/internal/web/router.go
@@ -24,6 +24,7 @@ import (
"io/fs"
"log/slog"
"net/http"
+ "net/netip"
"strings"
"sync"
"time"
@@ -76,10 +77,39 @@ type Server struct {
setupToken string
}
+// ipSortKey turns an address or CIDR into a string whose byte order is its
+// numeric order, so the browser can sort an IP column with a plain string
+// compare (10.0.0.9 before 10.0.0.10, a /16 before the /24 at the same
+// base). Anything unparseable sorts as itself.
+//
+// The key leads with the address family. As16 alone is not enough: it puts
+// IPv4 at ::ffff:a.b.c.d, in the middle of IPv6 space, so ::1 would sort
+// before every IPv4 address and ::ffff:10.0.0.1 would collide with 10.0.0.1.
+func ipSortKey(s string) string {
+ if p, err := netip.ParsePrefix(s); err == nil {
+ return fmt.Sprintf("%s/%03d", addrSortKey(p.Addr()), p.Bits())
+ }
+ if a, err := netip.ParseAddr(s); err == nil {
+ return addrSortKey(a)
+ }
+ return s
+}
+
+// addrSortKey is "4" or "6" followed by the address as 32 hex digits, so
+// all of IPv4 orders before all of IPv6 (IPv4-mapped IPv6 counts as IPv6).
+func addrSortKey(a netip.Addr) string {
+ family := "6"
+ if a.Is4() {
+ family = "4"
+ }
+ return fmt.Sprintf("%s%x", family, a.As16())
+}
+
var funcMap = template.FuncMap{
"fields": func(s string) []string {
return strings.Fields(s)
},
+ "ipKey": ipSortKey,
"relTime": func(u int64) string {
if u == 0 {
return "never"
diff --git a/internal/web/static/app.js b/internal/web/static/app.js
index 6836f99..57ddc6e 100644
--- a/internal/web/static/app.js
+++ b/internal/web/static/app.js
@@ -22,6 +22,180 @@
bindFilter();
bindConfirms();
bindRowEdit();
+ bindSort();
+ bindClip();
+ }
+
+ // A td.clip cell cuts long text off with an ellipsis. The full text is in
+ // its title, but a tooltip needs a mouse, so any cell that is actually
+ // truncated becomes a keyboard- and touch-operable toggle: click, Enter or
+ // Space expands it to wrap in place, and again collapses it. Cells that
+ // fit are left alone, so they add no tab stops.
+ //
+ // The cell deliberately keeps its table-cell role: the text is only cut
+ // off visually, so a screen reader already reads all of it in its column,
+ // and turning the cell into a button would take that away.
+ //
+ // Controls inside the cell (links, the inline-edit input) keep their own
+ // behaviour, so a click on one of them is not a toggle.
+ function isClipToggle(e, td) {
+ return td.classList.contains('clipped') && !e.target.closest('a, input, button, select, textarea');
+ }
+
+ function bindClip() {
+ const cells = Array.prototype.slice.call(document.querySelectorAll('td.clip'));
+ if (!cells.length) return;
+
+ function measure() {
+ cells.forEach(function (td) {
+ if (td.classList.contains('expanded')) return;
+ const cut = td.scrollWidth > td.clientWidth;
+ td.classList.toggle('clipped', cut);
+ if (cut) td.tabIndex = 0;
+ else td.removeAttribute('tabindex');
+ });
+ }
+
+ function toggle(td) {
+ if (!td.classList.toggle('expanded')) measure();
+ }
+
+ cells.forEach(function (td) {
+ td.addEventListener('click', function (e) {
+ if (isClipToggle(e, td)) toggle(td);
+ });
+ td.addEventListener('keydown', function (e) {
+ if (e.target !== td || (e.key !== 'Enter' && e.key !== ' ')) return;
+ e.preventDefault();
+ toggle(td);
+ });
+ });
+
+ // Whether a cell is cut off depends on its column's width and its own
+ // content, and both move without any window resize: the web font
+ // swapping in after first paint (font-display: swap), the filter hiding
+ // rows, a row entering edit mode (which swaps the text for an input).
+ // So re-measure when the fonts settle, whenever a clip cell changes
+ // size, and after any click or typing on the page, not only on resize.
+ let timer = null;
+ function schedule() {
+ clearTimeout(timer);
+ timer = setTimeout(measure, 150);
+ }
+ window.addEventListener('resize', schedule);
+ document.addEventListener('click', schedule);
+ document.addEventListener('input', schedule);
+ if (document.fonts) {
+ // A font that fails to load changes nothing to measure; the resize
+ // paths below still cover every later layout change.
+ document.fonts.ready.then(measure).catch(function () { /* nothing to re-measure */ });
+ }
+ if (typeof ResizeObserver === 'function') {
+ const observer = new ResizeObserver(schedule);
+ cells.forEach(function (td) { observer.observe(td); });
+ }
+ measure();
+ }
+
+ // Click-to-sort for every table whose header cells carry data-sort:
+ // "text" (natural, case-insensitive), "num", or "key" (exact code-unit
+ // order, for the server-built IP sort keys, which a natural compare would
+ // misread as numbers). A cell sorts by its data-v attribute when it has
+ // one (timestamps, IP keys, raw counts) and by its text otherwise. Empty
+ // values always sink to the bottom. The choice is remembered per table for
+ // the browser session, so saving a row edit doesn't reshuffle the list.
+ //
+ // sortValue reads one cell's sort value: null when empty (or not a number
+ // in a numeric column), so the caller can sink it.
+ function sortValue(tr, col, numeric) {
+ const td = tr.cells[col];
+ if (!td) return null;
+ const raw = (td.dataset.v === undefined ? td.textContent : td.dataset.v).trim();
+ if (raw === '') return null;
+ if (!numeric) return raw;
+ const n = Number.parseFloat(raw);
+ return Number.isNaN(n) ? null : n;
+ }
+
+ function compareExact(a, b) {
+ if (a < b) return -1;
+ return a > b ? 1 : 0;
+ }
+
+ function sortArrow(dir) {
+ return dir > 0 ? '\u2191' : '\u2193';
+ }
+
+ // nextSortDir: an unsorted column starts in its preferred direction
+ // (data-first="desc" for times), a sorted one flips.
+ function nextSortDir(th) {
+ const current = th.getAttribute('aria-sort');
+ if (current === null) return th.dataset.first === 'desc' ? -1 : 1;
+ return current === 'ascending' ? -1 : 1;
+ }
+
+ function bindSort() {
+ const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });
+
+ document.querySelectorAll('table').forEach(function (table, tableIndex) {
+ const body = table.tBodies[0];
+ const heads = Array.prototype.slice.call(table.querySelectorAll('thead th[data-sort]'));
+ if (!body || !heads.length || body.querySelector('td.empty-row')) return;
+ const storeKey = 'sort:' + location.pathname + '#' + tableIndex;
+
+ function apply(th, dir) {
+ const col = th.cellIndex;
+ const numeric = th.dataset.sort === 'num';
+ const exact = th.dataset.sort === 'key';
+ const rows = Array.prototype.map.call(body.rows, function (tr, i) {
+ return { tr: tr, v: sortValue(tr, col, numeric), i: i };
+ });
+ rows.sort(function (a, b) {
+ if (a.v === null || b.v === null) {
+ if (a.v === b.v) return a.i - b.i;
+ return a.v === null ? 1 : -1;
+ }
+ let c;
+ if (numeric) c = a.v - b.v;
+ else if (exact) c = compareExact(a.v, b.v);
+ else c = collator.compare(a.v, b.v);
+ return c === 0 ? a.i - b.i : c * dir;
+ });
+ rows.forEach(function (r) { body.appendChild(r.tr); });
+
+ heads.forEach(function (h) {
+ const on = h === th;
+ h.classList.toggle('sorted', on);
+ if (on) h.setAttribute('aria-sort', dir > 0 ? 'ascending' : 'descending');
+ else h.removeAttribute('aria-sort');
+ h.querySelector('.arrow').textContent = on ? sortArrow(dir) : '';
+ });
+ try { sessionStorage.setItem(storeKey, col + ':' + dir); } catch (e) { /* private mode */ }
+ }
+
+ heads.forEach(function (th) {
+ const btn = document.createElement('button');
+ btn.type = 'button';
+ btn.className = 'th-sort';
+ while (th.firstChild) btn.appendChild(th.firstChild);
+ const arrow = document.createElement('span');
+ arrow.className = 'arrow';
+ arrow.setAttribute('aria-hidden', 'true');
+ btn.appendChild(arrow);
+ th.appendChild(btn);
+ btn.addEventListener('click', function () {
+ apply(th, nextSortDir(th));
+ });
+ });
+
+ let saved = null;
+ try { saved = sessionStorage.getItem(storeKey); } catch (e) { /* private mode */ }
+ if (saved) {
+ const parts = saved.split(':');
+ const th = heads.find(function (h) { return h.cellIndex === Number(parts[0]); });
+ if (th) apply(th, parts[1] === '-1' ? -1 : 1);
+ }
+ });
}
function bindRowEdit() {
diff --git a/internal/web/static/style.css b/internal/web/static/style.css
index 970f1aa..343714a 100644
--- a/internal/web/static/style.css
+++ b/internal/web/static/style.css
@@ -57,8 +57,8 @@
/* density knobs */
--root-size: 13px;
- --row-y: 7px;
- --row-x: 12px;
+ --row-h: 30px;
+ --row-x: 10px;
--gap: 14px;
--main-pad: 22px 28px 40px;
--ctl-y: 6px;
@@ -87,8 +87,7 @@
:root[data-density="compact"] {
--root-size: 12px;
- --row-y: 3px;
- --row-x: 10px;
+ --row-h: 25px;
--gap: 10px;
--main-pad: 14px 18px 28px;
--ctl-y: 4px;
@@ -133,7 +132,7 @@ button.primary { background: var(--accent); border-color: var(--accent); color:
button.primary:hover { filter: brightness(1.1); color: var(--accent-ink); }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
-button.small { padding: 3px 9px; font-size: 0.846rem; }
+button.small { padding: 1px 8px; font-size: 0.846rem; }
/* Radio group drawn as a segmented control; the inputs stay in the DOM
(and keyboard-reachable) but are visually replaced by their . */
@@ -231,7 +230,6 @@ h2 a { letter-spacing: 0; text-transform: none; }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
-.sub { margin-top: 2px; font-size: 0.846rem; color: var(--muted); }
.hint { font-size: 0.846rem; color: var(--muted); }
.err-inline { color: var(--bad); font-weight: 700; cursor: help; }
.more { margin: 10px 0 0; font-size: 0.923rem; }
@@ -243,22 +241,52 @@ h2 a { letter-spacing: 0; text-transform: none; }
.table { border: 1px solid var(--line); border-radius: 4px; background: var(--panel); overflow-x: auto; }
.table + .hint { margin-top: 8px; }
-/* min-width: on a phone the .table wrapper scrolls sideways rather than
- wrapping every cell into a column of single words. */
-table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 0.923rem; }
-th, td { padding: var(--row-y) var(--row-x); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
+/* Table layout and sizing follow idlerthing's server inventory: every row
+ is one line at a fixed height, cells never wrap (long text is clipped
+ with an ellipsis and kept in the title), and the header is a small
+ uppercase strip on its own shade. On a narrow screen the .table wrapper
+ scrolls sideways. */
+table { width: 100%; border-collapse: collapse; font-size: 1rem; }
+th, td { text-align: left; vertical-align: middle; white-space: nowrap; border-bottom: 1px solid var(--line); }
th {
- padding-top: calc(var(--row-y) + 1px); padding-bottom: calc(var(--row-y) + 1px);
- font-size: 0.808rem; font-weight: 500; color: var(--muted);
- text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
+ padding: 4px var(--row-x); background: var(--panel2);
+ font-size: 0.77rem; font-weight: 600; color: var(--muted);
+ text-transform: uppercase; letter-spacing: 0.07em;
}
+td { height: var(--row-h); padding: 0 var(--row-x); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel2); }
-td.empty-row { padding: 28px var(--row-x); text-align: center; color: var(--muted); }
+td.empty-row { height: auto; padding: 28px var(--row-x); text-align: center; white-space: normal; color: var(--muted); }
tbody tr:hover:has(td.empty-row) { background: none; }
-.empty { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 4px; }
+td.clip { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
+/* The one free-text column per table takes whatever width is left over and
+ clips to it; the min-width keeps it usable when the wrapper scrolls. */
+td.clip.grow { width: 100%; max-width: 0; min-width: 140px; }
+/* app.js marks a cell .clipped when its text really is cut off and makes it
+ a toggle; .expanded wraps the full text in place, so reading it never
+ depends on a hover tooltip. */
+td.clip.clipped { cursor: pointer; }
+td.clip.clipped:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
+td.clip.expanded { padding-top: 6px; padding-bottom: 6px; white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }
+table:has(td.grow) { min-width: 760px; }
+.hosts-table:has(td.grow) { min-width: 1000px; }
+td.col-muted { color: var(--muted); }
+
+/* Links inside a table read as plain text until hovered. */
+td a { color: var(--text); }
+td a:hover { color: var(--accent-hover); text-decoration: underline; }
+
+/* Sortable headers: app.js wraps each th[data-sort] label in this button. */
+button.th-sort {
+ display: inline-flex; align-items: center; padding: 0; border: 0; border-radius: 0;
+ background: none; color: inherit; font: inherit; line-height: inherit;
+ text-transform: inherit; letter-spacing: inherit;
+}
+button.th-sort:hover { color: var(--text); }
+button.th-sort .arrow { display: inline-block; width: 1ch; margin-left: 5px; letter-spacing: 0; }
+th.sorted button.th-sort, th.sorted .arrow { color: var(--accent); }
-.events-table td:first-child { white-space: nowrap; color: var(--muted); }
+.events-table td:first-child { color: var(--muted); }
.thead-tools {
display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
@@ -273,26 +301,20 @@ tbody tr:hover:has(td.empty-row) { background: none; }
.hosts-table th:first-child, .hosts-table td:first-child { width: 1%; padding-right: 2px; }
.hosts-table input[type="checkbox"] { display: block; }
-.hosts-table input:not([type="checkbox"]) { padding: 2px 7px; font-size: 1em; min-width: 120px; }
-/* Wide enough that no column is crushed; the .table wrapper scrolls on
- narrow screens instead. */
-.hosts-table { min-width: 900px; }
-/* hostname and comments are free text and may wrap anywhere; the rest stay on one line */
-.hosts-table td:nth-child(3), .hosts-table td:nth-child(8) { overflow-wrap: anywhere; }
-.hosts-table td:nth-child(2), .hosts-table td:nth-child(4), .hosts-table td:nth-child(7) { white-space: nowrap; }
+/* inline-edit fields sit inside the fixed row height */
+.hosts-table input:not([type="checkbox"]) { height: 22px; padding: 0 7px; font-size: 1em; min-width: 140px; }
tr.status-down td, tr.status-down td a { color: var(--muted); }
td.tag-cell { max-width: 220px; }
td.row-actions { width: 1%; }
-.acts { display: flex; justify-content: flex-end; align-items: center; gap: 6px; white-space: nowrap; }
-.row-link { margin-left: 6px; font-size: 0.846rem; color: var(--muted); }
-.row-link:hover { color: var(--text); }
+.acts { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
+.row-link, td a.row-link { margin-left: 6px; font-size: 0.846rem; color: var(--muted); }
+.row-link:hover, td a.row-link:hover { color: var(--text); }
/* host row view/edit toggle (app.js adds .editing) */
tr.host-row .edit-only { display: none; }
tr.host-row.editing .view-only { display: none; }
tr.host-row.editing input.edit-only { display: block; }
tr.host-row.editing button.edit-only { display: inline-block; }
-tr.host-row span.view-only { white-space: pre-wrap; overflow-wrap: anywhere; }
/* ---- status, tags, meters --------------------------------------------- */
@@ -315,14 +337,17 @@ tr.host-row span.view-only { white-space: pre-wrap; overflow-wrap: anywhere; }
.tag.event-mac_changed,
.tag.event-hostname_changed { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
+/* "up / total" with a thin bar after it; the fixed-width fraction keeps
+ the bars in one column. */
+.frac { display: inline-block; min-width: 9ch; }
progress.meter {
-webkit-appearance: none; appearance: none;
- display: block; width: 100%; max-width: 110px; height: 4px; margin-top: 3px;
+ display: inline-block; vertical-align: middle; width: 56px; height: 3px;
border: 0; border-radius: 2px; background: var(--line); overflow: hidden;
}
progress.meter::-webkit-progress-bar { background: var(--line); }
-progress.meter::-webkit-progress-value { background: var(--accent); }
-progress.meter::-moz-progress-bar { background: var(--accent); }
+progress.meter::-webkit-progress-value { background: var(--ok); }
+progress.meter::-moz-progress-bar { background: var(--ok); }
/* ---- forms ------------------------------------------------------------ */
@@ -379,7 +404,7 @@ label.f { display: grid; gap: 5px; font-size: 0.846rem; color: var(--muted); }
}
aside nav { flex-direction: row; flex-wrap: wrap; }
.brand { padding: 2px 8px; }
- .nav { width: auto; }
+ .nav { width: auto; padding: 6px 8px; }
/* The license and source links stay reachable at every width. */
.side-foot { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 4px; padding: 6px 8px 0; }
.spacer { display: none; }
diff --git a/internal/web/templates/dashboard.html b/internal/web/templates/dashboard.html
index dd12a20..1d96ae9 100644
--- a/internal/web/templates/dashboard.html
+++ b/internal/web/templates/dashboard.html
@@ -38,18 +38,18 @@ Subnets
-| CIDR | Name | Hosts | Up | Scanning | Interval | Last scan |
+CIDR | Name | Hosts | Up | Scanning | Interval | Last scan |
{{range .Subnets}}
-{{.CIDR}} |
-{{.Name}} |
+{{.CIDR}} |
+{{.Name}} |
{{.Hosts}} |
-{{.Up}}{{if .Hosts}} / {{.Hosts}}{{end}} |
+{{.Up}} / {{.Hosts}} |
{{if .ScanEnabled}}on{{else}}off{{end}} |
-{{.ScanIntervalSec}}s |
-{{relTime .LastScanAt}}{{if .LastScanErr}} !{{end}} |
+{{.ScanIntervalSec}}s |
+{{relTime .LastScanAt}}{{if .LastScanErr}} !{{end}} |
{{else}}
| No subnets yet. Add one. |
@@ -62,13 +62,13 @@
{{if .RecentEvents}}
-| When | Subnet | Host | Event |
+| When | Subnet | Host | Event |
{{range .RecentEvents}}
-| {{relTime .TS}} |
-{{.SubnetCIDR}} |
-{{.IP}}{{if .EffectiveHostname}} {{.EffectiveHostname}}{{end}} |
+{{relTime .TS}} |
+{{.SubnetCIDR}} |
+{{.IP}}{{if .EffectiveHostname}} {{.EffectiveHostname}}{{end}} |
{{.Event}} |
{{end}}
diff --git a/internal/web/templates/events.html b/internal/web/templates/events.html
index f487cb9..2a272cc 100644
--- a/internal/web/templates/events.html
+++ b/internal/web/templates/events.html
@@ -26,19 +26,19 @@
-| When | Subnet | Host | Event | Details |
+When | Subnet | Host | Event | Details |
{{range .Events}}
-| {{relTime .TS}} |
-{{.SubnetCIDR}} |
-
+ | {{relTime .TS}} |
+{{.SubnetCIDR}} |
+
{{.IP}}
{{if .EffectiveHostname}} {{.EffectiveHostname}}{{end}}
|
{{.Event}} |
-{{if .Details}}{{.Details}}{{end}} |
+{{if .Details}}{{.Details}}{{end}} |
{{end}}
diff --git a/internal/web/templates/host.html b/internal/web/templates/host.html
index c652f64..6fdcca9 100644
--- a/internal/web/templates/host.html
+++ b/internal/web/templates/host.html
@@ -68,13 +68,13 @@ Scan history
{{if .Events}}
-| When | Event | Details |
+| When | Event | Details |
{{range .Events}}
-| {{relTime .TS}} |
+{{relTime .TS}} |
{{.Event}} |
-{{if .Details}}{{.Details}}{{end}} |
+{{if .Details}}{{.Details}}{{end}} |
{{end}}
diff --git a/internal/web/templates/hosts.html b/internal/web/templates/hosts.html
index 75dbd24..f91b477 100644
--- a/internal/web/templates/hosts.html
+++ b/internal/web/templates/hosts.html
@@ -83,23 +83,22 @@ {{if .Subnet.Name}}{{.Subnet.Name}}{{else}}{{.Subnet.CIDR}}{{end}}