← Back to team overview

sts-sponsors team mailing list archive

[Merge] ~petermakowski/maas-site-manager:update-regions-alert-message into maas-site-manager:main

 

Peter Makowski has proposed merging ~petermakowski/maas-site-manager:update-regions-alert-message into maas-site-manager:main.

Commit message:
feat: update regions alert message

Requested reviews:
  MAAS Committers (maas-committers)

For more details, see:
https://code.launchpad.net/~petermakowski/maas-site-manager/+git/site-manager/+merge/440155
-- 
Your team MAAS Committers is requested to review the proposed merge of ~petermakowski/maas-site-manager:update-regions-alert-message into maas-site-manager:main.
diff --git a/frontend/src/components/EnrollmentActions/EnrollmentNotification/EnrollmentNotification.tsx b/frontend/src/components/EnrollmentActions/EnrollmentNotification/EnrollmentNotification.tsx
index afe4489..c9c3c48 100644
--- a/frontend/src/components/EnrollmentActions/EnrollmentNotification/EnrollmentNotification.tsx
+++ b/frontend/src/components/EnrollmentActions/EnrollmentNotification/EnrollmentNotification.tsx
@@ -1,9 +1,10 @@
 import { Notification } from "@canonical/react-components";
+import pluralize from "pluralize";
 import { useNavigate } from "react-router-dom";
 
 import type { PostEnrollmentRequestsData } from "@/api/handlers";
 
-const EnrollmentNotification = ({ accept }: Partial<PostEnrollmentRequestsData>) => {
+const EnrollmentNotification = ({ accept, ids }: Partial<PostEnrollmentRequestsData>) => {
   const navigate = useNavigate();
   return (
     <Notification
@@ -12,8 +13,8 @@ const EnrollmentNotification = ({ accept }: Partial<PostEnrollmentRequestsData>)
       severity="information"
       title={accept ? "Accepted" : "Denied"}
     >
-      {accept ? "Accepted" : "Denied"} enrolment request for maas-example-region. See more data of this region in the
-      Regions page.
+      {accept ? "Accepted" : "Denied"} enrolment request for {pluralize("MAAS regions", ids?.length, true)}. See more
+      data of this region in the Regions page.
     </Notification>
   );
 };
diff --git a/frontend/tests/requests.spec.ts b/frontend/tests/requests.spec.ts
index 9b59012..ec0163c 100644
--- a/frontend/tests/requests.spec.ts
+++ b/frontend/tests/requests.spec.ts
@@ -8,6 +8,7 @@ test("goes to the regions page if the user clicks on the regions link", async ({
   await expect(page.getByRole("heading", { name: /regions/i })).toBeHidden();
   await page.getByRole("checkbox", { name: "select all" }).click({ force: true });
   await page.getByRole("button", { name: /Accept/i }).click();
+  await expect(page.getByRole("alert").getByText(/Accepted enrolment request for [0-9]+ MAAS regions/i)).toBeVisible();
   await page.getByRole("button", { name: /Go to Regions/i }).click();
   await expect(page.getByRole("heading", { name: /regions/i })).toBeVisible();
 });

Follow ups