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": { "client-scopes": {
"createClientScope": "Create client scope", "createClientScope": "Create client scope",
"clientScopeList": "List of client scopes", "clientScopeList": "Client scopes",
"clientScopeDetails": "Client scope details", "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", "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", "searchFor": "Search for client scope",

View file

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

View file

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

View file

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

View file

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

View file

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