From c67ced2d6c2b20803652547a21dbc6a0c59b638c Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Fri, 10 Nov 2023 12:28:31 +0530 Subject: [PATCH 1/6] quick patch: hide not working sort filter (#6577) --- src/Components/Facility/LiveFeedScreen.tsx | 67 ---------------------- 1 file changed, 67 deletions(-) diff --git a/src/Components/Facility/LiveFeedScreen.tsx b/src/Components/Facility/LiveFeedScreen.tsx index b9a2eabdc03..a47d4a0c955 100644 --- a/src/Components/Facility/LiveFeedScreen.tsx +++ b/src/Components/Facility/LiveFeedScreen.tsx @@ -14,9 +14,6 @@ import { AssetData } from "../Assets/AssetTypes"; import { Popover, Transition } from "@headlessui/react"; import { FieldLabel } from "../Form/FormFields/FormField"; import CheckBoxFormField from "../Form/FormFields/CheckBoxFormField"; -import { useTranslation } from "react-i18next"; -import { SortOption } from "../Common/SortDropdown"; -import { SelectFormField } from "../Form/FormFields/SelectFormField"; import LiveFeedTile from "./LiveFeedTile"; import { getCameraConfig } from "../../Utils/transformUtils"; import { getPermittedFacility, listAssets } from "../../Redux/actions"; @@ -24,45 +21,11 @@ import { useDispatch } from "react-redux"; const PER_PAGE_LIMIT = 6; -const SORT_OPTIONS: SortOption[] = [ - { isAscending: true, value: "bed__name" }, - { isAscending: false, value: "-bed__name" }, - { isAscending: false, value: "-created_date" }, - { isAscending: true, value: "created_date" }, -]; - interface Props { facilityId: string; } -const getOrderingList = async ( - facilityId: string, - setOrdering: (order: string) => void -) => { - const orderData = localStorage.getItem("live-feed-order"); - if (orderData) { - const order = JSON.parse(orderData); - const orderValue = order.find((item: any) => item.facility === facilityId); - setOrdering(orderValue.order); - } -}; - -const setOrderingList = async (facilityId: string, order: string) => { - const orderData = localStorage.getItem("live-feed-order") || "[]"; - const orderList = JSON.parse(orderData); - const index = orderList.findIndex( - (item: any) => item.facility === facilityId - ); - if (index !== -1) { - orderList[index].order = order; - } else { - orderList.push({ facility: facilityId, order }); - } - localStorage.setItem("live-feed-order", JSON.stringify(orderList)); -}; - export default function LiveFeedScreen({ facilityId }: Props) { - const { t } = useTranslation(); const dispatch = useDispatch(); const [isFullscreen, setFullscreen] = useFullscreen(); const sidebar = useContext(SidebarShrinkContext); @@ -73,7 +36,6 @@ export default function LiveFeedScreen({ facilityId }: Props) { const { qParams, updateQuery, removeFilter, updatePage } = useFilters({ limit: PER_PAGE_LIMIT, }); - const [ordering, setOrdering] = useState("bed__name"); const [refresh_presets_hash, setRefreshPresetsHash] = useState( Number(new Date()) @@ -88,10 +50,6 @@ export default function LiveFeedScreen({ facilityId }: Props) { }; }, []); - useEffect(() => { - getOrderingList(facilityId, setOrdering); - }, [facilityId]); - useEffect(() => { async function fetchFacilityOrObject() { if (facility) return facility; @@ -112,7 +70,6 @@ export default function LiveFeedScreen({ facilityId }: Props) { asset_class: "ONVIF", facility: facilityId || "", location: qParams.location, - ordering: qParams.ordering || ordering, bed_is_occupied: qParams.bed_is_occupied, }; @@ -204,30 +161,6 @@ export default function LiveFeedScreen({ facilityId }: Props) { )} - { - updateQuery({ ordering: value }); - setOrderingList(facilityId, value); - }} - options={SORT_OPTIONS} - optionLabel={({ value }) => t("SortOptions." + value)} - optionIcon={({ isAscending }) => ( - - )} - optionValue={({ value }) => value} - labelClassName="text-sm" - errorClassName="hidden" - /> Date: Fri, 10 Nov 2023 14:37:53 +0530 Subject: [PATCH 2/6] Fix clear button for CNS location filter (#6581) * Fix clear button for CNS location filter * Fixes * tooltip --- .../Facility/CentralNursingStation.tsx | 18 ++++++------------ src/Components/Facility/FacilityCard.tsx | 2 +- src/Components/Facility/LiveFeedScreen.tsx | 18 ++++++------------ 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/Components/Facility/CentralNursingStation.tsx b/src/Components/Facility/CentralNursingStation.tsx index 26bed83635b..0eae504399c 100644 --- a/src/Components/Facility/CentralNursingStation.tsx +++ b/src/Components/Facility/CentralNursingStation.tsx @@ -168,11 +168,15 @@ export default function CentralNursingStation({ facilityId }: Props) { Filter by Location -
+
updateQuery({ location })} + setSelected={(location) => { + location + ? updateQuery({ location }) + : removeFilter("location"); + }} selected={qParams.location} showAll={false} multiple={false} @@ -180,16 +184,6 @@ export default function CentralNursingStation({ facilityId }: Props) { errors="" errorClassName="hidden" /> - {qParams.location && ( - removeFilter("location")} - > - Clear - - )}
{ : "button-primary-border bg-primary-100" }`} > - + Live Patients / Total beds {" "} Filter by Location -
+
updateQuery({ location })} + setSelected={(location) => { + location + ? updateQuery({ location }) + : removeFilter("location"); + }} selected={qParams.location} showAll={false} multiple={false} @@ -149,16 +153,6 @@ export default function LiveFeedScreen({ facilityId }: Props) { errors="" errorClassName="hidden" /> - {qParams.location && ( - removeFilter("location")} - > - Clear - - )}
Date: Fri, 10 Nov 2023 16:06:07 +0530 Subject: [PATCH 3/6] Fixed Flaky Cypress Test in the User_Manage File (#6583) * flaky-test-in-usertab * trying out another solution * trying slow approach * revert vite config --- cypress/e2e/shifting_spec/filter.cy.ts | 2 +- cypress/e2e/users_spec/user_manage.cy.ts | 11 +++++++++++ cypress/pageobject/Users/ManageUserPage.ts | 2 ++ package.json | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/shifting_spec/filter.cy.ts b/cypress/e2e/shifting_spec/filter.cy.ts index f1068f7c53a..3790198a4db 100644 --- a/cypress/e2e/shifting_spec/filter.cy.ts +++ b/cypress/e2e/shifting_spec/filter.cy.ts @@ -19,7 +19,7 @@ describe("Shifting section filter", () => { shiftingPage.filterByFacility( "Dummy Shifting", "Dummy Shifting", - "District Admin" + "District" ); shiftingPage.facilityAssignedBadge().should("exist"); diff --git a/cypress/e2e/users_spec/user_manage.cy.ts b/cypress/e2e/users_spec/user_manage.cy.ts index db865dc8126..9fe3aea75f9 100644 --- a/cypress/e2e/users_spec/user_manage.cy.ts +++ b/cypress/e2e/users_spec/user_manage.cy.ts @@ -2,6 +2,7 @@ import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress"; import LoginPage from "../../pageobject/Login/LoginPage"; import { UserPage } from "../../pageobject/Users/UserSearch"; import ManageUserPage from "../../pageobject/Users/ManageUserPage"; +import { UserCreationPage } from "../../pageobject/Users/UserCreation"; describe("Manage User", () => { const loginPage = new LoginPage(); @@ -11,6 +12,7 @@ describe("Manage User", () => { const usernametolinkfacilitydoc2 = "dummydoctor5"; const usernametolinkfacilitydoc3 = "dummydoctor6"; const usernametolinkskill = "devdoctor"; + const userCreationPage = new UserCreationPage(); const usernameforworkinghour = "devdistrictadmin"; const usernamerealname = "Dummy Doctor"; const facilitytolinkusername = "Dummy Shifting Center"; @@ -37,7 +39,16 @@ describe("Manage User", () => { manageUserPage.selectFacilityFromDropdown(linkedskill); manageUserPage.clickAddSkillButton(); manageUserPage.clickCloseSlideOver(); + cy.wait(5000); + manageUserPage.clicklinkedskillbutton(); + manageUserPage.assertSkillInAddedUserSkills(linkedskill); + manageUserPage.clickCloseSlideOver(); + cy.wait(5000); manageUserPage.navigateToProfile(); + userCreationPage.verifyElementContainsText( + "username-profile-details", + usernameforworkinghour + ); manageUserPage.assertSkillInAlreadyLinkedSkills(linkedskill); }); diff --git a/cypress/pageobject/Users/ManageUserPage.ts b/cypress/pageobject/Users/ManageUserPage.ts index 1b340c875ee..b79b96447f0 100644 --- a/cypress/pageobject/Users/ManageUserPage.ts +++ b/cypress/pageobject/Users/ManageUserPage.ts @@ -73,7 +73,9 @@ export class ManageUserPage { } navigateToProfile() { + cy.intercept("GET", "**/api/v1/users/**").as("getUsers"); cy.get("#profilenamelink").click(); + cy.wait("@getUsers").its("response.statusCode").should("eq", 200); } verifyWorkingHours(expectedHours: string) { diff --git a/package.json b/package.json index 1ec0e88f48f..ca3f6920a12 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "@typescript-eslint/parser": "^5.61.0", "@vitejs/plugin-react-swc": "^3.3.2", "autoprefixer": "^10.4.14", - "cypress": "^13.1.0", + "cypress": "^13.5.0", "cypress-localstorage-commands": "^2.2.3", "eslint": "^8.44.0", "eslint-config-prettier": "^8.8.0", From 5b9c61848ddc8b729802e9099fd4ccfa5ad5ea2f Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Fri, 10 Nov 2023 20:35:44 +0530 Subject: [PATCH 4/6] refresh administrations upon archive (#6586) --- .../AdministrationEventCell.tsx | 3 ++ .../AdministrationTableRow.tsx | 36 ++++++++++--------- .../Medicine/PrescrpitionTimeline.tsx | 7 +++- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx index 9869b677cd2..1bcfc24a80a 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx @@ -11,12 +11,14 @@ interface Props { administrations: MedicineAdministrationRecord[]; interval: { start: Date; end: Date }; prescription: Prescription; + refetch: () => void; } export default function AdministrationEventCell({ administrations, interval: { start, end }, prescription, + refetch, }: Props) { const [showTimeline, setShowTimeline] = useState(false); // Check if cell belongs to an administered prescription @@ -55,6 +57,7 @@ export default function AdministrationEventCell({ interval={{ start, end }} prescription={prescription} showPrescriptionDetails + onRefetch={refetch} />