mirror of
https://github.com/goauthentik/authentik
synced 2026-04-26 01:25:02 +02:00
83 lines
2.9 KiB
TypeScript
83 lines
2.9 KiB
TypeScript
import "#admin/outposts/ServiceConnectionDockerForm";
|
|
import "#admin/outposts/ServiceConnectionKubernetesForm";
|
|
import "#elements/forms/ProxyForm";
|
|
import "#elements/wizard/FormWizardPage";
|
|
import "#elements/wizard/TypeCreateWizardPage";
|
|
import "#elements/wizard/Wizard";
|
|
|
|
import { DEFAULT_CONFIG } from "#common/api/config";
|
|
|
|
import { AKElement } from "#elements/Base";
|
|
import type { Wizard } from "#elements/wizard/Wizard";
|
|
|
|
import { OutpostsApi, TypeCreate } from "@goauthentik/api";
|
|
|
|
import { msg, str } from "@lit/localize";
|
|
import { customElement } from "@lit/reactive-element/decorators/custom-element.js";
|
|
import { CSSResult, html, TemplateResult } from "lit";
|
|
import { property, query } from "lit/decorators.js";
|
|
|
|
import PFButton from "@patternfly/patternfly/components/Button/button.css";
|
|
import PFBase from "@patternfly/patternfly/patternfly-base.css";
|
|
|
|
@customElement("ak-service-connection-wizard")
|
|
export class ServiceConnectionWizard extends AKElement {
|
|
static styles: CSSResult[] = [PFBase, PFButton];
|
|
|
|
@property()
|
|
createText = msg("Create");
|
|
|
|
@property({ attribute: false })
|
|
connectionTypes: TypeCreate[] = [];
|
|
|
|
@query("ak-wizard")
|
|
wizard?: Wizard;
|
|
|
|
firstUpdated(): void {
|
|
new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsAllTypesList().then((types) => {
|
|
this.connectionTypes = types;
|
|
});
|
|
}
|
|
|
|
render(): TemplateResult {
|
|
return html`
|
|
<ak-wizard
|
|
.steps=${["initial"]}
|
|
header=${msg("New outpost integration")}
|
|
description=${msg("Create a new outpost integration.")}
|
|
>
|
|
<ak-wizard-page-type-create
|
|
slot="initial"
|
|
.types=${this.connectionTypes}
|
|
@select=${(ev: CustomEvent<TypeCreate>) => {
|
|
if (!this.wizard) return;
|
|
this.wizard.steps = [
|
|
"initial",
|
|
`type-${ev.detail.component}-${ev.detail.modelName}`,
|
|
];
|
|
this.wizard.isValid = true;
|
|
}}
|
|
>
|
|
</ak-wizard-page-type-create>
|
|
${this.connectionTypes.map((type) => {
|
|
return html`
|
|
<ak-wizard-page-form
|
|
slot=${`type-${type.component}-${type.modelName}`}
|
|
label=${msg(str`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>
|
|
`;
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
"ak-service-connection-wizard": ServiceConnectionWizard;
|
|
}
|
|
}
|