From d832891c06ab87336328bdd838f132b06a49898e Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Thu, 5 May 2022 09:47:46 +0200 Subject: [PATCH] Use flow type instead of flow name (#2570) --- public/resources/en/authentication.json | 3 ++- src/authentication/AuthenticationSection.tsx | 14 ++++++++------ src/authentication/components/UsedBy.tsx | 3 +-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/public/resources/en/authentication.json b/public/resources/en/authentication.json index bfd5a24487..9a7c990e7a 100644 --- a/public/resources/en/authentication.json +++ b/public/resources/en/authentication.json @@ -84,7 +84,8 @@ "registrationFlow": "Registration flow", "directGrantFlow": "Direct grant flow", "resetCredentialsFlow": "Reset credentials flow", - "clientAuthenticationFlow": "Client authentication flow" + "clientAuthenticationFlow": "Client authentication flow", + "dockerAuthenticationFlow": "Docker authentication flow" }, "editInfo": "Edit info", "editFlow": "Edit flow", diff --git a/src/authentication/AuthenticationSection.tsx b/src/authentication/AuthenticationSection.tsx index 86a538e177..63fa3a48fd 100644 --- a/src/authentication/AuthenticationSection.tsx +++ b/src/authentication/AuthenticationSection.tsx @@ -73,9 +73,9 @@ export default function AuthenticationSection() { throw new Error(t("common:notFound")); } - const defaultFlows = Object.entries(realmRep) - .filter((entry) => REALM_FLOWS.includes(entry[0])) - .map((entry) => entry[1]); + const defaultFlows = Object.entries(realmRep).filter(([key]) => + REALM_FLOWS.includes(key) + ); for (const flow of flows as AuthenticationType[]) { flow.usedBy = { values: [] }; @@ -101,10 +101,12 @@ export default function AuthenticationSection() { flow.usedBy.values = idps.map(({ alias }) => alias!); } - const isDefault = defaultFlows.includes(flow.alias); - if (isDefault) { + const defaultFlow = defaultFlows.find( + ([, alias]) => flow.alias === alias + ); + if (defaultFlow) { flow.usedBy.type = "default"; - flow.usedBy.values.push(flow.alias!); + flow.usedBy.values.push(defaultFlow[0]); } } diff --git a/src/authentication/components/UsedBy.tsx b/src/authentication/components/UsedBy.tsx index 2a6b760e6f..2575c89c36 100644 --- a/src/authentication/components/UsedBy.tsx +++ b/src/authentication/components/UsedBy.tsx @@ -13,7 +13,6 @@ import { CheckCircleIcon } from "@patternfly/react-icons"; import type { AuthenticationType } from "../AuthenticationSection"; import { KeycloakDataTable } from "../../components/table-toolbar/KeycloakDataTable"; -import { toUpperCase } from "../../util"; import useToggle from "../../utils/useToggle"; import "./used-by.css"; @@ -135,7 +134,7 @@ export const UsedBy = ({