@itwin/reports-config-widget-react 0.5.0 → 0.7.0
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/CHANGELOG.json +76 -1
- package/CHANGELOG.md +27 -2
- package/LICENSE.md +9 -9
- package/README.md +38 -38
- package/__mocks__/fileMock.js +4 -4
- package/api/reports-config-widget-react.api.md +126 -0
- package/api/reports-config-widget-react.exports.csv +14 -0
- package/api/temp/reports-config-widget-react.api.md +126 -0
- package/coverage/clover.xml +521 -521
- package/coverage/coverage-final.json +32 -32
- package/coverage/lcov-report/index.html +31 -31
- package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +15 -15
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/test/index.html +11 -11
- package/coverage/lcov-report/src/test/test-utils.tsx.html +46 -16
- package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +29 -86
- package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +5 -38
- package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +25 -121
- package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +120 -96
- package/coverage/lcov-report/src/widget/components/Constants.ts.html +5 -5
- package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +13 -103
- package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +6 -21
- package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +6 -21
- package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +7 -22
- package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +7 -28
- package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +6 -21
- package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +20 -47
- package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +20 -11
- package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +16 -79
- package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +15 -108
- package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +36 -75
- package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +62 -92
- package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +104 -128
- package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +88 -301
- package/coverage/lcov-report/src/widget/components/Reports.tsx.html +42 -204
- package/coverage/lcov-report/src/widget/components/ReportsConfigContext.tsx.html +164 -50
- package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +15 -63
- package/coverage/lcov-report/src/widget/components/ReportsHeader.tsx.html +8 -47
- package/coverage/lcov-report/src/widget/components/ReportsRouter.tsx.html +6 -12
- package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +13 -25
- package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +11 -56
- package/coverage/lcov-report/src/widget/components/index.html +50 -50
- package/coverage/lcov-report/src/widget/components/utils.tsx.html +25 -169
- package/coverage/lcov-report/src/widget/context/BulkExtractorContext.tsx.html +6 -12
- package/coverage/lcov-report/src/widget/context/ReportsConfigApiContext.tsx.html +10 -13
- package/coverage/lcov-report/src/widget/context/index.html +1 -1
- package/coverage/lcov-report/src/widget/hooks/index.html +1 -1
- package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +12 -54
- package/coverage/lcov-report/src/widget/index.html +13 -13
- package/coverage/lcov.info +941 -919
- package/jest.config.js +14 -17
- package/lib/cjs/ReportsConfigWidget.d.ts +4 -0
- package/lib/cjs/ReportsConfigWidget.d.ts.map +1 -1
- package/lib/cjs/ReportsConfigWidget.js +4 -0
- package/lib/cjs/ReportsConfigWidget.js.map +1 -1
- package/lib/cjs/reports-config-widget-react.d.ts +1 -0
- package/lib/cjs/reports-config-widget-react.d.ts.map +1 -1
- package/lib/cjs/reports-config-widget-react.js +4 -3
- package/lib/cjs/reports-config-widget-react.js.map +1 -1
- package/lib/cjs/test/AddMappingModal.test.js +11 -10
- package/lib/cjs/test/AddMappingModal.test.js.map +1 -1
- package/lib/cjs/test/BulkExtractor.test.js +68 -43
- package/lib/cjs/test/BulkExtractor.test.js.map +1 -1
- package/lib/cjs/test/DeleteModal.test.js +3 -3
- package/lib/cjs/test/DeleteModal.test.js.map +1 -1
- package/lib/cjs/test/ReportAction.test.js +6 -4
- package/lib/cjs/test/ReportAction.test.js.map +1 -1
- package/lib/cjs/test/ReportMappingHorizontalTile.test.js +64 -25
- package/lib/cjs/test/ReportMappingHorizontalTile.test.js.map +1 -1
- package/lib/cjs/test/ReportMappings.test.js +39 -18
- package/lib/cjs/test/ReportMappings.test.js.map +1 -1
- package/lib/cjs/test/Reports.test.js +3 -3
- package/lib/cjs/test/Reports.test.js.map +1 -1
- package/lib/cjs/test/WidgetHeader.test.js +3 -3
- package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
- package/lib/cjs/test/test-utils.d.ts +8 -0
- package/lib/cjs/test/test-utils.d.ts.map +1 -1
- package/lib/cjs/test/test-utils.js +16 -4
- package/lib/cjs/test/test-utils.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/widget/ReportsConfigUiProvider.d.ts +10 -4
- package/lib/cjs/widget/ReportsConfigUiProvider.d.ts.map +1 -1
- package/lib/cjs/widget/ReportsConfigUiProvider.js +11 -7
- package/lib/cjs/widget/ReportsConfigUiProvider.js.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.d.ts +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.js +7 -7
- package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.scss +1 -1
- package/lib/cjs/widget/components/BulkExtractor.d.ts +8 -5
- package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -1
- package/lib/cjs/widget/components/BulkExtractor.js +52 -35
- package/lib/cjs/widget/components/BulkExtractor.js.map +1 -1
- package/lib/cjs/widget/components/Constants.d.ts.map +1 -1
- package/lib/cjs/widget/components/Constants.js +3 -3
- package/lib/cjs/widget/components/Constants.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.d.ts +1 -1
- package/lib/cjs/widget/components/DeleteModal.d.ts.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.js +5 -5
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.scss +2 -2
- package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.d.ts.map +1 -1
- package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.js +3 -3
- package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.js.map +1 -1
- package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.d.ts.map +1 -1
- package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.js +3 -3
- package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.js.map +1 -1
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.d.ts.map +1 -1
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js +3 -3
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -1
- package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.d.ts.map +1 -1
- package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.js +3 -3
- package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.js.map +1 -1
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -1
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js +3 -3
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -1
- package/lib/cjs/widget/components/ExtractionStatus.d.ts +1 -1
- package/lib/cjs/widget/components/ExtractionStatus.d.ts.map +1 -1
- package/lib/cjs/widget/components/ExtractionStatus.js +9 -9
- package/lib/cjs/widget/components/ExtractionStatus.js.map +1 -1
- package/lib/cjs/widget/components/ExtractionStatus.scss +1 -1
- package/lib/cjs/widget/components/ExtractionToast.d.ts.map +1 -1
- package/lib/cjs/widget/components/ExtractionToast.js +3 -3
- package/lib/cjs/widget/components/ExtractionToast.js.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.d.ts.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.js +1 -2
- package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.scss +1 -4
- package/lib/cjs/widget/components/LocalizedTablePaginator.d.ts.map +1 -1
- package/lib/cjs/widget/components/LocalizedTablePaginator.js +1 -1
- package/lib/cjs/widget/components/LocalizedTablePaginator.js.map +1 -1
- package/lib/cjs/widget/components/ReportAction.d.ts +8 -0
- package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportAction.js +9 -7
- package/lib/cjs/widget/components/ReportAction.js.map +1 -1
- package/lib/cjs/widget/components/ReportAction.scss +1 -1
- package/lib/cjs/widget/components/ReportHorizontalTile.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportHorizontalTile.js +4 -4
- package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.js +46 -45
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.d.ts +8 -0
- package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.js +25 -11
- package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
- package/lib/cjs/widget/components/Reports.d.ts +9 -1
- package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
- package/lib/cjs/widget/components/Reports.js +7 -8
- package/lib/cjs/widget/components/Reports.js.map +1 -1
- package/lib/cjs/widget/components/Reports.scss +0 -1
- package/lib/cjs/widget/components/ReportsConfigContext.d.ts +34 -4
- package/lib/cjs/widget/components/ReportsConfigContext.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportsConfigContext.js +27 -9
- package/lib/cjs/widget/components/ReportsConfigContext.js.map +1 -1
- package/lib/cjs/widget/components/ReportsContainer.d.ts +3 -6
- package/lib/cjs/widget/components/ReportsContainer.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportsContainer.js +7 -5
- package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
- package/lib/cjs/widget/components/ReportsContainer.scss +1 -1
- package/lib/cjs/widget/components/ReportsHeader.d.ts +1 -1
- package/lib/cjs/widget/components/ReportsHeader.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportsHeader.js +6 -7
- package/lib/cjs/widget/components/ReportsHeader.js.map +1 -1
- package/lib/cjs/widget/components/ReportsRouter.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportsRouter.js +3 -3
- package/lib/cjs/widget/components/ReportsRouter.js.map +1 -1
- package/lib/cjs/widget/components/SearchBar.d.ts +1 -1
- package/lib/cjs/widget/components/SearchBar.d.ts.map +1 -1
- package/lib/cjs/widget/components/SearchBar.js +4 -4
- package/lib/cjs/widget/components/SearchBar.js.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.d.ts +1 -1
- package/lib/cjs/widget/components/SelectIModel.d.ts.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.js +1 -1
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.scss +1 -1
- package/lib/cjs/widget/components/utils.d.ts +1 -1
- package/lib/cjs/widget/components/utils.d.ts.map +1 -1
- package/lib/cjs/widget/components/utils.js +5 -5
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/components/utils.scss +1 -1
- package/lib/cjs/widget/context/BulkExtractorContext.d.ts.map +1 -1
- package/lib/cjs/widget/context/BulkExtractorContext.js.map +1 -1
- package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts +3 -3
- package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts.map +1 -1
- package/lib/cjs/widget/context/ReportsConfigApiContext.js.map +1 -1
- package/lib/cjs/widget/hooks/useValidator.d.ts +1 -4
- package/lib/cjs/widget/hooks/useValidator.d.ts.map +1 -1
- package/lib/cjs/widget/hooks/useValidator.js +3 -3
- package/lib/cjs/widget/hooks/useValidator.js.map +1 -1
- package/lib/esm/ReportsConfigWidget.d.ts +4 -0
- package/lib/esm/ReportsConfigWidget.d.ts.map +1 -1
- package/lib/esm/ReportsConfigWidget.js +4 -0
- package/lib/esm/ReportsConfigWidget.js.map +1 -1
- package/lib/esm/reports-config-widget-react.d.ts +1 -0
- package/lib/esm/reports-config-widget-react.d.ts.map +1 -1
- package/lib/esm/reports-config-widget-react.js +4 -3
- package/lib/esm/reports-config-widget-react.js.map +1 -1
- package/lib/esm/test/AddMappingModal.test.js +12 -11
- package/lib/esm/test/AddMappingModal.test.js.map +1 -1
- package/lib/esm/test/BulkExtractor.test.js +69 -44
- package/lib/esm/test/BulkExtractor.test.js.map +1 -1
- package/lib/esm/test/DeleteModal.test.js +4 -4
- package/lib/esm/test/DeleteModal.test.js.map +1 -1
- package/lib/esm/test/ReportAction.test.js +7 -5
- package/lib/esm/test/ReportAction.test.js.map +1 -1
- package/lib/esm/test/ReportMappingHorizontalTile.test.js +65 -26
- package/lib/esm/test/ReportMappingHorizontalTile.test.js.map +1 -1
- package/lib/esm/test/ReportMappings.test.js +41 -20
- package/lib/esm/test/ReportMappings.test.js.map +1 -1
- package/lib/esm/test/Reports.test.js +4 -4
- package/lib/esm/test/Reports.test.js.map +1 -1
- package/lib/esm/test/WidgetHeader.test.js +3 -3
- package/lib/esm/test/WidgetHeader.test.js.map +1 -1
- package/lib/esm/test/test-utils.d.ts +8 -0
- package/lib/esm/test/test-utils.d.ts.map +1 -1
- package/lib/esm/test/test-utils.js +15 -3
- package/lib/esm/test/test-utils.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/widget/ReportsConfigUiProvider.d.ts +10 -4
- package/lib/esm/widget/ReportsConfigUiProvider.d.ts.map +1 -1
- package/lib/esm/widget/ReportsConfigUiProvider.js +12 -8
- package/lib/esm/widget/ReportsConfigUiProvider.js.map +1 -1
- package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -1
- package/lib/esm/widget/components/ActionPanel.js.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.d.ts +1 -1
- package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.js +7 -7
- package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.scss +1 -1
- package/lib/esm/widget/components/BulkExtractor.d.ts +8 -5
- package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -1
- package/lib/esm/widget/components/BulkExtractor.js +53 -36
- package/lib/esm/widget/components/BulkExtractor.js.map +1 -1
- package/lib/esm/widget/components/Constants.d.ts.map +1 -1
- package/lib/esm/widget/components/Constants.js +3 -3
- package/lib/esm/widget/components/Constants.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.d.ts +1 -1
- package/lib/esm/widget/components/DeleteModal.d.ts.map +1 -1
- package/lib/esm/widget/components/DeleteModal.js +6 -6
- package/lib/esm/widget/components/DeleteModal.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.scss +2 -2
- package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.d.ts.map +1 -1
- package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.js +3 -3
- package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.js.map +1 -1
- package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.d.ts.map +1 -1
- package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.js +3 -3
- package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.js.map +1 -1
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.d.ts.map +1 -1
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js +3 -3
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -1
- package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.d.ts.map +1 -1
- package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.js +3 -3
- package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.js.map +1 -1
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -1
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js +3 -3
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -1
- package/lib/esm/widget/components/ExtractionStatus.d.ts +1 -1
- package/lib/esm/widget/components/ExtractionStatus.d.ts.map +1 -1
- package/lib/esm/widget/components/ExtractionStatus.js +9 -9
- package/lib/esm/widget/components/ExtractionStatus.js.map +1 -1
- package/lib/esm/widget/components/ExtractionStatus.scss +1 -1
- package/lib/esm/widget/components/ExtractionToast.d.ts.map +1 -1
- package/lib/esm/widget/components/ExtractionToast.js +3 -3
- package/lib/esm/widget/components/ExtractionToast.js.map +1 -1
- package/lib/esm/widget/components/HorizontalTile.d.ts.map +1 -1
- package/lib/esm/widget/components/HorizontalTile.js +1 -2
- package/lib/esm/widget/components/HorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/HorizontalTile.scss +1 -4
- package/lib/esm/widget/components/LocalizedTablePaginator.d.ts.map +1 -1
- package/lib/esm/widget/components/LocalizedTablePaginator.js +1 -1
- package/lib/esm/widget/components/LocalizedTablePaginator.js.map +1 -1
- package/lib/esm/widget/components/ReportAction.d.ts +8 -0
- package/lib/esm/widget/components/ReportAction.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportAction.js +10 -8
- package/lib/esm/widget/components/ReportAction.js.map +1 -1
- package/lib/esm/widget/components/ReportAction.scss +1 -1
- package/lib/esm/widget/components/ReportHorizontalTile.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportHorizontalTile.js +6 -6
- package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportMappingHorizontalTile.js +47 -46
- package/lib/esm/widget/components/ReportMappingHorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/ReportMappings.d.ts +8 -0
- package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportMappings.js +28 -14
- package/lib/esm/widget/components/ReportMappings.js.map +1 -1
- package/lib/esm/widget/components/Reports.d.ts +9 -1
- package/lib/esm/widget/components/Reports.d.ts.map +1 -1
- package/lib/esm/widget/components/Reports.js +8 -9
- package/lib/esm/widget/components/Reports.js.map +1 -1
- package/lib/esm/widget/components/Reports.scss +0 -1
- package/lib/esm/widget/components/ReportsConfigContext.d.ts +34 -4
- package/lib/esm/widget/components/ReportsConfigContext.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportsConfigContext.js +28 -10
- package/lib/esm/widget/components/ReportsConfigContext.js.map +1 -1
- package/lib/esm/widget/components/ReportsContainer.d.ts +3 -6
- package/lib/esm/widget/components/ReportsContainer.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportsContainer.js +7 -5
- package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
- package/lib/esm/widget/components/ReportsContainer.scss +1 -1
- package/lib/esm/widget/components/ReportsHeader.d.ts +1 -1
- package/lib/esm/widget/components/ReportsHeader.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportsHeader.js +6 -7
- package/lib/esm/widget/components/ReportsHeader.js.map +1 -1
- package/lib/esm/widget/components/ReportsRouter.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportsRouter.js +3 -3
- package/lib/esm/widget/components/ReportsRouter.js.map +1 -1
- package/lib/esm/widget/components/SearchBar.d.ts +1 -1
- package/lib/esm/widget/components/SearchBar.d.ts.map +1 -1
- package/lib/esm/widget/components/SearchBar.js +4 -4
- package/lib/esm/widget/components/SearchBar.js.map +1 -1
- package/lib/esm/widget/components/SelectIModel.d.ts +1 -1
- package/lib/esm/widget/components/SelectIModel.d.ts.map +1 -1
- package/lib/esm/widget/components/SelectIModel.js +2 -2
- package/lib/esm/widget/components/SelectIModel.js.map +1 -1
- package/lib/esm/widget/components/SelectIModel.scss +1 -1
- package/lib/esm/widget/components/utils.d.ts +1 -1
- package/lib/esm/widget/components/utils.d.ts.map +1 -1
- package/lib/esm/widget/components/utils.js +6 -6
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +1 -1
- package/lib/esm/widget/context/BulkExtractorContext.d.ts.map +1 -1
- package/lib/esm/widget/context/BulkExtractorContext.js.map +1 -1
- package/lib/esm/widget/context/ReportsConfigApiContext.d.ts +3 -3
- package/lib/esm/widget/context/ReportsConfigApiContext.d.ts.map +1 -1
- package/lib/esm/widget/context/ReportsConfigApiContext.js.map +1 -1
- package/lib/esm/widget/hooks/useValidator.d.ts +1 -4
- package/lib/esm/widget/hooks/useValidator.d.ts.map +1 -1
- package/lib/esm/widget/hooks/useValidator.js +3 -3
- package/lib/esm/widget/hooks/useValidator.js.map +1 -1
- package/package.json +9 -4
- package/src/ReportsConfigWidget.ts +9 -9
- package/src/reports-config-widget-react.ts +4 -3
- package/src/test/AddMappingModal.test.tsx +45 -70
- package/src/test/BulkExtractor.test.ts +73 -118
- package/src/test/DeleteModal.test.tsx +6 -23
- package/src/test/ReportAction.test.tsx +20 -38
- package/src/test/ReportMappingHorizontalTile.test.tsx +137 -106
- package/src/test/ReportMappings.test.tsx +73 -88
- package/src/test/Reports.test.tsx +30 -64
- package/src/test/WidgetHeader.test.tsx +3 -3
- package/src/test/test-utils.tsx +18 -8
- package/src/widget/ReportsConfigUiProvider.tsx +18 -37
- package/src/widget/components/ActionPanel.tsx +3 -14
- package/src/widget/components/AddMappingsModal.scss +1 -1
- package/src/widget/components/AddMappingsModal.tsx +21 -53
- package/src/widget/components/BulkExtractor.ts +67 -59
- package/src/widget/components/Constants.ts +4 -4
- package/src/widget/components/DeleteModal.scss +2 -2
- package/src/widget/components/DeleteModal.tsx +11 -41
- package/src/widget/components/ExtractionStates/FailedExtractionState.tsx +4 -9
- package/src/widget/components/ExtractionStates/QueuedExtractionState.tsx +4 -9
- package/src/widget/components/ExtractionStates/RunningExtractionState.tsx +4 -9
- package/src/widget/components/ExtractionStates/StartingExtractionState.tsx +4 -11
- package/src/widget/components/ExtractionStates/SucceededExtractionState.tsx +4 -9
- package/src/widget/components/ExtractionStatus.scss +1 -1
- package/src/widget/components/ExtractionStatus.tsx +9 -18
- package/src/widget/components/ExtractionToast.tsx +12 -9
- package/src/widget/components/HorizontalTile.scss +1 -4
- package/src/widget/components/HorizontalTile.tsx +12 -33
- package/src/widget/components/LocalizedTablePaginator.tsx +13 -44
- package/src/widget/components/ReportAction.scss +1 -1
- package/src/widget/components/ReportAction.tsx +26 -39
- package/src/widget/components/ReportHorizontalTile.tsx +45 -55
- package/src/widget/components/ReportMappingHorizontalTile.tsx +70 -78
- package/src/widget/components/ReportMappings.tsx +61 -132
- package/src/widget/components/Reports.scss +0 -1
- package/src/widget/components/Reports.tsx +30 -84
- package/src/widget/components/ReportsConfigContext.tsx +70 -32
- package/src/widget/components/ReportsContainer.scss +1 -1
- package/src/widget/components/ReportsContainer.tsx +12 -28
- package/src/widget/components/ReportsHeader.tsx +6 -19
- package/src/widget/components/ReportsRouter.tsx +4 -6
- package/src/widget/components/SearchBar.tsx +9 -13
- package/src/widget/components/SelectIModel.scss +1 -1
- package/src/widget/components/SelectIModel.tsx +9 -24
- package/src/widget/components/utils.scss +1 -1
- package/src/widget/components/utils.tsx +21 -69
- package/src/widget/context/BulkExtractorContext.tsx +4 -6
- package/src/widget/context/ReportsConfigApiContext.tsx +7 -8
- package/src/widget/hooks/useValidator.ts +10 -24
- package/tsconfig.json +11 -11
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import React from "react";
|
|
6
6
|
import faker from "@faker-js/faker";
|
|
7
7
|
import "@testing-library/jest-dom";
|
|
8
8
|
import { ReportsConfigWidget } from "../ReportsConfigWidget";
|
|
9
|
-
import {
|
|
10
|
-
fireEvent,
|
|
11
|
-
mockIModelId1,
|
|
12
|
-
mockIModelsResponse,
|
|
13
|
-
mockReportId,
|
|
14
|
-
render,
|
|
15
|
-
screen,
|
|
16
|
-
waitFor,
|
|
17
|
-
within,
|
|
18
|
-
} from "./test-utils";
|
|
9
|
+
import { fireEvent, mockIModelId1, mockIModelsResponse, mockReportId, render, screen, waitFor, within } from "./test-utils";
|
|
19
10
|
import * as moq from "typemoq";
|
|
20
|
-
import type {
|
|
21
|
-
MappingSingle,
|
|
22
|
-
ReportMappingCollection,
|
|
23
|
-
} from "@itwin/insights-client";
|
|
11
|
+
import type { MappingContainer, ReportMappingCollection } from "@itwin/insights-client";
|
|
24
12
|
import type { ReportMappingAndMapping } from "../widget/components/ReportMappings";
|
|
25
13
|
import type { GetSingleIModelParams } from "@itwin/imodels-client-management";
|
|
26
14
|
import { BeEvent } from "@itwin/core-bentley";
|
|
@@ -89,29 +77,25 @@ const mockReportMappingsFactory = (): ReportMappingCollection => {
|
|
|
89
77
|
};
|
|
90
78
|
};
|
|
91
79
|
|
|
92
|
-
const mockMappingsFactory = (
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
imodel: {
|
|
108
|
-
// Tie the mapping to to the iModel Id
|
|
109
|
-
href: mapping.imodelId,
|
|
110
|
-
},
|
|
80
|
+
const mockMappingsFactory = (mockReportMappings: ReportMappingCollection): MappingContainer[] => {
|
|
81
|
+
const mockMappings: MappingContainer[] = mockReportMappings.mappings.map((mapping, index) => ({
|
|
82
|
+
mapping: {
|
|
83
|
+
id: mapping.mappingId,
|
|
84
|
+
mappingName: `mOcKMaPpIngNaMe${index}`,
|
|
85
|
+
description: `mOcKmApPInGDeScRiPtIoN${index}`,
|
|
86
|
+
extractionEnabled: false,
|
|
87
|
+
createdOn: "",
|
|
88
|
+
createdBy: "",
|
|
89
|
+
modifiedOn: "",
|
|
90
|
+
modifiedBy: "",
|
|
91
|
+
_links: {
|
|
92
|
+
iModel: {
|
|
93
|
+
// Tie the mapping to to the iModel Id
|
|
94
|
+
href: mapping.imodelId,
|
|
111
95
|
},
|
|
112
96
|
},
|
|
113
|
-
}
|
|
114
|
-
);
|
|
97
|
+
},
|
|
98
|
+
}));
|
|
115
99
|
|
|
116
100
|
return mockMappings;
|
|
117
101
|
};
|
|
@@ -119,18 +103,17 @@ const mockMappingsFactory = (
|
|
|
119
103
|
const mockReportMappingsAndMappingsFactory = (): ReportMappingAndMapping[] => {
|
|
120
104
|
const reportMappings = mockReportMappingsFactory();
|
|
121
105
|
const mockMappings = mockMappingsFactory(reportMappings);
|
|
122
|
-
const reportMappingsAndMapping =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
106
|
+
const reportMappingsAndMapping = reportMappings.mappings.map((reportMapping) => {
|
|
107
|
+
const mapping = mockMappings.find((x) => x.mapping.id === reportMapping.mappingId)!.mapping;
|
|
108
|
+
const iModelName = mockProjectIModels.iModels.find((x) => x.id === reportMapping.imodelId)!.displayName;
|
|
109
|
+
const reportMappingAndMapping: ReportMappingAndMapping = {
|
|
110
|
+
...reportMapping,
|
|
111
|
+
iModelName,
|
|
112
|
+
mappingName: mapping.mappingName,
|
|
113
|
+
mappingDescription: mapping.description ?? "",
|
|
114
|
+
};
|
|
115
|
+
return reportMappingAndMapping;
|
|
116
|
+
});
|
|
134
117
|
return reportMappingsAndMapping;
|
|
135
118
|
};
|
|
136
119
|
|
|
@@ -158,16 +141,19 @@ describe("Report Mapping Horizontal Tile", () => {
|
|
|
158
141
|
it("tile renders correctly", async () => {
|
|
159
142
|
const firstMockMapping = mockReportMappingsAndMappingsFactory()[0];
|
|
160
143
|
|
|
161
|
-
mockBulkExtractor
|
|
144
|
+
mockBulkExtractor
|
|
145
|
+
.setup(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl))
|
|
162
146
|
.returns(async () => ExtractionStates.None);
|
|
163
147
|
|
|
164
|
-
render(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
148
|
+
render(
|
|
149
|
+
<ReportMappingHorizontalTile
|
|
150
|
+
jobStartEvent={new BeEvent()}
|
|
151
|
+
mapping={firstMockMapping}
|
|
152
|
+
onClickDelete={() => {}}
|
|
153
|
+
bulkExtractor={mockBulkExtractor.object}
|
|
154
|
+
odataFeedUrl={mockOdataFeedUrl}
|
|
155
|
+
/>,
|
|
156
|
+
);
|
|
171
157
|
|
|
172
158
|
mockBulkExtractor.verify(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl), moq.Times.once());
|
|
173
159
|
await waitFor(() => expect(screen.getByRole("button", { name: /UpdateDataset/i })).not.toBeDisabled(), { timeout: 1000 });
|
|
@@ -181,22 +167,32 @@ describe("Report Mapping Horizontal Tile", () => {
|
|
|
181
167
|
|
|
182
168
|
it("starting extraction sends request", async () => {
|
|
183
169
|
const firstMockMapping = mockReportMappingsAndMappingsFactory()[0];
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
170
|
+
const firstMockExtractionRequest = {
|
|
171
|
+
mappings: [{ id: firstMockMapping.mappingId }],
|
|
172
|
+
iModelId: firstMockMapping.imodelId,
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
mockBulkExtractor
|
|
176
|
+
.setup(async (x) => x.runIModelExtraction(firstMockExtractionRequest))
|
|
177
|
+
.returns(async () => {
|
|
178
|
+
return Promise.resolve();
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
mockBulkExtractor
|
|
182
|
+
.setup(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl))
|
|
189
183
|
.returns(async () => ExtractionStates.None);
|
|
190
184
|
|
|
191
185
|
const jobStartEvent = new BeEvent<(iModelId: string) => void>();
|
|
192
186
|
|
|
193
|
-
const { user } = render(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
187
|
+
const { user } = render(
|
|
188
|
+
<ReportMappingHorizontalTile
|
|
189
|
+
jobStartEvent={jobStartEvent}
|
|
190
|
+
mapping={firstMockMapping}
|
|
191
|
+
onClickDelete={() => {}}
|
|
192
|
+
bulkExtractor={mockBulkExtractor.object}
|
|
193
|
+
odataFeedUrl={mockOdataFeedUrl}
|
|
194
|
+
/>,
|
|
195
|
+
);
|
|
200
196
|
|
|
201
197
|
mockBulkExtractor.verify(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl), moq.Times.once());
|
|
202
198
|
await waitFor(() => expect(screen.getByRole("button", { name: /UpdateDataset/i })).not.toBeDisabled(), { timeout: 1000 });
|
|
@@ -204,29 +200,39 @@ describe("Report Mapping Horizontal Tile", () => {
|
|
|
204
200
|
const startExtractionButton = screen.getByRole("button", { name: /UpdateDataset/i });
|
|
205
201
|
await user.click(startExtractionButton);
|
|
206
202
|
|
|
207
|
-
mockBulkExtractor.verify(async (x) => x.runIModelExtraction(
|
|
203
|
+
mockBulkExtractor.verify(async (x) => x.runIModelExtraction(firstMockExtractionRequest), moq.Times.once());
|
|
208
204
|
});
|
|
209
205
|
|
|
210
206
|
it("on delete is called when remove is pressed", async () => {
|
|
211
207
|
const firstMockMapping = mockReportMappingsAndMappingsFactory()[0];
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
208
|
+
const firstMockExtractionRequest = {
|
|
209
|
+
mappings: [{ id: firstMockMapping.mappingId }],
|
|
210
|
+
iModelId: firstMockMapping.imodelId,
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
mockBulkExtractor
|
|
214
|
+
.setup(async (x) => x.runIModelExtraction(firstMockExtractionRequest))
|
|
215
|
+
.returns(async () => {
|
|
216
|
+
return Promise.resolve();
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
mockBulkExtractor
|
|
220
|
+
.setup(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl))
|
|
217
221
|
.returns(async () => ExtractionStates.None);
|
|
218
222
|
|
|
219
223
|
const mockOnClickDelete = jest.fn();
|
|
220
224
|
|
|
221
225
|
const jobStartEvent = new BeEvent<(iModelId: string) => void>();
|
|
222
226
|
|
|
223
|
-
const { user } = render(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
const { user } = render(
|
|
228
|
+
<ReportMappingHorizontalTile
|
|
229
|
+
jobStartEvent={jobStartEvent}
|
|
230
|
+
mapping={firstMockMapping}
|
|
231
|
+
onClickDelete={mockOnClickDelete}
|
|
232
|
+
bulkExtractor={mockBulkExtractor.object}
|
|
233
|
+
odataFeedUrl={mockOdataFeedUrl}
|
|
234
|
+
/>,
|
|
235
|
+
);
|
|
230
236
|
|
|
231
237
|
await waitFor(() => expect(screen.getByRole("button", { name: /Remove/i })).not.toBeDisabled(), { timeout: 1000 });
|
|
232
238
|
|
|
@@ -238,53 +244,68 @@ describe("Report Mapping Horizontal Tile", () => {
|
|
|
238
244
|
|
|
239
245
|
it("full extraction status cycle", async () => {
|
|
240
246
|
const firstMockMapping = mockReportMappingsAndMappingsFactory()[0];
|
|
247
|
+
const firstMockExtractionRequest = {
|
|
248
|
+
mappings: [{ id: firstMockMapping.mappingId }],
|
|
249
|
+
iModelId: firstMockMapping.imodelId,
|
|
250
|
+
};
|
|
241
251
|
|
|
242
|
-
mockIModelsClient
|
|
252
|
+
mockIModelsClient
|
|
253
|
+
.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))
|
|
243
254
|
.returns(async () => mockIModelsResponse[0].iModel);
|
|
244
255
|
|
|
245
|
-
mockBulkExtractor
|
|
246
|
-
.
|
|
256
|
+
mockBulkExtractor
|
|
257
|
+
.setup(async (x) => x.runIModelExtraction(firstMockExtractionRequest))
|
|
258
|
+
.returns(async () => {
|
|
259
|
+
return Promise.resolve();
|
|
260
|
+
});
|
|
247
261
|
|
|
248
|
-
mockBulkExtractor
|
|
262
|
+
mockBulkExtractor
|
|
263
|
+
.setup(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl))
|
|
249
264
|
.returns(async () => ExtractionStates.None);
|
|
250
265
|
|
|
251
266
|
const mockOnClickDelete = jest.fn();
|
|
252
267
|
|
|
253
268
|
const jobStartEvent = new BeEvent<(iModelId: string) => void>();
|
|
254
269
|
|
|
255
|
-
const { user } = render(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
270
|
+
const { user } = render(
|
|
271
|
+
<ReportMappingHorizontalTile
|
|
272
|
+
jobStartEvent={jobStartEvent}
|
|
273
|
+
mapping={firstMockMapping}
|
|
274
|
+
onClickDelete={mockOnClickDelete}
|
|
275
|
+
bulkExtractor={mockBulkExtractor.object}
|
|
276
|
+
odataFeedUrl={mockOdataFeedUrl}
|
|
277
|
+
/>,
|
|
278
|
+
);
|
|
262
279
|
|
|
263
280
|
await waitFor(() => expect(screen.getByRole("button", { name: /UpdateDataset/i })).not.toBeDisabled(), { timeout: 1000 });
|
|
264
281
|
|
|
265
|
-
mockBulkExtractor
|
|
282
|
+
mockBulkExtractor
|
|
283
|
+
.setup(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl))
|
|
266
284
|
.returns(async () => ExtractionStates.Starting);
|
|
267
285
|
|
|
268
286
|
const startExtractionButton = screen.getByRole("button", { name: /UpdateDataset/i });
|
|
269
287
|
await user.click(startExtractionButton);
|
|
270
288
|
|
|
271
|
-
mockBulkExtractor.verify(async (x) => x.runIModelExtraction(
|
|
289
|
+
mockBulkExtractor.verify(async (x) => x.runIModelExtraction(firstMockExtractionRequest), moq.Times.once());
|
|
272
290
|
|
|
273
291
|
expect(screen.getByTitle(/Starting/i)).toBeInTheDocument();
|
|
274
292
|
|
|
275
293
|
mockBulkExtractor.reset();
|
|
276
|
-
mockBulkExtractor
|
|
294
|
+
mockBulkExtractor
|
|
295
|
+
.setup(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl))
|
|
277
296
|
.returns(async () => ExtractionStates.Queued);
|
|
278
297
|
|
|
279
298
|
await waitFor(() => expect(screen.getByTitle(/Queued/i)).toBeInTheDocument(), { timeout: 1000 });
|
|
280
299
|
|
|
281
300
|
mockBulkExtractor.reset();
|
|
282
|
-
mockBulkExtractor
|
|
301
|
+
mockBulkExtractor
|
|
302
|
+
.setup(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl))
|
|
283
303
|
.returns(async () => ExtractionStates.Running);
|
|
284
304
|
await waitFor(() => expect(screen.getByTitle(/Running/i)).toBeInTheDocument(), { timeout: 1000 });
|
|
285
305
|
|
|
286
306
|
mockBulkExtractor.reset();
|
|
287
|
-
mockBulkExtractor
|
|
307
|
+
mockBulkExtractor
|
|
308
|
+
.setup(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl))
|
|
288
309
|
.returns(async () => ExtractionStates.Succeeded);
|
|
289
310
|
await waitFor(() => expect(screen.getByTitle(/Success/i)).toBeInTheDocument(), { timeout: 1000 });
|
|
290
311
|
|
|
@@ -297,8 +318,13 @@ describe("Report Mapping Horizontal Tile", () => {
|
|
|
297
318
|
const mockReportMappingsAndMappings = mockReportMappingsAndMappingsFactory();
|
|
298
319
|
const firstMockMapping = mockReportMappingsAndMappings[0];
|
|
299
320
|
const secondMockMapping = mockReportMappingsAndMappings[1];
|
|
321
|
+
const firstMockExtractionRequest = {
|
|
322
|
+
mappings: [{ id: firstMockMapping.mappingId }],
|
|
323
|
+
iModelId: firstMockMapping.imodelId,
|
|
324
|
+
};
|
|
300
325
|
|
|
301
|
-
mockBulkExtractor
|
|
326
|
+
mockBulkExtractor
|
|
327
|
+
.setup(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl))
|
|
302
328
|
.returns(async () => ExtractionStates.None);
|
|
303
329
|
|
|
304
330
|
const jobStartEvent = new BeEvent<(iModelId: string) => void>();
|
|
@@ -308,18 +334,19 @@ describe("Report Mapping Horizontal Tile", () => {
|
|
|
308
334
|
<ReportMappingHorizontalTile
|
|
309
335
|
jobStartEvent={jobStartEvent}
|
|
310
336
|
mapping={firstMockMapping}
|
|
311
|
-
onClickDelete={() => {
|
|
337
|
+
onClickDelete={() => {}}
|
|
312
338
|
bulkExtractor={mockBulkExtractor.object}
|
|
313
339
|
odataFeedUrl={mockOdataFeedUrl}
|
|
314
340
|
/>
|
|
315
341
|
<ReportMappingHorizontalTile
|
|
316
342
|
jobStartEvent={jobStartEvent}
|
|
317
343
|
mapping={secondMockMapping}
|
|
318
|
-
onClickDelete={() => {
|
|
344
|
+
onClickDelete={() => {}}
|
|
319
345
|
bulkExtractor={mockBulkExtractor.object}
|
|
320
346
|
odataFeedUrl={mockOdataFeedUrl}
|
|
321
347
|
/>
|
|
322
|
-
</div
|
|
348
|
+
</div>,
|
|
349
|
+
);
|
|
323
350
|
|
|
324
351
|
const tiles = screen.getAllByTestId("horizontal-tile");
|
|
325
352
|
|
|
@@ -329,11 +356,15 @@ describe("Report Mapping Horizontal Tile", () => {
|
|
|
329
356
|
}
|
|
330
357
|
|
|
331
358
|
mockBulkExtractor.reset();
|
|
332
|
-
mockBulkExtractor
|
|
359
|
+
mockBulkExtractor
|
|
360
|
+
.setup(async (x) => x.getIModelState(firstMockMapping.imodelId, firstMockMapping.iModelName, mockOdataFeedUrl))
|
|
333
361
|
.returns(async () => ExtractionStates.Queued);
|
|
334
362
|
|
|
335
|
-
mockBulkExtractor
|
|
336
|
-
.
|
|
363
|
+
mockBulkExtractor
|
|
364
|
+
.setup(async (x) => x.runIModelExtraction(firstMockExtractionRequest))
|
|
365
|
+
.returns(async () => {
|
|
366
|
+
return Promise.resolve();
|
|
367
|
+
});
|
|
337
368
|
|
|
338
369
|
const startExtractionButton = screen.getAllByRole("button", { name: /UpdateDataset/i })[0];
|
|
339
370
|
await user.click(startExtractionButton);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import React from "react";
|
|
6
6
|
import "@testing-library/jest-dom";
|
|
7
7
|
import { ReportsConfigWidget } from "../ReportsConfigWidget";
|
|
8
8
|
import {
|
|
9
9
|
act,
|
|
10
|
+
mockExtractionRequestDetails,
|
|
10
11
|
mockIModelId1,
|
|
11
12
|
mockIModelId2,
|
|
12
13
|
mockIModelsResponse,
|
|
@@ -18,16 +19,8 @@ import {
|
|
|
18
19
|
within,
|
|
19
20
|
} from "./test-utils";
|
|
20
21
|
import * as moq from "typemoq";
|
|
21
|
-
import type {
|
|
22
|
-
|
|
23
|
-
MappingSingle,
|
|
24
|
-
Report,
|
|
25
|
-
ReportMappingCollection,
|
|
26
|
-
} from "@itwin/insights-client";
|
|
27
|
-
import {
|
|
28
|
-
ExtractionClient,
|
|
29
|
-
ReportsClient,
|
|
30
|
-
} from "@itwin/insights-client";
|
|
22
|
+
import type { MappingContainer, MappingsClient, Report, ReportMappingCollection } from "@itwin/insights-client";
|
|
23
|
+
import { ExtractionClient, ReportsClient } from "@itwin/insights-client";
|
|
31
24
|
import { ReportMappings } from "../widget/components/ReportMappings";
|
|
32
25
|
import type { GetSingleIModelParams, IModelsClient } from "@itwin/imodels-client-management";
|
|
33
26
|
import { BulkExtractor } from "../widget/components/BulkExtractor";
|
|
@@ -108,29 +101,25 @@ const mockReportMappingsFactory = (): ReportMappingCollection => {
|
|
|
108
101
|
};
|
|
109
102
|
};
|
|
110
103
|
|
|
111
|
-
const mockMappingsFactory = (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
imodel: {
|
|
127
|
-
// Tie the mapping to to the iModel Id
|
|
128
|
-
href: mapping.imodelId,
|
|
129
|
-
},
|
|
104
|
+
const mockMappingsFactory = (mockReportMappings: ReportMappingCollection): MappingContainer[] => {
|
|
105
|
+
const mockMappings: MappingContainer[] = mockReportMappings.mappings.map((mapping, index) => ({
|
|
106
|
+
mapping: {
|
|
107
|
+
id: mapping.mappingId,
|
|
108
|
+
mappingName: `mOcKMaPpIngNaMe${index}`,
|
|
109
|
+
description: `mOcKmApPInGDeScRiPtIoN${index}`,
|
|
110
|
+
extractionEnabled: false,
|
|
111
|
+
createdOn: "",
|
|
112
|
+
createdBy: "",
|
|
113
|
+
modifiedOn: "",
|
|
114
|
+
modifiedBy: "",
|
|
115
|
+
_links: {
|
|
116
|
+
iModel: {
|
|
117
|
+
// Tie the mapping to to the iModel Id
|
|
118
|
+
href: mapping.imodelId,
|
|
130
119
|
},
|
|
131
120
|
},
|
|
132
|
-
}
|
|
133
|
-
);
|
|
121
|
+
},
|
|
122
|
+
}));
|
|
134
123
|
|
|
135
124
|
return mockMappings;
|
|
136
125
|
};
|
|
@@ -142,10 +131,12 @@ jest.mock("../widget/components/Constants.ts", () => ({
|
|
|
142
131
|
|
|
143
132
|
jest.mock("../widget/components/ReportMappingHorizontalTile", () => ({
|
|
144
133
|
ReportMappingHorizontalTile: (props: ReportMappingHorizontalTileProps) => {
|
|
145
|
-
return (
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
134
|
+
return (
|
|
135
|
+
<div data-testid="horizontal-tile">
|
|
136
|
+
<Text>{props.mapping.mappingName}</Text>
|
|
137
|
+
<Text title={props.mapping.mappingDescription}>{props.mapping.iModelName}</Text>
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
149
140
|
},
|
|
150
141
|
}));
|
|
151
142
|
|
|
@@ -178,15 +169,16 @@ const mockMappingsClient = moq.Mock.ofType<MappingsClient>();
|
|
|
178
169
|
beforeAll(async () => {
|
|
179
170
|
const localization = new EmptyLocalization();
|
|
180
171
|
await ReportsConfigWidget.initialize(localization);
|
|
181
|
-
mockIModelsClientOperations
|
|
172
|
+
mockIModelsClientOperations
|
|
173
|
+
.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))
|
|
182
174
|
.returns(async () => mockIModelsResponse[0].iModel);
|
|
183
|
-
mockIModelsClientOperations
|
|
175
|
+
mockIModelsClientOperations
|
|
176
|
+
.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))
|
|
184
177
|
.returns(async () => mockIModelsResponse[1].iModel);
|
|
185
|
-
mockIModelsClient.setup((x) => x.iModels)
|
|
186
|
-
.returns(() => mockIModelsClientOperations.object);
|
|
178
|
+
mockIModelsClient.setup((x) => x.iModels).returns(() => mockIModelsClientOperations.object);
|
|
187
179
|
mockReportsClient.setup(async (x) => x.getReportMappings(moq.It.isAny(), moq.It.isAny())).returns(mockGetReportMappings);
|
|
188
180
|
mockMappingsClient.setup(async (x) => x.getMappings(moq.It.isAny(), moq.It.isAny())).returns(mockGetMappings);
|
|
189
|
-
mockMappingsClient.setup(async (x) => x.getMapping(moq.It.isAny(), moq.It.isAny()
|
|
181
|
+
mockMappingsClient.setup(async (x) => x.getMapping(moq.It.isAny(), moq.It.isAny())).returns(mockGetMapping);
|
|
190
182
|
});
|
|
191
183
|
|
|
192
184
|
afterEach(() => {
|
|
@@ -203,7 +195,11 @@ describe("Report Mappings View", () => {
|
|
|
203
195
|
mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
|
|
204
196
|
mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
|
|
205
197
|
|
|
206
|
-
render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
|
|
198
|
+
render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
|
|
199
|
+
reportsClient: mockReportsClient.object,
|
|
200
|
+
mappingsClient: mockMappingsClient.object,
|
|
201
|
+
iModelsClient: mockIModelsClient.object,
|
|
202
|
+
});
|
|
207
203
|
|
|
208
204
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
209
205
|
|
|
@@ -218,7 +214,11 @@ describe("Report Mappings View", () => {
|
|
|
218
214
|
mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
|
|
219
215
|
mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
|
|
220
216
|
|
|
221
|
-
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
|
|
217
|
+
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
|
|
218
|
+
reportsClient: mockReportsClient.object,
|
|
219
|
+
mappingsClient: mockMappingsClient.object,
|
|
220
|
+
iModelsClient: mockIModelsClient.object,
|
|
221
|
+
});
|
|
222
222
|
|
|
223
223
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
224
224
|
|
|
@@ -232,29 +232,20 @@ describe("Report Mappings View", () => {
|
|
|
232
232
|
// Be an exact match on display name.
|
|
233
233
|
await user.type(searchInput, mockMappings[0].mapping.mappingName);
|
|
234
234
|
expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
|
|
235
|
-
expect(
|
|
236
|
-
screen.getByText(mockMappings[0].mapping.mappingName)
|
|
237
|
-
).toBeInTheDocument();
|
|
235
|
+
expect(screen.getByText(mockMappings[0].mapping.mappingName)).toBeInTheDocument();
|
|
238
236
|
|
|
239
237
|
// Be an exact match on description.
|
|
240
238
|
await user.clear(searchInput);
|
|
241
239
|
await user.type(searchInput, mockMappings[0].mapping.description ?? "");
|
|
242
240
|
expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
|
|
243
|
-
expect(
|
|
244
|
-
screen.getByTitle(mockMappings[0].mapping.description ?? "")
|
|
245
|
-
).toBeInTheDocument();
|
|
241
|
+
expect(screen.getByTitle(mockMappings[0].mapping.description ?? "")).toBeInTheDocument();
|
|
246
242
|
|
|
247
243
|
// Be an exact match on iModel Name.
|
|
248
|
-
const iModel = mockIModelsResponse.find(
|
|
249
|
-
(mockIModel) =>
|
|
250
|
-
mockIModel.iModel.id === mockMappings[0].mapping._links.imodel.href
|
|
251
|
-
);
|
|
244
|
+
const iModel = mockIModelsResponse.find((mockIModel) => mockIModel.iModel.id === mockMappings[0].mapping._links.iModel.href);
|
|
252
245
|
await user.clear(searchInput);
|
|
253
246
|
await user.type(searchInput, iModel?.iModel.displayName ?? "");
|
|
254
247
|
expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
|
|
255
|
-
expect(
|
|
256
|
-
screen.getByText(iModel?.iModel.displayName ?? "")
|
|
257
|
-
).toBeInTheDocument();
|
|
248
|
+
expect(screen.getByText(iModel?.iModel.displayName ?? "")).toBeInTheDocument();
|
|
258
249
|
});
|
|
259
250
|
|
|
260
251
|
it("add mapping", async () => {
|
|
@@ -264,11 +255,15 @@ describe("Report Mappings View", () => {
|
|
|
264
255
|
mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
|
|
265
256
|
mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
|
|
266
257
|
|
|
267
|
-
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
|
|
258
|
+
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
|
|
259
|
+
reportsClient: mockReportsClient.object,
|
|
260
|
+
mappingsClient: mockMappingsClient.object,
|
|
261
|
+
iModelsClient: mockIModelsClient.object,
|
|
262
|
+
});
|
|
268
263
|
|
|
269
264
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
270
265
|
|
|
271
|
-
mockGetMappings.mockReturnValueOnce(mockMappings.map((m:
|
|
266
|
+
mockGetMappings.mockReturnValueOnce(mockMappings.map((m: MappingContainer) => m.mapping));
|
|
272
267
|
|
|
273
268
|
const addMappingButton = screen.getByRole("button", {
|
|
274
269
|
name: /addmapping/i,
|
|
@@ -290,7 +285,11 @@ describe("Report Mappings View", () => {
|
|
|
290
285
|
});
|
|
291
286
|
|
|
292
287
|
it("odata feed url", async () => {
|
|
293
|
-
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
|
|
288
|
+
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
|
|
289
|
+
reportsClient: mockReportsClient.object,
|
|
290
|
+
mappingsClient: mockMappingsClient.object,
|
|
291
|
+
iModelsClient: mockIModelsClient.object,
|
|
292
|
+
});
|
|
294
293
|
|
|
295
294
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
296
295
|
|
|
@@ -298,11 +297,7 @@ describe("Report Mappings View", () => {
|
|
|
298
297
|
name: /odatafeedurl/i,
|
|
299
298
|
});
|
|
300
299
|
expect(urlTextbox).toBeInTheDocument();
|
|
301
|
-
expect(
|
|
302
|
-
screen.getByDisplayValue(
|
|
303
|
-
`https://api.bentley.com/insights/reporting/odata/${mockReport.id}`
|
|
304
|
-
)
|
|
305
|
-
).toBeInTheDocument();
|
|
300
|
+
expect(screen.getByDisplayValue(`https://api.bentley.com/insights/reporting/odata/${mockReport.id}`)).toBeInTheDocument();
|
|
306
301
|
|
|
307
302
|
const copyButton = screen.getByRole("button", {
|
|
308
303
|
name: /copy/i,
|
|
@@ -319,13 +314,16 @@ describe("Report Mappings View", () => {
|
|
|
319
314
|
mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
|
|
320
315
|
mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
|
|
321
316
|
|
|
322
|
-
const iModels = mockIModelsResponse.map((iModel) => iModel.iModel.id);
|
|
323
|
-
|
|
324
317
|
const bulkExtractor = new BulkExtractor(new ReportsClient(), new ExtractionClient(), jest.fn().mockResolvedValue("mockAccessToken"), jest.fn, jest.fn);
|
|
325
318
|
|
|
326
319
|
const runIModelExtractionsMock = jest.spyOn(bulkExtractor, "runIModelExtractions").mockImplementation(async () => Promise.resolve());
|
|
327
320
|
|
|
328
|
-
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
|
|
321
|
+
const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
|
|
322
|
+
reportsClient: mockReportsClient.object,
|
|
323
|
+
mappingsClient: mockMappingsClient.object,
|
|
324
|
+
iModelsClient: mockIModelsClient.object,
|
|
325
|
+
bulkExtractor,
|
|
326
|
+
});
|
|
329
327
|
|
|
330
328
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
331
329
|
|
|
@@ -336,31 +334,18 @@ describe("Report Mappings View", () => {
|
|
|
336
334
|
await waitFor(() => expect(extractAllButton).toBeEnabled());
|
|
337
335
|
|
|
338
336
|
// Check that the mocked method was called with the expected arguments
|
|
339
|
-
expect(runIModelExtractionsMock).toHaveBeenCalledWith(
|
|
337
|
+
expect(runIModelExtractionsMock).toHaveBeenCalledWith(mockExtractionRequestDetails);
|
|
340
338
|
});
|
|
341
339
|
|
|
342
|
-
const assertHorizontalTiles = (horizontalTiles: HTMLElement[], mockMappings:
|
|
340
|
+
const assertHorizontalTiles = (horizontalTiles: HTMLElement[], mockMappings: MappingContainer[]) => {
|
|
343
341
|
expect(horizontalTiles).toHaveLength(mockMappings.length);
|
|
344
342
|
|
|
345
343
|
for (const [index, horizontalTile] of horizontalTiles.entries()) {
|
|
346
344
|
const reportMappingTile = within(horizontalTile);
|
|
347
|
-
const mockiModel = mockIModelsResponse.find(
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
);
|
|
351
|
-
expect(
|
|
352
|
-
reportMappingTile.getByText(
|
|
353
|
-
mockMappings[index].mapping.mappingName
|
|
354
|
-
)
|
|
355
|
-
).toBeInTheDocument();
|
|
356
|
-
expect(
|
|
357
|
-
reportMappingTile.getByTitle(
|
|
358
|
-
mockMappings[index].mapping.description ?? ""
|
|
359
|
-
)
|
|
360
|
-
).toBeInTheDocument();
|
|
361
|
-
expect(
|
|
362
|
-
reportMappingTile.getByText(mockiModel?.iModel.displayName ?? "")
|
|
363
|
-
).toBeInTheDocument();
|
|
345
|
+
const mockiModel = mockIModelsResponse.find((iModel) => iModel.iModel.id === mockMappings[index].mapping._links.iModel.href);
|
|
346
|
+
expect(reportMappingTile.getByText(mockMappings[index].mapping.mappingName)).toBeInTheDocument();
|
|
347
|
+
expect(reportMappingTile.getByTitle(mockMappings[index].mapping.description ?? "")).toBeInTheDocument();
|
|
348
|
+
expect(reportMappingTile.getByText(mockiModel?.iModel.displayName ?? "")).toBeInTheDocument();
|
|
364
349
|
}
|
|
365
350
|
};
|
|
366
351
|
});
|