@openmrs/esm-openconceptlab-app 3.0.1-pre.5 → 3.0.1-pre.7
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 +19 -19
- package/dist/452.js +1 -0
- package/dist/574.js +1 -1
- package/dist/645.js +2 -0
- package/dist/{538.js.LICENSE.txt → 645.js.LICENSE.txt} +0 -0
- package/dist/862.js +1 -1
- package/dist/main.js +1 -1
- package/dist/openmrs-esm-openconceptlab-app.js +1 -1
- package/dist/openmrs-esm-openconceptlab-app.js.buildmanifest.json +42 -42
- package/dist/openmrs-esm-openconceptlab-app.old +1 -1
- package/package.json +2 -2
- package/src/previous-imports/import-overview/import-items.component.scss +24 -0
- package/src/previous-imports/import-overview/import-items.component.tsx +121 -0
- package/src/previous-imports/import-overview/import-items.resource.ts +10 -0
- package/src/previous-imports/import-overview/import-items.test.tsx +89 -0
- package/src/previous-imports/import-overview/import-overview.component.scss +11 -0
- package/src/previous-imports/import-overview/import-overview.component.tsx +65 -0
- package/src/previous-imports/import-overview/import-overview.test.tsx +83 -0
- package/src/previous-imports/previous-imports.component.scss +39 -0
- package/src/previous-imports/previous-imports.component.tsx +136 -0
- package/src/previous-imports/previous-imports.resource.ts +17 -0
- package/src/previous-imports/previous-imports.test.tsx +77 -0
- package/src/root.component.tsx +4 -1
- package/src/types.ts +10 -0
- package/translations/en.json +17 -1
- package/dist/15.js +0 -1
- package/dist/538.js +0 -2
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import { formatDatetime } from '@openmrs/esm-framework';
|
|
4
|
+
import { renderWithSwr } from '../../../../../tools/test-helpers';
|
|
5
|
+
import { mockPreviousImports } from '../../../../../__mocks__/openconceptlab.mock';
|
|
6
|
+
import { Import } from '../../types';
|
|
7
|
+
import ImportOverview from './import-overview.component';
|
|
8
|
+
|
|
9
|
+
describe(`Import Overview component`, () => {
|
|
10
|
+
it(`renders without dying`, () => {
|
|
11
|
+
renderImportOverviewComponent(mockPreviousImports[0]);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it(`renders the fields`, async () => {
|
|
15
|
+
renderImportOverviewComponent(mockPreviousImports[0]);
|
|
16
|
+
await waitForLoadingToFinish();
|
|
17
|
+
|
|
18
|
+
expect(screen.getByText('Started on')).toBeVisible();
|
|
19
|
+
expect(screen.getByText('Completed on')).toBeVisible();
|
|
20
|
+
expect(screen.getByText('Duration')).toBeVisible();
|
|
21
|
+
expect(screen.getByText('Result:')).toBeVisible();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it(`renders the import details when no errored items`, async () => {
|
|
25
|
+
const selectedImport = mockPreviousImports[0];
|
|
26
|
+
|
|
27
|
+
renderImportOverviewComponent(selectedImport);
|
|
28
|
+
await waitForLoadingToFinish();
|
|
29
|
+
|
|
30
|
+
const startedTimeText = formatDatetime(selectedImport.localDateStarted);
|
|
31
|
+
const stoppedTimeText = formatDatetime(selectedImport.localDateStopped);
|
|
32
|
+
const upToDateItemsText = selectedImport.upToDateItemsCount + ' concepts up to date';
|
|
33
|
+
const addedItemsText = selectedImport.addedItemsCount + ' concepts added';
|
|
34
|
+
const updatedItemsText = selectedImport.updatedItemsCount + ' concepts updated';
|
|
35
|
+
const retiredItemsText = selectedImport.retiredItemsCount + ' concepts retired';
|
|
36
|
+
const errorItemsText = selectedImport.errorItemsCount + ' errors found';
|
|
37
|
+
const ignoredErrorsText = selectedImport.ignoredErrorsCount + ' errors ignored';
|
|
38
|
+
|
|
39
|
+
expect(screen.getByText(startedTimeText)).toBeVisible();
|
|
40
|
+
expect(screen.getByText(stoppedTimeText)).toBeVisible();
|
|
41
|
+
expect(screen.getByText(upToDateItemsText)).toBeVisible();
|
|
42
|
+
expect(screen.getByText(addedItemsText)).toBeVisible();
|
|
43
|
+
expect(screen.getByText(updatedItemsText)).toBeVisible();
|
|
44
|
+
expect(screen.getByText(retiredItemsText)).toBeVisible();
|
|
45
|
+
expect(screen.getByText(errorItemsText)).toBeVisible();
|
|
46
|
+
expect(screen.getByText(ignoredErrorsText)).toBeVisible();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it(`renders the import details when there are errored items`, async () => {
|
|
50
|
+
const selectedImport = mockPreviousImports[1];
|
|
51
|
+
|
|
52
|
+
renderImportOverviewComponent(selectedImport);
|
|
53
|
+
await waitForLoadingToFinish();
|
|
54
|
+
|
|
55
|
+
const startedTimeText = formatDatetime(selectedImport.localDateStarted);
|
|
56
|
+
const stoppedTimeText = formatDatetime(selectedImport.localDateStopped);
|
|
57
|
+
const upToDateItemsText = selectedImport.upToDateItemsCount + ' concepts up to date';
|
|
58
|
+
const addedItemsText = selectedImport.addedItemsCount + ' concepts added';
|
|
59
|
+
const updatedItemsText = selectedImport.updatedItemsCount + ' concepts updated';
|
|
60
|
+
const retiredItemsText = selectedImport.retiredItemsCount + ' concepts retired';
|
|
61
|
+
const errorItemsText = selectedImport.errorItemsCount + ' errors found';
|
|
62
|
+
const ignoredErrorsText = selectedImport.ignoredErrorsCount + ' errors ignored';
|
|
63
|
+
|
|
64
|
+
expect(screen.getByText(startedTimeText)).toBeVisible();
|
|
65
|
+
expect(screen.getByText(stoppedTimeText)).toBeVisible();
|
|
66
|
+
expect(screen.getByText(upToDateItemsText)).toBeVisible();
|
|
67
|
+
expect(screen.getByText(addedItemsText)).toBeVisible();
|
|
68
|
+
expect(screen.getByText(updatedItemsText)).toBeVisible();
|
|
69
|
+
expect(screen.getByText(retiredItemsText)).toBeVisible();
|
|
70
|
+
expect(screen.getByText(errorItemsText)).toBeVisible();
|
|
71
|
+
expect(screen.getByText(ignoredErrorsText)).toBeVisible();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
function renderImportOverviewComponent(importObject: Import) {
|
|
76
|
+
renderWithSwr(<ImportOverview selectedImportObject={importObject} />);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function waitForLoadingToFinish() {
|
|
80
|
+
return waitFor(() => {
|
|
81
|
+
expect(screen.getByText('Started on')).toBeVisible(), { timeout: 2000 };
|
|
82
|
+
});
|
|
83
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
@use "@carbon/styles/scss/spacing";
|
|
2
|
+
@use "@carbon/styles/scss/type";
|
|
3
|
+
@import "~@openmrs/esm-styleguide/src/vars";
|
|
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('productive-heading-03');
|
|
14
|
+
margin-bottom: spacing.$spacing-03;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pagination {
|
|
18
|
+
@include type.type-style('body-short-01');
|
|
19
|
+
background-color: $ui-02;
|
|
20
|
+
color: $text-02;
|
|
21
|
+
border: 1px solid $ui-03;
|
|
22
|
+
display: flex;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tableBordered {
|
|
26
|
+
border: 1px solid $ui-03;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.tableRow > td {
|
|
30
|
+
background-color: $ui-02;
|
|
31
|
+
border-bottom: 1px solid $ui-03 !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.tableExpandedRow > td {
|
|
35
|
+
padding-left: spacing.$spacing-09 !important;
|
|
36
|
+
padding-right: spacing.$spacing-09;
|
|
37
|
+
padding-top: spacing.$spacing-05;
|
|
38
|
+
padding-bottom: spacing.$spacing-05;
|
|
39
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { formatDatetime, showNotification, usePagination } from '@openmrs/esm-framework';
|
|
2
|
+
import {
|
|
3
|
+
Column,
|
|
4
|
+
DataTable,
|
|
5
|
+
DataTableSkeleton,
|
|
6
|
+
Pagination,
|
|
7
|
+
PaginationSkeleton,
|
|
8
|
+
Grid,
|
|
9
|
+
SkeletonText,
|
|
10
|
+
Table,
|
|
11
|
+
TableBody,
|
|
12
|
+
TableCell,
|
|
13
|
+
TableExpandedRow,
|
|
14
|
+
TableExpandHeader,
|
|
15
|
+
TableExpandRow,
|
|
16
|
+
TableHead,
|
|
17
|
+
TableHeader,
|
|
18
|
+
TableRow,
|
|
19
|
+
} from '@carbon/react';
|
|
20
|
+
import React, { Fragment, useState } from 'react';
|
|
21
|
+
import { useTranslation } from 'react-i18next';
|
|
22
|
+
import { usePreviousImports } from './previous-imports.resource';
|
|
23
|
+
import styles from './previous-imports.component.scss';
|
|
24
|
+
import { Import } from '../types';
|
|
25
|
+
import ImportOverview from './import-overview/import-overview.component';
|
|
26
|
+
|
|
27
|
+
const PreviousImports: React.FC = () => {
|
|
28
|
+
const { t } = useTranslation();
|
|
29
|
+
const [pageSize, setPageSize] = useState(10);
|
|
30
|
+
|
|
31
|
+
const { data: prevImports, isLoading, isError } = usePreviousImports();
|
|
32
|
+
const { results, currentPage, goTo } = usePagination(prevImports, pageSize);
|
|
33
|
+
|
|
34
|
+
if (isLoading) {
|
|
35
|
+
return (
|
|
36
|
+
<Grid className={styles.grid}>
|
|
37
|
+
<Column sm={4} md={8} lg={10}>
|
|
38
|
+
<SkeletonText className={styles.productiveHeading03} />
|
|
39
|
+
<DataTableSkeleton showHeader={false} showToolbar={false} rowCount={10} columnCount={3} />
|
|
40
|
+
<PaginationSkeleton />
|
|
41
|
+
</Column>
|
|
42
|
+
</Grid>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (isError) {
|
|
47
|
+
showNotification({
|
|
48
|
+
kind: 'error',
|
|
49
|
+
description: t('previousImportsFetchError', 'Error occured while fetching the imports'),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const headerData = [
|
|
54
|
+
{
|
|
55
|
+
header: t('dateAndTime', 'Date and Time'),
|
|
56
|
+
key: 'localDateStarted',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
header: t('duration', 'Duration'),
|
|
60
|
+
key: 'importTime',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
header: t('status', 'Status'),
|
|
64
|
+
key: 'status',
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
const rowData = results?.map((prevImport) => {
|
|
69
|
+
return {
|
|
70
|
+
id: prevImport.uuid,
|
|
71
|
+
localDateStarted: formatDatetime(new Date(prevImport.localDateStarted)),
|
|
72
|
+
importTime: prevImport.importTime,
|
|
73
|
+
status: prevImport.status,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
!isLoading &&
|
|
79
|
+
!isError && (
|
|
80
|
+
<Grid className={styles.grid}>
|
|
81
|
+
<Column sm={4} md={8} lg={10}>
|
|
82
|
+
<h3 className={styles.productiveHeading03}>{t('previousImports', 'Previous Imports')}</h3>
|
|
83
|
+
|
|
84
|
+
<DataTable rows={rowData} headers={headerData} size="sm">
|
|
85
|
+
{({ rows, headers, getHeaderProps, getRowProps, getTableProps }) => (
|
|
86
|
+
<Table {...getTableProps()} className={styles.tableBordered}>
|
|
87
|
+
<TableHead>
|
|
88
|
+
<TableRow>
|
|
89
|
+
<TableExpandHeader />
|
|
90
|
+
{headers.map((header, i) => (
|
|
91
|
+
<TableHeader key={i} {...getHeaderProps({ header })}>
|
|
92
|
+
{header.header}
|
|
93
|
+
</TableHeader>
|
|
94
|
+
))}
|
|
95
|
+
</TableRow>
|
|
96
|
+
</TableHead>
|
|
97
|
+
<TableBody>
|
|
98
|
+
{rows.map((row) => (
|
|
99
|
+
<Fragment key={row.id}>
|
|
100
|
+
<TableExpandRow {...getRowProps({ row })} className={styles.tableRow}>
|
|
101
|
+
{row.cells.map((cell) => (
|
|
102
|
+
<TableCell key={cell.id}>{cell.value}</TableCell>
|
|
103
|
+
))}
|
|
104
|
+
</TableExpandRow>
|
|
105
|
+
{row.isExpanded && (
|
|
106
|
+
<TableExpandedRow colSpan={headers.length + 1} className={styles.tableExpandedRow}>
|
|
107
|
+
<ImportOverview
|
|
108
|
+
selectedImportObject={prevImports.find((importItem: Import) => importItem.uuid === row.id)}
|
|
109
|
+
/>
|
|
110
|
+
</TableExpandedRow>
|
|
111
|
+
)}
|
|
112
|
+
</Fragment>
|
|
113
|
+
))}
|
|
114
|
+
</TableBody>
|
|
115
|
+
</Table>
|
|
116
|
+
)}
|
|
117
|
+
</DataTable>
|
|
118
|
+
<Pagination
|
|
119
|
+
className={styles.pagination}
|
|
120
|
+
size="sm"
|
|
121
|
+
page={currentPage}
|
|
122
|
+
pageSize={pageSize}
|
|
123
|
+
pageSizes={[10, 20, 50, 100]}
|
|
124
|
+
totalItems={prevImports.length}
|
|
125
|
+
onChange={({ page, pageSize }) => {
|
|
126
|
+
goTo(page);
|
|
127
|
+
setPageSize(pageSize);
|
|
128
|
+
}}
|
|
129
|
+
/>
|
|
130
|
+
</Column>
|
|
131
|
+
</Grid>
|
|
132
|
+
)
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export default PreviousImports;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import useSWR from 'swr';
|
|
3
|
+
import { Import } from '../types';
|
|
4
|
+
|
|
5
|
+
export function usePreviousImports() {
|
|
6
|
+
const { data, error, isValidating } = useSWR<{ data: { results: Import[] } }, Error>(
|
|
7
|
+
'/ws/rest/v1/openconceptlab/import?v=full',
|
|
8
|
+
openmrsFetch,
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
data: data?.data?.results,
|
|
13
|
+
isLoading: !data && !error,
|
|
14
|
+
isError: error,
|
|
15
|
+
isValidating,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import { formatDatetime, openmrsFetch, usePagination } from '@openmrs/esm-framework';
|
|
4
|
+
import { renderWithSwr } from '../../../../tools/test-helpers';
|
|
5
|
+
import { mockPreviousImports } from '../../../../__mocks__/openconceptlab.mock';
|
|
6
|
+
import { Import } from '../types';
|
|
7
|
+
import PreviousImports from './previous-imports.component';
|
|
8
|
+
|
|
9
|
+
const mockOpenmrsFetch = openmrsFetch as jest.Mock;
|
|
10
|
+
const mockUsePagination = usePagination as jest.Mock;
|
|
11
|
+
|
|
12
|
+
jest.mock('@openmrs/esm-framework', () => {
|
|
13
|
+
const originalModule = jest.requireActual('@openmrs/esm-framework');
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
...originalModule,
|
|
17
|
+
usePagination: jest.fn(),
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe(`Previous Imports component`, () => {
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
mockUsePagination.mockReset();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it(`renders without dying`, () => {
|
|
27
|
+
mockUsePagination.mockReturnValue({
|
|
28
|
+
currentPage: 1,
|
|
29
|
+
goTo: () => {},
|
|
30
|
+
results: [],
|
|
31
|
+
});
|
|
32
|
+
renderPreviousImportsComponent();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it(`renders the table`, async () => {
|
|
36
|
+
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: [] } });
|
|
37
|
+
mockUsePagination.mockReturnValue({
|
|
38
|
+
currentPage: 1,
|
|
39
|
+
goTo: () => {},
|
|
40
|
+
results: [],
|
|
41
|
+
});
|
|
42
|
+
renderPreviousImportsComponent();
|
|
43
|
+
await waitForLoadingToFinish();
|
|
44
|
+
|
|
45
|
+
expect(screen.getByText('Previous Imports')).toBeVisible();
|
|
46
|
+
expect(screen.getByText('Date and Time')).toBeVisible();
|
|
47
|
+
expect(screen.getByText('Duration')).toBeVisible();
|
|
48
|
+
expect(screen.getByText('Status')).toBeVisible();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it(`renders the previous imports correctly`, async () => {
|
|
52
|
+
mockOpenmrsFetch.mockReturnValueOnce({ data: { results: mockPreviousImports } });
|
|
53
|
+
mockUsePagination.mockReturnValue({
|
|
54
|
+
currentPage: 1,
|
|
55
|
+
goTo: () => {},
|
|
56
|
+
results: mockPreviousImports,
|
|
57
|
+
});
|
|
58
|
+
renderPreviousImportsComponent();
|
|
59
|
+
await waitForLoadingToFinish();
|
|
60
|
+
|
|
61
|
+
mockPreviousImports.forEach((item: Import) => {
|
|
62
|
+
expect(screen.getByText(formatDatetime(item.localDateStarted))).toBeVisible();
|
|
63
|
+
expect(screen.getByText(item.importTime)).toBeVisible();
|
|
64
|
+
expect(screen.getByText(item.status)).toBeVisible();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
function renderPreviousImportsComponent() {
|
|
70
|
+
renderWithSwr(<PreviousImports />);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function waitForLoadingToFinish() {
|
|
74
|
+
return waitFor(() => {
|
|
75
|
+
expect(screen.getByText('Previous Imports')).toBeVisible(), { timeout: 2000 };
|
|
76
|
+
});
|
|
77
|
+
}
|
package/src/root.component.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { SWRConfig } from 'swr';
|
|
|
5
5
|
import Subscription from './subscription/subscription.component';
|
|
6
6
|
import styles from './root.component.scss';
|
|
7
7
|
import Import from './import/import.component';
|
|
8
|
+
import PreviousImports from './previous-imports/previous-imports.component';
|
|
8
9
|
|
|
9
10
|
const Root: React.FC = () => {
|
|
10
11
|
const { t } = useTranslation();
|
|
@@ -25,7 +26,9 @@ const Root: React.FC = () => {
|
|
|
25
26
|
<TabPanel className={styles.tabPanel}>
|
|
26
27
|
<Import />
|
|
27
28
|
</TabPanel>
|
|
28
|
-
<TabPanel className={styles.tabPanel}
|
|
29
|
+
<TabPanel className={styles.tabPanel}>
|
|
30
|
+
<PreviousImports />
|
|
31
|
+
</TabPanel>
|
|
29
32
|
</TabPanels>
|
|
30
33
|
</Tabs>
|
|
31
34
|
</main>
|
package/src/types.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface Import {
|
|
|
14
14
|
errorMessage: string;
|
|
15
15
|
importProgress: number;
|
|
16
16
|
allItemsCount: number;
|
|
17
|
+
addedItemsCount: number;
|
|
17
18
|
errorItemsCount: number;
|
|
18
19
|
ignoredErrorsCount: number;
|
|
19
20
|
updatedItemsCount: number;
|
|
@@ -22,3 +23,12 @@ export interface Import {
|
|
|
22
23
|
unretiredItemsCount: number;
|
|
23
24
|
status: string;
|
|
24
25
|
}
|
|
26
|
+
|
|
27
|
+
export interface ImportItem {
|
|
28
|
+
uuid: string;
|
|
29
|
+
errorMessage: string;
|
|
30
|
+
type: 'CONCEPT' | 'MAPPING';
|
|
31
|
+
versionUrl: string;
|
|
32
|
+
updatedOn: Date;
|
|
33
|
+
state: 'ADDED' | 'UPDATED' | 'RETIRED' | 'UNRETIRED' | 'ERROR' | 'IGNORED_ERROR' | 'UP_TO_DATE' | 'DUPLICATE';
|
|
34
|
+
}
|
package/translations/en.json
CHANGED
|
@@ -33,5 +33,21 @@
|
|
|
33
33
|
"noFileSelected": "No file selected",
|
|
34
34
|
"noSubscriptionError": "No saved subscription",
|
|
35
35
|
"fileFormatError": "Only .zip files are allowed",
|
|
36
|
-
"subscriptionError": "Error occured while fetching the subscription"
|
|
36
|
+
"subscriptionError": "Error occured while fetching the subscription",
|
|
37
|
+
"previousImportsFetchError": "Error occured while fetching the imports",
|
|
38
|
+
"dateAndTime": "Date and Time",
|
|
39
|
+
"duration": "Duration",
|
|
40
|
+
"status": "Status",
|
|
41
|
+
"startedOn": "Started on",
|
|
42
|
+
"completedOn": "Completed on",
|
|
43
|
+
"result": "Result:",
|
|
44
|
+
"conceptsUpToDate": "concepts up to date",
|
|
45
|
+
"conceptsAdded": "concepts added",
|
|
46
|
+
"conceptsUpdated": "concepts updated",
|
|
47
|
+
"conceptsRetired": "concepts retired",
|
|
48
|
+
"errorsFound": "errors found",
|
|
49
|
+
"errorsIgnored": "errors ignored",
|
|
50
|
+
"importItemsFetchError": "Error occured while fetching the import items",
|
|
51
|
+
"conceptOrMapping": "Concept/Mapping",
|
|
52
|
+
"message": "Message"
|
|
37
53
|
}
|
package/dist/15.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_openmrs_esm_openconceptlab_app=self.webpackChunk_openmrs_esm_openconceptlab_app||[]).push([[15],{2015:(e,t,n)=>{n.r(t),n.d(t,{default:()=>oe});var r=n(4507),o=n(268),a=n.n(o),i=n(4924),c=n(9857),s=n(5047),l=n.n(s),u=n(906),p=n(9140);function m(e,t,n,r,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){m(a,r,o,i,c,"next",e)}function c(e){m(a,r,o,i,c,"throw",e)}i(void 0)}))}}function b(e,t){return f.apply(this,arguments)}function f(){return(f=d(l().mark((function e(t,n){var r;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=(0,p.Z)(t.uuid)?"/ws/rest/v1/openconceptlab/subscription":"/ws/rest/v1/openconceptlab/subscription/".concat(t.uuid),e.abrupt("return",(0,u.openmrsFetch)(r,{method:"POST",body:t,headers:{"Content-Type":"application/json"},signal:null==n?void 0:n.signal}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(e,t){return g.apply(this,arguments)}function g(){return(g=d(l().mark((function e(t,n){var r;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r="/ws/rest/v1/openconceptlab/subscription/".concat(t.uuid),e.abrupt("return",(0,u.openmrsFetch)(r,{method:"DELETE",signal:null==n?void 0:n.signal}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var v=n(6062),h=n.n(v),y=n(4036),E=n.n(y),w=n(6793),k=n.n(w),N=n(7892),x=n.n(N),S=n(1173),T=n.n(S),P=n(2464),O=n.n(P),C=n(7542),F={};F.styleTagTransform=O(),F.setAttributes=x(),F.insert=k().bind(null,"head"),F.domAPI=E(),F.insertStyleElement=T(),h()(C.Z,F);const j=C.Z&&C.Z.locals?C.Z.locals:void 0;function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Z(e,t,n,r,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function D(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Z(a,r,o,i,c,"next",e)}function c(e){Z(a,r,o,i,c,"throw",e)}i(void 0)}))}}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){L(e,t,n[t])}))}return e}function z(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n}(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})),e}function B(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const I=function(){var e=(0,i.useTranslation)().t,t=(0,c.kY)().mutate,n=B((0,o.useState)(""),2),s=n[0],p=n[1],m=B((0,o.useState)(""),2),d=m[0],f=m[1],g=B((0,o.useState)(!1),2),v=g[0],h=g[1],y=B((0,o.useState)("FULL"),2),E=y[0],w=y[1],k=function(){var e,t=(0,c.ZP)("/ws/rest/v1/openconceptlab/subscription?v=full",u.openmrsFetch),n=t.data,r=t.error,o=t.isValidating;return{data:null==n||null===(e=n.data)||void 0===e?void 0:e.results[0],isLoading:!n&&!r,isError:r,isValidating:o}}(),N=k.data,x=k.isLoading,S=k.isError;(0,o.useEffect)((function(){x||S||(p((null==N?void 0:N.url)||""),f((null==N?void 0:N.token)||""),h((null==N?void 0:N.subscribedToSnapshot)||!1),w((null==N?void 0:N.validationType)||"FULL"))}),[x,S,N]);var T,P=(0,o.useCallback)((function(e){p(e.target.value)}),[]),O=(0,o.useCallback)((function(e){f(e.target.value)}),[]),C=(0,o.useCallback)((function(e){w(e?"NONE":"FULL")}),[]),F=(0,o.useCallback)((function(e){h(e)}),[]),A=(0,o.useCallback)((T=D(l().mark((function n(r){var o,a,i;return l().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r.preventDefault(),r.stopPropagation(),o=new AbortController,a=z(H({},N),{url:s,token:d,validationType:E,subscribedToSnapshot:v}),t("/ws/rest/v1/openconceptlab/subscription?v=full",a,!1),n.next=7,b(a,o);case 7:return i=n.sent,t("/ws/rest/v1/openconceptlab/subscription?v=full"),i.ok?(0,u.showNotification)({kind:"success",description:e(201===i.status?"subscriptionCreated":"subscriptionUpdated")}):(0,u.showNotification)({title:e("errorSavingSubscription"),kind:"error",critical:!0,description:JSON.stringify(i.data)}),n.abrupt("return",(function(){return o.abort()}));case 11:case"end":return n.stop()}}),n)}))),function(e){return T.apply(this,arguments)}),[s,d,E,v,e,N,t]),Z=(0,o.useCallback)((function(){p((null==N?void 0:N.url)||""),f((null==N?void 0:N.token)||""),h((null==N?void 0:N.subscribedToSnapshot)||!1),w((null==N?void 0:N.validationType)||"FULL"),(0,u.showNotification)({kind:"info",description:e("cancelledChanges")})}),[N,e]),L=(0,o.useCallback)(function(){var n=D(l().mark((function n(r){var o,a;return l().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r.preventDefault(),r.stopPropagation(),o=new AbortController,n.next=5,_(N,o);case 5:return a=n.sent,t("/ws/rest/v1/openconceptlab/subscription?v=full"),204===a.status?(p(""),f(""),h(!1),w("FULL"),(0,u.showNotification)({kind:"success",description:e("subscriptionDeleted")})):(0,u.showNotification)({title:e("errorDeletingSubscription"),kind:"error",critical:!0,description:JSON.stringify(a.data)}),n.abrupt("return",(function(){return o.abort()}));case 9:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}(),[N,e,t]);return x?a().createElement(r.rjZ,{className:j.grid},a().createElement(r.sgG,{sm:4,md:8,lg:10},a().createElement(r.l09,null,a().createElement(r.N2B,{className:j.productiveHeading03}),a().createElement(r.Kqy,{gap:5},a().createElement(r.znL,null),a().createElement(r.znL,null),a().createElement(r.cwH,{legendText:a().createElement(r.N2B,{width:"75px"}),className:j.formGroup},a().createElement(r.jJq,null),a().createElement(r.jJq,null))),a().createElement(r.Db,null),a().createElement(r.Db,null)),a().createElement(r.l09,{className:j.unsubscribeForm},a().createElement(r.N2B,{className:j.productiveHeading03}),a().createElement(r.N2B,{className:j.unsubscribeText}),a().createElement(r.Db,null)))):(S&&(0,u.showNotification)({kind:"error",description:e("subscriptionError")}),a().createElement(r.rjZ,{className:j.grid},a().createElement(r.sgG,{sm:4,md:8,lg:10},a().createElement(r.l09,{onSubmit:A},a().createElement("h3",{className:j.productiveHeading03},e("setupSubscription")),a().createElement(r.Kqy,{gap:5},a().createElement(r.oil,{id:"subscriptionUrl",type:"url",labelText:e("subscriptionUrl"),placeholder:"https://api.openconceptlab.org/orgs/organization-name/collections/dictionary-name",value:s,onChange:P,light:!0,required:!0}),a().createElement(r.oil,{id:"apiToken",type:"password",placeholder:"••••••••••••••••••••••••••••••••••••••••••••••••",labelText:e("apiToken"),value:d,onChange:O,light:!0,required:!0}),a().createElement(r.cwH,{legendText:e("advancedOptions"),className:j.formGroup},a().createElement(r.XZJ,{checked:v,onChange:F,labelText:e("subscribeToSnapshotText"),id:"isSubscribedToSnapshot"}),a().createElement(r.XZJ,{checked:"NONE"===E,onChange:C,labelText:e("disableValidationText"),id:"isValidationDisabled"}))),a().createElement(r.zxk,{kind:"secondary",onClick:Z},e("cancelButton")),a().createElement(r.zxk,{kind:"primary",type:"submit"},e("subscribeButton"))),a().createElement(r.l09,{onSubmit:L,className:j.unsubscribeForm},a().createElement("h3",{className:j.productiveHeading03},e("unsubscribe")),a().createElement("p",{className:j.unsubscribeText},e("unsubscribeInfo")),a().createElement(r.zxk,{kind:"danger",type:"submit",disabled:!N},e("unsubscribeButton"))))))};var G=n(302),U={};U.styleTagTransform=O(),U.setAttributes=x(),U.insert=k().bind(null,"head"),U.domAPI=E(),U.insertStyleElement=T(),h()(G.Z,U);const K=G.Z&&G.Z.locals?G.Z.locals:void 0;var J=n(3111),q={};q.styleTagTransform=O(),q.setAttributes=x(),q.insert=k().bind(null,"head"),q.domAPI=E(),q.insertStyleElement=T(),h()(J.Z,q);const V=J.Z&&J.Z.locals?J.Z.locals:void 0;function M(e,t,n,r,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function X(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){M(a,r,o,i,c,"next",e)}function c(e){M(a,r,o,i,c,"throw",e)}i(void 0)}))}}function Y(e){return $.apply(this,arguments)}function $(){return($=X(l().mark((function e(t){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,u.openmrsFetch)("/ws/rest/v1/openconceptlab/import",{method:"POST",body:{},headers:{"Content-Type":"application/json"},signal:null==t?void 0:t.signal}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(e,t){return Q.apply(this,arguments)}function Q(){return(Q=X(l().mark((function e(t,n){var r;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=new FormData).append("file",t),e.abrupt("return",(0,u.openmrsFetch)("/ws/rest/v1/openconceptlab/import",{method:"POST",body:r,signal:null==n?void 0:n.signal}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ee(e,t,n,r,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,o)}function te(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ee(a,r,o,i,c,"next",e)}function c(e){ee(a,r,o,i,c,"throw",e)}i(void 0)}))}}function ne(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],i=!0,c=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==n.return||n.return()}finally{if(c)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return R(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const re=function(){var e=(0,i.useTranslation)().t,t=ne((0,o.useState)(!1),2),n=t[0],s=t[1],p=ne((0,o.useState)(),2),m=p[0],d=p[1],b=function(){var e,t=(0,c.ZP)("/ws/rest/v1/openconceptlab/subscription?v=full",u.openmrsFetch),n=t.data,r=t.error,o=t.isValidating;return{data:null==n||null===(e=n.data)||void 0===e?void 0:e.results[0],isLoading:!n&&!r,isError:r,isValidating:o}}(),f=b.data,_=b.isLoading,g=b.isError;(0,o.useEffect)((function(){_||g||s(!!f)}),[_,g,f]);var v,h=(0,o.useCallback)((function(t,n){var r=n.addedFiles[0];"application/zip"!==r.type?(0,u.showNotification)({kind:"error",description:e("fileFormatError")}):d(r)}),[e]),y=(0,o.useCallback)((function(){d(null)}),[]),E=(0,o.useCallback)((v=te(l().mark((function t(r){var o;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r.preventDefault(),r.stopPropagation(),n){t.next=5;break}return(0,u.showNotification)({kind:"error",description:e("noSubscriptionError")}),t.abrupt("return");case 5:return o=new AbortController,t.next=8,Y(o);case 8:201===t.sent.status?(0,u.showNotification)({kind:"success",description:e("importSuccess")}):(0,u.showNotification)({kind:"error",description:e("importFailed")});case 10:case"end":return t.stop()}}),t)}))),function(e){return v.apply(this,arguments)}),[n,e]),w=(0,o.useCallback)(function(){var t=te(l().mark((function t(n){var r;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n.preventDefault(),n.stopPropagation(),m){t.next=5;break}return(0,u.showNotification)({kind:"error",description:e("noFileSelected")}),t.abrupt("return");case 5:return r=new AbortController,t.next=8,W(m,r);case 8:201===t.sent.status?(d(null),(0,u.showNotification)({kind:"success",description:e("importSuccess")})):(0,u.showNotification)({kind:"error",description:e("importFailed")});case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),[m,e]);return _?a().createElement(r.rjZ,{className:V.grid},a().createElement(r.sgG,{sm:4,md:8,lg:10},a().createElement(r.l09,null,a().createElement(r.N2B,{className:V.productiveHeading03,heading:!0}),a().createElement(r.N2B,{className:V.formText,paragraph:!0,lineCount:2}),a().createElement(r.Db,null)),a().createElement(r.l09,{className:V.form},a().createElement(r.N2B,{className:V.productiveHeading03,heading:!0}),a().createElement(r.N2B,{className:V.formText}),a().createElement(r.rhD,{style:{marginBottom:"1.5rem"}}),a().createElement(r.Db,null)))):(g&&(0,u.showNotification)({kind:"error",description:e("subscriptionError")}),a().createElement(r.rjZ,{className:V.grid},a().createElement(r.sgG,{sm:4,md:8,lg:10},a().createElement(r.l09,{onSubmit:E},a().createElement("h3",{className:V.productiveHeading03},e("importConcepts")),a().createElement("p",{className:V.formText},e("importInstructions")),a().createElement(r.zxk,{kind:"primary",type:"submit",disabled:!n},e("importFromSubscription"))),a().createElement(r.l09,{className:V.form,onSubmit:w},a().createElement("h3",{className:V.productiveHeading03},e("importFromFileHeading")),a().createElement("p",{className:V.formText},e("importFromFileInfo")),m?a().createElement(r.Py3,{key:m.name,name:m.name,size:"default",status:"edit",iconDescription:e("fileAdded"),onDelete:y,style:{backgroundColor:"#e0e0e0"}}):a().createElement(r.awp,{accept:["application/zip"],multiple:!0,labelText:e("importFromFileDragInfo"),onAddFiles:h,style:{marginBottom:"1.5rem"}}),a().createElement(r.zxk,{kind:"primary",type:"submit"},e("importFromFile"))))))},oe=function(){var e=(0,i.useTranslation)().t;return a().createElement(c.J$,null,a().createElement("main",{className:"omrs-main-content ".concat(K.main)},a().createElement("h3",{className:K.moduleHeader},e("moduleTitle")),a().createElement(r.mQc,null,a().createElement(r.tdY,{className:K.tabList,contained:!0},a().createElement(r.OK9,null,e("subscription")," "),a().createElement(r.OK9,null,e("import")," "),a().createElement(r.OK9,null,e("previousImports")," ")),a().createElement(r.nPR,null,a().createElement(r.x45,{className:K.tabPanel},a().createElement(I,null)),a().createElement(r.x45,{className:K.tabPanel},a().createElement(re,null)),a().createElement(r.x45,{className:K.tabPanel})))))}},3111:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),o=n.n(r)()((function(e){return e[1]}));o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-openconceptlab__import-component__grid___5wW0H{margin-left:0;margin-right:0;padding-left:0;padding-right:0}.-esm-openconceptlab__import-component__productiveHeading03___m6cC7{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0);margin-bottom:.5rem}.-esm-openconceptlab__import-component__form___BAtOz{margin-top:2rem}.-esm-openconceptlab__import-component__formText___-LFNS{padding-bottom:1rem}.-esm-openconceptlab__import-component__fileUploaderDropContainer___u9wb\\+{margin-bottom:1.5rem}",""]),o.locals={grid:"-esm-openconceptlab__import-component__grid___5wW0H",productiveHeading03:"-esm-openconceptlab__import-component__productiveHeading03___m6cC7",form:"-esm-openconceptlab__import-component__form___BAtOz",formText:"-esm-openconceptlab__import-component__formText___-LFNS",fileUploaderDropContainer:"-esm-openconceptlab__import-component__fileUploaderDropContainer___u9wb+"};const a=o},302:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),o=n.n(r)()((function(e){return e[1]}));o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-openconceptlab__root-component__main___G0\\+lN{background-color:#fff}.-esm-openconceptlab__root-component__moduleHeader___yB-PY{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0);padding-left:1rem;padding-top:1rem;padding-bottom:1rem}.-esm-openconceptlab__root-component__tabList___aXyg4{padding:0 1rem}.-esm-openconceptlab__root-component__tabPanel___2e0wL{height:100%;background-color:#f4f4f4}",""]),o.locals={main:"-esm-openconceptlab__root-component__main___G0+lN",moduleHeader:"-esm-openconceptlab__root-component__moduleHeader___yB-PY",tabList:"-esm-openconceptlab__root-component__tabList___aXyg4",tabPanel:"-esm-openconceptlab__root-component__tabPanel___2e0wL"};const a=o},7542:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(2609),o=n.n(r)()((function(e){return e[1]}));o.push([e.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-openconceptlab__subscription-component__grid___Kwugy{margin-left:0;margin-right:0;padding-left:0;padding-right:0}.-esm-openconceptlab__subscription-component__productiveHeading03___xgZur{font-size:var(--cds-productive-heading-03-font-size, 1.25rem);font-weight:var(--cds-productive-heading-03-font-weight, 400);line-height:var(--cds-productive-heading-03-line-height, 1.4);letter-spacing:var(--cds-productive-heading-03-letter-spacing, 0);margin-bottom:.5rem}.-esm-openconceptlab__subscription-component__formGroup___GmK5h{margin-bottom:1rem}.-esm-openconceptlab__subscription-component__unsubscribeText___B9jCa{padding-bottom:1rem}.-esm-openconceptlab__subscription-component__unsubscribeForm___dMi0v{margin-top:1rem}",""]),o.locals={grid:"-esm-openconceptlab__subscription-component__grid___Kwugy",productiveHeading03:"-esm-openconceptlab__subscription-component__productiveHeading03___xgZur",formGroup:"-esm-openconceptlab__subscription-component__formGroup___GmK5h",unsubscribeText:"-esm-openconceptlab__subscription-component__unsubscribeText___B9jCa",unsubscribeForm:"-esm-openconceptlab__subscription-component__unsubscribeForm___dMi0v"};const a=o}}]);
|