@itwin/reports-config-widget-react 0.5.0 → 0.6.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.
Files changed (380) hide show
  1. package/CHANGELOG.json +47 -1
  2. package/CHANGELOG.md +14 -2
  3. package/LICENSE.md +9 -9
  4. package/README.md +38 -38
  5. package/__mocks__/fileMock.js +4 -4
  6. package/api/reports-config-widget-react.api.md +130 -0
  7. package/api/reports-config-widget-react.exports.csv +14 -0
  8. package/api/temp/reports-config-widget-react.api.md +130 -0
  9. package/coverage/clover.xml +505 -504
  10. package/coverage/coverage-final.json +32 -32
  11. package/coverage/lcov-report/index.html +24 -24
  12. package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +15 -15
  13. package/coverage/lcov-report/src/index.html +1 -1
  14. package/coverage/lcov-report/src/test/index.html +11 -11
  15. package/coverage/lcov-report/src/test/test-utils.tsx.html +46 -16
  16. package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +22 -64
  17. package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +5 -38
  18. package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +23 -119
  19. package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +117 -90
  20. package/coverage/lcov-report/src/widget/components/Constants.ts.html +5 -5
  21. package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +13 -103
  22. package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +6 -21
  23. package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +6 -21
  24. package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +7 -22
  25. package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +7 -28
  26. package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +6 -21
  27. package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +1 -1
  28. package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +20 -47
  29. package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +20 -11
  30. package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +16 -79
  31. package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +15 -108
  32. package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +36 -75
  33. package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +62 -92
  34. package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +104 -128
  35. package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +86 -299
  36. package/coverage/lcov-report/src/widget/components/Reports.tsx.html +40 -202
  37. package/coverage/lcov-report/src/widget/components/ReportsConfigContext.tsx.html +59 -44
  38. package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +10 -49
  39. package/coverage/lcov-report/src/widget/components/ReportsHeader.tsx.html +8 -47
  40. package/coverage/lcov-report/src/widget/components/ReportsRouter.tsx.html +6 -12
  41. package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +13 -25
  42. package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +11 -56
  43. package/coverage/lcov-report/src/widget/components/index.html +50 -50
  44. package/coverage/lcov-report/src/widget/components/utils.tsx.html +25 -169
  45. package/coverage/lcov-report/src/widget/context/BulkExtractorContext.tsx.html +6 -12
  46. package/coverage/lcov-report/src/widget/context/ReportsConfigApiContext.tsx.html +6 -12
  47. package/coverage/lcov-report/src/widget/context/index.html +1 -1
  48. package/coverage/lcov-report/src/widget/hooks/index.html +1 -1
  49. package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +12 -54
  50. package/coverage/lcov-report/src/widget/index.html +1 -1
  51. package/coverage/lcov.info +917 -893
  52. package/jest.config.js +14 -17
  53. package/lib/cjs/ReportsConfigWidget.d.ts +4 -0
  54. package/lib/cjs/ReportsConfigWidget.d.ts.map +1 -1
  55. package/lib/cjs/ReportsConfigWidget.js +4 -0
  56. package/lib/cjs/ReportsConfigWidget.js.map +1 -1
  57. package/lib/cjs/reports-config-widget-react.js +3 -3
  58. package/lib/cjs/reports-config-widget-react.js.map +1 -1
  59. package/lib/cjs/test/AddMappingModal.test.js +11 -10
  60. package/lib/cjs/test/AddMappingModal.test.js.map +1 -1
  61. package/lib/cjs/test/BulkExtractor.test.js +68 -43
  62. package/lib/cjs/test/BulkExtractor.test.js.map +1 -1
  63. package/lib/cjs/test/DeleteModal.test.js +3 -3
  64. package/lib/cjs/test/DeleteModal.test.js.map +1 -1
  65. package/lib/cjs/test/ReportAction.test.js +6 -4
  66. package/lib/cjs/test/ReportAction.test.js.map +1 -1
  67. package/lib/cjs/test/ReportMappingHorizontalTile.test.js +64 -25
  68. package/lib/cjs/test/ReportMappingHorizontalTile.test.js.map +1 -1
  69. package/lib/cjs/test/ReportMappings.test.js +39 -18
  70. package/lib/cjs/test/ReportMappings.test.js.map +1 -1
  71. package/lib/cjs/test/Reports.test.js +3 -3
  72. package/lib/cjs/test/Reports.test.js.map +1 -1
  73. package/lib/cjs/test/WidgetHeader.test.js +3 -3
  74. package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
  75. package/lib/cjs/test/test-utils.d.ts +8 -0
  76. package/lib/cjs/test/test-utils.d.ts.map +1 -1
  77. package/lib/cjs/test/test-utils.js +16 -4
  78. package/lib/cjs/test/test-utils.js.map +1 -1
  79. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  80. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts +7 -0
  81. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts.map +1 -1
  82. package/lib/cjs/widget/ReportsConfigUiProvider.js +8 -3
  83. package/lib/cjs/widget/ReportsConfigUiProvider.js.map +1 -1
  84. package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -1
  85. package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
  86. package/lib/cjs/widget/components/AddMappingsModal.d.ts +1 -1
  87. package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
  88. package/lib/cjs/widget/components/AddMappingsModal.js +7 -7
  89. package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
  90. package/lib/cjs/widget/components/AddMappingsModal.scss +1 -1
  91. package/lib/cjs/widget/components/BulkExtractor.d.ts +7 -4
  92. package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -1
  93. package/lib/cjs/widget/components/BulkExtractor.js +52 -35
  94. package/lib/cjs/widget/components/BulkExtractor.js.map +1 -1
  95. package/lib/cjs/widget/components/Constants.d.ts.map +1 -1
  96. package/lib/cjs/widget/components/Constants.js +3 -3
  97. package/lib/cjs/widget/components/Constants.js.map +1 -1
  98. package/lib/cjs/widget/components/DeleteModal.d.ts +1 -1
  99. package/lib/cjs/widget/components/DeleteModal.d.ts.map +1 -1
  100. package/lib/cjs/widget/components/DeleteModal.js +5 -5
  101. package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
  102. package/lib/cjs/widget/components/DeleteModal.scss +2 -2
  103. package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.d.ts.map +1 -1
  104. package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.js +3 -3
  105. package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.js.map +1 -1
  106. package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.d.ts.map +1 -1
  107. package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.js +3 -3
  108. package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.js.map +1 -1
  109. package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.d.ts.map +1 -1
  110. package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js +3 -3
  111. package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -1
  112. package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.d.ts.map +1 -1
  113. package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.js +3 -3
  114. package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.js.map +1 -1
  115. package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -1
  116. package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js +3 -3
  117. package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -1
  118. package/lib/cjs/widget/components/ExtractionStatus.d.ts +1 -1
  119. package/lib/cjs/widget/components/ExtractionStatus.d.ts.map +1 -1
  120. package/lib/cjs/widget/components/ExtractionStatus.js +9 -9
  121. package/lib/cjs/widget/components/ExtractionStatus.js.map +1 -1
  122. package/lib/cjs/widget/components/ExtractionStatus.scss +1 -1
  123. package/lib/cjs/widget/components/ExtractionToast.d.ts.map +1 -1
  124. package/lib/cjs/widget/components/ExtractionToast.js +3 -3
  125. package/lib/cjs/widget/components/ExtractionToast.js.map +1 -1
  126. package/lib/cjs/widget/components/HorizontalTile.d.ts.map +1 -1
  127. package/lib/cjs/widget/components/HorizontalTile.js +1 -2
  128. package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
  129. package/lib/cjs/widget/components/HorizontalTile.scss +1 -4
  130. package/lib/cjs/widget/components/LocalizedTablePaginator.d.ts.map +1 -1
  131. package/lib/cjs/widget/components/LocalizedTablePaginator.js +1 -1
  132. package/lib/cjs/widget/components/LocalizedTablePaginator.js.map +1 -1
  133. package/lib/cjs/widget/components/ReportAction.d.ts +8 -0
  134. package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -1
  135. package/lib/cjs/widget/components/ReportAction.js +9 -7
  136. package/lib/cjs/widget/components/ReportAction.js.map +1 -1
  137. package/lib/cjs/widget/components/ReportAction.scss +1 -1
  138. package/lib/cjs/widget/components/ReportHorizontalTile.d.ts.map +1 -1
  139. package/lib/cjs/widget/components/ReportHorizontalTile.js +4 -4
  140. package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -1
  141. package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
  142. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js +46 -45
  143. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js.map +1 -1
  144. package/lib/cjs/widget/components/ReportMappings.d.ts +8 -0
  145. package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
  146. package/lib/cjs/widget/components/ReportMappings.js +25 -11
  147. package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
  148. package/lib/cjs/widget/components/Reports.d.ts +9 -1
  149. package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
  150. package/lib/cjs/widget/components/Reports.js +7 -8
  151. package/lib/cjs/widget/components/Reports.js.map +1 -1
  152. package/lib/cjs/widget/components/Reports.scss +0 -1
  153. package/lib/cjs/widget/components/ReportsConfigContext.d.ts +8 -0
  154. package/lib/cjs/widget/components/ReportsConfigContext.d.ts.map +1 -1
  155. package/lib/cjs/widget/components/ReportsConfigContext.js +13 -5
  156. package/lib/cjs/widget/components/ReportsConfigContext.js.map +1 -1
  157. package/lib/cjs/widget/components/ReportsContainer.d.ts +1 -1
  158. package/lib/cjs/widget/components/ReportsContainer.d.ts.map +1 -1
  159. package/lib/cjs/widget/components/ReportsContainer.js +2 -4
  160. package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
  161. package/lib/cjs/widget/components/ReportsContainer.scss +1 -1
  162. package/lib/cjs/widget/components/ReportsHeader.d.ts +1 -1
  163. package/lib/cjs/widget/components/ReportsHeader.d.ts.map +1 -1
  164. package/lib/cjs/widget/components/ReportsHeader.js +6 -7
  165. package/lib/cjs/widget/components/ReportsHeader.js.map +1 -1
  166. package/lib/cjs/widget/components/ReportsRouter.d.ts.map +1 -1
  167. package/lib/cjs/widget/components/ReportsRouter.js +3 -3
  168. package/lib/cjs/widget/components/ReportsRouter.js.map +1 -1
  169. package/lib/cjs/widget/components/SearchBar.d.ts +1 -1
  170. package/lib/cjs/widget/components/SearchBar.d.ts.map +1 -1
  171. package/lib/cjs/widget/components/SearchBar.js +4 -4
  172. package/lib/cjs/widget/components/SearchBar.js.map +1 -1
  173. package/lib/cjs/widget/components/SelectIModel.d.ts +1 -1
  174. package/lib/cjs/widget/components/SelectIModel.d.ts.map +1 -1
  175. package/lib/cjs/widget/components/SelectIModel.js +1 -1
  176. package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
  177. package/lib/cjs/widget/components/SelectIModel.scss +1 -1
  178. package/lib/cjs/widget/components/utils.d.ts +1 -1
  179. package/lib/cjs/widget/components/utils.d.ts.map +1 -1
  180. package/lib/cjs/widget/components/utils.js +5 -5
  181. package/lib/cjs/widget/components/utils.js.map +1 -1
  182. package/lib/cjs/widget/components/utils.scss +1 -1
  183. package/lib/cjs/widget/context/BulkExtractorContext.d.ts.map +1 -1
  184. package/lib/cjs/widget/context/BulkExtractorContext.js.map +1 -1
  185. package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts.map +1 -1
  186. package/lib/cjs/widget/context/ReportsConfigApiContext.js.map +1 -1
  187. package/lib/cjs/widget/hooks/useValidator.d.ts +1 -4
  188. package/lib/cjs/widget/hooks/useValidator.d.ts.map +1 -1
  189. package/lib/cjs/widget/hooks/useValidator.js +3 -3
  190. package/lib/cjs/widget/hooks/useValidator.js.map +1 -1
  191. package/lib/esm/ReportsConfigWidget.d.ts +4 -0
  192. package/lib/esm/ReportsConfigWidget.d.ts.map +1 -1
  193. package/lib/esm/ReportsConfigWidget.js +4 -0
  194. package/lib/esm/ReportsConfigWidget.js.map +1 -1
  195. package/lib/esm/reports-config-widget-react.js +3 -3
  196. package/lib/esm/reports-config-widget-react.js.map +1 -1
  197. package/lib/esm/test/AddMappingModal.test.js +12 -11
  198. package/lib/esm/test/AddMappingModal.test.js.map +1 -1
  199. package/lib/esm/test/BulkExtractor.test.js +69 -44
  200. package/lib/esm/test/BulkExtractor.test.js.map +1 -1
  201. package/lib/esm/test/DeleteModal.test.js +4 -4
  202. package/lib/esm/test/DeleteModal.test.js.map +1 -1
  203. package/lib/esm/test/ReportAction.test.js +7 -5
  204. package/lib/esm/test/ReportAction.test.js.map +1 -1
  205. package/lib/esm/test/ReportMappingHorizontalTile.test.js +65 -26
  206. package/lib/esm/test/ReportMappingHorizontalTile.test.js.map +1 -1
  207. package/lib/esm/test/ReportMappings.test.js +41 -20
  208. package/lib/esm/test/ReportMappings.test.js.map +1 -1
  209. package/lib/esm/test/Reports.test.js +4 -4
  210. package/lib/esm/test/Reports.test.js.map +1 -1
  211. package/lib/esm/test/WidgetHeader.test.js +3 -3
  212. package/lib/esm/test/WidgetHeader.test.js.map +1 -1
  213. package/lib/esm/test/test-utils.d.ts +8 -0
  214. package/lib/esm/test/test-utils.d.ts.map +1 -1
  215. package/lib/esm/test/test-utils.js +15 -3
  216. package/lib/esm/test/test-utils.js.map +1 -1
  217. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  218. package/lib/esm/widget/ReportsConfigUiProvider.d.ts +7 -0
  219. package/lib/esm/widget/ReportsConfigUiProvider.d.ts.map +1 -1
  220. package/lib/esm/widget/ReportsConfigUiProvider.js +9 -4
  221. package/lib/esm/widget/ReportsConfigUiProvider.js.map +1 -1
  222. package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -1
  223. package/lib/esm/widget/components/ActionPanel.js.map +1 -1
  224. package/lib/esm/widget/components/AddMappingsModal.d.ts +1 -1
  225. package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
  226. package/lib/esm/widget/components/AddMappingsModal.js +7 -7
  227. package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
  228. package/lib/esm/widget/components/AddMappingsModal.scss +1 -1
  229. package/lib/esm/widget/components/BulkExtractor.d.ts +7 -4
  230. package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -1
  231. package/lib/esm/widget/components/BulkExtractor.js +53 -36
  232. package/lib/esm/widget/components/BulkExtractor.js.map +1 -1
  233. package/lib/esm/widget/components/Constants.d.ts.map +1 -1
  234. package/lib/esm/widget/components/Constants.js +3 -3
  235. package/lib/esm/widget/components/Constants.js.map +1 -1
  236. package/lib/esm/widget/components/DeleteModal.d.ts +1 -1
  237. package/lib/esm/widget/components/DeleteModal.d.ts.map +1 -1
  238. package/lib/esm/widget/components/DeleteModal.js +6 -6
  239. package/lib/esm/widget/components/DeleteModal.js.map +1 -1
  240. package/lib/esm/widget/components/DeleteModal.scss +2 -2
  241. package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.d.ts.map +1 -1
  242. package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.js +3 -3
  243. package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.js.map +1 -1
  244. package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.d.ts.map +1 -1
  245. package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.js +3 -3
  246. package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.js.map +1 -1
  247. package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.d.ts.map +1 -1
  248. package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js +3 -3
  249. package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -1
  250. package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.d.ts.map +1 -1
  251. package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.js +3 -3
  252. package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.js.map +1 -1
  253. package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -1
  254. package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js +3 -3
  255. package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -1
  256. package/lib/esm/widget/components/ExtractionStatus.d.ts +1 -1
  257. package/lib/esm/widget/components/ExtractionStatus.d.ts.map +1 -1
  258. package/lib/esm/widget/components/ExtractionStatus.js +9 -9
  259. package/lib/esm/widget/components/ExtractionStatus.js.map +1 -1
  260. package/lib/esm/widget/components/ExtractionStatus.scss +1 -1
  261. package/lib/esm/widget/components/ExtractionToast.d.ts.map +1 -1
  262. package/lib/esm/widget/components/ExtractionToast.js +3 -3
  263. package/lib/esm/widget/components/ExtractionToast.js.map +1 -1
  264. package/lib/esm/widget/components/HorizontalTile.d.ts.map +1 -1
  265. package/lib/esm/widget/components/HorizontalTile.js +1 -2
  266. package/lib/esm/widget/components/HorizontalTile.js.map +1 -1
  267. package/lib/esm/widget/components/HorizontalTile.scss +1 -4
  268. package/lib/esm/widget/components/LocalizedTablePaginator.d.ts.map +1 -1
  269. package/lib/esm/widget/components/LocalizedTablePaginator.js +1 -1
  270. package/lib/esm/widget/components/LocalizedTablePaginator.js.map +1 -1
  271. package/lib/esm/widget/components/ReportAction.d.ts +8 -0
  272. package/lib/esm/widget/components/ReportAction.d.ts.map +1 -1
  273. package/lib/esm/widget/components/ReportAction.js +10 -8
  274. package/lib/esm/widget/components/ReportAction.js.map +1 -1
  275. package/lib/esm/widget/components/ReportAction.scss +1 -1
  276. package/lib/esm/widget/components/ReportHorizontalTile.d.ts.map +1 -1
  277. package/lib/esm/widget/components/ReportHorizontalTile.js +6 -6
  278. package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -1
  279. package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
  280. package/lib/esm/widget/components/ReportMappingHorizontalTile.js +47 -46
  281. package/lib/esm/widget/components/ReportMappingHorizontalTile.js.map +1 -1
  282. package/lib/esm/widget/components/ReportMappings.d.ts +8 -0
  283. package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
  284. package/lib/esm/widget/components/ReportMappings.js +28 -14
  285. package/lib/esm/widget/components/ReportMappings.js.map +1 -1
  286. package/lib/esm/widget/components/Reports.d.ts +9 -1
  287. package/lib/esm/widget/components/Reports.d.ts.map +1 -1
  288. package/lib/esm/widget/components/Reports.js +8 -9
  289. package/lib/esm/widget/components/Reports.js.map +1 -1
  290. package/lib/esm/widget/components/Reports.scss +0 -1
  291. package/lib/esm/widget/components/ReportsConfigContext.d.ts +8 -0
  292. package/lib/esm/widget/components/ReportsConfigContext.d.ts.map +1 -1
  293. package/lib/esm/widget/components/ReportsConfigContext.js +14 -6
  294. package/lib/esm/widget/components/ReportsConfigContext.js.map +1 -1
  295. package/lib/esm/widget/components/ReportsContainer.d.ts +1 -1
  296. package/lib/esm/widget/components/ReportsContainer.d.ts.map +1 -1
  297. package/lib/esm/widget/components/ReportsContainer.js +2 -4
  298. package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
  299. package/lib/esm/widget/components/ReportsContainer.scss +1 -1
  300. package/lib/esm/widget/components/ReportsHeader.d.ts +1 -1
  301. package/lib/esm/widget/components/ReportsHeader.d.ts.map +1 -1
  302. package/lib/esm/widget/components/ReportsHeader.js +6 -7
  303. package/lib/esm/widget/components/ReportsHeader.js.map +1 -1
  304. package/lib/esm/widget/components/ReportsRouter.d.ts.map +1 -1
  305. package/lib/esm/widget/components/ReportsRouter.js +3 -3
  306. package/lib/esm/widget/components/ReportsRouter.js.map +1 -1
  307. package/lib/esm/widget/components/SearchBar.d.ts +1 -1
  308. package/lib/esm/widget/components/SearchBar.d.ts.map +1 -1
  309. package/lib/esm/widget/components/SearchBar.js +4 -4
  310. package/lib/esm/widget/components/SearchBar.js.map +1 -1
  311. package/lib/esm/widget/components/SelectIModel.d.ts +1 -1
  312. package/lib/esm/widget/components/SelectIModel.d.ts.map +1 -1
  313. package/lib/esm/widget/components/SelectIModel.js +2 -2
  314. package/lib/esm/widget/components/SelectIModel.js.map +1 -1
  315. package/lib/esm/widget/components/SelectIModel.scss +1 -1
  316. package/lib/esm/widget/components/utils.d.ts +1 -1
  317. package/lib/esm/widget/components/utils.d.ts.map +1 -1
  318. package/lib/esm/widget/components/utils.js +6 -6
  319. package/lib/esm/widget/components/utils.js.map +1 -1
  320. package/lib/esm/widget/components/utils.scss +1 -1
  321. package/lib/esm/widget/context/BulkExtractorContext.d.ts.map +1 -1
  322. package/lib/esm/widget/context/BulkExtractorContext.js.map +1 -1
  323. package/lib/esm/widget/context/ReportsConfigApiContext.d.ts.map +1 -1
  324. package/lib/esm/widget/context/ReportsConfigApiContext.js.map +1 -1
  325. package/lib/esm/widget/hooks/useValidator.d.ts +1 -4
  326. package/lib/esm/widget/hooks/useValidator.d.ts.map +1 -1
  327. package/lib/esm/widget/hooks/useValidator.js +3 -3
  328. package/lib/esm/widget/hooks/useValidator.js.map +1 -1
  329. package/package.json +9 -4
  330. package/src/ReportsConfigWidget.ts +9 -9
  331. package/src/reports-config-widget-react.ts +3 -3
  332. package/src/test/AddMappingModal.test.tsx +45 -70
  333. package/src/test/BulkExtractor.test.ts +73 -118
  334. package/src/test/DeleteModal.test.tsx +6 -23
  335. package/src/test/ReportAction.test.tsx +20 -38
  336. package/src/test/ReportMappingHorizontalTile.test.tsx +137 -106
  337. package/src/test/ReportMappings.test.tsx +73 -88
  338. package/src/test/Reports.test.tsx +30 -64
  339. package/src/test/WidgetHeader.test.tsx +3 -3
  340. package/src/test/test-utils.tsx +18 -8
  341. package/src/widget/ReportsConfigUiProvider.tsx +16 -30
  342. package/src/widget/components/ActionPanel.tsx +3 -14
  343. package/src/widget/components/AddMappingsModal.scss +1 -1
  344. package/src/widget/components/AddMappingsModal.tsx +19 -51
  345. package/src/widget/components/BulkExtractor.ts +63 -54
  346. package/src/widget/components/Constants.ts +4 -4
  347. package/src/widget/components/DeleteModal.scss +2 -2
  348. package/src/widget/components/DeleteModal.tsx +11 -41
  349. package/src/widget/components/ExtractionStates/FailedExtractionState.tsx +4 -9
  350. package/src/widget/components/ExtractionStates/QueuedExtractionState.tsx +4 -9
  351. package/src/widget/components/ExtractionStates/RunningExtractionState.tsx +4 -9
  352. package/src/widget/components/ExtractionStates/StartingExtractionState.tsx +4 -11
  353. package/src/widget/components/ExtractionStates/SucceededExtractionState.tsx +4 -9
  354. package/src/widget/components/ExtractionStatus.scss +1 -1
  355. package/src/widget/components/ExtractionStatus.tsx +9 -18
  356. package/src/widget/components/ExtractionToast.tsx +12 -9
  357. package/src/widget/components/HorizontalTile.scss +1 -4
  358. package/src/widget/components/HorizontalTile.tsx +12 -33
  359. package/src/widget/components/LocalizedTablePaginator.tsx +13 -44
  360. package/src/widget/components/ReportAction.scss +1 -1
  361. package/src/widget/components/ReportAction.tsx +26 -39
  362. package/src/widget/components/ReportHorizontalTile.tsx +45 -55
  363. package/src/widget/components/ReportMappingHorizontalTile.tsx +70 -78
  364. package/src/widget/components/ReportMappings.tsx +59 -130
  365. package/src/widget/components/Reports.scss +0 -1
  366. package/src/widget/components/Reports.tsx +28 -82
  367. package/src/widget/components/ReportsConfigContext.tsx +30 -25
  368. package/src/widget/components/ReportsContainer.scss +1 -1
  369. package/src/widget/components/ReportsContainer.tsx +8 -21
  370. package/src/widget/components/ReportsHeader.tsx +6 -19
  371. package/src/widget/components/ReportsRouter.tsx +4 -6
  372. package/src/widget/components/SearchBar.tsx +9 -13
  373. package/src/widget/components/SelectIModel.scss +1 -1
  374. package/src/widget/components/SelectIModel.tsx +9 -24
  375. package/src/widget/components/utils.scss +1 -1
  376. package/src/widget/components/utils.tsx +21 -69
  377. package/src/widget/context/BulkExtractorContext.tsx +4 -6
  378. package/src/widget/context/ReportsConfigApiContext.tsx +4 -6
  379. package/src/widget/hooks/useValidator.ts +10 -24
  380. package/tsconfig.json +11 -11
@@ -1,12 +1,13 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  import React from "react";
6
6
  import "@testing-library/jest-dom";
7
7
  import { ReportsConfigWidget } from "../ReportsConfigWidget";
8
8
  import {
9
9
  act,
10
+ mockExtractionRequestDetails,
10
11
  mockIModelId1,
11
12
  mockIModelId2,
12
13
  mockIModelsResponse,
@@ -18,16 +19,8 @@ import {
18
19
  within,
19
20
  } from "./test-utils";
20
21
  import * as moq from "typemoq";
21
- import type {
22
- MappingsClient,
23
- MappingSingle,
24
- Report,
25
- ReportMappingCollection,
26
- } from "@itwin/insights-client";
27
- import {
28
- ExtractionClient,
29
- ReportsClient,
30
- } from "@itwin/insights-client";
22
+ import type { MappingContainer, MappingsClient, Report, ReportMappingCollection } from "@itwin/insights-client";
23
+ import { ExtractionClient, ReportsClient } from "@itwin/insights-client";
31
24
  import { ReportMappings } from "../widget/components/ReportMappings";
32
25
  import type { GetSingleIModelParams, IModelsClient } from "@itwin/imodels-client-management";
33
26
  import { BulkExtractor } from "../widget/components/BulkExtractor";
@@ -108,29 +101,25 @@ const mockReportMappingsFactory = (): ReportMappingCollection => {
108
101
  };
109
102
  };
110
103
 
111
- const mockMappingsFactory = (
112
- mockReportMappings: ReportMappingCollection
113
- ): MappingSingle[] => {
114
- const mockMappings: MappingSingle[] = mockReportMappings.mappings.map(
115
- (mapping, index) => ({
116
- mapping: {
117
- id: mapping.mappingId,
118
- mappingName: `mOcKMaPpIngNaMe${index}`,
119
- description: `mOcKmApPInGDeScRiPtIoN${index}`,
120
- extractionEnabled: false,
121
- createdOn: "",
122
- createdBy: "",
123
- modifiedOn: "",
124
- modifiedBy: "",
125
- _links: {
126
- imodel: {
127
- // Tie the mapping to to the iModel Id
128
- href: mapping.imodelId,
129
- },
104
+ const mockMappingsFactory = (mockReportMappings: ReportMappingCollection): MappingContainer[] => {
105
+ const mockMappings: MappingContainer[] = mockReportMappings.mappings.map((mapping, index) => ({
106
+ mapping: {
107
+ id: mapping.mappingId,
108
+ mappingName: `mOcKMaPpIngNaMe${index}`,
109
+ description: `mOcKmApPInGDeScRiPtIoN${index}`,
110
+ extractionEnabled: false,
111
+ createdOn: "",
112
+ createdBy: "",
113
+ modifiedOn: "",
114
+ modifiedBy: "",
115
+ _links: {
116
+ iModel: {
117
+ // Tie the mapping to to the iModel Id
118
+ href: mapping.imodelId,
130
119
  },
131
120
  },
132
- })
133
- );
121
+ },
122
+ }));
134
123
 
135
124
  return mockMappings;
136
125
  };
@@ -142,10 +131,12 @@ jest.mock("../widget/components/Constants.ts", () => ({
142
131
 
143
132
  jest.mock("../widget/components/ReportMappingHorizontalTile", () => ({
144
133
  ReportMappingHorizontalTile: (props: ReportMappingHorizontalTileProps) => {
145
- return (<div data-testid="horizontal-tile">
146
- <Text>{props.mapping.mappingName}</Text>
147
- <Text title={props.mapping.mappingDescription}>{props.mapping.iModelName}</Text>
148
- </div>);
134
+ return (
135
+ <div data-testid="horizontal-tile">
136
+ <Text>{props.mapping.mappingName}</Text>
137
+ <Text title={props.mapping.mappingDescription}>{props.mapping.iModelName}</Text>
138
+ </div>
139
+ );
149
140
  },
150
141
  }));
151
142
 
@@ -178,15 +169,16 @@ const mockMappingsClient = moq.Mock.ofType<MappingsClient>();
178
169
  beforeAll(async () => {
179
170
  const localization = new EmptyLocalization();
180
171
  await ReportsConfigWidget.initialize(localization);
181
- mockIModelsClientOperations.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))
172
+ mockIModelsClientOperations
173
+ .setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId1 })))
182
174
  .returns(async () => mockIModelsResponse[0].iModel);
183
- mockIModelsClientOperations.setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))
175
+ mockIModelsClientOperations
176
+ .setup(async (x) => x.getSingle(moq.It.isObjectWith<GetSingleIModelParams>({ iModelId: mockIModelId2 })))
184
177
  .returns(async () => mockIModelsResponse[1].iModel);
185
- mockIModelsClient.setup((x) => x.iModels)
186
- .returns(() => mockIModelsClientOperations.object);
178
+ mockIModelsClient.setup((x) => x.iModels).returns(() => mockIModelsClientOperations.object);
187
179
  mockReportsClient.setup(async (x) => x.getReportMappings(moq.It.isAny(), moq.It.isAny())).returns(mockGetReportMappings);
188
180
  mockMappingsClient.setup(async (x) => x.getMappings(moq.It.isAny(), moq.It.isAny())).returns(mockGetMappings);
189
- mockMappingsClient.setup(async (x) => x.getMapping(moq.It.isAny(), moq.It.isAny(), moq.It.isAny())).returns(mockGetMapping);
181
+ mockMappingsClient.setup(async (x) => x.getMapping(moq.It.isAny(), moq.It.isAny())).returns(mockGetMapping);
190
182
  });
191
183
 
192
184
  afterEach(() => {
@@ -203,7 +195,11 @@ describe("Report Mappings View", () => {
203
195
  mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
204
196
  mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
205
197
 
206
- render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
198
+ render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
199
+ reportsClient: mockReportsClient.object,
200
+ mappingsClient: mockMappingsClient.object,
201
+ iModelsClient: mockIModelsClient.object,
202
+ });
207
203
 
208
204
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
209
205
 
@@ -218,7 +214,11 @@ describe("Report Mappings View", () => {
218
214
  mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
219
215
  mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
220
216
 
221
- const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
217
+ const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
218
+ reportsClient: mockReportsClient.object,
219
+ mappingsClient: mockMappingsClient.object,
220
+ iModelsClient: mockIModelsClient.object,
221
+ });
222
222
 
223
223
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
224
224
 
@@ -232,29 +232,20 @@ describe("Report Mappings View", () => {
232
232
  // Be an exact match on display name.
233
233
  await user.type(searchInput, mockMappings[0].mapping.mappingName);
234
234
  expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
235
- expect(
236
- screen.getByText(mockMappings[0].mapping.mappingName)
237
- ).toBeInTheDocument();
235
+ expect(screen.getByText(mockMappings[0].mapping.mappingName)).toBeInTheDocument();
238
236
 
239
237
  // Be an exact match on description.
240
238
  await user.clear(searchInput);
241
239
  await user.type(searchInput, mockMappings[0].mapping.description ?? "");
242
240
  expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
243
- expect(
244
- screen.getByTitle(mockMappings[0].mapping.description ?? "")
245
- ).toBeInTheDocument();
241
+ expect(screen.getByTitle(mockMappings[0].mapping.description ?? "")).toBeInTheDocument();
246
242
 
247
243
  // Be an exact match on iModel Name.
248
- const iModel = mockIModelsResponse.find(
249
- (mockIModel) =>
250
- mockIModel.iModel.id === mockMappings[0].mapping._links.imodel.href
251
- );
244
+ const iModel = mockIModelsResponse.find((mockIModel) => mockIModel.iModel.id === mockMappings[0].mapping._links.iModel.href);
252
245
  await user.clear(searchInput);
253
246
  await user.type(searchInput, iModel?.iModel.displayName ?? "");
254
247
  expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
255
- expect(
256
- screen.getByText(iModel?.iModel.displayName ?? "")
257
- ).toBeInTheDocument();
248
+ expect(screen.getByText(iModel?.iModel.displayName ?? "")).toBeInTheDocument();
258
249
  });
259
250
 
260
251
  it("add mapping", async () => {
@@ -264,11 +255,15 @@ describe("Report Mappings View", () => {
264
255
  mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
265
256
  mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
266
257
 
267
- const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
258
+ const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
259
+ reportsClient: mockReportsClient.object,
260
+ mappingsClient: mockMappingsClient.object,
261
+ iModelsClient: mockIModelsClient.object,
262
+ });
268
263
 
269
264
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
270
265
 
271
- mockGetMappings.mockReturnValueOnce(mockMappings.map((m: MappingSingle) => m.mapping));
266
+ mockGetMappings.mockReturnValueOnce(mockMappings.map((m: MappingContainer) => m.mapping));
272
267
 
273
268
  const addMappingButton = screen.getByRole("button", {
274
269
  name: /addmapping/i,
@@ -290,7 +285,11 @@ describe("Report Mappings View", () => {
290
285
  });
291
286
 
292
287
  it("odata feed url", async () => {
293
- const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object });
288
+ const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
289
+ reportsClient: mockReportsClient.object,
290
+ mappingsClient: mockMappingsClient.object,
291
+ iModelsClient: mockIModelsClient.object,
292
+ });
294
293
 
295
294
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
296
295
 
@@ -298,11 +297,7 @@ describe("Report Mappings View", () => {
298
297
  name: /odatafeedurl/i,
299
298
  });
300
299
  expect(urlTextbox).toBeInTheDocument();
301
- expect(
302
- screen.getByDisplayValue(
303
- `https://api.bentley.com/insights/reporting/odata/${mockReport.id}`
304
- )
305
- ).toBeInTheDocument();
300
+ expect(screen.getByDisplayValue(`https://api.bentley.com/insights/reporting/odata/${mockReport.id}`)).toBeInTheDocument();
306
301
 
307
302
  const copyButton = screen.getByRole("button", {
308
303
  name: /copy/i,
@@ -319,13 +314,16 @@ describe("Report Mappings View", () => {
319
314
  mockGetMapping.mockReturnValueOnce(mockMappings[0].mapping).mockReturnValueOnce(mockMappings[1].mapping);
320
315
  mockGetReportMappings.mockReturnValueOnce(mockReportMappings.mappings);
321
316
 
322
- const iModels = mockIModelsResponse.map((iModel) => iModel.iModel.id);
323
-
324
317
  const bulkExtractor = new BulkExtractor(new ReportsClient(), new ExtractionClient(), jest.fn().mockResolvedValue("mockAccessToken"), jest.fn, jest.fn);
325
318
 
326
319
  const runIModelExtractionsMock = jest.spyOn(bulkExtractor, "runIModelExtractions").mockImplementation(async () => Promise.resolve());
327
320
 
328
- const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, { reportsClient: mockReportsClient.object, mappingsClient: mockMappingsClient.object, iModelsClient: mockIModelsClient.object, bulkExtractor });
321
+ const { user } = render(<ReportMappings report={mockReport} onClickClose={jest.fn()} />, {
322
+ reportsClient: mockReportsClient.object,
323
+ mappingsClient: mockMappingsClient.object,
324
+ iModelsClient: mockIModelsClient.object,
325
+ bulkExtractor,
326
+ });
329
327
 
330
328
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
331
329
 
@@ -336,31 +334,18 @@ describe("Report Mappings View", () => {
336
334
  await waitFor(() => expect(extractAllButton).toBeEnabled());
337
335
 
338
336
  // Check that the mocked method was called with the expected arguments
339
- expect(runIModelExtractionsMock).toHaveBeenCalledWith(iModels);
337
+ expect(runIModelExtractionsMock).toHaveBeenCalledWith(mockExtractionRequestDetails);
340
338
  });
341
339
 
342
- const assertHorizontalTiles = (horizontalTiles: HTMLElement[], mockMappings: MappingSingle[]) => {
340
+ const assertHorizontalTiles = (horizontalTiles: HTMLElement[], mockMappings: MappingContainer[]) => {
343
341
  expect(horizontalTiles).toHaveLength(mockMappings.length);
344
342
 
345
343
  for (const [index, horizontalTile] of horizontalTiles.entries()) {
346
344
  const reportMappingTile = within(horizontalTile);
347
- const mockiModel = mockIModelsResponse.find(
348
- (iModel) =>
349
- iModel.iModel.id === mockMappings[index].mapping._links.imodel.href
350
- );
351
- expect(
352
- reportMappingTile.getByText(
353
- mockMappings[index].mapping.mappingName
354
- )
355
- ).toBeInTheDocument();
356
- expect(
357
- reportMappingTile.getByTitle(
358
- mockMappings[index].mapping.description ?? ""
359
- )
360
- ).toBeInTheDocument();
361
- expect(
362
- reportMappingTile.getByText(mockiModel?.iModel.displayName ?? "")
363
- ).toBeInTheDocument();
345
+ const mockiModel = mockIModelsResponse.find((iModel) => iModel.iModel.id === mockMappings[index].mapping._links.iModel.href);
346
+ expect(reportMappingTile.getByText(mockMappings[index].mapping.mappingName)).toBeInTheDocument();
347
+ expect(reportMappingTile.getByTitle(mockMappings[index].mapping.description ?? "")).toBeInTheDocument();
348
+ expect(reportMappingTile.getByText(mockiModel?.iModel.displayName ?? "")).toBeInTheDocument();
364
349
  }
365
350
  };
366
351
  });
@@ -1,15 +1,10 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  import React from "react";
6
6
  import "@testing-library/jest-dom";
7
- import {
8
- render,
9
- screen,
10
- waitForElementToBeRemoved,
11
- within,
12
- } from "../test/test-utils";
7
+ import { render, screen, waitForElementToBeRemoved, within } from "../test/test-utils";
13
8
  import { Reports } from "../widget/components/Reports";
14
9
  import { ReportsConfigWidget } from "../ReportsConfigWidget";
15
10
  import faker from "@faker-js/faker";
@@ -19,20 +14,17 @@ import { EmptyLocalization } from "@itwin/core-common";
19
14
  import * as moq from "typemoq";
20
15
 
21
16
  const reportsFactory = (): ReportCollection => ({
22
- reports: Array.from(
23
- { length: faker.datatype.number({ min: 3, max: 5 }) },
24
- (_, index) => ({
25
- id: `${faker.datatype.uuid()}`,
26
- displayName: `mOcKRePoRT${index}`,
27
- description: `mOcKRePoRTDeScRiPtIoN${index}`,
28
- deleted: false,
29
- _links: {
30
- project: {
31
- href: "",
32
- },
17
+ reports: Array.from({ length: faker.datatype.number({ min: 3, max: 5 }) }, (_, index) => ({
18
+ id: `${faker.datatype.uuid()}`,
19
+ displayName: `mOcKRePoRT${index}`,
20
+ description: `mOcKRePoRTDeScRiPtIoN${index}`,
21
+ deleted: false,
22
+ _links: {
23
+ project: {
24
+ href: "",
33
25
  },
34
- })
35
- ),
26
+ },
27
+ })),
36
28
  _links: {
37
29
  next: undefined,
38
30
  self: {
@@ -78,7 +70,7 @@ describe("Reports View", () => {
78
70
  mockGetReports.mockReturnValueOnce([]);
79
71
 
80
72
  const onClickAddMock = jest.fn();
81
- const { user } = render(<Reports onClickAddReport={onClickAddMock} />, { reportsClient: mockReportsClient.object });
73
+ const { user } = render(<Reports onClickAddReport={onClickAddMock} />, { reportsClient: mockReportsClient.object });
82
74
 
83
75
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
84
76
  const newButton = screen.getByRole("button", {
@@ -92,7 +84,7 @@ describe("Reports View", () => {
92
84
  const mockedReports: ReportCollection = reportsFactory();
93
85
  mockGetReports.mockReturnValueOnce(mockedReports.reports);
94
86
 
95
- render(<Reports />, { reportsClient: mockReportsClient.object });
87
+ render(<Reports />, { reportsClient: mockReportsClient.object });
96
88
 
97
89
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
98
90
  const horizontalTiles = screen.getAllByTestId("horizontal-tile");
@@ -101,16 +93,8 @@ describe("Reports View", () => {
101
93
 
102
94
  for (const [index, horizontalTile] of horizontalTiles.entries()) {
103
95
  const reportMappingTile = within(horizontalTile);
104
- expect(
105
- reportMappingTile.getByText(
106
- mockedReports?.reports[index].displayName ?? ""
107
- )
108
- ).toBeInTheDocument();
109
- expect(
110
- reportMappingTile.getByTitle(
111
- mockedReports?.reports[index].description ?? ""
112
- )
113
- ).toBeInTheDocument();
96
+ expect(reportMappingTile.getByText(mockedReports?.reports[index].displayName ?? "")).toBeInTheDocument();
97
+ expect(reportMappingTile.getByTitle(mockedReports?.reports[index].description ?? "")).toBeInTheDocument();
114
98
  }
115
99
  });
116
100
 
@@ -118,13 +102,11 @@ describe("Reports View", () => {
118
102
  const mockedReports: ReportCollection = reportsFactory();
119
103
  mockGetReports.mockReturnValueOnce(mockedReports.reports);
120
104
  const onClickModifyMock = jest.fn();
121
- const { user } = render(<Reports onClickReportModify={onClickModifyMock} />, { reportsClient: mockReportsClient.object });
105
+ const { user } = render(<Reports onClickReportModify={onClickModifyMock} />, { reportsClient: mockReportsClient.object });
122
106
 
123
107
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
124
108
 
125
- const firstMenuDropdown = within(
126
- screen.getAllByTestId(/tile-action-button/i)[0]
127
- ).getByRole("button");
109
+ const firstMenuDropdown = within(screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
128
110
  await user.click(firstMenuDropdown);
129
111
  const modifyButton = screen.getByRole("menuitem", { name: /modify/i });
130
112
  await user.click(modifyButton);
@@ -137,13 +119,11 @@ describe("Reports View", () => {
137
119
 
138
120
  mockGetReports.mockReturnValue(mockedReports.reports);
139
121
 
140
- const { user } = render(<Reports />, { reportsClient: mockReportsClient.object });
122
+ const { user } = render(<Reports />, { reportsClient: mockReportsClient.object });
141
123
 
142
124
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
143
125
 
144
- const firstMenuDropdown = within(
145
- screen.getAllByTestId(/tile-action-button/i)[0]
146
- ).getByRole("button");
126
+ const firstMenuDropdown = within(screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
147
127
  await user.click(firstMenuDropdown);
148
128
  const removeButton = screen.getByRole("menuitem", { name: /remove/i });
149
129
  await user.click(removeButton);
@@ -178,38 +158,26 @@ describe("Reports View", () => {
178
158
  });
179
159
 
180
160
  // Be an exact match on display name.
181
- await userEvent.type(
182
- searchInput,
183
- mockedReports.reports[0].displayName
184
- );
161
+ await userEvent.type(searchInput, mockedReports.reports[0].displayName);
185
162
  expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
186
- expect(
187
- screen.getByText(mockedReports.reports[0].displayName)
188
- ).toBeInTheDocument();
163
+ expect(screen.getByText(mockedReports.reports[0].displayName)).toBeInTheDocument();
189
164
 
190
165
  // Be an exact match on description.
191
166
  await userEvent.clear(searchInput);
192
- await userEvent.type(
193
- searchInput,
194
- mockedReports.reports[0].description ?? ""
195
- );
167
+ await userEvent.type(searchInput, mockedReports.reports[0].description ?? "");
196
168
  expect(screen.getAllByTestId("horizontal-tile")).toHaveLength(1);
197
- expect(
198
- screen.getByText(mockedReports.reports[0].displayName)
199
- ).toBeInTheDocument();
169
+ expect(screen.getByText(mockedReports.reports[0].displayName)).toBeInTheDocument();
200
170
  });
201
171
 
202
172
  it("modify a report", async () => {
203
173
  const mockedReports: ReportCollection = reportsFactory();
204
174
  mockGetReports.mockReturnValueOnce(mockedReports.reports);
205
175
  const onClickModifyMock = jest.fn();
206
- const { user } = render(<Reports onClickReportModify={onClickModifyMock} />, { reportsClient: mockReportsClient.object });
176
+ const { user } = render(<Reports onClickReportModify={onClickModifyMock} />, { reportsClient: mockReportsClient.object });
207
177
 
208
178
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
209
179
 
210
- const firstMenuDropdown = within(
211
- screen.getAllByTestId(/tile-action-button/i)[0]
212
- ).getByRole("button");
180
+ const firstMenuDropdown = within(screen.getAllByTestId(/tile-action-button/i)[0]).getByRole("button");
213
181
  await user.click(firstMenuDropdown);
214
182
  const modifyButton = screen.getByRole("menuitem", { name: /modify/i });
215
183
  await user.click(modifyButton);
@@ -220,13 +188,11 @@ describe("Reports View", () => {
220
188
  const mockedReports: ReportCollection = reportsFactory();
221
189
  mockGetReports.mockReturnValueOnce(mockedReports.reports);
222
190
  const onClickTitleMock = jest.fn();
223
- const { user } = render(<Reports onClickReportTitle={onClickTitleMock} />, { reportsClient: mockReportsClient.object });
191
+ const { user } = render(<Reports onClickReportTitle={onClickTitleMock} />, { reportsClient: mockReportsClient.object });
224
192
 
225
193
  await waitForElementToBeRemoved(() => screen.getByText(/loading/i));
226
194
 
227
- const reportName = screen.getByText(
228
- mockedReports.reports[0].displayName
229
- );
195
+ const reportName = screen.getByText(mockedReports.reports[0].displayName);
230
196
  await user.click(reportName);
231
197
  expect(onClickTitleMock).toBeCalled();
232
198
  });
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  import React from "react";
6
6
  import "@testing-library/jest-dom";
7
7
  import { render, screen } from "../test/test-utils";
@@ -1,7 +1,7 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  import * as React from "react";
6
6
  import { render as rtlRender } from "@testing-library/react";
7
7
  import userEvent from "@testing-library/user-event";
@@ -14,6 +14,9 @@ export const mockAccessToken = async () => "Bearer eyJhbGci";
14
14
  export const mockIModelId1 = "mockIModelId1";
15
15
  export const mockIModelId2 = "mockIModelId2";
16
16
 
17
+ export const mockMappingId1 = "mockMappingId1";
18
+ export const mockMappingId2 = "mockMappingId2";
19
+
17
20
  export const mockReportId = "mockReportId";
18
21
  export const mockITwinId: string = "mockiTwinId";
19
22
 
@@ -72,17 +75,24 @@ export const mockIModelsResponse = [
72
75
  },
73
76
  ];
74
77
 
78
+ export const mockExtractionRequestDetails = [
79
+ {
80
+ iModelId: mockIModelId1,
81
+ mappings: [{ id: mockMappingId1 }],
82
+ },
83
+ {
84
+ iModelId: mockIModelId2,
85
+ mappings: [{ id: mockMappingId2 }],
86
+ },
87
+ ];
88
+
75
89
  interface WrapperProps {
76
90
  children?: React.ReactNode;
77
91
  }
78
92
 
79
93
  function render(ui: React.ReactElement, contextProps?: Partial<ReportsConfigContextProps>, { ...options } = {}) {
80
94
  const Wrapper = ({ children }: WrapperProps) => (
81
- <ReportsConfigContext
82
- getAccessToken={mockAccessToken}
83
- iTwinId={contextProps?.iTwinId ?? mockITwinId}
84
- {...contextProps}
85
- >
95
+ <ReportsConfigContext getAccessToken={mockAccessToken} iTwinId={contextProps?.iTwinId ?? mockITwinId} {...contextProps}>
86
96
  {children}
87
97
  </ReportsConfigContext>
88
98
  );
@@ -1,54 +1,40 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- import type {
6
- UiItemsProvider,
7
- Widget,
8
- } from "@itwin/appui-react";
9
- import {
10
- StagePanelLocation,
11
- StagePanelSection,
12
- StageUsage,
13
- } from "@itwin/appui-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 type { UiItemsProvider, Widget } from "@itwin/appui-react";
6
+ import { StagePanelLocation, StagePanelSection, StageUsage } from "@itwin/appui-react";
14
7
  import type { AccessToken } from "@itwin/core-bentley";
15
8
 
16
9
  import * as React from "react";
17
10
  import { ReportsConfigWidget } from "../ReportsConfigWidget";
18
11
  import ReportsContainer from "./components/ReportsContainer";
19
12
 
13
+ /**
14
+ * @internal
15
+ */
20
16
  export const REPORTS_CONFIG_BASE_URL = "https://api.bentley.com";
21
17
 
18
+ /**
19
+ * Reports Config Widget UI Provider
20
+ * @public
21
+ */
22
22
  export class ReportsConfigProvider implements UiItemsProvider {
23
23
  public readonly id = "ReportsConfigProvider";
24
24
  private readonly _getAccessToken?: () => Promise<AccessToken>;
25
25
  private readonly _baseUrl: string;
26
26
 
27
- constructor(
28
- getAccessToken?: () => Promise<AccessToken>,
29
- baseUrl: string = REPORTS_CONFIG_BASE_URL
30
- ) {
27
+ constructor(getAccessToken?: () => Promise<AccessToken>, baseUrl: string = REPORTS_CONFIG_BASE_URL) {
31
28
  this._getAccessToken = getAccessToken;
32
29
  this._baseUrl = baseUrl;
33
30
  }
34
31
 
35
- public provideWidgets(
36
- _stageId: string,
37
- stageUsage: string,
38
- location: StagePanelLocation,
39
- section?: StagePanelSection
40
- ): ReadonlyArray<Widget> {
32
+ public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection): ReadonlyArray<Widget> {
41
33
  const widgets: Widget[] = [];
42
- if (
43
- location === StagePanelLocation.Left &&
44
- section === StagePanelSection.Start &&
45
- stageUsage === StageUsage.General
46
- ) {
34
+ if (location === StagePanelLocation.Left && section === StagePanelSection.Start && stageUsage === StageUsage.General) {
47
35
  const ReportsWidget: Widget = {
48
36
  id: "reports-config-widget",
49
- label: ReportsConfigWidget.localization.getLocalizedString(
50
- "ReportsConfigWidget:ReportsConfig"
51
- ),
37
+ label: ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:ReportsConfig"),
52
38
  content: <ReportsContainer getAccessToken={this._getAccessToken} baseUrl={this._baseUrl} />,
53
39
  };
54
40
 
@@ -28,23 +28,12 @@ const ActionPanel = ({
28
28
  return (
29
29
  <div className="rcw-action-panel">
30
30
  {isLoading && <LoadingSpinner />}
31
- <Button
32
- disabled={isSavingDisabled || isLoading}
33
- styleType="high-visibility"
34
- onClick={onAction}
35
- >
31
+ <Button disabled={isSavingDisabled || isLoading} styleType="high-visibility" onClick={onAction}>
36
32
  {actionLabel}
37
33
  </Button>
38
34
  {onCancel && (
39
- <Button
40
- styleType="default"
41
- type="button"
42
- onClick={onCancel}
43
- disabled={isCancelDisabled || isLoading}
44
- >
45
- {ReportsConfigWidget.localization.getLocalizedString(
46
- "ReportsConfigWidget:Cancel"
47
- )}
35
+ <Button styleType="default" type="button" onClick={onCancel} disabled={isCancelDisabled || isLoading}>
36
+ {ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Cancel")}
48
37
  </Button>
49
38
  )}
50
39
  </div>
@@ -15,4 +15,4 @@
15
15
  flex-grow: 1;
16
16
  overflow: auto;
17
17
  }
18
- }
18
+ }