Skip to content

Commit

Permalink
Merge branch 'develop' into issues/8449/remove-clear-all-filters-when…
Browse files Browse the repository at this point in the history
…-no-active-filters
  • Loading branch information
nihal467 authored Sep 6, 2024
2 parents aae7932 + 760ef63 commit 29d2778
Show file tree
Hide file tree
Showing 128 changed files with 1,449 additions and 1,114 deletions.
6 changes: 4 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Whitelabelling envs

REACT_APP_TITLE=CARE
REACT_APP_META_DESCRIPTION=Revolutionizing EMR with AI: Open Healthcare Network develops free, open-source tools to enhance efficiency in global healthcare delivery. Our EMR system is recognized as a Digital Public Good by the United Nations.
REACT_APP_META_DESCRIPTION="Revolutionizing EMR with AI: Open Healthcare Network develops free, open-source tools to enhance efficiency in global healthcare delivery. Our EMR system is recognized as a Digital Public Good by the United Nations."
REACT_APP_COVER_IMAGE=https://cdn.ohc.network/care_logo.svg
REACT_APP_COVER_IMAGE_ALT=https://cdn.ohc.network/care_logo.svg
REACT_PUBLIC_URL=https://care.ohc.network

# Care API URL without the /api prefix
REACT_CARE_API_URL=https://careapi.ohc.network

# Dev envs
ESLINT_NO_DEV_ERRORS=true

CARE_CDN_URL="https://egov-s3-facility-10bedicu.s3.amazonaws.com https://egov-s3-patient-data-10bedicu.s3.amazonaws.com http://localhost:4566"
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dotenv
test -f .env.local && dotenv .env.local
79 changes: 79 additions & 0 deletions .example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Backend URL
REACT_CARE_API_URL=https://careapi.ohc.network

# Dashboard URL
REACT_DASHBOARD_URL=

# GitHub URL (default: https://github.com/ohcnetwork)
REACT_GITHUB_URL=

# OHCN URL (default: https://ohc.network?ref=care)
REACT_OHCN_URL=

# Plausible site domain (default: care.ohc.network)
REACT_PLAUSIBLE_SITE_DOMAIN=

# Plausible server URL (default: https://plausible.10bedicu.in)
REACT_PLAUSIBLE_SERVER_URL=


# Main logo (JSON string with light and dark properties)
REACT_HEADER_LOGO=

# Main logo (JSON string with light and dark properties)
# Example: REACT_MAIN_LOGO="{\"light\": \"https://cdn.ohc.network/light-logo.svg\", \"dark\": \"https://cdn.ohc.network/dark-logo.svg\"}"
REACT_MAIN_LOGO=

# State logo (JSON string with light and dark properties)
REACT_STATE_LOGO=

# Custom logo (JSON string with light and dark properties)
REACT_CUSTOM_LOGO=

# Custom alternative logo (JSON string with light and dark properties)
REACT_CUSTOM_LOGO_ALT=

# Custom description
REACT_CUSTOM_DESCRIPTION=

# Google Maps API key
REACT_GMAPS_API_KEY=

# Government data API key
REACT_GOV_DATA_API_KEY=

# reCAPTCHA site key
REACT_RECAPTCHA_SITE_KEY=

# Sentry DSN
REACT_SENTRY_DSN=

# Sentry environment (default: staging)
REACT_SENTRY_ENVIRONMENT=

# KASP settings
REACT_KASP_ENABLED=true
REACT_KASP_STRING=KASP
REACT_KASP_FULL_STRING=Karunya Arogya Suraksha Padhathi

# Sample format file paths
REACT_SAMPLE_FORMAT_ASSET_IMPORT=/asset-import-template.xlsx
REACT_SAMPLE_FORMAT_EXTERNAL_RESULT_IMPORT=/External-Results-Template.csv

# Camera feed, still watching idle timeout (in seconds; default: 180)
REACT_STILL_WATCHING_IDLE_TIMEOUT=

# Camera feed, still watching prompt duration (in seconds; default: 30)
REACT_STILL_WATCHING_PROMPT_DURATION=

# Feature flags
REACT_ENABLE_HCX=true
REACT_ENABLE_ABDM=true
REACT_ENABLE_SCRIBE=true
REACT_WARTIME_SHIFTING=true

# JWT token refresh interval (in milliseconds) (default: 5 minutes)
REACT_JWT_TOKEN_REFRESH_INTERVAL=

# Minimum encounter date (default: 2020-01-01)
REACT_MIN_ENCOUNTER_DATE=
7 changes: 4 additions & 3 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5, 6, 7, 8]
env:
REACT_CARE_API_URL: http://localhost:9000
steps:
- name: Checkout 📥
uses: actions/checkout@v3
Expand All @@ -42,6 +44,7 @@ jobs:
run: |
cd care
echo DISABLE_RATELIMIT=True >> docker/.prebuilt.env
echo "CORS_ALLOWED_ORIGINS=\"[\\\"http://localhost:4000\\\"]\"" >> docker/.prebuilt.env
make docker_config_file=docker-compose.pre-built.yaml up
make docker_config_file=docker-compose.pre-built.yaml load-dummy-data
cd ..
Expand All @@ -66,7 +69,7 @@ jobs:
- name: Install dependencies 📦
run: npm install

- name: Build & Compile rescript files ⚙️
- name: Build ⚙️
run: npm run build

- name: Install Specific Chrome Version
Expand All @@ -89,7 +92,6 @@ jobs:
parallel: true
group: "UI-Chrome"
env:
CARE_API: http://localhost:9000
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max_old_space_size=4096
Expand All @@ -111,7 +113,6 @@ jobs:
group: "UI-Chrome"
env:
CYPRESS_SPLIT_TESTS: "true"
CARE_API: http://localhost:9000
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max_old_space_size=4096
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ To ensure the quality of our pull requests, we use a variety of tools:

To run cypress tests locally, you'll need to setup the backend to run locally and load dummy data required for cypress to the database. See [docs](https://github.com/ohcnetwork/care#self-hosting).

Once backend is running locally, you'll have to ensure your local front-end is connected to local backend, by setting the `CARE_API` env.
Once backend is running locally, you'll have to ensure your local front-end is connected to local backend, by setting the `REACT_CARE_API_URL` env.

```env
#.env
CARE_API=http://127.0.0.1:9000
REACT_CARE_API_URL=http://127.0.0.1:9000
```

Once done, start the development server by running
Expand Down
112 changes: 112 additions & 0 deletions care.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
const env = import.meta.env;

interface ILogo {
light: string;
dark: string;
}

const logo = (value?: string, fallback?: ILogo) => {
if (!value) {
return fallback;
}

try {
return JSON.parse(value) as ILogo;
} catch {
// TODO: define vite plugin to validate care.config.ts during build step
return fallback;
}
};
const careConfig = {
apiUrl: env.REACT_CARE_API_URL,

urls: {
dashboard: env.REACT_DASHBOARD_URL,
github: env.REACT_GITHUB_URL || "https://github.com/ohcnetwork",
ohcn: env.REACT_OHCN_URL || "https://ohc.network?ref=care",
},

headerLogo: logo(env.REACT_HEADER_LOGO, {
light: "https://cdn.ohc.network/header_logo.png",
dark: "https://cdn.ohc.network/header_logo.png",
}),
mainLogo: logo(env.REACT_MAIN_LOGO, {
light: "https://cdn.ohc.network/light-logo.svg",
dark: "https://cdn.ohc.network/black-logo.svg",
}),
stateLogo: logo(env.REACT_STATE_LOGO),
customLogo: logo(env.REACT_CUSTOM_LOGO),
customLogoAlt: logo(env.REACT_CUSTOM_LOGO_ALT),
customDescription: env.REACT_CUSTOM_DESCRIPTION,

gmapsApiKey:
env.REACT_GMAPS_API_KEY || "AIzaSyDsBAc3y7deI5ZO3NtK5GuzKwtUzQNJNUk",

govDataApiKey:
env.REACT_GOV_DATA_API_KEY ||
"579b464db66ec23bdd000001cdd3946e44ce4aad7209ff7b23ac571b",
reCaptchaSiteKey:
env.REACT_RECAPTCHA_SITE_KEY || "6LdvxuQUAAAAADDWVflgBqyHGfq-xmvNJaToM0pN",

kasp: {
enabled: env.REACT_KASP_ENABLED === "true",
string: env.REACT_KASP_STRING || "KASP",
fullString:
env.REACT_KASP_FULL_STRING || "Karunya Arogya Suraksha Padhathi",
},

sampleFormats: {
assetImport:
env.REACT_SAMPLE_FORMAT_ASSET_IMPORT || "/asset-import-template.xlsx",
externalResultImport:
env.REACT_SAMPLE_FORMAT_EXTERNAL_RESULT_IMPORT ||
"/External-Results-Template.csv",
},

wartimeShifting: env.REACT_WARTIME_SHIFTING === "true",

stillWatching: {
idleTimeout: env.REACT_STILL_WATCHING_IDLE_TIMEOUT
? parseInt(env.REACT_STILL_WATCHING_IDLE_TIMEOUT)
: 3 * 60,
promptDuration: env.REACT_STILL_WATCHING_PROMPT_DURATION
? parseInt(env.REACT_STILL_WATCHING_PROMPT_DURATION)
: 30,
},

auth: {
tokenRefreshInterval: env.REACT_JWT_TOKEN_REFRESH_INTERVAL
? parseInt(env.REACT_JWT_TOKEN_REFRESH_INTERVAL)
: 5 * 60e3,
},

minEncounterDate: new Date(env.REACT_MIN_ENCOUNTER_DATE || "2020-01-01"),

// Plugins related configs...

plausible: {
server: env.REACT_PLAUSIBLE_SERVER_URL || "https://plausible.10bedicu.in",
domain: env.REACT_PLAUSIBLE_SITE_DOMAIN || "care.ohc.network",
},

sentry: {
dsn:
env.REACT_SENTRY_DSN ||
"https://[email protected]/5183632",
environment: env.REACT_SENTRY_ENVIRONMENT || "staging",
},

hcx: {
enabled: env.REACT_ENABLE_HCX === "true",
},

abdm: {
enabled: (env.REACT_ENABLE_ABDM ?? "true") === "true",
},

scribe: {
enabled: env.REACT_ENABLE_SCRIBE === "true",
},
} as const;

export default careConfig;
3 changes: 3 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ export default defineConfig({
requestTimeout: 15000,
excludeSpecPattern: "**/*roles.cy.ts",
},
env: {
API_URL: process.env.REACT_CARE_API_URL ?? "http://localhost:9000",
},
});
5 changes: 1 addition & 4 deletions cypress/e2e/assets_spec/asset_homepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/// <reference types="cypress" />

import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
import { AssetQRScanPage } from "../../pageobject/Asset/AssetQRScan";
import { AssetPagination } from "../../pageobject/Asset/AssetPagination";
Expand Down Expand Up @@ -65,7 +62,7 @@ describe("Asset Tab", () => {
"Dummy Facility 40",
"ACTIVE",
"ONVIF Camera",
"Camera Loc"
"Camera Loc",
);
assetFilters.clickadvancefilter();
assetFilters.clickslideoverbackbutton(); // to verify the back button doesn't clear applied filters
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/assets_spec/assets_creation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/// <reference types="cypress" />
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import { v4 as uuidv4 } from "uuid";
import LoginPage from "../../pageobject/Login/LoginPage";
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/assets_spec/assets_manage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
import { AssetPage } from "../../pageobject/Asset/AssetCreation";
import LoginPage from "../../pageobject/Login/LoginPage";
import { AssetSearchPage } from "../../pageobject/Asset/AssetSearch";
Expand Down
4 changes: 0 additions & 4 deletions cypress/e2e/auth_spec/auth.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/// <reference types="cypress" />

import { cy, describe, beforeEach, it } from "local-cypress";

describe("Authorisation/Authentication", () => {
beforeEach(() => {
cy.awaitUrl("/", true);
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/auth_spec/forget_password.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { cy, describe, beforeEach, it } from "local-cypress";

describe("Forgot Password", () => {
beforeEach(() => {
cy.awaitUrl("/", true);
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/auth_spec/redirect.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { cy, describe, it, beforeEach, Cypress } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";

describe("redirect", () => {
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/auth_spec/roles.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { afterEach, cy, describe, it } from "local-cypress";
import * as users from "../../fixtures/users.json";

describe("authentication", () => {
Expand Down
12 changes: 1 addition & 11 deletions cypress/e2e/external_results_spec/external_result.cy.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
import {
cy,
describe,
it,
before,
beforeEach,
afterEach,
expect,
} from "local-cypress";

describe("Edit Profile Testing", () => {
before(() => {
cy.loginByApi("devdistrictadmin", "Coronasafe@123");
Expand Down Expand Up @@ -52,7 +42,7 @@ describe("Edit Profile Testing", () => {
});

it("export", () => {
cy.intercept("**", (req: Cypress.Request) => {
cy.intercept("**", (req) => {
const url = new URL(req.url);
const params = new URLSearchParams(url.search);
if (
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/external_results_spec/filter.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";

describe("External Results Filters", () => {
before(() => {
cy.loginByApi("devdistrictadmin", "Coronasafe@123");
Expand Down
12 changes: 1 addition & 11 deletions cypress/e2e/facility_spec/facility_creation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
// FacilityCreation
import {
cy,
describe,
before,
beforeEach,
it,
afterEach,
expect,
} from "local-cypress";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import LoginPage from "../../pageobject/Login/LoginPage";
import FacilityHome from "../../pageobject/Facility/FacilityHome";
Expand Down Expand Up @@ -37,7 +27,7 @@ describe("Facility Creation", () => {
const totalOccupancy = "10";
const doctorCapacity = "5";
const totalDoctor = "10";
const facilityName = "cypress facility";
const facilityName = "Cypress Facility";
const facilityName2 = "Dummy Facility 40";
const facilityAddress = "cypress address";
const facilityUpdateAddress = "cypress updated address";
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/facility_spec/facility_homepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// FacilityCreation
import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";

import LoginPage from "../../pageobject/Login/LoginPage";
import FacilityHome from "../../pageobject/Facility/FacilityHome";
import ManageUserPage from "../../pageobject/Users/ManageUserPage";
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/facility_spec/facility_manage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
import LoginPage from "../../pageobject/Login/LoginPage";
import FacilityManage from "../../pageobject/Facility/FacilityManage";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/facility_spec/inventory.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress";
import FacilityPage from "../../pageobject/Facility/FacilityCreation";
import LoginPage from "../../pageobject/Login/LoginPage";
import FacilityHome from "../../pageobject/Facility/FacilityHome";
Expand Down
Loading

0 comments on commit 29d2778

Please sign in to comment.