@openmrs/esm-patient-list-management-app 9.2.1-pre.7129 → 9.2.1-pre.7136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/1992.js +1 -1
- package/dist/1992.js.map +1 -1
- package/dist/416.js +1 -1
- package/dist/416.js.map +1 -1
- package/dist/4300.js +1 -1
- package/dist/7647.js +1 -1
- package/dist/7647.js.map +1 -1
- package/dist/7760.js +1 -1
- package/dist/7760.js.map +1 -1
- package/dist/8984.js +1 -1
- package/dist/8984.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-patient-list-management-app.js.buildmanifest.json +21 -21
- package/dist/routes.json +1 -1
- package/package.json +2 -2
- package/src/add-patient/add-patient.modal.tsx +1 -1
- package/src/add-patient/add-patient.test.tsx +2 -2
- package/src/api/hooks.ts +6 -1
- package/src/api/{api-remote.ts → patient-list.resource.ts} +2 -2
- package/src/dashboard.meta.ts +1 -1
- package/src/list-details/list-details.component.tsx +1 -1
- package/src/list-details/list-details.test.tsx +2 -2
- package/src/list-details-table/list-details-table.component.tsx +1 -1
- package/src/list-details-table/list-details-table.test.tsx +2 -2
- package/src/lists-table/lists-table.component.tsx +1 -1
- package/src/patient-list-form/patient-list-form.workspace.tsx +2 -2
- package/translations/en.json +2 -0
package/src/api/hooks.ts
CHANGED
|
@@ -2,7 +2,12 @@ import { useEffect } from 'react';
|
|
|
2
2
|
import useSWR from 'swr';
|
|
3
3
|
import useSWRInfinite from 'swr/infinite';
|
|
4
4
|
import { openmrsFetch, type FetchResponse, useConfig, useSession } from '@openmrs/esm-framework';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
cohortUrl,
|
|
7
|
+
getAllPatientLists,
|
|
8
|
+
getPatientListIdsForPatient,
|
|
9
|
+
getPatientListMembers,
|
|
10
|
+
} from './patient-list.resource';
|
|
6
11
|
import { type PatientListManagementConfig } from '../config-schema';
|
|
7
12
|
import {
|
|
8
13
|
type CohortResponse,
|
|
@@ -58,7 +58,7 @@ async function postData(url: string, data = {}, ac = new AbortController()) {
|
|
|
58
58
|
return response.data;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export function extractErrorMessagesFromResponse(errorObject: ErrorObject) {
|
|
61
|
+
export function extractErrorMessagesFromResponse(errorObject: ErrorObject, t?: TFunction) {
|
|
62
62
|
const {
|
|
63
63
|
error: { fieldErrors, globalErrors, message, code },
|
|
64
64
|
} = errorObject ?? {};
|
|
@@ -75,7 +75,7 @@ export function extractErrorMessagesFromResponse(errorObject: ErrorObject) {
|
|
|
75
75
|
.join('\n');
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
return message ?? code ??
|
|
78
|
+
return message ?? code ?? t('unknownError', 'An unknown error occurred');
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
async function deleteData(url: string, data = {}, ac = new AbortController()) {
|
package/src/dashboard.meta.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
launchWorkspace,
|
|
14
14
|
showModal,
|
|
15
15
|
} from '@openmrs/esm-framework';
|
|
16
|
-
import { deletePatientList } from '../api/
|
|
16
|
+
import { deletePatientList } from '../api/patient-list.resource';
|
|
17
17
|
import { usePatientListDetails, usePatientListMembers } from '../api/hooks';
|
|
18
18
|
import ListDetailsTable from '../list-details-table/list-details-table.component';
|
|
19
19
|
import styles from './list-details.scss';
|
|
@@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event';
|
|
|
4
4
|
import type { OpenmrsCohortMember, OpenmrsCohort } from '../api/types';
|
|
5
5
|
import { showModal } from '@openmrs/esm-framework';
|
|
6
6
|
import { useCohortTypes, usePatientListDetails, usePatientListMembers } from '../api/hooks';
|
|
7
|
-
import { deletePatientList } from '../api/
|
|
7
|
+
import { deletePatientList } from '../api/patient-list.resource';
|
|
8
8
|
import { getByTextWithMarkup } from 'tools';
|
|
9
9
|
import ListDetails from './list-details.component';
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ jest.mock('../api/hooks', () => ({
|
|
|
20
20
|
useCohortTypes: jest.fn(),
|
|
21
21
|
}));
|
|
22
22
|
|
|
23
|
-
jest.mock('../api/
|
|
23
|
+
jest.mock('../api/patient-list.resource');
|
|
24
24
|
|
|
25
25
|
const mockPatientListDetails = {
|
|
26
26
|
name: 'Test Patient List',
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
useDebounce,
|
|
33
33
|
useLayoutType,
|
|
34
34
|
} from '@openmrs/esm-framework';
|
|
35
|
-
import { addPatientToList, removePatientFromList } from '../api/
|
|
35
|
+
import { addPatientToList, removePatientFromList } from '../api/patient-list.resource';
|
|
36
36
|
import { EmptyDataIllustration } from '../empty-state/empty-data-illustration.component';
|
|
37
37
|
import styles from './list-details-table.scss';
|
|
38
38
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import { ExtensionSlot, isDesktop, showSnackbar, useLayoutType } from '@openmrs/esm-framework';
|
|
5
|
-
import { addPatientToList } from '../api/
|
|
5
|
+
import { addPatientToList } from '../api/patient-list.resource';
|
|
6
6
|
import ListDetailsTable from './list-details-table.component';
|
|
7
7
|
|
|
8
8
|
const mockShowSnackbar = jest.mocked(showSnackbar);
|
|
@@ -19,7 +19,7 @@ beforeEach(() => {
|
|
|
19
19
|
));
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
jest.mock('../api/
|
|
22
|
+
jest.mock('../api/patient-list.resource', () => ({
|
|
23
23
|
addPatientToList: jest.fn(() => Promise.resolve()),
|
|
24
24
|
removePatientFromList: jest.fn(),
|
|
25
25
|
}));
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
} from '@openmrs/esm-framework';
|
|
32
32
|
import type { PatientListManagementConfig } from '../config-schema';
|
|
33
33
|
import type { PatientList } from '../api/types';
|
|
34
|
-
import { starPatientList } from '../api/
|
|
34
|
+
import { starPatientList } from '../api/patient-list.resource';
|
|
35
35
|
import { CustomPagination } from './custom-pagination.component';
|
|
36
36
|
import { ErrorState } from '../error-state/error-state.component';
|
|
37
37
|
import EmptyState from '../empty-state/empty-state.component';
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
editPatientList,
|
|
18
18
|
extractErrorMessagesFromResponse,
|
|
19
19
|
type ErrorObject,
|
|
20
|
-
} from '../api/
|
|
20
|
+
} from '../api/patient-list.resource';
|
|
21
21
|
import { useCohortTypes } from '../api/hooks';
|
|
22
22
|
import styles from './patient-list-form.scss';
|
|
23
23
|
|
|
@@ -105,7 +105,7 @@ const PatientListFormWorkspace: React.FC<PatientListFormWorkspaceProps> = ({
|
|
|
105
105
|
OpenmrsFetchError && error instanceof OpenmrsFetchError
|
|
106
106
|
? typeof error.responseBody === 'string'
|
|
107
107
|
? error.responseBody
|
|
108
|
-
: extractErrorMessagesFromResponse(error.responseBody as ErrorObject)
|
|
108
|
+
: extractErrorMessagesFromResponse(error.responseBody as ErrorObject, t)
|
|
109
109
|
: (error as any)?.message;
|
|
110
110
|
|
|
111
111
|
showSnackbar({
|
package/translations/en.json
CHANGED
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"noMatchingPatients": "No matching patients to display",
|
|
59
59
|
"noOfPatients": "No. of patients",
|
|
60
60
|
"noPatientsInList": "There are no patients in this list",
|
|
61
|
+
"offlinePatients": "Offline patients",
|
|
61
62
|
"openPatientList": "Add to list",
|
|
62
63
|
"patientAddedToList": "Patient added to list",
|
|
63
64
|
"patientAlreadyInList": "This patient is already in the list",
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
"systemDefined": "system-defined",
|
|
89
90
|
"systemLists": "System lists",
|
|
90
91
|
"trySearchingForADifferentList": "Try searching for a different list",
|
|
92
|
+
"unknownError": "An unknown error occurred",
|
|
91
93
|
"unstarList": "Unstar list",
|
|
92
94
|
"updated": "Updated",
|
|
93
95
|
"userDefined": "user-defined"
|