From d2ca2bf247ed58713ad270e0a30b89117c0053d5 Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Tue, 10 Aug 2021 15:07:59 +0200 Subject: [PATCH] Convert more links to use new routes (#933) * Convert more links to use new routes * convert server info dropdown * Fix link with render prop --- src/PageHeader.tsx | 16 ++++++++++------ src/client-scopes/ClientScopesSection.tsx | 18 ++++++++++-------- src/client-scopes/details/MapperList.tsx | 7 +++++-- src/client-scopes/routes/ClientScope.ts | 4 +++- src/events/EventsSection.tsx | 6 ++++-- src/groups/Members.tsx | 3 ++- src/realm-roles/RolesList.tsx | 6 ++++-- src/realm-roles/routes/RealmRole.ts | 8 +++++++- src/realm-settings/RealmSettingsSection.tsx | 13 +++++++++---- src/user/UsersSection.tsx | 6 +++++- src/user/routes/User.ts | 2 +- 11 files changed, 60 insertions(+), 29 deletions(-) diff --git a/src/PageHeader.tsx b/src/PageHeader.tsx index b31259e25a..001e1235ce 100644 --- a/src/PageHeader.tsx +++ b/src/PageHeader.tsx @@ -14,13 +14,16 @@ import { import { HelpIcon } from "@patternfly/react-icons"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; -import { Link, useHistory } from "react-router-dom"; +import { Link } from "react-router-dom"; import { HelpHeader, useHelp } from "./components/help-enabler/HelpHeader"; import { useAdminClient } from "./context/auth/AdminClient"; +import { useRealm } from "./context/realm-context/RealmContext"; import { useWhoAmI } from "./context/whoami/WhoAmI"; +import { toDashboard } from "./dashboard/routes/Dashboard"; import environment from "./environment"; export const Header = () => { + const { realm } = useRealm(); const adminClient = useAdminClient(); const { t } = useTranslation(); @@ -57,14 +60,15 @@ export const Header = () => { }; const ServerInfoDropdownItem = () => { + const { realm } = useRealm(); const { t } = useTranslation(); - const history = useHistory(); + return ( { - history.push("/master/"); - }} + component={Link} + // @ts-ignore + to={toDashboard({ realm })} > {t("realmInfo")} @@ -182,7 +186,7 @@ export const Header = () => { +