@openmrs/esm-openconceptlab-app 3.0.1-pre.7 → 3.0.1-pre.72
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 +33 -36
- package/dist/130.js +2 -0
- package/dist/130.js.LICENSE.txt +5 -0
- package/dist/130.js.map +1 -0
- package/dist/316.js +1 -1
- package/dist/316.js.map +1 -0
- package/dist/392.js +1 -0
- package/dist/392.js.map +1 -0
- package/dist/553.js +1 -0
- package/dist/553.js.map +1 -0
- package/dist/574.js +1 -1
- package/dist/608.js +2 -0
- package/dist/608.js.LICENSE.txt +15 -0
- package/dist/608.js.map +1 -0
- package/dist/784.js +1 -1
- package/dist/784.js.map +1 -0
- package/dist/842.js +1 -0
- package/dist/842.js.map +1 -0
- package/dist/853.js +1 -0
- package/dist/853.js.map +1 -0
- package/dist/912.js +2 -0
- package/dist/912.js.LICENSE.txt +9 -0
- package/dist/912.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -0
- package/dist/openmrs-esm-openconceptlab-app.js +1 -1
- package/dist/openmrs-esm-openconceptlab-app.js.buildmanifest.json +143 -54
- package/dist/openmrs-esm-openconceptlab-app.js.map +1 -0
- package/dist/routes.json +1 -0
- package/jest.config.js +3 -0
- package/package.json +7 -5
- package/src/admin-ocl-card-link.component.tsx +23 -0
- package/src/declarations.d.tsx +2 -0
- package/src/import/import.component.tsx +38 -21
- package/src/import/import.resource.ts +1 -1
- package/src/import/import.scss +26 -0
- package/src/import/import.test.tsx +13 -15
- package/src/index.ts +9 -51
- package/src/previous-imports/import-overview/import-items.component.tsx +23 -20
- package/src/previous-imports/import-overview/import-items.resource.ts +1 -1
- package/src/previous-imports/import-overview/import-items.scss +23 -0
- package/src/previous-imports/import-overview/import-items.test.tsx +7 -14
- package/src/previous-imports/import-overview/import-overview.component.tsx +2 -2
- package/src/previous-imports/import-overview/import-overview.scss +10 -0
- package/src/previous-imports/import-overview/import-overview.test.tsx +1 -2
- package/src/previous-imports/previous-imports.component.tsx +4 -4
- package/src/previous-imports/previous-imports.resource.ts +1 -1
- package/src/previous-imports/previous-imports.scss +39 -0
- package/src/previous-imports/previous-imports.test.tsx +1 -2
- package/src/root.component.tsx +8 -8
- package/src/root.scss +23 -0
- package/src/root.test.tsx +4 -4
- package/src/routes.json +20 -0
- package/src/subscription/subscription.component.tsx +58 -24
- package/src/subscription/subscription.resource.ts +1 -1
- package/src/subscription/subscription.scss +26 -0
- package/src/subscription/subscription.test.tsx +22 -20
- package/src/utils.ts +27 -0
- package/translations/en.json +42 -40
- package/tsconfig.json +1 -19
- package/webpack.config.js +1 -1
- package/dist/452.js +0 -1
- package/dist/645.js +0 -2
- package/dist/645.js.LICENSE.txt +0 -20
- package/dist/709.js +0 -1
- package/dist/858.js +0 -2
- package/dist/858.js.LICENSE.txt +0 -1
- package/dist/862.js +0 -1
- package/dist/openmrs-esm-openconceptlab-app.old +0 -1
- package/locales/en/translation.json +0 -35
- package/locales/fr/translation.json +0 -35
- package/src/import/import.component.scss +0 -27
- package/src/previous-imports/import-overview/import-items.component.scss +0 -24
- package/src/previous-imports/import-overview/import-overview.component.scss +0 -11
- package/src/previous-imports/previous-imports.component.scss +0 -39
- package/src/root.component.scss +0 -23
- package/src/setup-tests.ts +0 -1
- package/src/subscription/subscription.component.scss +0 -27
|
@@ -44,14 +44,12 @@ describe(`Import component`, () => {
|
|
|
44
44
|
renderImportComponent();
|
|
45
45
|
await waitForLoadingToFinish();
|
|
46
46
|
|
|
47
|
-
expect(screen.getByText('
|
|
48
|
-
expect(screen.getByText('
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
expect(screen.getByText('
|
|
52
|
-
expect(screen.
|
|
53
|
-
expect(screen.getByText('importFromFile')).toBeEnabled();
|
|
54
|
-
expect(screen.queryByText('fileAdded')).not.toBeInTheDocument();
|
|
47
|
+
expect(screen.getByText('Import Concepts')).toBeVisible();
|
|
48
|
+
expect(screen.getByText('Import from Subscription')).toBeVisible();
|
|
49
|
+
|
|
50
|
+
expect(screen.getByText('Import from file (Offline)')).toBeVisible();
|
|
51
|
+
expect(screen.getByText('Import from file')).toBeEnabled();
|
|
52
|
+
expect(screen.queryByText('File Added')).not.toBeInTheDocument();
|
|
55
53
|
});
|
|
56
54
|
|
|
57
55
|
it(`renders correctly when there is no subscription`, async () => {
|
|
@@ -59,8 +57,8 @@ describe(`Import component`, () => {
|
|
|
59
57
|
renderImportComponent();
|
|
60
58
|
await waitForLoadingToFinish();
|
|
61
59
|
|
|
62
|
-
expect(screen.getByText('
|
|
63
|
-
expect(screen.getByText('
|
|
60
|
+
expect(screen.getByText('Import from Subscription')).toBeDisabled();
|
|
61
|
+
expect(screen.getByText('Import from file')).toBeEnabled();
|
|
64
62
|
});
|
|
65
63
|
|
|
66
64
|
it(`renders correctly when when a subscription exists`, async () => {
|
|
@@ -68,8 +66,8 @@ describe(`Import component`, () => {
|
|
|
68
66
|
renderImportComponent();
|
|
69
67
|
await waitForLoadingToFinish();
|
|
70
68
|
|
|
71
|
-
expect(screen.getByText('
|
|
72
|
-
expect(screen.getByText('
|
|
69
|
+
await waitFor(() => expect(screen.getByText('Import from Subscription')).toBeEnabled(), { timeout: 2000 });
|
|
70
|
+
expect(screen.getByText('Import from file')).toBeEnabled();
|
|
73
71
|
});
|
|
74
72
|
|
|
75
73
|
it(`allows starting an import using the subscription`, async () => {
|
|
@@ -79,14 +77,14 @@ describe(`Import component`, () => {
|
|
|
79
77
|
|
|
80
78
|
mockStartImportWithSubscription.mockReturnValueOnce({ status: 201 });
|
|
81
79
|
|
|
82
|
-
await waitFor(() => userEvent.click(screen.getByText('
|
|
80
|
+
await waitFor(() => userEvent.click(screen.getByText('Import from Subscription')));
|
|
83
81
|
|
|
84
82
|
expect(mockStartImportWithSubscription).toHaveBeenCalledWith(new AbortController());
|
|
85
83
|
expect(mockStartImportWithSubscription).toHaveBeenCalledTimes(1);
|
|
86
84
|
|
|
87
85
|
expect(mockShowNotification).toHaveBeenCalledWith(
|
|
88
86
|
expect.objectContaining({
|
|
89
|
-
description: '
|
|
87
|
+
description: 'Import started successfully',
|
|
90
88
|
kind: 'success',
|
|
91
89
|
}),
|
|
92
90
|
);
|
|
@@ -100,6 +98,6 @@ function renderImportComponent() {
|
|
|
100
98
|
|
|
101
99
|
function waitForLoadingToFinish() {
|
|
102
100
|
return waitFor(() => {
|
|
103
|
-
expect(screen.getByText('
|
|
101
|
+
expect(screen.getByText('Import Concepts')).toBeVisible, { timeout: 2000 };
|
|
104
102
|
});
|
|
105
103
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,61 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is the entrypoint file of the application. It communicates the
|
|
3
|
-
* important features of this microfrontend to the app shell. It
|
|
4
|
-
* connects the app shell to the React application(s) that make up this
|
|
5
|
-
* microfrontend.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
1
|
import { getAsyncLifecycle, defineConfigSchema } from '@openmrs/esm-framework';
|
|
9
2
|
import { configSchema } from './config-schema';
|
|
10
3
|
|
|
11
|
-
|
|
12
|
-
* This tells the app shell how to obtain translation files: that they
|
|
13
|
-
* are JSON files in the directory `../translations` (which you should
|
|
14
|
-
* see in the directory structure).
|
|
15
|
-
*/
|
|
16
|
-
const importTranslation = require.context('../translations', false, /.json$/, 'lazy');
|
|
4
|
+
const moduleName = '@openmrs/esm-openconceptlab-app';
|
|
17
5
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* installed. The keys are the part of the module name after
|
|
22
|
-
* `openmrs-module-`; e.g., `openmrs-module-fhir2` becomes `fhir2`.
|
|
23
|
-
*/
|
|
24
|
-
const backendDependencies = {
|
|
25
|
-
openconceptlab: '^1.2.0',
|
|
26
|
-
'webservices.rest': '^2.2.0',
|
|
6
|
+
const options = {
|
|
7
|
+
featureName: 'openconceptlab',
|
|
8
|
+
moduleName,
|
|
27
9
|
};
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
* This function performs any setup that should happen at microfrontend
|
|
31
|
-
* load-time (such as defining the config schema) and then returns an
|
|
32
|
-
* object which describes how the React application(s) should be
|
|
33
|
-
* rendered.
|
|
34
|
-
*
|
|
35
|
-
* In this example, our return object contains a single page definition.
|
|
36
|
-
* It tells the app shell that the default export of `greeter.tsx`
|
|
37
|
-
* should be rendered when the route matches `hello`. The full route
|
|
38
|
-
* will be `openmrsSpaBase() + 'hello'`, which is usually
|
|
39
|
-
* `/openmrs/spa/hello`.
|
|
40
|
-
*/
|
|
41
|
-
function setupOpenMRS() {
|
|
42
|
-
const moduleName = '@openmrs/esm-openconceptlab-app';
|
|
43
|
-
|
|
44
|
-
const options = {
|
|
45
|
-
featureName: 'openconceptlab',
|
|
46
|
-
moduleName,
|
|
47
|
-
};
|
|
11
|
+
export const importTranslation = require.context('../translations', false, /.json$/, 'lazy');
|
|
48
12
|
|
|
13
|
+
export function startupApp() {
|
|
49
14
|
defineConfigSchema(moduleName, configSchema);
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
pages: [
|
|
53
|
-
{
|
|
54
|
-
load: getAsyncLifecycle(() => import('./root.component'), options),
|
|
55
|
-
route: 'ocl',
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
};
|
|
59
15
|
}
|
|
60
16
|
|
|
61
|
-
export
|
|
17
|
+
export const root = getAsyncLifecycle(() => import('./root.component'), options);
|
|
18
|
+
|
|
19
|
+
export const adminOclCardLink = getAsyncLifecycle(() => import('./admin-ocl-card-link.component'), options);
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
import React, { Fragment, useCallback, useEffect, useState } from 'react';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import { getImportDetails } from './import-items.resource';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
17
|
+
import type { ImportItem } from '../../types';
|
|
18
|
+
import styles from './import-items.scss';
|
|
19
19
|
|
|
20
20
|
interface ImportItemsProps {
|
|
21
21
|
importUuid: string;
|
|
@@ -29,29 +29,32 @@ const ImportItems: React.FC<ImportItemsProps> = ({ importUuid }) => {
|
|
|
29
29
|
const [selectedImportItems, setSelectedImportItems] = useState<ImportItem[]>([]);
|
|
30
30
|
const { results, currentPage, goTo } = usePagination(selectedImportItems, pageSize);
|
|
31
31
|
|
|
32
|
-
const handleImportDetails = useCallback(
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const handleImportDetails = useCallback(
|
|
33
|
+
async (uuid: string) => {
|
|
34
|
+
setIsLoading(true);
|
|
35
|
+
const abortController = new AbortController();
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
const response = await getImportDetails(uuid, abortController);
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
if (response.ok) {
|
|
40
|
+
setSelectedImportItems(response.data.results);
|
|
41
|
+
} else {
|
|
42
|
+
showNotification({
|
|
43
|
+
title: t('importItemsFetchError', 'Error occured while fetching the import items'),
|
|
44
|
+
kind: 'error',
|
|
45
|
+
critical: true,
|
|
46
|
+
description: JSON.stringify(response.data),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
setIsLoading(false);
|
|
50
|
+
return () => abortController.abort();
|
|
51
|
+
},
|
|
52
|
+
[t],
|
|
53
|
+
);
|
|
51
54
|
|
|
52
55
|
useEffect(() => {
|
|
53
56
|
handleImportDetails(importUuid);
|
|
54
|
-
}, []);
|
|
57
|
+
}, [handleImportDetails, importUuid]);
|
|
55
58
|
|
|
56
59
|
if (isLoading) {
|
|
57
60
|
return (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
-
import { ImportItem } from '../../types';
|
|
2
|
+
import type { ImportItem } from '../../types';
|
|
3
3
|
|
|
4
4
|
export async function getImportDetails(importUuid: string, abortController?: AbortController) {
|
|
5
5
|
const url = `/ws/rest/v1/openconceptlab/import/${importUuid}/item?state=ERROR&v=full`;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@use "@carbon/colors";
|
|
2
|
+
@use "@carbon/type";
|
|
3
|
+
|
|
4
|
+
.pagination {
|
|
5
|
+
@include type.type-style('body-short-01');
|
|
6
|
+
background-color: colors.$white-0;
|
|
7
|
+
color: colors.$gray-70;
|
|
8
|
+
border: 1px solid colors.$gray-20;
|
|
9
|
+
display: flex;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.tableBordered {
|
|
13
|
+
border: 1px solid colors.$gray-20;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.tableDataRow > td {
|
|
17
|
+
padding-left: 1rem !important;
|
|
18
|
+
background-color: colors.$white-0 !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.tableHeaderRow > th {
|
|
22
|
+
background-color: colors.$gray-20 !important;
|
|
23
|
+
}
|
|
@@ -3,9 +3,12 @@ import { screen, waitFor } from '@testing-library/react';
|
|
|
3
3
|
import { usePagination } from '@openmrs/esm-framework';
|
|
4
4
|
import { renderWithSwr } from '../../../../../tools/test-helpers';
|
|
5
5
|
import { mockImportItems, mockPreviousImports } from '../../../../../__mocks__/openconceptlab.mock';
|
|
6
|
-
import { ImportItem } from '../../types';
|
|
7
|
-
import ImportItems from './import-items.component';
|
|
8
6
|
import { getImportDetails } from './import-items.resource';
|
|
7
|
+
import ImportItems from './import-items.component';
|
|
8
|
+
|
|
9
|
+
const testProps = {
|
|
10
|
+
importUuid: mockPreviousImports[1].uuid,
|
|
11
|
+
};
|
|
9
12
|
|
|
10
13
|
const mockGetImportDetails = getImportDetails as jest.Mock;
|
|
11
14
|
const mockUsePagination = usePagination as jest.Mock;
|
|
@@ -34,16 +37,6 @@ describe(`Import Items component`, () => {
|
|
|
34
37
|
mockUsePagination.mockReset();
|
|
35
38
|
});
|
|
36
39
|
|
|
37
|
-
it(`renders without dying`, () => {
|
|
38
|
-
mockGetImportDetails.mockReturnValue({ status: 200, ok: true, data: [] });
|
|
39
|
-
mockUsePagination.mockReturnValue({
|
|
40
|
-
currentPage: 1,
|
|
41
|
-
goTo: () => {},
|
|
42
|
-
results: [],
|
|
43
|
-
});
|
|
44
|
-
renderImportItemsComponent();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
40
|
it(`renders the table`, async () => {
|
|
48
41
|
mockGetImportDetails.mockReturnValue({ status: 200, ok: true, data: mockImportItems });
|
|
49
42
|
mockUsePagination.mockReturnValue({
|
|
@@ -71,7 +64,7 @@ describe(`Import Items component`, () => {
|
|
|
71
64
|
expect(screen.getByText('Concept/Mapping')).toBeVisible();
|
|
72
65
|
expect(screen.getByText('Message')).toBeVisible();
|
|
73
66
|
|
|
74
|
-
mockImportItems.slice(5).forEach((importItem
|
|
67
|
+
mockImportItems.slice(5).forEach((importItem) => {
|
|
75
68
|
expect(screen.getByText(importItem.type + ' ' + importItem.uuid)).toBeVisible();
|
|
76
69
|
expect(screen.getByText(importItem.errorMessage)).toBeVisible();
|
|
77
70
|
});
|
|
@@ -79,7 +72,7 @@ describe(`Import Items component`, () => {
|
|
|
79
72
|
});
|
|
80
73
|
|
|
81
74
|
function renderImportItemsComponent() {
|
|
82
|
-
renderWithSwr(<ImportItems
|
|
75
|
+
renderWithSwr(<ImportItems {...testProps} />);
|
|
83
76
|
}
|
|
84
77
|
|
|
85
78
|
function waitForLoadingToFinish() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { formatDatetime } from '@openmrs/esm-framework';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import
|
|
5
|
-
import { Import } from '../../types';
|
|
4
|
+
import type { Import } from '../../types';
|
|
6
5
|
import ImportItems from './import-items.component';
|
|
6
|
+
import styles from './import-overview.scss';
|
|
7
7
|
|
|
8
8
|
interface ImportOverviewProps {
|
|
9
9
|
selectedImportObject: Import;
|
|
@@ -3,7 +3,6 @@ import { screen, waitFor } from '@testing-library/react';
|
|
|
3
3
|
import { formatDatetime } from '@openmrs/esm-framework';
|
|
4
4
|
import { renderWithSwr } from '../../../../../tools/test-helpers';
|
|
5
5
|
import { mockPreviousImports } from '../../../../../__mocks__/openconceptlab.mock';
|
|
6
|
-
import { Import } from '../../types';
|
|
7
6
|
import ImportOverview from './import-overview.component';
|
|
8
7
|
|
|
9
8
|
describe(`Import Overview component`, () => {
|
|
@@ -72,7 +71,7 @@ describe(`Import Overview component`, () => {
|
|
|
72
71
|
});
|
|
73
72
|
});
|
|
74
73
|
|
|
75
|
-
function renderImportOverviewComponent(importObject
|
|
74
|
+
function renderImportOverviewComponent(importObject) {
|
|
76
75
|
renderWithSwr(<ImportOverview selectedImportObject={importObject} />);
|
|
77
76
|
}
|
|
78
77
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, { Fragment, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Column,
|
|
4
4
|
DataTable,
|
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
TableHeader,
|
|
18
18
|
TableRow,
|
|
19
19
|
} from '@carbon/react';
|
|
20
|
-
import React, { Fragment, useState } from 'react';
|
|
21
20
|
import { useTranslation } from 'react-i18next';
|
|
21
|
+
import { formatDatetime, showNotification, usePagination } from '@openmrs/esm-framework';
|
|
22
22
|
import { usePreviousImports } from './previous-imports.resource';
|
|
23
|
-
import
|
|
24
|
-
import { Import } from '../types';
|
|
23
|
+
import type { Import } from '../types';
|
|
25
24
|
import ImportOverview from './import-overview/import-overview.component';
|
|
25
|
+
import styles from './previous-imports.scss';
|
|
26
26
|
|
|
27
27
|
const PreviousImports: React.FC = () => {
|
|
28
28
|
const { t } = useTranslation();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
2
|
import useSWR from 'swr';
|
|
3
|
-
import { Import } from '../types';
|
|
3
|
+
import type { Import } from '../types';
|
|
4
4
|
|
|
5
5
|
export function usePreviousImports() {
|
|
6
6
|
const { data, error, isValidating } = useSWR<{ data: { results: Import[] } }, Error>(
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@use "@carbon/colors";
|
|
2
|
+
@use "@carbon/layout";
|
|
3
|
+
@use "@carbon/type";
|
|
4
|
+
|
|
5
|
+
.grid {
|
|
6
|
+
margin-left: 0;
|
|
7
|
+
margin-right: 0;
|
|
8
|
+
padding-left: 0;
|
|
9
|
+
padding-right: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.productiveHeading03 {
|
|
13
|
+
@include type.type-style('heading-03');
|
|
14
|
+
margin-bottom: layout.$spacing-03;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pagination {
|
|
18
|
+
@include type.type-style('body-compact-01');
|
|
19
|
+
background-color: colors.$white-0;
|
|
20
|
+
color: colors.$gray-70;
|
|
21
|
+
border: 1px solid colors.$gray-20;
|
|
22
|
+
display: flex;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tableBordered {
|
|
26
|
+
border: 1px solid colors.$gray-20;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.tableRow > td {
|
|
30
|
+
background-color: colors.$white-0;
|
|
31
|
+
border-bottom: 1px solid colors.$gray-20 !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.tableExpandedRow > td {
|
|
35
|
+
padding-left: layout.$spacing-09 !important;
|
|
36
|
+
padding-right: layout.$spacing-09;
|
|
37
|
+
padding-top: layout.$spacing-05;
|
|
38
|
+
padding-bottom: layout.$spacing-05;
|
|
39
|
+
}
|
|
@@ -3,7 +3,6 @@ import { screen, waitFor } from '@testing-library/react';
|
|
|
3
3
|
import { formatDatetime, openmrsFetch, usePagination } from '@openmrs/esm-framework';
|
|
4
4
|
import { renderWithSwr } from '../../../../tools/test-helpers';
|
|
5
5
|
import { mockPreviousImports } from '../../../../__mocks__/openconceptlab.mock';
|
|
6
|
-
import { Import } from '../types';
|
|
7
6
|
import PreviousImports from './previous-imports.component';
|
|
8
7
|
|
|
9
8
|
const mockOpenmrsFetch = openmrsFetch as jest.Mock;
|
|
@@ -58,7 +57,7 @@ describe(`Previous Imports component`, () => {
|
|
|
58
57
|
renderPreviousImportsComponent();
|
|
59
58
|
await waitForLoadingToFinish();
|
|
60
59
|
|
|
61
|
-
mockPreviousImports.forEach((item
|
|
60
|
+
mockPreviousImports.forEach((item) => {
|
|
62
61
|
expect(screen.getByText(formatDatetime(item.localDateStarted))).toBeVisible();
|
|
63
62
|
expect(screen.getByText(item.importTime)).toBeVisible();
|
|
64
63
|
expect(screen.getByText(item.status)).toBeVisible();
|
package/src/root.component.tsx
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Tab, Tabs, TabList, TabPanels, TabPanel } from '@carbon/react';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import { Tab, Tabs, TabList, TabPanels, TabPanel } from '@carbon/react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { SWRConfig } from 'swr';
|
|
5
|
-
import Subscription from './subscription/subscription.component';
|
|
6
|
-
import styles from './root.component.scss';
|
|
7
5
|
import Import from './import/import.component';
|
|
8
6
|
import PreviousImports from './previous-imports/previous-imports.component';
|
|
7
|
+
import Subscription from './subscription/subscription.component';
|
|
8
|
+
import styles from './root.scss';
|
|
9
9
|
|
|
10
10
|
const Root: React.FC = () => {
|
|
11
11
|
const { t } = useTranslation();
|
|
12
12
|
return (
|
|
13
13
|
<SWRConfig>
|
|
14
14
|
<main className={`omrs-main-content ${styles.main}`}>
|
|
15
|
-
<h3 className={styles.moduleHeader}>{t('moduleTitle')}</h3>
|
|
15
|
+
<h3 className={styles.moduleHeader}>{t('moduleTitle', 'OCL Subscription Module')}</h3>
|
|
16
16
|
<Tabs>
|
|
17
|
-
<TabList className={styles.tabList} contained={true}>
|
|
18
|
-
<Tab>{t('subscription')} </Tab>
|
|
19
|
-
<Tab>{t('import')} </Tab>
|
|
20
|
-
<Tab>{t('previousImports')} </Tab>
|
|
17
|
+
<TabList aria-label="OCL tabs" className={styles.tabList} contained={true}>
|
|
18
|
+
<Tab>{t('subscription', 'Subscription')} </Tab>
|
|
19
|
+
<Tab>{t('import', 'Import')} </Tab>
|
|
20
|
+
<Tab>{t('previousImports', 'Previous Imports')} </Tab>
|
|
21
21
|
</TabList>
|
|
22
22
|
<TabPanels>
|
|
23
23
|
<TabPanel className={styles.tabPanel}>
|
package/src/root.scss
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@use "@carbon/colors";
|
|
2
|
+
@use "@carbon/layout";
|
|
3
|
+
@use "@carbon/type";
|
|
4
|
+
|
|
5
|
+
.main {
|
|
6
|
+
background-color: colors.$white-0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.moduleHeader {
|
|
10
|
+
@include type.type-style('heading-03');
|
|
11
|
+
padding-left: layout.$spacing-05;
|
|
12
|
+
padding-top: layout.$spacing-05;
|
|
13
|
+
padding-bottom: layout.$spacing-05;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.tabList {
|
|
17
|
+
padding: 0 layout.$spacing-05;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.tabPanel {
|
|
21
|
+
height: 100%;
|
|
22
|
+
background-color: colors.$gray-10;
|
|
23
|
+
}
|
package/src/root.test.tsx
CHANGED
|
@@ -10,10 +10,10 @@ describe(`Root component`, () => {
|
|
|
10
10
|
|
|
11
11
|
it(`renders the title and tab containers`, () => {
|
|
12
12
|
renderOclSubscriptionModule();
|
|
13
|
-
expect(screen.getByText('
|
|
14
|
-
expect(screen.getByRole('tab', { name: '
|
|
15
|
-
expect(screen.getByRole('tab', { name: '
|
|
16
|
-
expect(screen.getByRole('tab', { name: '
|
|
13
|
+
expect(screen.getByText('OCL Subscription Module')).toBeInTheDocument();
|
|
14
|
+
expect(screen.getByRole('tab', { name: 'Subscription' })).toBeInTheDocument();
|
|
15
|
+
expect(screen.getByRole('tab', { name: 'Import' })).toBeInTheDocument();
|
|
16
|
+
expect(screen.getByRole('tab', { name: 'Previous Imports' })).toBeInTheDocument();
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
19
|
|
package/src/routes.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.openmrs.org/routes.schema.json",
|
|
3
|
+
"backendDependencies": {
|
|
4
|
+
"openconceptlab": ">=1.2.0",
|
|
5
|
+
"webservices.rest": "^2.2.0"
|
|
6
|
+
},
|
|
7
|
+
"extensions": [
|
|
8
|
+
{
|
|
9
|
+
"name": "admin-ocl-card-link",
|
|
10
|
+
"slot": "system-admin-page-card-link-slot",
|
|
11
|
+
"component": "adminOclCardLink"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"pages": [
|
|
15
|
+
{
|
|
16
|
+
"component": "root",
|
|
17
|
+
"route": "ocl"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|