-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added directory breadcrumb buttons to see path and navigate back (#141)
* Added directory breadcrumbs to - be able to view the current path one came to the current directory - be able to quickly navigate upwards * layout fixes * use breadcrumps for history in DirectoryObject.jsx / DirectoryBreadcrumbs.jsx * - get path of snapshot - no tooltip if no OID - disable / improve wrapping of tooltip - disable clicking on current breadcrumb item * enable copying of OID to clipboard * fix warning about className and readOnly form --------- Co-authored-by: Peter Tandler <[email protected]>
- Loading branch information
Showing
6 changed files
with
83 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import Breadcrumb from 'react-bootstrap/Breadcrumb'; | ||
import { useHistory, useLocation } from 'react-router-dom'; | ||
import { OverlayTrigger, Tooltip } from "react-bootstrap"; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { faInfoCircle } from "@fortawesome/free-solid-svg-icons"; | ||
|
||
export function DirectoryBreadcrumbs() { | ||
const location = useLocation(); | ||
const history = useHistory(); | ||
|
||
const breadcrumbs = [] | ||
for (let state = location.state; state; state = state.prevState) { | ||
breadcrumbs.unshift(state) | ||
} | ||
|
||
return ( | ||
<Breadcrumb> | ||
{ | ||
breadcrumbs.map((state, i) => { | ||
const index = breadcrumbs.length - i - 1 // revert index | ||
return <Breadcrumb.Item key={index} size="sm" variant="outline-secondary" | ||
onClick={() => { | ||
if (index) history.go(-index); | ||
}} | ||
active={!index}> | ||
{state.label} | ||
{state.oid && !index && <> <OverlayTrigger placement="top" | ||
trigger="click" | ||
overlay={<Tooltip | ||
className={"wide-tooltip"}>OID: {state.oid}</Tooltip>} | ||
> | ||
<FontAwesomeIcon icon={faInfoCircle} /> | ||
</OverlayTrigger></>} | ||
</Breadcrumb.Item>; | ||
}) | ||
} | ||
</Breadcrumb> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters