import { DummyPolicy, PoliciesApi } from "authentik-api"; import { gettext } from "django"; 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 { ifDefined } from "lit-html/directives/if-defined"; import "../../../elements/forms/HorizontalFormElement"; import "../../../elements/forms/FormGroup"; @customElement("ak-policy-dummy-form") export class DummyPolicyForm extends Form { set policyUUID(value: string) { new PoliciesApi(DEFAULT_CONFIG).policiesDummyRead({ policyUuid: value, }).then(policy => { this.policy = policy; }); } @property({attribute: false}) policy?: DummyPolicy; getSuccessMessage(): string { if (this.policy) { return gettext("Successfully updated policy."); } else { return gettext("Successfully created policy."); } } send = (data: DummyPolicy): Promise => { if (this.policy) { return new PoliciesApi(DEFAULT_CONFIG).policiesDummyUpdate({ policyUuid: this.policy.pk || "", data: data }); } else { return new PoliciesApi(DEFAULT_CONFIG).policiesDummyCreate({ data: data }); } }; renderForm(): TemplateResult { return html`

${gettext("When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.")}

${gettext("Policy-specific settings")}

${gettext("When this option is enabled, all executions of this policy will be logged. By default, only execution errors are logged.")}

${gettext("The policy takes a random time to execute. This controls the minimum time it will take.")}

`; } }