@itwin/reports-config-widget-react 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (386) hide show
  1. package/CHANGELOG.json +76 -1
  2. package/CHANGELOG.md +27 -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 +126 -0
  7. package/api/reports-config-widget-react.exports.csv +14 -0
  8. package/api/temp/reports-config-widget-react.api.md +126 -0
  9. package/coverage/clover.xml +521 -521
  10. package/coverage/coverage-final.json +32 -32
  11. package/coverage/lcov-report/index.html +31 -31
  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 +29 -86
  17. package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +5 -38
  18. package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +25 -121
  19. package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +120 -96
  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 +88 -301
  36. package/coverage/lcov-report/src/widget/components/Reports.tsx.html +42 -204
  37. package/coverage/lcov-report/src/widget/components/ReportsConfigContext.tsx.html +164 -50
  38. package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +15 -63
  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 +10 -13
  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 +13 -13
  51. package/coverage/lcov.info +941 -919
  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.d.ts +1 -0
  58. package/lib/cjs/reports-config-widget-react.d.ts.map +1 -1
  59. package/lib/cjs/reports-config-widget-react.js +4 -3
  60. package/lib/cjs/reports-config-widget-react.js.map +1 -1
  61. package/lib/cjs/test/AddMappingModal.test.js +11 -10
  62. package/lib/cjs/test/AddMappingModal.test.js.map +1 -1
  63. package/lib/cjs/test/BulkExtractor.test.js +68 -43
  64. package/lib/cjs/test/BulkExtractor.test.js.map +1 -1
  65. package/lib/cjs/test/DeleteModal.test.js +3 -3
  66. package/lib/cjs/test/DeleteModal.test.js.map +1 -1
  67. package/lib/cjs/test/ReportAction.test.js +6 -4
  68. package/lib/cjs/test/ReportAction.test.js.map +1 -1
  69. package/lib/cjs/test/ReportMappingHorizontalTile.test.js +64 -25
  70. package/lib/cjs/test/ReportMappingHorizontalTile.test.js.map +1 -1
  71. package/lib/cjs/test/ReportMappings.test.js +39 -18
  72. package/lib/cjs/test/ReportMappings.test.js.map +1 -1
  73. package/lib/cjs/test/Reports.test.js +3 -3
  74. package/lib/cjs/test/Reports.test.js.map +1 -1
  75. package/lib/cjs/test/WidgetHeader.test.js +3 -3
  76. package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
  77. package/lib/cjs/test/test-utils.d.ts +8 -0
  78. package/lib/cjs/test/test-utils.d.ts.map +1 -1
  79. package/lib/cjs/test/test-utils.js +16 -4
  80. package/lib/cjs/test/test-utils.js.map +1 -1
  81. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  82. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts +10 -4
  83. package/lib/cjs/widget/ReportsConfigUiProvider.d.ts.map +1 -1
  84. package/lib/cjs/widget/ReportsConfigUiProvider.js +11 -7
  85. package/lib/cjs/widget/ReportsConfigUiProvider.js.map +1 -1
  86. package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -1
  87. package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
  88. package/lib/cjs/widget/components/AddMappingsModal.d.ts +1 -1
  89. package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
  90. package/lib/cjs/widget/components/AddMappingsModal.js +7 -7
  91. package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
  92. package/lib/cjs/widget/components/AddMappingsModal.scss +1 -1
  93. package/lib/cjs/widget/components/BulkExtractor.d.ts +8 -5
  94. package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -1
  95. package/lib/cjs/widget/components/BulkExtractor.js +52 -35
  96. package/lib/cjs/widget/components/BulkExtractor.js.map +1 -1
  97. package/lib/cjs/widget/components/Constants.d.ts.map +1 -1
  98. package/lib/cjs/widget/components/Constants.js +3 -3
  99. package/lib/cjs/widget/components/Constants.js.map +1 -1
  100. package/lib/cjs/widget/components/DeleteModal.d.ts +1 -1
  101. package/lib/cjs/widget/components/DeleteModal.d.ts.map +1 -1
  102. package/lib/cjs/widget/components/DeleteModal.js +5 -5
  103. package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
  104. package/lib/cjs/widget/components/DeleteModal.scss +2 -2
  105. package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.d.ts.map +1 -1
  106. package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.js +3 -3
  107. package/lib/cjs/widget/components/ExtractionStates/FailedExtractionState.js.map +1 -1
  108. package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.d.ts.map +1 -1
  109. package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.js +3 -3
  110. package/lib/cjs/widget/components/ExtractionStates/QueuedExtractionState.js.map +1 -1
  111. package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.d.ts.map +1 -1
  112. package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js +3 -3
  113. package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -1
  114. package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.d.ts.map +1 -1
  115. package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.js +3 -3
  116. package/lib/cjs/widget/components/ExtractionStates/StartingExtractionState.js.map +1 -1
  117. package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -1
  118. package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js +3 -3
  119. package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -1
  120. package/lib/cjs/widget/components/ExtractionStatus.d.ts +1 -1
  121. package/lib/cjs/widget/components/ExtractionStatus.d.ts.map +1 -1
  122. package/lib/cjs/widget/components/ExtractionStatus.js +9 -9
  123. package/lib/cjs/widget/components/ExtractionStatus.js.map +1 -1
  124. package/lib/cjs/widget/components/ExtractionStatus.scss +1 -1
  125. package/lib/cjs/widget/components/ExtractionToast.d.ts.map +1 -1
  126. package/lib/cjs/widget/components/ExtractionToast.js +3 -3
  127. package/lib/cjs/widget/components/ExtractionToast.js.map +1 -1
  128. package/lib/cjs/widget/components/HorizontalTile.d.ts.map +1 -1
  129. package/lib/cjs/widget/components/HorizontalTile.js +1 -2
  130. package/lib/cjs/widget/components/HorizontalTile.js.map +1 -1
  131. package/lib/cjs/widget/components/HorizontalTile.scss +1 -4
  132. package/lib/cjs/widget/components/LocalizedTablePaginator.d.ts.map +1 -1
  133. package/lib/cjs/widget/components/LocalizedTablePaginator.js +1 -1
  134. package/lib/cjs/widget/components/LocalizedTablePaginator.js.map +1 -1
  135. package/lib/cjs/widget/components/ReportAction.d.ts +8 -0
  136. package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -1
  137. package/lib/cjs/widget/components/ReportAction.js +9 -7
  138. package/lib/cjs/widget/components/ReportAction.js.map +1 -1
  139. package/lib/cjs/widget/components/ReportAction.scss +1 -1
  140. package/lib/cjs/widget/components/ReportHorizontalTile.d.ts.map +1 -1
  141. package/lib/cjs/widget/components/ReportHorizontalTile.js +4 -4
  142. package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -1
  143. package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
  144. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js +46 -45
  145. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js.map +1 -1
  146. package/lib/cjs/widget/components/ReportMappings.d.ts +8 -0
  147. package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
  148. package/lib/cjs/widget/components/ReportMappings.js +25 -11
  149. package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
  150. package/lib/cjs/widget/components/Reports.d.ts +9 -1
  151. package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
  152. package/lib/cjs/widget/components/Reports.js +7 -8
  153. package/lib/cjs/widget/components/Reports.js.map +1 -1
  154. package/lib/cjs/widget/components/Reports.scss +0 -1
  155. package/lib/cjs/widget/components/ReportsConfigContext.d.ts +34 -4
  156. package/lib/cjs/widget/components/ReportsConfigContext.d.ts.map +1 -1
  157. package/lib/cjs/widget/components/ReportsConfigContext.js +27 -9
  158. package/lib/cjs/widget/components/ReportsConfigContext.js.map +1 -1
  159. package/lib/cjs/widget/components/ReportsContainer.d.ts +3 -6
  160. package/lib/cjs/widget/components/ReportsContainer.d.ts.map +1 -1
  161. package/lib/cjs/widget/components/ReportsContainer.js +7 -5
  162. package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
  163. package/lib/cjs/widget/components/ReportsContainer.scss +1 -1
  164. package/lib/cjs/widget/components/ReportsHeader.d.ts +1 -1
  165. package/lib/cjs/widget/components/ReportsHeader.d.ts.map +1 -1
  166. package/lib/cjs/widget/components/ReportsHeader.js +6 -7
  167. package/lib/cjs/widget/components/ReportsHeader.js.map +1 -1
  168. package/lib/cjs/widget/components/ReportsRouter.d.ts.map +1 -1
  169. package/lib/cjs/widget/components/ReportsRouter.js +3 -3
  170. package/lib/cjs/widget/components/ReportsRouter.js.map +1 -1
  171. package/lib/cjs/widget/components/SearchBar.d.ts +1 -1
  172. package/lib/cjs/widget/components/SearchBar.d.ts.map +1 -1
  173. package/lib/cjs/widget/components/SearchBar.js +4 -4
  174. package/lib/cjs/widget/components/SearchBar.js.map +1 -1
  175. package/lib/cjs/widget/components/SelectIModel.d.ts +1 -1
  176. package/lib/cjs/widget/components/SelectIModel.d.ts.map +1 -1
  177. package/lib/cjs/widget/components/SelectIModel.js +1 -1
  178. package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
  179. package/lib/cjs/widget/components/SelectIModel.scss +1 -1
  180. package/lib/cjs/widget/components/utils.d.ts +1 -1
  181. package/lib/cjs/widget/components/utils.d.ts.map +1 -1
  182. package/lib/cjs/widget/components/utils.js +5 -5
  183. package/lib/cjs/widget/components/utils.js.map +1 -1
  184. package/lib/cjs/widget/components/utils.scss +1 -1
  185. package/lib/cjs/widget/context/BulkExtractorContext.d.ts.map +1 -1
  186. package/lib/cjs/widget/context/BulkExtractorContext.js.map +1 -1
  187. package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts +3 -3
  188. package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts.map +1 -1
  189. package/lib/cjs/widget/context/ReportsConfigApiContext.js.map +1 -1
  190. package/lib/cjs/widget/hooks/useValidator.d.ts +1 -4
  191. package/lib/cjs/widget/hooks/useValidator.d.ts.map +1 -1
  192. package/lib/cjs/widget/hooks/useValidator.js +3 -3
  193. package/lib/cjs/widget/hooks/useValidator.js.map +1 -1
  194. package/lib/esm/ReportsConfigWidget.d.ts +4 -0
  195. package/lib/esm/ReportsConfigWidget.d.ts.map +1 -1
  196. package/lib/esm/ReportsConfigWidget.js +4 -0
  197. package/lib/esm/ReportsConfigWidget.js.map +1 -1
  198. package/lib/esm/reports-config-widget-react.d.ts +1 -0
  199. package/lib/esm/reports-config-widget-react.d.ts.map +1 -1
  200. package/lib/esm/reports-config-widget-react.js +4 -3
  201. package/lib/esm/reports-config-widget-react.js.map +1 -1
  202. package/lib/esm/test/AddMappingModal.test.js +12 -11
  203. package/lib/esm/test/AddMappingModal.test.js.map +1 -1
  204. package/lib/esm/test/BulkExtractor.test.js +69 -44
  205. package/lib/esm/test/BulkExtractor.test.js.map +1 -1
  206. package/lib/esm/test/DeleteModal.test.js +4 -4
  207. package/lib/esm/test/DeleteModal.test.js.map +1 -1
  208. package/lib/esm/test/ReportAction.test.js +7 -5
  209. package/lib/esm/test/ReportAction.test.js.map +1 -1
  210. package/lib/esm/test/ReportMappingHorizontalTile.test.js +65 -26
  211. package/lib/esm/test/ReportMappingHorizontalTile.test.js.map +1 -1
  212. package/lib/esm/test/ReportMappings.test.js +41 -20
  213. package/lib/esm/test/ReportMappings.test.js.map +1 -1
  214. package/lib/esm/test/Reports.test.js +4 -4
  215. package/lib/esm/test/Reports.test.js.map +1 -1
  216. package/lib/esm/test/WidgetHeader.test.js +3 -3
  217. package/lib/esm/test/WidgetHeader.test.js.map +1 -1
  218. package/lib/esm/test/test-utils.d.ts +8 -0
  219. package/lib/esm/test/test-utils.d.ts.map +1 -1
  220. package/lib/esm/test/test-utils.js +15 -3
  221. package/lib/esm/test/test-utils.js.map +1 -1
  222. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  223. package/lib/esm/widget/ReportsConfigUiProvider.d.ts +10 -4
  224. package/lib/esm/widget/ReportsConfigUiProvider.d.ts.map +1 -1
  225. package/lib/esm/widget/ReportsConfigUiProvider.js +12 -8
  226. package/lib/esm/widget/ReportsConfigUiProvider.js.map +1 -1
  227. package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -1
  228. package/lib/esm/widget/components/ActionPanel.js.map +1 -1
  229. package/lib/esm/widget/components/AddMappingsModal.d.ts +1 -1
  230. package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
  231. package/lib/esm/widget/components/AddMappingsModal.js +7 -7
  232. package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
  233. package/lib/esm/widget/components/AddMappingsModal.scss +1 -1
  234. package/lib/esm/widget/components/BulkExtractor.d.ts +8 -5
  235. package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -1
  236. package/lib/esm/widget/components/BulkExtractor.js +53 -36
  237. package/lib/esm/widget/components/BulkExtractor.js.map +1 -1
  238. package/lib/esm/widget/components/Constants.d.ts.map +1 -1
  239. package/lib/esm/widget/components/Constants.js +3 -3
  240. package/lib/esm/widget/components/Constants.js.map +1 -1
  241. package/lib/esm/widget/components/DeleteModal.d.ts +1 -1
  242. package/lib/esm/widget/components/DeleteModal.d.ts.map +1 -1
  243. package/lib/esm/widget/components/DeleteModal.js +6 -6
  244. package/lib/esm/widget/components/DeleteModal.js.map +1 -1
  245. package/lib/esm/widget/components/DeleteModal.scss +2 -2
  246. package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.d.ts.map +1 -1
  247. package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.js +3 -3
  248. package/lib/esm/widget/components/ExtractionStates/FailedExtractionState.js.map +1 -1
  249. package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.d.ts.map +1 -1
  250. package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.js +3 -3
  251. package/lib/esm/widget/components/ExtractionStates/QueuedExtractionState.js.map +1 -1
  252. package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.d.ts.map +1 -1
  253. package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js +3 -3
  254. package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -1
  255. package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.d.ts.map +1 -1
  256. package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.js +3 -3
  257. package/lib/esm/widget/components/ExtractionStates/StartingExtractionState.js.map +1 -1
  258. package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -1
  259. package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js +3 -3
  260. package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -1
  261. package/lib/esm/widget/components/ExtractionStatus.d.ts +1 -1
  262. package/lib/esm/widget/components/ExtractionStatus.d.ts.map +1 -1
  263. package/lib/esm/widget/components/ExtractionStatus.js +9 -9
  264. package/lib/esm/widget/components/ExtractionStatus.js.map +1 -1
  265. package/lib/esm/widget/components/ExtractionStatus.scss +1 -1
  266. package/lib/esm/widget/components/ExtractionToast.d.ts.map +1 -1
  267. package/lib/esm/widget/components/ExtractionToast.js +3 -3
  268. package/lib/esm/widget/components/ExtractionToast.js.map +1 -1
  269. package/lib/esm/widget/components/HorizontalTile.d.ts.map +1 -1
  270. package/lib/esm/widget/components/HorizontalTile.js +1 -2
  271. package/lib/esm/widget/components/HorizontalTile.js.map +1 -1
  272. package/lib/esm/widget/components/HorizontalTile.scss +1 -4
  273. package/lib/esm/widget/components/LocalizedTablePaginator.d.ts.map +1 -1
  274. package/lib/esm/widget/components/LocalizedTablePaginator.js +1 -1
  275. package/lib/esm/widget/components/LocalizedTablePaginator.js.map +1 -1
  276. package/lib/esm/widget/components/ReportAction.d.ts +8 -0
  277. package/lib/esm/widget/components/ReportAction.d.ts.map +1 -1
  278. package/lib/esm/widget/components/ReportAction.js +10 -8
  279. package/lib/esm/widget/components/ReportAction.js.map +1 -1
  280. package/lib/esm/widget/components/ReportAction.scss +1 -1
  281. package/lib/esm/widget/components/ReportHorizontalTile.d.ts.map +1 -1
  282. package/lib/esm/widget/components/ReportHorizontalTile.js +6 -6
  283. package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -1
  284. package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
  285. package/lib/esm/widget/components/ReportMappingHorizontalTile.js +47 -46
  286. package/lib/esm/widget/components/ReportMappingHorizontalTile.js.map +1 -1
  287. package/lib/esm/widget/components/ReportMappings.d.ts +8 -0
  288. package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
  289. package/lib/esm/widget/components/ReportMappings.js +28 -14
  290. package/lib/esm/widget/components/ReportMappings.js.map +1 -1
  291. package/lib/esm/widget/components/Reports.d.ts +9 -1
  292. package/lib/esm/widget/components/Reports.d.ts.map +1 -1
  293. package/lib/esm/widget/components/Reports.js +8 -9
  294. package/lib/esm/widget/components/Reports.js.map +1 -1
  295. package/lib/esm/widget/components/Reports.scss +0 -1
  296. package/lib/esm/widget/components/ReportsConfigContext.d.ts +34 -4
  297. package/lib/esm/widget/components/ReportsConfigContext.d.ts.map +1 -1
  298. package/lib/esm/widget/components/ReportsConfigContext.js +28 -10
  299. package/lib/esm/widget/components/ReportsConfigContext.js.map +1 -1
  300. package/lib/esm/widget/components/ReportsContainer.d.ts +3 -6
  301. package/lib/esm/widget/components/ReportsContainer.d.ts.map +1 -1
  302. package/lib/esm/widget/components/ReportsContainer.js +7 -5
  303. package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
  304. package/lib/esm/widget/components/ReportsContainer.scss +1 -1
  305. package/lib/esm/widget/components/ReportsHeader.d.ts +1 -1
  306. package/lib/esm/widget/components/ReportsHeader.d.ts.map +1 -1
  307. package/lib/esm/widget/components/ReportsHeader.js +6 -7
  308. package/lib/esm/widget/components/ReportsHeader.js.map +1 -1
  309. package/lib/esm/widget/components/ReportsRouter.d.ts.map +1 -1
  310. package/lib/esm/widget/components/ReportsRouter.js +3 -3
  311. package/lib/esm/widget/components/ReportsRouter.js.map +1 -1
  312. package/lib/esm/widget/components/SearchBar.d.ts +1 -1
  313. package/lib/esm/widget/components/SearchBar.d.ts.map +1 -1
  314. package/lib/esm/widget/components/SearchBar.js +4 -4
  315. package/lib/esm/widget/components/SearchBar.js.map +1 -1
  316. package/lib/esm/widget/components/SelectIModel.d.ts +1 -1
  317. package/lib/esm/widget/components/SelectIModel.d.ts.map +1 -1
  318. package/lib/esm/widget/components/SelectIModel.js +2 -2
  319. package/lib/esm/widget/components/SelectIModel.js.map +1 -1
  320. package/lib/esm/widget/components/SelectIModel.scss +1 -1
  321. package/lib/esm/widget/components/utils.d.ts +1 -1
  322. package/lib/esm/widget/components/utils.d.ts.map +1 -1
  323. package/lib/esm/widget/components/utils.js +6 -6
  324. package/lib/esm/widget/components/utils.js.map +1 -1
  325. package/lib/esm/widget/components/utils.scss +1 -1
  326. package/lib/esm/widget/context/BulkExtractorContext.d.ts.map +1 -1
  327. package/lib/esm/widget/context/BulkExtractorContext.js.map +1 -1
  328. package/lib/esm/widget/context/ReportsConfigApiContext.d.ts +3 -3
  329. package/lib/esm/widget/context/ReportsConfigApiContext.d.ts.map +1 -1
  330. package/lib/esm/widget/context/ReportsConfigApiContext.js.map +1 -1
  331. package/lib/esm/widget/hooks/useValidator.d.ts +1 -4
  332. package/lib/esm/widget/hooks/useValidator.d.ts.map +1 -1
  333. package/lib/esm/widget/hooks/useValidator.js +3 -3
  334. package/lib/esm/widget/hooks/useValidator.js.map +1 -1
  335. package/package.json +9 -4
  336. package/src/ReportsConfigWidget.ts +9 -9
  337. package/src/reports-config-widget-react.ts +4 -3
  338. package/src/test/AddMappingModal.test.tsx +45 -70
  339. package/src/test/BulkExtractor.test.ts +73 -118
  340. package/src/test/DeleteModal.test.tsx +6 -23
  341. package/src/test/ReportAction.test.tsx +20 -38
  342. package/src/test/ReportMappingHorizontalTile.test.tsx +137 -106
  343. package/src/test/ReportMappings.test.tsx +73 -88
  344. package/src/test/Reports.test.tsx +30 -64
  345. package/src/test/WidgetHeader.test.tsx +3 -3
  346. package/src/test/test-utils.tsx +18 -8
  347. package/src/widget/ReportsConfigUiProvider.tsx +18 -37
  348. package/src/widget/components/ActionPanel.tsx +3 -14
  349. package/src/widget/components/AddMappingsModal.scss +1 -1
  350. package/src/widget/components/AddMappingsModal.tsx +21 -53
  351. package/src/widget/components/BulkExtractor.ts +67 -59
  352. package/src/widget/components/Constants.ts +4 -4
  353. package/src/widget/components/DeleteModal.scss +2 -2
  354. package/src/widget/components/DeleteModal.tsx +11 -41
  355. package/src/widget/components/ExtractionStates/FailedExtractionState.tsx +4 -9
  356. package/src/widget/components/ExtractionStates/QueuedExtractionState.tsx +4 -9
  357. package/src/widget/components/ExtractionStates/RunningExtractionState.tsx +4 -9
  358. package/src/widget/components/ExtractionStates/StartingExtractionState.tsx +4 -11
  359. package/src/widget/components/ExtractionStates/SucceededExtractionState.tsx +4 -9
  360. package/src/widget/components/ExtractionStatus.scss +1 -1
  361. package/src/widget/components/ExtractionStatus.tsx +9 -18
  362. package/src/widget/components/ExtractionToast.tsx +12 -9
  363. package/src/widget/components/HorizontalTile.scss +1 -4
  364. package/src/widget/components/HorizontalTile.tsx +12 -33
  365. package/src/widget/components/LocalizedTablePaginator.tsx +13 -44
  366. package/src/widget/components/ReportAction.scss +1 -1
  367. package/src/widget/components/ReportAction.tsx +26 -39
  368. package/src/widget/components/ReportHorizontalTile.tsx +45 -55
  369. package/src/widget/components/ReportMappingHorizontalTile.tsx +70 -78
  370. package/src/widget/components/ReportMappings.tsx +61 -132
  371. package/src/widget/components/Reports.scss +0 -1
  372. package/src/widget/components/Reports.tsx +30 -84
  373. package/src/widget/components/ReportsConfigContext.tsx +70 -32
  374. package/src/widget/components/ReportsContainer.scss +1 -1
  375. package/src/widget/components/ReportsContainer.tsx +12 -28
  376. package/src/widget/components/ReportsHeader.tsx +6 -19
  377. package/src/widget/components/ReportsRouter.tsx +4 -6
  378. package/src/widget/components/SearchBar.tsx +9 -13
  379. package/src/widget/components/SelectIModel.scss +1 -1
  380. package/src/widget/components/SelectIModel.tsx +9 -24
  381. package/src/widget/components/utils.scss +1 -1
  382. package/src/widget/components/utils.tsx +21 -69
  383. package/src/widget/context/BulkExtractorContext.tsx +4 -6
  384. package/src/widget/context/ReportsConfigApiContext.tsx +7 -8
  385. package/src/widget/hooks/useValidator.ts +10 -24
  386. package/tsconfig.json +11 -11
@@ -1,37 +1,18 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
5
- import {
6
- SvgAdd,
7
- SvgCopy,
8
- SvgRefresh,
9
- } from "@itwin/itwinui-icons-react";
10
- import {
11
- Button,
12
- IconButton,
13
- LabeledInput,
14
- Text,
15
- toaster,
16
- } from "@itwin/itwinui-react";
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { SvgAdd, SvgCopy, SvgRefresh } from "@itwin/itwinui-icons-react";
6
+ import { Button, IconButton, LabeledInput, Text, toaster } from "@itwin/itwinui-react";
17
7
  import React, { useCallback, useEffect, useMemo, useState } from "react";
18
8
  import type { CreateTypeFromInterface } from "./utils";
19
- import {
20
- EmptyMessage,
21
- generateUrl,
22
- handleError,
23
- LoadingOverlay,
24
- LoadingSpinner,
25
- } from "./utils";
9
+ import { EmptyMessage, generateUrl, handleError, LoadingOverlay, LoadingSpinner } from "./utils";
26
10
  import "./ReportMappings.scss";
27
11
  import DeleteModal from "./DeleteModal";
28
- import type { MappingsClient, Report, ReportMapping, ReportsClient } from "@itwin/insights-client";
12
+ import type { ExtractionRequestDetails, IMappingsClient, IReportsClient, Report, ReportMapping } from "@itwin/insights-client";
29
13
  import { REPORTING_BASE_PATH } from "@itwin/insights-client";
30
14
  import { AddMappingsModal } from "./AddMappingsModal";
31
- import type {
32
- GetSingleIModelParams,
33
- IModelsClient,
34
- } from "@itwin/imodels-client-management";
15
+ import type { GetSingleIModelParams, IModelsClient } from "@itwin/imodels-client-management";
35
16
  import { AccessTokenAdapter } from "@itwin/imodels-access-frontend";
36
17
  import { SearchBar } from "./SearchBar";
37
18
  import { useReportsConfigApi } from "../context/ReportsConfigApiContext";
@@ -40,7 +21,6 @@ import { ReportMappingHorizontalTile } from "./ReportMappingHorizontalTile";
40
21
  import type { AccessToken } from "@itwin/core-bentley";
41
22
  import { BeEvent } from "@itwin/core-bentley";
42
23
  import { useBulkExtractor } from "../context/BulkExtractorContext";
43
-
44
24
  export type ReportMappingType = CreateTypeFromInterface<ReportMapping>;
45
25
 
46
26
  export type ReportMappingAndMapping = ReportMappingType & {
@@ -53,31 +33,23 @@ const fetchReportMappings = async (
53
33
  setReportMappings: (mappings: ReportMappingAndMapping[]) => void,
54
34
  reportId: string,
55
35
  setIsLoading: (isLoading: boolean) => void,
56
- reportsClient: ReportsClient,
57
- mappingsClient: MappingsClient,
36
+ reportsClient: IReportsClient,
37
+ mappingsClient: IMappingsClient,
58
38
  iModelsClient: IModelsClient,
59
- getAccessToken: () => Promise<AccessToken>
39
+ getAccessToken: () => Promise<AccessToken>,
60
40
  ) => {
61
41
  try {
62
42
  setIsLoading(true);
63
43
  const accessToken = await getAccessToken();
64
- const reportMappings = await reportsClient.getReportMappings(
65
- accessToken,
66
- reportId
67
- );
68
- const authorization =
69
- AccessTokenAdapter.toAuthorizationCallback(accessToken);
44
+ const reportMappings = await reportsClient.getReportMappings(accessToken, reportId);
45
+ const authorization = AccessTokenAdapter.toAuthorizationCallback(accessToken);
70
46
  const iModelNames = new Map<string, string>();
71
47
 
72
48
  const reportMappingsAndMappings = [];
73
49
  for (const reportMapping of reportMappings) {
74
50
  const iModelId = reportMapping.imodelId;
75
51
  let iModelName = "";
76
- const mapping = await mappingsClient.getMapping(
77
- accessToken,
78
- iModelId,
79
- reportMapping.mappingId
80
- );
52
+ const mapping = await mappingsClient.getMapping(accessToken, reportMapping.mappingId);
81
53
  if (iModelNames.has(iModelId)) {
82
54
  iModelName = iModelNames.get(iModelId) ?? "";
83
55
  } else {
@@ -106,12 +78,20 @@ const fetchReportMappings = async (
106
78
  }
107
79
  };
108
80
 
81
+ /**
82
+ * Props for the {@link ReportMappings} component.
83
+ * @public
84
+ */
109
85
  export interface ReportMappingsProps {
110
86
  report: Report;
111
87
  onClickClose: () => void;
112
88
  defaultIModelId?: string;
113
89
  }
114
90
 
91
+ /**
92
+ * Component to display and manage report mappings.
93
+ * @public
94
+ */
115
95
  export const ReportMappings = ({ report, onClickClose, defaultIModelId }: ReportMappingsProps) => {
116
96
  const { getAccessToken, reportsClient, iModelsClient, mappingsClient, baseUrl } = useReportsConfigApi();
117
97
  const [showDeleteModal, setShowDeleteModal] = useState<ReportMappingAndMapping | undefined>(undefined);
@@ -121,61 +101,39 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }: Report
121
101
  const [searchValue, setSearchValue] = useState<string>("");
122
102
  const [reportMappings, setReportMappings] = useState<ReportMappingAndMapping[]>([]);
123
103
  const [jobRunning, setJobRunning] = useState<boolean>(false);
124
- const jobStartEvent = useMemo(
125
- () => new BeEvent<(iModelId: string) => void>(),
126
- []
127
- );
104
+ const jobStartEvent = useMemo(() => new BeEvent<(iModelId: string) => void>(), []);
128
105
 
129
106
  useEffect(() => {
130
- void fetchReportMappings(
131
- setReportMappings,
132
- report.id,
133
- setIsLoading,
134
- reportsClient,
135
- mappingsClient,
136
- iModelsClient,
137
- getAccessToken
138
- );
107
+ void fetchReportMappings(setReportMappings, report.id, setIsLoading, reportsClient, mappingsClient, iModelsClient, getAccessToken);
139
108
  }, [getAccessToken, iModelsClient, mappingsClient, report.id, reportsClient, setIsLoading]);
140
109
 
141
110
  useEffect(() => {
142
111
  if (!bulkExtractor) return;
143
- bulkExtractor.setHook(setJobRunning, reportMappings.map((x) => x.imodelId));
112
+ bulkExtractor.setHook(
113
+ setJobRunning,
114
+ reportMappings.map((x) => x.imodelId),
115
+ );
144
116
  }, [bulkExtractor, reportMappings]);
145
117
 
146
118
  const refresh = useCallback(async () => {
147
- await fetchReportMappings(
148
- setReportMappings,
149
- report.id,
150
- setIsLoading,
151
- reportsClient,
152
- mappingsClient,
153
- iModelsClient,
154
- getAccessToken
155
- );
119
+ await fetchReportMappings(setReportMappings, report.id, setIsLoading, reportsClient, mappingsClient, iModelsClient, getAccessToken);
156
120
  }, [getAccessToken, iModelsClient, mappingsClient, report.id, reportsClient]);
157
121
 
158
- const odataFeedUrl = `${generateUrl(
159
- REPORTING_BASE_PATH,
160
- baseUrl
161
- )}/odata/${report.id}`;
122
+ const odataFeedUrl = `${generateUrl(REPORTING_BASE_PATH, baseUrl)}/odata/${report.id}`;
162
123
 
163
124
  const addMapping = useCallback(() => {
164
125
  setShowAddMapping(true);
165
126
  }, []);
166
127
 
167
128
  const filteredReportMappings = useMemo(
168
- () =>
169
- reportMappings.filter((x) =>
170
- [x.iModelName, x.mappingName, x.mappingDescription]
171
- .join(" ")
172
- .toLowerCase()
173
- .includes(searchValue.toLowerCase())
174
- ),
175
- [reportMappings, searchValue]
129
+ () => reportMappings.filter((x) => [x.iModelName, x.mappingName, x.mappingDescription].join(" ").toLowerCase().includes(searchValue.toLowerCase())),
130
+ [reportMappings, searchValue],
176
131
  );
177
132
 
178
- const onAddMappingsModalClose = useCallback(async () => { await refresh(); setShowAddMapping(false); }, [refresh]);
133
+ const onAddMappingsModalClose = useCallback(async () => {
134
+ await refresh();
135
+ setShowAddMapping(false);
136
+ }, [refresh]);
179
137
 
180
138
  if (!bulkExtractor) return null;
181
139
 
@@ -183,24 +141,16 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }: Report
183
141
  <>
184
142
  <div className="rcw-report-mappings-container">
185
143
  <LabeledInput
186
- label={ReportsConfigWidget.localization.getLocalizedString(
187
- "ReportsConfigWidget:ODataFeedURL"
188
- )}
144
+ label={ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:ODataFeedURL")}
189
145
  className="rcw-odata-url-input"
190
146
  readOnly={true}
191
147
  value={odataFeedUrl}
192
148
  svgIcon={
193
149
  <IconButton
194
- title={ReportsConfigWidget.localization.getLocalizedString(
195
- "ReportsConfigWidget:Copy"
196
- )}
150
+ title={ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Copy")}
197
151
  onClick={async (_) => {
198
152
  await navigator.clipboard.writeText(odataFeedUrl);
199
- toaster.positive(
200
- ReportsConfigWidget.localization.getLocalizedString(
201
- "ReportsConfigWidget:CopiedToClipboard"
202
- )
203
- );
153
+ toaster.positive(ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:CopiedToClipboard"));
204
154
  }}
205
155
  >
206
156
  <SvgCopy />
@@ -209,31 +159,19 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }: Report
209
159
  iconDisplayStyle="inline"
210
160
  />
211
161
  <div className="rcw-toolbar">
212
- <Button
213
- startIcon={<SvgAdd />}
214
- onClick={() => addMapping()}
215
- styleType="high-visibility"
216
- >
217
- {ReportsConfigWidget.localization.getLocalizedString(
218
- "ReportsConfigWidget:AddMapping"
219
- )}
162
+ <Button startIcon={<SvgAdd />} onClick={() => addMapping()} styleType="high-visibility">
163
+ {ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:AddMapping")}
220
164
  </Button>
221
165
  <div className="rcw-search-bar-container" data-testid="rcw-search-bar">
222
166
  <IconButton
223
- title={ReportsConfigWidget.localization.getLocalizedString(
224
- "ReportsConfigWidget:Refresh"
225
- )}
167
+ title={ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Refresh")}
226
168
  onClick={refresh}
227
169
  disabled={isLoading}
228
- styleType='borderless'
170
+ styleType="borderless"
229
171
  >
230
172
  <SvgRefresh />
231
173
  </IconButton>
232
- <SearchBar
233
- searchValue={searchValue}
234
- setSearchValue={setSearchValue}
235
- disabled={isLoading}
236
- />
174
+ <SearchBar searchValue={searchValue} setSearchValue={setSearchValue} disabled={isLoading} />
237
175
  </div>
238
176
  </div>
239
177
  {isLoading ? (
@@ -241,16 +179,10 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }: Report
241
179
  ) : reportMappings.length === 0 ? (
242
180
  <EmptyMessage>
243
181
  <>
244
- <Text>
245
- {ReportsConfigWidget.localization.getLocalizedString(
246
- "ReportsConfigWidget:NoReportMappings"
247
- )}
248
- </Text>
182
+ <Text>{ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:NoReportMappings")}</Text>
249
183
  <div>
250
184
  <Button onClick={addMapping} styleType="cta">
251
- {ReportsConfigWidget.localization.getLocalizedString(
252
- "ReportsConfigWidget:LetsAddSomeMappingsCTA"
253
- )}
185
+ {ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:LetsAddSomeMappingsCTA")}
254
186
  </Button>
255
187
  </div>
256
188
  </>
@@ -283,11 +215,7 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }: Report
283
215
  entityName={showDeleteModal?.mappingName ?? ""}
284
216
  onDelete={async () => {
285
217
  const accessToken = await getAccessToken();
286
- await reportsClient.deleteReportMapping(
287
- accessToken,
288
- report.id,
289
- showDeleteModal?.mappingId ?? ""
290
- );
218
+ await reportsClient.deleteReportMapping(accessToken, report.id, showDeleteModal?.mappingId ?? "");
291
219
  }}
292
220
  refresh={refresh}
293
221
  onClose={() => setShowDeleteModal(undefined)}
@@ -300,25 +228,26 @@ export const ReportMappings = ({ report, onClickClose, defaultIModelId }: Report
300
228
  onClick={async () => {
301
229
  setJobRunning(true);
302
230
  const uniqueIModels = Array.from(new Set(reportMappings.map((x) => x.imodelId)));
303
- await bulkExtractor.runIModelExtractions(uniqueIModels);
231
+ const iModelsAndMappings: ExtractionRequestDetails[] = uniqueIModels.map((iModelId) => {
232
+ return {
233
+ iModelId,
234
+ mappings: reportMappings
235
+ .filter((reportMapping) => reportMapping.imodelId === iModelId)
236
+ .map((reportMappingForIModel) => ({
237
+ id: reportMappingForIModel.mappingId,
238
+ })),
239
+ };
240
+ });
241
+ await bulkExtractor.runIModelExtractions(iModelsAndMappings);
304
242
  reportMappings.forEach((reportMapping) => {
305
243
  jobStartEvent.raiseEvent(reportMapping.imodelId);
306
244
  });
307
245
  }}
308
246
  >
309
- {ReportsConfigWidget.localization.getLocalizedString(
310
- "ReportsConfigWidget:UpdateAllDatasets"
311
- )}
247
+ {ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:UpdateAllDatasets")}
312
248
  </Button>
313
- <Button
314
- styleType="default"
315
- type="button"
316
- onClick={onClickClose}
317
- disabled={isLoading}
318
- >
319
- {ReportsConfigWidget.localization.getLocalizedString(
320
- "ReportsConfigWidget:Close"
321
- )}
249
+ <Button styleType="default" type="button" onClick={onClickClose} disabled={isLoading}>
250
+ {ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Close")}
322
251
  </Button>
323
252
  </div>
324
253
  </>
@@ -37,4 +37,3 @@
37
37
  margin-top: var(--iui-size-xs);
38
38
  }
39
39
  }
40
-
@@ -6,14 +6,10 @@ import { SvgAdd, SvgPlay, SvgRefresh } from "@itwin/itwinui-icons-react";
6
6
  import { Button, IconButton } from "@itwin/itwinui-react";
7
7
  import React, { useCallback, useEffect, useMemo, useState } from "react";
8
8
  import type { CreateTypeFromInterface } from "./utils";
9
- import {
10
- EmptyMessage,
11
- handleError,
12
- LoadingOverlay,
13
- } from "./utils";
9
+ import { EmptyMessage, handleError, LoadingOverlay } from "./utils";
14
10
  import "./Reports.scss";
15
11
  import DeleteModal from "./DeleteModal";
16
- import type { Report, ReportsClient } from "@itwin/insights-client";
12
+ import type { IReportsClient, Report } from "@itwin/insights-client";
17
13
  import { ReportHorizontalTile } from "./ReportHorizontalTile";
18
14
  import { SearchBar } from "./SearchBar";
19
15
  import { useReportsConfigApi } from "../context/ReportsConfigApiContext";
@@ -28,8 +24,8 @@ const fetchReports = async (
28
24
  setReports: (reports: Report[]) => void,
29
25
  iTwinId: string | undefined,
30
26
  setIsLoading: (isLoading: boolean) => void,
31
- reportsClient: ReportsClient,
32
- getAccessToken: () => Promise<AccessToken>
27
+ reportsClient: IReportsClient,
28
+ getAccessToken: () => Promise<AccessToken>,
33
29
  ) => {
34
30
  try {
35
31
  if (!iTwinId) return;
@@ -44,70 +40,47 @@ const fetchReports = async (
44
40
  }
45
41
  };
46
42
 
43
+ /**
44
+ * Props for {@link Reports} component.
45
+ * @public
46
+ */
47
47
  export interface ReportsProps {
48
48
  onClickAddReport?: () => void;
49
49
  onClickReportTitle?: (report: Report) => void;
50
50
  onClickReportModify?: (report: Report) => void;
51
51
  }
52
52
 
53
- export const Reports = ({
54
- onClickAddReport,
55
- onClickReportModify,
56
- onClickReportTitle,
57
- }: ReportsProps) => {
53
+ /**
54
+ * Component to manage and list reports for an iTwin.
55
+ * @public
56
+ */
57
+ export const Reports = ({ onClickAddReport, onClickReportModify, onClickReportTitle }: ReportsProps) => {
58
58
  const { iTwinId, getAccessToken, reportsClient } = useReportsConfigApi();
59
59
  const { bulkExtractor } = useBulkExtractor();
60
- const [showDeleteModal, setShowDeleteModal] = useState<Report | undefined>(
61
- undefined
62
- );
60
+ const [showDeleteModal, setShowDeleteModal] = useState<Report | undefined>(undefined);
63
61
  const [selectedReportIds, setSelectedReportIds] = useState<string[]>([]);
64
62
  const [isLoading, setIsLoading] = useState<boolean>(true);
65
63
  const [searchValue, setSearchValue] = useState<string>("");
66
64
  const [reports, setReports] = useState<Report[]>([]);
67
- const jobStartEvent = useMemo(
68
- () => new BeEvent<(reportId: string) => void>(),
69
- []
70
- );
65
+ const jobStartEvent = useMemo(() => new BeEvent<(reportId: string) => void>(), []);
71
66
 
72
67
  useEffect(() => {
73
- void fetchReports(
74
- setReports,
75
- iTwinId,
76
- setIsLoading,
77
- reportsClient,
78
- getAccessToken
79
- );
68
+ void fetchReports(setReports, iTwinId, setIsLoading, reportsClient, getAccessToken);
80
69
  }, [getAccessToken, iTwinId, reportsClient, setIsLoading]);
81
70
 
82
71
  const refresh = useCallback(async () => {
83
- await fetchReports(
84
- setReports,
85
- iTwinId,
86
- setIsLoading,
87
- reportsClient,
88
- getAccessToken
89
- );
72
+ await fetchReports(setReports, iTwinId, setIsLoading, reportsClient, getAccessToken);
90
73
  }, [getAccessToken, iTwinId, reportsClient]);
91
74
 
92
75
  const filteredReports = useMemo(
93
- () =>
94
- reports.filter((x) =>
95
- [x.displayName, x.description]
96
- .join(" ")
97
- .toLowerCase()
98
- .includes(searchValue.toLowerCase())
99
- ),
100
- [reports, searchValue]
76
+ () => reports.filter((x) => [x.displayName, x.description].join(" ").toLowerCase().includes(searchValue.toLowerCase())),
77
+ [reports, searchValue],
101
78
  );
102
79
 
103
80
  const onSelectionChange = (reportId: string, control: boolean) => {
104
81
  if (!control) setSelectedReportIds([]);
105
82
 
106
- setSelectedReportIds((sr) =>
107
- sr.some((r) => reportId === r)
108
- ? sr.filter((r) => reportId !== r)
109
- : [...sr, reportId]
110
- );
83
+ setSelectedReportIds((sr) => (sr.some((r) => reportId === r) ? sr.filter((r) => reportId !== r) : [...sr, reportId]));
111
84
  };
112
85
 
113
86
  const updateDatasets = useCallback(async () => {
@@ -125,46 +98,28 @@ export const Reports = ({
125
98
  <div className="rcw-toolbar">
126
99
  <div className="rcw-button-spacing">
127
100
  {onClickAddReport && (
128
- <Button
129
- startIcon={<SvgAdd />}
130
- onClick={onClickAddReport}
131
- styleType="high-visibility"
132
- title="New Report"
133
- >
134
- {ReportsConfigWidget.localization.getLocalizedString(
135
- "ReportsConfigWidget:New"
136
- )}
101
+ <Button startIcon={<SvgAdd />} onClick={onClickAddReport} styleType="high-visibility" title="New Report">
102
+ {ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:New")}
137
103
  </Button>
138
104
  )}
139
105
  <IconButton
140
- title={ReportsConfigWidget.localization.getLocalizedString(
141
- "ReportsConfigWidget:UpdateDatasets"
142
- )}
106
+ title={ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:UpdateDatasets")}
143
107
  onClick={updateDatasets}
144
108
  disabled={selectedReportIds.length === 0}
145
109
  >
146
110
  <SvgPlay />
147
111
  </IconButton>
148
112
  </div>
149
- <div
150
- className="rcw-search-bar-container"
151
- data-testid="rcw-search-bar"
152
- >
113
+ <div className="rcw-search-bar-container" data-testid="rcw-search-bar">
153
114
  <IconButton
154
- title={ReportsConfigWidget.localization.getLocalizedString(
155
- "ReportsConfigWidget:Refresh"
156
- )}
115
+ title={ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Refresh")}
157
116
  onClick={refresh}
158
117
  disabled={isLoading}
159
118
  styleType="borderless"
160
119
  >
161
120
  <SvgRefresh />
162
121
  </IconButton>
163
- <SearchBar
164
- searchValue={searchValue}
165
- setSearchValue={setSearchValue}
166
- disabled={isLoading}
167
- />
122
+ <SearchBar searchValue={searchValue} setSearchValue={setSearchValue} disabled={isLoading} />
168
123
  </div>
169
124
  </div>
170
125
  {isLoading ? (
@@ -172,14 +127,10 @@ export const Reports = ({
172
127
  ) : reports.length === 0 && onClickAddReport ? (
173
128
  <EmptyMessage>
174
129
  <>
175
- {ReportsConfigWidget.localization.getLocalizedString(
176
- "ReportsConfigWidget:NoReports"
177
- )}
130
+ {ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:NoReports")}
178
131
  <div>
179
132
  <Button onClick={onClickAddReport} styleType="cta">
180
- {ReportsConfigWidget.localization.getLocalizedString(
181
- "ReportsConfigWidget:CreateOneReportCTA"
182
- )}
133
+ {ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:CreateOneReportCTA")}
183
134
  </Button>
184
135
  </div>
185
136
  </>
@@ -198,9 +149,7 @@ export const Reports = ({
198
149
  }}
199
150
  onClickModify={onClickReportModify}
200
151
  onSelectionChange={onSelectionChange}
201
- selected={selectedReportIds.some(
202
- (reportId) => report.id === reportId
203
- )}
152
+ selected={selectedReportIds.some((reportId) => report.id === reportId)}
204
153
  />
205
154
  ))}
206
155
  </div>
@@ -211,10 +160,7 @@ export const Reports = ({
211
160
  onClose={() => setShowDeleteModal(undefined)}
212
161
  onDelete={async () => {
213
162
  const accessToken = await getAccessToken();
214
- await reportsClient.deleteReport(
215
- accessToken,
216
- showDeleteModal?.id ?? ""
217
- );
163
+ await reportsClient.deleteReport(accessToken, showDeleteModal?.id ?? "");
218
164
  }}
219
165
  refresh={refresh}
220
166
  />