Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "all activity" breadcrumb to D&D tables #5694

Merged
merged 9 commits into from
Jan 29, 2025
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Changes can also be flagged with a GitHub label for tracking purposes. The URL o
- The privacy declarations for a system are now sorted alphabetically by name. [#5683](https://github.com/ethyca/fides/pull/5683)
- Upgraded GPP library to `3.1.5` and added support for all available state sections (ustx, usde, usia, etc.) [#5696](https://github.com/ethyca/fides/pull/5696)
- Updating DSR execution to allow collections to be unreachable when they don't contain policy-relevant data categories [#5689](https://github.com/ethyca/fides/pull/5689)
- Added "All activity" root breadcrumb to D&D results tables [#5694](https://github.com/ethyca/fides/pull/5694)

### Developer Experience
- Migrated radio buttons and groups to Ant Design [#5681](https://github.com/ethyca/fides/pull/5681)
Expand Down
16 changes: 16 additions & 0 deletions clients/admin-ui/src/features/common/nav/v2/NextBreadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
AntBreadcrumb as Breadcrumb,
AntBreadcrumbItemType as BreadcrumbItemType,
AntBreadcrumbProps as BreadcrumbProps,
AntButton as Button,
AntTypography as Typography,
} from "fidesui";
import { Url } from "next/dist/shared/lib/router/router";
Expand Down Expand Up @@ -36,6 +37,7 @@ export const NextBreadcrumb = ({ items, ...props }: NextBreadcrumbProps) => {
items?.map((item, i) => {
const isCurrentPage = i === items.length - 1;
const modifiedItem = { ...item };
const renderAsButton = modifiedItem.onClick && !modifiedItem.href;
if (typeof modifiedItem.title === "string") {
// for everything except the current page, truncate the title if it's too long
modifiedItem.title = (
Expand All @@ -50,6 +52,20 @@ export const NextBreadcrumb = ({ items, ...props }: NextBreadcrumbProps) => {
</Text>
);
}
if (renderAsButton) {
modifiedItem.title = (
<Button
type="text"
size="small"
icon={modifiedItem.icon}
onClick={modifiedItem.onClick}
className="ant-breadcrumb-link -mt-px px-1 text-inherit"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gilluminate Updated NextBreadcrumb as you suggested.

This top margin is ugly, but was the closest I was able to get to centering the buttons vertically so the breadcrumb items are aligned-- Ant doesn't expose much of its item rendering and they don't have classes to style with SCSS either.

>
{modifiedItem.title}
</Button>
);
return modifiedItem;
}
if (modifiedItem.icon) {
modifiedItem.title = (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ const DiscoveryMonitorBreadcrumbs = ({
}

if (resourceUrn) {
breadcrumbItems.push({
title: "All activity",
href: parentLink,
});
const urnParts = resourceUrn.split(".");
urnParts.forEach((urnPart, index) => {
// don't render anything at the monitor level because there's no view for it
if (index === 0) {
return;
}
const isDatabase = index === 1;

breadcrumbItems.push({
title: urnPart,
icon: DATA_BREADCRUMB_ICONS[index - 1],
href: isDatabase ? parentLink : "",
onClick: !isDatabase
? (e) => {
e.preventDefault();
onPathClick(urnParts.slice(0, index + 1).join("."));
}
: undefined,
onClick: (e) => {
e.preventDefault();
onPathClick(urnParts.slice(0, index + 1).join("."));
},
});
});
}
Expand Down