{{/* Renders a container or list-instance as a level page. Direct leaves appear as an inline editable form (or read-only in ReadOnly mode). Structural children appear as navigation items below. Data: *leafGroupData */}} {{define "yang-leaf-group"}} {{$ro := .ReadOnly}} {{$nodeBase := "/configure/tree"}}{{if $ro}}{{$nodeBase = "/status/tree"}}{{end}}
{{if .ParentPath}} {{end}} {{.Name}} {{if and .Presence (not $ro)}}
{{if .Exists}} {{else}} {{end}}
{{else if and .Presence $ro}}
{{if .Exists}}● Enabled{{else}}○ Disabled{{end}}
{{end}} {{/* Non-presence container with data: offer "Delete" so the user can wipe out the whole subtree as a unit. Required for the NPC + mandatory-leaf idiom (bridge-port / lag-port — the mandatory leaf can't be cleared individually), and useful in general for IPv4/IPv6/DHCP-style blocks. */}} {{if and .CanDelete (not $ro)}}
{{end}}
{{if .Error}}
{{.Error}}
{{end}} {{/* ── Direct leaves ────────────────────────────────────────────── */}} {{if .Leaves}} {{if not $ro}}
{{end}}
{{range .Leaves}} {{$cv := .CurrentValue}} {{$default := .Default}} {{$hasHelp := or .Description .Default .Type}}
{{.Name}}{{if .Mandatory}}*{{end}} {{if or $ro (not .Config)}} {{if and .IsBinary .HasBinary}}
binary data
{{if $cv}}{{$cv}}{{else}}{{.RawBase64}}{{end}}
{{else}} {{if $cv}}{{$cv}}{{else}}—{{end}} {{end}} {{else if and .Type (eq .Type.Kind "boolean")}}
{{if and (eq $cv "") (not .UsingDefault)}}(not configured){{end}}
{{else if and .Type (eq .Type.Kind "enumeration") .Type.Enums}} {{else if and .Type (eq .Type.Kind "identityref") .Type.Identities}} {{else if and .Type (or (eq .Type.Kind "int8") (eq .Type.Kind "int16") (eq .Type.Kind "int32") (eq .Type.Kind "int64") (eq .Type.Kind "uint8") (eq .Type.Kind "uint16") (eq .Type.Kind "uint32") (eq .Type.Kind "uint64"))}} {{else if and .Type (eq .Type.Kind "leafref")}} {{/* Always a select for leafref leaves, even when LeafrefValues is empty (e.g. no LAGs configured yet — the field is still semantically a picker). */}} {{else if and .Type (eq .Type.Kind "binary")}} {{else}} {{end}}
{{if and (not $ro) .Config (not .Mandatory)}} {{end}}
{{if $hasHelp}}
{{if .Description}}

{{.Description}}

{{end}} {{if .Default}}{{end}} {{if .Mandatory}}{{end}} {{if .Type}}{{end}} {{if and .Type .Type.Range}}{{end}} {{if and .Type .Type.Pattern}}{{end}} {{if and .Type .Type.Leafref}}{{end}}
Default{{.Default}}
Mandatoryyes
Type{{.Type.Kind}}
Range{{.Type.Range}}
Pattern{{.Type.Pattern}}
Leafref{{.Type.Leafref}}
Path{{.Path}}
{{end}}
{{end}}
{{if not $ro}}
{{end}} {{end}} {{/* ── Inline simple sub-lists ────────────────────────────────── */}} {{range $i, $list := .InlineLists}}
{{$list.Name}}
{{if $list.Complex}}{{end}} {{range $list.Columns}}{{end}} {{if not $list.ReadOnly}}{{end}} {{range $list.Rows}} {{$row := .}} {{if $list.Complex}} {{end}} {{range $list.Columns}}{{end}} {{if not $list.ReadOnly}} {{end}} {{end}} {{if not $list.Rows}} {{end}} {{if and (not $list.Complex) (not $list.ReadOnly)}} {{/* Hidden inline add row — simple lists only */}} {{end}}
{{.DisplayName}}
{{template "icon-yt-row-arrow"}} {{index $row.Values .Name}}
No entries
{{if not $list.ReadOnly}}
{{if $list.Complex}} {{else}} {{end}}
{{end}}
{{end}} {{/* ── Inline flat sub-containers ────────────────────────────── */}} {{range .InlineContainers}} {{$sub := .}}
{{$sub.Name}}
{{if $sub.Leaves}} {{if not $sub.ReadOnly}}
{{end}}
{{range $sub.Leaves}} {{$cv := .CurrentValue}} {{$default := .Default}} {{$hasHelp := or .Description .Default .Type}}
{{.Name}}{{if .Mandatory}}*{{end}} {{if or $sub.ReadOnly (not .Config)}} {{if and .IsBinary .HasBinary}}
binary data
{{if $cv}}{{$cv}}{{else}}{{.RawBase64}}{{end}}
{{else}} {{if $cv}}{{$cv}}{{else}}—{{end}} {{end}} {{else if and .Type (eq .Type.Kind "boolean")}}
{{if and (eq $cv "") (not .UsingDefault)}}(not configured){{end}}
{{else if and .Type (eq .Type.Kind "enumeration") .Type.Enums}} {{else if and .Type (eq .Type.Kind "identityref") .Type.Identities}} {{else if and .Type (or (eq .Type.Kind "int8") (eq .Type.Kind "int16") (eq .Type.Kind "int32") (eq .Type.Kind "int64") (eq .Type.Kind "uint8") (eq .Type.Kind "uint16") (eq .Type.Kind "uint32") (eq .Type.Kind "uint64"))}} {{else if and .Type (eq .Type.Kind "leafref")}} {{else if and .Type (eq .Type.Kind "binary")}} {{else}} {{end}}
{{if and (not $sub.ReadOnly) .Config (not .Mandatory)}} {{end}}
{{if $hasHelp}}
{{if .Description}}

{{.Description}}

{{end}} {{if .Default}}{{end}} {{if .Mandatory}}{{end}} {{if .Type}}{{end}} {{if and .Type .Type.Range}}{{end}} {{if and .Type .Type.Pattern}}{{end}} {{if and .Type .Type.Leafref}}{{end}}
Default{{.Default}}
Mandatoryyes
Type{{.Type.Kind}}
Range{{.Type.Range}}
Pattern{{.Type.Pattern}}
Leafref{{.Type.Leafref}}
Path{{.Path}}
{{end}}
{{end}}
{{if not $sub.ReadOnly}}
{{end}} {{end}}
{{end}} {{/* ── Sub-sections ─────────────────────────────────────────────── */}} {{if .SubNodes}}
{{if .Leaves}}
Sub-sections
{{end}} {{range .SubNodes}} {{end}}
{{end}}
{{end}}