From e868d43ffd5b2afb149c5fb3201f396afffcf5b4 Mon Sep 17 00:00:00 2001 From: etanb Date: Fri, 2 Aug 2024 13:09:21 -0400 Subject: [PATCH] title casing + receiver ID fix --- .../spec/all/last-mile-failures-page.spec.ts | 46 ++----- .../Admin/AdminLastMileFailuresTable.tsx | 128 ++++-------------- .../api/UseCreateResend/UseCreateResend.ts | 2 +- .../src/pages/admin/AdminLastMileFailures.tsx | 7 +- 4 files changed, 44 insertions(+), 139 deletions(-) diff --git a/frontend-react/e2e/spec/all/last-mile-failures-page.spec.ts b/frontend-react/e2e/spec/all/last-mile-failures-page.spec.ts index 17f74554ebb..8af5e5b64af 100644 --- a/frontend-react/e2e/spec/all/last-mile-failures-page.spec.ts +++ b/frontend-react/e2e/spec/all/last-mile-failures-page.spec.ts @@ -22,7 +22,7 @@ test.describe("Last Mile Failure page", () => { }); test("has correct title", async ({ page }) => { - await expect(page).toHaveTitle(/Last mile failures/); + await expect(page).toHaveTitle(/Last Mile Failures/); }); test("has footer", async ({ page }) => { @@ -30,45 +30,27 @@ test.describe("Last Mile Failure page", () => { }); test("table has correct headers", async ({ page }) => { - await expect(page.locator(".column-header-text").nth(0)).toHaveText( - /Failed At/, - ); - await expect(page.locator(".column-header-text").nth(1)).toHaveText( - /ReportId/, - ); - await expect(page.locator(".column-header-text").nth(2)).toHaveText( - /Receiver/, - ); + await expect(page.locator(".column-header-text").nth(0)).toHaveText(/Failed At/); + await expect(page.locator(".column-header-text").nth(1)).toHaveText(/ReportId/); + await expect(page.locator(".column-header-text").nth(2)).toHaveText(/Receiver/); }); test("table column 'Failed At' has expected data", async ({ page }) => { - await expect( - tableRows(page).nth(0).locator("td").nth(0), - ).toHaveText("Tue, 2/20/2024, 9:35 PM"); + await expect(tableRows(page).nth(0).locator("td").nth(0)).toHaveText("Tue, 2/20/2024, 9:35 PM"); }); - test("table column 'ReportId' will open a modal with report details", async ({ - page, - }) => { + test("table column 'ReportId' will open a modal with report details", async ({ page }) => { const reportId = tableRows(page).nth(0).locator("td").nth(1); - await expect(reportId).toContainText( - /e5ce49c0-b230-4364-8230-964273249fa1/, - ); + await expect(reportId).toContainText(/e5ce49c0-b230-4364-8230-964273249fa1/); await reportId.click(); const modal = page.getByTestId("modalWindow").nth(0); - await expect(modal).toContainText( - /Report ID:e5ce49c0-b230-4364-8230-964273249fa1/, - ); + await expect(modal).toContainText(/Report ID:e5ce49c0-b230-4364-8230-964273249fa1/); }); - test("table column 'Receiver' will open receiver edit page", async ({ - page, - }) => { + test("table column 'Receiver' will open receiver edit page", async ({ page }) => { const receiver = tableRows(page).nth(0).locator("td").nth(2); - await expect(receiver).toContainText( - /flexion.etor-service-receiver-results/, - ); + await expect(receiver).toContainText(/flexion.etor-service-receiver-results/); await receiver.click(); await expect(page).toHaveURL( @@ -86,16 +68,12 @@ test.describe("Last Mile Failure page", () => { }); test("has correct title", async ({ page }) => { - await expect(page).toHaveTitle(/Last mile failures/); + await expect(page).toHaveTitle(/Last Mile Failures/); }); test("has alert", async ({ page }) => { await expect(page.getByTestId("alert")).toBeAttached(); - await expect( - page.getByText( - /Our apologies, there was an error loading this content./, - ), - ).toBeAttached(); + await expect(page.getByText(/Our apologies, there was an error loading this content./)).toBeAttached(); }); test("has footer", async ({ page }) => { diff --git a/frontend-react/src/components/Admin/AdminLastMileFailuresTable.tsx b/frontend-react/src/components/Admin/AdminLastMileFailuresTable.tsx index 1b73c04d285..5b332227990 100644 --- a/frontend-react/src/components/Admin/AdminLastMileFailuresTable.tsx +++ b/frontend-react/src/components/Admin/AdminLastMileFailuresTable.tsx @@ -11,21 +11,12 @@ import { TextInput, } from "@trussworks/react-uswds"; import DOMPurify from "dompurify"; -import { - PropsWithChildren, - Suspense, - useCallback, - useEffect, - useRef, - useState, -} from "react"; +import { PropsWithChildren, Suspense, useCallback, useEffect, useRef, useState } from "react"; import { showToast } from "../../contexts/Toast"; import useCreateResend from "../../hooks/api/UseCreateResend/UseCreateResend"; import useResends, { RSResend } from "../../hooks/api/UseResends/UseResends"; -import useSendFailures, { - RSSendFailure, -} from "../../hooks/api/UseSendFailures/UseSendFailures"; +import useSendFailures, { RSSendFailure } from "../../hooks/api/UseSendFailures/UseSendFailures"; import Table from "../../shared/Table/Table"; import { filterMatch as resendFilterMatch } from "../../utils/filters/resendFilters"; import { filterMatch as sendFailureFilterMatch } from "../../utils/filters/sendFailuresFilters"; @@ -42,12 +33,8 @@ interface DataForDialog { const DRow = (props: PropsWithChildren<{ label: string }>) => { return ( - - {props.label}: - - - {props.children} - + {props.label}: + {props.children} ); }; @@ -62,16 +49,12 @@ const RenderInfoModal = (props: { infoDataJson: string }) => { return ( - - Info Details: {infoData.actionId} - + Info Details: {infoData.actionId} {infoData.receiver} {formatDate(infoData.failedAt)} {infoData.actionId} {infoData.reportId} - - {infoData.reportFileReceiver} - + {infoData.reportFileReceiver} {infoData.bodyUrl}
@@ -82,14 +65,10 @@ const RenderInfoModal = (props: { infoDataJson: string }) => { {/*from existin data so show them all*/} {retryDataArray.map((retryData) => ( <> - + Resend Details: {retryData.actionId} - - {formatDate(retryData.createdAt)} - + {formatDate(retryData.createdAt)} {retryData.username} {retryData.actionResult} @@ -111,8 +90,8 @@ const RenderResendModal = (props: {

You are about to trigger a retransmission.
- Copy the information below into a github issue to coordinate - fixing. (This is only until tracking is in place in the server.) + Copy the information below into a github issue to coordinate fixing. (This is only until tracking is in + place in the server.)

- - @@ -168,9 +139,7 @@ const DataLoadRenderTable = ({ handleShowDetailsClick: (jsonRowData: string) => void; }) => { const fiterResends = (reportId: string) => { - return lastMileResends.filter((each) => - resendFilterMatch(each, reportId), - ); + return lastMileResends.filter((each) => resendFilterMatch(each, reportId)); }; const rowData = lastMileData @@ -203,21 +172,12 @@ const DataLoadRenderTable = ({ className={"font-mono-xs"} title={"Show Info"} key={`details_${eachRow.actionId}`} - onClick={() => - handleShowDetailsClick( - JSON.stringify(dataForDialog, null, 4), - ) - } + onClick={() => handleShowDetailsClick(JSON.stringify(dataForDialog, null, 4))} > {eachRow.reportId} - { - - } + {} - + {resends.length > 0 && ( )} @@ -240,11 +200,7 @@ const DataLoadRenderTable = ({