504338ea66
* initial Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * remove log Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * start oauth Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * use form for all type wizard pages Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * more oauth Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * basic wizard actions Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * make resets work Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * add hint in provider wizard Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * render correct icon in empty state in table page Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * improve empty state Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * more Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * add more pages Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * fix Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * add group PK to service account creation response Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * use wizard-level isValid prop Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * re-add old buttons Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
107 lines
4.2 KiB
TypeScript
107 lines
4.2 KiB
TypeScript
import { DEFAULT_CONFIG } from "@goauthentik/web/api/Config";
|
|
import "@goauthentik/web/elements/forms/ProxyForm";
|
|
import "@goauthentik/web/elements/wizard/FormWizardPage";
|
|
import "@goauthentik/web/elements/wizard/Wizard";
|
|
import { WizardPage } from "@goauthentik/web/elements/wizard/WizardPage";
|
|
import "@goauthentik/web/pages/policies/dummy/DummyPolicyForm";
|
|
import "@goauthentik/web/pages/policies/event_matcher/EventMatcherPolicyForm";
|
|
import "@goauthentik/web/pages/policies/expiry/ExpiryPolicyForm";
|
|
import "@goauthentik/web/pages/policies/expression/ExpressionPolicyForm";
|
|
import "@goauthentik/web/pages/policies/hibp/HaveIBeenPwnedPolicyForm";
|
|
import "@goauthentik/web/pages/policies/password/PasswordPolicyForm";
|
|
import "@goauthentik/web/pages/policies/reputation/ReputationPolicyForm";
|
|
|
|
import { t } from "@lingui/macro";
|
|
|
|
import { customElement } from "@lit/reactive-element/decorators/custom-element.js";
|
|
import { CSSResult, LitElement, TemplateResult, html } from "lit";
|
|
import { property } from "lit/decorators.js";
|
|
|
|
import AKGlobal from "@goauthentik/web/authentik.css";
|
|
import PFButton from "@patternfly/patternfly/components/Button/button.css";
|
|
import PFForm from "@patternfly/patternfly/components/Form/form.css";
|
|
import PFRadio from "@patternfly/patternfly/components/Radio/radio.css";
|
|
import PFBase from "@patternfly/patternfly/patternfly-base.css";
|
|
|
|
import { PoliciesApi, TypeCreate } from "@goauthentik/api";
|
|
|
|
@customElement("ak-policy-wizard-initial")
|
|
export class InitialPolicyWizardPage extends WizardPage {
|
|
@property({ attribute: false })
|
|
policyTypes: TypeCreate[] = [];
|
|
|
|
static get styles(): CSSResult[] {
|
|
return [PFBase, PFForm, PFButton, AKGlobal, PFRadio];
|
|
}
|
|
sidebarLabel = () => t`Select type`;
|
|
|
|
render(): TemplateResult {
|
|
return html`<form class="pf-c-form pf-m-horizontal">
|
|
${this.policyTypes.map((type) => {
|
|
return html`<div class="pf-c-radio">
|
|
<input
|
|
class="pf-c-radio__input"
|
|
type="radio"
|
|
name="type"
|
|
id=${`${type.component}-${type.modelName}`}
|
|
@change=${() => {
|
|
this.host.steps = [
|
|
"initial",
|
|
`type-${type.component}-${type.modelName}`,
|
|
];
|
|
this._isValid = true;
|
|
}}
|
|
/>
|
|
<label class="pf-c-radio__label" for=${`${type.component}-${type.modelName}`}
|
|
>${type.name}</label
|
|
>
|
|
<span class="pf-c-radio__description">${type.description}</span>
|
|
</div>`;
|
|
})}
|
|
</form>`;
|
|
}
|
|
}
|
|
|
|
@customElement("ak-policy-wizard")
|
|
export class PolicyWizard extends LitElement {
|
|
static get styles(): CSSResult[] {
|
|
return [PFBase, PFButton, AKGlobal, PFRadio];
|
|
}
|
|
|
|
@property()
|
|
createText = t`Create`;
|
|
|
|
@property({ attribute: false })
|
|
policyTypes: TypeCreate[] = [];
|
|
|
|
firstUpdated(): void {
|
|
new PoliciesApi(DEFAULT_CONFIG).policiesAllTypesList().then((types) => {
|
|
this.policyTypes = types;
|
|
});
|
|
}
|
|
|
|
render(): TemplateResult {
|
|
return html`
|
|
<ak-wizard
|
|
.steps=${["initial"]}
|
|
header=${t`New policy`}
|
|
description=${t`Create a new policy.`}
|
|
>
|
|
<ak-policy-wizard-initial slot="initial" .policyTypes=${this.policyTypes}>
|
|
</ak-policy-wizard-initial>
|
|
${this.policyTypes.map((type) => {
|
|
return html`
|
|
<ak-wizard-page-form
|
|
slot=${`type-${type.component}-${type.modelName}`}
|
|
.sidebarLabel=${() => t`Create ${type.name}`}
|
|
>
|
|
<ak-proxy-form type=${type.component}></ak-proxy-form>
|
|
</ak-wizard-page-form>
|
|
`;
|
|
})}
|
|
<button slot="trigger" class="pf-c-button pf-m-primary">${this.createText}</button>
|
|
</ak-wizard>
|
|
`;
|
|
}
|
|
}
|