@openmrs/esm-form-builder-app 3.5.2-pre.3883 → 3.5.2-pre.3887
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/dist/1850.js +1 -1
- package/dist/1850.js.map +1 -1
- package/dist/5117.js +1 -1
- package/dist/5117.js.map +1 -1
- package/dist/5543.js +1 -1
- package/dist/5543.js.map +1 -1
- package/dist/openmrs-esm-form-builder-app.js +2 -2
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/components/audit-details/audit-details.component.tsx +9 -3
- package/src/components/audit-details/audit-details.test.tsx +52 -0
package/dist/routes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":">=2.2.0"},"pages":[{"component":"root","route":"form-builder","online":true,"offline":true,"order":1}],"extensions":[{"name":"system-administration-form-builder-card-link","slot":"system-admin-page-card-link-slot","component":"systemAdministrationFormBuilderCardLink","online":true,"offline":true}],"modals":[{"name":"new-form-modal","component":"newFormModal"},{"name":"new-page-modal","component":"newPageModal"},{"name":"delete-page-modal","component":"deletePageModal"},{"name":"new-section-modal","component":"newSectionModal"},{"name":"delete-section-modal","component":"deleteSectionModal"},{"name":"add-form-reference-modal","component":"addFormReferenceModal"},{"name":"question-modal","component":"questionModal"},{"name":"delete-question-modal","component":"deleteQuestionModal"},{"name":"edit-question-modal","component":"editQuestionModal"},{"name":"restore-draft-schema-modal","component":"restoreDraftSchemaModal"},{"name":"unpublish-form-modal","component":"unpublishFormModal"},{"name":"delete-form-modal","component":"deleteFormModal"},{"name":"edit-translation-modal","component":"editTranslationModal"},{"name":"save-form-modal","component":"saveFormModal"}],"version":"3.5.2-pre.
|
|
1
|
+
{"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":">=2.2.0"},"pages":[{"component":"root","route":"form-builder","online":true,"offline":true,"order":1}],"extensions":[{"name":"system-administration-form-builder-card-link","slot":"system-admin-page-card-link-slot","component":"systemAdministrationFormBuilderCardLink","online":true,"offline":true}],"modals":[{"name":"new-form-modal","component":"newFormModal"},{"name":"new-page-modal","component":"newPageModal"},{"name":"delete-page-modal","component":"deletePageModal"},{"name":"new-section-modal","component":"newSectionModal"},{"name":"delete-section-modal","component":"deleteSectionModal"},{"name":"add-form-reference-modal","component":"addFormReferenceModal"},{"name":"question-modal","component":"questionModal"},{"name":"delete-question-modal","component":"deleteQuestionModal"},{"name":"edit-question-modal","component":"editQuestionModal"},{"name":"restore-draft-schema-modal","component":"restoreDraftSchemaModal"},{"name":"unpublish-form-modal","component":"unpublishFormModal"},{"name":"delete-form-modal","component":"deleteFormModal"},{"name":"edit-translation-modal","component":"editTranslationModal"},{"name":"save-form-modal","component":"saveFormModal"}],"version":"3.5.2-pre.3887"}
|
package/package.json
CHANGED
|
@@ -52,7 +52,7 @@ interface FormGroupData {
|
|
|
52
52
|
name: string;
|
|
53
53
|
uuid: string;
|
|
54
54
|
version: string;
|
|
55
|
-
encounterType: EncounterType;
|
|
55
|
+
encounterType: EncounterType | null;
|
|
56
56
|
description: string;
|
|
57
57
|
display?: string;
|
|
58
58
|
published?: boolean;
|
|
@@ -88,7 +88,11 @@ const AuditDetails: React.FC<AuditDetailsProps> = ({ form }) => {
|
|
|
88
88
|
<StructuredListRow>
|
|
89
89
|
<StructuredListCell>{t('encounterType', 'Encounter Type')}</StructuredListCell>
|
|
90
90
|
<StructuredListCell>
|
|
91
|
-
|
|
91
|
+
{form.encounterType?.uuid ? (
|
|
92
|
+
<CopyableValue value={form.encounterType.uuid} />
|
|
93
|
+
) : (
|
|
94
|
+
t('noEncounterType', 'None')
|
|
95
|
+
)}
|
|
92
96
|
</StructuredListCell>
|
|
93
97
|
</StructuredListRow>
|
|
94
98
|
<StructuredListRow>
|
|
@@ -103,7 +107,9 @@ const AuditDetails: React.FC<AuditDetailsProps> = ({ form }) => {
|
|
|
103
107
|
<StructuredListCell>{t('lastEditedBy', 'Last Edited By')}</StructuredListCell>
|
|
104
108
|
<StructuredListCell>
|
|
105
109
|
{form?.auditInfo?.dateChanged ? (
|
|
106
|
-
`${form?.auditInfo?.changedBy
|
|
110
|
+
`${form?.auditInfo?.changedBy?.display ?? t('unknownUser', 'Unknown')} on ${formatDatetime(
|
|
111
|
+
parseDate(form?.auditInfo?.dateChanged),
|
|
112
|
+
)}`
|
|
107
113
|
) : (
|
|
108
114
|
<span
|
|
109
115
|
aria-label={t('uneditedFormMsg', 'This form has never been edited')}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import { render, screen, within } from '@testing-library/react';
|
|
4
|
+
import AuditDetails from './audit-details.component';
|
|
5
|
+
|
|
6
|
+
const form = {
|
|
7
|
+
uuid: '2ddde996-b1c3-37f1-a53e-378dd1a4f6b5',
|
|
8
|
+
name: 'Test Form 1',
|
|
9
|
+
description: 'A test form',
|
|
10
|
+
version: '1.0',
|
|
11
|
+
encounterType: {
|
|
12
|
+
uuid: 'dd528487-82a5-4082-9c72-ed246bd49591',
|
|
13
|
+
name: 'Consultation',
|
|
14
|
+
display: 'Consultation',
|
|
15
|
+
},
|
|
16
|
+
published: false,
|
|
17
|
+
retired: false,
|
|
18
|
+
auditInfo: {
|
|
19
|
+
creator: { display: 'admin' },
|
|
20
|
+
dateCreated: '2026-10-06T10:00:00.000+0000',
|
|
21
|
+
changedBy: null,
|
|
22
|
+
dateChanged: null,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
describe('AuditDetails', () => {
|
|
27
|
+
it('renders the encounter type uuid when the form has an encounter type', () => {
|
|
28
|
+
render(<AuditDetails form={form} />);
|
|
29
|
+
|
|
30
|
+
const encounterTypeRow = screen.getByRole('row', { name: /encounter type/i });
|
|
31
|
+
expect(encounterTypeRow).toHaveTextContent('dd528487-82a5-4082-9c72-ed246bd49591');
|
|
32
|
+
expect(within(encounterTypeRow).getByRole('button', { name: /copy to clipboard/i })).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('renders a placeholder when the form has no encounter type', () => {
|
|
36
|
+
render(<AuditDetails form={{ ...form, encounterType: null }} />);
|
|
37
|
+
|
|
38
|
+
const encounterTypeRow = screen.getByRole('row', { name: /encounter type/i });
|
|
39
|
+
expect(encounterTypeRow).toHaveTextContent(/none/i);
|
|
40
|
+
expect(within(encounterTypeRow).queryByRole('button', { name: /copy to clipboard/i })).not.toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('renders an unknown editor when the form was changed without a recorded user', () => {
|
|
44
|
+
render(
|
|
45
|
+
<AuditDetails
|
|
46
|
+
form={{ ...form, auditInfo: { ...form.auditInfo, dateChanged: '2026-10-06T11:00:00.000+0000' } }}
|
|
47
|
+
/>,
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
expect(screen.getByRole('row', { name: /last edited by/i })).toHaveTextContent(/unknown on/i);
|
|
51
|
+
});
|
|
52
|
+
});
|