Use flow type instead of flow name (#2570)

This commit is contained in:
Erik Jan de Wit 2022-05-05 09:47:46 +02:00 committed by GitHub
parent 24f43d59ec
commit d832891c06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View file

@ -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",

View file

@ -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]);
}
}

View file

@ -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 = ({
<Label label={t(type!)} />
</Button>
))}
{type === "default" && <Label label={toUpperCase(values[0])} />}
{type === "default" && <Label label={t(`flow.${values[0]}`)} />}
{!type && t("notInUse")}
</>
);