Skip to content

Commit 9954832

Browse files
authored
Migrate consent reporting table to Ant Design (#7187)
1 parent 633843c commit 9954832

File tree

16 files changed

+318
-322
lines changed

16 files changed

+318
-322
lines changed

changelog/7187.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
type: Developer Experience
2+
description: Migrated consent reporting tables from Fides V2 table to Ant Design table components
3+
pr: 7187

clients/admin-ui/cypress/e2e/consent-reporting.cy.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe("Consent reporting", () => {
3131
},
3232
});
3333
cy.visit(CONSENT_REPORTING_ROUTE);
34-
cy.getByTestId("consent-reporting");
34+
cy.getByTestId("consent-reporting-table").should("exist");
3535
});
3636
it("can't access without plus", () => {
3737
stubPlus(false);
@@ -140,7 +140,9 @@ describe("Consent reporting", () => {
140140
expect(params.get("request_timestamp_lt")).to.be.null;
141141
});
142142

143-
cy.getByTestId("fidesTable-body").children().should("have.length", 22);
143+
cy.getByTestId("consent-reporting-table")
144+
.find("tr")
145+
.should("have.length", 24);
144146
});
145147
it("loads the consent report table with date filters", () => {
146148
cy.intercept(
@@ -177,7 +179,9 @@ describe("Consent reporting", () => {
177179
);
178180
});
179181

180-
cy.getByTestId("fidesTable-body").children().should("have.length", 22);
182+
cy.getByTestId("consent-reporting-table")
183+
.find("tr")
184+
.should("have.length", 24);
181185
});
182186
});
183187

@@ -198,24 +202,22 @@ describe("Consent reporting", () => {
198202
});
199203

200204
it("displays TCF badge and is clickable", () => {
201-
cy.getByTestId("fidesTable-body")
205+
cy.getByTestId("consent-reporting-table")
202206
.find("tr")
203-
.each(($row) => {
204-
if ($row.find("td").eq(3).text() === "TCF") {
205-
cy.wrap($row).find("button").should("exist").and("be.visible");
206-
return false;
207-
}
207+
.eq(3)
208+
.findByTestId("tcf-badge")
209+
.within(() => {
210+
cy.get("button").should("exist");
208211
});
209212
});
210213

211214
it("shows TCF details table and excludes system and vendor records", () => {
212-
cy.getByTestId("fidesTable-body")
215+
cy.getByTestId("consent-reporting-table")
213216
.find("tr")
214-
.each(($row) => {
215-
if ($row.find("td").eq(3).text() === "TCF") {
216-
cy.wrap($row).find("button").click();
217-
return false;
218-
}
217+
.eq(3)
218+
.findByTestId("tcf-badge")
219+
.within(() => {
220+
cy.get("button").click();
219221
});
220222

221223
cy.getByTestId("consent-tcf-detail-modal").should("exist");
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Typography } from "fidesui";
2+
3+
interface EllipsisCellProps
4+
extends React.ComponentProps<typeof Typography.Text> {
5+
children: React.ReactNode;
6+
}
7+
8+
export const EllipsisCell = ({ children, ...props }: EllipsisCellProps) => {
9+
return children && typeof children === "string" ? (
10+
<Typography.Text ellipsis={{ tooltip: children }} {...props}>
11+
{children}
12+
</Typography.Text>
13+
) : (
14+
children
15+
);
16+
};

clients/admin-ui/src/features/common/table/cells/LinkCell.tsx

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,34 @@ export const LinkCell = ({
88
href,
99
children,
1010
containerProps,
11+
strong = true,
1112
...props
1213
}: ComponentProps<typeof LinkText> & {
1314
containerProps?: FlexProps;
1415
}) => {
1516
return (
16-
<Flex {...containerProps}>
17-
{href ? (
18-
<NextLink href={href} passHref legacyBehavior>
19-
<LinkText
20-
strong
21-
ellipsis
22-
onClick={(e) => e.stopPropagation()}
23-
variant="primary"
24-
{...props}
25-
>
26-
<Text unStyled ellipsis={{ tooltip: children }}>
27-
{children}
28-
</Text>
29-
</LinkText>
30-
</NextLink>
31-
) : (
32-
<Text strong ellipsis {...props}>
33-
{children}
34-
</Text>
35-
)}
36-
</Flex>
17+
children && (
18+
<Flex {...containerProps}>
19+
{href ? (
20+
<NextLink href={href} passHref legacyBehavior>
21+
<LinkText
22+
strong={strong}
23+
ellipsis
24+
onClick={(e) => e.stopPropagation()}
25+
variant="primary"
26+
{...props}
27+
>
28+
<Text unStyled ellipsis={{ tooltip: children }}>
29+
{children}
30+
</Text>
31+
</LinkText>
32+
</NextLink>
33+
) : (
34+
<Text strong={strong} ellipsis {...props}>
35+
{children}
36+
</Text>
37+
)}
38+
</Flex>
39+
)
3740
);
3841
};

0 commit comments

Comments
 (0)