@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,15 +1,10 @@
|
|
|
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
|
-
import {
|
|
8
|
-
render,
|
|
9
|
-
screen,
|
|
10
|
-
waitForElementToBeRemoved,
|
|
11
|
-
within,
|
|
12
|
-
} from "../test/test-utils";
|
|
7
|
+
import { render, screen, waitForElementToBeRemoved, within } from "../test/test-utils";
|
|
13
8
|
import { Reports } from "../widget/components/Reports";
|
|
14
9
|
import { ReportsConfigWidget } from "../ReportsConfigWidget";
|
|
15
10
|
import faker from "@faker-js/faker";
|
|
@@ -19,20 +14,17 @@ import { EmptyLocalization } from "@itwin/core-common";
|
|
|
19
14
|
import * as moq from "typemoq";
|
|
20
15
|
|
|
21
16
|
const reportsFactory = (): ReportCollection => ({
|
|
22
|
-
reports: Array.from(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
project: {
|
|
31
|
-
href: "",
|
|
32
|
-
},
|
|
17
|
+
reports: Array.from({ length: faker.datatype.number({ min: 3, max: 5 }) }, (_, index) => ({
|
|
18
|
+
id: `${faker.datatype.uuid()}`,
|
|
19
|
+
displayName: `mOcKRePoRT${index}`,
|
|
20
|
+
description: `mOcKRePoRTDeScRiPtIoN${index}`,
|
|
21
|
+
deleted: false,
|
|
22
|
+
_links: {
|
|
23
|
+
project: {
|
|
24
|
+
href: "",
|
|
33
25
|
},
|
|
34
|
-
}
|
|
35
|
-
),
|
|
26
|
+
},
|
|
27
|
+
})),
|
|
36
28
|
_links: {
|
|
37
29
|
next: undefined,
|
|
38
30
|
self: {
|
|
@@ -78,7 +70,7 @@ describe("Reports View", () => {
|
|
|
78
70
|
mockGetReports.mockReturnValueOnce([]);
|
|
79
71
|
|
|
80
72
|
const onClickAddMock = jest.fn();
|
|
81
|
-
const { user } = render(<Reports onClickAddReport={onClickAddMock} />,
|
|
73
|
+
const { user } = render(<Reports onClickAddReport={onClickAddMock} />, { reportsClient: mockReportsClient.object });
|
|
82
74
|
|
|
83
75
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
84
76
|
const newButton = screen.getByRole("button", {
|
|
@@ -92,7 +84,7 @@ describe("Reports View", () => {
|
|
|
92
84
|
const mockedReports: ReportCollection = reportsFactory();
|
|
93
85
|
mockGetReports.mockReturnValueOnce(mockedReports.reports);
|
|
94
86
|
|
|
95
|
-
render(<Reports />,
|
|
87
|
+
render(<Reports />, { reportsClient: mockReportsClient.object });
|
|
96
88
|
|
|
97
89
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
98
90
|
const horizontalTiles = screen.getAllByTestId("horizontal-tile");
|
|
@@ -101,16 +93,8 @@ describe("Reports View", () => {
|
|
|
101
93
|
|
|
102
94
|
for (const [index, horizontalTile] of horizontalTiles.entries()) {
|
|
103
95
|
const reportMappingTile = within(horizontalTile);
|
|
104
|
-
expect(
|
|
105
|
-
|
|
106
|
-
mockedReports?.reports[index].displayName ?? ""
|
|
107
|
-
)
|
|
108
|
-
).toBeInTheDocument();
|
|
109
|
-
expect(
|
|
110
|
-
reportMappingTile.getByTitle(
|
|
111
|
-
mockedReports?.reports[index].description ?? ""
|
|
112
|
-
)
|
|
113
|
-
).toBeInTheDocument();
|
|
96
|
+
expect(reportMappingTile.getByText(mockedReports?.reports[index].displayName ?? "")).toBeInTheDocument();
|
|
97
|
+
expect(reportMappingTile.getByTitle(mockedReports?.reports[index].description ?? "")).toBeInTheDocument();
|
|
114
98
|
}
|
|
115
99
|
});
|
|
116
100
|
|
|
@@ -118,13 +102,11 @@ describe("Reports View", () => {
|
|
|
118
102
|
const mockedReports: ReportCollection = reportsFactory();
|
|
119
103
|
mockGetReports.mockReturnValueOnce(mockedReports.reports);
|
|
120
104
|
const onClickModifyMock = jest.fn();
|
|
121
|
-
const { user } = render(<Reports onClickReportModify={onClickModifyMock} />,
|
|
105
|
+
const { user } = render(<Reports onClickReportModify={onClickModifyMock} />, { reportsClient: mockReportsClient.object });
|
|
122
106
|
|
|
123
107
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
124
108
|
|
|
125
|
-
const firstMenuDropdown = within(
|
|
126
|
-
screen.getAllByTestId(/tile-action-button/i)[0]
|
|
127
|
-
).getByRole("button");
|
|
109
|
+
const firstMenuDropdown = within(screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
|
|
128
110
|
await user.click(firstMenuDropdown);
|
|
129
111
|
const modifyButton = screen.getByRole("menuitem", { name: /modify/i });
|
|
130
112
|
await user.click(modifyButton);
|
|
@@ -137,13 +119,11 @@ describe("Reports View", () => {
|
|
|
137
119
|
|
|
138
120
|
mockGetReports.mockReturnValue(mockedReports.reports);
|
|
139
121
|
|
|
140
|
-
const { user } = render(<Reports />,
|
|
122
|
+
const { user } = render(<Reports />, { reportsClient: mockReportsClient.object });
|
|
141
123
|
|
|
142
124
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
143
125
|
|
|
144
|
-
const firstMenuDropdown = within(
|
|
145
|
-
screen.getAllByTestId(/tile-action-button/i)[0]
|
|
146
|
-
).getByRole("button");
|
|
126
|
+
const firstMenuDropdown = within(screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
|
|
147
127
|
await user.click(firstMenuDropdown);
|
|
148
128
|
const removeButton = screen.getByRole("menuitem", { name: /remove/i });
|
|
149
129
|
await user.click(removeButton);
|
|
@@ -178,38 +158,26 @@ describe("Reports View", () => {
|
|
|
178
158
|
});
|
|
179
159
|
|
|
180
160
|
// Be an exact match on display name.
|
|
181
|
-
await userEvent.type(
|
|
182
|
-
searchInput,
|
|
183
|
-
mockedReports.reports[0].displayName
|
|
184
|
-
);
|
|
161
|
+
await userEvent.type(searchInput, mockedReports.reports[0].displayName);
|
|
185
162
|
expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
|
|
186
|
-
expect(
|
|
187
|
-
screen.getByText(mockedReports.reports[0].displayName)
|
|
188
|
-
).toBeInTheDocument();
|
|
163
|
+
expect(screen.getByText(mockedReports.reports[0].displayName)).toBeInTheDocument();
|
|
189
164
|
|
|
190
165
|
// Be an exact match on description.
|
|
191
166
|
await userEvent.clear(searchInput);
|
|
192
|
-
await userEvent.type(
|
|
193
|
-
searchInput,
|
|
194
|
-
mockedReports.reports[0].description ?? ""
|
|
195
|
-
);
|
|
167
|
+
await userEvent.type(searchInput, mockedReports.reports[0].description ?? "");
|
|
196
168
|
expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
|
|
197
|
-
expect(
|
|
198
|
-
screen.getByText(mockedReports.reports[0].displayName)
|
|
199
|
-
).toBeInTheDocument();
|
|
169
|
+
expect(screen.getByText(mockedReports.reports[0].displayName)).toBeInTheDocument();
|
|
200
170
|
});
|
|
201
171
|
|
|
202
172
|
it("modify a report", async () => {
|
|
203
173
|
const mockedReports: ReportCollection = reportsFactory();
|
|
204
174
|
mockGetReports.mockReturnValueOnce(mockedReports.reports);
|
|
205
175
|
const onClickModifyMock = jest.fn();
|
|
206
|
-
const { user } = render(<Reports onClickReportModify={onClickModifyMock} />,
|
|
176
|
+
const { user } = render(<Reports onClickReportModify={onClickModifyMock} />, { reportsClient: mockReportsClient.object });
|
|
207
177
|
|
|
208
178
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
209
179
|
|
|
210
|
-
const firstMenuDropdown = within(
|
|
211
|
-
screen.getAllByTestId(/tile-action-button/i)[0]
|
|
212
|
-
).getByRole("button");
|
|
180
|
+
const firstMenuDropdown = within(screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
|
|
213
181
|
await user.click(firstMenuDropdown);
|
|
214
182
|
const modifyButton = screen.getByRole("menuitem", { name: /modify/i });
|
|
215
183
|
await user.click(modifyButton);
|
|
@@ -220,13 +188,11 @@ describe("Reports View", () => {
|
|
|
220
188
|
const mockedReports: ReportCollection = reportsFactory();
|
|
221
189
|
mockGetReports.mockReturnValueOnce(mockedReports.reports);
|
|
222
190
|
const onClickTitleMock = jest.fn();
|
|
223
|
-
const { user } = render(<Reports onClickReportTitle={onClickTitleMock} />,
|
|
191
|
+
const { user } = render(<Reports onClickReportTitle={onClickTitleMock} />, { reportsClient: mockReportsClient.object });
|
|
224
192
|
|
|
225
193
|
await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
|
|
226
194
|
|
|
227
|
-
const reportName = screen.getByText(
|
|
228
|
-
mockedReports.reports[0].displayName
|
|
229
|
-
);
|
|
195
|
+
const reportName = screen.getByText(mockedReports.reports[0].displayName);
|
|
230
196
|
await user.click(reportName);
|
|
231
197
|
expect(onClickTitleMock).toBeCalled();
|
|
232
198
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { render, screen } from "../test/test-utils";
|
package/src/test/test-utils.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 * as React from "react";
|
|
6
6
|
import { render as rtlRender } from "@testing-library/react";
|
|
7
7
|
import userEvent from "@testing-library/user-event";
|
|
@@ -14,6 +14,9 @@ export const mockAccessToken = async () => "Bearer eyJhbGci";
|
|
|
14
14
|
export const mockIModelId1 = "mockIModelId1";
|
|
15
15
|
export const mockIModelId2 = "mockIModelId2";
|
|
16
16
|
|
|
17
|
+
export const mockMappingId1 = "mockMappingId1";
|
|
18
|
+
export const mockMappingId2 = "mockMappingId2";
|
|
19
|
+
|
|
17
20
|
export const mockReportId = "mockReportId";
|
|
18
21
|
export const mockITwinId: string = "mockiTwinId";
|
|
19
22
|
|
|
@@ -72,17 +75,24 @@ export const mockIModelsResponse = [
|
|
|
72
75
|
},
|
|
73
76
|
];
|
|
74
77
|
|
|
78
|
+
export const mockExtractionRequestDetails = [
|
|
79
|
+
{
|
|
80
|
+
iModelId: mockIModelId1,
|
|
81
|
+
mappings: [{ id: mockMappingId1 }],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
iModelId: mockIModelId2,
|
|
85
|
+
mappings: [{ id: mockMappingId2 }],
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
|
|
75
89
|
interface WrapperProps {
|
|
76
90
|
children?: React.ReactNode;
|
|
77
91
|
}
|
|
78
92
|
|
|
79
93
|
function render(ui: React.ReactElement, contextProps?: Partial<ReportsConfigContextProps>, { ...options } = {}) {
|
|
80
94
|
const Wrapper = ({ children }: WrapperProps) => (
|
|
81
|
-
<ReportsConfigContext
|
|
82
|
-
getAccessToken={mockAccessToken}
|
|
83
|
-
iTwinId={contextProps?.iTwinId ?? mockITwinId}
|
|
84
|
-
{...contextProps}
|
|
85
|
-
>
|
|
95
|
+
<ReportsConfigContext getAccessToken={mockAccessToken} iTwinId={contextProps?.iTwinId ?? mockITwinId} {...contextProps}>
|
|
86
96
|
{children}
|
|
87
97
|
</ReportsConfigContext>
|
|
88
98
|
);
|
|
@@ -1,55 +1,36 @@
|
|
|
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
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
Widget,
|
|
8
|
-
} from "@itwin/appui-react";
|
|
9
|
-
import {
|
|
10
|
-
StagePanelLocation,
|
|
11
|
-
StagePanelSection,
|
|
12
|
-
StageUsage,
|
|
13
|
-
} from "@itwin/appui-react";
|
|
14
|
-
import type { AccessToken } from "@itwin/core-bentley";
|
|
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
|
+
import type { UiItemsProvider, Widget } from "@itwin/appui-react";
|
|
6
|
+
import { StagePanelLocation, StagePanelSection, StageUsage } from "@itwin/appui-react";
|
|
15
7
|
|
|
16
8
|
import * as React from "react";
|
|
17
9
|
import { ReportsConfigWidget } from "../ReportsConfigWidget";
|
|
10
|
+
import type { ReportsContainerProps } from "./components/ReportsContainer";
|
|
18
11
|
import ReportsContainer from "./components/ReportsContainer";
|
|
19
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
20
16
|
export const REPORTS_CONFIG_BASE_URL = "https://api.bentley.com";
|
|
21
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Reports Config Widget UI Provider
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
22
|
export class ReportsConfigProvider implements UiItemsProvider {
|
|
23
23
|
public readonly id = "ReportsConfigProvider";
|
|
24
|
-
private readonly _getAccessToken?: () => Promise<AccessToken>;
|
|
25
|
-
private readonly _baseUrl: string;
|
|
26
24
|
|
|
27
|
-
constructor(
|
|
28
|
-
getAccessToken?: () => Promise<AccessToken>,
|
|
29
|
-
baseUrl: string = REPORTS_CONFIG_BASE_URL
|
|
30
|
-
) {
|
|
31
|
-
this._getAccessToken = getAccessToken;
|
|
32
|
-
this._baseUrl = baseUrl;
|
|
33
|
-
}
|
|
25
|
+
constructor(private _props?: ReportsContainerProps) { }
|
|
34
26
|
|
|
35
|
-
public provideWidgets(
|
|
36
|
-
_stageId: string,
|
|
37
|
-
stageUsage: string,
|
|
38
|
-
location: StagePanelLocation,
|
|
39
|
-
section?: StagePanelSection
|
|
40
|
-
): ReadonlyArray<Widget> {
|
|
27
|
+
public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection): ReadonlyArray<Widget> {
|
|
41
28
|
const widgets: Widget[] = [];
|
|
42
|
-
if (
|
|
43
|
-
location === StagePanelLocation.Left &&
|
|
44
|
-
section === StagePanelSection.Start &&
|
|
45
|
-
stageUsage === StageUsage.General
|
|
46
|
-
) {
|
|
29
|
+
if (location === StagePanelLocation.Left && section === StagePanelSection.Start && stageUsage === StageUsage.General) {
|
|
47
30
|
const ReportsWidget: Widget = {
|
|
48
31
|
id: "reports-config-widget",
|
|
49
|
-
label: ReportsConfigWidget.localization.getLocalizedString(
|
|
50
|
-
|
|
51
|
-
),
|
|
52
|
-
content: <ReportsContainer getAccessToken={this._getAccessToken} baseUrl={this._baseUrl} />,
|
|
32
|
+
label: ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:ReportsConfig"),
|
|
33
|
+
content: <ReportsContainer {...this._props} />,
|
|
53
34
|
};
|
|
54
35
|
|
|
55
36
|
widgets.push(ReportsWidget);
|
|
@@ -28,23 +28,12 @@ const ActionPanel = ({
|
|
|
28
28
|
return (
|
|
29
29
|
<div className="rcw-action-panel">
|
|
30
30
|
{isLoading && <LoadingSpinner />}
|
|
31
|
-
<Button
|
|
32
|
-
disabled={isSavingDisabled || isLoading}
|
|
33
|
-
styleType="high-visibility"
|
|
34
|
-
onClick={onAction}
|
|
35
|
-
>
|
|
31
|
+
<Button disabled={isSavingDisabled || isLoading} styleType="high-visibility" onClick={onAction}>
|
|
36
32
|
{actionLabel}
|
|
37
33
|
</Button>
|
|
38
34
|
{onCancel && (
|
|
39
|
-
<Button
|
|
40
|
-
|
|
41
|
-
type="button"
|
|
42
|
-
onClick={onCancel}
|
|
43
|
-
disabled={isCancelDisabled || isLoading}
|
|
44
|
-
>
|
|
45
|
-
{ReportsConfigWidget.localization.getLocalizedString(
|
|
46
|
-
"ReportsConfigWidget:Cancel"
|
|
47
|
-
)}
|
|
35
|
+
<Button styleType="default" type="button" onClick={onCancel} disabled={isCancelDisabled || isLoading}>
|
|
36
|
+
{ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Cancel")}
|
|
48
37
|
</Button>
|
|
49
38
|
)}
|
|
50
39
|
</div>
|
|
@@ -1,10 +1,10 @@
|
|
|
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 { Modal, Table, tableFilters } from "@itwin/itwinui-react";
|
|
6
6
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
-
import type {
|
|
7
|
+
import type { IMappingsClient, Mapping } from "@itwin/insights-client";
|
|
8
8
|
import ActionPanel from "./ActionPanel";
|
|
9
9
|
import "./AddMappingsModal.scss";
|
|
10
10
|
import { LocalizedTablePaginator } from "./LocalizedTablePaginator";
|
|
@@ -23,17 +23,14 @@ const fetchMappings = async (
|
|
|
23
23
|
setMappings: (mappings: Mapping[]) => void,
|
|
24
24
|
iModelId: string,
|
|
25
25
|
setIsLoading: (isLoading: boolean) => void,
|
|
26
|
-
mappingsClient:
|
|
27
|
-
getAccessToken: () => Promise<AccessToken
|
|
26
|
+
mappingsClient: IMappingsClient,
|
|
27
|
+
getAccessToken: () => Promise<AccessToken>,
|
|
28
28
|
) => {
|
|
29
29
|
try {
|
|
30
30
|
setIsLoading(true);
|
|
31
31
|
const accessToken = await getAccessToken();
|
|
32
|
-
const mappings = await mappingsClient.getMappings(
|
|
33
|
-
|
|
34
|
-
iModelId
|
|
35
|
-
);
|
|
36
|
-
setMappings(mappings);
|
|
32
|
+
const mappings = await mappingsClient.getMappings(accessToken, iModelId);
|
|
33
|
+
setMappings(mappings.mappings);
|
|
37
34
|
} catch (error: any) {
|
|
38
35
|
handleError(error.status);
|
|
39
36
|
} finally {
|
|
@@ -49,13 +46,7 @@ export interface AddMappingsModalProps {
|
|
|
49
46
|
defaultIModelId?: string;
|
|
50
47
|
}
|
|
51
48
|
|
|
52
|
-
export const AddMappingsModal = ({
|
|
53
|
-
reportId,
|
|
54
|
-
existingMappings,
|
|
55
|
-
show,
|
|
56
|
-
onClose,
|
|
57
|
-
defaultIModelId,
|
|
58
|
-
}: AddMappingsModalProps) => {
|
|
49
|
+
export const AddMappingsModal = ({ reportId, existingMappings, show, onClose, defaultIModelId }: AddMappingsModalProps) => {
|
|
59
50
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
60
51
|
const selectedMappings = useRef<Mapping[]>([]);
|
|
61
52
|
const [selectedIModelId, setSelectediModelId] = useState<string | undefined>(defaultIModelId);
|
|
@@ -64,13 +55,7 @@ export const AddMappingsModal = ({
|
|
|
64
55
|
|
|
65
56
|
useEffect(() => {
|
|
66
57
|
if (selectedIModelId) {
|
|
67
|
-
void fetchMappings(
|
|
68
|
-
setMappings,
|
|
69
|
-
selectedIModelId,
|
|
70
|
-
setIsLoading,
|
|
71
|
-
mappingsClient,
|
|
72
|
-
getAccessToken
|
|
73
|
-
);
|
|
58
|
+
void fetchMappings(setMappings, selectedIModelId, setIsLoading, mappingsClient, getAccessToken);
|
|
74
59
|
}
|
|
75
60
|
}, [getAccessToken, mappingsClient, selectedIModelId, setIsLoading]);
|
|
76
61
|
|
|
@@ -78,21 +63,18 @@ export const AddMappingsModal = ({
|
|
|
78
63
|
(): Column<CreateTypeFromInterface<Mapping>>[] => [
|
|
79
64
|
{
|
|
80
65
|
id: "mappingName",
|
|
81
|
-
Header: ReportsConfigWidget.localization.getLocalizedString(
|
|
82
|
-
"ReportsConfigWidget:MappingName"
|
|
83
|
-
),
|
|
66
|
+
Header: ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:MappingName"),
|
|
84
67
|
accessor: "mappingName",
|
|
85
68
|
Filter: tableFilters.TextFilter(),
|
|
86
69
|
},
|
|
87
70
|
{
|
|
88
71
|
id: "description",
|
|
89
|
-
Header: ReportsConfigWidget.localization.getLocalizedString(
|
|
90
|
-
"ReportsConfigWidget:Description"
|
|
91
|
-
),
|
|
72
|
+
Header: ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Description"),
|
|
92
73
|
accessor: "description",
|
|
93
74
|
Filter: tableFilters.TextFilter(),
|
|
94
|
-
}
|
|
95
|
-
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
[],
|
|
96
78
|
);
|
|
97
79
|
|
|
98
80
|
const onSave = async () => {
|
|
@@ -119,15 +101,12 @@ export const AddMappingsModal = ({
|
|
|
119
101
|
if (selectData) selectedMappings.current = selectData;
|
|
120
102
|
}, []);
|
|
121
103
|
|
|
122
|
-
const tableData = useMemo(() => isLoading ? [] : mappings, [isLoading, mappings]);
|
|
123
|
-
const isRowDisabled = useCallback((rowData: MappingType) =>
|
|
124
|
-
existingMappings.some((v) => v.mappingId === rowData.id), [existingMappings]);
|
|
104
|
+
const tableData = useMemo(() => (isLoading ? [] : mappings), [isLoading, mappings]);
|
|
105
|
+
const isRowDisabled = useCallback((rowData: MappingType) => existingMappings.some((v) => v.mappingId === rowData.id), [existingMappings]);
|
|
125
106
|
|
|
126
107
|
return (
|
|
127
108
|
<Modal
|
|
128
|
-
title={ReportsConfigWidget.localization.getLocalizedString(
|
|
129
|
-
"ReportsConfigWidget:AddMappings"
|
|
130
|
-
)}
|
|
109
|
+
title={ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:AddMappings")}
|
|
131
110
|
isOpen={show}
|
|
132
111
|
isDismissible={!isLoading}
|
|
133
112
|
onClose={async () => {
|
|
@@ -136,17 +115,12 @@ export const AddMappingsModal = ({
|
|
|
136
115
|
style={{ display: "flex", flexDirection: "column", maxHeight: "77vh" }}
|
|
137
116
|
>
|
|
138
117
|
<div className="rcw-add-mappings-container">
|
|
139
|
-
<SelectIModel
|
|
140
|
-
selectedIModelId={selectedIModelId}
|
|
141
|
-
setSelectedIModelId={setSelectediModelId}
|
|
142
|
-
/>
|
|
118
|
+
<SelectIModel selectedIModelId={selectedIModelId} setSelectedIModelId={setSelectediModelId} />
|
|
143
119
|
<Table<MappingType>
|
|
144
120
|
data={tableData}
|
|
145
121
|
columns={mappingsColumns}
|
|
146
122
|
className="rcw-add-mappings-table"
|
|
147
|
-
emptyTableContent={ReportsConfigWidget.localization.getLocalizedString(
|
|
148
|
-
"ReportsConfigWidget:NoMappingsAvailable"
|
|
149
|
-
)}
|
|
123
|
+
emptyTableContent={ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:NoMappingsAvailable")}
|
|
150
124
|
isSortable
|
|
151
125
|
isSelectable
|
|
152
126
|
isLoading={isLoading}
|
|
@@ -156,13 +130,7 @@ export const AddMappingsModal = ({
|
|
|
156
130
|
/>
|
|
157
131
|
</div>
|
|
158
132
|
{/* Add button permanently enabled as a workaround to the warning stating that the table and parent component are being rendered at the same time. */}
|
|
159
|
-
<ActionPanel
|
|
160
|
-
actionLabel={ReportsConfigWidget.localization.getLocalizedString(
|
|
161
|
-
"ReportsConfigWidget:Add"
|
|
162
|
-
)}
|
|
163
|
-
onAction={onSave}
|
|
164
|
-
isLoading={isLoading}
|
|
165
|
-
/>
|
|
133
|
+
<ActionPanel actionLabel={ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Add")} onAction={onSave} isLoading={isLoading} />
|
|
166
134
|
</Modal>
|
|
167
135
|
);
|
|
168
136
|
};
|