Skip to content

Commit

Permalink
fix(RV-394): Update template redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
knguyenrise8 committed Dec 10, 2024
1 parent 87ee87f commit aaa9992
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 38 deletions.
36 changes: 16 additions & 20 deletions frontend/e2e/App.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,27 @@ test.describe("when templates exist", async () => {
const templates = [
{
name: "MumpsQuestV1",
lab: "Quest",
createdBy: "J.Smith",
status: "Completed",
lastUpdated: new Date(Date.parse("2025-03-24T12:00:00.000-05:00")),
facility: "Quest",
condition: 'Mumps',
createdOn: new Date(Date.parse("2025-03-24T12:00:00.000-05:00")),
},
{
name: "LBTIRadar",
lab: "Radar",
createdBy: "C.Alex",
status: "Completed",
lastUpdated: new Date(Date.parse("2025-05-30T12:00:00.000-05:00")),
condition: 'Covid',
facility: "LBTI",
createdOn: new Date(Date.parse("2025-05-30T12:00:00.000-05:00")),
},
{
name: "COVIDBaylor1",
lab: "Emory",
createdBy: "A.Bryant",
status: "Completed",
lastUpdated: new Date(Date.parse("2025-06-21T12:00:00.000-05:00")),
condition: 'Covid',
facility: "Baylor",
createdOn: new Date(Date.parse("2025-06-21T12:00:00.000-05:00")),
},
{
name: "COVIDEMory",
lab: "Baylor",
createdBy: "D.Smith",
status: "Completed",
lastUpdated: new Date(Date.parse("2024-06-21T12:00:00.000-05:00")),
condition: 'Covid',
facility: "Emory",
createdOn: new Date(Date.parse("2024-06-21T12:00:00.000-05:00")),
},
];
localStorage.setItem("templates", JSON.stringify(templates));
Expand All @@ -60,14 +56,14 @@ test.describe("when templates exist", async () => {
page.getByRole("heading", { name: "Saved Templates" }),
).toBeVisible();
await expect(page.locator("tbody").getByRole("row")).toHaveCount(4);
await page.getByText("Updated On").click();
await page.getByText("Created On").click();
await expect(
page.locator("tbody").locator("tr").nth(0).getByRole("cell").nth(1),
).toHaveText("6/21/2024");
await page.getByText("Updated On").click();
).toHaveText("Mumps");
await page.getByText("Created On").click();
await expect(
page.locator("tbody").locator("tr").nth(0).getByRole("cell").nth(1),
).toHaveText("6/21/2025");
).toHaveText("Covid");
await page.close();
});
test("has links to extraction", async ({ page, baseURL }) => {
Expand Down
25 changes: 7 additions & 18 deletions frontend/src/components/TemplatesIndex/TemplatesIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,13 @@ export const TemplatesIndex: FC<TemplateIndexProps> = () => {

const templateColumnNames = {
name: "Name",
labName: "Lab",
lab: "Lab",
createdBy: "Creator",
status: "Status",
updatedAt: "Updated On",
created: "Created On",
facility: "Facility",
condition: "Condition",
};

const templateColumnFormatters = {
updatedAt: (d) => {
const date = Date.parse(d);
if (isNaN(date)) {
return new Date().toLocaleDateString();
}
return new Date(date).toLocaleDateString();
},
lastUpdated: (d) => {
created: (d) => {
const date = Date.parse(d);
if (isNaN(date)) {
return new Date().toLocaleDateString();
Expand All @@ -77,11 +68,9 @@ export const TemplatesIndex: FC<TemplateIndexProps> = () => {

const templateColumns = [
"name",
"updatedAt",
"createdBy",
"lab",
"status",
"labName",
"condition",
"facility",
"created",
];

useEffect(() => {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/pages/SaveTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const SaveTemplate = () => {
name,
condition,
facility,
created: new Date().toLocaleDateString(),
pages: pages,
};

Expand Down

0 comments on commit aaa9992

Please sign in to comment.