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

Platform/13199/fhir function dynamic message routing #15273

Closed
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ If your e2e tests fail during the GitHub build. The following steps will help in

---

## Updating the TEST_*_USERNAME OKTA accounts
## Updating the TEST\_\*\_USERNAME OKTA accounts

1. Change the password in OKTA for the `TEST_*_USERNAME` user account(s).
2. Have DevOps update the [GitHub Action](https://github.com/CDCgov/prime-reportstream/settings/secrets/actions) `TEST_*_PASSWORD` secret(s) for the `TEST_*_USERNAME` user account(s).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ function DashboardFilterAndTable({
if (result) setActiveReceiver(result);
};

const {
data: results,
filterManager,
isLoading,
} = useReceiverDeliveries(activeReceiver.name);
const { data: results, filterManager, isLoading } = useReceiverDeliveries(activeReceiver.name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to figure this out, but your PR should not be touching any .tsx files. That is outside the scope of platform work.


if (isLoading || !results) return <Spinner />;

Expand All @@ -61,46 +57,35 @@ function DashboardFilterAndTable({
columnKey: DeliveriesAttr.CREATED_AT,
columnHeader: "Date sent to you",
content: formatDateWithoutSeconds(dataRow.createdAt),
columnCustomSort: () =>
onColumnCustomSort(DeliveriesAttr.CREATED_AT),
columnCustomSort: () => onColumnCustomSort(DeliveriesAttr.CREATED_AT),
columnCustomSortSettings: filterManager.sortSettings,
},
{
columnKey: DeliveriesAttr.ORDERING_PROVIDER,
columnHeader: "Ordering provider",
content: dataRow.orderingProvider,
columnCustomSort: () =>
onColumnCustomSort(DeliveriesAttr.ORDERING_PROVIDER),
columnCustomSort: () => onColumnCustomSort(DeliveriesAttr.ORDERING_PROVIDER),
columnCustomSortSettings: filterManager.sortSettings,
},
{
columnKey: DeliveriesAttr.ORDERING_FACILITY,
columnHeader: "Performing facility",
content: dataRow.orderingFacility,
columnCustomSort: () =>
onColumnCustomSort(DeliveriesAttr.ORDERING_FACILITY),
columnCustomSort: () => onColumnCustomSort(DeliveriesAttr.ORDERING_FACILITY),
columnCustomSortSettings: filterManager.sortSettings,
},
{
columnKey: DeliveriesAttr.SUBMITTER,
columnHeader: "Submitter",
content: dataRow.submitter,
columnCustomSort: () =>
onColumnCustomSort(DeliveriesAttr.SUBMITTER),
columnCustomSort: () => onColumnCustomSort(DeliveriesAttr.SUBMITTER),
columnCustomSortSettings: filterManager.sortSettings,
},
{
columnKey: DeliveriesAttr.REPORT_ID,
columnHeader: "Report ID",
content: (
<USLink
href={`/data-dashboard/report-details/${dataRow.reportId}`}
>
{dataRow.reportId}
</USLink>
),
columnCustomSort: () =>
onColumnCustomSort(DeliveriesAttr.REPORT_ID),
content: <USLink href={`/data-dashboard/report-details/${dataRow.reportId}`}>{dataRow.reportId}</USLink>,
columnCustomSort: () => onColumnCustomSort(DeliveriesAttr.REPORT_ID),
columnCustomSortSettings: filterManager.sortSettings,
},
]);
Expand All @@ -109,9 +94,7 @@ function DashboardFilterAndTable({

return (
<>
<div className="text-bold font-sans-md">
Showing all results ({results?.meta.totalFilteredCount})
</div>
<div className="text-bold font-sans-md">Showing all results ({results?.meta.totalFilteredCount})</div>
<div className="display-flex flex-row">
<ReceiverServices
receiverServices={receiverServices}
Expand All @@ -122,13 +105,7 @@ function DashboardFilterAndTable({
startDateLabel="From: (mm/dd/yyyy)"
endDateLabel="To: (mm/dd/yyyy)"
filterManager={filterManager}
onFilterClick={({
from,
to,
}: {
from: string;
to: string;
}) => {
onFilterClick={({ from, to }: { from: string; to: string }) => {
filterManager?.updatePage({
type: PageSettingsActionType.RESET,
});
Expand All @@ -148,9 +125,7 @@ function DashboardFilterAndTable({
currentPage={currentPageNum}
pathname=""
onClickPageNumber={(e) => {
const pageNumValue = parseInt(
(e.target as HTMLElement).innerText,
);
const pageNumValue = parseInt((e.target as HTMLElement).innerText);
filterManager.updatePage({
type: PageSettingsActionType.SET_PAGE,
payload: { page: pageNumValue },
Expand All @@ -176,8 +151,7 @@ function DashboardFilterAndTable({
}

export default function DataDashboardTable() {
const { isLoading, isDisabled, activeReceivers } =
useOrganizationReceivers();
const { isLoading, isDisabled, activeReceivers } = useOrganizationReceivers();
const [activeReceiver, setActiveReceiver] = useState(activeReceivers?.[0]);
if (isLoading) return <Spinner />;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import { SortSettingsActionType } from "../../../hooks/filters/UseSortOrder/UseS
import useAppInsightsContext from "../../../hooks/UseAppInsightsContext/UseAppInsightsContext";
import { Table } from "../../../shared";
import { EventName } from "../../../utils/AppInsights";
import {
transformFacilityTypeClass,
transformFacilityTypeLabel,
} from "../../../utils/DataDashboardUtils";
import { transformFacilityTypeClass, transformFacilityTypeLabel } from "../../../utils/DataDashboardUtils";
import { formatDateWithoutSeconds } from "../../../utils/DateTimeUtils";
import { FeatureName } from "../../../utils/FeatureName";
import AdminFetchAlert from "../../alerts/AdminFetchAlert";
Expand All @@ -40,11 +37,7 @@ function FacilitiesProvidersFilterAndTable({
if (result) setActiveReceiver(result);
};

const {
data: results,
filterManager,
isLoading,
} = useReceiverSubmitters(activeReceiver.name);
const { data: results, filterManager, isLoading } = useReceiverSubmitters(activeReceiver.name);

if (isLoading || !results) return <Spinner />;

Expand Down Expand Up @@ -84,24 +77,21 @@ function FacilitiesProvidersFilterAndTable({
) : (
""
),
columnCustomSort: () =>
onColumnCustomSort(DeliveriesAttr.FACILITY_TYPE),
columnCustomSort: () => onColumnCustomSort(DeliveriesAttr.FACILITY_TYPE),
columnCustomSortSettings: filterManager.sortSettings,
},
{
columnKey: DeliveriesAttr.TEST_RESULT_COUNT,
columnHeader: "Report count",
content: dataRow.testResultCount,
columnCustomSort: () =>
onColumnCustomSort(DeliveriesAttr.TEST_RESULT_COUNT),
columnCustomSort: () => onColumnCustomSort(DeliveriesAttr.TEST_RESULT_COUNT),
columnCustomSortSettings: filterManager.sortSettings,
},
{
columnKey: DeliveriesAttr.REPORT_DATE,
columnHeader: "Most recent report date",
content: formatDateWithoutSeconds(dataRow.firstReportDate),
columnCustomSort: () =>
onColumnCustomSort(DeliveriesAttr.REPORT_DATE),
columnCustomSort: () => onColumnCustomSort(DeliveriesAttr.REPORT_DATE),
columnCustomSortSettings: filterManager.sortSettings,
},
]);
Expand All @@ -111,9 +101,7 @@ function FacilitiesProvidersFilterAndTable({
return (
<div>
<section id="facilities-providers">
<div className="text-bold font-sans-md">
Showing all results ({results?.meta.totalFilteredCount})
</div>
<div className="text-bold font-sans-md">Showing all results ({results?.meta.totalFilteredCount})</div>
<div className="display-flex flex-row">
<ReceiverServices
receiverServices={receiverServices}
Expand All @@ -124,13 +112,7 @@ function FacilitiesProvidersFilterAndTable({
startDateLabel="From: (mm/dd/yyyy)"
endDateLabel="To: (mm/dd/yyyy)"
filterManager={filterManager}
onFilterClick={({
from,
to,
}: {
from: string;
to: string;
}) => {
onFilterClick={({ from, to }: { from: string; to: string }) => {
filterManager?.updatePage({
type: PageSettingsActionType.RESET,
});
Expand All @@ -153,9 +135,7 @@ function FacilitiesProvidersFilterAndTable({
currentPage={currentPageNum}
pathname=""
onClickPageNumber={(e) => {
const pageNumValue = parseInt(
(e.target as HTMLElement).innerText,
);
const pageNumValue = parseInt((e.target as HTMLElement).innerText);
filterManager.updatePage({
type: PageSettingsActionType.SET_PAGE,
payload: { page: pageNumValue },
Expand All @@ -182,8 +162,7 @@ function FacilitiesProvidersFilterAndTable({
}

export default function FacilitiesProvidersTable() {
const { isLoading, isDisabled, activeReceivers } =
useOrganizationReceivers();
const { isLoading, isDisabled, activeReceivers } = useOrganizationReceivers();
const [activeReceiver, setActiveReceiver] = useState(activeReceivers?.[0]);
if (isLoading) return <Spinner />;

Expand Down
73 changes: 17 additions & 56 deletions frontend-react/src/components/Table/Table.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ import TableFilters, { TableFilterDateLabel } from "./TableFilters";
import { DatasetAction } from "./TableInfo";
import { TableRowData, TableRows } from "./TableRows";
import { filterManagerFixture } from "../../hooks/filters/filters.fixtures";
import useCursorManager, {
CursorActionType,
} from "../../hooks/filters/UseCursorManager/UseCursorManager";
import useFilterManager, {
FilterManager,
} from "../../hooks/filters/UseFilterManager/UseFilterManager";
import useCursorManager, { CursorActionType } from "../../hooks/filters/UseCursorManager/UseCursorManager";
import useFilterManager, { FilterManager } from "../../hooks/filters/UseFilterManager/UseFilterManager";
import { SortSettingsActionType } from "../../hooks/filters/UseSortOrder/UseSortOrder";
import { renderApp } from "../../utils/CustomRenderUtils";
import { selectDatesFromRange } from "../../utils/TestUtils";
Expand Down Expand Up @@ -86,9 +82,7 @@ const makeConfigs = (sampleRow: TableRowData): ColumnConfig[] => {
return Object.keys(sampleRow).map((key) => {
return {
dataAttr: key,
columnHeader: `${key[0].toUpperCase()}${key
.slice(1)
.toLowerCase()}`,
columnHeader: `${key[0].toUpperCase()}${key.slice(1).toLowerCase()}`,
feature: getFeatureParams(key),
valueMap: key.includes("map") ? sampleMapper : undefined,
transform: key.includes("transform") ? transformFunc : undefined,
Expand Down Expand Up @@ -141,9 +135,7 @@ const SimpleTableWithAction = () => (
/>
);
const FilteredTable = () => {
return (
<Table config={getTestConfig(10)} filterManager={mockFilterManager} />
);
return <Table config={getTestConfig(10)} filterManager={mockFilterManager} />;
};

const testDataRowOne = {
Expand All @@ -166,20 +158,9 @@ const sampleCallback = () => void 0;

/* This component is specifically configured to help test the
* Table component. Any */
const TestTable = ({
editable,
linkable = true,
}: {
editable?: boolean;
linkable?: boolean;
}) => {
const TestTable = ({ editable, linkable = true }: { editable?: boolean; linkable?: boolean }) => {
const filterManager = useFilterManager();
const {
cursors,
hasNext,
hasPrev,
update: updateCursors,
} = useCursorManager(filterManager.rangeSettings.to);
const { cursors, hasNext, hasPrev, update: updateCursors } = useCursorManager(filterManager.rangeSettings.to);
const [_searchTerm, setSearchTerm] = useState("");
/* Ensure there's at least 1 more cursor in the cursorMap
* to test the Next/Prev buttons. In a real application
Expand Down Expand Up @@ -298,9 +279,7 @@ const TestTable = ({
hasPrev,
update: updateCursors,
}}
setSearchTerm={
handleSearchTerm as Dispatch<SetStateAction<string>>
}
setSearchTerm={handleSearchTerm as Dispatch<SetStateAction<string>>}
setService={() => undefined}
searchTerm={""}
/>
Expand Down Expand Up @@ -355,16 +334,12 @@ describe("Table, basic tests", () => {
test("Link columns are rendered as links", () => {
renderApp(<SimpleTable />);
const linkInCell = screen.getByText("UUID-1");
expect(linkInCell).toContainHTML(
'<a class="usa-link" href="/base/UUID-1">UUID-1</a>',
);
expect(linkInCell).toContainHTML('<a class="usa-link" href="/base/UUID-1">UUID-1</a>');
});

test("Action columns are rendered as actions", () => {
renderApp(<SimpleTableWithAction />);
expect(
screen.getByText("Test Simple Table With Action"),
).toBeInTheDocument();
expect(screen.getByText("Test Simple Table With Action")).toBeInTheDocument();
const actionButtonCell = screen.getAllByText("actionButtonParam")[0];
expect(actionButtonCell).toContainHTML("actionButtonParam</button>");
});
Expand Down Expand Up @@ -443,17 +418,14 @@ describe(
test("date range selection and clearing", async () => {
setup();
/* Workaround to assert changing state */
const defaultState =
"range: from 2000-01-01T00:00:00.000Z to 3000-01-01T00:00:00.000Z";
const defaultState = "range: from 2000-01-01T00:00:00.000Z to 3000-01-01T00:00:00.000Z";
expect(screen.getByText(/range:/)).toHaveTextContent(defaultState);

await selectDatesFromRange("20", "23");
await clickFilterButton();

/* Assert the value of state in string has changed */
expect(screen.getByText(/range:/)).not.toHaveTextContent(
defaultState,
);
expect(screen.getByText(/range:/)).not.toHaveTextContent(defaultState);

const clearButton = screen.getAllByText("Reset");
await userEvent.click(clearButton[0]);
Expand All @@ -462,20 +434,14 @@ describe(
test("cursor sets properly according to sort order", async () => {
setup();
const defaultCursor = "cursor: 3000-01-01T00:00:00.000Z";
expect(screen.getByText(/cursor:/)).toHaveTextContent(
defaultCursor,
);
expect(screen.getByText(/cursor:/)).toHaveTextContent(defaultCursor);

await selectDatesFromRange("10", "20");
await clickFilterButton();

expect(screen.getByText(/cursor:/)).not.toHaveTextContent(
defaultCursor,
);
expect(screen.getByText(/cursor:/)).not.toHaveTextContent(defaultCursor);
// Checking for inclusive date
expect(screen.getByText(/cursor:/)).toHaveTextContent(
/2024-03-20T23:59:00.000Z/,
);
expect(screen.getByText(/cursor:/)).toHaveTextContent(/2024-03-20T23:59:00.000Z/);

// Change sort order and repeat
await userEvent.click(screen.getByText("Column Two"));
Expand Down Expand Up @@ -636,8 +602,7 @@ describe("TableRows", () => {

// update value
// this assumes that an input is being rendered by `ColumnData`
const firstInput =
screen.getByLabelText<HTMLInputElement>("editableColumn-0");
const firstInput = screen.getByLabelText<HTMLInputElement>("editableColumn-0");
const initialValue = firstInput.value;
await userEvent.click(firstInput);
await userEvent.keyboard("fakeItem");
Expand Down Expand Up @@ -679,18 +644,14 @@ describe("ColumnData", () => {
);

// update value
const firstInput =
screen.getByLabelText<HTMLInputElement>("editableColumn-0");
const firstInput = screen.getByLabelText<HTMLInputElement>("editableColumn-0");
const initialValue = firstInput.value;
await userEvent.click(firstInput);
await userEvent.keyboard("fakeItem");

// once for each character
expect(fakeUpdate).toHaveBeenCalledTimes(8);
expect(fakeUpdate).toHaveBeenLastCalledWith(
`${initialValue}fakeItem`,
"editableColumn",
);
expect(fakeUpdate).toHaveBeenLastCalledWith(`${initialValue}fakeItem`, "editableColumn");
});
});

Expand Down
Loading
Loading