Skip to content

Commit

Permalink
Merge branch 'develop' into ImprovingVitalsMonitor#6549
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamprakash123 authored Nov 10, 2023
2 parents 12d7bfc + 9f36488 commit d1a40b9
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 94 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/shifting_spec/filter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("Shifting section filter", () => {
shiftingPage.filterByFacility(
"Dummy Shifting",
"Dummy Shifting",
"District Admin"
"District"
);

shiftingPage.facilityAssignedBadge().should("exist");
Expand Down
11 changes: 11 additions & 0 deletions cypress/e2e/users_spec/user_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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";
Expand All @@ -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);
});

Expand Down
2 changes: 2 additions & 0 deletions cypress/pageobject/Users/ManageUserPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 6 additions & 12 deletions src/Components/Facility/CentralNursingStation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,28 +168,22 @@ export default function CentralNursingStation({ facilityId }: Props) {
<FieldLabel className="text-sm">
Filter by Location
</FieldLabel>
<div className="flex w-full items-center gap-2">
<div>
<LocationSelect
key={qParams.location}
name="Facilities"
setSelected={(location) => updateQuery({ location })}
setSelected={(location) => {
location
? updateQuery({ location })
: removeFilter("location");
}}
selected={qParams.location}
showAll={false}
multiple={false}
facilityId={facilityId}
errors=""
errorClassName="hidden"
/>
{qParams.location && (
<ButtonV2
variant="secondary"
circle
border
onClick={() => removeFilter("location")}
>
Clear
</ButtonV2>
)}
</div>
</div>
<SelectFormField
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Facility/FacilityCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export const FacilityCard = (props: { facility: any; userType: any }) => {
: "button-primary-border bg-primary-100"
}`}
>
<span className="tooltip-text tooltip-bottom md:tooltip-right -translate-y-2">
<span className="tooltip-text tooltip-top">
Live Patients / Total beds
</span>{" "}
<CareIcon
Expand Down
85 changes: 6 additions & 79 deletions src/Components/Facility/LiveFeedScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,55 +14,18 @@ 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";
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<any>();
const [isFullscreen, setFullscreen] = useFullscreen();
const sidebar = useContext(SidebarShrinkContext);
Expand All @@ -73,7 +36,6 @@ export default function LiveFeedScreen({ facilityId }: Props) {
const { qParams, updateQuery, removeFilter, updatePage } = useFilters({
limit: PER_PAGE_LIMIT,
});
const [ordering, setOrdering] = useState<string>("bed__name");

const [refresh_presets_hash, setRefreshPresetsHash] = useState<number>(
Number(new Date())
Expand All @@ -88,10 +50,6 @@ export default function LiveFeedScreen({ facilityId }: Props) {
};
}, []);

useEffect(() => {
getOrderingList(facilityId, setOrdering);
}, [facilityId]);

useEffect(() => {
async function fetchFacilityOrObject() {
if (facility) return facility;
Expand All @@ -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,
};

Expand Down Expand Up @@ -180,54 +137,24 @@ export default function LiveFeedScreen({ facilityId }: Props) {
<FieldLabel className="text-sm">
Filter by Location
</FieldLabel>
<div className="flex w-full items-center gap-2">
<div>
<LocationSelect
key={qParams.location}
name="Facilities"
setSelected={(location) => updateQuery({ location })}
setSelected={(location) => {
location
? updateQuery({ location })
: removeFilter("location");
}}
selected={qParams.location}
showAll={false}
multiple={false}
facilityId={facilityId}
errors=""
errorClassName="hidden"
/>
{qParams.location && (
<ButtonV2
variant="secondary"
circle
border
onClick={() => removeFilter("location")}
>
Clear
</ButtonV2>
)}
</div>
</div>
<SelectFormField
name="ordering"
label={t("sort_by")}
required
value={qParams.ordering || ordering}
onChange={({ value }) => {
updateQuery({ ordering: value });
setOrderingList(facilityId, value);
}}
options={SORT_OPTIONS}
optionLabel={({ value }) => t("SortOptions." + value)}
optionIcon={({ isAscending }) => (
<CareIcon
className={
isAscending
? "care-l-sort-amount-up"
: "care-l-sort-amount-down"
}
/>
)}
optionValue={({ value }) => value}
labelClassName="text-sm"
errorClassName="hidden"
/>
<CheckBoxFormField
name="bed_is_occupied"
label="Hide Cameras without Patient"
Expand Down

0 comments on commit d1a40b9

Please sign in to comment.