web/admin: fix default for codemirror

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-17 19:37:13 +02:00
parent 78dd7b0341
commit 240136154b
4 changed files with 5 additions and 4 deletions

View File

@ -121,7 +121,7 @@ export class GroupForm extends Form<Group> {
<ak-form-element-horizontal
label=${t`Attributes`}
name="attributes">
<ak-codemirror mode="yaml" value="${YAML.stringify(this.group?.attributes)}">
<ak-codemirror mode="yaml" value="${YAML.stringify(first(this.group?.attributes, {}))}">
</ak-codemirror>
<p class="pf-c-form__helper-text">${t`Set custom attributes using YAML or JSON.`}</p>
</ak-form-element-horizontal>

View File

@ -65,7 +65,7 @@ export class ServiceConnectionKubernetesForm extends Form<KubernetesServiceConne
<ak-form-element-horizontal
label=${t`Kubeconfig`}
name="kubeconfig">
<ak-codemirror mode="yaml" value="${YAML.stringify(this.sc?.kubeconfig)}">
<ak-codemirror mode="yaml" value="${YAML.stringify(first(this.sc?.kubeconfig, {}))}">
</ak-codemirror>
<p class="pf-c-form__helper-text">${t`Set custom attributes using YAML or JSON.`}</p>
</ak-form-element-horizontal>

View File

@ -7,6 +7,7 @@ import { Form } from "../../../elements/forms/Form";
import "../../../elements/forms/HorizontalFormElement";
import "../../../elements/CodeMirror";
import YAML from "yaml";
import { first } from "../../../utils";
@customElement("ak-invitation-form")
export class InvitationForm extends Form<Invitation> {
@ -46,7 +47,7 @@ export class InvitationForm extends Form<Invitation> {
<ak-form-element-horizontal
label=${t`Attributes`}
name="fixedData">
<ak-codemirror mode="yaml" value="${YAML.stringify(this.invitation?.fixedData)}">
<ak-codemirror mode="yaml" value="${YAML.stringify(first(this.invitation?.fixedData, {}))}">
</ak-codemirror>
<p class="pf-c-form__helper-text">${t`Optional data which is loaded into the flow's 'prompt_data' context variable. YAML or JSON.`}</p>
</ak-form-element-horizontal>

View File

@ -72,7 +72,7 @@ export class UserForm extends Form<User> {
<ak-form-element-horizontal
label=${t`Attributes`}
name="attributes">
<ak-codemirror mode="yaml" value="${YAML.stringify(this.user?.attributes)}">
<ak-codemirror mode="yaml" value="${YAML.stringify(first(this.user?.attributes, {}))}">
</ak-codemirror>
<p class="pf-c-form__helper-text">${t`Set custom attributes using YAML or JSON.`}</p>
</ak-form-element-horizontal>