Skip to content

Commit

Permalink
Merge branch 'develop' into fix#7169
Browse files Browse the repository at this point in the history
  • Loading branch information
konavivekramakrishna authored Mar 4, 2024
2 parents ac1090c + de5d7ce commit 2cf4d0b
Show file tree
Hide file tree
Showing 53 changed files with 1,066 additions and 947 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/thank-you.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/[email protected]
with:
script: |
const thankyouNote = 'We truly appreciate your efforts. Thank you for taking the time to contribute; this is a very valuable contribution to us :1st_place_medal:. We always welcome your contribution :slightly_smiling_face:, so feel free to contribute to anything anytime, and never lose that spirit of innovation :raised_hands:.'
const thankyouNote = 'Your efforts have helped advance digital healthcare and TeleICU systems. :rocket: Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! :raised_hands:'
const options = {
issue_number: context.issue.number,
owner: context.repo.owner,
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Corona Safe
Copyright (c) 2024 Open Healthcare Network

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
32 changes: 32 additions & 0 deletions cypress/e2e/auth_spec/redirect.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { cy, describe, it, beforeEach, Cypress } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";

describe("redirect", () => {
const loginPage = new LoginPage();

beforeEach(() => {
cy.log("Logging in the user devdistrictadmin");
});

it("Check if login redirects to the right url", () => {
cy.awaitUrl("/resource/board", true);
loginPage.loginManuallyAsDistrictAdmin();
loginPage.ensureLoggedIn();
cy.url().should("include", "/resource/board");
});

it("Check if the redirect param works", () => {
const baseUrl = Cypress.config("baseUrl");
cy.awaitUrl(`login?redirect=${baseUrl}/resource/board`, true);
loginPage.loginManuallyAsDistrictAdmin();
loginPage.ensureLoggedIn();
cy.url().should("include", "/resource/board");
});

it("Check to ensure that redirect is the same origin", () => {
cy.awaitUrl("login?redirect=https://google.com", true);
loginPage.loginManuallyAsDistrictAdmin();
loginPage.ensureLoggedIn();
cy.url().should("include", "/facility");
});
});
11 changes: 11 additions & 0 deletions cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,30 @@ describe("Facility Creation", () => {
facilityPage.fillExpectedDTypeCylinderRequirement(oxygenExpected);
facilityPage.selectLocation("Kochi, Kerala");
facilityPage.submitForm();
cy.closeNotification();
// create multiple bed capacity and verify card reflection
facilityPage.selectBedType("Oxygen beds");
facilityPage.fillTotalCapacity(bedCapacity);
facilityPage.fillCurrentlyOccupied(bedOccupancy);
facilityPage.clickbedcapcityaddmore();
cy.closeNotification();
facilityPage.selectBedType("Ordinary Bed");
facilityPage.fillTotalCapacity(bedCapacity);
facilityPage.fillCurrentlyOccupied(bedOccupancy);
facilityPage.clickbedcapcityaddmore();
cy.closeNotification();
facilityPage.getTotalBedCapacity().contains(totalCapacity);
facilityPage.getTotalBedCapacity().contains(totalOccupancy);
facilityPage.clickcancelbutton();
// create multiple bed capacity and verify card reflection
facilityPage.selectAreaOfSpecialization("General Medicine");
facilityPage.fillDoctorCount(doctorCapacity);
facilityPage.clickdoctorcapacityaddmore();
cy.closeNotification();
facilityPage.selectAreaOfSpecialization("Pulmonology");
facilityPage.fillDoctorCount(doctorCapacity);
facilityPage.clickdoctorcapacityaddmore();
cy.closeNotification();
facilityPage.getTotalDoctorCapacity().contains(doctorCapacity);
facilityPage.clickcancelbutton();
facilityPage.verifyfacilitynewurl();
Expand Down Expand Up @@ -186,6 +191,12 @@ describe("Facility Creation", () => {
facilityPage.getFacilityTotalBedCapacity().contains(totalOccupancy);
facilityPage.getFacilityTotalDoctorCapacity().scrollIntoView();
facilityPage.getFacilityTotalDoctorCapacity().contains(totalDoctor);
// verify the delete functionality
cy.get("#manage-facility-dropdown button").scrollIntoView();
facilityPage.clickManageFacilityDropdown();
facilityPage.clickDeleteFacilityOption();
facilityPage.confirmDeleteFacility();
cy.verifyNotification("Facility deleted successfully");
});

it("Create a new facility with single bed and doctor capacity", () => {
Expand Down
5 changes: 5 additions & 0 deletions cypress/e2e/facility_spec/facility_homepage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ describe("Facility Homepage Function", () => {

it("Verify the Facility card button redirection", () => {
// view cns button
manageUserPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
manageUserPage.assertFacilityInCard(facilityName);
facilityHome.clickViewCnsButton();
facilityHome.verifyCnsUrl();
facilityHome.navigateBack();
Expand Down Expand Up @@ -121,6 +124,8 @@ describe("Facility Homepage Function", () => {
facilityPage.selectLocalBody(localBody);
userPage.applyFilter();
// go to cns page in the facility details page
manageUserPage.typeFacilitySearch(facilityName);
facilityPage.verifyFacilityBadgeContent(facilityName);
manageUserPage.assertFacilityInCard(facilityName);
facilityHome.clickViewFacilityDetails();
facilityHome.clickFacilityCnsButton();
Expand Down
9 changes: 0 additions & 9 deletions cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,6 @@ describe("Facility Manage Functions", () => {
);
});

it("Delete a existing facility and verify the error message", () => {
facilityPage.clickManageFacilityDropdown();
facilityPage.clickDeleteFacilityOption();
facilityPage.confirmDeleteFacility();
facilityManage.verifySuccessMessageVisibilityAndContent(
"You do not have permission to perform this action."
);
});

afterEach(() => {
cy.saveLocalStorage();
});
Expand Down
4 changes: 1 addition & 3 deletions cypress/pageobject/Facility/FacilityCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,7 @@ class FacilityPage {
}

confirmDeleteFacility() {
cy.intercept("DELETE", "**/api/v1/facility/**").as("deleteFacility");
cy.get("#submit").contains("Delete").click();
cy.wait("@deleteFacility").its("response.statusCode").should("eq", 403);
cy.submitButton("Delete");
}

selectLocation(location: string) {
Expand Down
14 changes: 14 additions & 0 deletions cypress/pageobject/Login/LoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,23 @@ class LoginPage {
cy.loginByApi("devdoctor", "Coronasafe@123");
}

loginAsStaff(): void {
cy.loginByApi("staffdev", "Coronasafe@123");
}

loginManuallyAsDistrictAdmin(): void {
cy.get("input[id='username']").type("devdistrictadmin");
cy.get("input[id='password']").type("Coronasafe@123");
cy.get("button").contains("Login").click();
}

login(username: string, password: string): void {
cy.loginByApi(username, password);
}

ensureLoggedIn(): void {
cy.get("p").contains("Sign Out").should("exist");
}
}

export default LoginPage;
10 changes: 5 additions & 5 deletions src/CAREUI/interactive/LegendInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CareIcon from "../icons/CareIcon";
import { classNames } from "../../Utils/utils";
import { RefObject, useRef, useState, useEffect } from "react";

import { useTranslation } from "react-i18next";
type InputProps = {
id?: string;
name: string;
Expand All @@ -19,7 +19,7 @@ type InputProps = {
onKeyDown?: (e: any) => void;
onKeyPress?: (e: any) => void;
disabled?: boolean;
error?: boolean;
error?: string;
className?: string;
outerClassName?: string;
size?: "small" | "medium" | "large";
Expand All @@ -30,6 +30,7 @@ export default function LegendInput(props: InputProps) {
/**
* Useful for small input forms. Should only be used in special cases.
*/
const { t } = useTranslation();
const [showPassword, setShowPassword] = useState(false);
const inputRef = useRef<HTMLInputElement>(null);
const ref = props.ref || inputRef;
Expand Down Expand Up @@ -66,7 +67,6 @@ export default function LegendInput(props: InputProps) {
useEffect(() => {
ref.current && testAutoFill(ref.current);
}, [ref.current]);

return (
<div className={props.outerClassName}>
{props.label && (
Expand Down Expand Up @@ -149,8 +149,8 @@ export default function LegendInput(props: InputProps) {
</button>
)}
</div>
{props.error && (
<div className="mt-1 text-xs text-red-500">{props.error}</div>
{!!props.error && (
<div className="mt-1 text-xs text-red-500">{t(props.error)}</div>
)}
</div>
);
Expand Down
10 changes: 0 additions & 10 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -565,11 +565,6 @@ export const NOTIFICATION_EVENTS: NotificationEvent[] = [
text: "Patient Updated",
icon: "l-edit",
},
{
id: "PATIENT_DELETED",
text: "Patient Deleted",
icon: "l-user-minus",
},
{
id: "PATIENT_CONSULTATION_CREATED",
text: "Patient Consultation Created",
Expand All @@ -580,11 +575,6 @@ export const NOTIFICATION_EVENTS: NotificationEvent[] = [
text: "Patient Consultation Updated",
icon: "l-heart-medical",
},
{
id: "PATIENT_CONSULTATION_DELETED",
text: "Patient Consultation Deleted",
icon: "l-heartbeat",
},
{
id: "INVESTIGATION_SESSION_CREATED",
text: "Investigation Session Created",
Expand Down
12 changes: 2 additions & 10 deletions src/Common/static/countryPhoneAndFlags.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@
"DJ": { "flag": "🇩🇯", "name": "Djibouti", "code": "253" },
"DK": { "flag": "🇩🇰", "name": "Denmark", "code": "45" },
"DM": { "flag": "🇩🇲", "name": "Dominica", "code": "1-767" },
"DO": {
"flag": "🇩🇴",
"name": "Dominican Republic",
"code": "1"
},
"DO": { "flag": "🇩🇴", "name": "Dominican Republic", "code": "1" },
"DZ": { "flag": "🇩🇿", "name": "Algeria", "code": "213" },
"EC": { "flag": "🇪🇨", "name": "Ecuador", "code": "593" },
"EE": { "flag": "🇪🇪", "name": "Estonia", "code": "372" },
Expand Down Expand Up @@ -105,11 +101,7 @@
"IL": { "flag": "🇮🇱", "name": "Israel", "code": "972" },
"IM": { "flag": "🇮🇲", "name": "Isle of Man", "code": "44-1624" },
"IN": { "flag": "🇮🇳", "name": "India", "code": "91" },
"IO": {
"flag": "🇮🇴",
"name": "British Indian Ocean Territory",
"code": "246"
},
"IO": { "flag": "🇮🇴", "name": "British Indian Ocean Territory", "code": "246" },
"IQ": { "flag": "🇮🇶", "name": "Iraq", "code": "964" },
"IR": { "flag": "🇮🇷", "name": "Iran", "code": "98" },
"IS": { "flag": "🇮🇸", "name": "Iceland", "code": "354" },
Expand Down
4 changes: 4 additions & 0 deletions src/Components/Assets/AssetManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,10 @@ const AssetManage = (props: AssetManageProps) => {
<Uptime
route={routes.listAssetAvailability}
params={{ external_id: asset.id }}
header={
<div className="text-xl font-semibold">Availability History</div>
}
parentClassNames="mt-8 flex w-full flex-col bg-white p-4 shadow-sm sm:rounded-lg"
/>
)}
<div className="mb-4 mt-8 text-xl font-semibold">Service History</div>
Expand Down
9 changes: 8 additions & 1 deletion src/Components/Assets/AssetType/HL7Monitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,19 @@ const HL7Monitor = (props: HL7MonitorProps) => {
)}

{assetType === "HL7MONITOR" && (
<HL7PatientVitalsMonitor key={socketUrl} socketUrl={socketUrl} />
<HL7PatientVitalsMonitor
key={socketUrl}
socketUrl={socketUrl}
hideHeader={true}
hideFooter={true}
/>
)}
{assetType === "VENTILATOR" && (
<VentilatorPatientVitalsMonitor
key={socketUrl}
socketUrl={socketUrl}
hideHeader={true}
hideFooter={true}
/>
)}
</div>
Expand Down
10 changes: 6 additions & 4 deletions src/Components/Auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,19 @@ export const Login = (props: { forgot?: boolean }) => {
) {
if (!form[key].match(/\w/)) {
hasError = true;
err[key] = t("field_required");
err[key] = "field_required";
}
}
if (!form[key]) {
hasError = true;
err[key] = t("field_required");
err[key] = "field_required";
}
});
if (hasError) {
setErrors(err);
return false;
}

return form;
};

Expand All @@ -92,6 +93,7 @@ export const Login = (props: { forgot?: boolean }) => {

const handleSubmit = async (e: any) => {
e.preventDefault();

setLoading(true);
FiltersCache.invaldiateAll();
const validated = validateData();
Expand All @@ -111,12 +113,12 @@ export const Login = (props: { forgot?: boolean }) => {
if (typeof form.username === "string") {
if (!form.username.match(/\w/)) {
hasError = true;
err.username = t("field_required");
err.username = "field_required";
}
}
if (!form.username) {
hasError = true;
err.username = t("field_required");
err.username = "field_required";
}

if (hasError) {
Expand Down
5 changes: 2 additions & 3 deletions src/Components/Common/LanguageSelectorLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { LANGUAGE_NAMES } from "../../Locale/config";
import { classNames } from "../../Utils/utils";

export const LanguageSelectorLogin = () => {
const { i18n } = useTranslation();

const { i18n, t } = useTranslation();
useEffect(() => {
document.documentElement.setAttribute("lang", i18n.language);
}, [i18n]);
Expand All @@ -20,7 +19,7 @@ export const LanguageSelectorLogin = () => {

return (
<div className="mt-8 flex flex-col items-center text-sm text-gray-800">
Available in:
{t("available_in")}
<br />
<div className="inline-flex flex-wrap gap-3">
{Object.keys(LANGUAGE_NAMES).map((e: string) => (
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Common/RelativeDateUserMention.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function RelativeDateUserMention(props: {
withoutSuffix?: boolean;
}) {
return (
<div className="flex flex-row flex-wrap items-center justify-center ">
<div className="flex flex-row flex-wrap items-center justify-start ">
<div className="tooltip">
<span
className={`tooltip-text tooltip-${props.tooltipPosition || "top"}`}
Expand Down
Loading

0 comments on commit 2cf4d0b

Please sign in to comment.