changed X to link to organization (#30648)

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-07-01 13:22:46 +02:00 committed by GitHub
parent 213b4ca6d1
commit ea0f569bd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 6 deletions

View file

@ -3201,6 +3201,7 @@ linkUpdatedSuccessful=Identity provider link successfully updated
linkUpdateError=Could not update link to identity provider\: {{error}}
noResultsFound=No results found
linkedOrganization=Linked organization
organization=Organization
send=Send
redirectWhenEmailMatches=Redirect when email domain matches
redirectWhenEmailMatchesHelp=Automatically redirect the user to this identity provider when the email domain matches the domain

View file

@ -21,7 +21,6 @@ import {
TextVariants,
ToolbarItem,
} from "@patternfly/react-core";
import { IFormatterValueType } from "@patternfly/react-table";
import { groupBy, sortBy } from "lodash-es";
import { Fragment, useState } from "react";
import { useTranslation } from "react-i18next";
@ -38,6 +37,7 @@ import { ViewHeader } from "../components/view-header/ViewHeader";
import { useRealm } from "../context/realm-context/RealmContext";
import { useServerInfo } from "../context/server-info/ServerInfoProvider";
import helpUrls from "../help-urls";
import { toEditOrganization } from "../organizations/routes/EditOrganization";
import { upperCaseFormatter } from "../util";
import { useFetch } from "../utils/useFetch";
import { ManageOrderDialog } from "./ManageOrderDialog";
@ -72,6 +72,28 @@ const DetailLink = (identityProvider: IdentityProviderRepresentation) => {
);
};
const OrganizationLink = (identityProvider: IdentityProviderRepresentation) => {
const { t } = useTranslation();
const { realm } = useRealm();
if (!identityProvider.config?.["kc.org"]) {
return "—";
}
return (
<Link
key={identityProvider.providerId}
to={toEditOrganization({
realm,
id: identityProvider.config["kc.org"],
tab: "identityProviders",
})}
>
{t("organization")}
</Link>
);
};
export default function IdentityProvidersSection() {
const { adminClient } = useAdminClient();
@ -278,11 +300,7 @@ export default function IdentityProvidersSection() {
{
name: "config['kc.org']",
displayKey: "linkedOrganization",
cellFormatters: [
(data?: IFormatterValueType) => {
return data ? "X" : "—";
},
],
cellRenderer: OrganizationLink,
},
]}
/>