From 397b9845ec8a50d4fc4080e9faaa589c518c77bf Mon Sep 17 00:00:00 2001 From: Jens L Date: Thu, 16 Mar 2023 22:39:26 +0100 Subject: [PATCH] web/admin: fix inconsistent display of flows in selections (#4977) Signed-off-by: Jens Langhammer --- .../oauth/TypeOAuthCodeApplicationWizardPage.ts | 3 ++- web/src/admin/flows/utils.ts | 6 +++++- web/src/admin/providers/ldap/LDAPProviderForm.ts | 3 ++- .../admin/providers/oauth2/OAuth2ProviderForm.ts | 3 ++- web/src/admin/providers/proxy/ProxyProviderForm.ts | 3 ++- web/src/admin/providers/saml/SAMLProviderForm.ts | 3 ++- .../admin/providers/saml/SAMLProviderImportForm.ts | 3 ++- web/src/admin/sources/oauth/OAuthSourceForm.ts | 5 +++-- web/src/admin/sources/plex/PlexSourceForm.ts | 5 +++-- web/src/admin/sources/saml/SAMLSourceForm.ts | 7 ++++--- .../authenticator_duo/AuthenticatorDuoStageForm.ts | 3 ++- .../authenticator_sms/AuthenticatorSMSStageForm.ts | 3 ++- .../AuthenticatorStaticStageForm.ts | 3 ++- .../AuthenticatorTOTPStageForm.ts | 3 ++- .../AuthenticateWebAuthnStageForm.ts | 3 ++- .../identification/IdentificationStageForm.ts | 3 ++- web/src/admin/stages/invitation/InvitationForm.ts | 3 ++- web/src/admin/stages/password/PasswordStageForm.ts | 3 ++- web/src/admin/tenants/TenantForm.ts | 13 +++++++------ 19 files changed, 50 insertions(+), 28 deletions(-) diff --git a/web/src/admin/applications/wizard/oauth/TypeOAuthCodeApplicationWizardPage.ts b/web/src/admin/applications/wizard/oauth/TypeOAuthCodeApplicationWizardPage.ts index 54adfd5f1..298a55d7a 100644 --- a/web/src/admin/applications/wizard/oauth/TypeOAuthCodeApplicationWizardPage.ts +++ b/web/src/admin/applications/wizard/oauth/TypeOAuthCodeApplicationWizardPage.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { KeyUnknown } from "@goauthentik/elements/forms/Form"; import "@goauthentik/elements/forms/HorizontalFormElement"; @@ -60,7 +61,7 @@ export class TypeOAuthCodeApplicationWizardPage extends WizardFormPage { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/flows/utils.ts b/web/src/admin/flows/utils.ts index 8a4c79609..94ad03c3c 100644 --- a/web/src/admin/flows/utils.ts +++ b/web/src/admin/flows/utils.ts @@ -1,6 +1,10 @@ import { t } from "@lingui/macro"; -import { FlowDesignationEnum, LayoutEnum } from "@goauthentik/api"; +import { Flow, FlowDesignationEnum, LayoutEnum } from "@goauthentik/api"; + +export function RenderFlowOption(flow: Flow): string { + return `${flow.slug} (${flow.name})`; +} export function DesignationToLabel(designation: FlowDesignationEnum): string { switch (designation) { diff --git a/web/src/admin/providers/ldap/LDAPProviderForm.ts b/web/src/admin/providers/ldap/LDAPProviderForm.ts index e9f1f20d8..0875744c8 100644 --- a/web/src/admin/providers/ldap/LDAPProviderForm.ts +++ b/web/src/admin/providers/ldap/LDAPProviderForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG, tenant } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; import "@goauthentik/elements/forms/FormGroup"; @@ -93,7 +94,7 @@ export class LDAPProviderFormPage extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.name; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.slug}`; diff --git a/web/src/admin/providers/oauth2/OAuth2ProviderForm.ts b/web/src/admin/providers/oauth2/OAuth2ProviderForm.ts index 9050df558..9d764f8e5 100644 --- a/web/src/admin/providers/oauth2/OAuth2ProviderForm.ts +++ b/web/src/admin/providers/oauth2/OAuth2ProviderForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first, randomString } from "@goauthentik/common/utils"; import "@goauthentik/elements/forms/FormGroup"; @@ -96,7 +97,7 @@ export class OAuth2ProviderFormPage extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/providers/proxy/ProxyProviderForm.ts b/web/src/admin/providers/proxy/ProxyProviderForm.ts index f98b15848..3a9155289 100644 --- a/web/src/admin/providers/proxy/ProxyProviderForm.ts +++ b/web/src/admin/providers/proxy/ProxyProviderForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; import "@goauthentik/elements/forms/FormGroup"; @@ -318,7 +319,7 @@ export class ProxyProviderFormPage extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/providers/saml/SAMLProviderForm.ts b/web/src/admin/providers/saml/SAMLProviderForm.ts index d4370e6fb..e1f3d9c31 100644 --- a/web/src/admin/providers/saml/SAMLProviderForm.ts +++ b/web/src/admin/providers/saml/SAMLProviderForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import "@goauthentik/elements/forms/FormGroup"; import "@goauthentik/elements/forms/HorizontalFormElement"; @@ -88,7 +89,7 @@ export class SAMLProviderFormPage extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/providers/saml/SAMLProviderImportForm.ts b/web/src/admin/providers/saml/SAMLProviderImportForm.ts index ccddc06cb..4b7c47791 100644 --- a/web/src/admin/providers/saml/SAMLProviderImportForm.ts +++ b/web/src/admin/providers/saml/SAMLProviderImportForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { SentryIgnoredError } from "@goauthentik/common/errors"; import { Form } from "@goauthentik/elements/forms/Form"; @@ -59,7 +60,7 @@ export class SAMLProviderImportForm extends Form { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/sources/oauth/OAuthSourceForm.ts b/web/src/admin/sources/oauth/OAuthSourceForm.ts index 06f681b83..6084086f8 100644 --- a/web/src/admin/sources/oauth/OAuthSourceForm.ts +++ b/web/src/admin/sources/oauth/OAuthSourceForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils"; import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; @@ -431,7 +432,7 @@ export class OAuthSourceForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; @@ -477,7 +478,7 @@ export class OAuthSourceForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/sources/plex/PlexSourceForm.ts b/web/src/admin/sources/plex/PlexSourceForm.ts index 5b7abca9b..21908febd 100644 --- a/web/src/admin/sources/plex/PlexSourceForm.ts +++ b/web/src/admin/sources/plex/PlexSourceForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils"; import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config"; import { PlexAPIClient, PlexResource, popupCenterScreen } from "@goauthentik/common/helpers/plex"; @@ -364,7 +365,7 @@ export class PlexSourceForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; @@ -410,7 +411,7 @@ export class PlexSourceForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/sources/saml/SAMLSourceForm.ts b/web/src/admin/sources/saml/SAMLSourceForm.ts index e48359deb..6eed32cc5 100644 --- a/web/src/admin/sources/saml/SAMLSourceForm.ts +++ b/web/src/admin/sources/saml/SAMLSourceForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { UserMatchingModeToLabel } from "@goauthentik/admin/sources/oauth/utils"; import { DEFAULT_CONFIG, config } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; @@ -496,7 +497,7 @@ export class SAMLSourceForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; @@ -540,7 +541,7 @@ export class SAMLSourceForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; @@ -586,7 +587,7 @@ export class SAMLSourceForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/stages/authenticator_duo/AuthenticatorDuoStageForm.ts b/web/src/admin/stages/authenticator_duo/AuthenticatorDuoStageForm.ts index b3e001bb3..fbd155026 100644 --- a/web/src/admin/stages/authenticator_duo/AuthenticatorDuoStageForm.ts +++ b/web/src/admin/stages/authenticator_duo/AuthenticatorDuoStageForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; import "@goauthentik/elements/forms/FormGroup"; @@ -146,7 +147,7 @@ export class AuthenticatorDuoStageForm extends ModelForm { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/stages/authenticator_sms/AuthenticatorSMSStageForm.ts b/web/src/admin/stages/authenticator_sms/AuthenticatorSMSStageForm.ts index 9998b68ba..fcad2a319 100644 --- a/web/src/admin/stages/authenticator_sms/AuthenticatorSMSStageForm.ts +++ b/web/src/admin/stages/authenticator_sms/AuthenticatorSMSStageForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; import "@goauthentik/elements/forms/FormGroup"; @@ -292,7 +293,7 @@ export class AuthenticatorSMSStageForm extends ModelForm { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/stages/authenticator_static/AuthenticatorStaticStageForm.ts b/web/src/admin/stages/authenticator_static/AuthenticatorStaticStageForm.ts index 16aab0ab5..4f193f404 100644 --- a/web/src/admin/stages/authenticator_static/AuthenticatorStaticStageForm.ts +++ b/web/src/admin/stages/authenticator_static/AuthenticatorStaticStageForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; import "@goauthentik/elements/forms/HorizontalFormElement"; @@ -93,7 +94,7 @@ export class AuthenticatorStaticStageForm extends ModelForm { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts b/web/src/admin/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts index 4a61eba86..ff8f622f6 100644 --- a/web/src/admin/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts +++ b/web/src/admin/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import "@goauthentik/elements/forms/FormGroup"; import "@goauthentik/elements/forms/HorizontalFormElement"; @@ -98,7 +99,7 @@ export class AuthenticatorTOTPStageForm extends ModelForm { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/stages/authenticator_webauthn/AuthenticateWebAuthnStageForm.ts b/web/src/admin/stages/authenticator_webauthn/AuthenticateWebAuthnStageForm.ts index b481bd4a7..0c9abf1d2 100644 --- a/web/src/admin/stages/authenticator_webauthn/AuthenticateWebAuthnStageForm.ts +++ b/web/src/admin/stages/authenticator_webauthn/AuthenticateWebAuthnStageForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import "@goauthentik/elements/forms/HorizontalFormElement"; import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; @@ -162,7 +163,7 @@ export class AuthenticateWebAuthnStageForm extends ModelForm { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/stages/identification/IdentificationStageForm.ts b/web/src/admin/stages/identification/IdentificationStageForm.ts index a85220b57..87b9e65ed 100644 --- a/web/src/admin/stages/identification/IdentificationStageForm.ts +++ b/web/src/admin/stages/identification/IdentificationStageForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first, groupBy } from "@goauthentik/common/utils"; import "@goauthentik/elements/forms/FormGroup"; @@ -265,7 +266,7 @@ export class IdentificationStageForm extends ModelForm { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/stages/invitation/InvitationForm.ts b/web/src/admin/stages/invitation/InvitationForm.ts index f6ef169e2..cd24ec9fa 100644 --- a/web/src/admin/stages/invitation/InvitationForm.ts +++ b/web/src/admin/stages/invitation/InvitationForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { dateTimeLocal, first } from "@goauthentik/common/utils"; import "@goauthentik/elements/CodeMirror"; @@ -88,7 +89,7 @@ export class InvitationForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/stages/password/PasswordStageForm.ts b/web/src/admin/stages/password/PasswordStageForm.ts index 755888f1f..8f548c5db 100644 --- a/web/src/admin/stages/password/PasswordStageForm.ts +++ b/web/src/admin/stages/password/PasswordStageForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; import "@goauthentik/elements/forms/FormGroup"; @@ -136,7 +137,7 @@ export class PasswordStageForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; diff --git a/web/src/admin/tenants/TenantForm.ts b/web/src/admin/tenants/TenantForm.ts index 1c1037f82..34b58c685 100644 --- a/web/src/admin/tenants/TenantForm.ts +++ b/web/src/admin/tenants/TenantForm.ts @@ -1,3 +1,4 @@ +import { RenderFlowOption } from "@goauthentik/admin/flows/utils"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; import "@goauthentik/elements/CodeMirror"; @@ -165,7 +166,7 @@ export class TenantForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; @@ -202,7 +203,7 @@ export class TenantForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; @@ -237,7 +238,7 @@ export class TenantForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; @@ -274,7 +275,7 @@ export class TenantForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; @@ -312,7 +313,7 @@ export class TenantForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`; @@ -347,7 +348,7 @@ export class TenantForm extends ModelForm { return flows.results; }} .renderElement=${(flow: Flow): string => { - return flow.slug; + return RenderFlowOption(flow); }} .renderDescription=${(flow: Flow): TemplateResult => { return html`${flow.name}`;