web/admin: replace more selects with search select
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		| @ -1,5 +1,6 @@ | ||||
| import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; | ||||
| import { first } from "@goauthentik/common/utils"; | ||||
| import "@goauthentik/elements/SearchSelect"; | ||||
| import "@goauthentik/elements/forms/FormGroup"; | ||||
| import "@goauthentik/elements/forms/HorizontalFormElement"; | ||||
| import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; | ||||
| @ -9,13 +10,14 @@ import { t } from "@lingui/macro"; | ||||
| import { TemplateResult, html } from "lit"; | ||||
| import { customElement } from "lit/decorators.js"; | ||||
| import { ifDefined } from "lit/directives/if-defined.js"; | ||||
| import { until } from "lit/directives/until.js"; | ||||
|  | ||||
| import { | ||||
|     AuthenticatorDuoStage, | ||||
|     AuthenticatorDuoStageRequest, | ||||
|     Flow, | ||||
|     FlowsApi, | ||||
|     FlowsInstancesListDesignationEnum, | ||||
|     FlowsInstancesListRequest, | ||||
|     StagesApi, | ||||
| } from "@goauthentik/api"; | ||||
|  | ||||
| @ -128,41 +130,36 @@ export class AuthenticatorDuoStageForm extends ModelForm<AuthenticatorDuoStage, | ||||
|                 <span slot="header"> ${t`Stage-specific settings`} </span> | ||||
|                 <div slot="body" class="pf-c-form"> | ||||
|                     <ak-form-element-horizontal label=${t`Configuration flow`} name="configureFlow"> | ||||
|                         <select class="pf-c-form-control"> | ||||
|                             <option | ||||
|                                 value="" | ||||
|                                 ?selected=${this.instance?.configureFlow === undefined} | ||||
|                             > | ||||
|                                 --------- | ||||
|                             </option> | ||||
|                             ${until( | ||||
|                                 new FlowsApi(DEFAULT_CONFIG) | ||||
|                                     .flowsInstancesList({ | ||||
|                                         ordering: "slug", | ||||
|                                         designation: | ||||
|                                             FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                     }) | ||||
|                                     .then((flows) => { | ||||
|                                         return flows.results.map((flow) => { | ||||
|                                             let selected = this.instance?.configureFlow === flow.pk; | ||||
|                                             if ( | ||||
|                                                 !this.instance?.pk && | ||||
|                                                 !this.instance?.configureFlow && | ||||
|                                                 flow.slug === "default-otp-time-configure" | ||||
|                                             ) { | ||||
|                                                 selected = true; | ||||
|                                             } | ||||
|                                             return html`<option | ||||
|                                                 value=${ifDefined(flow.pk)} | ||||
|                                                 ?selected=${selected} | ||||
|                                             > | ||||
|                                                 ${flow.name} (${flow.slug}) | ||||
|                                             </option>`; | ||||
|                                         }); | ||||
|                                     }), | ||||
|                                 html`<option>${t`Loading...`}</option>`, | ||||
|                             )} | ||||
|                         </select> | ||||
|                         <ak-search-select | ||||
|                             .fetchObjects=${async (query?: string): Promise<Flow[]> => { | ||||
|                                 const args: FlowsInstancesListRequest = { | ||||
|                                     ordering: "slug", | ||||
|                                     designation: | ||||
|                                         FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                 }; | ||||
|                                 if (query !== undefined) { | ||||
|                                     args.search = query; | ||||
|                                 } | ||||
|                                 const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList( | ||||
|                                     args, | ||||
|                                 ); | ||||
|                                 return flows.results; | ||||
|                             }} | ||||
|                             .renderElement=${(flow: Flow): string => { | ||||
|                                 return flow.name; | ||||
|                             }} | ||||
|                             .renderDescription=${(flow: Flow): string => { | ||||
|                                 return flow.slug; | ||||
|                             }} | ||||
|                             .value=${(flow: Flow | undefined): string | undefined => { | ||||
|                                 return flow?.pk; | ||||
|                             }} | ||||
|                             .selected=${(flow: Flow): boolean => { | ||||
|                                 return this.instance?.configureFlow === flow.pk; | ||||
|                             }} | ||||
|                             ?blankable=${true} | ||||
|                         > | ||||
|                         </ak-search-select> | ||||
|                         <p class="pf-c-form__helper-text"> | ||||
|                             ${t`Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.`} | ||||
|                         </p> | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; | ||||
| import { first } from "@goauthentik/common/utils"; | ||||
| import "@goauthentik/elements/SearchSelect"; | ||||
| import "@goauthentik/elements/forms/FormGroup"; | ||||
| import "@goauthentik/elements/forms/HorizontalFormElement"; | ||||
| import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; | ||||
| @ -14,8 +15,10 @@ import { until } from "lit/directives/until.js"; | ||||
| import { | ||||
|     AuthTypeEnum, | ||||
|     AuthenticatorSMSStage, | ||||
|     Flow, | ||||
|     FlowsApi, | ||||
|     FlowsInstancesListDesignationEnum, | ||||
|     FlowsInstancesListRequest, | ||||
|     PropertymappingsApi, | ||||
|     ProviderEnum, | ||||
|     StagesApi, | ||||
| @ -258,41 +261,36 @@ export class AuthenticatorSMSStageForm extends ModelForm<AuthenticatorSMSStage, | ||||
|                         </p> | ||||
|                     </ak-form-element-horizontal> | ||||
|                     <ak-form-element-horizontal label=${t`Configuration flow`} name="configureFlow"> | ||||
|                         <select class="pf-c-form-control"> | ||||
|                             <option | ||||
|                                 value="" | ||||
|                                 ?selected=${this.instance?.configureFlow === undefined} | ||||
|                             > | ||||
|                                 --------- | ||||
|                             </option> | ||||
|                             ${until( | ||||
|                                 new FlowsApi(DEFAULT_CONFIG) | ||||
|                                     .flowsInstancesList({ | ||||
|                                         ordering: "slug", | ||||
|                                         designation: | ||||
|                                             FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                     }) | ||||
|                                     .then((flows) => { | ||||
|                                         return flows.results.map((flow) => { | ||||
|                                             let selected = this.instance?.configureFlow === flow.pk; | ||||
|                                             if ( | ||||
|                                                 !this.instance?.pk && | ||||
|                                                 !this.instance?.configureFlow && | ||||
|                                                 flow.slug === "default-otp-time-configure" | ||||
|                                             ) { | ||||
|                                                 selected = true; | ||||
|                                             } | ||||
|                                             return html`<option | ||||
|                                                 value=${ifDefined(flow.pk)} | ||||
|                                                 ?selected=${selected} | ||||
|                                             > | ||||
|                                                 ${flow.name} (${flow.slug}) | ||||
|                                             </option>`; | ||||
|                                         }); | ||||
|                                     }), | ||||
|                                 html`<option>${t`Loading...`}</option>`, | ||||
|                             )} | ||||
|                         </select> | ||||
|                         <ak-search-select | ||||
|                             .fetchObjects=${async (query?: string): Promise<Flow[]> => { | ||||
|                                 const args: FlowsInstancesListRequest = { | ||||
|                                     ordering: "slug", | ||||
|                                     designation: | ||||
|                                         FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                 }; | ||||
|                                 if (query !== undefined) { | ||||
|                                     args.search = query; | ||||
|                                 } | ||||
|                                 const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList( | ||||
|                                     args, | ||||
|                                 ); | ||||
|                                 return flows.results; | ||||
|                             }} | ||||
|                             .renderElement=${(flow: Flow): string => { | ||||
|                                 return flow.name; | ||||
|                             }} | ||||
|                             .renderDescription=${(flow: Flow): string => { | ||||
|                                 return flow.slug; | ||||
|                             }} | ||||
|                             .value=${(flow: Flow | undefined): string | undefined => { | ||||
|                                 return flow?.pk; | ||||
|                             }} | ||||
|                             .selected=${(flow: Flow): boolean => { | ||||
|                                 return this.instance?.configureFlow === flow.pk; | ||||
|                             }} | ||||
|                             ?blankable=${true} | ||||
|                         > | ||||
|                         </ak-search-select> | ||||
|                         <p class="pf-c-form__helper-text"> | ||||
|                             ${t`Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.`} | ||||
|                         </p> | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; | ||||
| import { first } from "@goauthentik/common/utils"; | ||||
| import "@goauthentik/elements/forms/FormGroup"; | ||||
| import "@goauthentik/elements/SearchSelect"; | ||||
| import "@goauthentik/elements/forms/HorizontalFormElement"; | ||||
| import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; | ||||
|  | ||||
| @ -9,12 +9,13 @@ import { t } from "@lingui/macro"; | ||||
| import { TemplateResult, html } from "lit"; | ||||
| import { customElement } from "lit/decorators.js"; | ||||
| import { ifDefined } from "lit/directives/if-defined.js"; | ||||
| import { until } from "lit/directives/until.js"; | ||||
|  | ||||
| import { | ||||
|     AuthenticatorStaticStage, | ||||
|     Flow, | ||||
|     FlowsApi, | ||||
|     FlowsInstancesListDesignationEnum, | ||||
|     FlowsInstancesListRequest, | ||||
|     StagesApi, | ||||
| } from "@goauthentik/api"; | ||||
|  | ||||
| @ -76,41 +77,36 @@ export class AuthenticatorStaticStageForm extends ModelForm<AuthenticatorStaticS | ||||
|                         /> | ||||
|                     </ak-form-element-horizontal> | ||||
|                     <ak-form-element-horizontal label=${t`Configuration flow`} name="configureFlow"> | ||||
|                         <select class="pf-c-form-control"> | ||||
|                             <option | ||||
|                                 value="" | ||||
|                                 ?selected=${this.instance?.configureFlow === undefined} | ||||
|                             > | ||||
|                                 --------- | ||||
|                             </option> | ||||
|                             ${until( | ||||
|                                 new FlowsApi(DEFAULT_CONFIG) | ||||
|                                     .flowsInstancesList({ | ||||
|                                         ordering: "slug", | ||||
|                                         designation: | ||||
|                                             FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                     }) | ||||
|                                     .then((flows) => { | ||||
|                                         return flows.results.map((flow) => { | ||||
|                                             let selected = this.instance?.configureFlow === flow.pk; | ||||
|                                             if ( | ||||
|                                                 !this.instance?.pk && | ||||
|                                                 !this.instance?.configureFlow && | ||||
|                                                 flow.slug === "default-otp-time-configure" | ||||
|                                             ) { | ||||
|                                                 selected = true; | ||||
|                                             } | ||||
|                                             return html`<option | ||||
|                                                 value=${ifDefined(flow.pk)} | ||||
|                                                 ?selected=${selected} | ||||
|                                             > | ||||
|                                                 ${flow.name} (${flow.slug}) | ||||
|                                             </option>`; | ||||
|                                         }); | ||||
|                                     }), | ||||
|                                 html`<option>${t`Loading...`}</option>`, | ||||
|                             )} | ||||
|                         </select> | ||||
|                         <ak-search-select | ||||
|                             .fetchObjects=${async (query?: string): Promise<Flow[]> => { | ||||
|                                 const args: FlowsInstancesListRequest = { | ||||
|                                     ordering: "slug", | ||||
|                                     designation: | ||||
|                                         FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                 }; | ||||
|                                 if (query !== undefined) { | ||||
|                                     args.search = query; | ||||
|                                 } | ||||
|                                 const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList( | ||||
|                                     args, | ||||
|                                 ); | ||||
|                                 return flows.results; | ||||
|                             }} | ||||
|                             .renderElement=${(flow: Flow): string => { | ||||
|                                 return flow.name; | ||||
|                             }} | ||||
|                             .renderDescription=${(flow: Flow): string => { | ||||
|                                 return flow.slug; | ||||
|                             }} | ||||
|                             .value=${(flow: Flow | undefined): string | undefined => { | ||||
|                                 return flow?.pk; | ||||
|                             }} | ||||
|                             .selected=${(flow: Flow): boolean => { | ||||
|                                 return this.instance?.configureFlow === flow.pk; | ||||
|                             }} | ||||
|                             ?blankable=${true} | ||||
|                         > | ||||
|                         </ak-search-select> | ||||
|                         <p class="pf-c-form__helper-text"> | ||||
|                             ${t`Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.`} | ||||
|                         </p> | ||||
|  | ||||
| @ -1,4 +1,5 @@ | ||||
| import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; | ||||
| import "@goauthentik/elements/SearchSelect"; | ||||
| import "@goauthentik/elements/forms/FormGroup"; | ||||
| import "@goauthentik/elements/forms/HorizontalFormElement"; | ||||
| import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; | ||||
| @ -8,13 +9,14 @@ import { t } from "@lingui/macro"; | ||||
| import { TemplateResult, html } from "lit"; | ||||
| import { customElement } from "lit/decorators.js"; | ||||
| import { ifDefined } from "lit/directives/if-defined.js"; | ||||
| import { until } from "lit/directives/until.js"; | ||||
|  | ||||
| import { | ||||
|     AuthenticatorTOTPStage, | ||||
|     DigitsEnum, | ||||
|     Flow, | ||||
|     FlowsApi, | ||||
|     FlowsInstancesListDesignationEnum, | ||||
|     FlowsInstancesListRequest, | ||||
|     StagesApi, | ||||
| } from "@goauthentik/api"; | ||||
|  | ||||
| @ -80,41 +82,36 @@ export class AuthenticatorTOTPStageForm extends ModelForm<AuthenticatorTOTPStage | ||||
|                         </select> | ||||
|                     </ak-form-element-horizontal> | ||||
|                     <ak-form-element-horizontal label=${t`Configuration flow`} name="configureFlow"> | ||||
|                         <select class="pf-c-form-control"> | ||||
|                             <option | ||||
|                                 value="" | ||||
|                                 ?selected=${this.instance?.configureFlow === undefined} | ||||
|                             > | ||||
|                                 --------- | ||||
|                             </option> | ||||
|                             ${until( | ||||
|                                 new FlowsApi(DEFAULT_CONFIG) | ||||
|                                     .flowsInstancesList({ | ||||
|                                         ordering: "slug", | ||||
|                                         designation: | ||||
|                                             FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                     }) | ||||
|                                     .then((flows) => { | ||||
|                                         return flows.results.map((flow) => { | ||||
|                                             let selected = this.instance?.configureFlow === flow.pk; | ||||
|                                             if ( | ||||
|                                                 !this.instance?.pk && | ||||
|                                                 !this.instance?.configureFlow && | ||||
|                                                 flow.slug === "default-otp-time-configure" | ||||
|                                             ) { | ||||
|                                                 selected = true; | ||||
|                                             } | ||||
|                                             return html`<option | ||||
|                                                 value=${ifDefined(flow.pk)} | ||||
|                                                 ?selected=${selected} | ||||
|                                             > | ||||
|                                                 ${flow.name} (${flow.slug}) | ||||
|                                             </option>`; | ||||
|                                         }); | ||||
|                                     }), | ||||
|                                 html`<option>${t`Loading...`}</option>`, | ||||
|                             )} | ||||
|                         </select> | ||||
|                         <ak-search-select | ||||
|                             .fetchObjects=${async (query?: string): Promise<Flow[]> => { | ||||
|                                 const args: FlowsInstancesListRequest = { | ||||
|                                     ordering: "slug", | ||||
|                                     designation: | ||||
|                                         FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                 }; | ||||
|                                 if (query !== undefined) { | ||||
|                                     args.search = query; | ||||
|                                 } | ||||
|                                 const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList( | ||||
|                                     args, | ||||
|                                 ); | ||||
|                                 return flows.results; | ||||
|                             }} | ||||
|                             .renderElement=${(flow: Flow): string => { | ||||
|                                 return flow.name; | ||||
|                             }} | ||||
|                             .renderDescription=${(flow: Flow): string => { | ||||
|                                 return flow.slug; | ||||
|                             }} | ||||
|                             .value=${(flow: Flow | undefined): string | undefined => { | ||||
|                                 return flow?.pk; | ||||
|                             }} | ||||
|                             .selected=${(flow: Flow): boolean => { | ||||
|                                 return this.instance?.configureFlow === flow.pk; | ||||
|                             }} | ||||
|                             ?blankable=${true} | ||||
|                         > | ||||
|                         </ak-search-select> | ||||
|                         <p class="pf-c-form__helper-text"> | ||||
|                             ${t`Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.`} | ||||
|                         </p> | ||||
|  | ||||
| @ -1,4 +1,5 @@ | ||||
| import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; | ||||
| import "@goauthentik/elements/SearchSelect"; | ||||
| import "@goauthentik/elements/forms/HorizontalFormElement"; | ||||
| import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; | ||||
|  | ||||
| @ -7,13 +8,14 @@ import { t } from "@lingui/macro"; | ||||
| import { TemplateResult, html } from "lit"; | ||||
| import { customElement } from "lit/decorators.js"; | ||||
| import { ifDefined } from "lit/directives/if-defined.js"; | ||||
| import { until } from "lit/directives/until.js"; | ||||
|  | ||||
| import { | ||||
|     AuthenticateWebAuthnStage, | ||||
|     AuthenticatorAttachmentEnum, | ||||
|     Flow, | ||||
|     FlowsApi, | ||||
|     FlowsInstancesListDesignationEnum, | ||||
|     FlowsInstancesListRequest, | ||||
|     ResidentKeyRequirementEnum, | ||||
|     StagesApi, | ||||
|     UserVerificationEnum, | ||||
| @ -154,41 +156,36 @@ export class AuthenticateWebAuthnStageForm extends ModelForm<AuthenticateWebAuth | ||||
|                         </select> | ||||
|                     </ak-form-element-horizontal> | ||||
|                     <ak-form-element-horizontal label=${t`Configuration flow`} name="configureFlow"> | ||||
|                         <select class="pf-c-form-control"> | ||||
|                             <option | ||||
|                                 value="" | ||||
|                                 ?selected=${this.instance?.configureFlow === undefined} | ||||
|                             > | ||||
|                                 --------- | ||||
|                             </option> | ||||
|                             ${until( | ||||
|                                 new FlowsApi(DEFAULT_CONFIG) | ||||
|                                     .flowsInstancesList({ | ||||
|                                         ordering: "slug", | ||||
|                                         designation: | ||||
|                                             FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                     }) | ||||
|                                     .then((flows) => { | ||||
|                                         return flows.results.map((flow) => { | ||||
|                                             let selected = this.instance?.configureFlow === flow.pk; | ||||
|                                             if ( | ||||
|                                                 !this.instance?.pk && | ||||
|                                                 !this.instance?.configureFlow && | ||||
|                                                 flow.slug === "default-otp-time-configure" | ||||
|                                             ) { | ||||
|                                                 selected = true; | ||||
|                                             } | ||||
|                                             return html`<option | ||||
|                                                 value=${ifDefined(flow.pk)} | ||||
|                                                 ?selected=${selected} | ||||
|                                             > | ||||
|                                                 ${flow.name} (${flow.slug}) | ||||
|                                             </option>`; | ||||
|                                         }); | ||||
|                                     }), | ||||
|                                 html`<option>${t`Loading...`}</option>`, | ||||
|                             )} | ||||
|                         </select> | ||||
|                         <ak-search-select | ||||
|                             .fetchObjects=${async (query?: string): Promise<Flow[]> => { | ||||
|                                 const args: FlowsInstancesListRequest = { | ||||
|                                     ordering: "slug", | ||||
|                                     designation: | ||||
|                                         FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                 }; | ||||
|                                 if (query !== undefined) { | ||||
|                                     args.search = query; | ||||
|                                 } | ||||
|                                 const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList( | ||||
|                                     args, | ||||
|                                 ); | ||||
|                                 return flows.results; | ||||
|                             }} | ||||
|                             .renderElement=${(flow: Flow): string => { | ||||
|                                 return flow.name; | ||||
|                             }} | ||||
|                             .renderDescription=${(flow: Flow): string => { | ||||
|                                 return flow.slug; | ||||
|                             }} | ||||
|                             .value=${(flow: Flow | undefined): string | undefined => { | ||||
|                                 return flow?.pk; | ||||
|                             }} | ||||
|                             .selected=${(flow: Flow): boolean => { | ||||
|                                 return this.instance?.configureFlow === flow.pk; | ||||
|                             }} | ||||
|                             ?blankable=${true} | ||||
|                         > | ||||
|                         </ak-search-select> | ||||
|                         <p class="pf-c-form__helper-text"> | ||||
|                             ${t`Flow used by an authenticated user to configure this Stage. If empty, user will not be able to configure this stage.`} | ||||
|                         </p> | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; | ||||
| import { first } from "@goauthentik/common/utils"; | ||||
| import "@goauthentik/elements/SearchSelect"; | ||||
| import "@goauthentik/elements/forms/FormGroup"; | ||||
| import "@goauthentik/elements/forms/HorizontalFormElement"; | ||||
| import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; | ||||
| @ -9,12 +10,13 @@ import { t } from "@lingui/macro"; | ||||
| import { TemplateResult, html } from "lit"; | ||||
| import { customElement } from "lit/decorators.js"; | ||||
| import { ifDefined } from "lit/directives/if-defined.js"; | ||||
| import { until } from "lit/directives/until.js"; | ||||
|  | ||||
| import { | ||||
|     BackendsEnum, | ||||
|     Flow, | ||||
|     FlowsApi, | ||||
|     FlowsInstancesListDesignationEnum, | ||||
|     FlowsInstancesListRequest, | ||||
|     PasswordStage, | ||||
|     StagesApi, | ||||
| } from "@goauthentik/api"; | ||||
| @ -118,41 +120,44 @@ export class PasswordStageForm extends ModelForm<PasswordStage, string> { | ||||
|                         ?required=${true} | ||||
|                         name="configureFlow" | ||||
|                     > | ||||
|                         <select class="pf-c-form-control"> | ||||
|                             <option | ||||
|                                 value="" | ||||
|                                 ?selected=${this.instance?.configureFlow === undefined} | ||||
|                             > | ||||
|                                 --------- | ||||
|                             </option> | ||||
|                             ${until( | ||||
|                                 new FlowsApi(DEFAULT_CONFIG) | ||||
|                                     .flowsInstancesList({ | ||||
|                                         ordering: "slug", | ||||
|                                         designation: | ||||
|                                             FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                     }) | ||||
|                                     .then((flows) => { | ||||
|                                         return flows.results.map((flow) => { | ||||
|                                             let selected = this.instance?.configureFlow === flow.pk; | ||||
|                                             if ( | ||||
|                                                 !this.instance?.pk && | ||||
|                                                 !this.instance?.configureFlow && | ||||
|                                                 flow.slug === "default-password-change" | ||||
|                                             ) { | ||||
|                                                 selected = true; | ||||
|                                             } | ||||
|                                             return html`<option | ||||
|                                                 value=${ifDefined(flow.pk)} | ||||
|                                                 ?selected=${selected} | ||||
|                                             > | ||||
|                                                 ${flow.name} (${flow.slug}) | ||||
|                                             </option>`; | ||||
|                                         }); | ||||
|                                     }), | ||||
|                                 html`<option>${t`Loading...`}</option>`, | ||||
|                             )} | ||||
|                         </select> | ||||
|                         <ak-search-select | ||||
|                             .fetchObjects=${async (query?: string): Promise<Flow[]> => { | ||||
|                                 const args: FlowsInstancesListRequest = { | ||||
|                                     ordering: "slug", | ||||
|                                     designation: | ||||
|                                         FlowsInstancesListDesignationEnum.StageConfiguration, | ||||
|                                 }; | ||||
|                                 if (query !== undefined) { | ||||
|                                     args.search = query; | ||||
|                                 } | ||||
|                                 const flows = await new FlowsApi(DEFAULT_CONFIG).flowsInstancesList( | ||||
|                                     args, | ||||
|                                 ); | ||||
|                                 return flows.results; | ||||
|                             }} | ||||
|                             .renderElement=${(flow: Flow): string => { | ||||
|                                 return flow.name; | ||||
|                             }} | ||||
|                             .renderDescription=${(flow: Flow): string => { | ||||
|                                 return flow.slug; | ||||
|                             }} | ||||
|                             .value=${(flow: Flow | undefined): string | undefined => { | ||||
|                                 return flow?.pk; | ||||
|                             }} | ||||
|                             .selected=${(flow: Flow): boolean => { | ||||
|                                 let selected = this.instance?.configureFlow === flow.pk; | ||||
|                                 if ( | ||||
|                                     !this.instance?.pk && | ||||
|                                     !this.instance?.configureFlow && | ||||
|                                     flow.slug === "default-password-change" | ||||
|                                 ) { | ||||
|                                     selected = true; | ||||
|                                 } | ||||
|                                 return selected; | ||||
|                             }} | ||||
|                             ?blankable=${true} | ||||
|                         > | ||||
|                         </ak-search-select> | ||||
|                         <p class="pf-c-form__helper-text"> | ||||
|                             ${t`Flow used by an authenticated user to configure their password. If empty, user will not be able to configure change their password.`} | ||||
|                         </p> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer