Improved search sub links / breadcrumbs (#2721)
This commit is contained in:
parent
73df18ac92
commit
152a62b72a
3 changed files with 7 additions and 17 deletions
|
@ -33,7 +33,7 @@ export const GroupBreadCrumbs = () => {
|
||||||
<BreadcrumbItem key={group.id} isActive={isLastGroup}>
|
<BreadcrumbItem key={group.id} isActive={isLastGroup}>
|
||||||
{!isLastGroup && (
|
{!isLastGroup && (
|
||||||
<Link
|
<Link
|
||||||
to={location.pathname.substr(
|
to={location.pathname.substring(
|
||||||
0,
|
0,
|
||||||
location.pathname.indexOf(group.id!) + group.id!.length
|
location.pathname.indexOf(group.id!) + group.id!.length
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -77,7 +77,10 @@ export default function GroupsSection() {
|
||||||
if (isNavigationStateInValid) {
|
if (isNavigationStateInValid) {
|
||||||
const groups: GroupRepresentation[] = [];
|
const groups: GroupRepresentation[] = [];
|
||||||
for (const i of ids!) {
|
for (const i of ids!) {
|
||||||
const group = await adminClient.groups.findOne({ id: i });
|
const group =
|
||||||
|
i !== "search"
|
||||||
|
? await adminClient.groups.findOne({ id: i })
|
||||||
|
: { name: t("searchGroups"), id: "search" };
|
||||||
if (group) {
|
if (group) {
|
||||||
groups.push(group);
|
groups.push(group);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
|
@ -22,7 +22,6 @@ import { useAdminClient } from "../context/auth/AdminClient";
|
||||||
import { useRealm } from "../context/realm-context/RealmContext";
|
import { useRealm } from "../context/realm-context/RealmContext";
|
||||||
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
|
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
|
||||||
import { GroupPath } from "../components/group/GroupPath";
|
import { GroupPath } from "../components/group/GroupPath";
|
||||||
import { useSubGroups } from "./SubGroupsContext";
|
|
||||||
import { ViewHeader } from "../components/view-header/ViewHeader";
|
import { ViewHeader } from "../components/view-header/ViewHeader";
|
||||||
import { useAccess } from "../context/access/Access";
|
import { useAccess } from "../context/access/Access";
|
||||||
|
|
||||||
|
@ -44,12 +43,6 @@ export default function SearchGroups() {
|
||||||
const { hasAccess } = useAccess();
|
const { hasAccess } = useAccess();
|
||||||
const isManager = hasAccess("manage-users", "query-clients");
|
const isManager = hasAccess("manage-users", "query-clients");
|
||||||
|
|
||||||
const { setSubGroups } = useSubGroups();
|
|
||||||
useEffect(
|
|
||||||
() => setSubGroups([{ name: t("searchGroups"), id: "search" }]),
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
const deleteTerm = (id: string) => {
|
const deleteTerm = (id: string) => {
|
||||||
const index = searchTerms.indexOf(id);
|
const index = searchTerms.indexOf(id);
|
||||||
searchTerms.splice(index, 1);
|
searchTerms.splice(index, 1);
|
||||||
|
@ -69,13 +62,7 @@ export default function SearchGroups() {
|
||||||
if (!isManager) return <span>{group.name}</span>;
|
if (!isManager) return <span>{group.name}</span>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link key={group.id} to={`/${realm}/groups/search/${group.link}`}>
|
||||||
key={group.id}
|
|
||||||
to={`/${realm}/groups/${group.link}`}
|
|
||||||
onClick={() =>
|
|
||||||
setSubGroups([{ name: t("searchGroups"), id: "search" }, group])
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{group.name}
|
{group.name}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue