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

release 2.52.0 #5621

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
description: Detect hardcoded secrets pre-commit using Gitleaks
entry: gitleaks protect --verbose --no-banner --redact --staged
language: system
stages: [pre-commit]
stages: [commit]

- id: gitleaks-pre-push
# To use this pre-push hook, run
Expand All @@ -20,4 +20,4 @@ repos:
description: Detect hardcoded secrets pre-push using Gitleaks
entry: gitleaks detect --verbose --no-banner --redact --log-opts "origin..HEAD"
language: system
stages: [pre-push]
stages: [push]
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@ The types of changes are:
- Added new `has_next` parameter for the `link` pagination strategy [#5596](https://github.com/ethyca/fides/pull/5596)
- Added a `DBCache` model for database-backed caching [#5613](https://github.com/ethyca/fides/pull/5613)
- Adds "reclassify" button to discovery result tables [#5574](https://github.com/ethyca/fides/pull/5574)
- Added support for exporting datamaps with column renaming, reordering and visibility options [#5543](https://github.com/ethyca/fides/pull/5543)

### Changed
- Adjusted Ant's Select component colors and icon [#5594](https://github.com/ethyca/fides/pull/5594)
- Replaced taxonomies page with new UI based on an interactive tree visualization [#5602](https://github.com/ethyca/fides/pull/5602)
- Adjusted functionality around updating taxonomy active field, includes data migration to re-activate taxonomy nodes [#5617](https://github.com/ethyca/fides/pull/5617)
- Migrated breadcrumbs to Ant Design [#5610](https://github.com/ethyca/fides/pull/5610)
- Updated `CustomReportConfig` to be more intuitive on its contents [#5543](https://github.com/ethyca/fides/pull/5543)

### Fixed
- Fixing quickstart.py script [#5585](https://github.com/ethyca/fides/pull/5585)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import {
getDatamapReportColumns,
getDefaultColumn,
} from "./DatamapReportTableColumns";
import { getGrouping, getPrefixColumns } from "./utils";
import { getColumnOrder, getGrouping, getPrefixColumns } from "./utils";

const emptyMinimalDatamapReportResponse: Page_DatamapReport_ = {
items: [],
Expand Down Expand Up @@ -223,6 +223,14 @@ export const DatamapReportTable = () => {
],
);

useEffect(() => {
if (datamapReport?.items?.length) {
const columnIDs = Object.keys(datamapReport.items[0]);
setColumnOrder(getColumnOrder(groupBy, columnIDs));
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [groupBy, datamapReport]);

const {
isOpen: isColumnSettingsOpen,
onOpen: onColumnSettingsOpen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { DATAMAP_GROUPING } from "~/types/api";

import { DatamapReportFilterSelections } from "../types";
import { COLUMN_IDS, DATAMAP_LOCAL_STORAGE_KEYS } from "./constants";
import { getColumnOrder } from "./utils";

interface DatamapReportContextProps {
savedCustomReportId: string;
Expand Down Expand Up @@ -61,7 +60,7 @@ export const DatamapReportProvider = ({

const [columnOrder, setColumnOrder] = useLocalStorage<string[]>(
DATAMAP_LOCAL_STORAGE_KEYS.COLUMN_ORDER,
getColumnOrder(groupBy),
[],
);

const [columnVisibility, setColumnVisibility] = useLocalStorage<
Expand Down
25 changes: 12 additions & 13 deletions clients/admin-ui/src/features/datamap/reporting/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,23 @@ export const getGrouping = (groupBy?: DATAMAP_GROUPING) => {
}
};

export const getColumnOrder = (groupBy: DATAMAP_GROUPING) => {
export const getColumnOrder = (
groupBy: DATAMAP_GROUPING,
columnIDs: string[],
) => {
let columnOrder: string[] = [];
if (DATAMAP_GROUPING.SYSTEM_DATA_USE === groupBy) {
columnOrder = [
COLUMN_IDS.SYSTEM_NAME,
COLUMN_IDS.DATA_USE,
COLUMN_IDS.DATA_CATEGORY,
COLUMN_IDS.DATA_SUBJECT,
];
columnOrder = [COLUMN_IDS.SYSTEM_NAME, COLUMN_IDS.DATA_USE];
}
if (DATAMAP_GROUPING.DATA_USE_SYSTEM === groupBy) {
columnOrder = [
COLUMN_IDS.DATA_USE,
COLUMN_IDS.SYSTEM_NAME,
COLUMN_IDS.DATA_CATEGORY,
COLUMN_IDS.DATA_SUBJECT,
];
columnOrder = [COLUMN_IDS.DATA_USE, COLUMN_IDS.SYSTEM_NAME];
}
columnOrder = columnOrder.concat(
columnIDs.filter(
(columnID) =>
columnID !== COLUMN_IDS.SYSTEM_NAME && columnID !== COLUMN_IDS.DATA_USE,
),
);
return columnOrder;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ const TaxonomyInteractiveTree = ({

// Reset the zoom level and center the view when the taxonomy type changes
useEffect(() => {
// Timeout is needed because fitView doesn't work if it's
// A small delay is needed because fitView doesn't work if it's
// called before the nodes are rendered
setTimeout(() => fitView(), 0);
setTimeout(() => fitView(), 150);
}, [fitView, taxonomyType]);

// Root node (the taxonomy type)
Expand Down
9 changes: 7 additions & 2 deletions clients/admin-ui/src/pages/taxonomy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ import PageHeader from "~/features/common/PageHeader";
import { errorToastParams, successToastParams } from "~/features/common/toast";
import TaxonomyEditDrawer from "~/features/taxonomy/components/TaxonomyEditDrawer";
import TaxonomyInteractiveTree from "~/features/taxonomy/components/TaxonomyInteractiveTree";
import { CoreTaxonomiesEnum } from "~/features/taxonomy/constants";
import {
CoreTaxonomiesEnum,
TAXONOMY_ROOT_NODE_ID,
} from "~/features/taxonomy/constants";
import useTaxonomySlices from "~/features/taxonomy/hooks/useTaxonomySlices";
import { TaxonomyEntity } from "~/features/taxonomy/types";

Expand Down Expand Up @@ -67,9 +70,11 @@ const TaxonomyPage: NextPage = () => {
return;
}

const isChildOfRoot = draftNewItem?.parent_key === TAXONOMY_ROOT_NODE_ID;
const newItem = {
...draftNewItem,
name: labelName,
parent_key: isChildOfRoot ? null : draftNewItem.parent_key,
};

const result = await createTrigger(newItem);
Expand All @@ -79,7 +84,7 @@ const TaxonomyPage: NextPage = () => {
}
setLastCreatedItemKey(result.data.fides_key);
toast(successToastParams("New label successfully created"));
setTimeout(() => setDraftNewItem(null));
setDraftNewItem(null);
},
[createTrigger, draftNewItem, toast],
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""adding foreign key on fides key for taxonomy
Revision ID: 10c6b7709be3
Revises: b63ecb007556
Create Date: 2024-12-17 14:54:02.325442
"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "10c6b7709be3"
down_revision = "b63ecb007556"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_foreign_key(
"ctl_data_categories_parent_key_fkey",
"ctl_data_categories",
"ctl_data_categories",
["parent_key"],
["fides_key"],
ondelete="RESTRICT",
)
op.create_foreign_key(
"ctl_data_uses_parent_key_fkey",
"ctl_data_uses",
"ctl_data_uses",
["parent_key"],
["fides_key"],
ondelete="RESTRICT",
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
"ctl_data_categories_parent_key_fkey", "ctl_data_categories", type_="foreignkey"
)
op.drop_constraint(
"ctl_data_uses_parent_key_fkey", "ctl_data_uses", type_="foreignkey"
)
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
"""Add data migration to reactivate taxonomy nodes
Revision ID: ae65da77c468
Revises: 10c6b7709be3
Create Date: 2024-12-18 12:27:47.239489
"""

import sqlalchemy as sa
from alembic import op
from sqlalchemy import text
from sqlalchemy.engine import Connection
from sqlalchemy.sql.elements import TextClause

# revision identifiers, used by Alembic.
revision = "ae65da77c468"
down_revision = "10c6b7709be3"
branch_labels = None
depends_on = None


def upgrade() -> None:
"""
This is a data migration to activate taxonomy nodes if it is de-active and has any children that are active
E.g.
Taxonomy Tree: A----B----C
\
----D
Current Active Fields: A (false), B (false), C (true), D (false)
Upgrade Active Fields: A (true), B (true), C (true), D (false)
"""
bind: Connection = op.get_bind()

reactivate_data_categories_query: TextClause = text(
"""
WITH RECURSIVE leaf_nodes AS (
SELECT DISTINCT dc.fides_key
FROM ctl_data_categories dc
WHERE dc.fides_key NOT IN (
SELECT DISTINCT parent_key
FROM ctl_data_categories
WHERE parent_key IS NOT NULL
)
AND dc.active = true
),
parent_hierarchy AS (
SELECT dc.fides_key, dc.parent_key
FROM ctl_data_categories dc
INNER JOIN leaf_nodes ln ON dc.fides_key = ln.fides_key
UNION
SELECT dc.fides_key, dc.parent_key
FROM ctl_data_categories dc
INNER JOIN parent_hierarchy ph ON dc.fides_key = ph.parent_key
)
UPDATE ctl_data_categories
SET active = true
WHERE fides_key IN (
SELECT fides_key FROM parent_hierarchy
)
AND active = false;
"""
)

reactivate_data_uses_query: TextClause = text(
"""
WITH RECURSIVE leaf_nodes AS (
SELECT DISTINCT dc.fides_key
FROM ctl_data_uses dc
WHERE dc.fides_key NOT IN (
SELECT DISTINCT parent_key
FROM ctl_data_uses
WHERE parent_key IS NOT NULL
)
AND dc.active = true
),
parent_hierarchy AS (
SELECT dc.fides_key, dc.parent_key
FROM ctl_data_uses dc
INNER JOIN leaf_nodes ln ON dc.fides_key = ln.fides_key
UNION
SELECT dc.fides_key, dc.parent_key
FROM ctl_data_uses dc
INNER JOIN parent_hierarchy ph ON dc.fides_key = ph.parent_key
)
UPDATE ctl_data_uses
SET active = true
WHERE fides_key IN (
SELECT fides_key FROM parent_hierarchy
)
AND active = false;
"""
)

# Update ctl_data_categories
bind.execute(reactivate_data_categories_query)

# Update ctl_data_uses
bind.execute(reactivate_data_uses_query)


def downgrade() -> None:
"""
This migration does not support downgrades.
"""
pass
Loading
Loading