@itwin/reports-config-widget-react 0.2.1 → 0.3.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 (288) hide show
  1. package/.rush/temp/operation/rebuild/all.log +9 -0
  2. package/.rush/temp/operation/rebuild/state.json +3 -0
  3. package/.rush/temp/package-deps_rebuild.json +36 -32
  4. package/.rush/temp/shrinkwrap-deps.json +88 -34
  5. package/CHANGELOG.json +18 -0
  6. package/CHANGELOG.md +10 -1
  7. package/lib/cjs/reports-config-widget-react.d.ts +5 -0
  8. package/lib/cjs/reports-config-widget-react.d.ts.map +1 -1
  9. package/lib/cjs/reports-config-widget-react.js +11 -0
  10. package/lib/cjs/reports-config-widget-react.js.map +1 -1
  11. package/lib/cjs/test/AddMappingModal.test.js +15 -28
  12. package/lib/cjs/test/AddMappingModal.test.js.map +1 -1
  13. package/lib/cjs/test/BulkExtractor.test.js +13 -19
  14. package/lib/cjs/test/BulkExtractor.test.js.map +1 -1
  15. package/lib/cjs/test/DeleteModal.test.d.ts.map +1 -1
  16. package/lib/cjs/test/DeleteModal.test.js +4 -62
  17. package/lib/cjs/test/DeleteModal.test.js.map +1 -1
  18. package/lib/cjs/test/ReportAction.test.js +13 -78
  19. package/lib/cjs/test/ReportAction.test.js.map +1 -1
  20. package/lib/cjs/test/ReportMappingHorizontalTile.test.js +2 -35
  21. package/lib/cjs/test/ReportMappingHorizontalTile.test.js.map +1 -1
  22. package/lib/cjs/test/ReportMappings.test.d.ts.map +1 -1
  23. package/lib/cjs/test/ReportMappings.test.js +38 -91
  24. package/lib/cjs/test/ReportMappings.test.js.map +1 -1
  25. package/lib/cjs/test/Reports.test.js +19 -72
  26. package/lib/cjs/test/Reports.test.js.map +1 -1
  27. package/lib/cjs/test/test-utils.d.ts +3 -8
  28. package/lib/cjs/test/test-utils.d.ts.map +1 -1
  29. package/lib/cjs/test/test-utils.js +8 -33
  30. package/lib/cjs/test/test-utils.js.map +1 -1
  31. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  32. package/lib/cjs/widget/components/ActionPanel.d.ts +1 -1
  33. package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -1
  34. package/lib/cjs/widget/components/ActionPanel.js +4 -4
  35. package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
  36. package/lib/cjs/widget/components/AddMappingsModal.d.ts +4 -4
  37. package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
  38. package/lib/cjs/widget/components/AddMappingsModal.js +23 -22
  39. package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
  40. package/lib/cjs/widget/components/BulkExtractor.d.ts +4 -4
  41. package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -1
  42. package/lib/cjs/widget/components/BulkExtractor.js +6 -6
  43. package/lib/cjs/widget/components/BulkExtractor.js.map +1 -1
  44. package/lib/cjs/widget/components/DeleteModal.d.ts +4 -5
  45. package/lib/cjs/widget/components/DeleteModal.d.ts.map +1 -1
  46. package/lib/cjs/widget/components/DeleteModal.js +9 -13
  47. package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
  48. package/lib/cjs/widget/components/HorizontalTile.scss +6 -3
  49. package/lib/cjs/widget/components/ReportAction.d.ts +4 -5
  50. package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -1
  51. package/lib/cjs/widget/components/ReportAction.js +15 -15
  52. package/lib/cjs/widget/components/ReportAction.js.map +1 -1
  53. package/lib/cjs/widget/components/ReportHorizontalTile.d.ts +4 -4
  54. package/lib/cjs/widget/components/ReportHorizontalTile.d.ts.map +1 -1
  55. package/lib/cjs/widget/components/ReportHorizontalTile.js +27 -12
  56. package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -1
  57. package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts +1 -1
  58. package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
  59. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js +24 -9
  60. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js.map +1 -1
  61. package/lib/cjs/widget/components/ReportMappings.d.ts +4 -6
  62. package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
  63. package/lib/cjs/widget/components/ReportMappings.js +37 -47
  64. package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
  65. package/lib/cjs/widget/components/ReportMappings.scss +3 -3
  66. package/lib/cjs/widget/components/Reports.d.ts +6 -1
  67. package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
  68. package/lib/cjs/widget/components/Reports.js +42 -83
  69. package/lib/cjs/widget/components/Reports.js.map +1 -1
  70. package/lib/cjs/widget/components/ReportsConfigContext.d.ts +18 -0
  71. package/lib/cjs/widget/components/ReportsConfigContext.d.ts.map +1 -0
  72. package/lib/cjs/widget/components/ReportsConfigContext.js +87 -0
  73. package/lib/cjs/widget/components/ReportsConfigContext.js.map +1 -0
  74. package/lib/cjs/widget/components/ReportsContainer.d.ts +14 -0
  75. package/lib/cjs/widget/components/ReportsContainer.d.ts.map +1 -1
  76. package/lib/cjs/widget/components/ReportsContainer.js +28 -16
  77. package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
  78. package/lib/cjs/widget/components/ReportsHeader.d.ts +7 -0
  79. package/lib/cjs/widget/components/ReportsHeader.d.ts.map +1 -0
  80. package/lib/cjs/widget/components/ReportsHeader.js +20 -0
  81. package/lib/cjs/widget/components/ReportsHeader.js.map +1 -0
  82. package/lib/cjs/widget/components/ReportsRouter.d.ts +8 -0
  83. package/lib/cjs/widget/components/ReportsRouter.d.ts.map +1 -0
  84. package/lib/cjs/widget/components/ReportsRouter.js +52 -0
  85. package/lib/cjs/widget/components/ReportsRouter.js.map +1 -0
  86. package/lib/cjs/widget/components/SearchBar.js +1 -2
  87. package/lib/cjs/widget/components/SearchBar.js.map +1 -1
  88. package/lib/cjs/widget/components/SearchBar.scss +1 -1
  89. package/lib/cjs/widget/components/SelectIModel.d.ts +3 -3
  90. package/lib/cjs/widget/components/SelectIModel.d.ts.map +1 -1
  91. package/lib/cjs/widget/components/SelectIModel.js +6 -26
  92. package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
  93. package/lib/cjs/widget/components/utils.d.ts +1 -1
  94. package/lib/cjs/widget/components/utils.d.ts.map +1 -1
  95. package/lib/cjs/widget/components/utils.js.map +1 -1
  96. package/lib/cjs/widget/context/BulkExtractorContext.d.ts +10 -0
  97. package/lib/cjs/widget/context/BulkExtractorContext.d.ts.map +1 -0
  98. package/lib/cjs/widget/context/{ReportsApiConfigContext.js → BulkExtractorContext.js} +7 -10
  99. package/lib/cjs/widget/context/BulkExtractorContext.js.map +1 -0
  100. package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts +16 -0
  101. package/lib/cjs/widget/context/ReportsConfigApiContext.d.ts.map +1 -0
  102. package/lib/cjs/widget/context/ReportsConfigApiContext.js +43 -0
  103. package/lib/cjs/widget/context/ReportsConfigApiContext.js.map +1 -0
  104. package/lib/esm/reports-config-widget-react.d.ts +5 -0
  105. package/lib/esm/reports-config-widget-react.d.ts.map +1 -1
  106. package/lib/esm/reports-config-widget-react.js +5 -0
  107. package/lib/esm/reports-config-widget-react.js.map +1 -1
  108. package/lib/esm/test/AddMappingModal.test.js +16 -29
  109. package/lib/esm/test/AddMappingModal.test.js.map +1 -1
  110. package/lib/esm/test/BulkExtractor.test.js +14 -17
  111. package/lib/esm/test/BulkExtractor.test.js.map +1 -1
  112. package/lib/esm/test/DeleteModal.test.d.ts.map +1 -1
  113. package/lib/esm/test/DeleteModal.test.js +5 -44
  114. package/lib/esm/test/DeleteModal.test.js.map +1 -1
  115. package/lib/esm/test/ReportAction.test.js +14 -60
  116. package/lib/esm/test/ReportAction.test.js.map +1 -1
  117. package/lib/esm/test/ReportMappingHorizontalTile.test.js +3 -36
  118. package/lib/esm/test/ReportMappingHorizontalTile.test.js.map +1 -1
  119. package/lib/esm/test/ReportMappings.test.d.ts.map +1 -1
  120. package/lib/esm/test/ReportMappings.test.js +37 -90
  121. package/lib/esm/test/ReportMappings.test.js.map +1 -1
  122. package/lib/esm/test/Reports.test.js +20 -54
  123. package/lib/esm/test/Reports.test.js.map +1 -1
  124. package/lib/esm/test/test-utils.d.ts +3 -8
  125. package/lib/esm/test/test-utils.d.ts.map +1 -1
  126. package/lib/esm/test/test-utils.js +7 -31
  127. package/lib/esm/test/test-utils.js.map +1 -1
  128. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  129. package/lib/esm/widget/components/ActionPanel.d.ts +1 -1
  130. package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -1
  131. package/lib/esm/widget/components/ActionPanel.js +4 -4
  132. package/lib/esm/widget/components/ActionPanel.js.map +1 -1
  133. package/lib/esm/widget/components/AddMappingsModal.d.ts +4 -4
  134. package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
  135. package/lib/esm/widget/components/AddMappingsModal.js +25 -24
  136. package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
  137. package/lib/esm/widget/components/BulkExtractor.d.ts +4 -4
  138. package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -1
  139. package/lib/esm/widget/components/BulkExtractor.js +7 -8
  140. package/lib/esm/widget/components/BulkExtractor.js.map +1 -1
  141. package/lib/esm/widget/components/DeleteModal.d.ts +4 -5
  142. package/lib/esm/widget/components/DeleteModal.d.ts.map +1 -1
  143. package/lib/esm/widget/components/DeleteModal.js +9 -13
  144. package/lib/esm/widget/components/DeleteModal.js.map +1 -1
  145. package/lib/esm/widget/components/HorizontalTile.scss +6 -3
  146. package/lib/esm/widget/components/ReportAction.d.ts +4 -5
  147. package/lib/esm/widget/components/ReportAction.d.ts.map +1 -1
  148. package/lib/esm/widget/components/ReportAction.js +14 -16
  149. package/lib/esm/widget/components/ReportAction.js.map +1 -1
  150. package/lib/esm/widget/components/ReportHorizontalTile.d.ts +4 -4
  151. package/lib/esm/widget/components/ReportHorizontalTile.d.ts.map +1 -1
  152. package/lib/esm/widget/components/ReportHorizontalTile.js +4 -5
  153. package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -1
  154. package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts +1 -1
  155. package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -1
  156. package/lib/esm/widget/components/ReportMappingHorizontalTile.js +1 -2
  157. package/lib/esm/widget/components/ReportMappingHorizontalTile.js.map +1 -1
  158. package/lib/esm/widget/components/ReportMappings.d.ts +4 -6
  159. package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
  160. package/lib/esm/widget/components/ReportMappings.js +39 -49
  161. package/lib/esm/widget/components/ReportMappings.js.map +1 -1
  162. package/lib/esm/widget/components/ReportMappings.scss +3 -3
  163. package/lib/esm/widget/components/Reports.d.ts +6 -1
  164. package/lib/esm/widget/components/Reports.d.ts.map +1 -1
  165. package/lib/esm/widget/components/Reports.js +45 -86
  166. package/lib/esm/widget/components/Reports.js.map +1 -1
  167. package/lib/esm/widget/components/ReportsConfigContext.d.ts +18 -0
  168. package/lib/esm/widget/components/ReportsConfigContext.d.ts.map +1 -0
  169. package/lib/esm/widget/components/ReportsConfigContext.js +64 -0
  170. package/lib/esm/widget/components/ReportsConfigContext.js.map +1 -0
  171. package/lib/esm/widget/components/ReportsContainer.d.ts +14 -0
  172. package/lib/esm/widget/components/ReportsContainer.d.ts.map +1 -1
  173. package/lib/esm/widget/components/ReportsContainer.js +28 -17
  174. package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
  175. package/lib/esm/widget/components/ReportsHeader.d.ts +7 -0
  176. package/lib/esm/widget/components/ReportsHeader.d.ts.map +1 -0
  177. package/lib/esm/widget/components/ReportsHeader.js +13 -0
  178. package/lib/esm/widget/components/ReportsHeader.js.map +1 -0
  179. package/lib/esm/widget/components/ReportsRouter.d.ts +8 -0
  180. package/lib/esm/widget/components/ReportsRouter.d.ts.map +1 -0
  181. package/lib/esm/widget/components/ReportsRouter.js +45 -0
  182. package/lib/esm/widget/components/ReportsRouter.js.map +1 -0
  183. package/lib/esm/widget/components/SearchBar.js +1 -2
  184. package/lib/esm/widget/components/SearchBar.js.map +1 -1
  185. package/lib/esm/widget/components/SearchBar.scss +1 -1
  186. package/lib/esm/widget/components/SelectIModel.d.ts +3 -3
  187. package/lib/esm/widget/components/SelectIModel.d.ts.map +1 -1
  188. package/lib/esm/widget/components/SelectIModel.js +7 -27
  189. package/lib/esm/widget/components/SelectIModel.js.map +1 -1
  190. package/lib/esm/widget/components/utils.d.ts +1 -1
  191. package/lib/esm/widget/components/utils.d.ts.map +1 -1
  192. package/lib/esm/widget/components/utils.js.map +1 -1
  193. package/lib/esm/widget/context/BulkExtractorContext.d.ts +10 -0
  194. package/lib/esm/widget/context/BulkExtractorContext.d.ts.map +1 -0
  195. package/lib/esm/widget/context/BulkExtractorContext.js +11 -0
  196. package/lib/esm/widget/context/BulkExtractorContext.js.map +1 -0
  197. package/lib/esm/widget/context/ReportsConfigApiContext.d.ts +16 -0
  198. package/lib/esm/widget/context/ReportsConfigApiContext.d.ts.map +1 -0
  199. package/lib/esm/widget/context/ReportsConfigApiContext.js +20 -0
  200. package/lib/esm/widget/context/ReportsConfigApiContext.js.map +1 -0
  201. package/lib/public/locales/en/ReportsConfigWidget.json +2 -1
  202. package/package.json +2 -2
  203. package/public/locales/en/ReportsConfigWidget.json +2 -1
  204. package/reports-config-widget-react.build.error.log +1 -14
  205. package/reports-config-widget-react.build.log +2 -60
  206. package/src/reports-config-widget-react.ts +6 -0
  207. package/src/test/AddMappingModal.test.tsx +20 -37
  208. package/src/test/BulkExtractor.test.ts +15 -17
  209. package/src/test/DeleteModal.test.tsx +4 -73
  210. package/src/test/ReportAction.test.tsx +17 -90
  211. package/src/test/ReportMappingHorizontalTile.test.tsx +3 -54
  212. package/src/test/ReportMappings.test.tsx +50 -135
  213. package/src/test/Reports.test.tsx +21 -80
  214. package/src/test/test-utils.tsx +9 -49
  215. package/src/widget/components/ActionPanel.tsx +16 -14
  216. package/src/widget/components/AddMappingsModal.tsx +39 -39
  217. package/src/widget/components/BulkExtractor.ts +11 -10
  218. package/src/widget/components/DeleteModal.tsx +14 -20
  219. package/src/widget/components/HorizontalTile.scss +6 -3
  220. package/src/widget/components/ReportAction.tsx +15 -30
  221. package/src/widget/components/ReportHorizontalTile.tsx +10 -11
  222. package/src/widget/components/ReportMappingHorizontalTile.tsx +2 -3
  223. package/src/widget/components/ReportMappings.scss +3 -3
  224. package/src/widget/components/ReportMappings.tsx +66 -69
  225. package/src/widget/components/Reports.tsx +143 -187
  226. package/src/widget/components/ReportsConfigContext.tsx +95 -0
  227. package/src/widget/components/ReportsContainer.tsx +47 -21
  228. package/src/widget/components/ReportsHeader.tsx +27 -0
  229. package/src/widget/components/ReportsRouter.tsx +63 -0
  230. package/src/widget/components/SearchBar.scss +1 -1
  231. package/src/widget/components/SearchBar.tsx +2 -2
  232. package/src/widget/components/SelectIModel.tsx +11 -29
  233. package/src/widget/components/utils.tsx +1 -1
  234. package/src/widget/context/{ReportsApiConfigContext.tsx → BulkExtractorContext.tsx} +9 -10
  235. package/src/widget/context/ReportsConfigApiContext.tsx +39 -0
  236. package/coverage/clover.xml +0 -838
  237. package/coverage/coverage-final.json +0 -29
  238. package/coverage/lcov-report/base.css +0 -224
  239. package/coverage/lcov-report/block-navigation.js +0 -87
  240. package/coverage/lcov-report/favicon.png +0 -0
  241. package/coverage/lcov-report/index.html +0 -206
  242. package/coverage/lcov-report/prettify.css +0 -1
  243. package/coverage/lcov-report/prettify.js +0 -2
  244. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  245. package/coverage/lcov-report/sorter.js +0 -196
  246. package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +0 -193
  247. package/coverage/lcov-report/src/index.html +0 -116
  248. package/coverage/lcov-report/src/test/index.html +0 -116
  249. package/coverage/lcov-report/src/test/test-utils.tsx.html +0 -316
  250. package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +0 -286
  251. package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +0 -241
  252. package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +0 -604
  253. package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +0 -661
  254. package/coverage/lcov-report/src/widget/components/Constants.ts.html +0 -106
  255. package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +0 -385
  256. package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +0 -187
  257. package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +0 -145
  258. package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +0 -139
  259. package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +0 -151
  260. package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +0 -190
  261. package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +0 -176
  262. package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +0 -295
  263. package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +0 -208
  264. package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +0 -289
  265. package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +0 -262
  266. package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +0 -517
  267. package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +0 -475
  268. package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +0 -469
  269. package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +0 -1078
  270. package/coverage/lcov-report/src/widget/components/Reports.tsx.html +0 -877
  271. package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +0 -223
  272. package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +0 -271
  273. package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +0 -391
  274. package/coverage/lcov-report/src/widget/components/index.html +0 -371
  275. package/coverage/lcov-report/src/widget/components/utils.tsx.html +0 -562
  276. package/coverage/lcov-report/src/widget/context/ReportsApiConfigContext.tsx.html +0 -166
  277. package/coverage/lcov-report/src/widget/context/index.html +0 -116
  278. package/coverage/lcov-report/src/widget/hooks/index.html +0 -116
  279. package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +0 -295
  280. package/coverage/lcov-report/src/widget/index.html +0 -116
  281. package/coverage/lcov.info +0 -1594
  282. package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts +0 -9
  283. package/lib/cjs/widget/context/ReportsApiConfigContext.d.ts.map +0 -1
  284. package/lib/cjs/widget/context/ReportsApiConfigContext.js.map +0 -1
  285. package/lib/esm/widget/context/ReportsApiConfigContext.d.ts +0 -9
  286. package/lib/esm/widget/context/ReportsApiConfigContext.d.ts.map +0 -1
  287. package/lib/esm/widget/context/ReportsApiConfigContext.js +0 -14
  288. package/lib/esm/widget/context/ReportsApiConfigContext.js.map +0 -1
@@ -34,8 +34,8 @@
34
34
  display: flex;
35
35
  flex-direction: column;
36
36
  overflow-y: overlay;
37
- gap: 7.5px;
38
- margin-top: 7.5px;
37
+ gap: 8px;
38
+ margin-top: 8px;
39
39
  }
40
40
 
41
41
  .rcw-search-bar-container {
@@ -43,4 +43,4 @@
43
43
  flex-shrink: 1;
44
44
  flex-grow: 1;
45
45
  }
46
- }
46
+ }
@@ -3,5 +3,10 @@ import type { CreateTypeFromInterface } from "./utils";
3
3
  import "./Reports.scss";
4
4
  import type { Report } from "@itwin/insights-client";
5
5
  export declare type ReportType = CreateTypeFromInterface<Report>;
6
- export declare const Reports: () => JSX.Element | null;
6
+ export interface ReportsProps {
7
+ onClickAddReport?: () => void;
8
+ onClickReportTitle?: (report: Report) => void;
9
+ onClickReportModify?: (report: Report) => void;
10
+ }
11
+ export declare const Reports: ({ onClickAddReport, onClickReportModify, onClickReportTitle, }: ReportsProps) => JSX.Element | null;
7
12
  //# sourceMappingURL=Reports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Reports.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/Reports.tsx"],"names":[],"mappings":";AAeA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAQvD,OAAO,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAcrD,oBAAY,UAAU,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;AA+BzD,eAAO,MAAM,OAAO,0BAiMnB,CAAC"}
1
+ {"version":3,"file":"Reports.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/Reports.tsx"],"names":[],"mappings":";AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAMvD,OAAO,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,wBAAwB,CAAC;AASpE,oBAAY,UAAU,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;AAsBzD,MAAM,WAAW,YAAY;IAC3B,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAED,eAAO,MAAM,OAAO,mEAIjB,YAAY,uBAmKd,CAAC"}
@@ -24,41 +24,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.Reports = void 0;
26
26
  /*---------------------------------------------------------------------------------------------
27
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
28
- * See LICENSE.md in the project root for license terms and full copyright notice.
29
- *--------------------------------------------------------------------------------------------*/
27
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
28
+ * See LICENSE.md in the project root for license terms and full copyright notice.
29
+ *--------------------------------------------------------------------------------------------*/
30
30
  const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
31
31
  const itwinui_react_1 = require("@itwin/itwinui-react");
32
32
  const react_1 = __importStar(require("react"));
33
33
  const utils_1 = require("./utils");
34
34
  require("./Reports.scss");
35
35
  const DeleteModal_1 = __importDefault(require("./DeleteModal"));
36
- const insights_client_1 = require("@itwin/insights-client");
37
- const ReportAction_1 = __importDefault(require("./ReportAction"));
38
- const ReportMappings_1 = require("./ReportMappings");
39
36
  const ReportHorizontalTile_1 = require("./ReportHorizontalTile");
40
37
  const SearchBar_1 = require("./SearchBar");
41
- const ReportsApiConfigContext_1 = require("../context/ReportsApiConfigContext");
38
+ const ReportsConfigApiContext_1 = require("../context/ReportsConfigApiContext");
42
39
  const ReportsConfigWidget_1 = require("../../ReportsConfigWidget");
43
- const appui_react_1 = require("@itwin/appui-react");
44
- const BulkExtractor_1 = __importDefault(require("./BulkExtractor"));
45
40
  const core_bentley_1 = require("@itwin/core-bentley");
46
- const ExtractionToast_1 = require("./ExtractionToast");
47
- var ReportsView;
48
- (function (ReportsView) {
49
- ReportsView["REPORTS"] = "reports";
50
- ReportsView["REPORTSMAPPING"] = "reportsmapping";
51
- ReportsView["ADDING"] = "adding";
52
- ReportsView["MODIFYING"] = "modifying";
53
- })(ReportsView || (ReportsView = {}));
54
- const fetchReports = async (setReports, iTwinId, setIsLoading, apiContext) => {
41
+ const BulkExtractorContext_1 = require("../context/BulkExtractorContext");
42
+ const fetchReports = async (setReports, iTwinId, setIsLoading, reportsClient, getAccessToken) => {
55
43
  try {
56
44
  if (!iTwinId)
57
45
  return;
58
46
  setIsLoading(true);
59
- const reportsClientApi = new insights_client_1.ReportsClient(utils_1.generateUrl(insights_client_1.REPORTING_BASE_PATH, apiContext.baseUrl));
60
- const accessToken = await apiContext.getAccessToken();
61
- const reports = await reportsClientApi.getReports(accessToken, iTwinId);
47
+ const accessToken = await getAccessToken();
48
+ const reports = await reportsClient.getReports(accessToken, iTwinId);
62
49
  setReports(reports !== null && reports !== void 0 ? reports : []);
63
50
  }
64
51
  catch (error) {
@@ -68,36 +55,21 @@ const fetchReports = async (setReports, iTwinId, setIsLoading, apiContext) => {
68
55
  setIsLoading(false);
69
56
  }
70
57
  };
71
- const Reports = () => {
72
- var _a, _b, _c;
73
- const successfulExtractionToast = (iModelName, odataFeedUrl) => {
74
- itwinui_react_1.toaster.positive(react_1.default.createElement(ExtractionToast_1.SuccessfulExtractionToast, { iModelName: iModelName, odataFeedUrl: odataFeedUrl }));
75
- };
76
- const failedExtractionToast = (iModelName) => {
77
- itwinui_react_1.toaster.negative(react_1.default.createElement(ExtractionToast_1.FailedExtractionToast, { iModelName: iModelName }));
78
- };
79
- const iTwinId = (_b = (_a = appui_react_1.useActiveIModelConnection()) === null || _a === void 0 ? void 0 : _a.iTwinId) !== null && _b !== void 0 ? _b : "";
80
- const apiConfig = ReportsApiConfigContext_1.useReportsApiConfig();
58
+ const Reports = ({ onClickAddReport, onClickReportModify, onClickReportTitle, }) => {
59
+ const { iTwinId, getAccessToken, reportsClient } = ReportsConfigApiContext_1.useReportsConfigApi();
60
+ const { bulkExtractor } = BulkExtractorContext_1.useBulkExtractor();
61
+ const [showDeleteModal, setShowDeleteModal] = react_1.useState(undefined);
81
62
  const [selectedReportIds, setSelectedReportIds] = react_1.useState([]);
82
- const [showDeleteModal, setShowDeleteModal] = react_1.useState(false);
83
- const [reportsView, setReportsView] = react_1.useState(ReportsView.REPORTS);
84
- const [selectedReport, setSelectedReport] = react_1.useState(undefined);
85
63
  const [isLoading, setIsLoading] = react_1.useState(true);
86
64
  const [searchValue, setSearchValue] = react_1.useState("");
87
65
  const [reports, setReports] = react_1.useState([]);
88
- const bulkExtractor = react_1.useMemo(() => new BulkExtractor_1.default(apiConfig, successfulExtractionToast, failedExtractionToast), [apiConfig]);
89
66
  const jobStartEvent = react_1.useMemo(() => new core_bentley_1.BeEvent(), []);
90
67
  react_1.useEffect(() => {
91
- void fetchReports(setReports, iTwinId, setIsLoading, apiConfig);
92
- }, [apiConfig, iTwinId, setIsLoading]);
68
+ void fetchReports(setReports, iTwinId, setIsLoading, reportsClient, getAccessToken);
69
+ }, [getAccessToken, iTwinId, reportsClient, setIsLoading]);
93
70
  const refresh = react_1.useCallback(async () => {
94
- setReportsView(ReportsView.REPORTS);
95
- setSelectedReport(undefined);
96
- await fetchReports(setReports, iTwinId, setIsLoading, apiConfig);
97
- }, [apiConfig, iTwinId, setReports]);
98
- const addReport = () => {
99
- setReportsView(ReportsView.ADDING);
100
- };
71
+ await fetchReports(setReports, iTwinId, setIsLoading, reportsClient, getAccessToken);
72
+ }, [getAccessToken, iTwinId, reportsClient]);
101
73
  const filteredReports = react_1.useMemo(() => reports.filter((x) => [x.displayName, x.description]
102
74
  .join(" ")
103
75
  .toLowerCase()
@@ -110,49 +82,36 @@ const Reports = () => {
110
82
  : [...sr, reportId]);
111
83
  };
112
84
  const updateDatasets = react_1.useCallback(async () => {
85
+ if (!bulkExtractor)
86
+ return;
113
87
  await bulkExtractor.runReportExtractions(selectedReportIds);
114
88
  selectedReportIds.map((reportId) => jobStartEvent.raiseEvent(reportId));
115
89
  setSelectedReportIds([]);
116
90
  }, [selectedReportIds, jobStartEvent, bulkExtractor]);
117
- switch (reportsView) {
118
- case ReportsView.ADDING:
119
- return iTwinId ? (react_1.default.createElement(ReportAction_1.default, { iTwinId: iTwinId !== null && iTwinId !== void 0 ? iTwinId : "", returnFn: refresh })) : null;
120
- case ReportsView.MODIFYING:
121
- return iTwinId ? (react_1.default.createElement(ReportAction_1.default, { iTwinId: iTwinId, report: selectedReport, returnFn: refresh })) : null;
122
- case ReportsView.REPORTSMAPPING:
123
- return selectedReport ? (react_1.default.createElement(ReportMappings_1.ReportMappings, { report: selectedReport, bulkExtractor: bulkExtractor, goBack: refresh })) : null;
124
- default:
125
- return (react_1.default.createElement(react_1.default.Fragment, null,
126
- react_1.default.createElement(utils_1.WidgetHeader, { title: ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:ITwinReports") }),
127
- react_1.default.createElement(itwinui_react_1.Surface, { className: "rcw-reports-list-container" },
128
- react_1.default.createElement("div", { className: "rcw-toolbar" },
129
- react_1.default.createElement(itwinui_react_1.Button, { startIcon: react_1.default.createElement(itwinui_icons_react_1.SvgAdd, null), onClick: () => addReport(), styleType: "high-visibility" }, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:New")),
130
- react_1.default.createElement(itwinui_react_1.IconButton, { title: ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:UpdateDatasets"), onClick: updateDatasets, disabled: selectedReportIds.length === 0 },
131
- react_1.default.createElement(itwinui_icons_react_1.SvgPlay, null)),
132
- react_1.default.createElement("div", { className: "rcw-search-bar-container", "data-testid": "rcw-search-bar" },
133
- react_1.default.createElement("div", { className: "rcw-search-button" },
134
- react_1.default.createElement(SearchBar_1.SearchBar, { searchValue: searchValue, setSearchValue: setSearchValue, disabled: isLoading })))),
135
- isLoading ? (react_1.default.createElement(utils_1.LoadingOverlay, null)) : reports.length === 0 ? (react_1.default.createElement(utils_1.EmptyMessage, null,
136
- react_1.default.createElement(react_1.default.Fragment, null,
137
- ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:NoReports"),
138
- react_1.default.createElement("div", null,
139
- react_1.default.createElement(itwinui_react_1.Button, { onClick: addReport, styleType: "cta" }, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:CreateOneReportCTA")))))) : (react_1.default.createElement("div", { className: "rcw-reports-list" }, filteredReports.map((report) => (react_1.default.createElement(ReportHorizontalTile_1.ReportHorizontalTile, { key: report.id, report: report, onClickTitle: () => {
140
- setSelectedReport(report);
141
- setReportsView(ReportsView.REPORTSMAPPING);
142
- }, jobStartEvent: jobStartEvent, bulkExtractor: bulkExtractor, onClickDelete: () => {
143
- setSelectedReport(report);
144
- setShowDeleteModal(true);
145
- }, onClickModify: () => {
146
- setSelectedReport(report);
147
- setReportsView(ReportsView.MODIFYING);
148
- }, onSelectionChange: onSelectionChange, selected: selectedReportIds.some((reportId) => report.id === reportId) })))))),
149
- react_1.default.createElement(DeleteModal_1.default, { entityName: (_c = selectedReport === null || selectedReport === void 0 ? void 0 : selectedReport.displayName) !== null && _c !== void 0 ? _c : "", show: showDeleteModal, setShow: setShowDeleteModal, onDelete: async () => {
150
- var _a;
151
- const reportsClientApi = new insights_client_1.ReportsClient(utils_1.generateUrl(insights_client_1.REPORTING_BASE_PATH, apiConfig.baseUrl));
152
- const accessToken = await apiConfig.getAccessToken();
153
- await reportsClientApi.deleteReport(accessToken, (_a = selectedReport === null || selectedReport === void 0 ? void 0 : selectedReport.id) !== null && _a !== void 0 ? _a : "");
154
- }, refresh: refresh })));
155
- }
91
+ if (!bulkExtractor)
92
+ return null;
93
+ return (react_1.default.createElement(react_1.default.Fragment, null,
94
+ react_1.default.createElement(itwinui_react_1.Surface, { className: "rcw-reports-list-container" },
95
+ react_1.default.createElement("div", { className: "rcw-toolbar" },
96
+ onClickAddReport && (react_1.default.createElement(itwinui_react_1.Button, { startIcon: react_1.default.createElement(itwinui_icons_react_1.SvgAdd, null), onClick: onClickAddReport, styleType: "high-visibility" }, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:New"))),
97
+ react_1.default.createElement(itwinui_react_1.IconButton, { title: ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:UpdateDatasets"), onClick: updateDatasets, disabled: selectedReportIds.length === 0 },
98
+ react_1.default.createElement(itwinui_icons_react_1.SvgPlay, null)),
99
+ react_1.default.createElement("div", { className: "rcw-search-bar-container", "data-testid": "rcw-search-bar" },
100
+ react_1.default.createElement(itwinui_react_1.IconButton, { title: ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:Refresh"), onClick: refresh, disabled: isLoading, styleType: "borderless" },
101
+ react_1.default.createElement(itwinui_icons_react_1.SvgRefresh, null)),
102
+ react_1.default.createElement(SearchBar_1.SearchBar, { searchValue: searchValue, setSearchValue: setSearchValue, disabled: isLoading }))),
103
+ isLoading ? (react_1.default.createElement(utils_1.LoadingOverlay, null)) : reports.length === 0 && onClickAddReport ? (react_1.default.createElement(utils_1.EmptyMessage, null,
104
+ react_1.default.createElement(react_1.default.Fragment, null,
105
+ ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:NoReports"),
106
+ react_1.default.createElement("div", null,
107
+ react_1.default.createElement(itwinui_react_1.Button, { onClick: onClickAddReport, styleType: "cta" }, ReportsConfigWidget_1.ReportsConfigWidget.localization.getLocalizedString("ReportsConfigWidget:CreateOneReportCTA")))))) : (react_1.default.createElement("div", { className: "rcw-reports-list" }, filteredReports.map((report) => (react_1.default.createElement(ReportHorizontalTile_1.ReportHorizontalTile, { key: report.id, report: report, onClickTitle: onClickReportTitle, jobStartEvent: jobStartEvent, bulkExtractor: bulkExtractor, onClickDelete: () => {
108
+ setShowDeleteModal(report);
109
+ }, onClickModify: onClickReportModify, onSelectionChange: onSelectionChange, selected: selectedReportIds.some((reportId) => report.id === reportId) })))))),
110
+ react_1.default.createElement(DeleteModal_1.default, { entityName: showDeleteModal === null || showDeleteModal === void 0 ? void 0 : showDeleteModal.displayName, onClose: () => setShowDeleteModal(undefined), onDelete: async () => {
111
+ var _a;
112
+ const accessToken = await getAccessToken();
113
+ await reportsClient.deleteReport(accessToken, (_a = showDeleteModal === null || showDeleteModal === void 0 ? void 0 : showDeleteModal.id) !== null && _a !== void 0 ? _a : "");
114
+ }, refresh: refresh })));
156
115
  };
157
116
  exports.Reports = Reports;
158
117
  //# sourceMappingURL=Reports.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Reports.js","sourceRoot":"","sources":["../../../../src/widget/components/Reports.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,oEAGoC;AACpC,wDAK8B;AAC9B,+CAAyE;AAEzE,mCAMiB;AACjB,0BAAwB;AACxB,gEAAwC;AAEx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AC,EACD,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,GAAG,EAAE;4BAClB,iBAAiB,CAAC,MAAM,CAAC,CAAC;4BAC1B,kBAAkB,CAAC,IAAI,CAAC,CAAC;wBAC3B,CAAC,EACD,aAAa,EAAE,GAAG,EAAE;4BAClB,iBAAiB,CAAC,MAAM,CAAC,CAAC;4BAC1B,cAAc,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;wBACxC,CAAC,EACD,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,QAAQ,CAAC,GACtE,CACH,CAAC,CACE,CACP,CACO;gBACV,8BAAC,qBAAW,IACV,UAAU,EAAE,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,WAAW,mCAAI,EAAE,EAC7C,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,KAAK,IAAI,EAAE;;wBACnB,MAAM,gBAAgB,GAAG,IAAI,+BAAa,CACxC,mBAAW,CAAC,qCAAmB,EAAE,SAAS,CAAC,OAAO,CAAC,CACpD,CAAC;wBACF,MAAM,WAAW,GAAG,MAAM,SAAS,CAAC,cAAc,EAAE,CAAC;wBACrD,MAAM,gBAAgB,CAAC,YAAY,CACjC,WAAW,EACX,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,EAAE,mCAAI,EAAE,CACzB,CAAC;oBACJ,CAAC,EACD,OAAO,EAAE,OAAO,GAChB,CACD,CACJ,CAAC;KACL;AACH,CAAC,CAAC;AAjMW,QAAA,OAAO,WAiMlB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport {\n SvgAdd,\n SvgPlay,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n IconButton,\n Surface,\n toaster,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"./utils\";\nimport {\n EmptyMessage,\n generateUrl,\n handleError,\n LoadingOverlay,\n WidgetHeader,\n} from \"./utils\";\nimport \"./Reports.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport type { Report } from \"@itwin/insights-client\";\nimport { REPORTING_BASE_PATH, ReportsClient } from \"@itwin/insights-client\";\nimport ReportAction from \"./ReportAction\";\nimport { ReportMappings } from \"./ReportMappings\";\nimport { ReportHorizontalTile } from \"./ReportHorizontalTile\";\nimport { SearchBar } from \"./SearchBar\";\nimport type { ReportsApiConfig } from \"../context/ReportsApiConfigContext\";\nimport { useReportsApiConfig } from \"../context/ReportsApiConfigContext\";\nimport { ReportsConfigWidget } from \"../../ReportsConfigWidget\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport BulkExtractor from \"./BulkExtractor\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { FailedExtractionToast, SuccessfulExtractionToast } from \"./ExtractionToast\";\n\nexport type ReportType = CreateTypeFromInterface<Report>;\n\nenum ReportsView {\n REPORTS = \"reports\",\n REPORTSMAPPING = \"reportsmapping\",\n ADDING = \"adding\",\n MODIFYING = \"modifying\",\n}\n\nconst fetchReports = async (\n setReports: React.Dispatch<React.SetStateAction<Report[]>>,\n iTwinId: string | undefined,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n apiContext: ReportsApiConfig\n) => {\n try {\n if (!iTwinId) return;\n setIsLoading(true);\n const reportsClientApi = new ReportsClient(\n generateUrl(REPORTING_BASE_PATH, apiContext.baseUrl)\n );\n const accessToken = await apiContext.getAccessToken();\n const reports = await reportsClientApi.getReports(accessToken, iTwinId);\n setReports(reports ?? []);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\nexport const Reports = () => {\n const successfulExtractionToast = (iModelName: string, odataFeedUrl: string) => {\n toaster.positive(<SuccessfulExtractionToast iModelName={iModelName} odataFeedUrl={odataFeedUrl} />);\n };\n\n const failedExtractionToast = (iModelName: string) => {\n toaster.negative(<FailedExtractionToast iModelName={iModelName} />);\n };\n\n const iTwinId = useActiveIModelConnection()?.iTwinId ?? \"\";\n const apiConfig = useReportsApiConfig();\n const [selectedReportIds, setSelectedReportIds] = useState<string[]>([]);\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [reportsView, setReportsView] = useState<ReportsView>(\n ReportsView.REPORTS\n );\n const [selectedReport, setSelectedReport] = useState<Report | undefined>(\n undefined\n );\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [searchValue, setSearchValue] = useState<string>(\"\");\n const [reports, setReports] = useState<Report[]>([]);\n const bulkExtractor = useMemo(\n () => new BulkExtractor(apiConfig, successfulExtractionToast, failedExtractionToast),\n [apiConfig]\n );\n const jobStartEvent = useMemo(\n () => new BeEvent<(reportId: string) => void>(),\n []\n );\n\n useEffect(() => {\n void fetchReports(setReports, iTwinId, setIsLoading, apiConfig);\n }, [apiConfig, iTwinId, setIsLoading]);\n\n const refresh = useCallback(async () => {\n setReportsView(ReportsView.REPORTS);\n setSelectedReport(undefined);\n await fetchReports(setReports, iTwinId, setIsLoading, apiConfig);\n }, [apiConfig, iTwinId, setReports]);\n\n const addReport = () => {\n setReportsView(ReportsView.ADDING);\n };\n\n const filteredReports = useMemo(\n () =>\n reports.filter((x) =>\n [x.displayName, x.description]\n .join(\" \")\n .toLowerCase()\n .includes(searchValue.toLowerCase())\n ),\n [reports, searchValue]\n );\n\n const onSelectionChange = (reportId: string, control: boolean) => {\n if (!control)\n setSelectedReportIds([]);\n\n setSelectedReportIds((sr) =>\n sr.some((r) => reportId === r)\n ? sr.filter(\n (r) => reportId !== r\n )\n : [...sr, reportId]\n );\n };\n\n const updateDatasets = useCallback(async () => {\n await bulkExtractor.runReportExtractions(selectedReportIds);\n selectedReportIds.map((reportId) => jobStartEvent.raiseEvent(reportId));\n setSelectedReportIds([]);\n }, [selectedReportIds, jobStartEvent, bulkExtractor]);\n\n switch (reportsView) {\n case ReportsView.ADDING:\n return iTwinId ? (\n <ReportAction iTwinId={iTwinId ?? \"\"} returnFn={refresh} />\n ) : null;\n case ReportsView.MODIFYING:\n return iTwinId ? (\n <ReportAction\n iTwinId={iTwinId}\n report={selectedReport}\n returnFn={refresh}\n />\n ) : null;\n case ReportsView.REPORTSMAPPING:\n return selectedReport ? (\n <ReportMappings report={selectedReport} bulkExtractor={bulkExtractor} goBack={refresh} />\n ) : null;\n default:\n return (\n <>\n <WidgetHeader\n title={ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:ITwinReports\"\n )}\n />\n <Surface className=\"rcw-reports-list-container\">\n <div className=\"rcw-toolbar\">\n <Button\n startIcon={<SvgAdd />}\n onClick={() => addReport()}\n styleType=\"high-visibility\"\n >\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:New\"\n )}\n </Button>\n <IconButton\n title={ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:UpdateDatasets\"\n )}\n onClick={updateDatasets}\n disabled={selectedReportIds.length === 0}\n >\n <SvgPlay />\n </IconButton>\n <div className=\"rcw-search-bar-container\" data-testid=\"rcw-search-bar\">\n <div className=\"rcw-search-button\">\n <SearchBar\n searchValue={searchValue}\n setSearchValue={setSearchValue}\n disabled={isLoading}\n />\n </div>\n </div>\n </div>\n {isLoading ? (\n <LoadingOverlay />\n ) : reports.length === 0 ? (\n <EmptyMessage>\n <>\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:NoReports\"\n )}\n <div>\n <Button onClick={addReport} styleType=\"cta\">\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:CreateOneReportCTA\"\n )}\n </Button>\n </div>\n </>\n </EmptyMessage>\n ) : (\n <div className=\"rcw-reports-list\">\n {filteredReports.map((report) => (\n <ReportHorizontalTile\n key={report.id}\n report={report}\n onClickTitle={() => {\n setSelectedReport(report);\n setReportsView(ReportsView.REPORTSMAPPING);\n }}\n jobStartEvent={jobStartEvent}\n bulkExtractor={bulkExtractor}\n onClickDelete={() => {\n setSelectedReport(report);\n setShowDeleteModal(true);\n }}\n onClickModify={() => {\n setSelectedReport(report);\n setReportsView(ReportsView.MODIFYING);\n }}\n onSelectionChange={onSelectionChange}\n selected={selectedReportIds.some((reportId) => report.id === reportId)}\n />\n ))}\n </div>\n )}\n </Surface>\n <DeleteModal\n entityName={selectedReport?.displayName ?? \"\"}\n show={showDeleteModal}\n setShow={setShowDeleteModal}\n onDelete={async () => {\n const reportsClientApi = new ReportsClient(\n generateUrl(REPORTING_BASE_PATH, apiConfig.baseUrl)\n );\n const accessToken = await apiConfig.getAccessToken();\n await reportsClientApi.deleteReport(\n accessToken,\n selectedReport?.id ?? \"\"\n );\n }}\n refresh={refresh}\n />\n </>\n );\n }\n};\n"]}
1
+ {"version":3,"file":"Reports.js","sourceRoot":"","sources":["../../../../src/widget/components/Reports.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,oEAAyE;AACzE,wDAAmE;AACnE,+CAAyE;AAEzE,mCAIiB;AACjB,0BAAwB;AACxB,gEAAwC;AAExC,iEAA8D;AAC9D,2CAAwC;AACxC,gFAAyE;AACzE,mEAAgE;AAEhE,sDAA8C;AAC9C,0EAAmE;AAInE,MAAM,YAAY,GAAG,KAAK,EACxB,UAAuC,EACvC,OAA2B,EAC3B,YAA0C,EAC1C,aAA4B,EAC5B,cAA0C,EAC1C,EAAE;IACF,IAAI;QACF,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;QAC3C,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,UAAU,CAAC,WAAW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AC,sBAAM,IAAC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAC,KAAK,IAC/C,yCAAmB,CAAC,YAAY,CAAC,kBAAkB,CAClD,wCAAwC,CACzC,CACM,CACL,CACL,CACU,CAChB,CAAC,CAAC,CAAC,CACF,uCAAK,SAAS,EAAC,kBAAkB,IAC9B,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC/B,8BAAC,2CAAoB,IACnB,GAAG,EAAE,MAAM,CAAC,EAAE,EACd,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,kBAAkB,EAChC,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,GAAG,EAAE;oBAClB,kBAAkB,CAAC,MAAM,CAAC,CAAC;gBAC7B,CAAC,EACD,aAAa,EAAE,mBAAmB,EAClC,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,iBAAiB,CAAC,IAAI,CAC9B,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,QAAQ,CACrC,GACD,CACH,CAAC,CACE,CACP,CACO;QACV,8BAAC,qBAAW,IACV,UAAU,EAAE,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,WAAW,EACxC,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAC5C,QAAQ,EAAE,KAAK,IAAI,EAAE;;gBACnB,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;gBAC3C,MAAM,aAAa,CAAC,YAAY,CAC9B,WAAW,EACX,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,EAAE,mCAAI,EAAE,CAC1B,CAAC;YACJ,CAAC,EACD,OAAO,EAAE,OAAO,GAChB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAvKW,QAAA,OAAO,WAuKlB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport { SvgAdd, SvgPlay, SvgRefresh } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton, Surface } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"./utils\";\nimport {\n EmptyMessage,\n handleError,\n LoadingOverlay,\n} from \"./utils\";\nimport \"./Reports.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport type { Report, ReportsClient } from \"@itwin/insights-client\";\nimport { ReportHorizontalTile } from \"./ReportHorizontalTile\";\nimport { SearchBar } from \"./SearchBar\";\nimport { useReportsConfigApi } from \"../context/ReportsConfigApiContext\";\nimport { ReportsConfigWidget } from \"../../ReportsConfigWidget\";\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { useBulkExtractor } from \"../context/BulkExtractorContext\";\n\nexport type ReportType = CreateTypeFromInterface<Report>;\n\nconst fetchReports = async (\n setReports: (reports: Report[]) => void,\n iTwinId: string | undefined,\n setIsLoading: (isLoading: boolean) => void,\n reportsClient: ReportsClient,\n getAccessToken: () => Promise<AccessToken>\n) => {\n try {\n if (!iTwinId) return;\n setIsLoading(true);\n const accessToken = await getAccessToken();\n const reports = await reportsClient.getReports(accessToken, iTwinId);\n setReports(reports ?? []);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\nexport interface ReportsProps {\n onClickAddReport?: () => void;\n onClickReportTitle?: (report: Report) => void;\n onClickReportModify?: (report: Report) => void;\n}\n\nexport const Reports = ({\n onClickAddReport,\n onClickReportModify,\n onClickReportTitle,\n}: ReportsProps) => {\n const { iTwinId, getAccessToken, reportsClient } = useReportsConfigApi();\n const { bulkExtractor } = useBulkExtractor();\n const [showDeleteModal, setShowDeleteModal] = useState<Report | undefined>(\n undefined\n );\n const [selectedReportIds, setSelectedReportIds] = useState<string[]>([]);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [searchValue, setSearchValue] = useState<string>(\"\");\n const [reports, setReports] = useState<Report[]>([]);\n const jobStartEvent = useMemo(\n () => new BeEvent<(reportId: string) => void>(),\n []\n );\n\n useEffect(() => {\n void fetchReports(\n setReports,\n iTwinId,\n setIsLoading,\n reportsClient,\n getAccessToken\n );\n }, [getAccessToken, iTwinId, reportsClient, setIsLoading]);\n\n const refresh = useCallback(async () => {\n await fetchReports(\n setReports,\n iTwinId,\n setIsLoading,\n reportsClient,\n getAccessToken\n );\n }, [getAccessToken, iTwinId, reportsClient]);\n\n const filteredReports = useMemo(\n () =>\n reports.filter((x) =>\n [x.displayName, x.description]\n .join(\" \")\n .toLowerCase()\n .includes(searchValue.toLowerCase())\n ),\n [reports, searchValue]\n );\n\n const onSelectionChange = (reportId: string, control: boolean) => {\n if (!control) setSelectedReportIds([]);\n\n setSelectedReportIds((sr) =>\n sr.some((r) => reportId === r)\n ? sr.filter((r) => reportId !== r)\n : [...sr, reportId]\n );\n };\n\n const updateDatasets = useCallback(async () => {\n if (!bulkExtractor) return;\n await bulkExtractor.runReportExtractions(selectedReportIds);\n selectedReportIds.map((reportId) => jobStartEvent.raiseEvent(reportId));\n setSelectedReportIds([]);\n }, [selectedReportIds, jobStartEvent, bulkExtractor]);\n\n if (!bulkExtractor) return null;\n\n return (\n <>\n <Surface className=\"rcw-reports-list-container\">\n <div className=\"rcw-toolbar\">\n {onClickAddReport && (\n <Button\n startIcon={<SvgAdd />}\n onClick={onClickAddReport}\n styleType=\"high-visibility\"\n >\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:New\"\n )}\n </Button>\n )}\n <IconButton\n title={ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:UpdateDatasets\"\n )}\n onClick={updateDatasets}\n disabled={selectedReportIds.length === 0}\n >\n <SvgPlay />\n </IconButton>\n <div\n className=\"rcw-search-bar-container\"\n data-testid=\"rcw-search-bar\"\n >\n <IconButton\n title={ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:Refresh\"\n )}\n onClick={refresh}\n disabled={isLoading}\n styleType=\"borderless\"\n >\n <SvgRefresh />\n </IconButton>\n <SearchBar\n searchValue={searchValue}\n setSearchValue={setSearchValue}\n disabled={isLoading}\n />\n </div>\n </div>\n {isLoading ? (\n <LoadingOverlay />\n ) : reports.length === 0 && onClickAddReport ? (\n <EmptyMessage>\n <>\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:NoReports\"\n )}\n <div>\n <Button onClick={onClickAddReport} styleType=\"cta\">\n {ReportsConfigWidget.localization.getLocalizedString(\n \"ReportsConfigWidget:CreateOneReportCTA\"\n )}\n </Button>\n </div>\n </>\n </EmptyMessage>\n ) : (\n <div className=\"rcw-reports-list\">\n {filteredReports.map((report) => (\n <ReportHorizontalTile\n key={report.id}\n report={report}\n onClickTitle={onClickReportTitle}\n jobStartEvent={jobStartEvent}\n bulkExtractor={bulkExtractor}\n onClickDelete={() => {\n setShowDeleteModal(report);\n }}\n onClickModify={onClickReportModify}\n onSelectionChange={onSelectionChange}\n selected={selectedReportIds.some(\n (reportId) => report.id === reportId\n )}\n />\n ))}\n </div>\n )}\n </Surface>\n <DeleteModal\n entityName={showDeleteModal?.displayName}\n onClose={() => setShowDeleteModal(undefined)}\n onDelete={async () => {\n const accessToken = await getAccessToken();\n await reportsClient.deleteReport(\n accessToken,\n showDeleteModal?.id ?? \"\"\n );\n }}\n refresh={refresh}\n />\n </>\n );\n};\n"]}
@@ -0,0 +1,18 @@
1
+ import { IModelsClient } from "@itwin/imodels-client-management";
2
+ import { ExtractionClient, MappingsClient, ReportsClient } from "@itwin/insights-client";
3
+ import React from "react";
4
+ import type { GetAccessTokenFn } from "../context/ReportsConfigApiContext";
5
+ import { BulkExtractor } from "./BulkExtractor";
6
+ export interface ReportsConfigContextProps {
7
+ getAccessToken?: GetAccessTokenFn;
8
+ baseUrl?: string;
9
+ iTwinId: string;
10
+ bulkExtractor?: BulkExtractor;
11
+ reportsClient?: ReportsClient;
12
+ mappingsClient?: MappingsClient;
13
+ extractionClient?: ExtractionClient;
14
+ iModelsClient?: IModelsClient;
15
+ children?: React.ReactNode;
16
+ }
17
+ export declare const ReportsConfigContext: (props: ReportsConfigContextProps) => JSX.Element;
18
+ //# sourceMappingURL=ReportsConfigContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReportsConfigContext.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/ReportsConfigContext.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAa,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAuB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE9G,OAAO,KAAoD,MAAM,OAAO,CAAC;AAEzE,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,MAAM,WAAW,yBAAyB;IACxC,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAKD,eAAO,MAAM,oBAAoB,UAAW,yBAAyB,gBA0DpE,CAAC"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.ReportsConfigContext = void 0;
23
+ /*---------------------------------------------------------------------------------------------
24
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
+ * See LICENSE.md in the project root for license terms and full copyright notice.
26
+ *--------------------------------------------------------------------------------------------*/
27
+ const core_frontend_1 = require("@itwin/core-frontend");
28
+ const imodels_client_management_1 = require("@itwin/imodels-client-management");
29
+ const insights_client_1 = require("@itwin/insights-client");
30
+ const itwinui_react_1 = require("@itwin/itwinui-react");
31
+ const react_1 = __importStar(require("react"));
32
+ const BulkExtractorContext_1 = require("../context/BulkExtractorContext");
33
+ const ReportsConfigApiContext_1 = require("../context/ReportsConfigApiContext");
34
+ const ReportsConfigUiProvider_1 = require("../ReportsConfigUiProvider");
35
+ const BulkExtractor_1 = require("./BulkExtractor");
36
+ const ExtractionToast_1 = require("./ExtractionToast");
37
+ const utils_1 = require("./utils");
38
+ const authorizationClientGetAccessToken = async () => { var _a, _b; return (_b = (await ((_a = core_frontend_1.IModelApp.authorizationClient) === null || _a === void 0 ? void 0 : _a.getAccessToken()))) !== null && _b !== void 0 ? _b : ""; };
39
+ const ReportsConfigContext = (props) => {
40
+ var _a, _b, _c, _d, _e;
41
+ const reportsBaseUrl = react_1.useCallback(() => utils_1.generateUrl(insights_client_1.REPORTING_BASE_PATH, props.baseUrl || ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL), [props.baseUrl]);
42
+ const iModelClientOptions = react_1.useMemo(() => {
43
+ var _a;
44
+ return ({
45
+ api: { baseUrl: utils_1.generateUrl(imodels_client_management_1.Constants.api.baseUrl, (_a = props.baseUrl) !== null && _a !== void 0 ? _a : ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL) },
46
+ });
47
+ }, [props.baseUrl]);
48
+ const [extractionClient, setExtractionClient] = react_1.useState((_a = props.extractionClient) !== null && _a !== void 0 ? _a : new insights_client_1.ExtractionClient(reportsBaseUrl()));
49
+ const [apiConfig, setApiConfig] = react_1.useState({
50
+ getAccessToken: (_b = props.getAccessToken) !== null && _b !== void 0 ? _b : authorizationClientGetAccessToken,
51
+ baseUrl: reportsBaseUrl(),
52
+ iTwinId: props.iTwinId,
53
+ reportsClient: (_c = props.reportsClient) !== null && _c !== void 0 ? _c : new insights_client_1.ReportsClient(reportsBaseUrl()),
54
+ mappingsClient: (_d = props.mappingsClient) !== null && _d !== void 0 ? _d : new insights_client_1.MappingsClient(reportsBaseUrl()),
55
+ iModelsClient: (_e = props.iModelsClient) !== null && _e !== void 0 ? _e : new imodels_client_management_1.IModelsClient(iModelClientOptions),
56
+ });
57
+ react_1.useEffect(() => {
58
+ var _a;
59
+ if (!props.extractionClient) {
60
+ setExtractionClient((_a = props.extractionClient) !== null && _a !== void 0 ? _a : new insights_client_1.ExtractionClient(reportsBaseUrl()));
61
+ }
62
+ }, [props.extractionClient, reportsBaseUrl]);
63
+ const successfulExtractionToast = (iModelName, odataFeedUrl) => {
64
+ itwinui_react_1.toaster.positive(react_1.default.createElement(ExtractionToast_1.SuccessfulExtractionToast, { iModelName: iModelName, odataFeedUrl: odataFeedUrl }));
65
+ };
66
+ const failedExtractionToast = (iModelName) => {
67
+ itwinui_react_1.toaster.negative(react_1.default.createElement(ExtractionToast_1.FailedExtractionToast, { iModelName: iModelName }));
68
+ };
69
+ const bulkExtractor = react_1.useMemo(() => { var _a; return ({ bulkExtractor: (_a = props.bulkExtractor) !== null && _a !== void 0 ? _a : new BulkExtractor_1.BulkExtractor(apiConfig.reportsClient, extractionClient, apiConfig.getAccessToken, successfulExtractionToast, failedExtractionToast) }); }, [apiConfig.getAccessToken, apiConfig.reportsClient, extractionClient, props.bulkExtractor]);
70
+ react_1.useEffect(() => {
71
+ setApiConfig(() => {
72
+ var _a, _b, _c, _d;
73
+ return ({
74
+ getAccessToken: (_a = props.getAccessToken) !== null && _a !== void 0 ? _a : authorizationClientGetAccessToken,
75
+ baseUrl: props.baseUrl || ReportsConfigUiProvider_1.REPORTS_CONFIG_BASE_URL,
76
+ iTwinId: props.iTwinId,
77
+ reportsClient: (_b = props.reportsClient) !== null && _b !== void 0 ? _b : new insights_client_1.ReportsClient(reportsBaseUrl()),
78
+ mappingsClient: (_c = props.mappingsClient) !== null && _c !== void 0 ? _c : new insights_client_1.MappingsClient(reportsBaseUrl()),
79
+ iModelsClient: (_d = props.iModelsClient) !== null && _d !== void 0 ? _d : new imodels_client_management_1.IModelsClient(iModelClientOptions),
80
+ });
81
+ });
82
+ }, [props.getAccessToken, props.baseUrl, props.iTwinId, props.reportsClient, props.mappingsClient, props.iModelsClient, reportsBaseUrl, iModelClientOptions]);
83
+ return (react_1.default.createElement(ReportsConfigApiContext_1.ReportsConfigApiContext.Provider, { value: apiConfig },
84
+ react_1.default.createElement(BulkExtractorContext_1.BulkExtractorContext.Provider, { value: bulkExtractor }, props.children)));
85
+ };
86
+ exports.ReportsConfigContext = ReportsConfigContext;
87
+ //# sourceMappingURL=ReportsConfigContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReportsConfigContext.js","sourceRoot":"","sources":["../../../../src/widget/components/ReportsConfigContext.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAAiD;AAEjD,gFAA4E;AAC5E,4DAA8G;AAC9G,wDAA+C;AAC/C,+CAAyE;A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,MAAA,KAAK,CAAC,cAAc,mCAAI,iCAAiC;gBACzE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,iDAAuB;gBACjD,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,aAAa,EAAE,MAAA,KAAK,CAAC,aAAa,mCAAI,IAAI,+BAAa,CAAC,cAAc,EAAE,CAAC;gBACzE,cAAc,EAAE,MAAA,KAAK,CAAC,cAAc,mCAAI,IAAI,gCAAc,CAAC,cAAc,EAAE,CAAC;gBAC5E,aAAa,EAAE,MAAA,KAAK,CAAC,aAAa,mCAAI,IAAI,yCAAa,CAAC,mBAAmB,CAAC;aAC7E,CAAC,CAAA;SAAA,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,aAAa,EAAE,cAAc,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAE9J,OAAO,CACL,8BAAC,iDAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS;QAChD,8BAAC,2CAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,IAChD,KAAK,CAAC,QAAQ,CACe,CACC,CACpC,CAAC;AACJ,CAAC,CAAC;AA1DW,QAAA,oBAAoB,wBA0D/B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { IModelsClientOptions } from \"@itwin/imodels-client-management\";\nimport { Constants, IModelsClient } from \"@itwin/imodels-client-management\";\nimport { ExtractionClient, MappingsClient, REPORTING_BASE_PATH, ReportsClient } from \"@itwin/insights-client\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { BulkExtractorContext } from \"../context/BulkExtractorContext\";\nimport type {\n GetAccessTokenFn,\n ReportsConfigApiProps,\n} from \"../context/ReportsConfigApiContext\";\nimport { ReportsConfigApiContext } from \"../context/ReportsConfigApiContext\";\nimport { REPORTS_CONFIG_BASE_URL } from \"../ReportsConfigUiProvider\";\nimport { BulkExtractor } from \"./BulkExtractor\";\nimport { FailedExtractionToast, SuccessfulExtractionToast } from \"./ExtractionToast\";\nimport { generateUrl } from \"./utils\";\n\nexport interface ReportsConfigContextProps {\n getAccessToken?: GetAccessTokenFn;\n baseUrl?: string;\n iTwinId: string;\n bulkExtractor?: BulkExtractor;\n reportsClient?: ReportsClient;\n mappingsClient?: MappingsClient;\n extractionClient?: ExtractionClient;\n iModelsClient?: IModelsClient;\n children?: React.ReactNode;\n}\n\nconst authorizationClientGetAccessToken = async () =>\n (await IModelApp.authorizationClient?.getAccessToken()) ?? \"\";\n\nexport const ReportsConfigContext = (props: ReportsConfigContextProps) => {\n const reportsBaseUrl = useCallback(() => generateUrl(\n REPORTING_BASE_PATH,\n props.baseUrl || REPORTS_CONFIG_BASE_URL\n ), [props.baseUrl]);\n const iModelClientOptions: IModelsClientOptions = useMemo(() => ({\n api: { baseUrl: generateUrl(Constants.api.baseUrl, props.baseUrl ?? REPORTS_CONFIG_BASE_URL) },\n }), [props.baseUrl]);\n const [extractionClient, setExtractionClient] = useState<ExtractionClient>(\n props.extractionClient ?? new ExtractionClient(reportsBaseUrl())\n );\n\n const [apiConfig, setApiConfig] = useState<ReportsConfigApiProps>({\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n baseUrl: reportsBaseUrl(),\n iTwinId: props.iTwinId,\n reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),\n mappingsClient: props.mappingsClient ?? new MappingsClient(reportsBaseUrl()),\n iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),\n });\n\n useEffect(() => {\n if (!props.extractionClient) {\n setExtractionClient(props.extractionClient ?? new ExtractionClient(reportsBaseUrl()));\n }\n }, [props.extractionClient, reportsBaseUrl]);\n\n const successfulExtractionToast = (iModelName: string, odataFeedUrl: string) => {\n toaster.positive(<SuccessfulExtractionToast iModelName={iModelName} odataFeedUrl={odataFeedUrl} />);\n };\n\n const failedExtractionToast = (iModelName: string) => {\n toaster.negative(<FailedExtractionToast iModelName={iModelName} />);\n };\n\n const bulkExtractor = useMemo(\n () => ({ bulkExtractor: props.bulkExtractor ?? new BulkExtractor(apiConfig.reportsClient, extractionClient, apiConfig.getAccessToken, successfulExtractionToast, failedExtractionToast) }),\n [apiConfig.getAccessToken, apiConfig.reportsClient, extractionClient, props.bulkExtractor]\n );\n\n useEffect(() => {\n setApiConfig(() => ({\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n baseUrl: props.baseUrl || REPORTS_CONFIG_BASE_URL,\n iTwinId: props.iTwinId,\n reportsClient: props.reportsClient ?? new ReportsClient(reportsBaseUrl()),\n mappingsClient: props.mappingsClient ?? new MappingsClient(reportsBaseUrl()),\n iModelsClient: props.iModelsClient ?? new IModelsClient(iModelClientOptions),\n }));\n }, [props.getAccessToken, props.baseUrl, props.iTwinId, props.reportsClient, props.mappingsClient, props.iModelsClient, reportsBaseUrl, iModelClientOptions]);\n\n return (\n <ReportsConfigApiContext.Provider value={apiConfig}>\n <BulkExtractorContext.Provider value={bulkExtractor}>\n {props.children}\n </BulkExtractorContext.Provider>\n </ReportsConfigApiContext.Provider>\n );\n};\n"]}
@@ -1,10 +1,24 @@
1
1
  /// <reference types="react" />
2
2
  import type { AccessToken } from "@itwin/core-bentley";
3
3
  import "./ReportsContainer.scss";
4
+ import type { Report } from "@itwin/insights-client";
4
5
  interface ReportsContainerProps {
5
6
  getAccessToken?: () => Promise<AccessToken>;
6
7
  baseUrl: string;
7
8
  }
9
+ export declare enum RouteStep {
10
+ ReportsList = 0,
11
+ ReportAction = 1,
12
+ ReportMappings = 2
13
+ }
14
+ export interface ReportsRouteFields {
15
+ report?: Report;
16
+ }
17
+ export interface Route {
18
+ step: RouteStep;
19
+ title: string;
20
+ reportsRoutingFields: ReportsRouteFields;
21
+ }
8
22
  declare const ReportsContainer: ({ getAccessToken, baseUrl, }: ReportsContainerProps) => JSX.Element;
9
23
  export default ReportsContainer;
10
24
  //# sourceMappingURL=ReportsContainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReportsContainer.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/ReportsContainer.tsx"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAMvD,OAAO,yBAAyB,CAAC;AAEjC,UAAU,qBAAqB;IAC7B,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;CACjB;AAKD,QAAA,MAAM,gBAAgB,iCAGnB,qBAAqB,gBAoBvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"ReportsContainer.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/ReportsContainer.tsx"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAMrD,UAAU,qBAAqB;IAC7B,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,oBAAY,SAAS;IACnB,WAAW,IAAA;IACX,YAAY,IAAA;IACZ,cAAc,IAAA;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB,EAAE,kBAAkB,CAAC;CAC1C;AAED,QAAA,MAAM,gBAAgB,iCAGnB,qBAAqB,gBAgCvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -19,26 +19,38 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- const core_frontend_1 = require("@itwin/core-frontend");
22
+ exports.RouteStep = void 0;
23
23
  const react_1 = __importStar(require("react"));
24
- const Reports_1 = require("../components/Reports");
25
- const ReportsApiConfigContext_1 = require("../context/ReportsApiConfigContext");
26
24
  require("./ReportsContainer.scss");
27
- const authorizationClientGetAccessToken = async () => { var _a, _b; return (_b = (await ((_a = core_frontend_1.IModelApp.authorizationClient) === null || _a === void 0 ? void 0 : _a.getAccessToken()))) !== null && _b !== void 0 ? _b : ""; };
25
+ const appui_react_1 = require("@itwin/appui-react");
26
+ const ReportsHeader_1 = require("./ReportsHeader");
27
+ const ReportsRouter_1 = require("./ReportsRouter");
28
+ const ReportsConfigContext_1 = require("./ReportsConfigContext");
29
+ var RouteStep;
30
+ (function (RouteStep) {
31
+ RouteStep[RouteStep["ReportsList"] = 0] = "ReportsList";
32
+ RouteStep[RouteStep["ReportAction"] = 1] = "ReportAction";
33
+ RouteStep[RouteStep["ReportMappings"] = 2] = "ReportMappings";
34
+ })(RouteStep = exports.RouteStep || (exports.RouteStep = {}));
28
35
  const ReportsContainer = ({ getAccessToken, baseUrl, }) => {
29
- const [apiConfig, setApiConfig] = react_1.useState({
30
- getAccessToken: getAccessToken !== null && getAccessToken !== void 0 ? getAccessToken : authorizationClientGetAccessToken,
31
- baseUrl,
32
- });
33
- react_1.useEffect(() => {
34
- setApiConfig(() => ({
35
- baseUrl,
36
- getAccessToken: getAccessToken !== null && getAccessToken !== void 0 ? getAccessToken : authorizationClientGetAccessToken,
37
- }));
38
- }, [getAccessToken, baseUrl]);
39
- return (react_1.default.createElement(ReportsApiConfigContext_1.ReportsApiConfigContext.Provider, { value: apiConfig },
36
+ var _a, _b;
37
+ const [routingHistory, setRoutingHistory] = react_1.useState([
38
+ { step: RouteStep.ReportsList, title: "iTwin Reports", reportsRoutingFields: {} },
39
+ ]);
40
+ const currentRoute = routingHistory[routingHistory.length - 1];
41
+ const iTwinId = (_b = (_a = appui_react_1.useActiveIModelConnection()) === null || _a === void 0 ? void 0 : _a.iTwinId) !== null && _b !== void 0 ? _b : "";
42
+ const navigateTo = react_1.useCallback((toRoute) => {
43
+ setRoutingHistory((r) => [...r, toRoute(r[r.length - 1])]);
44
+ }, []);
45
+ const goBack = react_1.useCallback(() => {
46
+ const updatedRouting = [...routingHistory];
47
+ updatedRouting.pop();
48
+ setRoutingHistory(updatedRouting);
49
+ }, [routingHistory]);
50
+ return (react_1.default.createElement(ReportsConfigContext_1.ReportsConfigContext, { getAccessToken: getAccessToken, baseUrl: baseUrl, iTwinId: iTwinId },
40
51
  react_1.default.createElement("div", { className: "rcw-reports-container" },
41
- react_1.default.createElement(Reports_1.Reports, null))));
52
+ react_1.default.createElement(ReportsHeader_1.ReportsHeader, { goBack: goBack, currentRoute: currentRoute }),
53
+ react_1.default.createElement(ReportsRouter_1.ReportsRouter, { currentRoute: currentRoute, navigateTo: navigateTo, goBack: goBack }))));
42
54
  };
43
55
  exports.default = ReportsContainer;
44
56
  //# sourceMappingURL=ReportsContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReportsContainer.js","sourceRoot":"","sources":["../../../../src/widget/components/ReportsContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA,wDAAiD;AACjD,+CAAmD;AACnD,mDAAgD;AAEhD,gFAA6E;AAC7E,mCAAiC;AAOjC,MAAM,iCAAiC,GAAG,KAAK,IAAI,EAAE,eACnD,OAAA,MAAA,CAAC,MAAM,CAAA,MAAA,yBAAS,CAAC,mBAAmB,0CAAE,cAAc,EAAE,CAAA,CAAC,mCAAI,EAAE,CAAA,EAAA,CAAC;AAEhE,MAAM,gBAAgB,GAAG,CAAC,EACxB,cAAc,EACd,OAAO,GACe,EAAE,EAAE;IAC1B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,gBAAQ,CAAmB;QAC3D,cAAc,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,iCAAiC;QACnE,OAAO;KACR,CAAC,CAAC;IAEH,iBAAS,CAAC,GAAG,EAAE;QACb,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;YAClB,OAAO;YACP,cAAc,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,iCAAiC;SACpE,CAAC,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;IAE9B,OAAO,CACL,8BAAC,iDAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS;QAChD,uCAAK,SAAS,EAAC,uBAAuB;YACpC,8BAAC,iBAAO,OAAG,CACP,CAC2B,CACpC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport React, { useEffect, useState } from \"react\";\nimport { Reports } from \"../components/Reports\";\nimport type { ReportsApiConfig } from \"../context/ReportsApiConfigContext\";\nimport { ReportsApiConfigContext } from \"../context/ReportsApiConfigContext\";\nimport \"./ReportsContainer.scss\";\n\ninterface ReportsContainerProps {\n getAccessToken?: () => Promise<AccessToken>;\n baseUrl: string;\n}\n\nconst authorizationClientGetAccessToken = async () =>\n (await IModelApp.authorizationClient?.getAccessToken()) ?? \"\";\n\nconst ReportsContainer = ({\n getAccessToken,\n baseUrl,\n}: ReportsContainerProps) => {\n const [apiConfig, setApiConfig] = useState<ReportsApiConfig>({\n getAccessToken: getAccessToken ?? authorizationClientGetAccessToken,\n baseUrl,\n });\n\n useEffect(() => {\n setApiConfig(() => ({\n baseUrl,\n getAccessToken: getAccessToken ?? authorizationClientGetAccessToken,\n }));\n }, [getAccessToken, baseUrl]);\n\n return (\n <ReportsApiConfigContext.Provider value={apiConfig}>\n <div className=\"rcw-reports-container\">\n <Reports />\n </div>\n </ReportsApiConfigContext.Provider>\n );\n};\n\nexport default ReportsContainer;\n"]}
1
+ {"version":3,"file":"ReportsContainer.js","sourceRoot":"","sources":["../../../../src/widget/components/ReportsContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA,+CAAqD;AACrD,mCAAiC;AAEjC,oDAA+D;AAC/D,mDAAgD;AAChD,mDAAgD;AAChD,iEAA8D;AAO9D,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,uDAAW,CAAA;IACX,yDAAY,CAAA;IACZ,6DAAc,CAAA;AAChB,CAAC,EAJW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAIpB;AAYD,MAAM,gBAAgB,GAAG,CAAC,EACxB,cAAc,EACd,OAAO,GACe,EAAE,EAAE;;IAE1B,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,gBAAQ,CAAU;QAC5D,EAAE,IAAI,EAAE,SAAS,CAAC,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,EAAE,EAAE;KAClF,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,MAAA,MAAA,uCAAyB,EAAE,0CAAE,OAAO,mCAAI,EAAE,CAAC;IAC3D,MAAM,UAAU,GAAG,mBAAW,CAAC,CAAC,OAA2C,EAAE,EAAE;QAC7E,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,MAAM,GAAG,mBAAW,CAAC,GAAG,EAAE;QAC9B,MAAM,cAAc,GAAG,CAAC,GAAG,cAAc,CAAC,CAAC;QAC3C,cAAc,CAAC,GAAG,EAAE,CAAC;QACrB,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,8BAAC,2CAAoB,IAAC,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;QACtF,uCAAK,SAAS,EAAC,uBAAuB;YACpC,8BAAC,6BAAa,IACZ,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,GAC1B;YACF,8BAAC,6BAAa,IACZ,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,GACd,CACE,CACe,CACxB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport React, { useCallback, useState } from \"react\";\nimport \"./ReportsContainer.scss\";\nimport type { Report } from \"@itwin/insights-client\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { ReportsHeader } from \"./ReportsHeader\";\nimport { ReportsRouter } from \"./ReportsRouter\";\nimport { ReportsConfigContext } from \"./ReportsConfigContext\";\n\ninterface ReportsContainerProps {\n getAccessToken?: () => Promise<AccessToken>;\n baseUrl: string;\n}\n\nexport enum RouteStep {\n ReportsList,\n ReportAction,\n ReportMappings\n}\n\nexport interface ReportsRouteFields {\n report?: Report;\n}\n\nexport interface Route {\n step: RouteStep;\n title: string;\n reportsRoutingFields: ReportsRouteFields;\n}\n\nconst ReportsContainer = ({\n getAccessToken,\n baseUrl,\n}: ReportsContainerProps) => {\n\n const [routingHistory, setRoutingHistory] = useState<Route[]>([\n { step: RouteStep.ReportsList, title: \"iTwin Reports\", reportsRoutingFields: {} },\n ]);\n const currentRoute = routingHistory[routingHistory.length - 1];\n const iTwinId = useActiveIModelConnection()?.iTwinId ?? \"\";\n const navigateTo = useCallback((toRoute: (prev: Route | undefined) => Route) => {\n setRoutingHistory((r) => [...r, toRoute(r[r.length - 1])]);\n }, []);\n\n const goBack = useCallback(() => {\n const updatedRouting = [...routingHistory];\n updatedRouting.pop();\n setRoutingHistory(updatedRouting);\n }, [routingHistory]);\n\n return (\n <ReportsConfigContext getAccessToken={getAccessToken} baseUrl={baseUrl} iTwinId={iTwinId}>\n <div className=\"rcw-reports-container\">\n <ReportsHeader\n goBack={goBack}\n currentRoute={currentRoute}\n />\n <ReportsRouter\n currentRoute={currentRoute}\n navigateTo={navigateTo}\n goBack={goBack}\n />\n </div>\n </ReportsConfigContext>\n );\n};\n\nexport default ReportsContainer;\n"]}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import type { Route } from "./ReportsContainer";
3
+ export declare const ReportsHeader: ({ goBack, currentRoute, }: {
4
+ goBack: () => void;
5
+ currentRoute: Route;
6
+ }) => JSX.Element;
7
+ //# sourceMappingURL=ReportsHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReportsHeader.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/ReportsHeader.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAIhD,eAAO,MAAM,aAAa;YAIhB,MAAM,IAAI;kBACJ,KAAK;iBAYpB,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ReportsHeader = void 0;
7
+ /*---------------------------------------------------------------------------------------------
8
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
9
+ * See LICENSE.md in the project root for license terms and full copyright notice.
10
+ *--------------------------------------------------------------------------------------------*/
11
+ const react_1 = __importDefault(require("react"));
12
+ const ReportsContainer_1 = require("./ReportsContainer");
13
+ const utils_1 = require("./utils");
14
+ const ReportsHeader = ({ goBack, currentRoute, }) => {
15
+ const shouldDisableReturnFn = currentRoute.step === ReportsContainer_1.RouteStep.ReportsList ||
16
+ currentRoute.step === ReportsContainer_1.RouteStep.ReportAction;
17
+ return (react_1.default.createElement(utils_1.WidgetHeader, { returnFn: shouldDisableReturnFn ? undefined : goBack, title: currentRoute.title }));
18
+ };
19
+ exports.ReportsHeader = ReportsHeader;
20
+ //# sourceMappingURL=ReportsHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReportsHeader.js","sourceRoot":"","sources":["../../../../src/widget/components/ReportsHeader.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAE1B,yDAA+C;AAC/C,mCAAuC;AAEhC,MAAM,aAAa,GAAG,CAAC,EAC5B,MAAM,EACN,YAAY,GAIb,EAAE,EAAE;IACH,MAAM,qBAAqB,GACzB,YAAY,CAAC,IAAI,KAAK,4BAAS,CAAC,WAAW;QAC3C,YAAY,CAAC,IAAI,KAAK,4BAAS,CAAC,YAAY,CAAC;IAE/C,OAAO,CACL,8BAAC,oBAAY,IACX,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EACpD,KAAK,EAAE,YAAY,CAAC,KAAK,GACzB,CACH,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,aAAa,iBAiBxB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport type { Route } from \"./ReportsContainer\";\nimport { RouteStep } from \"./ReportsContainer\";\nimport { WidgetHeader } from \"./utils\";\n\nexport const ReportsHeader = ({\n goBack,\n currentRoute,\n}: {\n goBack: () => void;\n currentRoute: Route;\n}) => {\n const shouldDisableReturnFn =\n currentRoute.step === RouteStep.ReportsList ||\n currentRoute.step === RouteStep.ReportAction;\n\n return (\n <WidgetHeader\n returnFn={shouldDisableReturnFn ? undefined : goBack}\n title={currentRoute.title}\n />\n );\n};\n"]}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { Route } from "./ReportsContainer";
3
+ export declare const ReportsRouter: ({ currentRoute, navigateTo, goBack, }: {
4
+ currentRoute: Route;
5
+ navigateTo: (toRoute: (prev: Route | undefined) => Route) => void;
6
+ goBack: () => void;
7
+ }) => JSX.Element | null;
8
+ //# sourceMappingURL=ReportsRouter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReportsRouter.d.ts","sourceRoot":"","sources":["../../../../src/widget/components/ReportsRouter.tsx"],"names":[],"mappings":";AAUA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhD,eAAO,MAAM,aAAa;kBAKV,KAAK;iCACU,KAAK,GAAG,SAAS,KAAK,KAAK,KAAK,IAAI;YACzD,MAAM,IAAI;wBA0CnB,CAAC"}