fixed group navigation (#452)

This commit is contained in:
Erik Jan de Wit 2021-03-19 19:37:21 +01:00 committed by GitHub
parent dfc4beced4
commit 6c399c1484
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 2 deletions

View file

@ -1,5 +1,5 @@
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { Link, useHistory } from "react-router-dom"; import { Link, useHistory, useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Breadcrumb, BreadcrumbItem } from "@patternfly/react-core"; import { Breadcrumb, BreadcrumbItem } from "@patternfly/react-core";
@ -12,6 +12,7 @@ export const GroupBreadCrumbs = () => {
const { realm } = useRealm(); const { realm } = useRealm();
const history = useHistory(); const history = useHistory();
const location = useLocation();
useEffect(() => { useEffect(() => {
return history.listen(({ pathname }) => { return history.listen(({ pathname }) => {

View file

@ -14,6 +14,7 @@ import { useAdminClient } from "../context/auth/AdminClient";
import { getLastId } from "./groupIdUtils"; import { getLastId } from "./groupIdUtils";
import { useSubGroups } from "./SubGroupsContext"; import { useSubGroups } from "./SubGroupsContext";
import { useLocation } from "react-router-dom";
export const GroupAttributes = () => { export const GroupAttributes = () => {
const { t } = useTranslation("groups"); const { t } = useTranslation("groups");
@ -25,6 +26,7 @@ export const GroupAttributes = () => {
name: "attributes", name: "attributes",
}); });
const location = useLocation();
const id = getLastId(location.pathname); const id = getLastId(location.pathname);
const { currentGroup, subGroups, setSubGroups } = useSubGroups(); const { currentGroup, subGroups, setSubGroups } = useSubGroups();

View file

@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useHistory } from "react-router-dom"; import { useHistory, useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useErrorHandler } from "react-error-boundary"; import { useErrorHandler } from "react-error-boundary";
import { import {
@ -37,6 +37,7 @@ export const GroupsSection = () => {
const errorHandler = useErrorHandler(); const errorHandler = useErrorHandler();
const history = useHistory(); const history = useHistory();
const location = useLocation();
const id = getLastId(location.pathname); const id = getLastId(location.pathname);
const deleteGroup = async (group: GroupRepresentation) => { const deleteGroup = async (group: GroupRepresentation) => {

View file

@ -1,4 +1,5 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import _ from "lodash"; import _ from "lodash";
import { Button, Checkbox, ToolbarItem } from "@patternfly/react-core"; import { Button, Checkbox, ToolbarItem } from "@patternfly/react-core";
@ -19,6 +20,7 @@ type MembersOf = UserRepresentation & {
export const Members = () => { export const Members = () => {
const { t } = useTranslation("groups"); const { t } = useTranslation("groups");
const adminClient = useAdminClient(); const adminClient = useAdminClient();
const location = useLocation();
const id = getLastId(location.pathname); const id = getLastId(location.pathname);
const [includeSubGroup, setIncludeSubGroup] = useState(false); const [includeSubGroup, setIncludeSubGroup] = useState(false);
const { currentGroup, subGroups } = useSubGroups(); const { currentGroup, subGroups } = useSubGroups();