import { Outpost, OutpostsApi, ProvidersApi } from "authentik-api"; import { t } from "@lingui/macro"; import { customElement, property } from "lit-element"; import { html, TemplateResult } from "lit-html"; import { DEFAULT_CONFIG } from "../../api/Config"; import { Form } from "../../elements/forms/Form"; import { until } from "lit-html/directives/until"; import { ifDefined } from "lit-html/directives/if-defined"; import "../../elements/forms/HorizontalFormElement"; import "../../elements/CodeMirror"; import YAML from "yaml"; @customElement("ak-outpost-form") export class OutpostForm extends Form { @property({attribute: false}) outpost?: Outpost; getSuccessMessage(): string { if (this.outpost) { return t`Successfully updated outpost.`; } else { return t`Successfully created outpost.`; } } send = (data: Outpost): Promise => { if (this.outpost) { return new OutpostsApi(DEFAULT_CONFIG).outpostsOutpostsUpdate({ uuid: this.outpost.pk || "", data: data }); } else { return new OutpostsApi(DEFAULT_CONFIG).outpostsOutpostsCreate({ data: data }); } }; renderForm(): TemplateResult { return html`

${t`Selecting a service-connection enables the management of the outpost by authentik.`}

See documentation.

${t`Hold control/command to select multiple items.`}

${until(new OutpostsApi(DEFAULT_CONFIG).outpostsOutpostsDefaultSettings({}).then(config => { let fc = config.config; if (this.outpost) { fc = this.outpost.config; } return html` `; }))}
`; } }