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

Data catalog UI: MVP #5628

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c2a27bc
first pass at system/project tables
jpople Oct 21, 2024
fc71e17
Merge branch 'main' into jpople/hj-29/dataset-lifecycle-top-tables
jpople Oct 21, 2024
6489e64
fix subfield naming
jpople Oct 31, 2024
13f9cca
apply const
jpople Oct 31, 2024
f256f5b
update changelog
jpople Oct 31, 2024
8d6a25b
add data use dropdown UI to system table
jpople Nov 1, 2024
58df678
refactor taxonomy selects
jpople Nov 4, 2024
2b3e67e
extract data use CRUD into hook
jpople Nov 4, 2024
72a4e87
code cleanup on data use form
jpople Nov 4, 2024
7eaabcb
TEMP: test PrivacyDeclarationResponse on BasicSystemResponse
jpople Nov 5, 2024
dd40ca0
add minimal declaration form
jpople Nov 8, 2024
a279c2e
fix deleting opening edit modal
jpople Nov 8, 2024
cfedd93
Merge branch 'main' into jpople/hj-29/dataset-lifecycle-top-tables
jpople Nov 15, 2024
b0ca9bb
Merge branch 'main' into jpople/hj-29/dataset-lifecycle-top-tables
jpople Nov 18, 2024
f0d3ca1
merge taxonomy select changes
jpople Nov 18, 2024
ecafa9d
refactor TaxonomySelect again
jpople Nov 18, 2024
c0900c7
WIP: new system endpoint hookup
jpople Nov 18, 2024
056b3ab
Merge branch 'main' into jpople/hj-29/dataset-lifecycle-top-tables
jpople Nov 25, 2024
d068f50
Merge branch 'jpople/hj-13/data-use-picker-cell' into jpople/hj-29/da…
jpople Nov 25, 2024
0297e41
WIP: tables
jpople Nov 27, 2024
8453d8b
regenerate types
jpople Dec 12, 2024
670e206
WIP: changes for updated backend
jpople Dec 18, 2024
482d662
type update
jpople Dec 18, 2024
4e53afa
tables; rework nav
jpople Dec 18, 2024
fcf6b21
type update
jpople Dec 19, 2024
81789af
result & status cells
jpople Dec 19, 2024
4162b70
Merge branch 'main' into jpople/hj-29/dataset-lifecycle-top-tables
jpople Dec 19, 2024
da3c337
breadcrumb update
jpople Dec 20, 2024
92f1a40
resource actions & columns
jpople Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ The types of changes are:

### Fixed
- API router sanitizer being too aggressive with NextJS Catch-all Segments [#5438](https://github.com/ethyca/fides/pull/5438)
- Fix rendering of subfield names in D&D tables [#5439](https://github.com/ethyca/fides/pull/5439)
- Fix BigQuery `partitioning` queries to properly support multiple identity clauses [#5432](https://github.com/ethyca/fides/pull/5432)

## [2.48.0](https://github.com/ethyca/fides/compare/2.47.1...2.48.0)
Expand Down
22 changes: 22 additions & 0 deletions clients/admin-ui/src/features/common/ResultStatusBadge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Badge, BadgeProps } from "fidesui";
import React from "react";

const ResultStatusBadge = React.forwardRef<HTMLSpanElement, BadgeProps>(
(props, ref) => {
return (
<Badge
fontSize="xs"
fontWeight="normal"
textTransform="none"
ref={ref}
{...props}
>
{props.children}
</Badge>
);
},
);

ResultStatusBadge.displayName = "ResultStatusBadge";

export default ResultStatusBadge;
17 changes: 5 additions & 12 deletions clients/admin-ui/src/features/common/TaxonomiesPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import {
Box,
CloseIcon,
SmallAddIcon,
Wrap,
} from "fidesui";
import { useState } from "react";

import { TaxonomySelect } from "~/features/common/dropdown/TaxonomySelect";
import DataCategorySelect from "~/features/common/dropdown/DataCategorySelect";
import TaxonomyCellContainer from "~/features/data-discovery-and-detection/tables/cells/TaxonomyCellContainer";

import useTaxonomies from "./hooks/useTaxonomies";

Expand All @@ -27,14 +27,7 @@ const TaxonomiesPicker = ({
const { getDataCategoryDisplayName } = useTaxonomies();

return (
<Wrap
py={2}
alignItems="center"
position="relative"
width="100%"
gap={2}
overflowX="auto"
>
<TaxonomyCellContainer>
{selectedTaxonomies.map((category) => (
<Badge
fontWeight="normal"
Expand Down Expand Up @@ -76,7 +69,7 @@ const TaxonomiesPicker = ({
height="max"
bgColor="#fff"
>
<TaxonomySelect
<DataCategorySelect
selectedTaxonomies={selectedTaxonomies}
onChange={(o) => {
setIsAdding(false);
Expand All @@ -87,7 +80,7 @@ const TaxonomiesPicker = ({
/>
</Box>
)}
</Wrap>
</TaxonomyCellContainer>
);
};
export default TaxonomiesPicker;
2 changes: 2 additions & 0 deletions clients/admin-ui/src/features/common/api.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const baseApi = createApi({
tagTypes: [
"Allow List",
"Auth",
"Catalog Systems",
"Catalog Projects",
"Classify Instances Datasets",
"Classify Instances Systems",
"Connection Type",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {
TaxonomySelect,
TaxonomySelectOption,
TaxonomySelectProps,
} from "~/features/common/dropdown/TaxonomySelect";
import useTaxonomies from "~/features/common/hooks/useTaxonomies";

import styles from "./TaxonomySelect.module.scss";

const DataCategorySelect = ({
selectedTaxonomies,
showDisabled = false,
...props
}: TaxonomySelectProps) => {
const { getDataCategoryDisplayNameProps, getDataCategories } =
useTaxonomies();

const getActiveDataCategories = () =>
getDataCategories().filter((c) => c.active);

const dataCategories = showDisabled
? getDataCategories()
: getActiveDataCategories();

const options: TaxonomySelectOption[] = dataCategories
.filter((category) => !selectedTaxonomies.includes(category.fides_key))
.map((category) => {
const { name, primaryName } = getDataCategoryDisplayNameProps(
category.fides_key,
);
return {
value: category.fides_key,
name,
primaryName,
description: category.description || "",
className: styles.option,
};
});

return <TaxonomySelect options={options} {...props} />;
};

export default DataCategorySelect;
39 changes: 39 additions & 0 deletions clients/admin-ui/src/features/common/dropdown/DataUseSelect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {
TaxonomySelect,
TaxonomySelectOption,
TaxonomySelectProps,
} from "~/features/common/dropdown/TaxonomySelect";
import useTaxonomies from "~/features/common/hooks/useTaxonomies";

import styles from "./TaxonomySelect.module.scss";

const DataUseSelect = ({
selectedTaxonomies,
showDisabled = false,
...props
}: TaxonomySelectProps) => {
const { getDataUseDisplayNameProps, getDataUses } = useTaxonomies();

const getActiveDataUses = () => getDataUses().filter((du) => du.active);

const dataUses = showDisabled ? getDataUses() : getActiveDataUses();

const options: TaxonomySelectOption[] = dataUses
.filter((dataUse) => !selectedTaxonomies.includes(dataUse.fides_key))
.map((dataUse) => {
const { name, primaryName } = getDataUseDisplayNameProps(
dataUse.fides_key,
);
return {
value: dataUse.fides_key,
name,
primaryName,
description: dataUse.description || "",
className: styles.option,
};
});

return <TaxonomySelect options={options} {...props} />;
};

export default DataUseSelect;
43 changes: 7 additions & 36 deletions clients/admin-ui/src/features/common/dropdown/TaxonomySelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import {
AntSelectProps as SelectProps,
} from "fidesui";

import useTaxonomies from "../hooks/useTaxonomies";
import styles from "./TaxonomySelect.module.scss";

export interface TaxonomySelectOption {
value: string;
name?: string;
Expand All @@ -15,7 +12,7 @@ export interface TaxonomySelectOption {
className?: string;
}

const TaxonomyOption = ({ data }: { data: TaxonomySelectOption }) => {
export const TaxonomyOption = ({ data }: { data: TaxonomySelectOption }) => {
return (
<Flex
gap={12}
Expand All @@ -30,48 +27,22 @@ const TaxonomyOption = ({ data }: { data: TaxonomySelectOption }) => {
);
};

interface TaxonomySelectProps
extends SelectProps<string, TaxonomySelectOption> {
export interface TaxonomySelectProps
extends Omit<SelectProps<string, TaxonomySelectOption>, "options"> {
selectedTaxonomies: string[];
showDisabled?: boolean;
}

export const TaxonomySelect = ({
selectedTaxonomies,
showDisabled = false,
options,
...props
}: TaxonomySelectProps) => {
const { getDataCategoryDisplayNameProps, getDataCategories } =
useTaxonomies();

const getActiveDataCategories = () =>
getDataCategories().filter((c) => c.active);

const dataCategories = showDisabled
? getDataCategories()
: getActiveDataCategories();

const options: TaxonomySelectOption[] = dataCategories
.filter((category) => !selectedTaxonomies.includes(category.fides_key))
.map((category) => {
const { name, primaryName } = getDataCategoryDisplayNameProps(
category.fides_key,
);
return {
value: category.fides_key,
name,
primaryName,
description: category.description || "",
className: styles.option,
};
});

}: SelectProps<string, TaxonomySelectOption>) => {
return (
<Select<string, TaxonomySelectOption>
options={options}
autoFocus
showSearch
variant="borderless"
placeholder="Select a category..."
options={options}
optionRender={TaxonomyOption}
dropdownStyle={{ minWidth: "500px" }}
className="w-full p-0"
Expand Down
27 changes: 27 additions & 0 deletions clients/admin-ui/src/features/common/form/AdvancedSettings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { ChevronDownIcon, Collapse, Flex, Text, useDisclosure } from "fidesui";
import { ReactNode } from "react";

const AdvancedSettings = ({ children }: { children: ReactNode }) => {
const { isOpen, onToggle } = useDisclosure();
return (
<Flex
p={4}
gap={6}
direction="column"
border="1px solid"
borderColor="gray.200"
>
<Flex justifyContent="space-between" cursor="pointer" onClick={onToggle}>
<Text fontSize="xs">Advanced settings</Text>
<ChevronDownIcon className={isOpen ? "rotate-180" : undefined} />
</Flex>
<Collapse in={isOpen}>
<Flex direction="column" gap={4}>
{children}
</Flex>
</Collapse>
</Flex>
);
};

export default AdvancedSettings;
5 changes: 5 additions & 0 deletions clients/admin-ui/src/features/common/hooks/useTaxonomies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ const useTaxonomies = () => {

const getDataUseDisplayName = (dataUseKey: string): JSX.Element | string =>
getDataDisplayName(dataUseKey, getDataUseByKey, 1);
const getDataUseDisplayNameProps = (
dataUseKey: string,
): DataDisplayNameProps =>
getDataDisplayNameProps(dataUseKey, getDataUseByKey, 1);

/*
Data Categories
Expand Down Expand Up @@ -143,6 +147,7 @@ const useTaxonomies = () => {
getDataUses,
getDataUseByKey,
getDataUseDisplayName,
getDataUseDisplayNameProps,
getDataCategories,
getDataCategoryByKey,
getDataCategoryDisplayName,
Expand Down
5 changes: 5 additions & 0 deletions clients/admin-ui/src/features/common/nav/v2/nav-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ export const NAV_CONFIG: NavConfigGroup[] = [
requiresFlag: "dataDiscoveryAndDetection",
requiresPlus: true,
},
{
title: "Data catalog",
path: routes.DATA_CATALOG_ROUTE,
scopes: [],
},
],
},
{
Expand Down
3 changes: 3 additions & 0 deletions clients/admin-ui/src/features/common/nav/v2/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export const DATA_DISCOVERY_ROUTE = "/data-discovery/discovery";
export const DATA_DISCOVERY_ROUTE_DETAIL =
"/data-discovery/discovery/[resourceUrn]";

// End-to-end datasets
export const DATA_CATALOG_ROUTE = "/data-catalog";

// Privacy requests group
export const DATASTORE_CONNECTION_ROUTE = "/datastore-connection";
export const PRIVACY_REQUESTS_ROUTE = "/privacy-requests";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const FidesCell = <T,>({
height="inherit"
onClick={handleCellClick}
data-testid={`row-${cell.row.id}-col-${cell.column.id}`}
{...cell.column.columnDef.meta?.cellProps}
>
{!cell.getIsPlaceholder() || isFirstRowOfGroupedRows
? flexRender(cell.column.columnDef.cell, {
Expand Down
3 changes: 3 additions & 0 deletions clients/admin-ui/src/features/common/table/v2/FidesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
Portal,
SmallCloseIcon,
Table,
TableCellProps,
TableContainer,
Tbody,
Td,
Expand Down Expand Up @@ -57,6 +58,7 @@ declare module "@tanstack/table-core" {
showHeaderMenuWrapOption?: boolean;
overflow?: "auto" | "visible" | "hidden";
disableRowClick?: boolean;
cellProps?: TableCellProps;
onCellClick?: (row: TData) => void;
}
}
Expand Down Expand Up @@ -438,6 +440,7 @@ export const FidesTableV2 = <T,>({
opacity: 1,
},
}}
{...header.column.columnDef.meta?.cellProps}
>
<HeaderContent
header={header}
Expand Down
Loading
Loading