@itwin/reports-config-widget-react 0.2.1 → 0.4.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/.rush/temp/operation/rebuild/all.log +9 -0
- package/.rush/temp/operation/rebuild/state.json +3 -0
- package/.rush/temp/package-deps_rebuild.json +48 -44
- package/.rush/temp/shrinkwrap-deps.json +228 -207
- package/CHANGELOG.json +44 -0
- package/CHANGELOG.md +24 -1
- package/coverage/clover.xml +562 -542
- package/coverage/coverage-final.json +24 -20
- package/coverage/lcov-report/index.html +51 -51
- package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +22 -22
- package/coverage/lcov-report/src/index.html +21 -21
- package/coverage/lcov-report/src/test/index.html +11 -11
- package/coverage/lcov-report/src/test/test-utils.tsx.html +20 -140
- package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +14 -35
- package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +26 -20
- package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +94 -109
- package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +55 -52
- package/coverage/lcov-report/src/widget/components/Constants.ts.html +1 -1
- package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +28 -46
- package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +1 -1
- package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +3 -3
- package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +8 -8
- package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +36 -81
- package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +38 -41
- package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +46 -46
- package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +127 -142
- package/coverage/lcov-report/src/widget/components/Reports.tsx.html +189 -312
- package/coverage/lcov-report/src/widget/components/ReportsConfigContext.tsx.html +370 -0
- package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +111 -33
- package/coverage/lcov-report/src/widget/components/ReportsHeader.tsx.html +166 -0
- package/coverage/lcov-report/src/widget/components/ReportsRouter.tsx.html +274 -0
- package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +22 -7
- package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +40 -94
- package/coverage/lcov-report/src/widget/components/index.html +142 -97
- package/coverage/lcov-report/src/widget/components/utils.tsx.html +22 -19
- package/coverage/lcov-report/src/widget/context/{ReportsApiConfigContext.tsx.html → BulkExtractorContext.tsx.html} +23 -26
- package/coverage/lcov-report/src/widget/context/ReportsConfigApiContext.tsx.html +202 -0
- package/coverage/lcov-report/src/widget/context/index.html +30 -15
- package/coverage/lcov-report/src/widget/hooks/index.html +1 -1
- package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +11 -11
- package/coverage/lcov-report/src/widget/index.html +13 -13
- package/coverage/lcov.info +1036 -1034
- package/jest.config.js +1 -0
- package/lib/cjs/ReportsConfigWidget.js +1 -1
- package/lib/cjs/ReportsConfigWidget.js.map +1 -1
- package/lib/cjs/reports-config-widget-react.d.ts +5 -0
- package/lib/cjs/reports-config-widget-react.d.ts.map +1 -1
- package/lib/cjs/reports-config-widget-react.js +11 -0
- package/lib/cjs/reports-config-widget-react.js.map +1 -1
- package/lib/cjs/test/AddMappingModal.test.js +20 -34
- package/lib/cjs/test/AddMappingModal.test.js.map +1 -1
- package/lib/cjs/test/BulkExtractor.test.js +13 -19
- package/lib/cjs/test/BulkExtractor.test.js.map +1 -1
- package/lib/cjs/test/DeleteModal.test.d.ts.map +1 -1
- package/lib/cjs/test/DeleteModal.test.js +4 -62
- package/lib/cjs/test/DeleteModal.test.js.map +1 -1
- package/lib/cjs/test/ReportAction.test.js +14 -79
- package/lib/cjs/test/ReportAction.test.js.map +1 -1
- package/lib/cjs/test/ReportMappingHorizontalTile.test.js +20 -54
- package/lib/cjs/test/ReportMappingHorizontalTile.test.js.map +1 -1
- package/lib/cjs/test/ReportMappings.test.d.ts.map +1 -1
- package/lib/cjs/test/ReportMappings.test.js +51 -106
- package/lib/cjs/test/ReportMappings.test.js.map +1 -1
- package/lib/cjs/test/Reports.test.js +41 -96
- package/lib/cjs/test/Reports.test.js.map +1 -1
- package/lib/cjs/test/WidgetHeader.test.js +9 -3
- package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
- package/lib/cjs/test/test-utils.d.ts +3 -8
- package/lib/cjs/test/test-utils.d.ts.map +1 -1
- package/lib/cjs/test/test-utils.js +6 -34
- package/lib/cjs/test/test-utils.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/widget/ReportsConfigUiProvider.d.ts +3 -3
- package/lib/cjs/widget/ReportsConfigUiProvider.d.ts.map +1 -1
- package/lib/cjs/widget/ReportsConfigUiProvider.js +5 -7
- package/lib/cjs/widget/ReportsConfigUiProvider.js.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.d.ts +3 -3
- package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.js +4 -4
- package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.scss +2 -3
- package/lib/cjs/widget/components/AddMappingsModal.d.ts +4 -4
- package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.js +39 -43
- package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.scss +1 -2
- package/lib/cjs/widget/components/BulkExtractor.d.ts +4 -4
- package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -1
- package/lib/cjs/widget/components/BulkExtractor.js +8 -8
- package/lib/cjs/widget/components/BulkExtractor.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.d.ts +4 -5
- package/lib/cjs/widget/components/DeleteModal.d.ts.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.js +11 -15
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.scss +2 -3
- package/lib/cjs/widget/components/ExtractionStatus.js +2 -2
- package/lib/cjs/widget/components/ExtractionStatus.js.map +1 -1
- package/lib/cjs/widget/components/ExtractionStatus.scss +6 -7
- package/lib/cjs/widget/components/HorizontalTile.js +2 -2
- package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.scss +11 -14
- package/lib/cjs/widget/components/LocalizedTablePaginator.js +2 -2
- package/lib/cjs/widget/components/LocalizedTablePaginator.js.map +1 -1
- package/lib/cjs/widget/components/ReportAction.d.ts +4 -5
- package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportAction.js +24 -26
- package/lib/cjs/widget/components/ReportAction.js.map +1 -1
- package/lib/cjs/widget/components/ReportAction.scss +1 -2
- package/lib/cjs/widget/components/ReportHorizontalTile.d.ts +4 -4
- package/lib/cjs/widget/components/ReportHorizontalTile.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportHorizontalTile.js +33 -20
- package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts +1 -1
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.js +36 -21
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.d.ts +4 -6
- package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.js +50 -63
- package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.scss +10 -11
- package/lib/cjs/widget/components/Reports.d.ts +6 -1
- package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
- package/lib/cjs/widget/components/Reports.js +53 -94
- package/lib/cjs/widget/components/Reports.js.map +1 -1
- package/lib/cjs/widget/components/Reports.scss +15 -15
- package/lib/cjs/widget/components/ReportsConfigContext.d.ts +18 -0
- package/lib/cjs/widget/components/ReportsConfigContext.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportsConfigContext.js +79 -0
- package/lib/cjs/widget/components/ReportsConfigContext.js.map +1 -0
- package/lib/cjs/widget/components/ReportsContainer.d.ts +14 -0
- package/lib/cjs/widget/components/ReportsContainer.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportsContainer.js +27 -16
- package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
- package/lib/cjs/widget/components/ReportsContainer.scss +1 -3
- package/lib/cjs/widget/components/ReportsHeader.d.ts +7 -0
- package/lib/cjs/widget/components/ReportsHeader.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportsHeader.js +20 -0
- package/lib/cjs/widget/components/ReportsHeader.js.map +1 -0
- package/lib/cjs/widget/components/ReportsRouter.d.ts +8 -0
- package/lib/cjs/widget/components/ReportsRouter.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportsRouter.js +51 -0
- package/lib/cjs/widget/components/ReportsRouter.js.map +1 -0
- package/lib/cjs/widget/components/SearchBar.d.ts.map +1 -1
- package/lib/cjs/widget/components/SearchBar.js +4 -5
- package/lib/cjs/widget/components/SearchBar.js.map +1 -1
- package/lib/cjs/widget/components/SearchBar.scss +1 -2
- package/lib/cjs/widget/components/SelectIModel.d.ts +3 -3
- package/lib/cjs/widget/components/SelectIModel.d.ts.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.js +10 -30
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.scss +2 -3
- 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 +1 -1
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/components/utils.scss +16 -8
- package/lib/cjs/widget/context/BulkExtractorContext.d.ts +10 -0
- package/lib/cjs/widget/context/BulkExtractorContext.d.ts.map +1 -0
- package/lib/cjs/widget/context/{ReportsApiConfigContext.js → BulkExtractorContext.js} +7 -10
- package/lib/cjs/widget/context/BulkExtractorContext.js.map +1 -0
- package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts +16 -0
- package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts.map +1 -0
- package/lib/cjs/widget/context/ReportsConfigApiContext.js +43 -0
- package/lib/cjs/widget/context/ReportsConfigApiContext.js.map +1 -0
- package/lib/cjs/widget/hooks/useValidator.js +1 -1
- package/lib/cjs/widget/hooks/useValidator.js.map +1 -1
- package/lib/esm/ReportsConfigWidget.js +1 -1
- package/lib/esm/ReportsConfigWidget.js.map +1 -1
- package/lib/esm/reports-config-widget-react.d.ts +5 -0
- package/lib/esm/reports-config-widget-react.d.ts.map +1 -1
- package/lib/esm/reports-config-widget-react.js +5 -0
- package/lib/esm/reports-config-widget-react.js.map +1 -1
- package/lib/esm/test/AddMappingModal.test.js +17 -31
- package/lib/esm/test/AddMappingModal.test.js.map +1 -1
- package/lib/esm/test/BulkExtractor.test.js +14 -17
- package/lib/esm/test/BulkExtractor.test.js.map +1 -1
- package/lib/esm/test/DeleteModal.test.d.ts.map +1 -1
- package/lib/esm/test/DeleteModal.test.js +5 -44
- package/lib/esm/test/DeleteModal.test.js.map +1 -1
- package/lib/esm/test/ReportAction.test.js +14 -60
- package/lib/esm/test/ReportAction.test.js.map +1 -1
- package/lib/esm/test/ReportMappingHorizontalTile.test.js +4 -38
- package/lib/esm/test/ReportMappingHorizontalTile.test.js.map +1 -1
- package/lib/esm/test/ReportMappings.test.d.ts.map +1 -1
- package/lib/esm/test/ReportMappings.test.js +43 -98
- package/lib/esm/test/ReportMappings.test.js.map +1 -1
- package/lib/esm/test/Reports.test.js +24 -60
- package/lib/esm/test/Reports.test.js.map +1 -1
- package/lib/esm/test/WidgetHeader.test.js +8 -2
- package/lib/esm/test/WidgetHeader.test.js.map +1 -1
- package/lib/esm/test/test-utils.d.ts +3 -8
- package/lib/esm/test/test-utils.d.ts.map +1 -1
- package/lib/esm/test/test-utils.js +4 -31
- package/lib/esm/test/test-utils.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/widget/ReportsConfigUiProvider.d.ts +3 -3
- package/lib/esm/widget/ReportsConfigUiProvider.d.ts.map +1 -1
- package/lib/esm/widget/ReportsConfigUiProvider.js +2 -4
- package/lib/esm/widget/ReportsConfigUiProvider.js.map +1 -1
- package/lib/esm/widget/components/ActionPanel.d.ts +3 -3
- package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -1
- package/lib/esm/widget/components/ActionPanel.js +4 -4
- package/lib/esm/widget/components/ActionPanel.js.map +1 -1
- package/lib/esm/widget/components/ActionPanel.scss +2 -3
- package/lib/esm/widget/components/AddMappingsModal.d.ts +4 -4
- package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.js +35 -39
- package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.scss +1 -2
- package/lib/esm/widget/components/BulkExtractor.d.ts +4 -4
- package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -1
- package/lib/esm/widget/components/BulkExtractor.js +7 -8
- package/lib/esm/widget/components/BulkExtractor.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.d.ts +4 -5
- package/lib/esm/widget/components/DeleteModal.d.ts.map +1 -1
- package/lib/esm/widget/components/DeleteModal.js +11 -15
- package/lib/esm/widget/components/DeleteModal.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.scss +2 -3
- package/lib/esm/widget/components/ExtractionStatus.scss +6 -7
- package/lib/esm/widget/components/HorizontalTile.scss +11 -14
- package/lib/esm/widget/components/ReportAction.d.ts +4 -5
- package/lib/esm/widget/components/ReportAction.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportAction.js +17 -21
- package/lib/esm/widget/components/ReportAction.js.map +1 -1
- package/lib/esm/widget/components/ReportAction.scss +1 -2
- package/lib/esm/widget/components/ReportHorizontalTile.d.ts +4 -4
- package/lib/esm/widget/components/ReportHorizontalTile.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportHorizontalTile.js +6 -9
- package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts +1 -1
- package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportMappingHorizontalTile.js +12 -13
- package/lib/esm/widget/components/ReportMappingHorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/ReportMappings.d.ts +4 -6
- package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportMappings.js +43 -56
- package/lib/esm/widget/components/ReportMappings.js.map +1 -1
- package/lib/esm/widget/components/ReportMappings.scss +10 -11
- package/lib/esm/widget/components/Reports.d.ts +6 -1
- package/lib/esm/widget/components/Reports.d.ts.map +1 -1
- package/lib/esm/widget/components/Reports.js +46 -87
- package/lib/esm/widget/components/Reports.js.map +1 -1
- package/lib/esm/widget/components/Reports.scss +15 -15
- package/lib/esm/widget/components/ReportsConfigContext.d.ts +18 -0
- package/lib/esm/widget/components/ReportsConfigContext.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportsConfigContext.js +56 -0
- package/lib/esm/widget/components/ReportsConfigContext.js.map +1 -0
- package/lib/esm/widget/components/ReportsContainer.d.ts +14 -0
- package/lib/esm/widget/components/ReportsContainer.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportsContainer.js +27 -17
- package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
- package/lib/esm/widget/components/ReportsContainer.scss +1 -3
- package/lib/esm/widget/components/ReportsHeader.d.ts +7 -0
- package/lib/esm/widget/components/ReportsHeader.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportsHeader.js +13 -0
- package/lib/esm/widget/components/ReportsHeader.js.map +1 -0
- package/lib/esm/widget/components/ReportsRouter.d.ts +8 -0
- package/lib/esm/widget/components/ReportsRouter.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportsRouter.js +44 -0
- package/lib/esm/widget/components/ReportsRouter.js.map +1 -0
- package/lib/esm/widget/components/SearchBar.d.ts.map +1 -1
- package/lib/esm/widget/components/SearchBar.js +2 -3
- package/lib/esm/widget/components/SearchBar.js.map +1 -1
- package/lib/esm/widget/components/SearchBar.scss +1 -2
- package/lib/esm/widget/components/SelectIModel.d.ts +3 -3
- package/lib/esm/widget/components/SelectIModel.d.ts.map +1 -1
- package/lib/esm/widget/components/SelectIModel.js +7 -27
- package/lib/esm/widget/components/SelectIModel.js.map +1 -1
- package/lib/esm/widget/components/SelectIModel.scss +2 -3
- 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 +2 -2
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +16 -8
- package/lib/esm/widget/context/BulkExtractorContext.d.ts +10 -0
- package/lib/esm/widget/context/BulkExtractorContext.d.ts.map +1 -0
- package/lib/esm/widget/context/BulkExtractorContext.js +11 -0
- package/lib/esm/widget/context/BulkExtractorContext.js.map +1 -0
- package/lib/esm/widget/context/ReportsConfigApiContext.d.ts +16 -0
- package/lib/esm/widget/context/ReportsConfigApiContext.d.ts.map +1 -0
- package/lib/esm/widget/context/ReportsConfigApiContext.js +20 -0
- package/lib/esm/widget/context/ReportsConfigApiContext.js.map +1 -0
- package/lib/public/locales/en/ReportsConfigWidget.json +6 -1
- package/package.json +29 -29
- package/public/locales/en/ReportsConfigWidget.json +6 -1
- package/reports-config-widget-react.build.error.log +6 -6
- package/reports-config-widget-react.build.log +52 -49
- package/src/reports-config-widget-react.ts +6 -0
- package/src/test/AddMappingModal.test.tsx +20 -37
- package/src/test/BulkExtractor.test.ts +15 -17
- package/src/test/DeleteModal.test.tsx +4 -73
- package/src/test/ReportAction.test.tsx +17 -90
- package/src/test/ReportMappingHorizontalTile.test.tsx +3 -54
- package/src/test/ReportMappings.test.tsx +50 -135
- package/src/test/Reports.test.tsx +21 -80
- package/src/test/WidgetHeader.test.tsx +9 -2
- package/src/test/test-utils.tsx +9 -49
- package/src/widget/ReportsConfigUiProvider.tsx +7 -14
- package/src/widget/components/ActionPanel.scss +2 -3
- package/src/widget/components/ActionPanel.tsx +17 -15
- package/src/widget/components/AddMappingsModal.scss +1 -2
- package/src/widget/components/AddMappingsModal.tsx +55 -60
- package/src/widget/components/BulkExtractor.ts +11 -10
- package/src/widget/components/DeleteModal.scss +2 -3
- package/src/widget/components/DeleteModal.tsx +17 -23
- package/src/widget/components/ExtractionStatus.scss +6 -7
- package/src/widget/components/HorizontalTile.scss +11 -14
- package/src/widget/components/ReportAction.scss +1 -2
- package/src/widget/components/ReportAction.tsx +18 -33
- package/src/widget/components/ReportHorizontalTile.tsx +11 -12
- package/src/widget/components/ReportMappingHorizontalTile.tsx +30 -30
- package/src/widget/components/ReportMappings.scss +10 -11
- package/src/widget/components/ReportMappings.tsx +67 -72
- package/src/widget/components/Reports.scss +15 -15
- package/src/widget/components/Reports.tsx +140 -181
- package/src/widget/components/ReportsConfigContext.tsx +95 -0
- package/src/widget/components/ReportsContainer.scss +1 -3
- package/src/widget/components/ReportsContainer.tsx +47 -21
- package/src/widget/components/ReportsHeader.tsx +27 -0
- package/src/widget/components/ReportsRouter.tsx +63 -0
- package/src/widget/components/SearchBar.scss +1 -2
- package/src/widget/components/SearchBar.tsx +7 -2
- package/src/widget/components/SelectIModel.scss +2 -3
- package/src/widget/components/SelectIModel.tsx +11 -29
- package/src/widget/components/utils.scss +16 -8
- package/src/widget/components/utils.tsx +8 -7
- package/src/widget/context/{ReportsApiConfigContext.tsx → BulkExtractorContext.tsx} +9 -10
- package/src/widget/context/ReportsConfigApiContext.tsx +39 -0
- package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts +0 -9
- package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts.map +0 -1
- package/lib/cjs/widget/context/ReportsApiConfigContext.js.map +0 -1
- package/lib/esm/widget/context/ReportsApiConfigContext.d.ts +0 -9
- package/lib/esm/widget/context/ReportsApiConfigContext.d.ts.map +0 -1
- package/lib/esm/widget/context/ReportsApiConfigContext.js +0 -14
- package/lib/esm/widget/context/ReportsApiConfigContext.js.map +0 -1
|
@@ -2,39 +2,39 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
5
|
|
|
7
6
|
.rcw-reports-list-container {
|
|
8
7
|
display: flex;
|
|
9
8
|
flex-direction: column;
|
|
10
9
|
flex-grow: 1;
|
|
11
|
-
padding: $iui-baseline $iui-m;
|
|
12
10
|
min-height: 0;
|
|
13
11
|
|
|
14
12
|
.rcw-toolbar {
|
|
15
13
|
display: flex;
|
|
16
14
|
justify-content: space-between;
|
|
17
|
-
gap:
|
|
18
|
-
border-bottom: 1px solid var(--iui-color-
|
|
19
|
-
padding-bottom:
|
|
15
|
+
gap: var(--iui-size-xs);
|
|
16
|
+
border-bottom: 1px solid var(--iui-color-border-subtle);
|
|
17
|
+
padding-bottom: var(--iui-size-s);
|
|
20
18
|
flex-wrap: wrap;
|
|
21
|
-
}
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
.rcw-search-bar-container {
|
|
21
|
+
flex-shrink: 1;
|
|
22
|
+
flex-grow: 0;
|
|
23
|
+
display: flex;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.rcw-button-spacing {
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: var(--iui-size-xs);
|
|
29
|
+
}
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
.rcw-reports-list {
|
|
30
33
|
display: flex;
|
|
31
34
|
flex-direction: column;
|
|
32
35
|
overflow-y: overlay;
|
|
33
|
-
gap:
|
|
34
|
-
margin-top:
|
|
36
|
+
gap: var(--iui-size-xs);
|
|
37
|
+
margin-top: var(--iui-size-xs);
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
.rcw-button-container {
|
|
39
|
-
display: flex;
|
|
40
|
-
}
|
|
@@ -1,65 +1,41 @@
|
|
|
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 {
|
|
6
|
-
|
|
7
|
-
SvgPlay,
|
|
8
|
-
} from "@itwin/itwinui-icons-react";
|
|
9
|
-
import {
|
|
10
|
-
Button,
|
|
11
|
-
IconButton,
|
|
12
|
-
Surface,
|
|
13
|
-
toaster,
|
|
14
|
-
} from "@itwin/itwinui-react";
|
|
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 { SvgAdd, SvgPlay, SvgRefresh } from "@itwin/itwinui-icons-react";
|
|
6
|
+
import { Button, IconButton } from "@itwin/itwinui-react";
|
|
15
7
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
16
8
|
import type { CreateTypeFromInterface } from "./utils";
|
|
17
9
|
import {
|
|
18
10
|
EmptyMessage,
|
|
19
|
-
generateUrl,
|
|
20
11
|
handleError,
|
|
21
12
|
LoadingOverlay,
|
|
22
|
-
WidgetHeader,
|
|
23
13
|
} from "./utils";
|
|
24
14
|
import "./Reports.scss";
|
|
25
15
|
import DeleteModal from "./DeleteModal";
|
|
26
|
-
import type { Report } from "@itwin/insights-client";
|
|
27
|
-
import { REPORTING_BASE_PATH, ReportsClient } from "@itwin/insights-client";
|
|
28
|
-
import ReportAction from "./ReportAction";
|
|
29
|
-
import { ReportMappings } from "./ReportMappings";
|
|
16
|
+
import type { Report, ReportsClient } from "@itwin/insights-client";
|
|
30
17
|
import { ReportHorizontalTile } from "./ReportHorizontalTile";
|
|
31
18
|
import { SearchBar } from "./SearchBar";
|
|
32
|
-
import
|
|
33
|
-
import { useReportsApiConfig } from "../context/ReportsApiConfigContext";
|
|
19
|
+
import { useReportsConfigApi } from "../context/ReportsConfigApiContext";
|
|
34
20
|
import { ReportsConfigWidget } from "../../ReportsConfigWidget";
|
|
35
|
-
import {
|
|
36
|
-
import BulkExtractor from "./BulkExtractor";
|
|
21
|
+
import type { AccessToken } from "@itwin/core-bentley";
|
|
37
22
|
import { BeEvent } from "@itwin/core-bentley";
|
|
38
|
-
import {
|
|
23
|
+
import { useBulkExtractor } from "../context/BulkExtractorContext";
|
|
39
24
|
|
|
40
25
|
export type ReportType = CreateTypeFromInterface<Report>;
|
|
41
26
|
|
|
42
|
-
enum ReportsView {
|
|
43
|
-
REPORTS = "reports",
|
|
44
|
-
REPORTSMAPPING = "reportsmapping",
|
|
45
|
-
ADDING = "adding",
|
|
46
|
-
MODIFYING = "modifying",
|
|
47
|
-
}
|
|
48
|
-
|
|
49
27
|
const fetchReports = async (
|
|
50
|
-
setReports:
|
|
28
|
+
setReports: (reports: Report[]) => void,
|
|
51
29
|
iTwinId: string | undefined,
|
|
52
|
-
setIsLoading:
|
|
53
|
-
|
|
30
|
+
setIsLoading: (isLoading: boolean) => void,
|
|
31
|
+
reportsClient: ReportsClient,
|
|
32
|
+
getAccessToken: () => Promise<AccessToken>
|
|
54
33
|
) => {
|
|
55
34
|
try {
|
|
56
35
|
if (!iTwinId) return;
|
|
57
36
|
setIsLoading(true);
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
);
|
|
61
|
-
const accessToken = await apiContext.getAccessToken();
|
|
62
|
-
const reports = await reportsClientApi.getReports(accessToken, iTwinId);
|
|
37
|
+
const accessToken = await getAccessToken();
|
|
38
|
+
const reports = await reportsClient.getReports(accessToken, iTwinId);
|
|
63
39
|
setReports(reports ?? []);
|
|
64
40
|
} catch (error: any) {
|
|
65
41
|
handleError(error.status);
|
|
@@ -68,50 +44,50 @@ const fetchReports = async (
|
|
|
68
44
|
}
|
|
69
45
|
};
|
|
70
46
|
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const failedExtractionToast = (iModelName: string) => {
|
|
77
|
-
toaster.negative(<FailedExtractionToast iModelName={iModelName} />);
|
|
78
|
-
};
|
|
47
|
+
export interface ReportsProps {
|
|
48
|
+
onClickAddReport?: () => void;
|
|
49
|
+
onClickReportTitle?: (report: Report) => void;
|
|
50
|
+
onClickReportModify?: (report: Report) => void;
|
|
51
|
+
}
|
|
79
52
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
);
|
|
87
|
-
const [
|
|
53
|
+
export const Reports = ({
|
|
54
|
+
onClickAddReport,
|
|
55
|
+
onClickReportModify,
|
|
56
|
+
onClickReportTitle,
|
|
57
|
+
}: ReportsProps) => {
|
|
58
|
+
const { iTwinId, getAccessToken, reportsClient } = useReportsConfigApi();
|
|
59
|
+
const { bulkExtractor } = useBulkExtractor();
|
|
60
|
+
const [showDeleteModal, setShowDeleteModal] = useState<Report | undefined>(
|
|
88
61
|
undefined
|
|
89
62
|
);
|
|
63
|
+
const [selectedReportIds, setSelectedReportIds] = useState<string[]>([]);
|
|
90
64
|
const [isLoading, setIsLoading] = useState<boolean>(true);
|
|
91
65
|
const [searchValue, setSearchValue] = useState<string>("");
|
|
92
66
|
const [reports, setReports] = useState<Report[]>([]);
|
|
93
|
-
const bulkExtractor = useMemo(
|
|
94
|
-
() => new BulkExtractor(apiConfig, successfulExtractionToast, failedExtractionToast),
|
|
95
|
-
[apiConfig]
|
|
96
|
-
);
|
|
97
67
|
const jobStartEvent = useMemo(
|
|
98
68
|
() => new BeEvent<(reportId: string) => void>(),
|
|
99
69
|
[]
|
|
100
70
|
);
|
|
101
71
|
|
|
102
72
|
useEffect(() => {
|
|
103
|
-
void fetchReports(
|
|
104
|
-
|
|
73
|
+
void fetchReports(
|
|
74
|
+
setReports,
|
|
75
|
+
iTwinId,
|
|
76
|
+
setIsLoading,
|
|
77
|
+
reportsClient,
|
|
78
|
+
getAccessToken
|
|
79
|
+
);
|
|
80
|
+
}, [getAccessToken, iTwinId, reportsClient, setIsLoading]);
|
|
105
81
|
|
|
106
82
|
const refresh = useCallback(async () => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
};
|
|
83
|
+
await fetchReports(
|
|
84
|
+
setReports,
|
|
85
|
+
iTwinId,
|
|
86
|
+
setIsLoading,
|
|
87
|
+
reportsClient,
|
|
88
|
+
getAccessToken
|
|
89
|
+
);
|
|
90
|
+
}, [getAccessToken, iTwinId, reportsClient]);
|
|
115
91
|
|
|
116
92
|
const filteredReports = useMemo(
|
|
117
93
|
() =>
|
|
@@ -125,140 +101,123 @@ export const Reports = () => {
|
|
|
125
101
|
);
|
|
126
102
|
|
|
127
103
|
const onSelectionChange = (reportId: string, control: boolean) => {
|
|
128
|
-
if (!control)
|
|
129
|
-
setSelectedReportIds([]);
|
|
104
|
+
if (!control) setSelectedReportIds([]);
|
|
130
105
|
|
|
131
106
|
setSelectedReportIds((sr) =>
|
|
132
107
|
sr.some((r) => reportId === r)
|
|
133
|
-
? sr.filter(
|
|
134
|
-
(r) => reportId !== r
|
|
135
|
-
)
|
|
108
|
+
? sr.filter((r) => reportId !== r)
|
|
136
109
|
: [...sr, reportId]
|
|
137
110
|
);
|
|
138
111
|
};
|
|
139
112
|
|
|
140
113
|
const updateDatasets = useCallback(async () => {
|
|
114
|
+
if (!bulkExtractor) return;
|
|
141
115
|
await bulkExtractor.runReportExtractions(selectedReportIds);
|
|
142
116
|
selectedReportIds.map((reportId) => jobStartEvent.raiseEvent(reportId));
|
|
143
117
|
setSelectedReportIds([]);
|
|
144
118
|
}, [selectedReportIds, jobStartEvent, bulkExtractor]);
|
|
145
119
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
iTwinId={iTwinId}
|
|
155
|
-
report={selectedReport}
|
|
156
|
-
returnFn={refresh}
|
|
157
|
-
/>
|
|
158
|
-
) : null;
|
|
159
|
-
case ReportsView.REPORTSMAPPING:
|
|
160
|
-
return selectedReport ? (
|
|
161
|
-
<ReportMappings report={selectedReport} bulkExtractor={bulkExtractor} goBack={refresh} />
|
|
162
|
-
) : null;
|
|
163
|
-
default:
|
|
164
|
-
return (
|
|
165
|
-
<>
|
|
166
|
-
<WidgetHeader
|
|
167
|
-
title={ReportsConfigWidget.localization.getLocalizedString(
|
|
168
|
-
"ReportsConfigWidget:ITwinReports"
|
|
169
|
-
)}
|
|
170
|
-
/>
|
|
171
|
-
<Surface className="rcw-reports-list-container">
|
|
172
|
-
<div className="rcw-toolbar">
|
|
120
|
+
if (!bulkExtractor) return null;
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<>
|
|
124
|
+
<div className="rcw-reports-list-container">
|
|
125
|
+
<div className="rcw-toolbar">
|
|
126
|
+
<div className="rcw-button-spacing">
|
|
127
|
+
{onClickAddReport && (
|
|
173
128
|
<Button
|
|
174
129
|
startIcon={<SvgAdd />}
|
|
175
|
-
onClick={
|
|
130
|
+
onClick={onClickAddReport}
|
|
176
131
|
styleType="high-visibility"
|
|
132
|
+
title="New Report"
|
|
177
133
|
>
|
|
178
134
|
{ReportsConfigWidget.localization.getLocalizedString(
|
|
179
135
|
"ReportsConfigWidget:New"
|
|
180
136
|
)}
|
|
181
137
|
</Button>
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
138
|
+
)}
|
|
139
|
+
<IconButton
|
|
140
|
+
title={ReportsConfigWidget.localization.getLocalizedString(
|
|
141
|
+
"ReportsConfigWidget:UpdateDatasets"
|
|
142
|
+
)}
|
|
143
|
+
onClick={updateDatasets}
|
|
144
|
+
disabled={selectedReportIds.length === 0}
|
|
145
|
+
>
|
|
146
|
+
<SvgPlay />
|
|
147
|
+
</IconButton>
|
|
148
|
+
</div>
|
|
149
|
+
<div
|
|
150
|
+
className="rcw-search-bar-container"
|
|
151
|
+
data-testid="rcw-search-bar"
|
|
152
|
+
>
|
|
153
|
+
<IconButton
|
|
154
|
+
title={ReportsConfigWidget.localization.getLocalizedString(
|
|
155
|
+
"ReportsConfigWidget:Refresh"
|
|
156
|
+
)}
|
|
157
|
+
onClick={refresh}
|
|
158
|
+
disabled={isLoading}
|
|
159
|
+
styleType="borderless"
|
|
160
|
+
>
|
|
161
|
+
<SvgRefresh />
|
|
162
|
+
</IconButton>
|
|
163
|
+
<SearchBar
|
|
164
|
+
searchValue={searchValue}
|
|
165
|
+
setSearchValue={setSearchValue}
|
|
166
|
+
disabled={isLoading}
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
{isLoading ? (
|
|
171
|
+
<LoadingOverlay />
|
|
172
|
+
) : reports.length === 0 && onClickAddReport ? (
|
|
173
|
+
<EmptyMessage>
|
|
174
|
+
<>
|
|
175
|
+
{ReportsConfigWidget.localization.getLocalizedString(
|
|
176
|
+
"ReportsConfigWidget:NoReports"
|
|
177
|
+
)}
|
|
178
|
+
<div>
|
|
179
|
+
<Button onClick={onClickAddReport} styleType="cta">
|
|
206
180
|
{ReportsConfigWidget.localization.getLocalizedString(
|
|
207
|
-
"ReportsConfigWidget:
|
|
181
|
+
"ReportsConfigWidget:CreateOneReportCTA"
|
|
208
182
|
)}
|
|
209
|
-
|
|
210
|
-
<Button onClick={addReport} styleType="cta">
|
|
211
|
-
{ReportsConfigWidget.localization.getLocalizedString(
|
|
212
|
-
"ReportsConfigWidget:CreateOneReportCTA"
|
|
213
|
-
)}
|
|
214
|
-
</Button>
|
|
215
|
-
</div>
|
|
216
|
-
</>
|
|
217
|
-
</EmptyMessage>
|
|
218
|
-
) : (
|
|
219
|
-
<div className="rcw-reports-list">
|
|
220
|
-
{filteredReports.map((report) => (
|
|
221
|
-
<ReportHorizontalTile
|
|
222
|
-
key={report.id}
|
|
223
|
-
report={report}
|
|
224
|
-
onClickTitle={() => {
|
|
225
|
-
setSelectedReport(report);
|
|
226
|
-
setReportsView(ReportsView.REPORTSMAPPING);
|
|
227
|
-
}}
|
|
228
|
-
jobStartEvent={jobStartEvent}
|
|
229
|
-
bulkExtractor={bulkExtractor}
|
|
230
|
-
onClickDelete={() => {
|
|
231
|
-
setSelectedReport(report);
|
|
232
|
-
setShowDeleteModal(true);
|
|
233
|
-
}}
|
|
234
|
-
onClickModify={() => {
|
|
235
|
-
setSelectedReport(report);
|
|
236
|
-
setReportsView(ReportsView.MODIFYING);
|
|
237
|
-
}}
|
|
238
|
-
onSelectionChange={onSelectionChange}
|
|
239
|
-
selected={selectedReportIds.some((reportId) => report.id === reportId)}
|
|
240
|
-
/>
|
|
241
|
-
))}
|
|
183
|
+
</Button>
|
|
242
184
|
</div>
|
|
243
|
-
|
|
244
|
-
</
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
185
|
+
</>
|
|
186
|
+
</EmptyMessage>
|
|
187
|
+
) : (
|
|
188
|
+
<div className="rcw-reports-list">
|
|
189
|
+
{filteredReports.map((report) => (
|
|
190
|
+
<ReportHorizontalTile
|
|
191
|
+
key={report.id}
|
|
192
|
+
report={report}
|
|
193
|
+
onClickTitle={onClickReportTitle}
|
|
194
|
+
jobStartEvent={jobStartEvent}
|
|
195
|
+
bulkExtractor={bulkExtractor}
|
|
196
|
+
onClickDelete={() => {
|
|
197
|
+
setShowDeleteModal(report);
|
|
198
|
+
}}
|
|
199
|
+
onClickModify={onClickReportModify}
|
|
200
|
+
onSelectionChange={onSelectionChange}
|
|
201
|
+
selected={selectedReportIds.some(
|
|
202
|
+
(reportId) => report.id === reportId
|
|
203
|
+
)}
|
|
204
|
+
/>
|
|
205
|
+
))}
|
|
206
|
+
</div>
|
|
207
|
+
)}
|
|
208
|
+
</div>
|
|
209
|
+
<DeleteModal
|
|
210
|
+
entityName={showDeleteModal?.displayName}
|
|
211
|
+
onClose={() => setShowDeleteModal(undefined)}
|
|
212
|
+
onDelete={async () => {
|
|
213
|
+
const accessToken = await getAccessToken();
|
|
214
|
+
await reportsClient.deleteReport(
|
|
215
|
+
accessToken,
|
|
216
|
+
showDeleteModal?.id ?? ""
|
|
217
|
+
);
|
|
218
|
+
}}
|
|
219
|
+
refresh={refresh}
|
|
220
|
+
/>
|
|
221
|
+
</>
|
|
222
|
+
);
|
|
264
223
|
};
|
|
@@ -0,0 +1,95 @@
|
|
|
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 { IModelApp } from "@itwin/core-frontend";
|
|
6
|
+
import type { IModelsClientOptions } from "@itwin/imodels-client-management";
|
|
7
|
+
import { Constants, IModelsClient } from "@itwin/imodels-client-management";
|
|
8
|
+
import { ExtractionClient, MappingsClient, REPORTING_BASE_PATH, ReportsClient } from "@itwin/insights-client";
|
|
9
|
+
import { toaster } from "@itwin/itwinui-react";
|
|
10
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
11
|
+
import { BulkExtractorContext } from "../context/BulkExtractorContext";
|
|
12
|
+
import type {
|
|
13
|
+
GetAccessTokenFn,
|
|
14
|
+
ReportsConfigApiProps,
|
|
15
|
+
} from "../context/ReportsConfigApiContext";
|
|
16
|
+
import { ReportsConfigApiContext } from "../context/ReportsConfigApiContext";
|
|
17
|
+
import { REPORTS_CONFIG_BASE_URL } from "../ReportsConfigUiProvider";
|
|
18
|
+
import { BulkExtractor } from "./BulkExtractor";
|
|
19
|
+
import { FailedExtractionToast, SuccessfulExtractionToast } from "./ExtractionToast";
|
|
20
|
+
import { generateUrl } from "./utils";
|
|
21
|
+
|
|
22
|
+
export interface ReportsConfigContextProps {
|
|
23
|
+
getAccessToken?: GetAccessTokenFn;
|
|
24
|
+
baseUrl?: string;
|
|
25
|
+
iTwinId: string;
|
|
26
|
+
bulkExtractor?: BulkExtractor;
|
|
27
|
+
reportsClient?: ReportsClient;
|
|
28
|
+
mappingsClient?: MappingsClient;
|
|
29
|
+
extractionClient?: ExtractionClient;
|
|
30
|
+
iModelsClient?: IModelsClient;
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const authorizationClientGetAccessToken = async () =>
|
|
35
|
+
(await IModelApp.authorizationClient?.getAccessToken()) ?? "";
|
|
36
|
+
|
|
37
|
+
export const ReportsConfigContext = (props: ReportsConfigContextProps) => {
|
|
38
|
+
const reportsBaseUrl = useCallback(() => generateUrl(
|
|
39
|
+
REPORTING_BASE_PATH,
|
|
40
|
+
props.baseUrl || REPORTS_CONFIG_BASE_URL
|
|
41
|
+
), [props.baseUrl]);
|
|
42
|
+
const iModelClientOptions: IModelsClientOptions = useMemo(() => ({
|
|
43
|
+
api: { baseUrl: generateUrl(Constants.api.baseUrl, props.baseUrl ?? REPORTS_CONFIG_BASE_URL) },
|
|
44
|
+
}), [props.baseUrl]);
|
|
45
|
+
const [extractionClient, setExtractionClient] = useState<ExtractionClient>(
|
|
46
|
+
props.extractionClient ?? new ExtractionClient(reportsBaseUrl())
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const [apiConfig, setApiConfig] = useState<ReportsConfigApiProps>({
|
|
50
|
+
getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,
|
|
51
|
+
baseUrl: reportsBaseUrl(),
|
|
52
|
+
iTwinId: props.iTwinId,
|
|
53
|
+
reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),
|
|
54
|
+
mappingsClient: props.mappingsClient ?? new MappingsClient(reportsBaseUrl()),
|
|
55
|
+
iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (!props.extractionClient) {
|
|
60
|
+
setExtractionClient(props.extractionClient ?? new ExtractionClient(reportsBaseUrl()));
|
|
61
|
+
}
|
|
62
|
+
}, [props.extractionClient, reportsBaseUrl]);
|
|
63
|
+
|
|
64
|
+
const successfulExtractionToast = (iModelName: string, odataFeedUrl: string) => {
|
|
65
|
+
toaster.positive(<SuccessfulExtractionToast iModelName={iModelName} odataFeedUrl={odataFeedUrl} />);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const failedExtractionToast = (iModelName: string) => {
|
|
69
|
+
toaster.negative(<FailedExtractionToast iModelName={iModelName} />);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const bulkExtractor = useMemo(
|
|
73
|
+
() => ({ bulkExtractor: props.bulkExtractor ?? new BulkExtractor(apiConfig.reportsClient, extractionClient, apiConfig.getAccessToken, successfulExtractionToast, failedExtractionToast) }),
|
|
74
|
+
[apiConfig.getAccessToken, apiConfig.reportsClient, extractionClient, props.bulkExtractor]
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
setApiConfig(() => ({
|
|
79
|
+
getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,
|
|
80
|
+
baseUrl: props.baseUrl || REPORTS_CONFIG_BASE_URL,
|
|
81
|
+
iTwinId: props.iTwinId,
|
|
82
|
+
reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),
|
|
83
|
+
mappingsClient: props.mappingsClient ?? new MappingsClient(reportsBaseUrl()),
|
|
84
|
+
iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),
|
|
85
|
+
}));
|
|
86
|
+
}, [props.getAccessToken, props.baseUrl, props.iTwinId, props.reportsClient, props.mappingsClient, props.iModelsClient, reportsBaseUrl, iModelClientOptions]);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<ReportsConfigApiContext.Provider value={apiConfig}>
|
|
90
|
+
<BulkExtractorContext.Provider value={bulkExtractor}>
|
|
91
|
+
{props.children}
|
|
92
|
+
</BulkExtractorContext.Provider>
|
|
93
|
+
</ReportsConfigApiContext.Provider>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
5
|
|
|
7
6
|
.rcw-reports-container {
|
|
8
7
|
position: absolute;
|
|
@@ -10,9 +9,8 @@
|
|
|
10
9
|
left: 0;
|
|
11
10
|
display: flex;
|
|
12
11
|
flex-direction: column;
|
|
13
|
-
padding:
|
|
12
|
+
padding: var(--iui-size-s) var(--iui-size-m);
|
|
14
13
|
box-sizing: border-box;
|
|
15
14
|
height: 100%;
|
|
16
15
|
overflow: auto;
|
|
17
|
-
gap: $iui-baseline;
|
|
18
16
|
}
|
|
@@ -3,43 +3,69 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import type { AccessToken } from "@itwin/core-bentley";
|
|
6
|
-
import {
|
|
7
|
-
import React, { useEffect, useState } from "react";
|
|
8
|
-
import { Reports } from "../components/Reports";
|
|
9
|
-
import type { ReportsApiConfig } from "../context/ReportsApiConfigContext";
|
|
10
|
-
import { ReportsApiConfigContext } from "../context/ReportsApiConfigContext";
|
|
6
|
+
import React, { useCallback, useState } from "react";
|
|
11
7
|
import "./ReportsContainer.scss";
|
|
8
|
+
import type { Report } from "@itwin/insights-client";
|
|
9
|
+
import { useActiveIModelConnection } from "@itwin/appui-react";
|
|
10
|
+
import { ReportsHeader } from "./ReportsHeader";
|
|
11
|
+
import { ReportsRouter } from "./ReportsRouter";
|
|
12
|
+
import { ReportsConfigContext } from "./ReportsConfigContext";
|
|
12
13
|
|
|
13
14
|
interface ReportsContainerProps {
|
|
14
15
|
getAccessToken?: () => Promise<AccessToken>;
|
|
15
16
|
baseUrl: string;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
export enum RouteStep {
|
|
20
|
+
ReportsList,
|
|
21
|
+
ReportAction,
|
|
22
|
+
ReportMappings
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ReportsRouteFields {
|
|
26
|
+
report?: Report;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Route {
|
|
30
|
+
step: RouteStep;
|
|
31
|
+
title: string;
|
|
32
|
+
reportsRoutingFields: ReportsRouteFields;
|
|
33
|
+
}
|
|
20
34
|
|
|
21
35
|
const ReportsContainer = ({
|
|
22
36
|
getAccessToken,
|
|
23
37
|
baseUrl,
|
|
24
38
|
}: ReportsContainerProps) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
|
|
40
|
+
const [routingHistory, setRoutingHistory] = useState<Route[]>([
|
|
41
|
+
{ step: RouteStep.ReportsList, title: "iTwin Reports", reportsRoutingFields: {} },
|
|
42
|
+
]);
|
|
43
|
+
const currentRoute = routingHistory[routingHistory.length - 1];
|
|
44
|
+
const iTwinId = useActiveIModelConnection()?.iTwinId ?? "";
|
|
45
|
+
const navigateTo = useCallback((toRoute: (prev: Route | undefined) => Route) => {
|
|
46
|
+
setRoutingHistory((r) => [...r, toRoute(r[r.length - 1])]);
|
|
47
|
+
}, []);
|
|
48
|
+
|
|
49
|
+
const goBack = useCallback(() => {
|
|
50
|
+
const updatedRouting = [...routingHistory];
|
|
51
|
+
updatedRouting.pop();
|
|
52
|
+
setRoutingHistory(updatedRouting);
|
|
53
|
+
}, [routingHistory]);
|
|
36
54
|
|
|
37
55
|
return (
|
|
38
|
-
<
|
|
56
|
+
<ReportsConfigContext getAccessToken={getAccessToken} baseUrl={baseUrl} iTwinId={iTwinId}>
|
|
39
57
|
<div className="rcw-reports-container">
|
|
40
|
-
<
|
|
58
|
+
<ReportsHeader
|
|
59
|
+
goBack={goBack}
|
|
60
|
+
currentRoute={currentRoute}
|
|
61
|
+
/>
|
|
62
|
+
<ReportsRouter
|
|
63
|
+
currentRoute={currentRoute}
|
|
64
|
+
navigateTo={navigateTo}
|
|
65
|
+
goBack={goBack}
|
|
66
|
+
/>
|
|
41
67
|
</div>
|
|
42
|
-
</
|
|
68
|
+
</ReportsConfigContext>
|
|
43
69
|
);
|
|
44
70
|
};
|
|
45
71
|
|