Details
-
Enhancement
-
Status: Done
-
Must
-
Resolution: Fixed
-
None
-
None
-
None
-
Undetermined
Description
Currently, the patient-forms-app has a mechanism for distinguishing between HTMLFormEntry forms and non-HTMLFormEntry forms. HTMLFormEntry forms are launched in a new page while other forms are launched in the workspace.
The problem is that the list of HTMLFormEntry forms is hard-coded. This should be refactored so that the list of HTMLFormEntry forms can be configured by an implementation.
This can be done by defining a proper configuration schema for the form app. For now, the idea is just to externalise what's already hard-coded, e.g., something like:
import { Type } from '@openmrs/esm-framework'; export const configSchema = { htmlFormEntryForms: { _type: Type.Array, _elements: { formUuid: { _type: Type.UUID, }, formName: { _type: Type.String, _description: 'The name of the form' }, formXmlFileName: { _type: Type.String, _description: 'The name of the XML file that defines the form' }, formUiPage: { _type: Type.String, _description: 'The HTMLFormEntry page to use to show this form. Should be one of "enterHtmlFormWithStandardUi" or "enterHtmlFormWithSimpleUi"', _validators: [validator(p => p === 'enterHtmlFormWithStandardUi' || p === 'enterHtmlFormWithSimpleUi', 'Must be one of "enterHtmlFormWithStandardUi" or "enterHtmlFormWithSimpleUi"')] } } } }
The existing hard-coded values should then be converted as the default value for this schema. This will allow implementers to define what forms should be registered as HFE forms, at least until a better mechanism comes along.