@kenyaemr/esm-admin-app 5.4.4-pre.5 → 5.4.4-pre.501
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 +5 -12
- package/dist/1102.js +1 -0
- package/dist/1102.js.map +1 -0
- package/dist/1278.js +1 -0
- package/dist/1278.js.map +1 -0
- package/dist/1442.js +1 -0
- package/dist/1442.js.map +1 -0
- package/dist/15.js +1 -0
- package/dist/15.js.map +1 -0
- package/dist/162.js +1 -0
- package/dist/162.js.map +1 -0
- package/dist/1620.js +1 -0
- package/dist/1620.js.map +1 -0
- package/dist/1789.js +1 -0
- package/dist/1789.js.map +1 -0
- package/dist/1831.js +1 -0
- package/dist/1831.js.map +1 -0
- package/dist/1844.js +1 -0
- package/dist/1844.js.map +1 -0
- package/dist/1854.js +1 -0
- package/dist/1854.js.map +1 -0
- package/dist/1919.js +1 -0
- package/dist/1919.js.map +1 -0
- package/dist/193.js +1 -0
- package/dist/193.js.map +1 -0
- package/dist/1946.js +1 -0
- package/dist/1946.js.map +1 -0
- package/dist/2007.js +1 -0
- package/dist/2007.js.map +1 -0
- package/dist/2043.js +1 -0
- package/dist/2043.js.map +1 -0
- package/dist/2127.js +1 -0
- package/dist/2127.js.map +1 -0
- package/dist/2146.js +1 -0
- package/dist/2146.js.map +1 -0
- package/dist/2152.js +1 -0
- package/dist/2152.js.map +1 -0
- package/dist/2202.js +1 -0
- package/dist/2202.js.map +1 -0
- package/dist/2258.js +1 -0
- package/dist/2258.js.map +1 -0
- package/dist/2394.js +1 -0
- package/dist/2394.js.map +1 -0
- package/dist/2468.js +1 -0
- package/dist/2468.js.map +1 -0
- package/dist/2534.js +1 -0
- package/dist/2534.js.map +1 -0
- package/dist/2556.js +1 -0
- package/dist/2556.js.map +1 -0
- package/dist/26.js +1 -0
- package/dist/26.js.map +1 -0
- package/dist/2638.js +1 -0
- package/dist/2638.js.map +1 -0
- package/dist/2648.js +1 -0
- package/dist/2648.js.map +1 -0
- package/dist/2709.js +1 -0
- package/dist/2709.js.map +1 -0
- package/dist/2823.js +1 -0
- package/dist/2823.js.map +1 -0
- package/dist/2840.js +1 -0
- package/dist/2840.js.map +1 -0
- package/dist/2842.js +1 -0
- package/dist/2842.js.map +1 -0
- package/dist/2916.js +1 -0
- package/dist/2916.js.map +1 -0
- package/dist/2924.js +1 -0
- package/dist/2924.js.map +1 -0
- package/dist/3137.js +1 -0
- package/dist/3137.js.map +1 -0
- package/dist/3248.js +1 -0
- package/dist/3248.js.map +1 -0
- package/dist/3282.js +1 -0
- package/dist/3282.js.map +1 -0
- package/dist/3285.js +1 -0
- package/dist/3285.js.map +1 -0
- package/dist/3302.js +1 -0
- package/dist/3302.js.map +1 -0
- package/dist/3335.js +1 -0
- package/dist/3335.js.map +1 -0
- package/dist/3378.js +1 -0
- package/dist/3378.js.map +1 -0
- package/dist/3504.js +1 -0
- package/dist/3504.js.map +1 -0
- package/dist/356.js +1 -0
- package/dist/356.js.map +1 -0
- package/dist/3569.js +1 -0
- package/dist/3569.js.map +1 -0
- package/dist/3580.js +1 -0
- package/dist/3580.js.map +1 -0
- package/dist/3690.js +1 -0
- package/dist/3690.js.map +1 -0
- package/dist/3723.js +1 -0
- package/dist/3723.js.map +1 -0
- package/dist/3745.js +1 -0
- package/dist/3745.js.map +1 -0
- package/dist/3796.js +1 -0
- package/dist/3796.js.map +1 -0
- package/dist/3813.js +1 -0
- package/dist/3813.js.map +1 -0
- package/dist/393.js +6 -0
- package/dist/393.js.map +1 -0
- package/dist/3953.js +1 -0
- package/dist/3953.js.map +1 -0
- package/dist/3989.js +1 -0
- package/dist/3989.js.map +1 -0
- package/dist/4124.js +1 -0
- package/dist/4124.js.map +1 -0
- package/dist/4163.js +1 -0
- package/dist/4163.js.map +1 -0
- package/dist/4178.js +1 -0
- package/dist/4178.js.map +1 -0
- package/dist/4308.js +1 -0
- package/dist/4308.js.map +1 -0
- package/dist/4487.js +11 -0
- package/dist/4487.js.map +1 -0
- package/dist/4588.js +1 -0
- package/dist/4588.js.map +1 -0
- package/dist/4637.js +1 -0
- package/dist/4637.js.map +1 -0
- package/dist/466.js +1 -1
- package/dist/466.js.map +1 -1
- package/dist/4711.js +1 -0
- package/dist/4711.js.map +1 -0
- package/dist/4759.js +1 -0
- package/dist/4759.js.map +1 -0
- package/dist/4817.js +1 -0
- package/dist/4817.js.map +1 -0
- package/dist/4818.js +1 -0
- package/dist/4818.js.map +1 -0
- package/dist/4902.js +1 -0
- package/dist/4902.js.map +1 -0
- package/dist/4973.js +1 -0
- package/dist/4973.js.map +1 -0
- package/dist/500.js +1 -0
- package/dist/500.js.map +1 -0
- package/dist/5086.js +1 -0
- package/dist/5086.js.map +1 -0
- package/dist/5117.js +1 -0
- package/dist/5117.js.map +1 -0
- package/dist/5203.js +1 -0
- package/dist/5203.js.map +1 -0
- package/dist/5361.js +1 -0
- package/dist/5361.js.map +1 -0
- package/dist/5362.js +1 -0
- package/dist/5362.js.map +1 -0
- package/dist/5366.js +1 -0
- package/dist/5366.js.map +1 -0
- package/dist/5536.js +1 -0
- package/dist/5536.js.map +1 -0
- package/dist/5567.js +1 -0
- package/dist/5567.js.map +1 -0
- package/dist/5598.js +1 -0
- package/dist/5598.js.map +1 -0
- package/dist/5676.js +1 -0
- package/dist/5676.js.map +1 -0
- package/dist/5693.js +1 -0
- package/dist/5693.js.map +1 -0
- package/dist/5731.js +5 -0
- package/dist/5731.js.map +1 -0
- package/dist/5767.js +1 -0
- package/dist/5767.js.map +1 -0
- package/dist/5809.js +1 -0
- package/dist/5809.js.map +1 -0
- package/dist/5825.js +1 -0
- package/dist/5825.js.map +1 -0
- package/dist/5932.js +1 -0
- package/dist/5932.js.map +1 -0
- package/dist/5941.js +1 -0
- package/dist/5941.js.map +1 -0
- package/dist/6104.js +1 -0
- package/dist/6104.js.map +1 -0
- package/dist/6273.js +1 -0
- package/dist/6273.js.map +1 -0
- package/dist/6337.js +1 -0
- package/dist/6337.js.map +1 -0
- package/dist/6355.js +1 -0
- package/dist/6355.js.map +1 -0
- package/dist/6357.js +1 -0
- package/dist/6357.js.map +1 -0
- package/dist/6427.js +1 -0
- package/dist/6427.js.map +1 -0
- package/dist/6478.js +7 -0
- package/dist/6478.js.map +1 -0
- package/dist/6508.js +1 -0
- package/dist/6508.js.map +1 -0
- package/dist/6567.js +1 -0
- package/dist/6567.js.map +1 -0
- package/dist/6634.js +1 -0
- package/dist/6634.js.map +1 -0
- package/dist/6698.js +1 -0
- package/dist/6698.js.map +1 -0
- package/dist/682.js +1 -0
- package/dist/682.js.map +1 -0
- package/dist/6848.js +1 -0
- package/dist/6848.js.map +1 -0
- package/dist/689.js +1 -1
- package/dist/689.js.map +1 -1
- package/dist/6978.js +1 -0
- package/dist/6978.js.map +1 -0
- package/dist/7085.js +1 -0
- package/dist/7085.js.map +1 -0
- package/dist/7187.js +1 -0
- package/dist/7187.js.map +1 -0
- package/dist/7209.js +1 -0
- package/dist/7209.js.map +1 -0
- package/dist/740.js +1 -0
- package/dist/740.js.map +1 -0
- package/dist/7419.js +1 -0
- package/dist/7419.js.map +1 -0
- package/dist/7478.js +1 -0
- package/dist/7478.js.map +1 -0
- package/dist/7686.js +1 -0
- package/dist/7686.js.map +1 -0
- package/dist/770.js +1 -0
- package/dist/770.js.map +1 -0
- package/dist/7782.js +1 -0
- package/dist/7782.js.map +1 -0
- package/dist/7783.js +1 -0
- package/dist/7783.js.map +1 -0
- package/dist/7808.js +1 -0
- package/dist/7808.js.map +1 -0
- package/dist/781.js +1 -0
- package/dist/781.js.map +1 -0
- package/dist/8183.js +1 -0
- package/dist/8183.js.map +1 -0
- package/dist/8196.js +1 -0
- package/dist/8196.js.map +1 -0
- package/dist/820.js +1 -0
- package/dist/820.js.map +1 -0
- package/dist/8240.js +1 -0
- package/dist/8240.js.map +1 -0
- package/dist/8267.js +1 -0
- package/dist/8267.js.map +1 -0
- package/dist/8472.js +1 -0
- package/dist/8472.js.map +1 -0
- package/dist/8521.js +1 -0
- package/dist/8521.js.map +1 -0
- package/dist/8602.js +1 -0
- package/dist/8602.js.map +1 -0
- package/dist/8607.js +1 -0
- package/dist/8607.js.map +1 -0
- package/dist/8743.js +1 -0
- package/dist/8743.js.map +1 -0
- package/dist/8762.js +1 -0
- package/dist/8762.js.map +1 -0
- package/dist/8781.js +1 -0
- package/dist/8781.js.map +1 -0
- package/dist/8812.js +1 -0
- package/dist/8812.js.map +1 -0
- package/dist/8952.js +1 -0
- package/dist/8952.js.map +1 -0
- package/dist/8985.js +1 -0
- package/dist/8985.js.map +1 -0
- package/dist/8996.js +1 -0
- package/dist/8996.js.map +1 -0
- package/dist/9011.js +1 -0
- package/dist/9011.js.map +1 -0
- package/dist/9049.js +1 -0
- package/dist/9049.js.map +1 -0
- package/dist/9050.js +1 -0
- package/dist/9050.js.map +1 -0
- package/dist/9061.js +1 -0
- package/dist/9061.js.map +1 -0
- package/dist/9087.js +1 -0
- package/dist/9087.js.map +1 -0
- package/dist/9148.js +1 -0
- package/dist/9148.js.map +1 -0
- package/dist/9168.js +1 -0
- package/dist/9168.js.map +1 -0
- package/dist/935.js +1 -0
- package/dist/935.js.map +1 -0
- package/dist/9425.js +1 -0
- package/dist/944.js +1 -0
- package/dist/944.js.map +1 -0
- package/dist/9443.js +1 -0
- package/dist/9443.js.map +1 -0
- package/dist/9520.js +1 -0
- package/dist/9520.js.map +1 -0
- package/dist/9547.js +1 -0
- package/dist/9547.js.map +1 -0
- package/dist/9549.js +1 -0
- package/dist/9549.js.map +1 -0
- package/dist/9603.js +1 -0
- package/dist/9603.js.map +1 -0
- package/dist/9612.js +1 -0
- package/dist/9612.js.map +1 -0
- package/dist/9621.js +1 -0
- package/dist/9621.js.map +1 -0
- package/dist/9662.js +1 -0
- package/dist/9662.js.map +1 -0
- package/dist/9771.js +1 -0
- package/dist/9771.js.map +1 -0
- package/dist/9774.js +1 -0
- package/dist/9774.js.map +1 -0
- package/dist/9800.js +1 -0
- package/dist/9800.js.map +1 -0
- package/dist/9806.js +1 -0
- package/dist/9806.js.map +1 -0
- package/dist/992.js +1 -0
- package/dist/992.js.map +1 -0
- package/dist/kenyaemr-esm-admin-app.js +6 -5
- package/dist/kenyaemr-esm-admin-app.js.buildmanifest.json +3594 -151
- package/dist/kenyaemr-esm-admin-app.js.map +1 -1
- package/dist/main.js +6 -31
- package/dist/main.js.map +1 -1
- package/dist/routes.json +1 -1
- package/package.json +5 -7
- package/rspack.config.js +1 -1
- package/src/components/confirm-modal/confirmation-operation.test.tsx +8 -19
- package/src/components/dashboard/dashboard.component.tsx +4 -1
- package/src/components/empty-state/empty-state-log.test.tsx +3 -4
- package/src/components/facility-setup/constant/index.ts +3 -0
- package/src/components/facility-setup/facility-info.component.tsx +247 -108
- package/src/components/facility-setup/facility-info.scss +136 -55
- package/src/components/facility-setup/facility-setup.component.tsx +2 -2
- package/src/components/facility-setup/header/header.component.tsx +4 -10
- package/src/components/facility-setup/header/header.scss +3 -9
- package/src/components/facility-setup/shared/custom-info.component.tsx +9 -0
- package/src/components/facility-setup/shared/custom-section-card.component.tsx +10 -0
- package/src/components/facility-setup/shared/custom-status-tag.component.tsx +22 -0
- package/src/components/facility-setup/type/index.ts +61 -0
- package/src/components/facility-setup/useFacilityRegistry.ts +29 -0
- package/src/components/global-property/dashboard/global-property-dashboard.component.tsx +23 -0
- package/src/components/global-property/dashboard/global-property-dashboard.scss +6 -0
- package/src/components/global-property/hooks/useGlobalProperty.ts +64 -0
- package/src/components/global-property/hooks/useLogoUpload.ts +28 -0
- package/src/components/global-property/index.ts +14 -0
- package/src/components/global-property/modal/delete-global-property-modal.component.tsx +71 -0
- package/src/components/global-property/modal/delete-global-property-modal.test.tsx +131 -0
- package/src/components/global-property/table/global-property-table.component.tsx +241 -0
- package/src/components/global-property/table/global-property-table.scss +44 -0
- package/src/components/global-property/table/global-property-table.test.tsx +202 -0
- package/src/components/global-property/workspace/global-property-form-schema.ts +32 -0
- package/src/components/global-property/workspace/global-property.workspace.scss +40 -0
- package/src/components/global-property/workspace/global-property.workspace.test.tsx +172 -0
- package/src/components/global-property/workspace/global-property.workspace.tsx +260 -0
- package/src/components/global-property/workspace/upload-logo.workspace.scss +61 -0
- package/src/components/global-property/workspace/upload-logo.workspace.test.tsx +180 -0
- package/src/components/global-property/workspace/upload-logo.workspace.tsx +191 -0
- package/src/components/hook/healthWorkerRegistry.ts +78 -0
- package/src/components/hook/useProfessionalRegistryEnums.ts +59 -0
- package/src/components/locations/forms/add-location/add-location.workspace.tsx +96 -95
- package/src/components/locations/forms/search-location/search-location.workspace.tsx +90 -85
- package/src/components/locations/tables/locations-table.component.tsx +117 -121
- package/src/components/logs-table/operation-log-table.component.tsx +87 -75
- package/src/components/logs-table/operation-log.test.tsx +134 -28
- package/src/components/modal/hwr-confirmation.modal.scss +80 -4
- package/src/components/modal/hwr-confirmation.modal.tsx +118 -128
- package/src/components/modal/hwr-sync.modal.tsx +194 -106
- package/src/components/users/manage-users/manage-user-role-scope/user-role-scope-workspace/user-role-scope.workspace.tsx +14 -14
- package/src/components/users/manage-users/user-details/user-detail.scss +167 -39
- package/src/components/users/manage-users/user-details/user-details.component.tsx +130 -122
- package/src/components/users/manage-users/user-list/user-list.component.tsx +22 -9
- package/src/components/users/manage-users/user-management.workspace.scss +233 -95
- package/src/components/users/manage-users/user-management.workspace.tsx +800 -687
- package/src/components/users/userManagementFormSchema.tsx +17 -8
- package/src/config-schema.ts +48 -68
- package/src/index.ts +68 -31
- package/src/left-pannel-link.component.tsx +5 -3
- package/src/root.component.tsx +13 -13
- package/src/routes.json +60 -36
- package/src/types/index.ts +40 -3
- package/translations/am.json +213 -13
- package/translations/en.json +225 -25
- package/translations/fr.json +260 -58
- package/translations/sw.json +329 -129
- package/tsconfig.json +1 -1
- package/dist/127.js +0 -1
- package/dist/267.js +0 -1
- package/dist/267.js.map +0 -1
- package/dist/281.js +0 -15
- package/dist/281.js.map +0 -1
- package/dist/329.js +0 -1
- package/dist/329.js.map +0 -1
- package/dist/40.js +0 -1
- package/dist/472.js +0 -1
- package/dist/472.js.map +0 -1
- package/dist/478.js +0 -1
- package/dist/478.js.map +0 -1
- package/dist/585.js +0 -1
- package/dist/585.js.map +0 -1
- package/dist/630.js +0 -1
- package/dist/630.js.map +0 -1
- package/dist/675.js +0 -1
- package/dist/675.js.map +0 -1
- package/dist/706.js +0 -27
- package/dist/706.js.map +0 -1
- package/dist/729.js +0 -17
- package/dist/729.js.map +0 -1
- package/dist/774.js +0 -1
- package/dist/774.js.map +0 -1
- package/dist/847.js +0 -1
- package/dist/847.js.map +0 -1
- package/dist/85.js +0 -1
- package/dist/85.js.map +0 -1
- package/dist/882.js +0 -1
- package/dist/91.js +0 -1
- package/dist/91.js.map +0 -1
- package/dist/916.js +0 -1
- package/dist/998.js +0 -1
- package/dist/998.js.map +0 -1
- package/jest.config.js +0 -8
- package/src/components/facility-setup/card.component.tsx +0 -16
- package/src/components/facility-setup/facility-setup.resource.tsx +0 -7
- package/src/components/hook/healthWorkerAdapter.ts +0 -213
- package/src/components/hook/useFacilityInfo.tsx +0 -37
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
TableRow,
|
|
13
13
|
Tag,
|
|
14
14
|
DataTableSkeleton,
|
|
15
|
-
InlineLoading,
|
|
16
15
|
} from '@carbon/react';
|
|
17
16
|
import { CardHeader, PatientChartPagination } from '@openmrs/esm-patient-common-lib';
|
|
18
17
|
import { useLayoutType, usePagination, formatDate } from '@openmrs/esm-framework';
|
|
@@ -21,13 +20,14 @@ import { ETLResponse } from '../../types';
|
|
|
21
20
|
import EmptyState from '../empty-state/empty-state-log.components';
|
|
22
21
|
|
|
23
22
|
interface LogTableProps {
|
|
24
|
-
logData: ETLResponse
|
|
23
|
+
logData: Array<ETLResponse>;
|
|
25
24
|
isLoading: boolean;
|
|
26
25
|
}
|
|
27
26
|
|
|
27
|
+
const PAGE_SIZE = 10;
|
|
28
|
+
|
|
28
29
|
const LogTable: React.FC<LogTableProps> = ({ logData, isLoading }) => {
|
|
29
30
|
const { t } = useTranslation();
|
|
30
|
-
const pageSize = 10;
|
|
31
31
|
const isTablet = useLayoutType() === 'tablet';
|
|
32
32
|
|
|
33
33
|
const headers = [
|
|
@@ -37,82 +37,94 @@ const LogTable: React.FC<LogTableProps> = ({ logData, isLoading }) => {
|
|
|
37
37
|
{ header: t('completionStatus', 'Completion status'), key: 'status' },
|
|
38
38
|
];
|
|
39
39
|
|
|
40
|
-
const rows =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
const rows =
|
|
41
|
+
logData?.map((item, index) => ({
|
|
42
|
+
id: index.toString(),
|
|
43
|
+
script_name: item.script_name,
|
|
44
|
+
start_time: item?.start_time ? formatDate(new Date(item.start_time)) : '--',
|
|
45
|
+
stop_time: item?.stop_time ? formatDate(new Date(item.stop_time)) : '--',
|
|
46
|
+
status: item.status,
|
|
47
|
+
})) ?? [];
|
|
48
|
+
|
|
49
|
+
const { results: paginatedData, currentPage, goTo } = usePagination(rows, PAGE_SIZE);
|
|
50
|
+
|
|
51
|
+
const renderTable = ({ rows, headers, getHeaderProps, getTableProps }: any) => (
|
|
52
|
+
<TableContainer className={styles.tableContainer}>
|
|
53
|
+
<Table {...getTableProps()}>
|
|
54
|
+
<TableHead>
|
|
55
|
+
<TableRow>
|
|
56
|
+
{headers.map((header: any) => (
|
|
57
|
+
<TableHeader
|
|
58
|
+
className={classNames(styles.productiveHeading01, styles.text02)}
|
|
59
|
+
{...getHeaderProps({ header })}>
|
|
60
|
+
{header.header}
|
|
61
|
+
</TableHeader>
|
|
62
|
+
))}
|
|
63
|
+
</TableRow>
|
|
64
|
+
</TableHead>
|
|
65
|
+
<TableBody>
|
|
66
|
+
{rows.map((row: any) => (
|
|
67
|
+
<TableRow key={row.id}>
|
|
68
|
+
{row.cells.map((cell: any) => (
|
|
69
|
+
<TableCell key={cell.id}>
|
|
70
|
+
{cell.info.header === 'status' ? (
|
|
71
|
+
<Tag size="md" type={cell.value === 'Success' ? 'green' : 'red'}>
|
|
72
|
+
{cell.value}
|
|
73
|
+
</Tag>
|
|
74
|
+
) : (
|
|
75
|
+
cell.value
|
|
76
|
+
)}
|
|
77
|
+
</TableCell>
|
|
78
|
+
))}
|
|
79
|
+
</TableRow>
|
|
80
|
+
))}
|
|
81
|
+
</TableBody>
|
|
82
|
+
</Table>
|
|
83
|
+
</TableContainer>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const renderContent = () => {
|
|
87
|
+
if (isLoading && logData.length === 0) {
|
|
88
|
+
return (
|
|
89
|
+
<DataTableSkeleton
|
|
90
|
+
headers={headers}
|
|
91
|
+
aria-label="etl table"
|
|
92
|
+
showToolbar={false}
|
|
93
|
+
showHeader={false}
|
|
94
|
+
rowCount={4}
|
|
95
|
+
zebra
|
|
96
|
+
columnCount={3}
|
|
97
|
+
className={styles.dataTableSkeleton}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (logData.length === 0) {
|
|
103
|
+
return <EmptyState subTitle={t('noRecordsFound', 'No ETL Operation logs found')} />;
|
|
104
|
+
}
|
|
47
105
|
|
|
48
|
-
|
|
106
|
+
return (
|
|
107
|
+
<>
|
|
108
|
+
<DataTable rows={paginatedData} headers={headers} isSortable size={isTablet ? 'lg' : 'sm'} useZebraStyles>
|
|
109
|
+
{renderTable}
|
|
110
|
+
</DataTable>
|
|
111
|
+
<PatientChartPagination
|
|
112
|
+
currentItems={paginatedData.length}
|
|
113
|
+
totalItems={rows.length}
|
|
114
|
+
onPageNumberChange={({ page }: { page: number }) => goTo(page)}
|
|
115
|
+
pageNumber={currentPage}
|
|
116
|
+
pageSize={PAGE_SIZE}
|
|
117
|
+
/>
|
|
118
|
+
</>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
49
121
|
|
|
50
122
|
return (
|
|
51
123
|
<div className={styles.table}>
|
|
52
|
-
<CardHeader title={t('facilityInfo', 'Facility Info')}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
headers={headers}
|
|
57
|
-
aria-label="etl table"
|
|
58
|
-
showToolbar={false}
|
|
59
|
-
showHeader={false}
|
|
60
|
-
rowCount={4}
|
|
61
|
-
zebra
|
|
62
|
-
columnCount={3}
|
|
63
|
-
className={styles.dataTableSkeleton}
|
|
64
|
-
/>
|
|
65
|
-
) : logData.length === 0 ? (
|
|
66
|
-
<EmptyState subTitle={t('noRecordsFound', 'No ETL Operation logs found')} />
|
|
67
|
-
) : (
|
|
68
|
-
<>
|
|
69
|
-
<DataTable rows={paginatedData} headers={headers} isSortable size={isTablet ? 'lg' : 'sm'} useZebraStyles>
|
|
70
|
-
{({ rows, headers, getHeaderProps, getTableProps }) => (
|
|
71
|
-
<TableContainer className={styles.tableContainer}>
|
|
72
|
-
<Table {...getTableProps()}>
|
|
73
|
-
<TableHead>
|
|
74
|
-
<TableRow>
|
|
75
|
-
{headers.map((header) => (
|
|
76
|
-
<TableHeader
|
|
77
|
-
key={header.key}
|
|
78
|
-
className={classNames(styles.productiveHeading01, styles.text02)}
|
|
79
|
-
{...getHeaderProps({ header })}>
|
|
80
|
-
{header.header}
|
|
81
|
-
</TableHeader>
|
|
82
|
-
))}
|
|
83
|
-
</TableRow>
|
|
84
|
-
</TableHead>
|
|
85
|
-
<TableBody>
|
|
86
|
-
{rows.map((row) => (
|
|
87
|
-
<TableRow key={row.id}>
|
|
88
|
-
{row.cells.map((cell) => (
|
|
89
|
-
<TableCell key={cell.id}>
|
|
90
|
-
{cell.info.header === 'status' ? (
|
|
91
|
-
<Tag size="md" type={cell.value === 'Success' ? 'green' : 'red'}>
|
|
92
|
-
{cell.value}
|
|
93
|
-
</Tag>
|
|
94
|
-
) : (
|
|
95
|
-
cell.value
|
|
96
|
-
)}
|
|
97
|
-
</TableCell>
|
|
98
|
-
))}
|
|
99
|
-
</TableRow>
|
|
100
|
-
))}
|
|
101
|
-
</TableBody>
|
|
102
|
-
</Table>
|
|
103
|
-
</TableContainer>
|
|
104
|
-
)}
|
|
105
|
-
</DataTable>
|
|
106
|
-
<PatientChartPagination
|
|
107
|
-
currentItems={paginatedData.length}
|
|
108
|
-
totalItems={rows.length}
|
|
109
|
-
onPageNumberChange={({ page }) => goTo(page)}
|
|
110
|
-
pageNumber={currentPage}
|
|
111
|
-
pageSize={pageSize}
|
|
112
|
-
/>
|
|
113
|
-
</>
|
|
114
|
-
)}
|
|
115
|
-
</div>
|
|
124
|
+
<CardHeader title={t('facilityInfo', 'Facility Info')}>
|
|
125
|
+
<></>
|
|
126
|
+
</CardHeader>
|
|
127
|
+
<div className={styles.logTable}>{renderContent()}</div>
|
|
116
128
|
</div>
|
|
117
129
|
);
|
|
118
130
|
};
|
|
@@ -1,47 +1,153 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import '@testing-library/jest-dom';
|
|
4
|
+
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
|
4
5
|
import LogTable from './operation-log-table.component';
|
|
5
6
|
import { ETLResponse } from '../../types';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
vi.mock('react-i18next', () => ({
|
|
9
|
+
useTranslation: () => ({ t: (key: string, fallback: string) => fallback }),
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
vi.mock('@openmrs/esm-framework', () => ({
|
|
13
|
+
useLayoutType: vi.fn(() => 'desktop'),
|
|
14
|
+
usePagination: vi.fn((data) => ({
|
|
15
|
+
results: data,
|
|
16
|
+
currentPage: 1,
|
|
17
|
+
goTo: vi.fn(),
|
|
18
|
+
})),
|
|
19
|
+
formatDate: vi.fn((date: Date) => date.toISOString()),
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
vi.mock('@openmrs/esm-patient-common-lib', () => ({
|
|
23
|
+
CardHeader: ({ title }: { title: string }) => <div>{title}</div>,
|
|
24
|
+
PatientChartPagination: ({ currentItems, totalItems }: { currentItems: number; totalItems: number }) => (
|
|
25
|
+
<div data-testid="pagination">
|
|
26
|
+
{currentItems}/{totalItems}
|
|
27
|
+
</div>
|
|
28
|
+
),
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
vi.mock('../empty-state/empty-state-log.components', () => ({
|
|
32
|
+
default: ({ subTitle }: { subTitle: string }) => <div data-testid="empty-state">{subTitle}</div>,
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
vi.mock('@carbon/react', async (importOriginal) => {
|
|
36
|
+
const original = await importOriginal<typeof import('@carbon/react')>();
|
|
37
|
+
return {
|
|
38
|
+
...original,
|
|
39
|
+
DataTable: ({
|
|
40
|
+
children,
|
|
41
|
+
rows,
|
|
42
|
+
headers,
|
|
43
|
+
}: {
|
|
44
|
+
children: (props: any) => React.ReactNode;
|
|
45
|
+
rows: any[];
|
|
46
|
+
headers: any[];
|
|
47
|
+
}) => {
|
|
48
|
+
if (typeof children === 'function') {
|
|
49
|
+
const renderRows = rows.map((row) => ({
|
|
50
|
+
...row,
|
|
51
|
+
cells: headers.map((h) => ({
|
|
52
|
+
id: `${row.id}:${h.key}`,
|
|
53
|
+
value: row[h.key],
|
|
54
|
+
info: { header: h.key },
|
|
55
|
+
})),
|
|
56
|
+
}));
|
|
57
|
+
return children({
|
|
58
|
+
rows: renderRows,
|
|
59
|
+
headers,
|
|
60
|
+
getTableProps: () => ({}),
|
|
61
|
+
getHeaderProps: ({ header }: any) => ({ key: header.key }),
|
|
62
|
+
getRowProps: () => ({}),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return children;
|
|
20
66
|
},
|
|
21
|
-
|
|
67
|
+
};
|
|
68
|
+
});
|
|
22
69
|
|
|
23
|
-
|
|
24
|
-
render(<LogTable logData={mockLogData} isLoading={false} />);
|
|
70
|
+
vi.mock('classnames', () => ({ default: (...args: string[]) => args.filter(Boolean).join(' ') }));
|
|
25
71
|
|
|
26
|
-
|
|
27
|
-
headers.forEach((header) => {
|
|
28
|
-
expect(screen.getByText(header)).toBeInTheDocument();
|
|
29
|
-
});
|
|
72
|
+
vi.mock('./operation-log.scss', () => ({ default: {} }));
|
|
30
73
|
|
|
31
|
-
|
|
32
|
-
|
|
74
|
+
const mockLogData: ETLResponse[] = [
|
|
75
|
+
{
|
|
76
|
+
script_name: 'Script A',
|
|
77
|
+
start_time: '2024-01-01T08:00:00Z',
|
|
78
|
+
stop_time: '2024-01-01T09:00:00Z',
|
|
79
|
+
status: 'Success',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
script_name: 'Script B',
|
|
83
|
+
start_time: '2024-01-02T10:00:00Z',
|
|
84
|
+
stop_time: '2024-01-02T11:00:00Z',
|
|
85
|
+
status: 'Failed',
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
describe('LogTable', () => {
|
|
90
|
+
beforeEach(() => {
|
|
91
|
+
vi.clearAllMocks();
|
|
33
92
|
});
|
|
34
93
|
|
|
35
|
-
it('
|
|
36
|
-
render(<LogTable logData={
|
|
94
|
+
it('renders the card header', () => {
|
|
95
|
+
render(<LogTable logData={mockLogData} isLoading={false} />);
|
|
96
|
+
expect(screen.getByText('Facility Info')).toBeInTheDocument();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('shows skeleton while loading with no data', () => {
|
|
100
|
+
render(<LogTable logData={[]} isLoading={true} />);
|
|
101
|
+
expect(screen.getByRole('table')).toBeInTheDocument();
|
|
102
|
+
});
|
|
37
103
|
|
|
104
|
+
it('shows empty state when not loading and no data', () => {
|
|
105
|
+
render(<LogTable logData={[]} isLoading={false} />);
|
|
106
|
+
expect(screen.getByTestId('empty-state')).toBeInTheDocument();
|
|
38
107
|
expect(screen.getByText('No ETL Operation logs found')).toBeInTheDocument();
|
|
39
108
|
});
|
|
40
109
|
|
|
41
|
-
it('
|
|
42
|
-
render(<LogTable logData={
|
|
110
|
+
it('renders table headers when data is present', () => {
|
|
111
|
+
render(<LogTable logData={mockLogData} isLoading={false} />);
|
|
112
|
+
expect(screen.getByText('Procedure')).toBeInTheDocument();
|
|
113
|
+
expect(screen.getByText('Start time')).toBeInTheDocument();
|
|
114
|
+
expect(screen.getByText('End time')).toBeInTheDocument();
|
|
115
|
+
expect(screen.getByText('Completion status')).toBeInTheDocument();
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('renders script names in the table', () => {
|
|
119
|
+
render(<LogTable logData={mockLogData} isLoading={false} />);
|
|
120
|
+
expect(screen.getByText('Script A')).toBeInTheDocument();
|
|
121
|
+
expect(screen.getByText('Script B')).toBeInTheDocument();
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('renders Success status as a green tag', () => {
|
|
125
|
+
render(<LogTable logData={mockLogData} isLoading={false} />);
|
|
126
|
+
const successTag = screen.getByText('Success');
|
|
127
|
+
expect(successTag).toBeInTheDocument();
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('renders Failed status as a red tag', () => {
|
|
131
|
+
render(<LogTable logData={mockLogData} isLoading={false} />);
|
|
132
|
+
const failedTag = screen.getByText('Failed');
|
|
133
|
+
expect(failedTag).toBeInTheDocument();
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('renders pagination when data is present', () => {
|
|
137
|
+
render(<LogTable logData={mockLogData} isLoading={false} />);
|
|
138
|
+
expect(screen.getByTestId('pagination')).toBeInTheDocument();
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('renders -- for missing start_time', () => {
|
|
142
|
+
const dataWithMissingTime: ETLResponse[] = [
|
|
143
|
+
{ script_name: 'Script C', start_time: '', stop_time: '', status: 'Success' },
|
|
144
|
+
];
|
|
145
|
+
render(<LogTable logData={dataWithMissingTime} isLoading={false} />);
|
|
146
|
+
expect(screen.getAllByText('--').length).toBeGreaterThanOrEqual(2);
|
|
147
|
+
});
|
|
43
148
|
|
|
44
|
-
|
|
45
|
-
|
|
149
|
+
it('does not show empty state when data is present', () => {
|
|
150
|
+
render(<LogTable logData={mockLogData} isLoading={false} />);
|
|
151
|
+
expect(screen.queryByTestId('empty-state')).not.toBeInTheDocument();
|
|
46
152
|
});
|
|
47
153
|
});
|
|
@@ -2,20 +2,96 @@
|
|
|
2
2
|
@use '@carbon/layout';
|
|
3
3
|
@use '@carbon/type';
|
|
4
4
|
|
|
5
|
+
.modalIntro {
|
|
6
|
+
margin-bottom: layout.$spacing-05;
|
|
7
|
+
color: colors.$gray-70;
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
.healthWorkerInfoContainer {
|
|
6
11
|
display: grid;
|
|
7
|
-
grid-template-columns: 0.
|
|
8
|
-
margin: layout.$spacing-02;
|
|
12
|
+
grid-template-columns: 0.4fr 0.6fr;
|
|
13
|
+
margin: layout.$spacing-02 0;
|
|
14
|
+
font-size: 0.875rem;
|
|
9
15
|
}
|
|
16
|
+
|
|
10
17
|
.healthWorkerInfoLabel {
|
|
11
18
|
min-width: layout.$spacing-11;
|
|
12
|
-
font-weight:
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
color: colors.$gray-70;
|
|
13
21
|
}
|
|
22
|
+
|
|
14
23
|
.healthWorkerOverview {
|
|
15
24
|
display: flex;
|
|
16
|
-
|
|
25
|
+
align-items: center;
|
|
26
|
+
margin: layout.$spacing-05 0;
|
|
27
|
+
padding: layout.$spacing-05;
|
|
28
|
+
background-color: colors.$gray-10;
|
|
29
|
+
border-radius: 4px;
|
|
17
30
|
}
|
|
31
|
+
|
|
18
32
|
.healthWorkerPhoto {
|
|
19
33
|
display: flex;
|
|
20
34
|
align-items: center;
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.healthWorkerSummary {
|
|
39
|
+
flex: 1;
|
|
40
|
+
margin-left: layout.$spacing-05;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.healthWorkerName {
|
|
44
|
+
margin: 0 0 layout.$spacing-02 0;
|
|
45
|
+
font-size: 1.25rem;
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.healthWorkerSubtitle {
|
|
50
|
+
color: colors.$gray-70;
|
|
51
|
+
font-size: 0.875rem;
|
|
52
|
+
margin-bottom: layout.$spacing-03;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.tagRow {
|
|
56
|
+
display: flex;
|
|
57
|
+
gap: layout.$spacing-02;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.sectionHeading {
|
|
62
|
+
margin: layout.$spacing-05 0 layout.$spacing-03 0;
|
|
63
|
+
padding-bottom: layout.$spacing-02;
|
|
64
|
+
border-bottom: 1px solid colors.$gray-20;
|
|
65
|
+
font-size: 0.875rem;
|
|
66
|
+
font-weight: 600;
|
|
67
|
+
text-transform: uppercase;
|
|
68
|
+
letter-spacing: 0.04em;
|
|
69
|
+
color: colors.$gray-70;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.licenseList {
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
gap: layout.$spacing-03;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.licenseCard {
|
|
79
|
+
padding: layout.$spacing-04;
|
|
80
|
+
border: 1px solid colors.$gray-20;
|
|
81
|
+
border-radius: 4px;
|
|
82
|
+
background-color: colors.$white;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.licenseHeader {
|
|
86
|
+
display: flex;
|
|
87
|
+
justify-content: space-between;
|
|
88
|
+
align-items: center;
|
|
89
|
+
margin-bottom: layout.$spacing-03;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.licenseType {
|
|
93
|
+
font-weight: 600;
|
|
94
|
+
text-transform: uppercase;
|
|
95
|
+
font-size: 0.75rem;
|
|
96
|
+
letter-spacing: 0.04em;
|
|
21
97
|
}
|