@openmrs/esm-report-builder 0.1.1-pre.101
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/.eslintignore +5 -0
- package/.eslintrc.js +19 -0
- package/.prettierrc +8 -0
- package/.tx/config +12 -0
- package/LICENSE +401 -0
- package/README.md +336 -0
- package/__mocks__/react-i18next.js +12 -0
- package/dist/128.css +1 -0
- package/dist/128.css.map +1 -0
- package/dist/128.js +338 -0
- package/dist/128.js.map +1 -0
- package/dist/1480.js +1 -0
- package/dist/1480.js.map +1 -0
- package/dist/1646.js +1 -0
- package/dist/1646.js.map +1 -0
- package/dist/1869.js +1 -0
- package/dist/1869.js.map +1 -0
- package/dist/1877.js +1 -0
- package/dist/1877.js.map +1 -0
- package/dist/2131.js +1 -0
- package/dist/2131.js.map +1 -0
- package/dist/2317.js +1 -0
- package/dist/2317.js.map +1 -0
- package/dist/2408.js +1 -0
- package/dist/2408.js.map +1 -0
- package/dist/2416.js +1 -0
- package/dist/2416.js.map +1 -0
- package/dist/282.js +1 -0
- package/dist/282.js.map +1 -0
- package/dist/2881.js +1 -0
- package/dist/2881.js.map +1 -0
- package/dist/2997.js +1 -0
- package/dist/2997.js.map +1 -0
- package/dist/3378.js +1 -0
- package/dist/3378.js.map +1 -0
- package/dist/3963.js +1 -0
- package/dist/3963.js.map +1 -0
- package/dist/4106.js +1 -0
- package/dist/4106.js.map +1 -0
- package/dist/4111.js +1 -0
- package/dist/4111.js.map +1 -0
- package/dist/4171.css +1 -0
- package/dist/4171.css.map +1 -0
- package/dist/4171.js +43 -0
- package/dist/4171.js.map +1 -0
- package/dist/434.js +1 -0
- package/dist/434.js.map +1 -0
- package/dist/4348.js +1 -0
- package/dist/4348.js.map +1 -0
- package/dist/4383.js +1 -0
- package/dist/4383.js.map +1 -0
- package/dist/4658.js +1 -0
- package/dist/4658.js.map +1 -0
- package/dist/4668.js +1 -0
- package/dist/4668.js.map +1 -0
- package/dist/4928.js +1 -0
- package/dist/4928.js.map +1 -0
- package/dist/5098.js +1 -0
- package/dist/5098.js.map +1 -0
- package/dist/5117.js +1 -0
- package/dist/5117.js.map +1 -0
- package/dist/5132.js +1 -0
- package/dist/5132.js.map +1 -0
- package/dist/5145.js +1 -0
- package/dist/5145.js.map +1 -0
- package/dist/550.js +1 -0
- package/dist/550.js.map +1 -0
- package/dist/5503.js +1 -0
- package/dist/5503.js.map +1 -0
- package/dist/556.js +1 -0
- package/dist/556.js.map +1 -0
- package/dist/5644.js +1 -0
- package/dist/5644.js.map +1 -0
- package/dist/5940.js +1 -0
- package/dist/5940.js.map +1 -0
- package/dist/6047.js +1 -0
- package/dist/6047.js.map +1 -0
- package/dist/6237.js +1 -0
- package/dist/6237.js.map +1 -0
- package/dist/6371.js +1 -0
- package/dist/6371.js.map +1 -0
- package/dist/6377.js +1 -0
- package/dist/6377.js.map +1 -0
- package/dist/6444.js +1 -0
- package/dist/6444.js.map +1 -0
- package/dist/6508.js +1 -0
- package/dist/6508.js.map +1 -0
- package/dist/6652.js +1 -0
- package/dist/6652.js.map +1 -0
- package/dist/6686.js +1 -0
- package/dist/6686.js.map +1 -0
- package/dist/6724.js +1 -0
- package/dist/6724.js.map +1 -0
- package/dist/6867.js +19 -0
- package/dist/6867.js.map +1 -0
- package/dist/6904.js +1 -0
- package/dist/6904.js.map +1 -0
- package/dist/7045.js +1 -0
- package/dist/7045.js.map +1 -0
- package/dist/7175.js +1 -0
- package/dist/7175.js.map +1 -0
- package/dist/7182.js +1 -0
- package/dist/7182.js.map +1 -0
- package/dist/7475.js +1 -0
- package/dist/7475.js.map +1 -0
- package/dist/7742.js +1 -0
- package/dist/7742.js.map +1 -0
- package/dist/7912.js +1 -0
- package/dist/7912.js.map +1 -0
- package/dist/8251.js +1 -0
- package/dist/8251.js.map +1 -0
- package/dist/8358.js +1 -0
- package/dist/8358.js.map +1 -0
- package/dist/8359.js +1 -0
- package/dist/8359.js.map +1 -0
- package/dist/8695.js +1 -0
- package/dist/8695.js.map +1 -0
- package/dist/903.js +1 -0
- package/dist/903.js.map +1 -0
- package/dist/9072.js +1 -0
- package/dist/9072.js.map +1 -0
- package/dist/9806.js +1 -0
- package/dist/9806.js.map +1 -0
- package/dist/997.js +1 -0
- package/dist/997.js.map +1 -0
- package/dist/openmrs-esm-report-builder.js +3 -0
- package/dist/openmrs-esm-report-builder.js.buildmanifest.json +1433 -0
- package/dist/openmrs-esm-report-builder.js.map +1 -0
- package/dist/routes.json +1 -0
- package/e2e/core/env.ts +5 -0
- package/e2e/core/global-setup.ts +34 -0
- package/e2e/core/test.ts +21 -0
- package/e2e/pages/app-shell.page.ts +35 -0
- package/e2e/pages/etl-sources.page.ts +36 -0
- package/e2e/pages/report-sections.page.ts +21 -0
- package/e2e/pages/section-preview.modal.ts +29 -0
- package/e2e/specs/etl-sources.spec.ts +51 -0
- package/e2e/specs/navigation.spec.ts +13 -0
- package/e2e/specs/section-preview-validation.spec.ts +38 -0
- package/e2e/specs/section-preview.spec.ts +94 -0
- package/e2e/support/github/Dockerfile +32 -0
- package/e2e/support/github/Dockerfile.dockerignore +13 -0
- package/e2e/support/github/docker-compose.yml +31 -0
- package/e2e/support/github/run-e2e-docker-env.sh +131 -0
- package/e2e/support/github/spa-assemble-config.json +6 -0
- package/e2e/tsconfig.json +11 -0
- package/example.env +5 -0
- package/linelist_report_builder_design_spec.md +816 -0
- package/package.json +98 -0
- package/playwright.config.ts +28 -0
- package/rspack.config.js +2 -0
- package/src/__debug__/all-designs.test.tsx +33 -0
- package/src/admin-card-link.extension.module.scss +55 -0
- package/src/admin-card-link.extension.tsx +24 -0
- package/src/components/admin/admin-page.component.tsx +75 -0
- package/src/components/admin/age-categories-page.component.tsx +109 -0
- package/src/components/admin/age-groups-page.component.tsx +146 -0
- package/src/components/admin/etl-browser/columns-tab.component.tsx +80 -0
- package/src/components/admin/etl-browser/etl-browser-page.component.tsx +309 -0
- package/src/components/admin/etl-browser/etl-browser.component.scss +424 -0
- package/src/components/admin/etl-browser/metadata-tab.component.tsx +65 -0
- package/src/components/admin/etl-browser/preview-grid.component.tsx +189 -0
- package/src/components/admin/etl-browser/relationships-tab.component.tsx +21 -0
- package/src/components/admin/etl-browser/sources-tree.component.tsx +118 -0
- package/src/components/admin/etl-browser/table-detail.component.tsx +124 -0
- package/src/components/admin/etl-browser/table-info-strip.component.tsx +51 -0
- package/src/components/admin/etl-browser/table-list.component.tsx +136 -0
- package/src/components/admin/etl-browser/use-table-preview.ts +47 -0
- package/src/components/admin/etl-sources-page.component.tsx +355 -0
- package/src/components/admin/etl-tasks-page.component.scss +370 -0
- package/src/components/admin/etl-tasks-page.component.tsx +768 -0
- package/src/components/admin/report-categories-page.component.tsx +267 -0
- package/src/components/admin/report-library-page.component.tsx +551 -0
- package/src/components/ai-support/ai-assist-button.component.tsx +30 -0
- package/src/components/ai-support/ai-assist-modal.component.tsx +81 -0
- package/src/components/ai-support/ai.service.ts +21 -0
- package/src/components/ai-support/ai.types.ts +12 -0
- package/src/components/app-shell/report-builder-shell.component.tsx +242 -0
- package/src/components/app-shell/report-builder-shell.scss +18 -0
- package/src/components/dashboards/dashboard-config.schema.ts +97 -0
- package/src/components/dashboards/dashboard-form-modal.component.tsx +150 -0
- package/src/components/dashboards/dashboards-admin.scss +62 -0
- package/src/components/dashboards/dashboards-page.component.tsx +153 -0
- package/src/components/dashboards/dashboards-table.component.tsx +130 -0
- package/src/components/dashboards/sections/dashboard-autoinclude.section.tsx +75 -0
- package/src/components/dashboards/sections/dashboard-basics.section.tsx +80 -0
- package/src/components/dashboards/sections/dashboard-json.section.tsx +79 -0
- package/src/components/dashboards/sections/dashboard-sections-editor.section.tsx +130 -0
- package/src/components/dashboards/sections/dashboard-widgets-editor.section.tsx +184 -0
- package/src/components/data-themes/data-theme-form.component.tsx +59 -0
- package/src/components/data-themes/data-theme-modal.component.tsx +349 -0
- package/src/components/data-themes/data-themes-page.component.tsx +139 -0
- package/src/components/data-themes/data-themes-table.component.tsx +98 -0
- package/src/components/data-themes/icon-registry.ts +35 -0
- package/src/components/data-themes/sections/data-theme-basics.section.tsx +63 -0
- package/src/components/data-themes/sections/data-theme-condition-columns.section.tsx +397 -0
- package/src/components/data-themes/sections/data-theme-fields-editor.section.tsx +125 -0
- package/src/components/data-themes/sections/data-theme-metadata.section.tsx +245 -0
- package/src/components/data-themes/sections/data-theme-preview.section.tsx +115 -0
- package/src/components/data-themes/sections/data-theme-source.section.tsx +184 -0
- package/src/components/data-visualizer/components/cqi-components/cqi-data-table.component.tsx +214 -0
- package/src/components/data-visualizer/components/cqi-components/cqi-elements.ts +203 -0
- package/src/components/data-visualizer/components/cqi-components/detail.component.tsx +110 -0
- package/src/components/data-visualizer/components/cqi-components/detail.scss +22 -0
- package/src/components/data-visualizer/components/data-table/data-table.component.tsx +208 -0
- package/src/components/data-visualizer/components/data-table/data-tables.scss +206 -0
- package/src/components/data-visualizer/components/empty-state/empty-state-illustration.component.tsx +53 -0
- package/src/components/data-visualizer/components/header/header.component.tsx +43 -0
- package/src/components/data-visualizer/components/header/header.scss +71 -0
- package/src/components/data-visualizer/components/model/confirm.component.tsx +40 -0
- package/src/components/data-visualizer/components/panel/panel.component.tsx +20 -0
- package/src/components/data-visualizer/components/panel/panel.scss +25 -0
- package/src/components/data-visualizer/components/popover/modifier-panel.tsx +53 -0
- package/src/components/data-visualizer/constants.ts +445 -0
- package/src/components/data-visualizer/data-visualizer-illustration.component.tsx +31 -0
- package/src/components/data-visualizer/data-visualizer.component.tsx +1935 -0
- package/src/components/data-visualizer/data-visualizer.resource.ts +462 -0
- package/src/components/data-visualizer/data-visualizer.scss +448 -0
- package/src/components/data-visualizer/declarations.d.ts +131 -0
- package/src/components/data-visualizer/parameter-inputs/boolean-parameter-input.component.tsx +34 -0
- package/src/components/data-visualizer/parameter-inputs/concept-parameter-input.component.tsx +81 -0
- package/src/components/data-visualizer/parameter-inputs/date-parameter-input.component.tsx +110 -0
- package/src/components/data-visualizer/parameter-inputs/date-range-input.component.scss +47 -0
- package/src/components/data-visualizer/parameter-inputs/date-range-input.component.tsx +228 -0
- package/src/components/data-visualizer/parameter-inputs/identifier-type-parameter-input.component.tsx +69 -0
- package/src/components/data-visualizer/parameter-inputs/list-parameter-input.component.tsx +73 -0
- package/src/components/data-visualizer/parameter-inputs/location-parameter-input.component.tsx +81 -0
- package/src/components/data-visualizer/parameter-inputs/number-parameter-input.component.tsx +40 -0
- package/src/components/data-visualizer/parameter-inputs/person-attribute-parameter-input.component.tsx +71 -0
- package/src/components/data-visualizer/parameter-inputs/text-parameter-input.component.tsx +52 -0
- package/src/components/data-visualizer/report-parameter-modal.component.tsx +383 -0
- package/src/components/data-visualizer/types.ts +206 -0
- package/src/components/etl-monitor/builder/builder-state-machine.ts +381 -0
- package/src/components/etl-monitor/builder/design-registry.tsx +139 -0
- package/src/components/etl-monitor/builder/etl-monitor-builder-context.tsx +702 -0
- package/src/components/etl-monitor/builder/etl-monitor-builder-modal.component.tsx +461 -0
- package/src/components/etl-monitor/builder/etl-monitor-builder-modal.scss +256 -0
- package/src/components/etl-monitor/builder/etl-monitor-builder-page.component.tsx +387 -0
- package/src/components/etl-monitor/builder/etl-monitor-builder-page.scss +976 -0
- package/src/components/etl-monitor/builder/generated-config-panel.component.tsx +168 -0
- package/src/components/etl-monitor/builder/generated-config-panel.scss +198 -0
- package/src/components/etl-monitor/builder/index.ts +5 -0
- package/src/components/etl-monitor/builder/monitor-preview.tsx +124 -0
- package/src/components/etl-monitor/builder/steps/data-source-step.component.tsx +667 -0
- package/src/components/etl-monitor/builder/steps/data-source-step.scss +284 -0
- package/src/components/etl-monitor/builder/steps/design-samples.ts +278 -0
- package/src/components/etl-monitor/builder/steps/design-step.component.tsx +299 -0
- package/src/components/etl-monitor/builder/steps/design-step.scss +479 -0
- package/src/components/etl-monitor/builder/steps/fields-step.component.tsx +859 -0
- package/src/components/etl-monitor/builder/steps/fields-step.scss +459 -0
- package/src/components/etl-monitor/builder/steps/general-step.component.tsx +288 -0
- package/src/components/etl-monitor/builder/steps/general-step.scss +103 -0
- package/src/components/etl-monitor/builder/steps/index.ts +5 -0
- package/src/components/etl-monitor/builder/steps/preview-step.component.tsx +245 -0
- package/src/components/etl-monitor/builder/steps/preview-step.scss +236 -0
- package/src/components/etl-monitor/etl-monitor-card-shell.component.tsx +154 -0
- package/src/components/etl-monitor/etl-monitor-card-shell.scss +103 -0
- package/src/components/etl-monitor/etl-monitor-dashboard.component.tsx +227 -0
- package/src/components/etl-monitor/etl-monitor-dashboard.scss +148 -0
- package/src/components/etl-monitor/etl-monitor-status-card.component.tsx +192 -0
- package/src/components/etl-monitor/etl-monitors-page.component.tsx +621 -0
- package/src/components/etl-monitor/renderers/DetailsRenderer.tsx +2 -0
- package/src/components/etl-monitor/renderers/ErrorLogRenderer.tsx +2 -0
- package/src/components/etl-monitor/renderers/EtlMonitorWidget.tsx +97 -0
- package/src/components/etl-monitor/renderers/MetricsGridRenderer.tsx +2 -0
- package/src/components/etl-monitor/renderers/MonitorRenderer.tsx +175 -0
- package/src/components/etl-monitor/renderers/ProgressRenderer.tsx +2 -0
- package/src/components/etl-monitor/renderers/StatusCardRenderer.tsx +2 -0
- package/src/components/etl-monitor/renderers/SummaryCardRenderer.tsx +2 -0
- package/src/components/etl-monitor/renderers/TableRenderer.tsx +2 -0
- package/src/components/etl-monitor/renderers/component-icons.tsx +33 -0
- package/src/components/etl-monitor/renderers/components/details-renderer.tsx +195 -0
- package/src/components/etl-monitor/renderers/components/error-log-renderer.tsx +104 -0
- package/src/components/etl-monitor/renderers/components/index.ts +6 -0
- package/src/components/etl-monitor/renderers/components/log-renderer.tsx +86 -0
- package/src/components/etl-monitor/renderers/components/metrics-grid-renderer.tsx +133 -0
- package/src/components/etl-monitor/renderers/components/progress-renderer.tsx +188 -0
- package/src/components/etl-monitor/renderers/components/status-card-renderer.tsx +247 -0
- package/src/components/etl-monitor/renderers/components/summary-card-renderer.tsx +160 -0
- package/src/components/etl-monitor/renderers/components/table-renderer.tsx +175 -0
- package/src/components/etl-monitor/renderers/components/time-series-renderer.tsx +310 -0
- package/src/components/etl-monitor/renderers/data-transformer.ts +361 -0
- package/src/components/etl-monitor/renderers/index.ts +11 -0
- package/src/components/etl-monitor/renderers/legacy-monitor-renderer.tsx +69 -0
- package/src/components/etl-monitor/renderers/monitor-renderer.tsx +6 -0
- package/src/components/etl-monitor/renderers/monitor-renderers.scss +1621 -0
- package/src/components/etl-monitor/renderers/monitor-widget-card.component.tsx +54 -0
- package/src/components/etl-monitor/renderers/monitor-widget-card.scss +16 -0
- package/src/components/etl-monitor/renderers/v2-monitor-renderer.tsx +227 -0
- package/src/components/import-export/artifact-groups.ts +153 -0
- package/src/components/import-export/export-report-modal.component.tsx +265 -0
- package/src/components/import-export/import-export-page.component.tsx +610 -0
- package/src/components/import-export/import-export.styles.scss +825 -0
- package/src/components/import-export/import-package-modal.component.tsx +401 -0
- package/src/components/import-export/index.ts +3 -0
- package/src/components/indicators/README.md +24 -0
- package/src/components/indicators/base-indicator-basic-fields.component.tsx +18 -0
- package/src/components/indicators/base-indicator-basics.section.tsx +54 -0
- package/src/components/indicators/base-indicator-countby.section.tsx +25 -0
- package/src/components/indicators/base-indicator-criteria.section.tsx +83 -0
- package/src/components/indicators/base-indicator-details-form.component.tsx +80 -0
- package/src/components/indicators/base-indicator-theme-unit-fields.component.tsx +39 -0
- package/src/components/indicators/create-base-indicator-modal.component.tsx +623 -0
- package/src/components/indicators/create-composite-base-indicator-modal.component.tsx +295 -0
- package/src/components/indicators/create-custom-indicator-modal.component.tsx +548 -0
- package/src/components/indicators/create-final-indicator-modal.component.tsx +285 -0
- package/src/components/indicators/custom-condition-input.component.tsx +310 -0
- package/src/components/indicators/diagnosis-filters-form.component.tsx +101 -0
- package/src/components/indicators/disaggregation-panel.component.tsx +93 -0
- package/src/components/indicators/handler/concept-search-multiselect.component.tsx +153 -0
- package/src/components/indicators/handler/question-answer-concept-search.component.tsx +336 -0
- package/src/components/indicators/indicator-run-preview-modal.component.tsx +391 -0
- package/src/components/indicators/indicator-search-select.component.tsx +297 -0
- package/src/components/indicators/indicator-status-tag.component.tsx +9 -0
- package/src/components/indicators/indicators-page.component.tsx +673 -0
- package/src/components/indicators/indicators-page.scss +121 -0
- package/src/components/indicators/indicators-table.component.tsx +188 -0
- package/src/components/indicators/preview-table.component.tsx +31 -0
- package/src/components/indicators/sections/composite-indicator-basics.section.tsx +36 -0
- package/src/components/indicators/sections/composite-indicator-picker.section.tsx +116 -0
- package/src/components/indicators/sections/composite-indicator-sql-preview.section.tsx +31 -0
- package/src/components/indicators/sections/custom-indicator-basics.section.tsx +65 -0
- package/src/components/indicators/sections/custom-indicator-disaggregation.section.tsx +93 -0
- package/src/components/indicators/sections/custom-indicator-filters.section.tsx +203 -0
- package/src/components/indicators/sections/custom-indicator-population.section.tsx +107 -0
- package/src/components/indicators/sections/custom-indicator-sql-preview.section.tsx +108 -0
- package/src/components/indicators/sections/final-indicator-basics.section.tsx +46 -0
- package/src/components/indicators/sections/final-indicator-disaggregation.section.tsx +47 -0
- package/src/components/indicators/sections/final-indicator-picker.section.tsx +60 -0
- package/src/components/indicators/sections/final-indicator-preview.section.tsx +20 -0
- package/src/components/indicators/sections/final-indicator-results-preview.section.tsx +65 -0
- package/src/components/indicators/sections/indicator-basics.section.tsx +40 -0
- package/src/components/indicators/sections/indicator-conditions.section.tsx +279 -0
- package/src/components/indicators/sections/indicator-sql-preview.section.tsx +63 -0
- package/src/components/indicators/sections/indicator-theme.section.tsx +48 -0
- package/src/components/indicators/sql-preview.component.tsx +19 -0
- package/src/components/indicators/tag-input.component.tsx +177 -0
- package/src/components/indicators/types/base-indicator-form.types.ts +17 -0
- package/src/components/indicators/types/base-indicator-theme.constants.ts +8 -0
- package/src/components/indicators/types/composite-indicator.types.ts +27 -0
- package/src/components/indicators/types/condition-ui.types.ts +11 -0
- package/src/components/indicators/types/custom-indicator.types.ts +161 -0
- package/src/components/indicators/types/data-theme-config.types.ts +88 -0
- package/src/components/indicators/types/indicator-types.ts +57 -0
- package/src/components/indicators/types/sql-builders.ts +43 -0
- package/src/components/indicators/utils/composite-indicator-sql.utils.test.ts +143 -0
- package/src/components/indicators/utils/composite-indicator-sql.utils.ts +426 -0
- package/src/components/indicators/utils/concept-preload.utils.ts +21 -0
- package/src/components/indicators/utils/custom-indicator-interpreter.test.ts +493 -0
- package/src/components/indicators/utils/custom-indicator-interpreter.ts +702 -0
- package/src/components/indicators/utils/final-indicator-sql.utils.ts +190 -0
- package/src/components/indicators/utils/indicator-conditions-hydration.utils.ts +254 -0
- package/src/components/indicators/utils/indicator-sql-resolution.utils.ts +204 -0
- package/src/components/indicators/utils/indicator-sql.utils.ts +721 -0
- package/src/components/indicators/utils/population-sql.compiler.test.ts +985 -0
- package/src/components/indicators/utils/population-sql.compiler.ts +858 -0
- package/src/components/landing/landing-action-item.component.tsx +50 -0
- package/src/components/landing/landing-action-list.component.tsx +12 -0
- package/src/components/landing/landing-activity-list.component.tsx +47 -0
- package/src/components/landing/landing-footer-grid.component.tsx +45 -0
- package/src/components/landing/landing-hero.component.tsx +18 -0
- package/src/components/landing/landing-section-card.component.tsx +33 -0
- package/src/components/landing/report-builder-landing-page.component.tsx +186 -0
- package/src/components/landing/report-builder-landing-page.scss +131 -0
- package/src/components/legacy-reports/legacy-report-detail-page.component.tsx +300 -0
- package/src/components/legacy-reports/legacy-report-editor-page.component.tsx +324 -0
- package/src/components/legacy-reports/legacy-report-upload-modal.component.tsx +307 -0
- package/src/components/legacy-reports/legacy-reports-page.component.tsx +206 -0
- package/src/components/legacy-reports/legacy-reports-table.component.tsx +154 -0
- package/src/components/legacy-reports/tabs/legacy-report-datasets-tab.component.tsx +344 -0
- package/src/components/legacy-reports/tabs/legacy-report-dimensions-tab.component.tsx +590 -0
- package/src/components/legacy-reports/tabs/legacy-report-indicators-tab.component.tsx +490 -0
- package/src/components/legacy-reports/tabs/legacy-report-json-preview-tab.component.tsx +272 -0
- package/src/components/legacy-reports/tabs/legacy-report-overview-tab.component.tsx +218 -0
- package/src/components/legacy-reports/tabs/legacy-report-parameters-tab.component.tsx +279 -0
- package/src/components/linelist/definition/indicator-to-sql.utils.ts +281 -0
- package/src/components/linelist/definition/linelist-definition-editor.component.tsx +1676 -0
- package/src/components/linelist/definition/linelist-definition-editor.scss +461 -0
- package/src/components/linelist/definition/linelist-definition.types.ts +108 -0
- package/src/components/linelist/definition/panels/column-properties-panel.component.tsx +328 -0
- package/src/components/linelist/definition/panels/column-selector-panel.component.tsx +1082 -0
- package/src/components/linelist/definition/panels/column-selector-panel.scss +100 -0
- package/src/components/linelist/definition/panels/custom-sql-column-modal.component.tsx +248 -0
- package/src/components/linelist/definition/panels/encounter-diagnosis-column-modal.component.tsx +300 -0
- package/src/components/linelist/definition/panels/encounter-diagnosis-column-modal.scss +21 -0
- package/src/components/linelist/definition/panels/multi-datasource-selector.component.tsx +332 -0
- package/src/components/linelist/definition/panels/multi-datasource-selector.scss +161 -0
- package/src/components/linelist/definition/panels/observation-column-modal.component.tsx +450 -0
- package/src/components/linelist/definition/panels/observation-column-modal.scss +29 -0
- package/src/components/linelist/definition/panels/parameter-panel.component.tsx +659 -0
- package/src/components/linelist/definition/panels/parameter-panel.scss +64 -0
- package/src/components/linelist/definition/panels/population-source-selector.component.tsx +407 -0
- package/src/components/linelist/definition/panels/population-source-selector.scss +187 -0
- package/src/components/linelist/design/panels/column-category-selector.component.tsx +433 -0
- package/src/components/linelist/design/panels/column-category-selector.scss +324 -0
- package/src/components/linelist/design/panels/column-debug-panel.component.tsx +197 -0
- package/src/components/linelist/design/panels/column-debug-panel.scss +141 -0
- package/src/components/linelist/design/panels/data-catalogue.component.tsx +1062 -0
- package/src/components/linelist/design/panels/data-catalogue.scss +263 -0
- package/src/components/linelist/design/panels/display-settings-panel.component.tsx +405 -0
- package/src/components/linelist/design/panels/display-settings-panel.scss +78 -0
- package/src/components/linelist/design/panels/filtermap-editor.component.tsx +434 -0
- package/src/components/linelist/design/panels/filtermap-editor.scss +176 -0
- package/src/components/linelist/design/panels/json-preview.component.tsx +114 -0
- package/src/components/linelist/design/panels/json-preview.scss +85 -0
- package/src/components/linelist/design/panels/query-config-panel.component.tsx +1137 -0
- package/src/components/linelist/design/panels/query-config-panel.scss +341 -0
- package/src/components/linelist/design/panels/sort-config-panel.component.tsx +330 -0
- package/src/components/linelist/design/panels/sort-config-panel.scss +77 -0
- package/src/components/linelist/design/panels/sql-builder-panel.component.tsx +475 -0
- package/src/components/linelist/design/panels/sql-builder-panel.scss +226 -0
- package/src/components/linelist/design/panels/transformation-panel.component.tsx +687 -0
- package/src/components/linelist/design/panels/transformation-panel.scss +81 -0
- package/src/components/linelist/design/panels/visual-filter-panel.component.tsx +595 -0
- package/src/components/linelist/design/panels/visual-filter-panel.scss +76 -0
- package/src/components/linelist/linelist-dashboard.page.component.tsx +756 -0
- package/src/components/linelist/linelist-dashboard.page.scss +240 -0
- package/src/components/linelist/linelist-editor.page.component.tsx +134 -0
- package/src/components/linelist/linelist-editor.page.scss +28 -0
- package/src/components/linelist/linelist-run-report.page.component.tsx +715 -0
- package/src/components/linelist/linelist-run-report.page.scss +136 -0
- package/src/components/linelist/modals/linelist-report-builder-modal.component.tsx +1454 -0
- package/src/components/linelist/modals/linelist-report-builder-modal.scss +164 -0
- package/src/components/linelist/modals/preview-parameter-modal.component.tsx +361 -0
- package/src/components/report/dashboard/reports-table.component.tsx +186 -0
- package/src/components/report/definition/panels/properties-panel.component.tsx +38 -0
- package/src/components/report/definition/panels/report-structure-panel.component.tsx +61 -0
- package/src/components/report/definition/panels/selection-panel.component.tsx +58 -0
- package/src/components/report/definition/report-definition-editor.component.tsx +99 -0
- package/src/components/report/definition/report-definition.types.ts +66 -0
- package/src/components/report/design/panels/IndicatorPropertiesPanel.scss +33 -0
- package/src/components/report/design/panels/IndicatorPropertiesPanel.tsx +389 -0
- package/src/components/report/design/panels/JsonPreviewPanel.scss +32 -0
- package/src/components/report/design/panels/JsonPreviewPanel.tsx +104 -0
- package/src/components/report/design/panels/mapping-preview-panel.component.tsx +82 -0
- package/src/components/report/design/panels/mapping-preview-panel.scss +55 -0
- package/src/components/report/design/panels/template-structure-panel.component.tsx +296 -0
- package/src/components/report/design/panels/template-structure-panel.scss +81 -0
- package/src/components/report/design/report-design-editor.component.tsx +1170 -0
- package/src/components/report/design/report-design.types.ts +48 -0
- package/src/components/report/design/report-design.utils.ts +86 -0
- package/src/components/report/panels/report-detail.component.tsx +71 -0
- package/src/components/report/panels/report-panel-shell.component.tsx +60 -0
- package/src/components/report/report-dashboard.page.component.tsx +554 -0
- package/src/components/report/report-editor.page.component.tsx +590 -0
- package/src/components/report/report.routes.tsx +32 -0
- package/src/components/report-sections/create-report-section-modal.component.tsx +388 -0
- package/src/components/report-sections/hooks/useAgeCategories.ts +25 -0
- package/src/components/report-sections/hooks/useSectionEditorState.ts +449 -0
- package/src/components/report-sections/panels/Dhis2MappingPanel.tsx +157 -0
- package/src/components/report-sections/panels/DisaggregationPanel.tsx +97 -0
- package/src/components/report-sections/panels/IndicatorPickerPanel.tsx +201 -0
- package/src/components/report-sections/panels/SectionBasicsPanel.tsx +27 -0
- package/src/components/report-sections/report-section-preview-modal.component.tsx +548 -0
- package/src/components/report-sections/report-sections-page.component.tsx +325 -0
- package/src/components/report-sections/section-disaggregation.utils.ts +637 -0
- package/src/components/report-sections/section-types.ts +55 -0
- package/src/components/report-sections/section-utils.ts +50 -0
- package/src/components/report-sections/sections-page.scss +79 -0
- package/src/components/run-reports/run-reports-page.component.tsx +8 -0
- package/src/components/security/access-denied-page.component.tsx +64 -0
- package/src/components/security/access-denied-page.scss +39 -0
- package/src/components/security/privilege-route.component.test.tsx +76 -0
- package/src/components/security/privilege-route.component.tsx +39 -0
- package/src/components/shared/compile-setup-modal.component.tsx +182 -0
- package/src/components/shared/concept-selector.component.tsx +245 -0
- package/src/components/shared/concept-selector.scss +121 -0
- package/src/components/shared/header/builder-header-actions.component.tsx +38 -0
- package/src/components/shared/header/header.component.tsx +85 -0
- package/src/components/shared/header/header.scss +151 -0
- package/src/components/shared/header/illustration.component.tsx +34 -0
- package/src/components/shared/indicator-properties-panel/IndicatorPropertiesPanel.scss +33 -0
- package/src/components/shared/indicator-properties-panel/IndicatorPropertiesPanel.tsx +389 -0
- package/src/components/shared/json-preview-panel/JsonPreviewPanel.scss +32 -0
- package/src/components/shared/json-preview-panel/JsonPreviewPanel.tsx +104 -0
- package/src/components/shared/mapping-preview-panel/mapping-preview-panel.component.tsx +82 -0
- package/src/components/shared/mapping-preview-panel/mapping-preview-panel.scss +55 -0
- package/src/components/shared/preview/query-results-preview.component.tsx +204 -0
- package/src/components/shared/template-structure-panel/template-structure-panel.component.tsx +296 -0
- package/src/components/shared/template-structure-panel/template-structure-panel.scss +81 -0
- package/src/config-schema.ts +43 -0
- package/src/constants/privileges.test.ts +54 -0
- package/src/constants/privileges.ts +118 -0
- package/src/features/dashboards/DashboardRendererPage.tsx +174 -0
- package/src/features/dashboards/DashboardsPage.tsx +164 -0
- package/src/features/dashboards/EtlDashboardPage.tsx +32 -0
- package/src/features/dashboards/components/DashboardEmptyState.tsx +41 -0
- package/src/features/dashboards/components/DashboardGrid.tsx +48 -0
- package/src/features/dashboards/components/DashboardHeader.tsx +58 -0
- package/src/features/dashboards/components/DashboardSection.tsx +46 -0
- package/src/features/dashboards/components/ReportLaunchCard.tsx +51 -0
- package/src/features/dashboards/components/WidgetSlotDispatcher.tsx +61 -0
- package/src/features/dashboards/components/WidgetUnavailableCard.tsx +36 -0
- package/src/features/dashboards/dashboards.scss +196 -0
- package/src/features/dashboards/hooks/useDashboard.ts +61 -0
- package/src/features/dashboards/hooks/useDashboardWidgets.ts +74 -0
- package/src/features/dashboards/hooks/useDashboards.ts +56 -0
- package/src/features/dashboards/hooks/useMonitorDataMap.ts +84 -0
- package/src/features/dashboards/index.ts +11 -0
- package/src/features/dashboards/utils/dashboard-config.util.test.ts +286 -0
- package/src/features/dashboards/utils/dashboard-config.util.ts +382 -0
- package/src/features/report-visualizer/ReportVisualizerPage.tsx +448 -0
- package/src/features/report-visualizer/components/Export/ExportMenu.tsx +141 -0
- package/src/features/report-visualizer/components/Export/index.ts +2 -0
- package/src/features/report-visualizer/components/ReportExplorer/QuickFilters.tsx +152 -0
- package/src/features/report-visualizer/components/ReportExplorer/ReportCategoryFilter.tsx +54 -0
- package/src/features/report-visualizer/components/ReportExplorer/ReportExplorerPanel.tsx +201 -0
- package/src/features/report-visualizer/components/ReportExplorer/ReportExplorerRail.tsx +202 -0
- package/src/features/report-visualizer/components/ReportExplorer/ReportList.tsx +287 -0
- package/src/features/report-visualizer/components/ReportExplorer/ReportSearch.tsx +151 -0
- package/src/features/report-visualizer/components/ReportExplorer/ReportTagFilter.tsx +100 -0
- package/src/features/report-visualizer/components/ReportExplorer/RunReportButton.tsx +42 -0
- package/src/features/report-visualizer/components/ReportExplorer/RuntimeParameterForm.tsx +259 -0
- package/src/features/report-visualizer/components/ReportExplorer/index.ts +8 -0
- package/src/features/report-visualizer/components/ReportWorkspace/ReportLayer.tsx +33 -0
- package/src/features/report-visualizer/components/ReportWorkspace/ReportSummary.tsx +88 -0
- package/src/features/report-visualizer/components/ReportWorkspace/ReportViewTabs.tsx +72 -0
- package/src/features/report-visualizer/components/ReportWorkspace/ReportWorkspaceHeader.tsx +92 -0
- package/src/features/report-visualizer/components/ReportWorkspace/ReportWorkspacePanel.tsx +242 -0
- package/src/features/report-visualizer/components/ReportWorkspace/index.ts +5 -0
- package/src/features/report-visualizer/components/TableView/ColumnVisibilityMenu.tsx +206 -0
- package/src/features/report-visualizer/components/TableView/ReportTable.tsx +253 -0
- package/src/features/report-visualizer/components/TableView/index.ts +2 -0
- package/src/features/report-visualizer/hooks/index.ts +4 -0
- package/src/features/report-visualizer/hooks/useExplorerPreferences.ts +103 -0
- package/src/features/report-visualizer/hooks/useReportCapabilities.ts +112 -0
- package/src/features/report-visualizer/hooks/useReportParameters.ts +152 -0
- package/src/features/report-visualizer/hooks/useReports.ts +135 -0
- package/src/features/report-visualizer/index.ts +6 -0
- package/src/features/report-visualizer/report-visualizer.scss +593 -0
- package/src/features/report-visualizer/types/index.ts +1 -0
- package/src/features/report-visualizer/types/report-visualizer.types.ts +104 -0
- package/src/features/report-visualizer/utils/status-colors.ts +117 -0
- package/src/globals.d.ts +9 -0
- package/src/hooks/address-template.ts +86 -0
- package/src/hooks/concept.ts +112 -0
- package/src/hooks/indicator/index.ts +1 -0
- package/src/hooks/indicator/useIndicatorsByTheme.ts +41 -0
- package/src/hooks/openmrs-reference-data.ts +432 -0
- package/src/hooks/theme/index.ts +4 -0
- package/src/hooks/theme/useDataTheme.ts +61 -0
- package/src/hooks/theme/useDataThemes.ts +28 -0
- package/src/hooks/theme/useMambaTableMeta.ts +34 -0
- package/src/hooks/theme/useMambaTables.ts +95 -0
- package/src/hooks/use-report-builder-privileges.test.tsx +92 -0
- package/src/hooks/use-report-builder-privileges.ts +58 -0
- package/src/index.ts +29 -0
- package/src/resources/address-template/address-template.api.ts +180 -0
- package/src/resources/agegroup/agegroups.api.ts +58 -0
- package/src/resources/concept/concept.api.ts +116 -0
- package/src/resources/concepts/concept-mapper.ts +21 -0
- package/src/resources/concepts/concept-types.ts +31 -0
- package/src/resources/concepts/concepts.resource.ts +44 -0
- package/src/resources/concepts/useConceptSearch.ts +41 -0
- package/src/resources/dashboard/dashboard.api.ts +107 -0
- package/src/resources/etl-monitor/etl-monitor-test.api.ts +409 -0
- package/src/resources/etl-monitor/etl-monitor.api.ts +381 -0
- package/src/resources/etl-source/etl-source.api.ts +65 -0
- package/src/resources/etl-task/etl-task.api.ts +96 -0
- package/src/resources/etl-task/etl-task.types.ts +31 -0
- package/src/resources/indicator/indicators.api.ts +125 -0
- package/src/resources/legacy-reports/legacy-reports.api.ts +144 -0
- package/src/resources/linelist/linelist-reports.api.ts +616 -0
- package/src/resources/location/location.api.ts +135 -0
- package/src/resources/openmrs-api.ts +40 -0
- package/src/resources/patient-identifier-type/patient-identifier-type.api.ts +65 -0
- package/src/resources/person-attribute-type/person-attribute-type.api.ts +71 -0
- package/src/resources/preview/sql-preview.api.ts +54 -0
- package/src/resources/report/reports.api.ts +140 -0
- package/src/resources/report-category/report-category.api.ts +41 -0
- package/src/resources/report-import-export/import-export-api.ts +164 -0
- package/src/resources/report-library/report-library.api.ts +63 -0
- package/src/resources/report-section/report-sections.api.ts +73 -0
- package/src/resources/report-section/section-preview.api.ts +25 -0
- package/src/resources/theme/data-theme.api.ts +88 -0
- package/src/resources/theme/etl-schema.api.ts +101 -0
- package/src/resources/theme/etl-table-meta.api.ts +45 -0
- package/src/root.component.tsx +20 -0
- package/src/routes/report-builder.routes.tsx +160 -0
- package/src/routes/report-builder.scss +56 -0
- package/src/routes.json +31 -0
- package/src/sample-template.ts +121 -0
- package/src/template-utils.ts +110 -0
- package/src/types/carbon-react-inert.d.ts +13 -0
- package/src/types/condition-operators.ts +63 -0
- package/src/types/dashboard/dashboard.types.ts +137 -0
- package/src/types/dashboard/index.ts +4 -0
- package/src/types/etl/etl-types.ts +238 -0
- package/src/types/etl-monitor/etl-monitor-builder.types.ts +555 -0
- package/src/types/etl-monitor/etl-monitor-v2.types.ts +397 -0
- package/src/types/etl-monitor/etl-monitor.types.ts +188 -0
- package/src/types/etl-monitor/index.ts +6 -0
- package/src/types/linelist/compile-config.ts +455 -0
- package/src/types/linelist-types.ts +2059 -0
- package/src/types/theme/data-theme.types.ts +88 -0
- package/src/utils/api-error.utils.test.ts +147 -0
- package/src/utils/api-error.utils.ts +131 -0
- package/src/utils/config-enhancer.ts +62 -0
- package/src/utils/etl-browser/etl-browser.util.test.ts +151 -0
- package/src/utils/etl-browser/export-csv.util.ts +43 -0
- package/src/utils/etl-browser/group-tables.util.ts +84 -0
- package/src/utils/etl-browser/index.ts +4 -0
- package/src/utils/etl-browser/summarize-columns.util.ts +27 -0
- package/src/utils/etl-browser/table-sql.util.ts +20 -0
- package/src/utils/etl-monitor/config-v2-adapter.util.ts +460 -0
- package/src/utils/etl-monitor/endpoint-config-normalizer.util.ts +383 -0
- package/src/utils/etl-monitor/index.ts +10 -0
- package/src/utils/etl-monitor/jsonpath-resolver.util.ts +118 -0
- package/src/utils/etl-monitor/normalization-examples.ts +0 -0
- package/src/utils/etl-monitor/schema-inspector.util.ts +76 -0
- package/src/utils/etl-monitor/semantic-type-detector.util.ts +76 -0
- package/src/utils/etl-monitor/status-mapper.util.ts +105 -0
- package/src/utils/etl-monitor/value-formatters.util.ts +167 -0
- package/src/utils/etl-task/etl-task-card.util.test.ts +240 -0
- package/src/utils/etl-task/etl-task-card.util.ts +276 -0
- package/src/utils/etl-task/index.ts +1 -0
- package/src/utils/html-entities.utils.ts +34 -0
- package/src/utils/parameter-resolution.ts +218 -0
- package/src/views/etl-monitor-builder/add-monitor-modal.component.scss +0 -0
- package/src/views/etl-monitor-builder/add-monitor-modal.component.tsx +210 -0
- package/src/views/etl-monitor-builder/etl-monitor-builder.component.scss +157 -0
- package/src/views/etl-monitor-builder/etl-monitor-builder.component.tsx +252 -0
- package/src/views/etl-monitor-builder/etl-monitor-builder.store.ts +126 -0
- package/tools/i18next-parser.config.js +0 -0
- package/tools/setup-tests.ts +1 -0
- package/tools/update-openmrs-deps.mjs +42 -0
- package/translations/am.json +65 -0
- package/translations/ar.json +65 -0
- package/translations/ar_SY.json +65 -0
- package/translations/bn.json +65 -0
- package/translations/cs.json +65 -0
- package/translations/de.json +65 -0
- package/translations/en.json +65 -0
- package/translations/en_US.json +65 -0
- package/translations/es.json +65 -0
- package/translations/es_MX.json +65 -0
- package/translations/fr.json +65 -0
- package/translations/he.json +65 -0
- package/translations/hi.json +65 -0
- package/translations/hi_IN.json +65 -0
- package/translations/id.json +65 -0
- package/translations/it.json +65 -0
- package/translations/ka.json +65 -0
- package/translations/km.json +65 -0
- package/translations/ku.json +65 -0
- package/translations/ky.json +65 -0
- package/translations/lg.json +65 -0
- package/translations/ne.json +65 -0
- package/translations/pl.json +65 -0
- package/translations/pt.json +65 -0
- package/translations/pt_BR.json +65 -0
- package/translations/qu.json +65 -0
- package/translations/ro_RO.json +65 -0
- package/translations/ru_RU.json +65 -0
- package/translations/si.json +65 -0
- package/translations/sq.json +65 -0
- package/translations/sw.json +65 -0
- package/translations/sw_KE.json +65 -0
- package/translations/tr.json +65 -0
- package/translations/tr_TR.json +65 -0
- package/translations/uk.json +65 -0
- package/translations/uz.json +65 -0
- package/translations/uz@Latn.json +65 -0
- package/translations/uz_UZ.json +65 -0
- package/translations/vi.json +65 -0
- package/translations/zh.json +65 -0
- package/translations/zh_CN.json +65 -0
- package/translations/zh_TW.json +65 -0
- package/tsconfig.json +24 -0
- package/vitest.config.mts +42 -0
|
@@ -0,0 +1,715 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linelist Run Report Component
|
|
3
|
+
*
|
|
4
|
+
* Screen for running linelist reports with runtime parameters.
|
|
5
|
+
* Follows design spec section 11: Run report screen.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React, { useState, useCallback, useEffect } from 'react';
|
|
9
|
+
import {
|
|
10
|
+
Button,
|
|
11
|
+
ButtonSet,
|
|
12
|
+
InlineNotification,
|
|
13
|
+
Tile,
|
|
14
|
+
Select,
|
|
15
|
+
SelectItem,
|
|
16
|
+
Stack,
|
|
17
|
+
DataTable,
|
|
18
|
+
Table,
|
|
19
|
+
TableContainer,
|
|
20
|
+
TableHead,
|
|
21
|
+
TableHeader,
|
|
22
|
+
TableRow,
|
|
23
|
+
TableBody,
|
|
24
|
+
TableCell,
|
|
25
|
+
Pagination,
|
|
26
|
+
Loading,
|
|
27
|
+
Grid,
|
|
28
|
+
Column,
|
|
29
|
+
RadioButton,
|
|
30
|
+
RadioButtonGroup,
|
|
31
|
+
} from '@carbon/react';
|
|
32
|
+
import { ArrowLeft, Download, Renew, Play, Save, View } from '@carbon/react/icons';
|
|
33
|
+
import { useNavigate, useParams } from 'react-router-dom';
|
|
34
|
+
|
|
35
|
+
import {
|
|
36
|
+
getLinelistReport,
|
|
37
|
+
parseLinelistConfig,
|
|
38
|
+
parseLinelistParameters,
|
|
39
|
+
evaluateLinelistReport,
|
|
40
|
+
compileLinelistReport,
|
|
41
|
+
} from '../../resources/linelist/linelist-reports.api';
|
|
42
|
+
import type { LinelistReportDto, LinelistParameter } from '../../types/linelist-types';
|
|
43
|
+
import {
|
|
44
|
+
RELATIVE_PERIOD_OPTIONS,
|
|
45
|
+
type RelativePeriod,
|
|
46
|
+
resolveRelativePeriod,
|
|
47
|
+
formatDate,
|
|
48
|
+
} from '../../utils/parameter-resolution';
|
|
49
|
+
|
|
50
|
+
// Import parameter input components from data-visualizer (reuse)
|
|
51
|
+
import DateParameterInput from '../data-visualizer/parameter-inputs/date-parameter-input.component';
|
|
52
|
+
import NumberParameterInput from '../data-visualizer/parameter-inputs/number-parameter-input.component';
|
|
53
|
+
import BooleanParameterInput from '../data-visualizer/parameter-inputs/boolean-parameter-input.component';
|
|
54
|
+
import ListParameterInput from '../data-visualizer/parameter-inputs/list-parameter-input.component';
|
|
55
|
+
import LocationParameterInput from '../data-visualizer/parameter-inputs/location-parameter-input.component';
|
|
56
|
+
import ConceptParameterInput from '../data-visualizer/parameter-inputs/concept-parameter-input.component';
|
|
57
|
+
import IdentifierTypeParameterInput from '../data-visualizer/parameter-inputs/identifier-type-parameter-input.component';
|
|
58
|
+
import PersonAttributeParameterInput from '../data-visualizer/parameter-inputs/person-attribute-parameter-input.component';
|
|
59
|
+
import TextParameterInput from '../data-visualizer/parameter-inputs/text-parameter-input.component';
|
|
60
|
+
|
|
61
|
+
import Header from '../shared/header/header.component';
|
|
62
|
+
import styles from './linelist-run-report.page.scss';
|
|
63
|
+
|
|
64
|
+
type Props = {};
|
|
65
|
+
|
|
66
|
+
const LinelistRunReport: React.FC<Props> = () => {
|
|
67
|
+
const navigate = useNavigate();
|
|
68
|
+
const { reportId } = useParams();
|
|
69
|
+
|
|
70
|
+
const [report, setReport] = useState<LinelistReportDto | null>(null);
|
|
71
|
+
const [loading, setLoading] = useState(true);
|
|
72
|
+
const [error, setError] = useState<string | null>(null);
|
|
73
|
+
const [running, setRunning] = useState(false);
|
|
74
|
+
const [runError, setRunError] = useState<string | null>(null);
|
|
75
|
+
|
|
76
|
+
// Runtime parameters
|
|
77
|
+
const [paramValues, setParamValues] = useState<Record<string, any>>({});
|
|
78
|
+
const [paramErrors, setParamErrors] = useState<Record<string, string>>({});
|
|
79
|
+
const [searchQueries, setSearchQueries] = useState<Record<string, string>>({});
|
|
80
|
+
|
|
81
|
+
// Date mode (FIXED or RELATIVE)
|
|
82
|
+
const [dateMode, setDateMode] = useState<'FIXED' | 'RELATIVE'>('FIXED');
|
|
83
|
+
const [relativePeriod, setRelativePeriod] = useState<RelativePeriod | ''>('');
|
|
84
|
+
|
|
85
|
+
// Results
|
|
86
|
+
const [results, setResults] = useState<any[] | null>(null);
|
|
87
|
+
const [columns, setColumns] = useState<string[]>([]);
|
|
88
|
+
const [recordCount, setRecordCount] = useState<number>(0);
|
|
89
|
+
const [generatedTime, setGeneratedTime] = useState<Date | null>(null);
|
|
90
|
+
|
|
91
|
+
// Pagination
|
|
92
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
93
|
+
const [pageSize, setPageSize] = useState(25);
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Load report details
|
|
97
|
+
*/
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
const loadData = async () => {
|
|
100
|
+
if (!reportId) return;
|
|
101
|
+
|
|
102
|
+
setLoading(true);
|
|
103
|
+
setError(null);
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
const reportData = await getLinelistReport(reportId);
|
|
107
|
+
|
|
108
|
+
setReport(reportData);
|
|
109
|
+
|
|
110
|
+
// Initialize default parameter values
|
|
111
|
+
const config = parseLinelistConfig(reportData);
|
|
112
|
+
if (config?.parameters) {
|
|
113
|
+
const defaults: Record<string, any> = {};
|
|
114
|
+
config.parameters.forEach((param) => {
|
|
115
|
+
if (param.defaultValue) {
|
|
116
|
+
defaults[param.name] = param.defaultValue;
|
|
117
|
+
}
|
|
118
|
+
// Set default date values for date parameters without defaults
|
|
119
|
+
if (param.type === 'DATE' && !defaults[param.name]) {
|
|
120
|
+
if (param.name === 'startDate') {
|
|
121
|
+
const endDate = new Date();
|
|
122
|
+
const startDate = new Date();
|
|
123
|
+
startDate.setMonth(startDate.getMonth() - 6);
|
|
124
|
+
defaults.startDate = startDate.toISOString().split('T')[0];
|
|
125
|
+
// Only set endDate if it exists in the parameters
|
|
126
|
+
if (config.parameters.some(p => p.name === 'endDate')) {
|
|
127
|
+
defaults.endDate = endDate.toISOString().split('T')[0];
|
|
128
|
+
}
|
|
129
|
+
} else if (param.name === 'endDate') {
|
|
130
|
+
defaults.endDate = new Date().toISOString().split('T')[0];
|
|
131
|
+
} else if (param.name.toLowerCase().includes('date') && !param.name.includes('end')) {
|
|
132
|
+
// For other date parameters, use today as default
|
|
133
|
+
defaults[param.name] = new Date().toISOString().split('T')[0];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
setParamValues(defaults);
|
|
138
|
+
}
|
|
139
|
+
} catch (err) {
|
|
140
|
+
setError(err instanceof Error ? err.message : 'Failed to load report');
|
|
141
|
+
} finally {
|
|
142
|
+
setLoading(false);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
loadData();
|
|
147
|
+
}, [reportId]);
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Get parameters from report config
|
|
151
|
+
* Uses parseLinelistParameters which reads from metaJson first (for dynamic options)
|
|
152
|
+
* then falls back to configJson
|
|
153
|
+
*/
|
|
154
|
+
const getParameters = useCallback((): LinelistParameter[] => {
|
|
155
|
+
if (!report) return [];
|
|
156
|
+
return parseLinelistParameters(report);
|
|
157
|
+
}, [report]);
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Get date parameters from report config
|
|
161
|
+
*/
|
|
162
|
+
const getDateParameters = useCallback((): LinelistParameter[] => {
|
|
163
|
+
const params = getParameters();
|
|
164
|
+
return params.filter(p => p.type === 'DATE' || p.type === 'DATETIME');
|
|
165
|
+
}, [getParameters]);
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Check if report has both startDate and endDate for relative period support
|
|
169
|
+
*/
|
|
170
|
+
const supportsRelativePeriod = useCallback(() => {
|
|
171
|
+
const dateParams = getDateParameters();
|
|
172
|
+
return (
|
|
173
|
+
dateParams.some(p => p.name.toLowerCase() === 'startdate' || p.name.toLowerCase() === 'start_date') &&
|
|
174
|
+
dateParams.some(p => p.name.toLowerCase() === 'enddate' || p.name.toLowerCase() === 'end_date')
|
|
175
|
+
);
|
|
176
|
+
}, [getDateParameters]);
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Update parameter value
|
|
180
|
+
*/
|
|
181
|
+
const updateParamValue = (paramName: string, value: any) => {
|
|
182
|
+
setParamValues((prev) => ({ ...prev, [paramName]: value }));
|
|
183
|
+
// Clear error for this parameter
|
|
184
|
+
if (paramErrors[paramName]) {
|
|
185
|
+
setParamErrors((prev) => {
|
|
186
|
+
const newErrors = { ...prev };
|
|
187
|
+
delete newErrors[paramName];
|
|
188
|
+
return newErrors;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Update parameter error
|
|
195
|
+
*/
|
|
196
|
+
const updateParamError = (paramName: string, error: string | undefined) => {
|
|
197
|
+
setParamErrors((prev) => {
|
|
198
|
+
if (error) {
|
|
199
|
+
return { ...prev, [paramName]: error };
|
|
200
|
+
}
|
|
201
|
+
const newErrors = { ...prev };
|
|
202
|
+
delete newErrors[paramName];
|
|
203
|
+
return newErrors;
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Update search query for a parameter
|
|
209
|
+
*/
|
|
210
|
+
const updateSearchQuery = (paramName: string, query: string) => {
|
|
211
|
+
setSearchQueries((prev) => ({ ...prev, [paramName]: query }));
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Check if parameters are valid
|
|
216
|
+
*/
|
|
217
|
+
const areParamsValid = useCallback(() => {
|
|
218
|
+
const params = getParameters();
|
|
219
|
+
|
|
220
|
+
// If in RELATIVE mode but no period selected, invalid
|
|
221
|
+
if (dateMode === 'RELATIVE' && supportsRelativePeriod() && !relativePeriod) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
for (const param of params) {
|
|
226
|
+
// Skip date parameters in RELATIVE mode
|
|
227
|
+
if ((param.type === 'DATE' || param.type === 'DATETIME') && dateMode === 'RELATIVE') {
|
|
228
|
+
const isStartDate = param.name.toLowerCase() === 'startdate' || param.name.toLowerCase() === 'start_date';
|
|
229
|
+
const isEndDate = param.name.toLowerCase() === 'enddate' || param.name.toLowerCase() === 'end_date';
|
|
230
|
+
if (isStartDate || isEndDate) continue;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (param.required && !paramValues[param.name]) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return true;
|
|
238
|
+
}, [getParameters, paramValues, dateMode, relativePeriod, supportsRelativePeriod]);
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Run the report
|
|
242
|
+
*/
|
|
243
|
+
const runReport = useCallback(async () => {
|
|
244
|
+
if (!report || !areParamsValid()) {
|
|
245
|
+
setRunError('Please fill in all required parameters');
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// If in RELATIVE mode but no period selected, show error
|
|
250
|
+
if (dateMode === 'RELATIVE' && supportsRelativePeriod() && !relativePeriod) {
|
|
251
|
+
setRunError('Please select a reporting period');
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
setRunning(true);
|
|
256
|
+
setRunError(null);
|
|
257
|
+
setResults(null);
|
|
258
|
+
|
|
259
|
+
try {
|
|
260
|
+
const config = parseLinelistConfig(report);
|
|
261
|
+
const params = getParameters();
|
|
262
|
+
|
|
263
|
+
// Build parameters object from the report config
|
|
264
|
+
const reportParams: Record<string, any> = {};
|
|
265
|
+
|
|
266
|
+
// If in RELATIVE mode with period selected, resolve dates
|
|
267
|
+
if (dateMode === 'RELATIVE' && relativePeriod && supportsRelativePeriod()) {
|
|
268
|
+
const { start, end } = resolveRelativePeriod(relativePeriod);
|
|
269
|
+
const dateParams = getDateParameters();
|
|
270
|
+
|
|
271
|
+
// Map resolved dates to date parameters
|
|
272
|
+
dateParams.forEach((param, index) => {
|
|
273
|
+
if (index === 0) {
|
|
274
|
+
reportParams[param.name] = formatDate(start);
|
|
275
|
+
} else if (index === 1) {
|
|
276
|
+
reportParams[param.name] = formatDate(end);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
// Add non-date parameters
|
|
281
|
+
params.forEach((param) => {
|
|
282
|
+
if (param.type !== 'DATE' && param.type !== 'DATETIME' && paramValues[param.name]) {
|
|
283
|
+
reportParams[param.name] = paramValues[param.name];
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
} else {
|
|
287
|
+
// FIXED mode - use all parameter values
|
|
288
|
+
params.forEach((param) => {
|
|
289
|
+
if (paramValues[param.name]) {
|
|
290
|
+
reportParams[param.name] = paramValues[param.name];
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Step 1: Compile the report to get the reportDefinitionUuid
|
|
296
|
+
// Pass categoryUuid from config to avoid "category is required" error
|
|
297
|
+
const compileResult = await compileLinelistReport(report.uuid, config?.categoryUuid);
|
|
298
|
+
if (!compileResult.reportDefinitionUuid) {
|
|
299
|
+
setRunError('Failed to compile report - no report definition UUID returned');
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Step 2: Evaluate using the compiled reportDefinitionUuid
|
|
304
|
+
const response = await evaluateLinelistReport({
|
|
305
|
+
reportDefinitionUuid: compileResult.reportDefinitionUuid,
|
|
306
|
+
parameters: reportParams,
|
|
307
|
+
maxRows: pageSize * 10, // Get enough rows for pagination
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
if (response.success && response.data) {
|
|
311
|
+
// Extract the dataset (usually named PATIENT_LIST)
|
|
312
|
+
const dataSetName = config?.dataSetDefinitions?.[0]?.name || 'PATIENT_LIST';
|
|
313
|
+
const data = response.data[dataSetName] || [];
|
|
314
|
+
|
|
315
|
+
// Extract column names from first row
|
|
316
|
+
const cols = data.length > 0 ? Object.keys(data[0]) : [];
|
|
317
|
+
setColumns(cols);
|
|
318
|
+
setResults(data);
|
|
319
|
+
setRecordCount(data.length);
|
|
320
|
+
setGeneratedTime(new Date());
|
|
321
|
+
} else {
|
|
322
|
+
setRunError(response.error || 'Failed to run report');
|
|
323
|
+
}
|
|
324
|
+
} catch (err) {
|
|
325
|
+
setRunError(err instanceof Error ? err.message : 'Failed to run report');
|
|
326
|
+
} finally {
|
|
327
|
+
setRunning(false);
|
|
328
|
+
}
|
|
329
|
+
}, [report, paramValues, pageSize, areParamsValid, getParameters, getDateParameters, dateMode, relativePeriod, supportsRelativePeriod]);
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Export report data
|
|
333
|
+
*/
|
|
334
|
+
const exportData = useCallback((format: 'CSV' | 'XLSX') => {
|
|
335
|
+
if (!results || results.length === 0) return;
|
|
336
|
+
|
|
337
|
+
// For now, just implement CSV export
|
|
338
|
+
if (format === 'CSV') {
|
|
339
|
+
const headers = columns.join(',');
|
|
340
|
+
const rows = results.map((row) =>
|
|
341
|
+
columns.map((col) => {
|
|
342
|
+
const value = row[col];
|
|
343
|
+
// Escape values containing commas or quotes
|
|
344
|
+
if (value === null || value === undefined) return '';
|
|
345
|
+
const strValue = String(value);
|
|
346
|
+
if (strValue.includes(',') || strValue.includes('"') || strValue.includes('\n')) {
|
|
347
|
+
return `"${strValue.replace(/"/g, '""')}"`;
|
|
348
|
+
}
|
|
349
|
+
return strValue;
|
|
350
|
+
}).join(',')
|
|
351
|
+
);
|
|
352
|
+
const csv = [headers, ...rows].join('\n');
|
|
353
|
+
|
|
354
|
+
const blob = new Blob([csv], { type: 'text/csv' });
|
|
355
|
+
const url = URL.createObjectURL(blob);
|
|
356
|
+
const a = document.createElement('a');
|
|
357
|
+
a.href = url;
|
|
358
|
+
a.download = `${report?.name?.replace(/[^a-z0-9]/gi, '_') || 'linelist'}_${Date.now()}.csv`;
|
|
359
|
+
a.click();
|
|
360
|
+
URL.revokeObjectURL(url);
|
|
361
|
+
} else {
|
|
362
|
+
// XLSX would require a library like xlsx
|
|
363
|
+
alert('XLSX export not implemented yet');
|
|
364
|
+
}
|
|
365
|
+
}, [results, columns, report]);
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Render parameter input based on type
|
|
369
|
+
*/
|
|
370
|
+
const renderParameterInput = (param: LinelistParameter) => {
|
|
371
|
+
const value = paramValues[param.name] || '';
|
|
372
|
+
const error = paramErrors[param.name];
|
|
373
|
+
|
|
374
|
+
// Skip start/end date parameters in RELATIVE mode - they're handled by the global relative period selector
|
|
375
|
+
if (supportsRelativePeriod() && dateMode === 'RELATIVE') {
|
|
376
|
+
const isStartDate = param.name.toLowerCase() === 'startdate' || param.name.toLowerCase() === 'start_date';
|
|
377
|
+
const isEndDate = param.name.toLowerCase() === 'enddate' || param.name.toLowerCase() === 'end_date';
|
|
378
|
+
if ((param.type === 'DATE' || param.type === 'DATETIME') && (isStartDate || isEndDate)) {
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
const commonProps = {
|
|
384
|
+
key: param.name,
|
|
385
|
+
parameter: param,
|
|
386
|
+
value,
|
|
387
|
+
error,
|
|
388
|
+
onChange: (newValue: any) => updateParamValue(param.name, newValue),
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
switch (param.type) {
|
|
392
|
+
case 'DATE':
|
|
393
|
+
case 'DATETIME':
|
|
394
|
+
return <DateParameterInput {...commonProps} />;
|
|
395
|
+
|
|
396
|
+
case 'NUMBER':
|
|
397
|
+
return <NumberParameterInput {...commonProps} />;
|
|
398
|
+
|
|
399
|
+
case 'BOOLEAN':
|
|
400
|
+
return <BooleanParameterInput {...commonProps} />;
|
|
401
|
+
|
|
402
|
+
case 'LIST':
|
|
403
|
+
return <ListParameterInput {...commonProps} />;
|
|
404
|
+
|
|
405
|
+
case 'LOCATION':
|
|
406
|
+
return (
|
|
407
|
+
<LocationParameterInput
|
|
408
|
+
{...commonProps}
|
|
409
|
+
onSearchQueryChange={(query) => updateSearchQuery(param.name, query)}
|
|
410
|
+
/>
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
case 'CONCEPT':
|
|
414
|
+
return (
|
|
415
|
+
<ConceptParameterInput
|
|
416
|
+
{...commonProps}
|
|
417
|
+
searchQuery={searchQueries[param.name] || ''}
|
|
418
|
+
onSearchQueryChange={(query) => updateSearchQuery(param.name, query)}
|
|
419
|
+
/>
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
case 'IDENTIFIER_TYPE':
|
|
423
|
+
return <IdentifierTypeParameterInput {...commonProps} />;
|
|
424
|
+
|
|
425
|
+
case 'PERSON_ATTRIBUTE':
|
|
426
|
+
return <PersonAttributeParameterInput {...commonProps} />;
|
|
427
|
+
|
|
428
|
+
case 'TEXT':
|
|
429
|
+
default:
|
|
430
|
+
return (
|
|
431
|
+
<TextParameterInput
|
|
432
|
+
{...commonProps}
|
|
433
|
+
onError={(error) => updateParamError(param.name, error)}
|
|
434
|
+
/>
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
const parameters = getParameters();
|
|
440
|
+
const hasResults = results && results.length > 0;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Get paginated data
|
|
444
|
+
*/
|
|
445
|
+
const paginatedData = hasResults
|
|
446
|
+
? results.slice((currentPage - 1) * pageSize, currentPage * pageSize)
|
|
447
|
+
: [];
|
|
448
|
+
|
|
449
|
+
if (loading) {
|
|
450
|
+
return (
|
|
451
|
+
<div style={{ padding: '2rem' }}>
|
|
452
|
+
<Loading description="Loading report..." withOverlay={false} active />
|
|
453
|
+
</div>
|
|
454
|
+
);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (error && !report) {
|
|
458
|
+
return (
|
|
459
|
+
<Stack gap={5}>
|
|
460
|
+
<InlineNotification kind="error" title="Error" subtitle={error} />
|
|
461
|
+
<Button kind="secondary" renderIcon={ArrowLeft} onClick={() => navigate('/linelist')}>
|
|
462
|
+
Back to Linelist Reports
|
|
463
|
+
</Button>
|
|
464
|
+
</Stack>
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
return (
|
|
469
|
+
<Stack gap={5}>
|
|
470
|
+
<Header
|
|
471
|
+
title={report?.name || 'Linelist Report'}
|
|
472
|
+
subtitle={report?.description}
|
|
473
|
+
actions={
|
|
474
|
+
<Button kind="ghost" size="sm" renderIcon={ArrowLeft} onClick={() => navigate('/linelist')}>
|
|
475
|
+
Back to Linelist Reports
|
|
476
|
+
</Button>
|
|
477
|
+
}
|
|
478
|
+
/>
|
|
479
|
+
|
|
480
|
+
{/* Parameters Section */}
|
|
481
|
+
{parameters.length > 0 && (
|
|
482
|
+
<div className={styles.parametersSection}>
|
|
483
|
+
<div className={styles.parametersHeader}>
|
|
484
|
+
<h2 className={styles.parametersTitle}>Report Parameters</h2>
|
|
485
|
+
<p className={styles.parametersDescription}>
|
|
486
|
+
Configure the parameters for this report run, then click "Run Report" to view results.
|
|
487
|
+
</p>
|
|
488
|
+
</div>
|
|
489
|
+
|
|
490
|
+
{/* Date Mode Toggle - shown ONLY if report has both startDate AND endDate */}
|
|
491
|
+
{supportsRelativePeriod() && (
|
|
492
|
+
<div style={{ marginBottom: '1.5rem' }}>
|
|
493
|
+
<label className="cds--label">Date Selection Mode</label>
|
|
494
|
+
<RadioButtonGroup
|
|
495
|
+
legendText=""
|
|
496
|
+
name="date-mode"
|
|
497
|
+
valueSelected={dateMode}
|
|
498
|
+
onChange={(mode) => {
|
|
499
|
+
setDateMode(mode as 'FIXED' | 'RELATIVE');
|
|
500
|
+
// Clear relative period when switching to FIXED
|
|
501
|
+
if (mode === 'FIXED') {
|
|
502
|
+
setRelativePeriod('');
|
|
503
|
+
}
|
|
504
|
+
}}
|
|
505
|
+
>
|
|
506
|
+
<RadioButton
|
|
507
|
+
id="date-mode-fixed"
|
|
508
|
+
labelText="Specific dates"
|
|
509
|
+
value="FIXED"
|
|
510
|
+
/>
|
|
511
|
+
<RadioButton
|
|
512
|
+
id="date-mode-relative"
|
|
513
|
+
labelText="Relative period"
|
|
514
|
+
value="RELATIVE"
|
|
515
|
+
/>
|
|
516
|
+
</RadioButtonGroup>
|
|
517
|
+
</div>
|
|
518
|
+
)}
|
|
519
|
+
|
|
520
|
+
{/* Relative Period Selector - shown in RELATIVE mode */}
|
|
521
|
+
{dateMode === 'RELATIVE' && supportsRelativePeriod() && (
|
|
522
|
+
<div style={{ marginBottom: '1.5rem', maxWidth: '300px' }}>
|
|
523
|
+
<Select
|
|
524
|
+
id="relative-period-select"
|
|
525
|
+
labelText="Select reporting period"
|
|
526
|
+
value={relativePeriod}
|
|
527
|
+
onChange={(e) => {
|
|
528
|
+
setRelativePeriod(e.target.value as RelativePeriod);
|
|
529
|
+
}}
|
|
530
|
+
size="sm"
|
|
531
|
+
>
|
|
532
|
+
<SelectItem value="" text="Select period" />
|
|
533
|
+
{RELATIVE_PERIOD_OPTIONS.map((option) => (
|
|
534
|
+
<SelectItem
|
|
535
|
+
key={option.value}
|
|
536
|
+
value={option.value}
|
|
537
|
+
text={option.label}
|
|
538
|
+
/>
|
|
539
|
+
))}
|
|
540
|
+
</Select>
|
|
541
|
+
{paramErrors.relativePeriod && (
|
|
542
|
+
<div style={{ color: '#da1e28', fontSize: '0.875rem', marginTop: '0.5rem' }}>
|
|
543
|
+
{paramErrors.relativePeriod}
|
|
544
|
+
</div>
|
|
545
|
+
)}
|
|
546
|
+
</div>
|
|
547
|
+
)}
|
|
548
|
+
|
|
549
|
+
<Grid fullWidth className={styles.parametersGrid}>
|
|
550
|
+
{parameters.map((param) => {
|
|
551
|
+
const rendered = renderParameterInput(param);
|
|
552
|
+
if (!rendered) return null;
|
|
553
|
+
return (
|
|
554
|
+
<Column key={param.name} md={4} lg={4}>
|
|
555
|
+
<div className={styles.parameterField}>
|
|
556
|
+
{rendered}
|
|
557
|
+
</div>
|
|
558
|
+
</Column>
|
|
559
|
+
);
|
|
560
|
+
})}
|
|
561
|
+
</Grid>
|
|
562
|
+
|
|
563
|
+
<div className={styles.actions}>
|
|
564
|
+
<ButtonSet>
|
|
565
|
+
<Button
|
|
566
|
+
kind="primary"
|
|
567
|
+
renderIcon={Play}
|
|
568
|
+
onClick={runReport}
|
|
569
|
+
disabled={running || !areParamsValid()}
|
|
570
|
+
>
|
|
571
|
+
{running ? 'Running...' : 'Run Report'}
|
|
572
|
+
</Button>
|
|
573
|
+
<Button kind="secondary" renderIcon={Renew} onClick={() => {
|
|
574
|
+
setParamValues({});
|
|
575
|
+
setRelativePeriod('');
|
|
576
|
+
setDateMode('FIXED');
|
|
577
|
+
}} disabled={running}>
|
|
578
|
+
Reset
|
|
579
|
+
</Button>
|
|
580
|
+
<Button
|
|
581
|
+
kind="ghost"
|
|
582
|
+
renderIcon={Save}
|
|
583
|
+
onClick={() => {
|
|
584
|
+
// TODO: Implement save preset functionality
|
|
585
|
+
alert('Save preset functionality not yet implemented');
|
|
586
|
+
}}
|
|
587
|
+
disabled={running}
|
|
588
|
+
>
|
|
589
|
+
Save Preset
|
|
590
|
+
</Button>
|
|
591
|
+
</ButtonSet>
|
|
592
|
+
</div>
|
|
593
|
+
|
|
594
|
+
{runError && (
|
|
595
|
+
<InlineNotification
|
|
596
|
+
kind="error"
|
|
597
|
+
title="Run Error"
|
|
598
|
+
subtitle={runError}
|
|
599
|
+
onClose={() => setRunError(null)}
|
|
600
|
+
/>
|
|
601
|
+
)}
|
|
602
|
+
</div>
|
|
603
|
+
)}
|
|
604
|
+
|
|
605
|
+
{/* Results Section */}
|
|
606
|
+
{hasResults && (
|
|
607
|
+
<div className={styles.resultsSection}>
|
|
608
|
+
<div className={styles.resultsHeader}>
|
|
609
|
+
<div className={styles.resultsInfo}>
|
|
610
|
+
<h2 className={styles.resultsTitle}>Results</h2>
|
|
611
|
+
<div className={styles.stats}>
|
|
612
|
+
<span>Records: <strong>{recordCount}</strong></span>
|
|
613
|
+
<span>
|
|
614
|
+
Generated: <strong>{generatedTime?.toLocaleString()}</strong>
|
|
615
|
+
</span>
|
|
616
|
+
{parameters.some((p) => p.name === 'startDate' || p.name === 'endDate') && (
|
|
617
|
+
<span>
|
|
618
|
+
{parameters.some((p) => p.name === 'startDate')
|
|
619
|
+
? `Date Range: ${paramValues.startDate} to ${paramValues.endDate || 'N/A'}`
|
|
620
|
+
: `Report Date: ${paramValues.endDate || paramValues.date || 'N/A'}`
|
|
621
|
+
}
|
|
622
|
+
</span>
|
|
623
|
+
)}
|
|
624
|
+
</div>
|
|
625
|
+
</div>
|
|
626
|
+
<div className={styles.exportActions}>
|
|
627
|
+
<ButtonSet>
|
|
628
|
+
<Button
|
|
629
|
+
kind="ghost"
|
|
630
|
+
size="sm"
|
|
631
|
+
renderIcon={Download}
|
|
632
|
+
onClick={() => exportData('CSV')}
|
|
633
|
+
>
|
|
634
|
+
Export CSV
|
|
635
|
+
</Button>
|
|
636
|
+
<Button
|
|
637
|
+
kind="ghost"
|
|
638
|
+
size="sm"
|
|
639
|
+
onClick={() => exportData('XLSX')}
|
|
640
|
+
>
|
|
641
|
+
Export XLSX
|
|
642
|
+
</Button>
|
|
643
|
+
</ButtonSet>
|
|
644
|
+
</div>
|
|
645
|
+
</div>
|
|
646
|
+
|
|
647
|
+
{/* Data Table */}
|
|
648
|
+
<DataTable
|
|
649
|
+
rows={paginatedData.map((row, idx) => ({ id: idx, ...row }))}
|
|
650
|
+
headers={columns.map((col) => ({ key: col, header: col }))}
|
|
651
|
+
>
|
|
652
|
+
{({ rows, headers, getHeaderProps, getTableProps }) => (
|
|
653
|
+
<TableContainer>
|
|
654
|
+
<Table {...getTableProps()}>
|
|
655
|
+
<TableHead>
|
|
656
|
+
<TableRow>
|
|
657
|
+
{headers.map((header) => (
|
|
658
|
+
<TableHeader {...getHeaderProps({ header })} key={header.key}>
|
|
659
|
+
{header.header}
|
|
660
|
+
</TableHeader>
|
|
661
|
+
))}
|
|
662
|
+
</TableRow>
|
|
663
|
+
</TableHead>
|
|
664
|
+
<TableBody>
|
|
665
|
+
{rows.map((row) => (
|
|
666
|
+
<TableRow key={row.id}>
|
|
667
|
+
{headers.map((header) => (
|
|
668
|
+
<TableCell key={header.key}>{(row as any)[header.key] ?? '-'}</TableCell>
|
|
669
|
+
))}
|
|
670
|
+
</TableRow>
|
|
671
|
+
))}
|
|
672
|
+
</TableBody>
|
|
673
|
+
</Table>
|
|
674
|
+
</TableContainer>
|
|
675
|
+
)}
|
|
676
|
+
</DataTable>
|
|
677
|
+
|
|
678
|
+
{/* Pagination */}
|
|
679
|
+
<Pagination
|
|
680
|
+
totalItems={results.length}
|
|
681
|
+
pageSize={pageSize}
|
|
682
|
+
pageSizes={[25, 50, 100]}
|
|
683
|
+
page={currentPage}
|
|
684
|
+
onChange={({ page, pageSize: newSize }) => {
|
|
685
|
+
setCurrentPage(page);
|
|
686
|
+
setPageSize(newSize);
|
|
687
|
+
}}
|
|
688
|
+
/>
|
|
689
|
+
</div>
|
|
690
|
+
)}
|
|
691
|
+
|
|
692
|
+
{/* No Results */}
|
|
693
|
+
{!running && !hasResults && parameters.length === 0 && (
|
|
694
|
+
<Tile className={styles.emptyState}>
|
|
695
|
+
<View size={48} />
|
|
696
|
+
<h3>No Parameters Required</h3>
|
|
697
|
+
<p>This report has no configurable parameters.</p>
|
|
698
|
+
<Button kind="primary" renderIcon={Play} onClick={runReport}>
|
|
699
|
+
Run Report
|
|
700
|
+
</Button>
|
|
701
|
+
</Tile>
|
|
702
|
+
)}
|
|
703
|
+
|
|
704
|
+
{!running && !hasResults && parameters.length > 0 && (
|
|
705
|
+
<Tile className={styles.emptyState}>
|
|
706
|
+
<View size={48} />
|
|
707
|
+
<h3>Ready to Run</h3>
|
|
708
|
+
<p>Configure the parameters above and click "Run Report" to view results.</p>
|
|
709
|
+
</Tile>
|
|
710
|
+
)}
|
|
711
|
+
</Stack>
|
|
712
|
+
);
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
export default LinelistRunReport;
|