Skip to content

Commit 84e3033

Browse files
authored
refactor(coral): Update text for blocked actions (#1667)
* Extend tests for deletion blocking topic and connector * Update text for blocked edit of topic and connector. * Update text for blocked claim request. * Update text for blocked schema request. * Update text for blocked promotion. Signed-off-by: Mirjam Aulbach <mirjam.aulbach@aiven.io>
1 parent 68c4211 commit 84e3033

12 files changed

Lines changed: 50 additions & 27 deletions

coral/src/app/features/components/ClaimBanner.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ describe("ClaimBanner", () => {
7979

8080
it("shows information that the topic has a pending request", () => {
8181
const description = screen.getByText(
82-
`${testProps.entityName} has pending requests. Your team cannot claim ownership at this time.`
82+
`Your team cannot claim ownership at this time. ${testProps.entityName} has pending requests.`
8383
);
8484

8585
expect(description).toBeVisible();
@@ -101,7 +101,7 @@ describe("ClaimBanner", () => {
101101

102102
it("shows information that the connector has a pending request", () => {
103103
const description = screen.getByText(
104-
`${testProps.entityName} has pending requests. Your team cannot claim ownership at this time.`
104+
`Your team cannot claim ownership at this time. ${testProps.entityName} has pending requests.`
105105
);
106106

107107
expect(description).toBeVisible();
@@ -127,7 +127,7 @@ describe("ClaimBanner", () => {
127127

128128
it("shows information that the topic has an open claim request", () => {
129129
const description = screen.getByText(
130-
`A claim request for ${testProps.entityName} is already in progress.`
130+
`Your team cannot claim ownership at this time. A claim request for ${testProps.entityName} is already in progress.`
131131
);
132132

133133
expect(description).toBeVisible();
@@ -162,7 +162,7 @@ describe("ClaimBanner", () => {
162162

163163
it("shows information that the connector has an open claim request", () => {
164164
const description = screen.getByText(
165-
`A claim request for ${testProps.entityName} is already in progress.`
165+
`Your team cannot claim ownership at this time. A claim request for ${testProps.entityName} is already in progress.`
166166
);
167167

168168
expect(description).toBeVisible();

coral/src/app/features/components/ClaimBanner.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const ClaimBanner = ({
3131
<Banner image={illustration} layout="vertical" title={""}>
3232
<Box.Flex minHeight={"full"}>
3333
<Box.Flex component={"p"} alignSelf={"center"}>
34-
{`${entityName} has pending requests. Your team cannot claim ownership at this time.`}
34+
{`Your team cannot claim ownership at this time. ${entityName} has pending requests.`}
3535
</Box.Flex>
3636
</Box.Flex>
3737
</Banner>
@@ -42,7 +42,8 @@ const ClaimBanner = ({
4242
return (
4343
<Banner image={illustration} layout="vertical" title={""}>
4444
<Box component={"p"} marginBottom={"l1"}>
45-
A claim request for {entityName} is already in progress.
45+
Your team cannot claim ownership at this time. A claim request for{" "}
46+
{entityName} is already in progress.
4647
</Box>
4748
<InternalLinkButton
4849
to={`/requests/${entityType}s?search=${entityName}&requestType=CLAIM&status=CREATED&page=1`}

coral/src/app/features/components/EntityDetailsHeader.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ describe("EntityDetailsHeader", () => {
435435
expect(link).toHaveAttribute("aria-disabled", "true");
436436
expect(link).not.toHaveAttribute("href");
437437
expect(link).toHaveAccessibleName(
438-
"Edit topic. The topic has a pending request."
438+
"Edit topic. You cannot edit the topic at this time. my-nice-topic has a pending request."
439439
);
440440
});
441441
});
@@ -459,7 +459,7 @@ describe("EntityDetailsHeader", () => {
459459
expect(link).toHaveAttribute("aria-disabled", "true");
460460
expect(link).not.toHaveAttribute("href");
461461
expect(link).toHaveAccessibleName(
462-
"Edit connector. The connector has a pending request."
462+
"Edit connector. You cannot edit the connector at this time. my-nice-connector has a pending request."
463463
);
464464
});
465465
});

coral/src/app/features/components/EntityDetailsHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function EntityDetailsHeader(props: TopicOverviewHeaderProps) {
111111

112112
{showEditButton && hasPendingRequest && (
113113
<DisabledButtonTooltip
114-
tooltip={`The ${entity.type} has a pending request.`}
114+
tooltip={`You cannot edit the ${entity.type} at this time. ${entity.name} has a pending request.`}
115115
role={"link"}
116116
>
117117
{`Edit ${entity.type}`}

coral/src/app/features/connectors/details/settings/ConnectorSettings.test.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,14 @@ describe("ConnectorSettings", () => {
350350

351351
afterAll(cleanup);
352352

353+
it("shows information connector can not be deleted at the moment", () => {
354+
const information = screen.getByText(
355+
"You can not create a delete request for this connector:"
356+
);
357+
358+
expect(information).toBeVisible();
359+
});
360+
353361
it("shows information that connector has a pending request and open ACL requests", () => {
354362
const reasonsList = screen.getByRole("list");
355363
const listItem = within(reasonsList).getAllByRole("listitem");

coral/src/app/features/topics/details/components/PromotionBanner.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ describe("PromotionBanner", () => {
145145

146146
it("shows information about the open request", () => {
147147
const information = screen.getByText(
148-
`${testTopicName} has a pending request.`
148+
`You cannot promote the schema at this time. ${testTopicName} has a pending request.`
149149
);
150150

151151
expect(information).toBeVisible();
@@ -183,7 +183,7 @@ describe("PromotionBanner", () => {
183183

184184
it("shows information about the open request", () => {
185185
const information = screen.getByText(
186-
`${testTopicName} has a pending request.`
186+
`You cannot promote the topic at this time. ${testTopicName} has a pending request.`
187187
);
188188

189189
expect(information).toBeVisible();
@@ -221,7 +221,7 @@ describe("PromotionBanner", () => {
221221

222222
it("shows information about the open request", () => {
223223
const information = screen.getByText(
224-
`A claim request for ${testTopicName} is in progress.`
224+
`You cannot promote the schema at this time. A claim request for ${testTopicName} is in progress.`
225225
);
226226

227227
expect(information).toBeVisible();
@@ -259,7 +259,7 @@ describe("PromotionBanner", () => {
259259

260260
it("shows information about the open request", () => {
261261
const information = screen.getByText(
262-
`A claim request for ${testTopicName} is in progress.`
262+
`You cannot promote the topic at this time. A claim request for ${testTopicName} is in progress.`
263263
);
264264

265265
expect(information).toBeVisible();
@@ -297,7 +297,7 @@ describe("PromotionBanner", () => {
297297

298298
it("shows information about the open request", () => {
299299
const information = screen.getByText(
300-
`An promotion request for ${testTopicName} is already in progress.`
300+
`You cannot promote the schema at this time. An promotion request for ${testTopicName} is already in progress.`
301301
);
302302

303303
expect(information).toBeVisible();
@@ -335,7 +335,7 @@ describe("PromotionBanner", () => {
335335

336336
it("shows information about the open request", () => {
337337
const information = screen.getByText(
338-
`An promotion request for ${testTopicName} is already in progress.`
338+
`You cannot promote the topic at this time. An promotion request for ${testTopicName} is already in progress.`
339339
);
340340

341341
expect(information).toBeVisible();

coral/src/app/features/topics/details/components/PromotionBanner.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@ import { InternalLinkButton } from "src/app/components/InternalLinkButton";
44
import illustration from "src/app/images/topic-details-banner-Illustration.svg";
55
import { PromotionStatus } from "src/domain/promotion";
66

7+
type RequestTypeLocal = "CLAIM" | "ALL" | "PROMOTE";
8+
type EntityTypeLocal = "schema" | "topic";
9+
710
interface PromotionBannerProps {
811
// `entityName` is only optional on
912
// KlawApiModel<"PromotionStatus">
1013
// so we can't rely on it to be part of
1114
// the promotionDetails
1215
entityName: string;
1316
promotionDetails: PromotionStatus;
14-
type: "schema" | "topic";
17+
type: EntityTypeLocal;
1518
promoteElement: ReactElement;
1619
hasOpenClaimRequest: boolean;
1720
hasOpenRequest: boolean;
1821
hasError: boolean;
1922
errorMessage: string;
2023
}
2124

22-
type RequestTypeLocal = "CLAIM" | "ALL" | "PROMOTE";
2325
function getRequestType({
2426
hasOpenClaimRequest,
2527
hasOpenPromotionRequest,
@@ -41,7 +43,7 @@ function createLink({
4143
entityName,
4244
requestType,
4345
}: {
44-
type: "schema" | "topic";
46+
type: EntityTypeLocal;
4547
entityName: string;
4648
requestType: RequestTypeLocal;
4749
}): string {
@@ -51,19 +53,23 @@ function createLink({
5153
}
5254

5355
function createText({
56+
type,
5457
entityName,
5558
requestType,
5659
}: {
60+
type: "schema" | "topic";
5761
entityName: string;
5862
requestType: RequestTypeLocal;
5963
}): string {
64+
const defaultText = `You cannot promote the ${type} at this time.`;
65+
6066
if (requestType === "PROMOTE") {
61-
return `An promotion request for ${entityName} is already in progress.`;
67+
return `${defaultText} An promotion request for ${entityName} is already in progress.`;
6268
}
6369
if (requestType === "CLAIM") {
64-
return `A claim request for ${entityName} is in progress.`;
70+
return `${defaultText} A claim request for ${entityName} is in progress.`;
6571
}
66-
return `${entityName} has a pending request.`;
72+
return `${defaultText} ${entityName} has a pending request.`;
6773
}
6874

6975
const PromotionBanner = ({
@@ -104,7 +110,7 @@ const PromotionBanner = ({
104110
hasOpenPromotionRequest,
105111
});
106112
const link = createLink({ type, entityName, requestType });
107-
const text = createText({ entityName, requestType });
113+
const text = createText({ type, entityName, requestType });
108114

109115
return (
110116
<Banner image={illustration} layout="vertical" title={""}>

coral/src/app/features/topics/details/schema/TopicDetailsSchema.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ describe("TopicDetailsSchema", () => {
306306

307307
it("shows information that there is a pending request", () => {
308308
const info = screen.getByText(
309-
`A schema request for ${testTopicName} is already in progress.`
309+
`You cannot request a schema at this time. A schema request for ${testTopicName} is already in progress.`
310310
);
311311

312312
expect(info).toBeVisible();
@@ -503,7 +503,7 @@ describe("TopicDetailsSchema", () => {
503503

504504
it("shows information that there is a pending request", () => {
505505
const info = screen.getByText(
506-
`A schema request for ${testTopicName} is already in progress.`
506+
`You cannot request a schema at this time. A schema request for ${testTopicName} is already in progress.`
507507
);
508508

509509
expect(info).toBeVisible();

coral/src/app/features/topics/details/schema/components/NoSchemaBanner.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ describe("NoSchemaBanner", () => {
165165

166166
it("shows information about pending request", () => {
167167
const text = screen.getByText(
168-
`A schema request for ${testTopicName} is already in progress.`
168+
`You cannot request a schema at this time. A schema request for ${testTopicName} is already in progress.`
169169
);
170170

171171
expect(text).toBeVisible();

coral/src/app/features/topics/details/schema/components/OpenSchemaRequestAlert.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe("OpenSchemaRequestAlert", () => {
1212

1313
it("shows information about pending request", () => {
1414
const text = screen.getByText(
15-
`A schema request for ${testTopicName} is already in progress.`
15+
`You cannot request a schema at this time. A schema request for ${testTopicName} is already in progress.`
1616
);
1717

1818
expect(text).toBeVisible();

0 commit comments

Comments
 (0)