diff --git a/src/PageNav.tsx b/src/PageNav.tsx index bb76742db5..1b44a4a39e 100644 --- a/src/PageNav.tsx +++ b/src/PageNav.tsx @@ -41,7 +41,8 @@ export const PageNav: React.FunctionComponent = () => { type LeftNavProps = { title: string; path: string }; const LeftNav = ({ title, path }: LeftNavProps) => { const route = routes(() => {}).find( - (route) => route.path.substr("/:realm".length) === path + (route) => + route.path.replaceAll(/\/:.+?(\?|(?:(?!\/).)*|$)/g, "") === path ); if (!route || !hasAccess(route.access)) return <>; //remove "/realm-name" from the start of the path diff --git a/src/clients/ClientsSection.tsx b/src/clients/ClientsSection.tsx index 4ac601c067..7f30bbfa70 100644 --- a/src/clients/ClientsSection.tsx +++ b/src/clients/ClientsSection.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from "react"; -import { Link, useHistory, useRouteMatch } from "react-router-dom"; +import { Link, useHistory } from "react-router-dom"; import { useTranslation } from "react-i18next"; import { AlertVariant, @@ -22,14 +22,15 @@ import { formattedLinkTableCell } from "../components/external-link/FormattedLin import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs"; import { InitialAccessTokenList } from "./initial-access/InitialAccessTokenList"; +import { useRealm } from "../context/realm-context/RealmContext"; export const ClientsSection = () => { const { t } = useTranslation("clients"); const { addAlert } = useAlerts(); const history = useHistory(); - const { url } = useRouteMatch(); const adminClient = useAdminClient(); + const { realm } = useRealm(); const baseUrl = getBaseUrl(adminClient); const [key, setKey] = useState(0); @@ -70,7 +71,7 @@ export const ClientsSection = () => { const ClientDetailLink = (client: ClientRepresentation) => ( <> - + {client.clientId} {!client.enabled && ( @@ -113,13 +114,19 @@ export const ClientsSection = () => { toolbarItem={ <> -