removed "Home" from navigation (#209)

* only show breadcrumb when there are 2 levels
* renamed the list clients and client scopes
This commit is contained in:
Erik Jan de Wit 2020-11-05 15:40:00 +01:00 committed by GitHub
parent fb21266695
commit 7ebe695921
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 22 deletions

View file

@ -1,7 +1,7 @@
{
"client-scopes": {
"createClientScope": "Create client scope",
"clientScopeList": "List of client scopes",
"clientScopeList": "Client scopes",
"clientScopeDetails": "Client scope details",
"clientScopeExplain": "Client scopes allow you to define a common set of protocol mappers and roles, which are shared between multiple clients",
"searchFor": "Search for client scope",

View file

@ -6,7 +6,7 @@ Object {
"baseElement": <body>
<div>
<table
aria-label="Client list"
aria-label="Clients"
class="pf-c-table pf-m-grid-md pf-m-compact"
data-ouia-component-id="OUIA-Generated-Table-1"
data-ouia-component-type="PF4/Table"
@ -749,7 +749,7 @@ Object {
</body>,
"container": <div>
<table
aria-label="Client list"
aria-label="Clients"
class="pf-c-table pf-m-grid-md pf-m-compact"
data-ouia-component-id="OUIA-Generated-Table-1"
data-ouia-component-type="PF4/Table"

View file

@ -14,7 +14,7 @@
"settings": "Settings",
"credentials": "Credentials",
"details": "Details",
"clientList": "Client list",
"clientList": "Clients",
"clientSettings": "Client details",
"selectEncryptionType": "Select Encryption type",
"generalSettings": "General Settings",

View file

@ -1,15 +1,17 @@
import React from "react";
import { Link } from "react-router-dom";
import { Breadcrumb, BreadcrumbItem } from "@patternfly/react-core";
import useBreadcrumbs from "use-react-router-breadcrumbs";
import { useTranslation } from "react-i18next";
import { Breadcrumb, BreadcrumbItem } from "@patternfly/react-core";
import { routes } from "../../route-config";
export const PageBreadCrumbs = () => {
const { t } = useTranslation();
const crumbs = useBreadcrumbs(routes(t));
const crumbs = useBreadcrumbs(routes(t)).slice(1);
return (
<>
{crumbs.length > 1 && (
<Breadcrumb>
{crumbs.map(({ match, breadcrumb: crumb }, i) => (
<BreadcrumbItem key={i} isActive={crumbs.length - 1 === i}>
@ -18,5 +20,7 @@ export const PageBreadCrumbs = () => {
</BreadcrumbItem>
))}
</Breadcrumb>
)}
</>
);
};

View file

@ -6,7 +6,7 @@ import { MemoryRouter } from "react-router-dom";
describe("BreadCrumbs tests", () => {
it("couple of crumbs", () => {
const crumbs = mount(
<MemoryRouter initialEntries={["/add-client"]}>
<MemoryRouter initialEntries={["/clients/1234"]}>
<PageBreadCrumbs />
</MemoryRouter>
);

View file

@ -22,20 +22,20 @@ exports[`BreadCrumbs tests couple of crumbs 1`] = `
className="pf-c-breadcrumb__item"
>
<Link
to="/"
to="/clients"
>
<LinkAnchor
href="/"
href="/clients"
navigate={[Function]}
>
<a
href="/"
href="/clients"
onClick={[Function]}
>
<span
key="/"
key="/clients"
>
Home
Clients
</span>
</a>
</LinkAnchor>
@ -79,9 +79,9 @@ exports[`BreadCrumbs tests couple of crumbs 1`] = `
</AngleRightIcon>
</span>
<span
key="/add-client"
key="/clients/1234"
>
Create client
Client details
</span>
</li>
</BreadcrumbItem>