@itwin/reports-config-widget-react 0.0.8 → 0.2.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/package-deps_rebuild.json +46 -32
- package/.rush/temp/shrinkwrap-deps.json +14 -6
- package/CHANGELOG.json +27 -0
- package/CHANGELOG.md +16 -1
- package/coverage/clover.xml +648 -427
- package/coverage/coverage-final.json +28 -18
- package/coverage/lcov-report/index.html +34 -19
- package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +10 -10
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/test/index.html +1 -1
- package/coverage/lcov-report/src/test/test-utils.tsx.html +22 -22
- package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +7 -7
- package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +29 -41
- package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +31 -37
- package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +661 -0
- package/coverage/lcov-report/src/widget/components/Constants.ts.html +106 -0
- package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +21 -21
- package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +187 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +145 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +139 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +151 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +190 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +176 -0
- package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +295 -0
- package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +208 -0
- package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +77 -44
- package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +8 -8
- package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +14 -20
- package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +475 -0
- package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +469 -0
- package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +184 -250
- package/coverage/lcov-report/src/widget/components/Reports.tsx.html +180 -132
- package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +10 -10
- package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +11 -11
- package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +31 -31
- package/coverage/lcov-report/src/widget/components/index.html +134 -59
- package/coverage/lcov-report/src/widget/components/utils.tsx.html +32 -32
- package/coverage/lcov-report/src/widget/context/ReportsApiConfigContext.tsx.html +8 -8
- 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 +7 -7
- package/coverage/lcov-report/src/widget/index.html +1 -1
- package/coverage/lcov.info +1137 -738
- package/jest.config.js +7 -0
- package/lib/cjs/test/AddMappingModal.test.d.ts +2 -0
- package/lib/cjs/test/AddMappingModal.test.d.ts.map +1 -0
- package/lib/cjs/test/AddMappingModal.test.js +277 -0
- package/lib/cjs/test/AddMappingModal.test.js.map +1 -0
- package/lib/cjs/test/BulkExtractor.test.d.ts +2 -0
- package/lib/cjs/test/BulkExtractor.test.d.ts.map +1 -0
- package/lib/cjs/test/BulkExtractor.test.js +182 -0
- package/lib/cjs/test/BulkExtractor.test.js.map +1 -0
- package/lib/cjs/test/DeleteModal.test.d.ts +2 -0
- package/lib/cjs/test/DeleteModal.test.d.ts.map +1 -0
- package/lib/cjs/test/DeleteModal.test.js +93 -0
- package/lib/cjs/test/DeleteModal.test.js.map +1 -0
- package/lib/cjs/test/ReportAction.test.js +2 -3
- package/lib/cjs/test/ReportAction.test.js.map +1 -1
- package/lib/cjs/test/ReportMappingHorizontalTile.test.d.ts +2 -0
- package/lib/cjs/test/ReportMappingHorizontalTile.test.d.ts.map +1 -0
- package/lib/cjs/test/ReportMappingHorizontalTile.test.js +340 -0
- package/lib/cjs/test/ReportMappingHorizontalTile.test.js.map +1 -0
- package/lib/cjs/test/ReportMappings.test.js +115 -267
- package/lib/cjs/test/ReportMappings.test.js.map +1 -1
- package/lib/cjs/test/Reports.test.js +1 -1
- package/lib/cjs/test/Reports.test.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.js +4 -5
- package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.d.ts +2 -2
- package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.js +5 -4
- package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/cjs/widget/components/AddMappingsModal.scss +4 -3
- package/lib/cjs/widget/components/BulkExtractor.d.ts +37 -0
- package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -0
- package/lib/cjs/widget/components/BulkExtractor.js +155 -0
- package/lib/cjs/widget/components/BulkExtractor.js.map +1 -0
- package/lib/cjs/widget/components/Constants.d.ts +4 -0
- package/lib/cjs/widget/components/Constants.d.ts.map +1 -0
- package/lib/cjs/widget/components/Constants.js +11 -0
- package/lib/cjs/widget/components/Constants.js.map +1 -0
- package/lib/cjs/widget/components/DeleteModal.js +1 -1
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.scss +4 -3
- package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.d.ts +8 -0
- package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.js +23 -0
- package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.d.ts +3 -0
- package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.js +18 -0
- package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.d.ts +3 -0
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js +17 -0
- package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.d.ts +3 -0
- package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.js +18 -0
- package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.d.ts +8 -0
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js +23 -0
- package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -0
- package/lib/cjs/widget/components/ExtractionStatus.d.ts +17 -0
- package/lib/cjs/widget/components/ExtractionStatus.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionStatus.js +76 -0
- package/lib/cjs/widget/components/ExtractionStatus.js.map +1 -0
- package/lib/cjs/widget/components/{Extraction.scss → ExtractionStatus.scss} +17 -15
- package/lib/cjs/widget/components/ExtractionToast.d.ts +11 -0
- package/lib/cjs/widget/components/ExtractionToast.d.ts.map +1 -0
- package/lib/cjs/widget/components/ExtractionToast.js +33 -0
- package/lib/cjs/widget/components/ExtractionToast.js.map +1 -0
- package/lib/cjs/widget/components/HorizontalTile.d.ts +8 -7
- package/lib/cjs/widget/components/HorizontalTile.d.ts.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.js +10 -6
- package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
- package/lib/cjs/widget/components/HorizontalTile.scss +42 -22
- package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportAction.js +3 -3
- package/lib/cjs/widget/components/ReportAction.js.map +1 -1
- package/lib/cjs/widget/components/ReportAction.scss +2 -2
- package/lib/cjs/widget/components/ReportHorizontalTile.d.ts +16 -0
- package/lib/cjs/widget/components/ReportHorizontalTile.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportHorizontalTile.js +71 -0
- package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -0
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts +13 -0
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -0
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.js +82 -0
- package/lib/cjs/widget/components/ReportMappingHorizontalTile.js.map +1 -0
- package/lib/cjs/widget/components/ReportMappings.d.ts +3 -1
- package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.js +39 -40
- package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
- package/lib/cjs/widget/components/ReportMappings.scss +7 -7
- package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
- package/lib/cjs/widget/components/Reports.js +43 -28
- package/lib/cjs/widget/components/Reports.js.map +1 -1
- package/lib/cjs/widget/components/Reports.scss +8 -4
- package/lib/cjs/widget/components/ReportsContainer.js +1 -1
- package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
- package/lib/cjs/widget/components/ReportsContainer.scss +2 -2
- package/lib/cjs/widget/components/SearchBar.js +1 -1
- package/lib/cjs/widget/components/SearchBar.js.map +1 -1
- package/lib/cjs/widget/components/SearchBar.scss +6 -0
- package/lib/cjs/widget/components/SelectIModel.js +2 -2
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.scss +4 -3
- 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 +2 -2
- package/lib/esm/test/AddMappingModal.test.d.ts +2 -0
- package/lib/esm/test/AddMappingModal.test.d.ts.map +1 -0
- package/lib/esm/test/AddMappingModal.test.js +253 -0
- package/lib/esm/test/AddMappingModal.test.js.map +1 -0
- package/lib/esm/test/BulkExtractor.test.d.ts +2 -0
- package/lib/esm/test/BulkExtractor.test.d.ts.map +1 -0
- package/lib/esm/test/BulkExtractor.test.js +158 -0
- package/lib/esm/test/BulkExtractor.test.js.map +1 -0
- package/lib/esm/test/DeleteModal.test.d.ts +2 -0
- package/lib/esm/test/DeleteModal.test.d.ts.map +1 -0
- package/lib/esm/test/DeleteModal.test.js +69 -0
- package/lib/esm/test/DeleteModal.test.js.map +1 -0
- package/lib/esm/test/ReportAction.test.js +2 -3
- package/lib/esm/test/ReportAction.test.js.map +1 -1
- package/lib/esm/test/ReportMappingHorizontalTile.test.d.ts +2 -0
- package/lib/esm/test/ReportMappingHorizontalTile.test.d.ts.map +1 -0
- package/lib/esm/test/ReportMappingHorizontalTile.test.js +316 -0
- package/lib/esm/test/ReportMappingHorizontalTile.test.js.map +1 -0
- package/lib/esm/test/ReportMappings.test.js +117 -269
- package/lib/esm/test/ReportMappings.test.js.map +1 -1
- package/lib/esm/test/Reports.test.js +1 -1
- package/lib/esm/test/Reports.test.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -1
- package/lib/esm/widget/components/ActionPanel.js +4 -5
- package/lib/esm/widget/components/ActionPanel.js.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.d.ts +2 -2
- package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.js +4 -5
- package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
- package/lib/esm/widget/components/AddMappingsModal.scss +4 -3
- package/lib/esm/widget/components/BulkExtractor.d.ts +37 -0
- package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -0
- package/lib/esm/widget/components/BulkExtractor.js +152 -0
- package/lib/esm/widget/components/BulkExtractor.js.map +1 -0
- package/lib/esm/widget/components/Constants.d.ts +4 -0
- package/lib/esm/widget/components/Constants.d.ts.map +1 -0
- package/lib/esm/widget/components/Constants.js +8 -0
- package/lib/esm/widget/components/Constants.js.map +1 -0
- package/lib/esm/widget/components/DeleteModal.js +1 -1
- package/lib/esm/widget/components/DeleteModal.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.scss +4 -3
- package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.d.ts +8 -0
- package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.js +16 -0
- package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.d.ts +3 -0
- package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.js +11 -0
- package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.d.ts +3 -0
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js +10 -0
- package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.d.ts +3 -0
- package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.js +11 -0
- package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.d.ts +8 -0
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js +16 -0
- package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -0
- package/lib/esm/widget/components/ExtractionStatus.d.ts +17 -0
- package/lib/esm/widget/components/ExtractionStatus.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionStatus.js +53 -0
- package/lib/esm/widget/components/ExtractionStatus.js.map +1 -0
- package/{src/widget/components/Extraction.scss → lib/esm/widget/components/ExtractionStatus.scss} +17 -15
- package/lib/esm/widget/components/ExtractionToast.d.ts +11 -0
- package/lib/esm/widget/components/ExtractionToast.d.ts.map +1 -0
- package/lib/esm/widget/components/ExtractionToast.js +25 -0
- package/lib/esm/widget/components/ExtractionToast.js.map +1 -0
- package/lib/esm/widget/components/HorizontalTile.d.ts +8 -7
- package/lib/esm/widget/components/HorizontalTile.d.ts.map +1 -1
- package/lib/esm/widget/components/HorizontalTile.js +10 -6
- package/lib/esm/widget/components/HorizontalTile.js.map +1 -1
- package/lib/esm/widget/components/HorizontalTile.scss +42 -22
- package/lib/esm/widget/components/ReportAction.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportAction.js +3 -3
- package/lib/esm/widget/components/ReportAction.js.map +1 -1
- package/lib/esm/widget/components/ReportAction.scss +2 -2
- package/lib/esm/widget/components/ReportHorizontalTile.d.ts +16 -0
- package/lib/esm/widget/components/ReportHorizontalTile.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportHorizontalTile.js +64 -0
- package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -0
- package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts +13 -0
- package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -0
- package/lib/esm/widget/components/ReportMappingHorizontalTile.js +75 -0
- package/lib/esm/widget/components/ReportMappingHorizontalTile.js.map +1 -0
- package/lib/esm/widget/components/ReportMappings.d.ts +3 -1
- package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
- package/lib/esm/widget/components/ReportMappings.js +40 -41
- package/lib/esm/widget/components/ReportMappings.js.map +1 -1
- package/lib/esm/widget/components/ReportMappings.scss +7 -7
- package/lib/esm/widget/components/Reports.d.ts.map +1 -1
- package/lib/esm/widget/components/Reports.js +45 -30
- package/lib/esm/widget/components/Reports.js.map +1 -1
- package/lib/esm/widget/components/Reports.scss +8 -4
- package/lib/esm/widget/components/ReportsContainer.js +1 -1
- package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
- package/lib/esm/widget/components/ReportsContainer.scss +2 -2
- package/lib/esm/widget/components/SearchBar.js +1 -1
- package/lib/esm/widget/components/SearchBar.js.map +1 -1
- package/lib/esm/widget/components/SearchBar.scss +6 -0
- 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 +4 -3
- package/lib/esm/widget/components/utils.js +1 -1
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +2 -2
- package/lib/public/locales/en/ReportsConfigWidget.json +7 -1
- package/package.json +9 -3
- package/public/locales/en/ReportsConfigWidget.json +7 -1
- package/reports-config-widget-react.build.error.log +10 -6
- package/reports-config-widget-react.build.log +51 -36
- package/src/test/AddMappingModal.test.tsx +315 -0
- package/src/test/BulkExtractor.test.ts +301 -0
- package/src/test/DeleteModal.test.tsx +118 -0
- package/src/test/ReportAction.test.tsx +2 -4
- package/src/test/ReportMappingHorizontalTile.test.tsx +451 -0
- package/src/test/ReportMappings.test.tsx +154 -549
- package/src/test/Reports.test.tsx +1 -1
- package/src/widget/components/ActionPanel.tsx +19 -23
- package/src/widget/components/AddMappingsModal.scss +4 -3
- package/src/widget/components/AddMappingsModal.tsx +4 -6
- package/src/widget/components/BulkExtractor.ts +192 -0
- package/src/widget/components/Constants.ts +7 -0
- package/src/widget/components/DeleteModal.scss +4 -3
- package/src/widget/components/DeleteModal.tsx +1 -1
- package/src/widget/components/ExtractionStates/FailedExtractionState.tsx +34 -0
- package/src/widget/components/ExtractionStates/QueuedExtractionState.tsx +20 -0
- package/src/widget/components/ExtractionStates/RunningExtractionState.tsx +18 -0
- package/src/widget/components/ExtractionStates/StartingExtractionState.tsx +22 -0
- package/src/widget/components/ExtractionStates/SucceededExtractionState.tsx +35 -0
- package/{lib/esm/widget/components/Extraction.scss → src/widget/components/ExtractionStatus.scss} +17 -15
- package/src/widget/components/ExtractionStatus.tsx +70 -0
- package/src/widget/components/ExtractionToast.tsx +41 -0
- package/src/widget/components/HorizontalTile.scss +42 -22
- package/src/widget/components/HorizontalTile.tsx +45 -34
- package/src/widget/components/ReportAction.scss +2 -2
- package/src/widget/components/ReportAction.tsx +1 -3
- package/src/widget/components/ReportHorizontalTile.tsx +130 -0
- package/src/widget/components/ReportMappingHorizontalTile.tsx +128 -0
- package/src/widget/components/ReportMappings.scss +7 -7
- package/src/widget/components/ReportMappings.tsx +91 -113
- package/src/widget/components/Reports.scss +8 -4
- package/src/widget/components/Reports.tsx +78 -62
- package/src/widget/components/ReportsContainer.scss +2 -2
- package/src/widget/components/ReportsContainer.tsx +1 -1
- package/src/widget/components/SearchBar.scss +6 -0
- package/src/widget/components/SearchBar.tsx +1 -1
- package/src/widget/components/SelectIModel.scss +4 -3
- package/src/widget/components/SelectIModel.tsx +2 -2
- package/src/widget/components/utils.scss +2 -2
- package/src/widget/components/utils.tsx +1 -1
- package/coverage/lcov-report/src/widget/components/Extraction.tsx.html +0 -1030
- package/lib/cjs/widget/components/Extraction.d.ts +0 -28
- package/lib/cjs/widget/components/Extraction.d.ts.map +0 -1
- package/lib/cjs/widget/components/Extraction.js +0 -190
- package/lib/cjs/widget/components/Extraction.js.map +0 -1
- package/lib/esm/widget/components/Extraction.d.ts +0 -28
- package/lib/esm/widget/components/Extraction.d.ts.map +0 -1
- package/lib/esm/widget/components/Extraction.js +0 -166
- package/lib/esm/widget/components/Extraction.js.map +0 -1
- package/src/widget/components/Extraction.tsx +0 -315
|
@@ -0,0 +1,315 @@
|
|
|
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 React from "react";
|
|
6
|
+
import faker from "@faker-js/faker";
|
|
7
|
+
import "@testing-library/jest-dom";
|
|
8
|
+
import type {
|
|
9
|
+
IModelConnection,
|
|
10
|
+
} from "@itwin/core-frontend";
|
|
11
|
+
import { NoRenderApp } from "@itwin/core-frontend";
|
|
12
|
+
import { ReportsConfigWidget } from "../ReportsConfigWidget";
|
|
13
|
+
import {
|
|
14
|
+
render,
|
|
15
|
+
screen,
|
|
16
|
+
TestUtils,
|
|
17
|
+
waitFor,
|
|
18
|
+
within,
|
|
19
|
+
} from "./test-utils";
|
|
20
|
+
import * as moq from "typemoq";
|
|
21
|
+
import type {
|
|
22
|
+
MappingSingle,
|
|
23
|
+
ReportMappingCollection,
|
|
24
|
+
} from "@itwin/insights-client";
|
|
25
|
+
import type { ReportMappingAndMapping } from "../widget/components/ReportMappings";
|
|
26
|
+
import type { IModelOperations, OperationOptions } from "@itwin/imodels-client-management";
|
|
27
|
+
import { IModelState } from "@itwin/imodels-client-management";
|
|
28
|
+
import { AddMappingsModal } from "../widget/components/AddMappingsModal";
|
|
29
|
+
import { EmptyLocalization } from "@itwin/core-common";
|
|
30
|
+
|
|
31
|
+
const mockITwinId = faker.datatype.uuid();
|
|
32
|
+
const mockIModelId1 = faker.datatype.uuid();
|
|
33
|
+
const mockIModelId2 = faker.datatype.uuid();
|
|
34
|
+
|
|
35
|
+
const mockReportId = faker.datatype.uuid();
|
|
36
|
+
|
|
37
|
+
const mockIModelsResponse = [
|
|
38
|
+
{
|
|
39
|
+
iModel: {
|
|
40
|
+
id: mockIModelId1,
|
|
41
|
+
displayName: "rAnDoMdIsPlAynAmE1",
|
|
42
|
+
name: "rAnDomName1",
|
|
43
|
+
description: "rAnDoMDeScRiPtIoN1",
|
|
44
|
+
createdDateTime: "2021-10-04T22:13:50.397Z",
|
|
45
|
+
state: IModelState.Initialized,
|
|
46
|
+
projectId: mockITwinId,
|
|
47
|
+
extent: null,
|
|
48
|
+
_links: {
|
|
49
|
+
creator: {
|
|
50
|
+
href: "",
|
|
51
|
+
},
|
|
52
|
+
namedVersions: {
|
|
53
|
+
href: "",
|
|
54
|
+
},
|
|
55
|
+
changesets: {
|
|
56
|
+
href: "",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
iModel: {
|
|
63
|
+
id: mockIModelId2,
|
|
64
|
+
displayName: "rAnDoMdIsPlAynAmE2",
|
|
65
|
+
name: "rAnDomName2",
|
|
66
|
+
description: "rAnDoMDeScRiPtIoN2",
|
|
67
|
+
createdDateTime: "2021-10-04T22:13:50.397Z",
|
|
68
|
+
state: IModelState.Initialized,
|
|
69
|
+
projectId: mockITwinId,
|
|
70
|
+
extent: null,
|
|
71
|
+
_links: {
|
|
72
|
+
creator: {
|
|
73
|
+
href: "",
|
|
74
|
+
},
|
|
75
|
+
namedVersions: {
|
|
76
|
+
href: "",
|
|
77
|
+
},
|
|
78
|
+
changesets: {
|
|
79
|
+
href: "",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
const mockProjectIModels = {
|
|
87
|
+
iModels: mockIModelsResponse.map((iModel) => ({
|
|
88
|
+
id: iModel.iModel.id,
|
|
89
|
+
displayName: iModel.iModel.displayName,
|
|
90
|
+
})),
|
|
91
|
+
_links: {
|
|
92
|
+
self: {
|
|
93
|
+
href: "",
|
|
94
|
+
},
|
|
95
|
+
prev: null,
|
|
96
|
+
next: null,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const mockReportMappingsFactory = (): ReportMappingCollection => {
|
|
101
|
+
return {
|
|
102
|
+
mappings: [
|
|
103
|
+
{
|
|
104
|
+
reportId: mockReportId,
|
|
105
|
+
mappingId: faker.datatype.uuid(),
|
|
106
|
+
imodelId: mockIModelId1,
|
|
107
|
+
_links: {
|
|
108
|
+
report: {
|
|
109
|
+
href: "",
|
|
110
|
+
},
|
|
111
|
+
mapping: {
|
|
112
|
+
href: "",
|
|
113
|
+
},
|
|
114
|
+
imodel: {
|
|
115
|
+
href: "",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
reportId: mockReportId,
|
|
121
|
+
mappingId: faker.datatype.uuid(),
|
|
122
|
+
imodelId: mockIModelId2,
|
|
123
|
+
_links: {
|
|
124
|
+
report: {
|
|
125
|
+
href: "",
|
|
126
|
+
},
|
|
127
|
+
mapping: {
|
|
128
|
+
href: "",
|
|
129
|
+
},
|
|
130
|
+
imodel: {
|
|
131
|
+
href: "",
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
_links: {
|
|
137
|
+
next: undefined,
|
|
138
|
+
self: {
|
|
139
|
+
href: "",
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const mockMappingsFactory = (
|
|
146
|
+
mockReportMappings: ReportMappingCollection
|
|
147
|
+
): MappingSingle[] => {
|
|
148
|
+
const mockMappings: MappingSingle[] = mockReportMappings.mappings.map(
|
|
149
|
+
(mapping, index) => ({
|
|
150
|
+
mapping: {
|
|
151
|
+
id: mapping.mappingId,
|
|
152
|
+
mappingName: `mOcKMaPpIngNaMe${index}`,
|
|
153
|
+
description: `mOcKmApPInGDeScRiPtIoN${index}`,
|
|
154
|
+
extractionEnabled: false,
|
|
155
|
+
createdOn: "",
|
|
156
|
+
createdBy: "",
|
|
157
|
+
modifiedOn: "",
|
|
158
|
+
modifiedBy: "",
|
|
159
|
+
_links: {
|
|
160
|
+
imodel: {
|
|
161
|
+
// Tie the mapping to to the iModel Id
|
|
162
|
+
href: mapping.imodelId,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
})
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
const extraMappingId = faker.datatype.uuid();
|
|
170
|
+
const extraMappingName = "mOcKNaMeExTrA";
|
|
171
|
+
const extraMappingDescription = "mOcKDeScRiPtIoNeXtRa";
|
|
172
|
+
|
|
173
|
+
mockMappings.push({
|
|
174
|
+
mapping: {
|
|
175
|
+
id: extraMappingId,
|
|
176
|
+
mappingName: extraMappingName,
|
|
177
|
+
description: extraMappingDescription,
|
|
178
|
+
extractionEnabled: false,
|
|
179
|
+
createdOn: "",
|
|
180
|
+
createdBy: "",
|
|
181
|
+
modifiedOn: "",
|
|
182
|
+
modifiedBy: "",
|
|
183
|
+
_links: {
|
|
184
|
+
imodel: {
|
|
185
|
+
href: "",
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
return mockMappings;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const mockReportMappingsAndMappingsFactory = (mockMappings: MappingSingle[], reportMappings: ReportMappingCollection): ReportMappingAndMapping[] => {
|
|
195
|
+
const reportMappingsAndMapping =
|
|
196
|
+
reportMappings.mappings.map((reportMapping) => {
|
|
197
|
+
const mapping = mockMappings.find((x) => x.mapping.id === reportMapping.mappingId)!.mapping;
|
|
198
|
+
const iModelName = mockProjectIModels.iModels.find((x) => x.id === reportMapping.imodelId)!.displayName;
|
|
199
|
+
const reportMappingAndMapping: ReportMappingAndMapping = {
|
|
200
|
+
...reportMapping,
|
|
201
|
+
iModelName,
|
|
202
|
+
mappingName: mapping.mappingName,
|
|
203
|
+
mappingDescription: mapping.description ?? "",
|
|
204
|
+
};
|
|
205
|
+
return reportMappingAndMapping;
|
|
206
|
+
});
|
|
207
|
+
return reportMappingsAndMapping;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const connectionMock = moq.Mock.ofType<IModelConnection>();
|
|
211
|
+
const mockIModelsClient = moq.Mock.ofType<IModelOperations<OperationOptions>>();
|
|
212
|
+
|
|
213
|
+
jest.mock("@itwin/appui-react", () => ({
|
|
214
|
+
...jest.requireActual("@itwin/appui-react"),
|
|
215
|
+
useActiveIModelConnection: () => connectionMock.object,
|
|
216
|
+
}));
|
|
217
|
+
|
|
218
|
+
jest.mock("@itwin/imodels-client-management", () => ({
|
|
219
|
+
...jest.requireActual("@itwin/imodels-client-management"),
|
|
220
|
+
IModelsClient: jest.fn().mockImplementation(() => ({
|
|
221
|
+
iModels: mockIModelsClient.object,
|
|
222
|
+
})),
|
|
223
|
+
toArray: jest.fn().mockImplementation(async () => {
|
|
224
|
+
return mockProjectIModels.iModels;
|
|
225
|
+
}),
|
|
226
|
+
}));
|
|
227
|
+
|
|
228
|
+
const mockGetMappings = jest.fn();
|
|
229
|
+
const mockCreateReportMapping = jest.fn();
|
|
230
|
+
|
|
231
|
+
jest.mock("@itwin/insights-client", () => ({
|
|
232
|
+
...jest.requireActual("@itwin/insights-client"),
|
|
233
|
+
MappingsClient: jest.fn().mockImplementation(() => ({
|
|
234
|
+
getMappings: mockGetMappings,
|
|
235
|
+
})),
|
|
236
|
+
ReportsClient: jest.fn().mockImplementation(() => ({
|
|
237
|
+
createReportMapping: mockCreateReportMapping,
|
|
238
|
+
})),
|
|
239
|
+
}));
|
|
240
|
+
|
|
241
|
+
beforeAll(async () => {
|
|
242
|
+
await NoRenderApp.startup({localization: new EmptyLocalization()});
|
|
243
|
+
connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId1);
|
|
244
|
+
await ReportsConfigWidget.initialize();
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
afterAll(() => {
|
|
248
|
+
TestUtils.terminateUiFramework();
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
afterEach(() => {
|
|
252
|
+
mockGetMappings.mockReset();
|
|
253
|
+
mockIModelsClient.reset();
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
describe("Add Mapping Modal", () => {
|
|
257
|
+
it("Adding mapping sends create request", async () => {
|
|
258
|
+
const mockReportMappings = mockReportMappingsFactory();
|
|
259
|
+
const mockMappings = mockMappingsFactory(mockReportMappings);
|
|
260
|
+
const mockReportMappingsAndMappings = mockReportMappingsAndMappingsFactory(mockMappings, mockReportMappings);
|
|
261
|
+
|
|
262
|
+
mockGetMappings.mockReturnValueOnce(mockMappings.map((m: MappingSingle) => m.mapping));
|
|
263
|
+
|
|
264
|
+
const { user } = render(
|
|
265
|
+
<AddMappingsModal
|
|
266
|
+
show={true}
|
|
267
|
+
reportId={mockReportId}
|
|
268
|
+
existingMappings={mockReportMappingsAndMappings}
|
|
269
|
+
returnFn={jest.fn()}
|
|
270
|
+
/>
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
expect(screen.getByRole("dialog")).toBeInTheDocument();
|
|
274
|
+
const modal = screen.getByRole("dialog");
|
|
275
|
+
const withinModal = within(modal);
|
|
276
|
+
expect(withinModal.getByText(/addmappings/i)).toBeInTheDocument();
|
|
277
|
+
|
|
278
|
+
const addButton = withinModal.getByRole("button", {
|
|
279
|
+
name: /add/i,
|
|
280
|
+
});
|
|
281
|
+
// Add button should be disabled
|
|
282
|
+
expect(addButton).toBeDisabled();
|
|
283
|
+
|
|
284
|
+
await waitFor(() => screen.getByRole("row"));
|
|
285
|
+
|
|
286
|
+
// Already mapped mappings are disabled
|
|
287
|
+
for (let i = 0; i < mockMappings.length - 1; i++) {
|
|
288
|
+
const row = screen.getByRole("row", {
|
|
289
|
+
name: new RegExp(
|
|
290
|
+
`${mockMappings[i].mapping.mappingName} ${mockMappings[i].mapping.description}`,
|
|
291
|
+
"i"
|
|
292
|
+
),
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
const checkbox = within(row).getByRole("checkbox");
|
|
296
|
+
expect(checkbox).toBeDisabled();
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Click on checkbox on new mapping
|
|
300
|
+
const unmappedRow = screen.getByRole("row", {
|
|
301
|
+
name: new RegExp(
|
|
302
|
+
`${mockMappings[mockMappings.length - 1].mapping.mappingName
|
|
303
|
+
} ${mockMappings[mockMappings.length - 1].mapping.description}`,
|
|
304
|
+
"i"
|
|
305
|
+
),
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
const enabledCheckbox = within(unmappedRow).getByRole("checkbox");
|
|
309
|
+
|
|
310
|
+
await user.click(enabledCheckbox);
|
|
311
|
+
await user.click(addButton);
|
|
312
|
+
|
|
313
|
+
expect(mockCreateReportMapping).toBeCalledTimes(1);
|
|
314
|
+
});
|
|
315
|
+
});
|
|
@@ -0,0 +1,301 @@
|
|
|
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 BulkExtractor from "../widget/components/BulkExtractor";
|
|
6
|
+
import { ExtractionStates } from "../widget/components/ExtractionStatus";
|
|
7
|
+
import { assert } from "chai";
|
|
8
|
+
import * as moq from "typemoq";
|
|
9
|
+
import { ExtractorState } from "@itwin/insights-client";
|
|
10
|
+
import type { AccessToken } from "@itwin/core-bentley";
|
|
11
|
+
|
|
12
|
+
jest.mock("../widget/components/Constants.ts", () => ({
|
|
13
|
+
STATUS_CHECK_INTERVAL: -1,
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
jest.mock("../widget/components/ExtractionToast.tsx", () => ({
|
|
17
|
+
FailedExtractionToast: jest.fn(),
|
|
18
|
+
SuccessfulExtractionToast: jest.fn(),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const mockRunExtraction = moq.Mock.ofType<(accessToken: AccessToken, iModelId: string) => Promise<{ id: string }>>();
|
|
22
|
+
const mockGetStatus = moq.Mock.ofType<(accessToken: AccessToken, jobId: string) => Promise<{ state: ExtractorState }>>();
|
|
23
|
+
const mockGetReportMappings = moq.Mock.ofType<(accessToken: AccessToken, reportId: string) => Promise<{ imodelId: string }[]>>();
|
|
24
|
+
|
|
25
|
+
jest.mock("@itwin/insights-client", () => ({
|
|
26
|
+
...jest.requireActual("@itwin/insights-client"),
|
|
27
|
+
ReportsClient: jest.fn().mockImplementation(() => ({
|
|
28
|
+
getReportMappings: mockGetReportMappings.object,
|
|
29
|
+
})),
|
|
30
|
+
ExtractionClient: jest.fn().mockImplementation(() => ({
|
|
31
|
+
runExtraction: mockRunExtraction.object,
|
|
32
|
+
getExtractionStatus: mockGetStatus.object,
|
|
33
|
+
})),
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
afterEach(() => {
|
|
37
|
+
mockRunExtraction.reset();
|
|
38
|
+
mockGetStatus.reset();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const mockToastCallback = jest.fn();
|
|
42
|
+
|
|
43
|
+
const mockIModelId = "mockIModelId";
|
|
44
|
+
const mockIModelId1 = "mockIModelId1";
|
|
45
|
+
const mockReportId = "mockReportId";
|
|
46
|
+
const mockRunId = "mockRunId";
|
|
47
|
+
const mockRunId1 = "mockRunId1";
|
|
48
|
+
|
|
49
|
+
describe("BulkExtractor", () => {
|
|
50
|
+
const mockApiConfig = {
|
|
51
|
+
getAccessToken: async () => "mockAccessToken",
|
|
52
|
+
baseUrl: "",
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
it("should return status none for unknown iModel", async () => {
|
|
56
|
+
const sut = new BulkExtractor(mockApiConfig, mockToastCallback, mockToastCallback);
|
|
57
|
+
const result = await sut.getIModelState(mockIModelId, "", "");
|
|
58
|
+
assert.strictEqual(result, ExtractionStates.None);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("should return running status for started extraction", async () => {
|
|
62
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId)).returns(
|
|
63
|
+
async () => ({ id: mockRunId })
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
67
|
+
async () => ({ state: ExtractorState.Running })
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const sut = new BulkExtractor(mockApiConfig, mockToastCallback, mockToastCallback);
|
|
71
|
+
await sut.runIModelExtraction(mockIModelId);
|
|
72
|
+
const result = await sut.getIModelState(mockIModelId, "", "");
|
|
73
|
+
assert.strictEqual(result, ExtractionStates.Running);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("should return failed status for failed extraction", async () => {
|
|
77
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId)).returns(
|
|
78
|
+
async () => ({ id: mockRunId })
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
82
|
+
async () => ({ state: ExtractorState.Failed })
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const sut = new BulkExtractor(mockApiConfig, mockToastCallback, mockToastCallback);
|
|
86
|
+
await sut.runIModelExtraction(mockIModelId);
|
|
87
|
+
const result = await sut.getIModelState(mockIModelId, "", "");
|
|
88
|
+
assert.strictEqual(result, ExtractionStates.Failed);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("full status check cycle", async () => {
|
|
92
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId)).returns(
|
|
93
|
+
async () => ({ id: mockRunId })
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
97
|
+
async () => ({ state: ExtractorState.Queued })
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
101
|
+
async () => ({ state: ExtractorState.Running })
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
105
|
+
async () => ({ state: ExtractorState.Succeeded })
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const sut = new BulkExtractor(mockApiConfig, mockToastCallback, mockToastCallback);
|
|
109
|
+
await sut.runIModelExtraction(mockIModelId);
|
|
110
|
+
|
|
111
|
+
let result = await sut.getIModelState(mockIModelId, "", "");
|
|
112
|
+
assert.strictEqual(result, ExtractionStates.Queued);
|
|
113
|
+
|
|
114
|
+
result = await sut.getIModelState(mockIModelId, "", "");
|
|
115
|
+
assert.strictEqual(result, ExtractionStates.Running);
|
|
116
|
+
|
|
117
|
+
result = await sut.getIModelState(mockIModelId, "", "");
|
|
118
|
+
assert.strictEqual(result, ExtractionStates.Succeeded);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("two started jobs should return status", async () => {
|
|
122
|
+
const mockIModelIds = [mockIModelId, mockIModelId1];
|
|
123
|
+
|
|
124
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId)).returns(
|
|
125
|
+
async () => ({ id: mockRunId })
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId1)).returns(
|
|
129
|
+
async () => ({ id: mockRunId1 })
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
133
|
+
async () => ({ state: ExtractorState.Queued })
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId1)).returns(
|
|
137
|
+
async () => ({ state: ExtractorState.Queued })
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
const sut = new BulkExtractor(mockApiConfig, mockToastCallback, mockToastCallback);
|
|
141
|
+
|
|
142
|
+
await sut.runIModelExtractions(mockIModelIds);
|
|
143
|
+
|
|
144
|
+
const result1 = await sut.getIModelState(mockIModelId, "", "");
|
|
145
|
+
const result2 = await sut.getIModelState(mockIModelId1, "", "");
|
|
146
|
+
|
|
147
|
+
assert.strictEqual(result1, ExtractionStates.Queued);
|
|
148
|
+
assert.strictEqual(result2, ExtractionStates.Queued);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("should return status none for unknown report", async () => {
|
|
152
|
+
const sut = new BulkExtractor(mockApiConfig, mockToastCallback, mockToastCallback);
|
|
153
|
+
const result = await sut.getReportState(mockReportId);
|
|
154
|
+
assert.strictEqual(result, ExtractionStates.None);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it("should return status running for running report", async () => {
|
|
158
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId)).returns(
|
|
159
|
+
async () => ({ id: mockRunId })
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
163
|
+
async () => ({ state: ExtractorState.Running })
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
mockGetReportMappings.setup(async (x) => x(moq.It.isAny(), mockReportId)).returns(
|
|
167
|
+
async () => ([{ imodelId: mockIModelId }])
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const sut = new BulkExtractor(mockApiConfig, mockToastCallback, mockToastCallback);
|
|
171
|
+
|
|
172
|
+
await sut.runReportExtractions([mockReportId]);
|
|
173
|
+
|
|
174
|
+
const result = await sut.getReportState(mockReportId);
|
|
175
|
+
assert.strictEqual(result, ExtractionStates.Running);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it("should return status running for both iModels in report", async () => {
|
|
179
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId)).returns(
|
|
180
|
+
async () => ({ id: mockRunId })
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId1)).returns(
|
|
184
|
+
async () => ({ id: mockRunId1 })
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
188
|
+
async () => ({ state: ExtractorState.Running })
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId1)).returns(
|
|
192
|
+
async () => ({ state: ExtractorState.Running })
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
mockGetReportMappings.setup(async (x) => x(moq.It.isAny(), mockReportId)).returns(
|
|
196
|
+
async () => ([{ imodelId: mockIModelId }, { imodelId: mockIModelId1 }])
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
const sut = new BulkExtractor(mockApiConfig, mockToastCallback, mockToastCallback);
|
|
200
|
+
|
|
201
|
+
await sut.runReportExtractions([mockReportId]);
|
|
202
|
+
|
|
203
|
+
const result1 = await sut.getIModelState(mockIModelId, "", "");
|
|
204
|
+
const result2 = await sut.getIModelState(mockIModelId1, "", "");
|
|
205
|
+
|
|
206
|
+
assert.strictEqual(result1, ExtractionStates.Running);
|
|
207
|
+
assert.strictEqual(result2, ExtractionStates.Running);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it("should return lowest progress status for extractions in report", async () => {
|
|
211
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId)).returns(
|
|
212
|
+
async () => ({ id: mockRunId })
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId1)).returns(
|
|
216
|
+
async () => ({ id: mockRunId1 })
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
220
|
+
async () => ({ state: ExtractorState.Running })
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId1)).returns(
|
|
224
|
+
async () => ({ state: ExtractorState.Queued })
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
mockGetReportMappings.setup(async (x) => x(moq.It.isAny(), mockReportId)).returns(
|
|
228
|
+
async () => ([{ imodelId: mockIModelId }, { imodelId: mockIModelId1 }])
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
const sut = new BulkExtractor(mockApiConfig, mockToastCallback, mockToastCallback);
|
|
232
|
+
|
|
233
|
+
await sut.runReportExtractions([mockReportId]);
|
|
234
|
+
|
|
235
|
+
const result = await sut.getReportState(mockReportId);
|
|
236
|
+
assert.strictEqual(result, ExtractionStates.Queued);
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
it("should return status failed if one of the extractions in report failed", async () => {
|
|
240
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId)).returns(
|
|
241
|
+
async () => ({ id: mockRunId })
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId1)).returns(
|
|
245
|
+
async () => ({ id: mockRunId1 })
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
249
|
+
async () => ({ state: ExtractorState.Succeeded })
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId1)).returns(
|
|
253
|
+
async () => ({ state: ExtractorState.Failed })
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
mockGetReportMappings.setup(async (x) => x(moq.It.isAny(), mockReportId)).returns(
|
|
257
|
+
async () => ([{ imodelId: mockIModelId1 }, { imodelId: mockIModelId1 }])
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
const sut = new BulkExtractor(mockApiConfig, mockToastCallback, mockToastCallback);
|
|
261
|
+
|
|
262
|
+
await sut.runReportExtractions([mockReportId]);
|
|
263
|
+
|
|
264
|
+
const result = await sut.getReportState(mockReportId);
|
|
265
|
+
assert.strictEqual(result, ExtractionStates.Failed);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
it("full report extraction status check cycle", async () => {
|
|
269
|
+
mockRunExtraction.setup(async (x) => x(moq.It.isAny(), mockIModelId)).returns(
|
|
270
|
+
async () => ({ id: mockRunId })
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
274
|
+
async () => ({ state: ExtractorState.Queued })
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
278
|
+
async () => ({ state: ExtractorState.Running })
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
mockGetStatus.setup(async (x) => x(moq.It.isAny(), mockRunId)).returns(
|
|
282
|
+
async () => ({ state: ExtractorState.Succeeded })
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
mockGetReportMappings.setup(async (x) => x(moq.It.isAny(), mockReportId)).returns(
|
|
286
|
+
async () => ([{ imodelId: mockIModelId }])
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
const sut = new BulkExtractor(mockApiConfig, mockToastCallback, mockToastCallback);
|
|
290
|
+
await sut.runReportExtractions([mockReportId]);
|
|
291
|
+
|
|
292
|
+
let result = await sut.getReportState(mockReportId);
|
|
293
|
+
assert.strictEqual(result, ExtractionStates.Queued);
|
|
294
|
+
|
|
295
|
+
result = await sut.getReportState(mockReportId);
|
|
296
|
+
assert.strictEqual(result, ExtractionStates.Running);
|
|
297
|
+
|
|
298
|
+
result = await sut.getReportState(mockReportId);
|
|
299
|
+
assert.strictEqual(result, ExtractionStates.Succeeded);
|
|
300
|
+
});
|
|
301
|
+
});
|