@itwin/reports-config-widget-react 0.1.0 → 0.2.1

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 (250) hide show
  1. package/.rush/temp/package-deps_rebuild.json +38 -34
  2. package/.rush/temp/shrinkwrap-deps.json +14 -6
  3. package/CHANGELOG.json +30 -0
  4. package/CHANGELOG.md +17 -1
  5. package/coverage/clover.xml +605 -610
  6. package/coverage/coverage-final.json +28 -27
  7. package/coverage/lcov-report/index.html +31 -31
  8. package/coverage/lcov-report/src/ReportsConfigWidget.ts.html +10 -10
  9. package/coverage/lcov-report/src/index.html +1 -1
  10. package/coverage/lcov-report/src/test/index.html +1 -1
  11. package/coverage/lcov-report/src/test/test-utils.tsx.html +22 -22
  12. package/coverage/lcov-report/src/widget/ReportsConfigUiProvider.tsx.html +7 -7
  13. package/coverage/lcov-report/src/widget/components/ActionPanel.tsx.html +29 -41
  14. package/coverage/lcov-report/src/widget/components/AddMappingsModal.tsx.html +31 -37
  15. package/coverage/lcov-report/src/widget/components/BulkExtractor.ts.html +270 -162
  16. package/coverage/lcov-report/src/widget/components/Constants.ts.html +4 -4
  17. package/coverage/lcov-report/src/widget/components/DeleteModal.tsx.html +21 -21
  18. package/coverage/lcov-report/src/widget/components/ExtractionStates/FailedExtractionState.tsx.html +6 -6
  19. package/coverage/lcov-report/src/widget/components/ExtractionStates/QueuedExtractionState.tsx.html +14 -14
  20. package/coverage/lcov-report/src/widget/components/ExtractionStates/RunningExtractionState.tsx.html +15 -15
  21. package/coverage/lcov-report/src/widget/components/ExtractionStates/StartingExtractionState.tsx.html +14 -14
  22. package/coverage/lcov-report/src/widget/components/ExtractionStates/SucceededExtractionState.tsx.html +22 -19
  23. package/coverage/lcov-report/src/widget/components/ExtractionStates/index.html +43 -43
  24. package/coverage/lcov-report/src/widget/components/ExtractionStatus.tsx.html +57 -57
  25. package/coverage/lcov-report/src/widget/components/ExtractionToast.tsx.html +208 -0
  26. package/coverage/lcov-report/src/widget/components/HorizontalTile.tsx.html +8 -8
  27. package/coverage/lcov-report/src/widget/components/LocalizedTablePaginator.tsx.html +8 -8
  28. package/coverage/lcov-report/src/widget/components/ReportAction.tsx.html +14 -20
  29. package/coverage/lcov-report/src/widget/components/ReportHorizontalTile.tsx.html +30 -33
  30. package/coverage/lcov-report/src/widget/components/ReportMappingHorizontalTile.tsx.html +469 -0
  31. package/coverage/lcov-report/src/widget/components/ReportMappings.tsx.html +183 -231
  32. package/coverage/lcov-report/src/widget/components/Reports.tsx.html +73 -43
  33. package/coverage/lcov-report/src/widget/components/ReportsContainer.tsx.html +10 -10
  34. package/coverage/lcov-report/src/widget/components/SearchBar.tsx.html +10 -10
  35. package/coverage/lcov-report/src/widget/components/SelectIModel.tsx.html +31 -31
  36. package/coverage/lcov-report/src/widget/components/index.html +100 -85
  37. package/coverage/lcov-report/src/widget/components/utils.tsx.html +32 -32
  38. package/coverage/lcov-report/src/widget/context/ReportsApiConfigContext.tsx.html +8 -8
  39. package/coverage/lcov-report/src/widget/context/index.html +1 -1
  40. package/coverage/lcov-report/src/widget/hooks/index.html +1 -1
  41. package/coverage/lcov-report/src/widget/hooks/useValidator.ts.html +7 -7
  42. package/coverage/lcov-report/src/widget/index.html +1 -1
  43. package/coverage/lcov.info +990 -1003
  44. package/jest.config.js +6 -0
  45. package/lib/cjs/test/AddMappingModal.test.d.ts +2 -0
  46. package/lib/cjs/test/AddMappingModal.test.d.ts.map +1 -0
  47. package/lib/cjs/test/AddMappingModal.test.js +277 -0
  48. package/lib/cjs/test/AddMappingModal.test.js.map +1 -0
  49. package/lib/cjs/test/BulkExtractor.test.d.ts +2 -0
  50. package/lib/cjs/test/BulkExtractor.test.d.ts.map +1 -0
  51. package/lib/cjs/test/BulkExtractor.test.js +182 -0
  52. package/lib/cjs/test/BulkExtractor.test.js.map +1 -0
  53. package/lib/cjs/test/DeleteModal.test.d.ts +2 -0
  54. package/lib/cjs/test/DeleteModal.test.d.ts.map +1 -0
  55. package/lib/cjs/test/DeleteModal.test.js +93 -0
  56. package/lib/cjs/test/DeleteModal.test.js.map +1 -0
  57. package/lib/cjs/test/ReportAction.test.js +2 -3
  58. package/lib/cjs/test/ReportAction.test.js.map +1 -1
  59. package/lib/cjs/test/ReportMappingHorizontalTile.test.d.ts +2 -0
  60. package/lib/cjs/test/ReportMappingHorizontalTile.test.d.ts.map +1 -0
  61. package/lib/cjs/test/ReportMappingHorizontalTile.test.js +340 -0
  62. package/lib/cjs/test/ReportMappingHorizontalTile.test.js.map +1 -0
  63. package/lib/cjs/test/ReportMappings.test.js +115 -267
  64. package/lib/cjs/test/ReportMappings.test.js.map +1 -1
  65. package/lib/cjs/test/Reports.test.js +1 -1
  66. package/lib/cjs/test/Reports.test.js.map +1 -1
  67. package/lib/cjs/tsconfig.tsbuildinfo +1 -1
  68. package/lib/cjs/widget/components/ActionPanel.d.ts.map +1 -1
  69. package/lib/cjs/widget/components/ActionPanel.js +4 -5
  70. package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
  71. package/lib/cjs/widget/components/AddMappingsModal.d.ts +2 -2
  72. package/lib/cjs/widget/components/AddMappingsModal.d.ts.map +1 -1
  73. package/lib/cjs/widget/components/AddMappingsModal.js +5 -4
  74. package/lib/cjs/widget/components/AddMappingsModal.js.map +1 -1
  75. package/lib/cjs/widget/components/AddMappingsModal.scss +4 -3
  76. package/lib/cjs/widget/components/BulkExtractor.d.ts +18 -9
  77. package/lib/cjs/widget/components/BulkExtractor.d.ts.map +1 -1
  78. package/lib/cjs/widget/components/BulkExtractor.js +86 -57
  79. package/lib/cjs/widget/components/BulkExtractor.js.map +1 -1
  80. package/lib/cjs/widget/components/DeleteModal.js +1 -1
  81. package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
  82. package/lib/cjs/widget/components/DeleteModal.scss +4 -3
  83. package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js +1 -1
  84. package/lib/cjs/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -1
  85. package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -1
  86. package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js +1 -1
  87. package/lib/cjs/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -1
  88. package/lib/cjs/widget/components/ExtractionStatus.scss +15 -1
  89. package/lib/cjs/widget/components/ExtractionToast.d.ts +11 -0
  90. package/lib/cjs/widget/components/ExtractionToast.d.ts.map +1 -0
  91. package/lib/cjs/widget/components/ExtractionToast.js +33 -0
  92. package/lib/cjs/widget/components/ExtractionToast.js.map +1 -0
  93. package/lib/cjs/widget/components/HorizontalTile.scss +1 -1
  94. package/lib/cjs/widget/components/ReportAction.d.ts.map +1 -1
  95. package/lib/cjs/widget/components/ReportAction.js +3 -3
  96. package/lib/cjs/widget/components/ReportAction.js.map +1 -1
  97. package/lib/cjs/widget/components/ReportAction.scss +2 -2
  98. package/lib/cjs/widget/components/ReportHorizontalTile.d.ts.map +1 -1
  99. package/lib/cjs/widget/components/ReportHorizontalTile.js +1 -2
  100. package/lib/cjs/widget/components/ReportHorizontalTile.js.map +1 -1
  101. package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts +13 -0
  102. package/lib/cjs/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -0
  103. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js +82 -0
  104. package/lib/cjs/widget/components/ReportMappingHorizontalTile.js.map +1 -0
  105. package/lib/cjs/widget/components/ReportMappings.d.ts +3 -1
  106. package/lib/cjs/widget/components/ReportMappings.d.ts.map +1 -1
  107. package/lib/cjs/widget/components/ReportMappings.js +39 -40
  108. package/lib/cjs/widget/components/ReportMappings.js.map +1 -1
  109. package/lib/cjs/widget/components/ReportMappings.scss +7 -7
  110. package/lib/cjs/widget/components/Reports.d.ts.map +1 -1
  111. package/lib/cjs/widget/components/Reports.js +13 -6
  112. package/lib/cjs/widget/components/Reports.js.map +1 -1
  113. package/lib/cjs/widget/components/Reports.scss +1 -1
  114. package/lib/cjs/widget/components/ReportsContainer.js +1 -1
  115. package/lib/cjs/widget/components/ReportsContainer.js.map +1 -1
  116. package/lib/cjs/widget/components/ReportsContainer.scss +2 -2
  117. package/lib/cjs/widget/components/SelectIModel.js +2 -2
  118. package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
  119. package/lib/cjs/widget/components/SelectIModel.scss +4 -3
  120. package/lib/cjs/widget/components/utils.js +1 -1
  121. package/lib/cjs/widget/components/utils.js.map +1 -1
  122. package/lib/cjs/widget/components/utils.scss +2 -2
  123. package/lib/esm/test/AddMappingModal.test.d.ts +2 -0
  124. package/lib/esm/test/AddMappingModal.test.d.ts.map +1 -0
  125. package/lib/esm/test/AddMappingModal.test.js +253 -0
  126. package/lib/esm/test/AddMappingModal.test.js.map +1 -0
  127. package/lib/esm/test/BulkExtractor.test.d.ts +2 -0
  128. package/lib/esm/test/BulkExtractor.test.d.ts.map +1 -0
  129. package/lib/esm/test/BulkExtractor.test.js +158 -0
  130. package/lib/esm/test/BulkExtractor.test.js.map +1 -0
  131. package/lib/esm/test/DeleteModal.test.d.ts +2 -0
  132. package/lib/esm/test/DeleteModal.test.d.ts.map +1 -0
  133. package/lib/esm/test/DeleteModal.test.js +69 -0
  134. package/lib/esm/test/DeleteModal.test.js.map +1 -0
  135. package/lib/esm/test/ReportAction.test.js +2 -3
  136. package/lib/esm/test/ReportAction.test.js.map +1 -1
  137. package/lib/esm/test/ReportMappingHorizontalTile.test.d.ts +2 -0
  138. package/lib/esm/test/ReportMappingHorizontalTile.test.d.ts.map +1 -0
  139. package/lib/esm/test/ReportMappingHorizontalTile.test.js +316 -0
  140. package/lib/esm/test/ReportMappingHorizontalTile.test.js.map +1 -0
  141. package/lib/esm/test/ReportMappings.test.js +117 -269
  142. package/lib/esm/test/ReportMappings.test.js.map +1 -1
  143. package/lib/esm/test/Reports.test.js +1 -1
  144. package/lib/esm/test/Reports.test.js.map +1 -1
  145. package/lib/esm/tsconfig.tsbuildinfo +1 -1
  146. package/lib/esm/widget/components/ActionPanel.d.ts.map +1 -1
  147. package/lib/esm/widget/components/ActionPanel.js +4 -5
  148. package/lib/esm/widget/components/ActionPanel.js.map +1 -1
  149. package/lib/esm/widget/components/AddMappingsModal.d.ts +2 -2
  150. package/lib/esm/widget/components/AddMappingsModal.d.ts.map +1 -1
  151. package/lib/esm/widget/components/AddMappingsModal.js +4 -5
  152. package/lib/esm/widget/components/AddMappingsModal.js.map +1 -1
  153. package/lib/esm/widget/components/AddMappingsModal.scss +4 -3
  154. package/lib/esm/widget/components/BulkExtractor.d.ts +18 -9
  155. package/lib/esm/widget/components/BulkExtractor.d.ts.map +1 -1
  156. package/lib/esm/widget/components/BulkExtractor.js +86 -57
  157. package/lib/esm/widget/components/BulkExtractor.js.map +1 -1
  158. package/lib/esm/widget/components/DeleteModal.js +1 -1
  159. package/lib/esm/widget/components/DeleteModal.js.map +1 -1
  160. package/lib/esm/widget/components/DeleteModal.scss +4 -3
  161. package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js +1 -1
  162. package/lib/esm/widget/components/ExtractionStates/RunningExtractionState.js.map +1 -1
  163. package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.d.ts.map +1 -1
  164. package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js +1 -1
  165. package/lib/esm/widget/components/ExtractionStates/SucceededExtractionState.js.map +1 -1
  166. package/lib/esm/widget/components/ExtractionStatus.scss +15 -1
  167. package/lib/esm/widget/components/ExtractionToast.d.ts +11 -0
  168. package/lib/esm/widget/components/ExtractionToast.d.ts.map +1 -0
  169. package/lib/esm/widget/components/ExtractionToast.js +25 -0
  170. package/lib/esm/widget/components/ExtractionToast.js.map +1 -0
  171. package/lib/esm/widget/components/HorizontalTile.scss +1 -1
  172. package/lib/esm/widget/components/ReportAction.d.ts.map +1 -1
  173. package/lib/esm/widget/components/ReportAction.js +3 -3
  174. package/lib/esm/widget/components/ReportAction.js.map +1 -1
  175. package/lib/esm/widget/components/ReportAction.scss +2 -2
  176. package/lib/esm/widget/components/ReportHorizontalTile.d.ts.map +1 -1
  177. package/lib/esm/widget/components/ReportHorizontalTile.js +1 -2
  178. package/lib/esm/widget/components/ReportHorizontalTile.js.map +1 -1
  179. package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts +13 -0
  180. package/lib/esm/widget/components/ReportMappingHorizontalTile.d.ts.map +1 -0
  181. package/lib/esm/widget/components/ReportMappingHorizontalTile.js +75 -0
  182. package/lib/esm/widget/components/ReportMappingHorizontalTile.js.map +1 -0
  183. package/lib/esm/widget/components/ReportMappings.d.ts +3 -1
  184. package/lib/esm/widget/components/ReportMappings.d.ts.map +1 -1
  185. package/lib/esm/widget/components/ReportMappings.js +40 -41
  186. package/lib/esm/widget/components/ReportMappings.js.map +1 -1
  187. package/lib/esm/widget/components/ReportMappings.scss +7 -7
  188. package/lib/esm/widget/components/Reports.d.ts.map +1 -1
  189. package/lib/esm/widget/components/Reports.js +15 -8
  190. package/lib/esm/widget/components/Reports.js.map +1 -1
  191. package/lib/esm/widget/components/Reports.scss +1 -1
  192. package/lib/esm/widget/components/ReportsContainer.js +1 -1
  193. package/lib/esm/widget/components/ReportsContainer.js.map +1 -1
  194. package/lib/esm/widget/components/ReportsContainer.scss +2 -2
  195. package/lib/esm/widget/components/SelectIModel.js +2 -2
  196. package/lib/esm/widget/components/SelectIModel.js.map +1 -1
  197. package/lib/esm/widget/components/SelectIModel.scss +4 -3
  198. package/lib/esm/widget/components/utils.js +1 -1
  199. package/lib/esm/widget/components/utils.js.map +1 -1
  200. package/lib/esm/widget/components/utils.scss +2 -2
  201. package/lib/public/locales/en/ReportsConfigWidget.json +5 -0
  202. package/package.json +7 -4
  203. package/public/locales/en/ReportsConfigWidget.json +5 -0
  204. package/reports-config-widget-react.build.error.log +10 -6
  205. package/reports-config-widget-react.build.log +51 -46
  206. package/src/test/AddMappingModal.test.tsx +315 -0
  207. package/src/test/BulkExtractor.test.ts +301 -0
  208. package/src/test/DeleteModal.test.tsx +118 -0
  209. package/src/test/ReportAction.test.tsx +2 -4
  210. package/src/test/ReportMappingHorizontalTile.test.tsx +451 -0
  211. package/src/test/ReportMappings.test.tsx +154 -549
  212. package/src/test/Reports.test.tsx +1 -1
  213. package/src/widget/components/ActionPanel.tsx +19 -23
  214. package/src/widget/components/AddMappingsModal.scss +4 -3
  215. package/src/widget/components/AddMappingsModal.tsx +4 -6
  216. package/src/widget/components/BulkExtractor.ts +97 -61
  217. package/src/widget/components/DeleteModal.scss +4 -3
  218. package/src/widget/components/DeleteModal.tsx +1 -1
  219. package/src/widget/components/ExtractionStates/RunningExtractionState.tsx +1 -1
  220. package/src/widget/components/ExtractionStates/SucceededExtractionState.tsx +1 -0
  221. package/src/widget/components/ExtractionStatus.scss +15 -1
  222. package/src/widget/components/ExtractionToast.tsx +41 -0
  223. package/src/widget/components/HorizontalTile.scss +1 -1
  224. package/src/widget/components/ReportAction.scss +2 -2
  225. package/src/widget/components/ReportAction.tsx +1 -3
  226. package/src/widget/components/ReportHorizontalTile.tsx +1 -2
  227. package/src/widget/components/ReportMappingHorizontalTile.tsx +128 -0
  228. package/src/widget/components/ReportMappings.scss +7 -7
  229. package/src/widget/components/ReportMappings.tsx +89 -105
  230. package/src/widget/components/Reports.scss +1 -1
  231. package/src/widget/components/Reports.tsx +18 -8
  232. package/src/widget/components/ReportsContainer.scss +2 -2
  233. package/src/widget/components/ReportsContainer.tsx +1 -1
  234. package/src/widget/components/SelectIModel.scss +4 -3
  235. package/src/widget/components/SelectIModel.tsx +2 -2
  236. package/src/widget/components/utils.scss +2 -2
  237. package/src/widget/components/utils.tsx +1 -1
  238. package/coverage/lcov-report/src/widget/components/Extraction.tsx.html +0 -1030
  239. package/lib/cjs/widget/components/Extraction.d.ts +0 -28
  240. package/lib/cjs/widget/components/Extraction.d.ts.map +0 -1
  241. package/lib/cjs/widget/components/Extraction.js +0 -190
  242. package/lib/cjs/widget/components/Extraction.js.map +0 -1
  243. package/lib/cjs/widget/components/Extraction.scss +0 -39
  244. package/lib/esm/widget/components/Extraction.d.ts +0 -28
  245. package/lib/esm/widget/components/Extraction.d.ts.map +0 -1
  246. package/lib/esm/widget/components/Extraction.js +0 -166
  247. package/lib/esm/widget/components/Extraction.js.map +0 -1
  248. package/lib/esm/widget/components/Extraction.scss +0 -39
  249. package/src/widget/components/Extraction.scss +0 -39
  250. package/src/widget/components/Extraction.tsx +0 -315
@@ -1,55 +1,60 @@
1
1
  Invoking: npm test -- --coverage
2
2
 
3
3
 
4
- > @itwin/reports-config-widget-react@0.0.8 test /home/vsts/work/1/s/packages/itwin/reports-config-widget
4
+ > @itwin/reports-config-widget-react@0.2.0 test /home/vsts/work/1/s/packages/itwin/reports-config-widget
5
5
  > jest "--coverage"
6
6
 
7
- PASS src/test/ReportMappings.test.tsx (44.264 s)
8
- PASS src/test/Reports.test.tsx (10.883 s)
9
- PASS src/test/ReportAction.test.tsx (6.943 s)
7
+ PASS src/test/ReportMappings.test.tsx (9.915 s)
8
+ PASS src/test/ReportMappingHorizontalTile.test.tsx
9
+ PASS src/test/Reports.test.tsx (7.469 s)
10
+ PASS src/test/BulkExtractor.test.ts
11
+ PASS src/test/AddMappingModal.test.tsx
12
+ PASS src/test/ReportAction.test.tsx
13
+ PASS src/test/DeleteModal.test.tsx
10
14
  PASS src/test/WidgetHeader.test.tsx
11
- ----------------------------------------|---------|----------|---------|---------|-------------------------------
12
- File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
13
- ----------------------------------------|---------|----------|---------|---------|-------------------------------
14
- All files | 77.63 | 62.45 | 70.73 | 77.55 |
15
- src | 100 | 75 | 100 | 100 |
16
- ReportsConfigWidget.ts | 100 | 75 | 100 | 100 | 21
17
- src/test | 100 | 66.66 | 100 | 100 |
18
- test-utils.tsx | 100 | 66.66 | 100 | 100 | 56
19
- src/widget | 40 | 0 | 0 | 40 |
20
- ReportsConfigUiProvider.tsx | 40 | 0 | 0 | 40 | 23-65
21
- src/widget/components | 76.48 | 64.31 | 71.94 | 76.6 |
22
- ActionPanel.tsx | 100 | 77.77 | 100 | 100 | 25-26
23
- AddMappingsModal.tsx | 91.66 | 83.33 | 88.88 | 93.47 | 40,120,134
24
- BulkExtractor.ts | 16.45 | 0 | 6.66 | 16.66 | 36-154
25
- Constants.ts | 100 | 100 | 100 | 100 |
26
- DeleteModal.tsx | 85 | 100 | 50 | 84.21 | 42,56-87
27
- Extraction.tsx | 85.41 | 79.48 | 85.71 | 85.71 | 51-53,138,200-203,226-229,295
28
- ExtractionStatus.tsx | 51.42 | 20 | 16.66 | 53.12 | 33-68
29
- HorizontalTile.tsx | 100 | 100 | 100 | 100 |
30
- LocalizedTablePaginator.tsx | 100 | 50 | 100 | 100 | 25
31
- ReportAction.tsx | 94.28 | 81.48 | 100 | 94.28 | 59-60
32
- ReportHorizontalTile.tsx | 70.73 | 56 | 72.72 | 69.23 | 43-45,57-63,124-125
33
- ReportMappings.tsx | 96.34 | 73.68 | 94.44 | 96.29 | 98,120,265
34
- Reports.tsx | 92.04 | 78.84 | 83.33 | 95.18 | 124,131-133
35
- ReportsContainer.tsx | 57.14 | 0 | 0 | 61.53 | 19,25-37
36
- SearchBar.tsx | 70.58 | 71.42 | 60 | 68.75 | 31-45
37
- SelectIModel.tsx | 97.05 | 81.81 | 85.71 | 96.87 | 92
38
- utils.tsx | 64.7 | 30.76 | 100 | 58.13 | 51-94
39
- src/widget/components/ExtractionStates | 84.37 | 0 | 0 | 81.48 |
40
- FailedExtractionState.tsx | 85.71 | 0 | 0 | 83.33 | 16
41
- QueuedExtractionState.tsx | 83.33 | 100 | 0 | 80 | 10
42
- RunningExtractionState.tsx | 83.33 | 100 | 0 | 80 | 10
43
- StartingExtractionState.tsx | 83.33 | 100 | 0 | 80 | 10
44
- SucceededExtractionState.tsx | 85.71 | 0 | 0 | 83.33 | 16
45
- src/widget/context | 80 | 0 | 50 | 77.77 |
46
- ReportsApiConfigContext.tsx | 80 | 0 | 50 | 77.77 | 15,22
47
- src/widget/hooks | 100 | 100 | 100 | 100 |
48
- useValidator.ts | 100 | 100 | 100 | 100 |
49
- ----------------------------------------|---------|----------|---------|---------|-------------------------------
15
+ ----------------------------------------|---------|----------|---------|---------|-------------------------------------
16
+ File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
17
+ ----------------------------------------|---------|----------|---------|---------|-------------------------------------
18
+ All files | 86.69 | 65.94 | 79.76 | 86.79 |
19
+ src | 100 | 75 | 100 | 100 |
20
+ ReportsConfigWidget.ts | 100 | 75 | 100 | 100 | 21
21
+ src/test | 100 | 66.66 | 100 | 100 |
22
+ test-utils.tsx | 100 | 66.66 | 100 | 100 | 56
23
+ src/widget | 40 | 0 | 0 | 40 |
24
+ ReportsConfigUiProvider.tsx | 40 | 0 | 0 | 40 | 23-65
25
+ src/widget/components | 86.37 | 67.81 | 79.72 | 86.64 |
26
+ ActionPanel.tsx | 100 | 77.77 | 100 | 100 | 25-26
27
+ AddMappingsModal.tsx | 91.66 | 83.33 | 88.88 | 93.33 | 40,120,134
28
+ BulkExtractor.ts | 85 | 76.19 | 86.66 | 85.41 | 108,117-119,124-132,159-161,169-171
29
+ Constants.ts | 100 | 100 | 100 | 100 |
30
+ DeleteModal.tsx | 90 | 100 | 75 | 89.47 | 42,56
31
+ ExtractionStatus.tsx | 94.28 | 90 | 83.33 | 96.87 | 63
32
+ ExtractionToast.tsx | 58.33 | 100 | 0 | 50 | 18-22,36
33
+ HorizontalTile.tsx | 100 | 100 | 100 | 100 |
34
+ LocalizedTablePaginator.tsx | 100 | 50 | 100 | 100 | 25
35
+ ReportAction.tsx | 94.28 | 81.48 | 100 | 94.28 | 59-60
36
+ ReportHorizontalTile.tsx | 72.5 | 56 | 72.72 | 71.05 | 43-45,57-63,124
37
+ ReportMappingHorizontalTile.tsx | 93.87 | 100 | 91.66 | 93.61 | 66-69
38
+ ReportMappings.tsx | 92.13 | 56.75 | 85 | 91.86 | 97,251,267-292
39
+ Reports.tsx | 90.21 | 78.84 | 76 | 93.18 | 73,77,134,141-143
40
+ ReportsContainer.tsx | 57.14 | 0 | 0 | 61.53 | 19,25-37
41
+ SearchBar.tsx | 70.58 | 71.42 | 60 | 68.75 | 31-45
42
+ SelectIModel.tsx | 97.05 | 81.81 | 85.71 | 96.87 | 92
43
+ utils.tsx | 62.74 | 30.76 | 87.5 | 55.81 | 51-94,150
44
+ src/widget/components/ExtractionStates | 96.87 | 25 | 80 | 96.29 |
45
+ FailedExtractionState.tsx | 85.71 | 0 | 0 | 83.33 | 16
46
+ QueuedExtractionState.tsx | 100 | 100 | 100 | 100 |
47
+ RunningExtractionState.tsx | 100 | 100 | 100 | 100 |
48
+ StartingExtractionState.tsx | 100 | 100 | 100 | 100 |
49
+ SucceededExtractionState.tsx | 100 | 50 | 100 | 100 | 26
50
+ src/widget/context | 80 | 0 | 50 | 77.77 |
51
+ ReportsApiConfigContext.tsx | 80 | 0 | 50 | 77.77 | 15,22
52
+ src/widget/hooks | 100 | 100 | 100 | 100 |
53
+ useValidator.ts | 100 | 100 | 100 | 100 |
54
+ ----------------------------------------|---------|----------|---------|---------|-------------------------------------
50
55
 
51
- Test Suites: 4 passed, 4 total
52
- Tests: 22 passed, 22 total
56
+ Test Suites: 8 passed, 8 total
57
+ Tests: 41 passed, 41 total
53
58
  Snapshots: 0 total
54
- Time: 67.274 s
59
+ Time: 29.593 s
55
60
  Ran all test suites.
@@ -0,0 +1,315 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import React from "react";
6
+ import faker from "@faker-js/faker";
7
+ import "@testing-library/jest-dom";
8
+ import type {
9
+ IModelConnection,
10
+ } from "@itwin/core-frontend";
11
+ import { NoRenderApp } from "@itwin/core-frontend";
12
+ import { ReportsConfigWidget } from "../ReportsConfigWidget";
13
+ import {
14
+ render,
15
+ screen,
16
+ TestUtils,
17
+ waitFor,
18
+ within,
19
+ } from "./test-utils";
20
+ import * as moq from "typemoq";
21
+ import type {
22
+ MappingSingle,
23
+ ReportMappingCollection,
24
+ } from "@itwin/insights-client";
25
+ import type { ReportMappingAndMapping } from "../widget/components/ReportMappings";
26
+ import type { IModelOperations, OperationOptions } from "@itwin/imodels-client-management";
27
+ import { IModelState } from "@itwin/imodels-client-management";
28
+ import { AddMappingsModal } from "../widget/components/AddMappingsModal";
29
+ import { EmptyLocalization } from "@itwin/core-common";
30
+
31
+ const mockITwinId = faker.datatype.uuid();
32
+ const mockIModelId1 = faker.datatype.uuid();
33
+ const mockIModelId2 = faker.datatype.uuid();
34
+
35
+ const mockReportId = faker.datatype.uuid();
36
+
37
+ const mockIModelsResponse = [
38
+ {
39
+ iModel: {
40
+ id: mockIModelId1,
41
+ displayName: "rAnDoMdIsPlAynAmE1",
42
+ name: "rAnDomName1",
43
+ description: "rAnDoMDeScRiPtIoN1",
44
+ createdDateTime: "2021-10-04T22:13:50.397Z",
45
+ state: IModelState.Initialized,
46
+ projectId: mockITwinId,
47
+ extent: null,
48
+ _links: {
49
+ creator: {
50
+ href: "",
51
+ },
52
+ namedVersions: {
53
+ href: "",
54
+ },
55
+ changesets: {
56
+ href: "",
57
+ },
58
+ },
59
+ },
60
+ },
61
+ {
62
+ iModel: {
63
+ id: mockIModelId2,
64
+ displayName: "rAnDoMdIsPlAynAmE2",
65
+ name: "rAnDomName2",
66
+ description: "rAnDoMDeScRiPtIoN2",
67
+ createdDateTime: "2021-10-04T22:13:50.397Z",
68
+ state: IModelState.Initialized,
69
+ projectId: mockITwinId,
70
+ extent: null,
71
+ _links: {
72
+ creator: {
73
+ href: "",
74
+ },
75
+ namedVersions: {
76
+ href: "",
77
+ },
78
+ changesets: {
79
+ href: "",
80
+ },
81
+ },
82
+ },
83
+ },
84
+ ];
85
+
86
+ const mockProjectIModels = {
87
+ iModels: mockIModelsResponse.map((iModel) => ({
88
+ id: iModel.iModel.id,
89
+ displayName: iModel.iModel.displayName,
90
+ })),
91
+ _links: {
92
+ self: {
93
+ href: "",
94
+ },
95
+ prev: null,
96
+ next: null,
97
+ },
98
+ };
99
+
100
+ const mockReportMappingsFactory = (): ReportMappingCollection => {
101
+ return {
102
+ mappings: [
103
+ {
104
+ reportId: mockReportId,
105
+ mappingId: faker.datatype.uuid(),
106
+ imodelId: mockIModelId1,
107
+ _links: {
108
+ report: {
109
+ href: "",
110
+ },
111
+ mapping: {
112
+ href: "",
113
+ },
114
+ imodel: {
115
+ href: "",
116
+ },
117
+ },
118
+ },
119
+ {
120
+ reportId: mockReportId,
121
+ mappingId: faker.datatype.uuid(),
122
+ imodelId: mockIModelId2,
123
+ _links: {
124
+ report: {
125
+ href: "",
126
+ },
127
+ mapping: {
128
+ href: "",
129
+ },
130
+ imodel: {
131
+ href: "",
132
+ },
133
+ },
134
+ },
135
+ ],
136
+ _links: {
137
+ next: undefined,
138
+ self: {
139
+ href: "",
140
+ },
141
+ },
142
+ };
143
+ };
144
+
145
+ const mockMappingsFactory = (
146
+ mockReportMappings: ReportMappingCollection
147
+ ): MappingSingle[] => {
148
+ const mockMappings: MappingSingle[] = mockReportMappings.mappings.map(
149
+ (mapping, index) => ({
150
+ mapping: {
151
+ id: mapping.mappingId,
152
+ mappingName: `mOcKMaPpIngNaMe${index}`,
153
+ description: `mOcKmApPInGDeScRiPtIoN${index}`,
154
+ extractionEnabled: false,
155
+ createdOn: "",
156
+ createdBy: "",
157
+ modifiedOn: "",
158
+ modifiedBy: "",
159
+ _links: {
160
+ imodel: {
161
+ // Tie the mapping to to the iModel Id
162
+ href: mapping.imodelId,
163
+ },
164
+ },
165
+ },
166
+ })
167
+ );
168
+
169
+ const extraMappingId = faker.datatype.uuid();
170
+ const extraMappingName = "mOcKNaMeExTrA";
171
+ const extraMappingDescription = "mOcKDeScRiPtIoNeXtRa";
172
+
173
+ mockMappings.push({
174
+ mapping: {
175
+ id: extraMappingId,
176
+ mappingName: extraMappingName,
177
+ description: extraMappingDescription,
178
+ extractionEnabled: false,
179
+ createdOn: "",
180
+ createdBy: "",
181
+ modifiedOn: "",
182
+ modifiedBy: "",
183
+ _links: {
184
+ imodel: {
185
+ href: "",
186
+ },
187
+ },
188
+ },
189
+ });
190
+
191
+ return mockMappings;
192
+ };
193
+
194
+ const mockReportMappingsAndMappingsFactory = (mockMappings: MappingSingle[], reportMappings: ReportMappingCollection): ReportMappingAndMapping[] => {
195
+ const reportMappingsAndMapping =
196
+ reportMappings.mappings.map((reportMapping) => {
197
+ const mapping = mockMappings.find((x) => x.mapping.id === reportMapping.mappingId)!.mapping;
198
+ const iModelName = mockProjectIModels.iModels.find((x) => x.id === reportMapping.imodelId)!.displayName;
199
+ const reportMappingAndMapping: ReportMappingAndMapping = {
200
+ ...reportMapping,
201
+ iModelName,
202
+ mappingName: mapping.mappingName,
203
+ mappingDescription: mapping.description ?? "",
204
+ };
205
+ return reportMappingAndMapping;
206
+ });
207
+ return reportMappingsAndMapping;
208
+ };
209
+
210
+ const connectionMock = moq.Mock.ofType<IModelConnection>();
211
+ const mockIModelsClient = moq.Mock.ofType<IModelOperations<OperationOptions>>();
212
+
213
+ jest.mock("@itwin/appui-react", () => ({
214
+ ...jest.requireActual("@itwin/appui-react"),
215
+ useActiveIModelConnection: () => connectionMock.object,
216
+ }));
217
+
218
+ jest.mock("@itwin/imodels-client-management", () => ({
219
+ ...jest.requireActual("@itwin/imodels-client-management"),
220
+ IModelsClient: jest.fn().mockImplementation(() => ({
221
+ iModels: mockIModelsClient.object,
222
+ })),
223
+ toArray: jest.fn().mockImplementation(async () => {
224
+ return mockProjectIModels.iModels;
225
+ }),
226
+ }));
227
+
228
+ const mockGetMappings = jest.fn();
229
+ const mockCreateReportMapping = jest.fn();
230
+
231
+ jest.mock("@itwin/insights-client", () => ({
232
+ ...jest.requireActual("@itwin/insights-client"),
233
+ MappingsClient: jest.fn().mockImplementation(() => ({
234
+ getMappings: mockGetMappings,
235
+ })),
236
+ ReportsClient: jest.fn().mockImplementation(() => ({
237
+ createReportMapping: mockCreateReportMapping,
238
+ })),
239
+ }));
240
+
241
+ beforeAll(async () => {
242
+ await NoRenderApp.startup({localization: new EmptyLocalization()});
243
+ connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId1);
244
+ await ReportsConfigWidget.initialize();
245
+ });
246
+
247
+ afterAll(() => {
248
+ TestUtils.terminateUiFramework();
249
+ });
250
+
251
+ afterEach(() => {
252
+ mockGetMappings.mockReset();
253
+ mockIModelsClient.reset();
254
+ });
255
+
256
+ describe("Add Mapping Modal", () => {
257
+ it("Adding mapping sends create request", async () => {
258
+ const mockReportMappings = mockReportMappingsFactory();
259
+ const mockMappings = mockMappingsFactory(mockReportMappings);
260
+ const mockReportMappingsAndMappings = mockReportMappingsAndMappingsFactory(mockMappings, mockReportMappings);
261
+
262
+ mockGetMappings.mockReturnValueOnce(mockMappings.map((m: MappingSingle) => m.mapping));
263
+
264
+ const { user } = render(
265
+ <AddMappingsModal
266
+ show={true}
267
+ reportId={mockReportId}
268
+ existingMappings={mockReportMappingsAndMappings}
269
+ returnFn={jest.fn()}
270
+ />
271
+ );
272
+
273
+ expect(screen.getByRole("dialog")).toBeInTheDocument();
274
+ const modal = screen.getByRole("dialog");
275
+ const withinModal = within(modal);
276
+ expect(withinModal.getByText(/addmappings/i)).toBeInTheDocument();
277
+
278
+ const addButton = withinModal.getByRole("button", {
279
+ name: /add/i,
280
+ });
281
+ // Add button should be disabled
282
+ expect(addButton).toBeDisabled();
283
+
284
+ await waitFor(() => screen.getByRole("row"));
285
+
286
+ // Already mapped mappings are disabled
287
+ for (let i = 0; i < mockMappings.length - 1; i++) {
288
+ const row = screen.getByRole("row", {
289
+ name: new RegExp(
290
+ `${mockMappings[i].mapping.mappingName} ${mockMappings[i].mapping.description}`,
291
+ "i"
292
+ ),
293
+ });
294
+
295
+ const checkbox = within(row).getByRole("checkbox");
296
+ expect(checkbox).toBeDisabled();
297
+ }
298
+
299
+ // Click on checkbox on new mapping
300
+ const unmappedRow = screen.getByRole("row", {
301
+ name: new RegExp(
302
+ `${mockMappings[mockMappings.length - 1].mapping.mappingName
303
+ } ${mockMappings[mockMappings.length - 1].mapping.description}`,
304
+ "i"
305
+ ),
306
+ });
307
+
308
+ const enabledCheckbox = within(unmappedRow).getByRole("checkbox");
309
+
310
+ await user.click(enabledCheckbox);
311
+ await user.click(addButton);
312
+
313
+ expect(mockCreateReportMapping).toBeCalledTimes(1);
314
+ });
315
+ });