{{ define "schema-form" }} {{ $readonly := .ReadOnly }} {{ $networks := .AvailableNetworks }} {{ $data := .Data }} {{ range $name, $schema := .Schema.Fields }} {{ if eq $schema.Kind 0 }} {{ else if eq $schema.Kind 1 }} {{ else if eq $schema.Kind 4 }} {{ else if eq $schema.Kind 3 }} {{ else if eq $schema.Kind 5 }} {{ $auth := index $data $name }} {{ $authEnabled := false }} {{ $authGroups := "" }} {{ if and $auth (index $auth "enabled") }}{{ $authEnabled = true }}{{ end }} {{ if and $auth (index $auth "groups") }}{{ $authGroups = index $auth "groups" }}{{ end }} {{ else if eq $schema.Kind 6 }} {{ $sshKey := index $data $name }} {{ $public := "" }} {{ $private := "" }} {{ if $sshKey }}{{ $public = index $sshKey "public" }}{{ end }} {{ if $sshKey }}{{ $private = index $sshKey "private" }}{{ end }} {{ end }} {{ end }} {{ end }} {{ define "main" }} {{ $instance := .Instance }}

{{ .App.Icon }}{{ .App.Name }}



{{ $schema := .App.Schema }}
{{ $networks := .AvailableNetworks }}

{{ if $instance }} {{ template "schema-form" (dict "Schema" $schema "AvailableNetworks" $networks "ReadOnly" false "Data" $instance.Config) }} {{ else }} {{ template "schema-form" (dict "Schema" $schema "AvailableNetworks" $networks "ReadOnly" false "Data" (dict)) }} {{ end }} {{ if $instance }}
{{ else }} {{ end }}
{{ range .Instances }} {{ if or (not $instance) (ne $instance.Id .Id)}}
{{ .Id }} {{ template "schema-form" (dict "Schema" $schema "AvailableNetworks" $networks "ReadOnly" true "Data" .Config ) }} View
{{ end }} {{ end }} {{ end }}