-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat) - O3-3096 service queues - configuration-driven queue table #1114
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
adde757
(feat) - O3-3096 service queues - onfiguration-driven queue table
chibongho c27b789
add more queue columns
chibongho 2cc7c0f
remove tablesConfig mocks in tests
chibongho 84963bc
fix misnamed columns and add queue number column
chibongho a86f9be
preserve JSON formatting for defaultTablesConfig
chibongho d6746c2
misc
chibongho File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,85 @@ | ||
import { Type, restBaseUrl, validators } from '@openmrs/esm-framework'; | ||
import { Type, validators } from '@openmrs/esm-framework'; | ||
import vitalsConfigSchema, { type VitalsConfigObject } from './current-visit/visit-details/vitals-config-schema'; | ||
import biometricsConfigSchema, { | ||
type BiometricsConfigObject, | ||
} from './current-visit/visit-details/biometrics-config-schema'; | ||
|
||
export const configSchema = { | ||
priorityConfigs: { | ||
_type: Type.Array, | ||
_element: { | ||
_type: Type.Object, | ||
// Not all of the columnDefinitions are used below, but they are defined anyway | ||
// for demonstration purpose. Implementors can copy this JSON as a starting point | ||
// to configure the queue tables | ||
export const defaultTablesConfig: TablesConfig = { | ||
columnDefinitions: [ | ||
{ | ||
id: 'patient-name', | ||
columnType: 'patient-name-column', | ||
}, | ||
_description: 'Allows customization of how specific priorities are rendered', | ||
_default: [], | ||
}, | ||
statusConfigs: { | ||
_type: Type.Array, | ||
_element: { | ||
_type: Type.Object, | ||
{ | ||
id: 'patient-age', | ||
columnType: 'patient-age-column', | ||
}, | ||
_description: 'Allows customization of how specific statuses are rendered', | ||
_default: [], | ||
}, | ||
{ | ||
id: 'patient-identifier', | ||
columnType: 'patient-identifier-column', | ||
config: { | ||
identifierType: 'patient-identifier-uuid', | ||
}, | ||
}, | ||
mseaton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
id: 'priority', | ||
columnType: 'priority-column', | ||
config: { | ||
priorities: [ | ||
{ | ||
conceptUuid: 'priority-concept-uuid', | ||
tagClassName: 'tag', | ||
tagType: 'red', | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
id: 'status', | ||
columnType: 'status-column', | ||
config: { | ||
statuses: [ | ||
{ | ||
conceptUuid: 'status-concept-uuid', | ||
iconComponent: 'InProgress', | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
id: 'visit-start-time', | ||
columnType: 'visit-start-time-column', | ||
}, | ||
{ | ||
id: 'comingFrom', | ||
columnType: 'queue-coming-from-column', | ||
}, | ||
{ | ||
id: 'queue', | ||
columnType: 'current-queue-column', | ||
}, | ||
{ | ||
id: 'wait-time', | ||
columnType: 'wait-time-column', | ||
}, | ||
{ | ||
id: 'actions', | ||
columnType: 'extension-column', | ||
header: 'Actions', | ||
}, | ||
], | ||
tableDefinitions: [ | ||
{ | ||
columns: ['patient-name', 'comingFrom', 'priority', 'status', 'queue', 'wait-time', 'actions'], | ||
appliedTo: [{ queue: null, status: null }], | ||
}, | ||
], | ||
}; | ||
|
||
export const configSchema = { | ||
concepts: { | ||
defaultPriorityConceptUuid: { | ||
_type: Type.ConceptUuid, | ||
|
@@ -129,11 +188,21 @@ export const configSchema = { | |
_default: '', | ||
_description: 'Custom URL to load default facility if it is not in the session', | ||
}, | ||
tablesConfig: { | ||
_type: Type.Object, | ||
_description: `Configurations of columns to show for the queue table. | ||
Multiple configurations can be provided, each can be applied generally, or to tables | ||
for a particular queue, particular status, or even particular queue+status combination. | ||
If multiple configs are defined, the first config with matching appliedTo condition | ||
is used. | ||
See https://github.com/openmrs/openmrs-esm-patient-management/blob/main/packages/esm-service-queues-app/src/config-schema.ts | ||
for full schema definition and example. | ||
`, | ||
_default: defaultTablesConfig, | ||
}, | ||
}; | ||
|
||
export interface ConfigObject { | ||
priorityConfigs: Array<PriorityConfig>; | ||
statusConfigs: Array<StatusConfig>; | ||
concepts: { | ||
defaultPriorityConceptUuid: string; | ||
defaultStatusConceptUuid: string; | ||
|
@@ -157,17 +226,75 @@ export interface ConfigObject { | |
defaultIdentifierTypes: Array<string>; | ||
showRecommendedVisitTypeTab: boolean; | ||
customPatientChartUrl: string; | ||
defaultFacilityUrl: string; | ||
visitTypeResourceUrl: string; | ||
tablesConfig: TablesConfig; | ||
} | ||
|
||
interface TablesConfig { | ||
columnDefinitions: ColumnDefinition[]; | ||
|
||
/* | ||
A list of table definitions. A queue table (whether it is displaying entries from a | ||
particular queue+status combination, from a particular queue, or from multiple queues) | ||
will determine what columns to show based on these definitions. If multiple TableDefinitions | ||
have matching appliedTo criteria, the first one will be used. | ||
*/ | ||
tableDefinitions: TableDefinitions[]; | ||
} | ||
|
||
export type ColumnDefinition = { | ||
id: string; | ||
header?: string; // optional custom i18n translation key for the column's header; overrides the default one | ||
headerModule?: string; // optional custom i18n translation module for the column's header. Must be used with the header option | ||
} & ( | ||
| { columnType: 'patient-name-column' } | ||
| { columnType: 'patient-identifier-column'; config: PatientIdentifierColumnConfig } | ||
| { columnType: 'patient-age-column' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could probably be optional if we want, and if the type is not supplied, there is some default behavior (eg. get the first preferred identifier, or whatever is the primary identifier in the rest response, etc) |
||
| { columnType: 'priority-column'; config?: PriorityColumnConfig } | ||
| { columnType: 'status-column'; config?: StatusColumnConfig } | ||
| { columnType: 'queue-coming-from-column' } | ||
| { columnType: 'current-queue-column' } | ||
| { columnType: 'wait-time-column' } | ||
| { columnType: 'visit-start-time-column' } | ||
| { columnType: 'actions-column' } | ||
| { columnType: 'extension-column'; config?: object } // column that contains the extension slot queue-table-extension-column-slot | ||
); | ||
|
||
export interface VisitAttributeQueueNumberColumnConfig { | ||
visitQueueNumberAttributeUuid: string; | ||
} | ||
mseaton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export interface PatientIdentifierColumnConfig { | ||
identifierType: string; // uuid of the identifier type | ||
} | ||
export interface PriorityConfig { | ||
conceptUuid: string; | ||
tagType: string; | ||
tagClassName: 'priorityTag' | 'tag' | null; | ||
} | ||
|
||
export interface PriorityColumnConfig { | ||
priorities: PriorityConfig[]; | ||
} | ||
|
||
export interface StatusConfig { | ||
conceptUuid: string; | ||
iconComponent: 'Group' | 'InProgress' | null; | ||
} | ||
|
||
export interface StatusColumnConfig { | ||
statuses: StatusConfig[]; | ||
} | ||
|
||
export interface ExtensionColumnConfig { | ||
state: any; // state to pass into the extension | ||
} | ||
|
||
export interface TableDefinitions { | ||
// a list of column ids defined in columnDefinitions | ||
columns: string[]; | ||
|
||
// apply the columns to tables of any of the specified queue and status | ||
// (if appliedTo is null, apply to all tables, including the one in the service queue app home page) | ||
appliedTo?: Array<{ queue?: string; status?: string }>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
...ages/esm-service-queues-app/src/queue-entry-table-components/queue-priority.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definition of default columns to show in the queue table of the service queues app main page.