Skip to content

Commit

Permalink
Merge pull request #1879 from UCSF-IGHS/master
Browse files Browse the repository at this point in the history
Updating working branch - sync with master
  • Loading branch information
alaboso authored Jun 20, 2024
2 parents 287f662 + c7f79fc commit 57922fc
Show file tree
Hide file tree
Showing 16 changed files with 259 additions and 179 deletions.
7 changes: 4 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ const config = {
'^@carbon/charts-react$': path.resolve(__dirname, '__mocks__', '@carbon__charts-react.ts'),
'^dexie$': require.resolve('dexie'),
'^lodash-es/(.*)$': 'lodash/$1',
'^lodash-es$': 'lodash',
'^react-i18next$': path.resolve(__dirname, '__mocks__', 'react-i18next.js'),
},
testEnvironment: 'jsdom',
testPathIgnorePatterns: [
"/node_modules/",
"/e2e/" // Ignore the e2e directory containing Playwright tests
]
'/node_modules/',
'/e2e/', // Ignore the e2e directory containing Playwright tests
],
};

module.exports = config;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ohri/openmrs-esm-ohri",
"private": true,
"version": "2.3.3",
"version": "2.3.4",
"description": "OHRI MicroFrontend for OpenMRS SPA",
"workspaces": [
"packages/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-cervical-cancer-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ohri/openmrs-esm-ohri-cervical-cancer-app",
"version": "2.3.3",
"version": "2.3.4",
"description": "Cervical cancer microfrontend for OpenMRS HIV Reference Implementation (OHRI)",
"browser": "dist/openmrs-esm-ohri-cervical-cancer-app.js",
"main": "src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-commons-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ohri/openmrs-esm-ohri-commons-lib",
"version": "2.3.3",
"version": "2.3.4",
"description": "Commons library microfrontend of shared assets for OpenMRS HIV Reference Implementation (OHRI)",
"browser": "dist/ohri-commons-lib.js",
"main": "src/index.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import localizedFormat from 'dayjs/plugin/localizedFormat';
import relativeTime from 'dayjs/plugin/relativeTime';
import { AddPatientToListOverflowMenuItem } from '../modals/add-patient-to-list-modal.component';
import { fetchPatientLastEncounter } from '../../api/api';
import { changeWorkspaceContext } from '@openmrs/esm-patient-common-lib';
import { launchForm } from '../../utils/ohri-forms-commons';
import { navigate } from '@openmrs/esm-framework';
import { navigate, WorkspaceWindow } from '@openmrs/esm-framework';

interface PatientMetaConfig {
location: { name: string };
Expand Down Expand Up @@ -55,21 +54,23 @@ export const LaunchableFormMenuItem = ({
} else {
setIsLoading(false);
}
}, []);
}, [continueEncounterActionText, encounterType, encounterUuid, launchableForm.editLatestEncounter, patientUuid]);

return (
<>
{isLoading ? (
<InlineLoading style={{ margin: '0 auto', width: '16px' }} />
) : (
<OverflowMenuItem
itemText={actionText}
onClick={() => {
changeWorkspaceContext(patientUuid);
launchForm(form, encounterUuid ? 'edit' : 'enter', moduleName, form.name, encounterUuid, null, null);
navigate({ to: patientUrl });
}}
/>
<>
<OverflowMenuItem
itemText={actionText}
onClick={() => {
launchForm(form, encounterUuid ? 'edit' : 'enter', moduleName, form.name, encounterUuid, null, null);
navigate({ to: patientUrl });
}}
/>
<WorkspaceWindow contextKey={`patient/${patientUuid}`} />
</>
)}
</>
);
Expand All @@ -94,7 +95,7 @@ export const ViewSummaryMenuItem = ({ patientUuid, ViewSummary, encounterType })
} else {
setIsLoading(false);
}
}, []);
}, [ViewSummary.editLatestEncounter, encounterType, encounterUuid, patientUuid, viewSummaryActionText]);

return (
<>
Expand Down Expand Up @@ -132,7 +133,7 @@ export const ViewTptSummaryMenuItem = ({ patientUuid, ViewTptSummary, encounterT
} else {
setIsLoading(false);
}
}, []);
}, [ViewTptSummary.editLatestEncounter, encounterType, patientUuid, encounterUuid, viewTptSummaryActionText]);

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,7 @@ export const EncounterList: React.FC<EncounterListProps> = ({
const abortController = new AbortController();
deleteEncounter(encounterUuid, abortController)
.then(() => {
mutate(
(key) =>
typeof key === "string" && key.startsWith("/ws/rest/v1/encounter"),
undefined,
{ revalidate: true }
);
onFormSave();
showSnackbar({
isLowContrast: true,
title: t('encounterDeleted', 'Encounter deleted'),
Expand Down
21 changes: 5 additions & 16 deletions packages/esm-commons-lib/src/workspace/ohri-workspace-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { getSyncLifecycle } from '@openmrs/esm-framework';
import { BehaviorSubject } from 'rxjs';
import { closeWorkspace, launchPatientWorkspace, registerWorkspace } from '@openmrs/esm-patient-common-lib';
import { FormEngine, SessionMode } from '@openmrs/openmrs-form-engine-lib';
import { closeWorkspace } from '@openmrs/esm-framework';
import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib';
import { SessionMode } from '@openmrs/openmrs-form-engine-lib';

export interface WorkspaceContextProps {
title: string;
encounterUuid?: string;
Expand All @@ -18,26 +19,14 @@ let counter = 0;

export const launchOHRIWorkSpace = (props: WorkspaceContextProps) => {
const workspaceName = props.workspaceName || 'ohri-forms-' + counter++;

const close = () => {
return closeWorkspace(workspaceName, { ignoreChanges: true });
};

const onFormSubmit = () => {
props.state?.updateParent?.();
close();
};
registerWorkspace({
name: workspaceName,
title: props.title,
preferredWindowSize: <any>props.screenSize,
load: getSyncLifecycle(FormEngine, {
featureName: 'ohri-forms-workspace-item',
moduleName: props.moduleName,
}),
canMaximize: true,
canHide: true,
width: 'wider',
});
launchPatientWorkspace(workspaceName, {
...props.state,
mode: props.mode,
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-covid-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ohri/openmrs-esm-ohri-covid-app",
"version": "2.3.3",
"version": "2.3.4",
"description": "COVID Microfrontend for OpenMRS HIV Reference Implementation (OHRI)",
"browser": "dist/openmrs-esm-ohri-covid-app.js",
"main": "src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-form-render-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ohri/openmrs-esm-ohri-form-render-app",
"version": "2.3.3",
"version": "2.3.4",
"description": "A Forms Rendering microfrontend for OpenMRS HIV Reference Implementation (OHRI)",
"browser": "dist/openmrs-esm-ohri-form-render-app.js",
"main": "src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-hiv-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ohri/openmrs-esm-ohri-hiv-app",
"version": "2.3.3",
"version": "2.3.4",
"description": "HIV microfrontend for OpenMRS HIV Reference Implementation (OHRI)",
"browser": "dist/openmrs-esm-ohri-hiv-app.js",
"main": "src/index.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { launchFormWithCustomTitle } from '@ohri/openmrs-esm-ohri-commons-lib';
import { getForm, applyFormIntent } from '@openmrs/openmrs-form-engine-lib';
import styles from './tabs/patient-list.scss';
import { OverflowMenu, OverflowMenuItem } from '@carbon/react';
import { changeWorkspaceContext, closeAllWorkspaces, resetWorkspaceStore } from '@openmrs/esm-patient-common-lib';
import { navigate } from '@openmrs/esm-framework';
import { useTranslation } from 'react-i18next';
import { moduleName } from '../../../index';
Expand Down Expand Up @@ -47,7 +46,6 @@ export const LabresultsFormViewer: React.FC<LabresultsFormViewerProps> = ({
itemText={t('viewResult', 'View Result')}
onClick={(e) => {
e.preventDefault();
changeWorkspaceContext(patientUuid);
launchEncounterForm(applyFormIntent('*', getForm(form.package, form.name)), '*', 'view', encounterUuid);
navigate({ to: patientUrl });
}}
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-ohri-core-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ohri/openmrs-esm-ohri-core-app",
"version": "2.3.3",
"version": "2.3.4",
"description": "A custom microfrontend for OpenMRS HIV Reference Implementation (OHRI)",
"browser": "dist/ohri-core-app.js",
"main": "src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-ohri-pmtct-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ohri/openmrs-esm-ohri-pmtct-app",
"version": "2.3.3",
"version": "2.3.4",
"description": "PMTCT microfrontend for OpenMRS HIV Reference Implementation (OHRI)",
"browser": "dist/ohri-pmtct-app.js",
"main": "src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-opd-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ohri/openmrs-esm-ohri-opd-app",
"version": "2.3.3",
"version": "2.3.4",
"description": "opd active visits",
"browser": "dist/openmrs-esm-ohri-opd-app.js",
"main": "src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-tb-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ohri/openmrs-esm-ohri-tb-app",
"version": "2.3.3",
"version": "2.3.4",
"description": "Tuberclosis microfrontend for OpenMRS HIV Reference Implementation (OHRI)",
"browser": "dist/openmrs-esm-ohri-tb-app.js",
"main": "src/index.ts",
Expand Down
Loading

0 comments on commit 57922fc

Please sign in to comment.