Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Develop To Staging [ November'24 Second Week ] #9008

Merged
merged 10 commits into from
Nov 6, 2024
Merged
6 changes: 2 additions & 4 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Cypress Tests

on:
schedule:
- cron: "30 22 * * *"
pull_request:
branches:
- develop
Expand All @@ -17,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5, 6, 7, 8]
containers: [1, 2, 3, 4]
env:
REACT_CARE_API_URL: http://localhost:9000
steps:
Expand Down Expand Up @@ -136,4 +134,4 @@ jobs:
if: steps.pr_origin.outputs.is_forked == 'true'
with:
name: cypress-videos
path: cypress/videos
path: cypress/videos
2 changes: 1 addition & 1 deletion cypress/pageobject/Users/UserSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class UserPage {
}

checkUsernameText(username: string) {
cy.get(this.usernameText).should("have.text", username);
cy.get(this.usernameText).should("contain.text", username);
}

checkUsernameBadgeVisibility(shouldBeVisible: boolean) {
Expand Down
11 changes: 6 additions & 5 deletions src/CAREUI/display/Timeline.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { createContext, useContext } from "react";
import { useTranslation } from "react-i18next";
import { PerformedByModel } from "@/components/HCX/misc";
import { classNames, formatName } from "../../Utils/utils";
import CareIcon, { IconName } from "../icons/CareIcon";
import { classNames, formatName } from "../../Utils/utils";
import { createContext, useContext } from "react";

import RecordMeta from "./RecordMeta";
import { UserBareMinimum } from "@/components/Users/models";
import { useTranslation } from "react-i18next";

export interface TimelineEvent<TType = string> {
type: TType;
timestamp: string;
by: PerformedByModel | undefined;
by: UserBareMinimum | undefined;
icon: IconName;
iconStyle?: string;
iconWrapperStyle?: string;
Expand Down
39 changes: 21 additions & 18 deletions src/PluginEngine.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CareAppsContext, useCareApps } from "@/common/hooks/useCareApps";
/* eslint-disable i18next/no-literal-string */
import React, { Suspense } from "react";
import { CareAppsContext, useCareApps } from "@/common/hooks/useCareApps";
import { pluginMap } from "./pluginTypes";
import { UserAssignedModel } from "@/components/Users/models";
import { SupportedPluginComponents, pluginMap } from "./pluginTypes";

import ErrorBoundary from "@/components/Common/ErrorBoundary";

export default function PluginEngine({
Expand All @@ -27,25 +27,28 @@ export default function PluginEngine({
);
}

export function PLUGIN_DoctorConnectButtons({
user,
}: {
user: UserAssignedModel;
}) {
type PluginProps<K extends keyof SupportedPluginComponents> =
React.ComponentProps<SupportedPluginComponents[K]>;

export function PLUGIN_Component<K extends keyof SupportedPluginComponents>({
__name,
...props
}: { __name: K } & PluginProps<K>) {
const plugins = useCareApps();

return (
<div>
{plugins.map((plugin, index) => {
const DoctorConnectButtons = plugin.components.DoctorConnectButtons;
if (!DoctorConnectButtons) {
<>
{plugins.map((plugin) => {
const Component = plugin.components[
__name
] as React.ComponentType<unknown>;

if (!Component) {
return null;
}
return (
<div key={index}>
<DoctorConnectButtons user={user} />
</div>
);

return <Component {...props} key={plugin.plugin} />;
})}
</div>
</>
);
}
118 changes: 1 addition & 117 deletions src/Redux/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,7 @@ import {
NotificationData,
PNconfigData,
} from "@/components/Notifications/models";
import {
HCXClaimModel,
HCXCommunicationModel,
HCXPolicyModel,
} from "@/components/HCX/models";
import { HCXPolicyModel } from "@/components/HCX/models";
import { ICD11DiagnosisModel } from "@/components/Diagnosis/types";
import { Investigation } from "@/components/Facility/Investigations/Reports/types";
import { PaginatedResponse } from "../Utils/request/types";
Expand Down Expand Up @@ -104,7 +100,6 @@ import {
IHealthFacility,
IpartialUpdateHealthFacilityTBody,
} from "@/components/ABDM/types/health-facility";
import { PMJAYPackageItem } from "@/components/Common/PMJAYProcedurePackageAutocomplete";
import { InsurerOptionModel } from "@/components/HCX/InsurerAutocomplete";

/**
Expand Down Expand Up @@ -1696,117 +1691,6 @@ const routes = {
TRes: Type<HCXPolicyModel>(),
},
},

claims: {
list: {
path: "/api/hcx/claim/",
method: "GET",
TRes: Type<PaginatedResponse<HCXClaimModel>>(),
},

create: {
path: "/api/hcx/claim/",
method: "POST",
TBody: Type<{
policy: string;
items: {
id: string;
price: number;
category?: string;
name: string;
}[];
consultation: string;
use: "preauthorization" | "claim";
}>(),
TRes: Type<HCXClaimModel>(),
},

get: {
path: "/api/hcx/claim/{external_id}/",
method: "GET",
},

update: {
path: "/api/hcx/claim/{external_id}/",
method: "PUT",
},

partialUpdate: {
path: "/api/hcx/claim/{external_id}/",
method: "PATCH",
},

delete: {
path: "/api/hcx/claim/{external_id}/",
method: "DELETE",
},

listPMJYPackages: {
path: "/api/hcx/pmjy_packages/",
method: "GET",
TRes: Type<PMJAYPackageItem[]>(),
},

makeClaim: {
path: "/api/hcx/make_claim/",
method: "POST",
TBody: Type<{ claim: string }>(),
TRes: Type<unknown>(),
},
},

communications: {
list: {
path: "/api/hcx/communication/",
method: "GET",
TRes: Type<PaginatedResponse<HCXCommunicationModel>>(),
},

create: {
path: "/api/hcx/communication/",
method: "POST",
TRes: Type<HCXCommunicationModel>(),
TBody: Type<{
claim: string;
content: {
type: string;
data: string;
}[];
}>(),
},

get: {
path: "/api/hcx/communication/{external_id}/",
method: "GET",
TRes: Type<HCXCommunicationModel>(),
},

update: {
path: "/api/hcx/communication/{external_id}/",
method: "PUT",
TRes: Type<HCXCommunicationModel>(),
},

partialUpdate: {
path: "/api/hcx/communication/{external_id}/",
method: "PATCH",
TRes: Type<HCXCommunicationModel>(),
},

delete: {
path: "/api/hcx/communication/{external_id}/",
method: "DELETE",
},

send: {
path: "/api/hcx/send_communication/",
method: "POST",
TRes: Type<void>(),
TBody: Type<{
communication: string;
}>(),
},
},
},
} as const;

Expand Down
38 changes: 16 additions & 22 deletions src/Routers/AppRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
import { useRedirect, useRoutes, usePath, Redirect } from "raviger";
import { useState, useEffect } from "react";

import ShowPushNotification from "@/components/Notifications/ShowPushNotification";
import { NoticeBoard } from "@/components/Notifications/NoticeBoard";
import Error404 from "@/components/ErrorPages/404";
import {
DesktopSidebar,
MobileSidebar,
SIDEBAR_SHRINK_PREFERENCE_KEY,
SidebarShrinkContext,
} from "@/components/Common/Sidebar/Sidebar";
import { Redirect, usePath, useRedirect, useRoutes } from "raviger";
import { useEffect, useState } from "react";

import ABDMFacilityRecords from "@/components/ABDM/ABDMFacilityRecords";
import AssetRoutes from "./routes/AssetRoutes";
import { BLACKLISTED_PATHS } from "@/common/constants";
import SessionExpired from "@/components/ErrorPages/SessionExpired";
import ConsultationRoutes from "./routes/ConsultationRoutes";
import Error404 from "@/components/ErrorPages/404";
import FacilityRoutes from "./routes/FacilityRoutes";
import HealthInformation from "@/components/ABDM/HealthInformation";
import ABDMFacilityRecords from "@/components/ABDM/ABDMFacilityRecords";

import UserRoutes from "./routes/UserRoutes";
import IconIndex from "../CAREUI/icons/Index";
import { NoticeBoard } from "@/components/Notifications/NoticeBoard";
import PatientRoutes from "./routes/PatientRoutes";
import ResourceRoutes from "./routes/ResourceRoutes";
import SampleRoutes from "./routes/SampleRoutes";
import FacilityRoutes from "./routes/FacilityRoutes";
import ConsultationRoutes from "./routes/ConsultationRoutes";
import HCXRoutes from "./routes/HCXRoutes";
import SessionExpired from "@/components/ErrorPages/SessionExpired";
import ShiftingRoutes from "./routes/ShiftingRoutes";
import AssetRoutes from "./routes/AssetRoutes";
import ResourceRoutes from "./routes/ResourceRoutes";
import { usePluginRoutes } from "@/common/hooks/useCareApps";
import ShowPushNotification from "@/components/Notifications/ShowPushNotification";
import UserRoutes from "./routes/UserRoutes";
import careConfig from "@careConfig";
import IconIndex from "../CAREUI/icons/Index";
import { usePluginRoutes } from "@/common/hooks/useCareApps";

export type RouteParams<T extends string> =
T extends `${string}:${infer Param}/${infer Rest}`
Expand Down Expand Up @@ -78,16 +76,12 @@ export default function AppRouter() {

let routes = Routes;

if (careConfig.hcx.enabled) {
routes = { ...HCXRoutes, ...routes };
}

useRedirect("/user", "/users");

// Merge in Plugin Routes
routes = {
...routes,
...pluginRoutes,
...routes,
};

const pages = useRoutes(routes) || <Error404 />;
Expand Down
15 changes: 0 additions & 15 deletions src/Routers/routes/HCXRoutes.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions src/Utils/types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { PerformedByModel } from "@/components/HCX/misc";
import { UserBareMinimum } from "@/components/Users/models";

export interface BaseModel {
readonly id: string;
readonly modified_date: string;
readonly created_date: string;
readonly created_by: PerformedByModel;
readonly updated_by: PerformedByModel;
readonly created_by: UserBareMinimum;
readonly updated_by: UserBareMinimum;
}

export type Writable<T> = {
Expand Down
9 changes: 4 additions & 5 deletions src/components/Assets/AssetManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ const AssetManage = (props: AssetManageProps) => {
data-testid="asset-update-button"
authorizeFor={NonReadOnlyUsers}
>
<CareIcon icon="l-pen" className="mr-1 h-4" />
<CareIcon icon="l-pen" className="text-lg" />
{t("update")}
</ButtonV2>
{asset?.asset_class &&
Expand All @@ -449,7 +449,7 @@ const AssetManage = (props: AssetManageProps) => {
id="configure-asset"
data-testid="asset-configure-button"
>
<CareIcon icon="l-setting" className="h-4" />
<CareIcon icon="l-setting" className="text-lg" />
{t("configure")}
</ButtonV2>
)}
Expand All @@ -459,10 +459,9 @@ const AssetManage = (props: AssetManageProps) => {
onClick={() => setShowDeleteDialog(true)}
variant="danger"
data-testid="asset-delete-button"
className="inline-flex"
>
<CareIcon icon="l-trash" className="h-4" />
<span className="md:hidden">{t("delete")}</span>
<CareIcon icon="l-trash" className="text-lg" />
<span>{t("delete")}</span>
</ButtonV2>
)}
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Assets/AssetTypes.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IconName } from "../../CAREUI/icons/CareIcon";
import { BedModel } from "../Facility/models";
import { PerformedByModel } from "../HCX/misc";
import { IconName } from "../../CAREUI/icons/CareIcon";
import { PatientModel } from "../Patient/models";
import { UserBareMinimum } from "@/components/Users/models";

export enum AssetLocationType {
OTHER = "OTHER",
Expand Down Expand Up @@ -169,7 +169,7 @@ export interface AssetServiceEdit {
serviced_on: string;
note: string;
edited_on: string;
edited_by: PerformedByModel;
edited_by: UserBareMinimum;
}
export interface AssetService {
id: string;
Expand Down
Loading
Loading