{{/* Copyright (c) ClaceIO, LLC */}} {{/* SPDX-License-Identifier: Apache-2.0 */}} {{/* Generic config entry form (/config/entry?section=X[&name=Y]): renders the fields from the CONFIG_SECTIONS descriptor in handler.star, so new sections need no template or backend change. Saving is live immediately (no staging). Secret fields are write-only: blank on edit keeps the stored value via the redaction placeholder */}} {{ template "head" . }}
{{ template "drawer_toggle" }}
{{ template "page_progress" }} {{ block "op_form" . }}
{{ template "error_alert" .Data.Error }}
{{ if .Data.Meta.name_help }}

{{ .Data.Meta.name_help }}

{{ end }}
{{ if .Data.Meta.kv }}
{{ or .Data.Meta.kv_label "Properties" }} {{ template "kv_table" (dict "Field" "properties" "AppPath" .AppPath "Prefix" (or .Data.Meta.secret_prefix .Data.Meta.section) "CanCreate" (index .Data.Perms "secret:create") "CanDelete" (index .Data.Perms "secret:delete") "Rows" (index .Data.Values "properties_rows") "KeyPlaceholder" "property" "ValuePlaceholder" "value" "AddLabel" "Add property") }} {{ if .Data.Meta.kv_help }}

{{ .Data.Meta.kv_help }}

{{ end }} {{ if .Data.IsEdit }}

Secret values show as <redacted> - leave them unchanged to keep the stored value

{{ end }}
{{ end }} {{ range .Data.Meta.fields }} {{ $value := index $.Data.Values .name }} {{ $kind := or .kind "text" }}
{{ if eq $kind "bool" }} {{ else if eq $kind "list" }} {{ else if eq $kind "select" }} {{ $opts := index $.Data.FieldOptions .name }} {{ $current := printf "%s" (or $value "") }} {{ else if eq $kind "checklist" }} {{ .label }} {{ $opts := index $.Data.FieldOptions .name }} {{ $current := $value }} {{ $fieldName := .name }}
{{ range $opts }} {{ $opt := . }} {{ $checked := false }} {{ range $current }}{{ if eq . $opt }}{{ $checked = true }}{{ end }}{{ end }} {{ end }} {{ if not $opts }} no services exist yet {{ end }} {{/* a stored entry missing from the options (deleted service) still round-trips as a checked fallback */}} {{ range $current }} {{ $cur := . }} {{ $found := false }} {{ range $opts }}{{ if eq . $cur }}{{ $found = true }}{{ end }}{{ end }} {{ if not $found }} {{ end }} {{ end }}
{{ else if eq $kind "textarea" }} {{ else if eq $kind "kvtable" }} {{ .label }} {{ template "kv_table" (dict "Field" .name "AppPath" $.AppPath "Prefix" (or $.Data.Meta.secret_prefix $.Data.Meta.section) "CanCreate" (index $.Data.Perms "secret:create") "CanDelete" (index $.Data.Perms "secret:delete") "Rows" (index $.Data.Values (printf "%s_rows" .name)) "KeyPlaceholder" "KEY" "ValuePlaceholder" "value" "AddLabel" "Add variable") }} {{ else if eq $kind "secret" }} {{ $redacted := and $value (eq (printf "%s" $value) "") }} {{ if .secretable }} {{/* A stored {{secret ...}} reference passes through redaction and renders as the locked state; a stored plain value arrives redacted and round-trips via the keep placeholder */}} {{ template "secret_input" (dict "Name" .name "InputId" (printf "entry-%s" .name) "AppPath" $.AppPath "Prefix" (or $.Data.Meta.secret_prefix $.Data.Meta.section) "CanCreate" (index $.Data.Perms "secret:create") "CanDelete" (index $.Data.Perms "secret:delete") "Value" (and (not $redacted) $value) "Masked" true "File" .file "Placeholder" (and $redacted "unchanged - leave blank to keep the stored value")) }} {{ else }} {{ end }} {{ if and $.Data.IsEdit $value }} {{ end }} {{ else if .secretable }} {{ template "secret_input" (dict "Name" .name "InputId" (printf "entry-%s" .name) "AppPath" $.AppPath "Prefix" (or $.Data.Meta.secret_prefix $.Data.Meta.section) "CanCreate" (index $.Data.Perms "secret:create") "CanDelete" (index $.Data.Perms "secret:delete") "Value" $value) }} {{ else }} {{ end }} {{ if .help }}

{{ .help }}

{{ end }}
{{ end }}
Cancel
{{ end }}
{{ template "sidebar" . }}