diff --git a/web/src/pages/stages/invitation/InvitationListPage.ts b/web/src/pages/stages/invitation/InvitationListPage.ts index ce139eac9..3719aa63c 100644 --- a/web/src/pages/stages/invitation/InvitationListPage.ts +++ b/web/src/pages/stages/invitation/InvitationListPage.ts @@ -1,7 +1,10 @@ import { t } from "@lingui/macro"; -import { TemplateResult, html } from "lit"; -import { customElement, property } from "lit/decorators"; +import { CSSResult, TemplateResult, html } from "lit"; +import { customElement, property, state } from "lit/decorators"; +import { ifDefined } from "lit/directives/if-defined"; + +import PFBanner from "@patternfly/patternfly/components/Banner/banner.css"; import { Invitation, StagesApi } from "@goauthentik/api"; @@ -34,12 +37,24 @@ export class InvitationListPage extends TablePage { return "pf-icon pf-icon-migration"; } + static get styles(): CSSResult[] { + return super.styles.concat(PFBanner); + } + checkbox = true; @property() order = "expires"; + @state() + invitationStageExists = false; + async apiEndpoint(page: number): Promise> { + const stages = await new StagesApi(DEFAULT_CONFIG).stagesInvitationStagesList({ + noFlows: false, + }); + this.invitationStageExists = stages.pagination.count > 0; + this.expandable = this.invitationStageExists; return new StagesApi(DEFAULT_CONFIG).stagesInvitationInvitationsList({ ordering: this.order, page: page, @@ -110,4 +125,23 @@ export class InvitationListPage extends TablePage { ${super.renderToolbar()} `; } + + render(): TemplateResult { + return html` + + ${this.invitationStageExists + ? html`` + : html` +
+ ${t`Warning: No invitation stage is bound to any flow. Invitations will not work as expected.`} +
+ `} +
+
${this.renderTable()}
+
`; + } }