@itwin/grouping-mapping-widget 0.23.1 → 0.25.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 (259) hide show
  1. package/lib/cjs/WidgetShell/GroupingMappingContent.js +2 -2
  2. package/lib/cjs/WidgetShell/GroupingMappingContent.js.map +1 -1
  3. package/lib/cjs/common/hooks/useIsMounted.d.ts +2 -1
  4. package/lib/cjs/common/hooks/useIsMounted.js +3 -3
  5. package/lib/cjs/common/hooks/useIsMounted.js.map +1 -1
  6. package/lib/cjs/components/Constants.d.ts +3 -0
  7. package/lib/cjs/components/Constants.js +5 -2
  8. package/lib/cjs/components/Constants.js.map +1 -1
  9. package/lib/cjs/components/GroupingMappingContext.js +12 -14
  10. package/lib/cjs/components/GroupingMappingContext.js.map +1 -1
  11. package/lib/cjs/components/Groups/{GroupItem.d.ts → GroupListItem.d.ts} +4 -3
  12. package/lib/cjs/components/Groups/GroupListItem.js +49 -0
  13. package/lib/cjs/components/Groups/GroupListItem.js.map +1 -0
  14. package/lib/cjs/components/Groups/GroupListItem.scss +13 -0
  15. package/lib/cjs/components/Groups/GroupsView.js +2 -2
  16. package/lib/cjs/components/Groups/GroupsView.js.map +1 -1
  17. package/lib/cjs/components/Groups/GroupsVisualization.js +33 -11
  18. package/lib/cjs/components/Groups/GroupsVisualization.js.map +1 -1
  19. package/lib/cjs/components/Groups/groupsHelpers.d.ts +1 -1
  20. package/lib/cjs/components/Groups/groupsHelpers.js +1 -1
  21. package/lib/cjs/components/Groups/groupsHelpers.js.map +1 -1
  22. package/lib/cjs/components/Groups/hooks/useKeySetHiliteQueries.d.ts +2 -2
  23. package/lib/cjs/components/Groups/hooks/useKeySetHiliteQueries.js.map +1 -1
  24. package/lib/cjs/components/Mappings/Extraction/ExtractionMessageModal.js +27 -18
  25. package/lib/cjs/components/Mappings/Extraction/ExtractionMessageModal.js.map +1 -1
  26. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.d.ts +3 -0
  27. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js +17 -0
  28. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js.map +1 -0
  29. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.d.ts +3 -0
  30. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js +16 -0
  31. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js.map +1 -0
  32. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.d.ts +3 -0
  33. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js +17 -0
  34. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js.map +1 -0
  35. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.d.ts +9 -0
  36. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js +21 -0
  37. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js.map +1 -0
  38. package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.d.ts +17 -0
  39. package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.js +79 -0
  40. package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.js.map +1 -0
  41. package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.scss +40 -0
  42. package/lib/cjs/components/Mappings/MappingListItem.d.ts +20 -0
  43. package/lib/cjs/components/Mappings/MappingListItem.js +96 -0
  44. package/lib/cjs/components/Mappings/MappingListItem.js.map +1 -0
  45. package/lib/cjs/components/Mappings/MappingListItem.scss +13 -0
  46. package/lib/cjs/components/Mappings/MappingViewActionGroup.d.ts +1 -1
  47. package/lib/cjs/components/Mappings/MappingViewActionGroup.js +3 -3
  48. package/lib/cjs/components/Mappings/MappingViewActionGroup.js.map +1 -1
  49. package/lib/cjs/components/Mappings/MappingsView.d.ts +2 -0
  50. package/lib/cjs/components/Mappings/MappingsView.js +28 -4
  51. package/lib/cjs/components/Mappings/MappingsView.js.map +1 -1
  52. package/lib/cjs/components/Mappings/MappingsView.scss +0 -5
  53. package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.d.ts +3 -1
  54. package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.js +7 -4
  55. package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.js.map +1 -1
  56. package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.d.ts +20 -0
  57. package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.js +55 -0
  58. package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.js.map +1 -0
  59. package/lib/cjs/components/Mappings/hooks/useMappingsOperations.d.ts +8 -0
  60. package/lib/cjs/components/Mappings/hooks/useMappingsOperations.js +29 -5
  61. package/lib/cjs/components/Mappings/hooks/useMappingsOperations.js.map +1 -1
  62. package/lib/cjs/components/Mappings/hooks/useRunExtraction.d.ts +14 -0
  63. package/lib/cjs/components/Mappings/hooks/useRunExtraction.js +42 -0
  64. package/lib/cjs/components/Mappings/hooks/useRunExtraction.js.map +1 -0
  65. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +17 -25
  66. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
  67. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +18 -25
  68. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
  69. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +35 -38
  70. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +1 -1
  71. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js +28 -59
  72. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
  73. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js +37 -40
  74. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js.map +1 -1
  75. package/lib/cjs/components/Properties/GroupColorToggle.js +30 -26
  76. package/lib/cjs/components/Properties/GroupColorToggle.js.map +1 -1
  77. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js +62 -167
  78. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
  79. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.scss +1 -46
  80. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyListItem.d.ts +13 -0
  81. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyListItem.js +21 -0
  82. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyListItem.js.map +1 -0
  83. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyListItem.scss +14 -0
  84. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js +34 -37
  85. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
  86. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyUtils.js +65 -51
  87. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyUtils.js.map +1 -1
  88. package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.d.ts +12 -0
  89. package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js +147 -0
  90. package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js.map +1 -0
  91. package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.scss +49 -0
  92. package/lib/cjs/components/Properties/GroupProperties/SortableHorizontalTile.d.ts +4 -4
  93. package/lib/cjs/components/Properties/GroupProperties/SortableHorizontalTile.js +4 -3
  94. package/lib/cjs/components/Properties/GroupProperties/SortableHorizontalTile.js.map +1 -1
  95. package/lib/cjs/components/Properties/PropertyMenu.js +11 -15
  96. package/lib/cjs/components/Properties/PropertyMenu.js.map +1 -1
  97. package/lib/cjs/components/Properties/PropertyTable.js +1 -1
  98. package/lib/cjs/components/Properties/PropertyTable.js.map +1 -1
  99. package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.d.ts +4 -0
  100. package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.js +12 -0
  101. package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.js.map +1 -0
  102. package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.d.ts +4 -0
  103. package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.js +12 -0
  104. package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.js.map +1 -0
  105. package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.d.ts +4 -0
  106. package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.js +12 -0
  107. package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.js.map +1 -0
  108. package/lib/cjs/components/SharedComponents/DeleteModal.d.ts +1 -2
  109. package/lib/cjs/components/SharedComponents/DeleteModal.js +1 -2
  110. package/lib/cjs/components/SharedComponents/DeleteModal.js.map +1 -1
  111. package/lib/cjs/components/context/ExtractionStateJobContext.d.ts +8 -0
  112. package/lib/cjs/components/context/ExtractionStateJobContext.js +44 -0
  113. package/lib/cjs/components/context/ExtractionStateJobContext.js.map +1 -0
  114. package/lib/cjs/components/context/PropertiesGroupColorContext.d.ts +8 -0
  115. package/lib/cjs/components/context/{PropertiesContext.js → PropertiesGroupColorContext.js} +7 -10
  116. package/lib/cjs/components/context/PropertiesGroupColorContext.js.map +1 -0
  117. package/lib/cjs/test/GroupingMappingCustomUI.test.js +3 -3
  118. package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
  119. package/lib/esm/WidgetShell/GroupingMappingContent.js +2 -2
  120. package/lib/esm/WidgetShell/GroupingMappingContent.js.map +1 -1
  121. package/lib/esm/common/hooks/useIsMounted.d.ts +2 -1
  122. package/lib/esm/common/hooks/useIsMounted.js +4 -4
  123. package/lib/esm/common/hooks/useIsMounted.js.map +1 -1
  124. package/lib/esm/components/Constants.d.ts +3 -0
  125. package/lib/esm/components/Constants.js +3 -0
  126. package/lib/esm/components/Constants.js.map +1 -1
  127. package/lib/esm/components/GroupingMappingContext.js +12 -14
  128. package/lib/esm/components/GroupingMappingContext.js.map +1 -1
  129. package/lib/esm/components/Groups/{GroupItem.d.ts → GroupListItem.d.ts} +4 -3
  130. package/lib/esm/components/Groups/GroupListItem.js +22 -0
  131. package/lib/esm/components/Groups/GroupListItem.js.map +1 -0
  132. package/lib/esm/components/Groups/GroupListItem.scss +13 -0
  133. package/lib/esm/components/Groups/GroupsView.js +3 -3
  134. package/lib/esm/components/Groups/GroupsView.js.map +1 -1
  135. package/lib/esm/components/Groups/GroupsVisualization.js +33 -11
  136. package/lib/esm/components/Groups/GroupsVisualization.js.map +1 -1
  137. package/lib/esm/components/Groups/groupsHelpers.d.ts +1 -1
  138. package/lib/esm/components/Groups/groupsHelpers.js +1 -1
  139. package/lib/esm/components/Groups/groupsHelpers.js.map +1 -1
  140. package/lib/esm/components/Groups/hooks/useKeySetHiliteQueries.d.ts +2 -2
  141. package/lib/esm/components/Groups/hooks/useKeySetHiliteQueries.js.map +1 -1
  142. package/lib/esm/components/Mappings/Extraction/ExtractionMessageModal.js +27 -18
  143. package/lib/esm/components/Mappings/Extraction/ExtractionMessageModal.js.map +1 -1
  144. package/lib/esm/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.d.ts +3 -0
  145. package/lib/esm/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js +10 -0
  146. package/lib/esm/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js.map +1 -0
  147. package/lib/esm/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.d.ts +3 -0
  148. package/lib/esm/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js +9 -0
  149. package/lib/esm/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js.map +1 -0
  150. package/lib/esm/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.d.ts +3 -0
  151. package/lib/esm/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js +10 -0
  152. package/lib/esm/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js.map +1 -0
  153. package/lib/esm/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.d.ts +9 -0
  154. package/lib/esm/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js +14 -0
  155. package/lib/esm/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js.map +1 -0
  156. package/lib/esm/components/Mappings/Extraction/ExtractionStatus.d.ts +17 -0
  157. package/lib/esm/components/Mappings/Extraction/ExtractionStatus.js +52 -0
  158. package/lib/esm/components/Mappings/Extraction/ExtractionStatus.js.map +1 -0
  159. package/lib/esm/components/Mappings/Extraction/ExtractionStatus.scss +40 -0
  160. package/lib/esm/components/Mappings/MappingListItem.d.ts +20 -0
  161. package/lib/esm/components/Mappings/MappingListItem.js +69 -0
  162. package/lib/esm/components/Mappings/MappingListItem.js.map +1 -0
  163. package/lib/esm/components/Mappings/MappingListItem.scss +13 -0
  164. package/lib/esm/components/Mappings/MappingViewActionGroup.d.ts +1 -1
  165. package/lib/esm/components/Mappings/MappingViewActionGroup.js +1 -1
  166. package/lib/esm/components/Mappings/MappingViewActionGroup.js.map +1 -1
  167. package/lib/esm/components/Mappings/MappingsView.d.ts +2 -0
  168. package/lib/esm/components/Mappings/MappingsView.js +31 -7
  169. package/lib/esm/components/Mappings/MappingsView.js.map +1 -1
  170. package/lib/esm/components/Mappings/MappingsView.scss +0 -5
  171. package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.d.ts +3 -1
  172. package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.js +7 -4
  173. package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.js.map +1 -1
  174. package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.d.ts +20 -0
  175. package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.js +49 -0
  176. package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.js.map +1 -0
  177. package/lib/esm/components/Mappings/hooks/useMappingsOperations.d.ts +8 -0
  178. package/lib/esm/components/Mappings/hooks/useMappingsOperations.js +30 -6
  179. package/lib/esm/components/Mappings/hooks/useMappingsOperations.js.map +1 -1
  180. package/lib/esm/components/Mappings/hooks/useRunExtraction.d.ts +14 -0
  181. package/lib/esm/components/Mappings/hooks/useRunExtraction.js +38 -0
  182. package/lib/esm/components/Mappings/hooks/useRunExtraction.js.map +1 -0
  183. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +17 -25
  184. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
  185. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +18 -25
  186. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
  187. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +35 -38
  188. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +1 -1
  189. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js +29 -60
  190. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
  191. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js +37 -40
  192. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js.map +1 -1
  193. package/lib/esm/components/Properties/GroupColorToggle.js +32 -28
  194. package/lib/esm/components/Properties/GroupColorToggle.js.map +1 -1
  195. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js +64 -169
  196. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
  197. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.scss +1 -46
  198. package/lib/esm/components/Properties/GroupProperties/GroupPropertyListItem.d.ts +13 -0
  199. package/lib/esm/components/Properties/GroupProperties/GroupPropertyListItem.js +14 -0
  200. package/lib/esm/components/Properties/GroupProperties/GroupPropertyListItem.js.map +1 -0
  201. package/lib/esm/components/Properties/GroupProperties/GroupPropertyListItem.scss +14 -0
  202. package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js +34 -37
  203. package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
  204. package/lib/esm/components/Properties/GroupProperties/GroupPropertyUtils.js +65 -51
  205. package/lib/esm/components/Properties/GroupProperties/GroupPropertyUtils.js.map +1 -1
  206. package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.d.ts +12 -0
  207. package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js +117 -0
  208. package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js.map +1 -0
  209. package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.scss +49 -0
  210. package/lib/esm/components/Properties/GroupProperties/SortableHorizontalTile.d.ts +4 -4
  211. package/lib/esm/components/Properties/GroupProperties/SortableHorizontalTile.js +3 -4
  212. package/lib/esm/components/Properties/GroupProperties/SortableHorizontalTile.js.map +1 -1
  213. package/lib/esm/components/Properties/PropertyMenu.js +12 -16
  214. package/lib/esm/components/Properties/PropertyMenu.js.map +1 -1
  215. package/lib/esm/components/Properties/PropertyTable.js +1 -1
  216. package/lib/esm/components/Properties/PropertyTable.js.map +1 -1
  217. package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.d.ts +4 -0
  218. package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.js +8 -0
  219. package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.js.map +1 -0
  220. package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.d.ts +4 -0
  221. package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.js +8 -0
  222. package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.js.map +1 -0
  223. package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.d.ts +4 -0
  224. package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.js +8 -0
  225. package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.js.map +1 -0
  226. package/lib/esm/components/SharedComponents/DeleteModal.d.ts +1 -2
  227. package/lib/esm/components/SharedComponents/DeleteModal.js +1 -2
  228. package/lib/esm/components/SharedComponents/DeleteModal.js.map +1 -1
  229. package/lib/esm/components/context/ExtractionStateJobContext.d.ts +8 -0
  230. package/lib/esm/components/context/ExtractionStateJobContext.js +17 -0
  231. package/lib/esm/components/context/ExtractionStateJobContext.js.map +1 -0
  232. package/lib/esm/components/context/PropertiesGroupColorContext.d.ts +8 -0
  233. package/lib/esm/components/context/{PropertiesContext.js → PropertiesGroupColorContext.js} +5 -8
  234. package/lib/esm/components/context/PropertiesGroupColorContext.js.map +1 -0
  235. package/lib/esm/test/GroupingMappingCustomUI.test.js +3 -3
  236. package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
  237. package/package.json +3 -2
  238. package/lib/cjs/components/Groups/GroupItem.js +0 -23
  239. package/lib/cjs/components/Groups/GroupItem.js.map +0 -1
  240. package/lib/cjs/components/Properties/hooks/useFetchData.d.ts +0 -7
  241. package/lib/cjs/components/Properties/hooks/useFetchData.js +0 -43
  242. package/lib/cjs/components/Properties/hooks/useFetchData.js.map +0 -1
  243. package/lib/cjs/components/SharedComponents/HorizontalTile.d.ts +0 -19
  244. package/lib/cjs/components/SharedComponents/HorizontalTile.js +0 -27
  245. package/lib/cjs/components/SharedComponents/HorizontalTile.js.map +0 -1
  246. package/lib/cjs/components/SharedComponents/HorizontalTile.scss +0 -58
  247. package/lib/cjs/components/context/PropertiesContext.d.ts +0 -15
  248. package/lib/cjs/components/context/PropertiesContext.js.map +0 -1
  249. package/lib/esm/components/Groups/GroupItem.js +0 -16
  250. package/lib/esm/components/Groups/GroupItem.js.map +0 -1
  251. package/lib/esm/components/Properties/hooks/useFetchData.d.ts +0 -7
  252. package/lib/esm/components/Properties/hooks/useFetchData.js +0 -37
  253. package/lib/esm/components/Properties/hooks/useFetchData.js.map +0 -1
  254. package/lib/esm/components/SharedComponents/HorizontalTile.d.ts +0 -19
  255. package/lib/esm/components/SharedComponents/HorizontalTile.js +0 -20
  256. package/lib/esm/components/SharedComponents/HorizontalTile.js.map +0 -1
  257. package/lib/esm/components/SharedComponents/HorizontalTile.scss +0 -58
  258. package/lib/esm/components/context/PropertiesContext.d.ts +0 -15
  259. package/lib/esm/components/context/PropertiesContext.js.map +0 -1
@@ -62,7 +62,7 @@ exports.visualizeGroupColors = visualizeGroupColors;
62
62
  const getHiliteIdsAndKeysetFromGroup = async (iModelConnection, group) => {
63
63
  const query = group.query;
64
64
  const result = await (0, viewerUtils_1.getHiliteIds)(query, iModelConnection);
65
- return { group, result };
65
+ return { query, result };
66
66
  };
67
67
  exports.getHiliteIdsAndKeysetFromGroup = getHiliteIdsAndKeysetFromGroup;
68
68
  const getOverlappedElementsInfo = (overlappedElements) => {
@@ -1 +1 @@
1
- {"version":3,"file":"groupsHelpers.js","sourceRoot":"","sources":["../../../../src/components/Groups/groupsHelpers.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,oDAAyD;AAIzD,0DAAmK;AAEnK,MAAM,uBAAuB,GAAG,GAAG,CAAC,CAAE,8CAA8C;AACpF,MAAM,eAAe,GAAG,EAAE,CAAC,CAAW,gFAAgF;AACtH,MAAM,mBAAmB,GAAG,EAAE,CAAC,CAAO,oDAAoD;AAC1F,MAAM,mBAAmB,GAAG,GAAG,CAAC,CAAM,gDAAgD;AACtF,MAAM,mBAAmB,GAAG,EAAE,CAAC,CAAO,gDAAgD;AACtF,MAAM,WAAW,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7C,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,aAAqB,GAAG,EAAE,YAAoB,EAAE,EAAE,EAAE;IACpF,OAAO,OAAO,GAAG,KAAK,UAAU,MAAM,SAAS,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AAC,EAAE;gBAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,UAAU,EAAE;oBACnC,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;iBACrC;aACF;iBAAM;gBACL,wEAAwE;gBACxE,MAAM,oBAAoB,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAC3D,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,KAAK,aAAa,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,CAC5D,CAAC;gBACF,IAAI,oBAAoB,EAAE;oBACxB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,UAAU,EAAE;wBACnC,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;qBACrC;iBACF;aACF;SACF;KACF;IAED,qDAAqD;IACrD,IAAA,0BAAY,EAAC,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC;AAjCW,QAAA,4BAA4B,gCAiCvC","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 { FeatureOverrideType } from \"@itwin/core-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { Group } from \"@itwin/insights-client\";\nimport type { OverlappedElementGroupPairs, OverlappedInfo } from \"../context/GroupHilitedElementsContext\";\nimport { clearEmphasizedOverriddenElements, clearHiddenElements, emphasizeElements, getHiliteIds, hideElements, overrideElements } from \"../../common/viewerUtils\";\n\nconst GOLDEN_ANGLE_MULTIPLIER = 1.5; // Multiplier to spread colors more uniformly.\nconst BASE_HUE_OFFSET = 60; // Initial hue offset to avoid certain colors e.g 0 offset would begin with red.\nconst HUE_ADJUSTMENT_STEP = 15; // Step to adjust the hue to avoid the red spectrum.\nconst RED_HUE_LOWER_BOUND = 330; // Lower bound of the red hue spectrum to avoid.\nconst RED_HUE_UPPER_BOUND = 30; // Upper bound of the red hue spectrum to avoid.\nconst GOLDENANGLE = 180 * (3 - Math.sqrt(5));\n\nconst generateHSL = (hue: number, saturation: number = 100, lightness: number = 50) => {\n return `hsl(${hue}, ${saturation}%, ${lightness}%)`;\n};\n\nexport const getGroupColor = (index: number) => {\n let hue = (index * GOLDENANGLE * GOLDEN_ANGLE_MULTIPLIER + BASE_HUE_OFFSET) % 360;\n\n while (hue >= RED_HUE_LOWER_BOUND || hue <= RED_HUE_UPPER_BOUND) {\n hue = (hue + HUE_ADJUSTMENT_STEP) % 360;\n }\n\n return generateHSL(hue);\n};\n\nconst processGroupVisualization = async (\n overlappedElementGroupPairs: OverlappedElementGroupPairs,\n hiddenGroupsIds: Set<string>,\n doEmphasizeElements: boolean,\n color: string,\n replace: boolean,\n setNumberOfVisualizedGroups: (numberOfVisualizedGroups: number | ((numberOfVisualizedGroups: number) => number)) => void,\n) => {\n const hilitedIds = Array.from(overlappedElementGroupPairs.elementIds);\n\n overrideElements(hilitedIds, color, FeatureOverrideType.ColorAndAlpha, replace);\n setNumberOfVisualizedGroups((numberOfVisualizedGroups) => numberOfVisualizedGroups + 1);\n\n doEmphasizeElements && emphasizeElements(hilitedIds, undefined);\n\n for (const id of overlappedElementGroupPairs.groupIds) {\n if (hiddenGroupsIds.has(id)) {\n return [];\n }\n }\n return hilitedIds;\n};\n\nexport type GroupsElementIds = {\n groupId: string;\n elementIds: string[];\n}[];\n\nexport const hideGroupIds = (hiddenGroupIds: Set<string>, groupsWithGroupedOverlaps: OverlappedElementGroupPairs[] ) => {\n hiddenGroupIds.forEach((groupId) => {\n hideGroupConsideringOverlaps(groupsWithGroupedOverlaps, groupId, hiddenGroupIds);\n });\n};\n\nexport const visualizeGroupColors = async (\n hiddenGroupsIds: Set<string>,\n groupsWithGroupedOverlaps: OverlappedElementGroupPairs[],\n setNumberOfVisualizedGroups: (numberOfVisualizedGroups: number | ((numberOfVisualizedGroups: number) => number)) => void,\n doEmphasizeElements: boolean = true,\n) => {\n clearEmphasizedOverriddenElements();\n\n const singleGroupPromises = groupsWithGroupedOverlaps\n .filter((group) => group.groupIds.size === 1)\n .map(async (group, index) =>\n processGroupVisualization(\n group,\n hiddenGroupsIds,\n doEmphasizeElements,\n getGroupColor(index), // color for single group\n false, // Shouldn't matter as replacement only accounts for same colored overrides.\n setNumberOfVisualizedGroups,\n )\n );\n\n const overlappedGroupPromises = groupsWithGroupedOverlaps\n .filter((group) => group.groupIds.size !== 1)\n .map(async (group) =>\n processGroupVisualization(\n group,\n hiddenGroupsIds,\n doEmphasizeElements,\n generateHSL(0), // color for group of overlapped elements\n false,\n setNumberOfVisualizedGroups,\n )\n );\n\n clearHiddenElements();\n\n const allPromises = [...singleGroupPromises, ...overlappedGroupPromises];\n\n const allIds = (await Promise.all(allPromises)).flat();\n return allIds;\n};\n\nexport const getHiliteIdsAndKeysetFromGroup = async (\n iModelConnection: IModelConnection,\n group: Group,\n) => {\n const query = group.query;\n const result = await getHiliteIds(query, iModelConnection);\n return {group, result};\n\n};\n\nconst getOverlappedElementsInfo = (overlappedElements: OverlappedElementGroupPairs[]) => {\n const overlappedElementsInfo: Map<string, OverlappedInfo[]> = new Map();\n\n overlappedElements.forEach((elementGroup) => {\n const { elementIds, groupIds } = elementGroup;\n\n groupIds.forEach((group) => {\n const otherGroups = Array.from(groupIds).filter((grp) => grp !== group);\n const overlappedInfoArray = overlappedElementsInfo.get(group) ?? [];\n overlappedInfoArray.push({ groupIds: otherGroups, elements: Array.from(elementIds) });\n overlappedElementsInfo.set(group, overlappedInfoArray);\n });\n });\n return overlappedElementsInfo;\n};\n\nconst mergeElementsByGroup = (elems: Map<string, Set<string>>) => {\n const mergedList: Map<string, OverlappedElementGroupPairs> = new Map();\n elems.forEach((groupIds, elementId) => {\n const sortedGroups = Array.from(groupIds).sort();\n const key = sortedGroups.join(\"-\");\n const overlap = mergedList.get(key);\n if (overlap) {\n overlap.elementIds.add(elementId);\n } else {\n mergedList.set(key, { elementIds: new Set([elementId]), groupIds });\n }\n });\n return mergedList;\n};\n\nexport const generateOverlappedGroups = (\n groupsElementIds: GroupsElementIds,\n) => {\n const elems: Map<string, Set<string>> = new Map();\n const groupElementCount: Map<string, number> = new Map();\n\n // Build the elems map for associations between elements and their groups.\n for (const groupInfo of groupsElementIds) {\n for (const elem of groupInfo.elementIds) {\n const elemGroups = elems.get(elem) || new Set<string>();\n elemGroups.add(groupInfo.groupId);\n elems.set(elem, elemGroups);\n }\n groupElementCount.set(groupInfo.groupId, groupInfo.elementIds.length);\n }\n\n // Construct the unique list of all groups and their overlapped groups combinations\n const allGroups: OverlappedElementGroupPairs[] = groupsElementIds.map((groupInfo) => {\n const nonOverlappingElements = Array.from(new Set(groupInfo.elementIds)).filter((elem) => elems.get(elem)!.size === 1);\n groupElementCount.set(groupInfo.groupId, groupInfo.elementIds.length);\n return { elementIds: new Set(nonOverlappingElements), groupIds: new Set([groupInfo.groupId]) };\n });\n\n const mergedList = mergeElementsByGroup(elems);\n const overlappedGroupsInformation: OverlappedElementGroupPairs[] = Array.from(mergedList.values()).filter((value) => value.groupIds.size > 1);\n\n return { groupsWithGroupedOverlaps: [...allGroups, ...overlappedGroupsInformation], overlappedElementsInfo: getOverlappedElementsInfo(overlappedGroupsInformation), numberOfElementsInGroups: groupElementCount };\n};\n\nexport const hideGroupConsideringOverlaps = (\n overlappedElementGroupPairs: OverlappedElementGroupPairs[],\n groupIdToHide: string,\n hiddenGroupsIds: Set<string>\n) => {\n const elementsToPotentiallyHide = new Set<string>();\n\n // Check each entry in overlappedElementGroupPairs\n for (const entry of overlappedElementGroupPairs) {\n // If the groupToHide is part of this entry\n if (entry.groupIds.has(groupIdToHide)) {\n // If this is a unique entry (no overlaps for this group), add all its elements to hide list\n if (entry.groupIds.size === 1) {\n for (const elem of entry.elementIds) {\n elementsToPotentiallyHide.add(elem);\n }\n } else {\n // If there are overlaps, only hide if all overlapping groups are hidden\n const allOtherGroupsHidden = Array.from(entry.groupIds).every(\n (groupId) =>\n groupId === groupIdToHide || hiddenGroupsIds.has(groupId)\n );\n if (allOtherGroupsHidden) {\n for (const elem of entry.elementIds) {\n elementsToPotentiallyHide.add(elem);\n }\n }\n }\n }\n }\n\n // Now hide all elements in elementsToPotentiallyHide\n hideElements(Array.from(elementsToPotentiallyHide));\n};\n"]}
1
+ {"version":3,"file":"groupsHelpers.js","sourceRoot":"","sources":["../../../../src/components/Groups/groupsHelpers.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,oDAAyD;AAIzD,0DAAmK;AAEnK,MAAM,uBAAuB,GAAG,GAAG,CAAC,CAAE,8CAA8C;AACpF,MAAM,eAAe,GAAG,EAAE,CAAC,CAAW,gFAAgF;AACtH,MAAM,mBAAmB,GAAG,EAAE,CAAC,CAAO,oDAAoD;AAC1F,MAAM,mBAAmB,GAAG,GAAG,CAAC,CAAM,gDAAgD;AACtF,MAAM,mBAAmB,GAAG,EAAE,CAAC,CAAO,gDAAgD;AACtF,MAAM,WAAW,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7C,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,aAAqB,GAAG,EAAE,YAAoB,EAAE,EAAE,EAAE;IACpF,OAAO,OAAO,GAAG,KAAK,UAAU,MAAM,SAAS,IAAI,CAAC;AACtD,CAAC,CAAC;AAEK,MAAM,aAAa,GAAG,CAAC,KAAa,EAAE,EAAE;IAC7C,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,WAAW,GAAG,uBAAuB,GAAG,eAAe,CAAC,GAAG,GAAG,CAAC;IAElF,OAAO,GAAG,IAAI,mBAAmB,IAAI,GAAG,IAAI,mBAAmB,EAAE;QAC/D,GAAG,GAAG,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,GAAG,CAAC;KACzC;IAED,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;AAC1B,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AoB,EAAE;oBACxB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,UAAU,EAAE;wBACnC,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;qBACrC;iBACF;aACF;SACF;KACF;IAED,qDAAqD;IACrD,IAAA,0BAAY,EAAC,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC;AACtD,CAAC,CAAC;AAjCW,QAAA,4BAA4B,gCAiCvC","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 { FeatureOverrideType } from \"@itwin/core-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { Group } from \"@itwin/insights-client\";\nimport type { OverlappedElementGroupPairs, OverlappedInfo } from \"../context/GroupHilitedElementsContext\";\nimport { clearEmphasizedOverriddenElements, clearHiddenElements, emphasizeElements, getHiliteIds, hideElements, overrideElements } from \"../../common/viewerUtils\";\n\nconst GOLDEN_ANGLE_MULTIPLIER = 1.5; // Multiplier to spread colors more uniformly.\nconst BASE_HUE_OFFSET = 60; // Initial hue offset to avoid certain colors e.g 0 offset would begin with red.\nconst HUE_ADJUSTMENT_STEP = 15; // Step to adjust the hue to avoid the red spectrum.\nconst RED_HUE_LOWER_BOUND = 330; // Lower bound of the red hue spectrum to avoid.\nconst RED_HUE_UPPER_BOUND = 30; // Upper bound of the red hue spectrum to avoid.\nconst GOLDENANGLE = 180 * (3 - Math.sqrt(5));\n\nconst generateHSL = (hue: number, saturation: number = 100, lightness: number = 50) => {\n return `hsl(${hue}, ${saturation}%, ${lightness}%)`;\n};\n\nexport const getGroupColor = (index: number) => {\n let hue = (index * GOLDENANGLE * GOLDEN_ANGLE_MULTIPLIER + BASE_HUE_OFFSET) % 360;\n\n while (hue >= RED_HUE_LOWER_BOUND || hue <= RED_HUE_UPPER_BOUND) {\n hue = (hue + HUE_ADJUSTMENT_STEP) % 360;\n }\n\n return generateHSL(hue);\n};\n\nconst processGroupVisualization = async (\n overlappedElementGroupPairs: OverlappedElementGroupPairs,\n hiddenGroupsIds: Set<string>,\n doEmphasizeElements: boolean,\n color: string,\n replace: boolean,\n setNumberOfVisualizedGroups: (numberOfVisualizedGroups: number | ((numberOfVisualizedGroups: number) => number)) => void,\n) => {\n const hilitedIds = Array.from(overlappedElementGroupPairs.elementIds);\n\n overrideElements(hilitedIds, color, FeatureOverrideType.ColorAndAlpha, replace);\n setNumberOfVisualizedGroups((numberOfVisualizedGroups) => numberOfVisualizedGroups + 1);\n\n doEmphasizeElements && emphasizeElements(hilitedIds, undefined);\n\n for (const id of overlappedElementGroupPairs.groupIds) {\n if (hiddenGroupsIds.has(id)) {\n return [];\n }\n }\n return hilitedIds;\n};\n\nexport type GroupsElementIds = {\n groupId: string;\n elementIds: string[];\n}[];\n\nexport const hideGroupIds = (hiddenGroupIds: Set<string>, groupsWithGroupedOverlaps: OverlappedElementGroupPairs[] ) => {\n hiddenGroupIds.forEach((groupId) => {\n hideGroupConsideringOverlaps(groupsWithGroupedOverlaps, groupId, hiddenGroupIds);\n });\n};\n\nexport const visualizeGroupColors = async (\n hiddenGroupsIds: Set<string>,\n groupsWithGroupedOverlaps: OverlappedElementGroupPairs[],\n setNumberOfVisualizedGroups: (numberOfVisualizedGroups: number | ((numberOfVisualizedGroups: number) => number)) => void,\n doEmphasizeElements: boolean = true,\n) => {\n clearEmphasizedOverriddenElements();\n\n const singleGroupPromises = groupsWithGroupedOverlaps\n .filter((group) => group.groupIds.size === 1)\n .map(async (group, index) =>\n processGroupVisualization(\n group,\n hiddenGroupsIds,\n doEmphasizeElements,\n getGroupColor(index), // color for single group\n false, // Shouldn't matter as replacement only accounts for same colored overrides.\n setNumberOfVisualizedGroups,\n )\n );\n\n const overlappedGroupPromises = groupsWithGroupedOverlaps\n .filter((group) => group.groupIds.size !== 1)\n .map(async (group) =>\n processGroupVisualization(\n group,\n hiddenGroupsIds,\n doEmphasizeElements,\n generateHSL(0), // color for group of overlapped elements\n false,\n setNumberOfVisualizedGroups,\n )\n );\n\n clearHiddenElements();\n\n const allPromises = [...singleGroupPromises, ...overlappedGroupPromises];\n\n const allIds = (await Promise.all(allPromises)).flat();\n return allIds;\n};\n\nexport const getHiliteIdsAndKeysetFromGroup = async (\n iModelConnection: IModelConnection,\n group: Group,\n) => {\n const query = group.query;\n const result = await getHiliteIds(query, iModelConnection);\n return {query, result};\n\n};\n\nconst getOverlappedElementsInfo = (overlappedElements: OverlappedElementGroupPairs[]) => {\n const overlappedElementsInfo: Map<string, OverlappedInfo[]> = new Map();\n\n overlappedElements.forEach((elementGroup) => {\n const { elementIds, groupIds } = elementGroup;\n\n groupIds.forEach((group) => {\n const otherGroups = Array.from(groupIds).filter((grp) => grp !== group);\n const overlappedInfoArray = overlappedElementsInfo.get(group) ?? [];\n overlappedInfoArray.push({ groupIds: otherGroups, elements: Array.from(elementIds) });\n overlappedElementsInfo.set(group, overlappedInfoArray);\n });\n });\n return overlappedElementsInfo;\n};\n\nconst mergeElementsByGroup = (elems: Map<string, Set<string>>) => {\n const mergedList: Map<string, OverlappedElementGroupPairs> = new Map();\n elems.forEach((groupIds, elementId) => {\n const sortedGroups = Array.from(groupIds).sort();\n const key = sortedGroups.join(\"-\");\n const overlap = mergedList.get(key);\n if (overlap) {\n overlap.elementIds.add(elementId);\n } else {\n mergedList.set(key, { elementIds: new Set([elementId]), groupIds });\n }\n });\n return mergedList;\n};\n\nexport const generateOverlappedGroups = (\n groupsElementIds: GroupsElementIds,\n) => {\n const elems: Map<string, Set<string>> = new Map();\n const groupElementCount: Map<string, number> = new Map();\n\n // Build the elems map for associations between elements and their groups.\n for (const groupInfo of groupsElementIds) {\n for (const elem of groupInfo.elementIds) {\n const elemGroups = elems.get(elem) || new Set<string>();\n elemGroups.add(groupInfo.groupId);\n elems.set(elem, elemGroups);\n }\n groupElementCount.set(groupInfo.groupId, groupInfo.elementIds.length);\n }\n\n // Construct the unique list of all groups and their overlapped groups combinations\n const allGroups: OverlappedElementGroupPairs[] = groupsElementIds.map((groupInfo) => {\n const nonOverlappingElements = Array.from(new Set(groupInfo.elementIds)).filter((elem) => elems.get(elem)!.size === 1);\n groupElementCount.set(groupInfo.groupId, groupInfo.elementIds.length);\n return { elementIds: new Set(nonOverlappingElements), groupIds: new Set([groupInfo.groupId]) };\n });\n\n const mergedList = mergeElementsByGroup(elems);\n const overlappedGroupsInformation: OverlappedElementGroupPairs[] = Array.from(mergedList.values()).filter((value) => value.groupIds.size > 1);\n\n return { groupsWithGroupedOverlaps: [...allGroups, ...overlappedGroupsInformation], overlappedElementsInfo: getOverlappedElementsInfo(overlappedGroupsInformation), numberOfElementsInGroups: groupElementCount };\n};\n\nexport const hideGroupConsideringOverlaps = (\n overlappedElementGroupPairs: OverlappedElementGroupPairs[],\n groupIdToHide: string,\n hiddenGroupsIds: Set<string>\n) => {\n const elementsToPotentiallyHide = new Set<string>();\n\n // Check each entry in overlappedElementGroupPairs\n for (const entry of overlappedElementGroupPairs) {\n // If the groupToHide is part of this entry\n if (entry.groupIds.has(groupIdToHide)) {\n // If this is a unique entry (no overlaps for this group), add all its elements to hide list\n if (entry.groupIds.size === 1) {\n for (const elem of entry.elementIds) {\n elementsToPotentiallyHide.add(elem);\n }\n } else {\n // If there are overlaps, only hide if all overlapping groups are hidden\n const allOtherGroupsHidden = Array.from(entry.groupIds).every(\n (groupId) =>\n groupId === groupIdToHide || hiddenGroupsIds.has(groupId)\n );\n if (allOtherGroupsHidden) {\n for (const elem of entry.elementIds) {\n elementsToPotentiallyHide.add(elem);\n }\n }\n }\n }\n }\n\n // Now hide all elements in elementsToPotentiallyHide\n hideElements(Array.from(elementsToPotentiallyHide));\n};\n"]}
@@ -3,7 +3,7 @@ import type { Group } from "@itwin/insights-client";
3
3
  import type { KeySet } from "@itwin/presentation-common";
4
4
  import { TErrCodes } from "../../Constants";
5
5
  export interface QueryResults {
6
- group: Group;
6
+ query: string;
7
7
  result: {
8
8
  keySet: KeySet;
9
9
  ids: string[];
@@ -12,7 +12,7 @@ export interface QueryResults {
12
12
  export declare const createQueryForHiliteIdsAndKeyset: (group: Group, iModelConnection: IModelConnection, enabled: boolean) => {
13
13
  queryKey: string[];
14
14
  queryFn: () => Promise<{
15
- group: Group;
15
+ query: string;
16
16
  result: {
17
17
  keySet: KeySet;
18
18
  ids: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"useKeySetHiliteQueries.js","sourceRoot":"","sources":["../../../../../src/components/Groups/hooks/useKeySetHiliteQueries.ts"],"names":[],"mappings":";;;AAQA,uDAAiD;AACjD,uDAAmD;AACnD,iCAAgC;AAChC,+FAA4F;AAC5F,+CAA4C;AAC5C,oDAAkE;AAQjE,EAAE,CAAC;AAIG,MAAM,gCAAgC,GAAG,CAAC,KAAY,EAAE,gBAAkC,EAAE,OAAgB,EAAE,EAAE,CAAC,CAAC;IACvH,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IAC7C,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,IAAA,8CAA8B,EAAC,gBAAgB,EAAE,KAAK,CAAC;IAC5E,OAAO;IACP,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,EAAE,SAAS,EAAC,qBAAS,CAAC,yBAAyB,EAAE,OAAO,EAAE,qBAAqB,KAAK,CAAC,SAAS,GAAG,EAAE;CAC1G,CAAC,CAAC;AANU,QAAA,gCAAgC,oCAM1C;AAEI,MAAM,mBAAmB,GAAG,CAAC,KAAY,EAAE,gBAAkC,EAAE,OAAgB,EAAE,EAAE;IACxG,MAAM,KAAK,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,wCAAgC,EAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAEpI,OAAO,IAAA,sBAAQ,EAAe,KAAK,CAAC,CAAC;AACvC,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B;AAEK,MAAM,sBAAsB,GAAG,CAAC,MAAe,EAAE,OAAgB,EAAE,gBAAkC,EAAE,EAAE;IAC9G,MAAM,OAAO,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,wCAAgC,EAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC,EACrH,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvC,MAAM,cAAc,GAAG,IAAA,wBAAU,EAAW,EAAE,OAAO,EAAE,CAAC,CAAC;IAEzD,MAAM,YAAY,GAAG,IAAA,qDAAyB,EAAC,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IAE/G,OAAO,EAAE,YAAY,EAAE,CAAC;AAC1B,CAAC,CAAC;AATW,QAAA,sBAAsB,0BASjC","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 { IModelConnection } from \"@itwin/core-frontend\";\nimport type { Group } from \"@itwin/insights-client\";\nimport type { KeySet } from \"@itwin/presentation-common\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useQueries } from \"@tanstack/react-query\";\nimport { useMemo } from \"react\";\nimport { useMemoizedCollectionPick } from \"../../../common/hooks/useMemoizedCollectionPick\";\nimport { TErrCodes } from \"../../Constants\";\nimport { getHiliteIdsAndKeysetFromGroup } from \"../groupsHelpers\";\n\nexport interface QueryResults {\n group: Group;\n result: {\n keySet: KeySet;\n ids: string[];\n };\n}[];\n\ntype TQueries = UseQueryOptions<QueryResults>[];\n\nexport const createQueryForHiliteIdsAndKeyset = (group: Group, iModelConnection: IModelConnection, enabled: boolean) => ({\n queryKey: [\"group\", \"hiliteids\", group.query],\n queryFn: async () => getHiliteIdsAndKeysetFromGroup(iModelConnection, group),\n enabled,\n staleTime: Infinity,\n meta: { errorCode:TErrCodes.QUERY_HILITE_FETCH_FAILED, message: `Failed to resolve ${group.groupName}.` },\n});\n\nexport const useGroupKeySetQuery = (group: Group, iModelConnection: IModelConnection, enabled: boolean) => {\n const query = useMemo(() => createQueryForHiliteIdsAndKeyset(group, iModelConnection, enabled), [enabled, group, iModelConnection]);\n\n return useQuery<QueryResults>(query);\n};\n\nexport const useKeySetHiliteQueries = (groups: Group[], enabled: boolean, iModelConnection: IModelConnection) => {\n const queries = useMemo(() => groups.map((group) => createQueryForHiliteIdsAndKeyset(group, iModelConnection, enabled)),\n [groups, iModelConnection, enabled]);\n\n const useQueriesHook = useQueries<TQueries>({ queries });\n\n const groupQueries = useMemoizedCollectionPick(useQueriesHook, [\"data\", \"isFetching\", \"isFetched\", \"refetch\"]);\n\n return { groupQueries };\n};\n"]}
1
+ {"version":3,"file":"useKeySetHiliteQueries.js","sourceRoot":"","sources":["../../../../../src/components/Groups/hooks/useKeySetHiliteQueries.ts"],"names":[],"mappings":";;;AAQA,uDAAiD;AACjD,uDAAmD;AACnD,iCAAgC;AAChC,+FAA4F;AAC5F,+CAA4C;AAC5C,oDAAkE;AAQjE,EAAE,CAAC;AAIG,MAAM,gCAAgC,GAAG,CAAC,KAAY,EAAE,gBAAkC,EAAE,OAAgB,EAAE,EAAE,CAAC,CAAC;IACvH,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC;IAC7C,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,IAAA,8CAA8B,EAAC,gBAAgB,EAAE,KAAK,CAAC;IAC5E,OAAO;IACP,SAAS,EAAE,QAAQ;IACnB,IAAI,EAAE,EAAE,SAAS,EAAC,qBAAS,CAAC,yBAAyB,EAAE,OAAO,EAAE,qBAAqB,KAAK,CAAC,SAAS,GAAG,EAAE;CAC1G,CAAC,CAAC;AANU,QAAA,gCAAgC,oCAM1C;AAEI,MAAM,mBAAmB,GAAG,CAAC,KAAY,EAAE,gBAAkC,EAAE,OAAgB,EAAE,EAAE;IACxG,MAAM,KAAK,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAA,wCAAgC,EAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAEpI,OAAO,IAAA,sBAAQ,EAAe,KAAK,CAAC,CAAC;AACvC,CAAC,CAAC;AAJW,QAAA,mBAAmB,uBAI9B;AAEK,MAAM,sBAAsB,GAAG,CAAC,MAAe,EAAE,OAAgB,EAAE,gBAAkC,EAAE,EAAE;IAC9G,MAAM,OAAO,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,wCAAgC,EAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC,EACrH,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvC,MAAM,cAAc,GAAG,IAAA,wBAAU,EAAW,EAAE,OAAO,EAAE,CAAC,CAAC;IAEzD,MAAM,YAAY,GAAG,IAAA,qDAAyB,EAAC,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IAE/G,OAAO,EAAE,YAAY,EAAE,CAAC;AAC1B,CAAC,CAAC;AATW,QAAA,sBAAsB,0BASjC","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 { IModelConnection } from \"@itwin/core-frontend\";\nimport type { Group } from \"@itwin/insights-client\";\nimport type { KeySet } from \"@itwin/presentation-common\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useQueries } from \"@tanstack/react-query\";\nimport { useMemo } from \"react\";\nimport { useMemoizedCollectionPick } from \"../../../common/hooks/useMemoizedCollectionPick\";\nimport { TErrCodes } from \"../../Constants\";\nimport { getHiliteIdsAndKeysetFromGroup } from \"../groupsHelpers\";\n\nexport interface QueryResults {\n query: string;\n result: {\n keySet: KeySet;\n ids: string[];\n };\n}[];\n\ntype TQueries = UseQueryOptions<QueryResults>[];\n\nexport const createQueryForHiliteIdsAndKeyset = (group: Group, iModelConnection: IModelConnection, enabled: boolean) => ({\n queryKey: [\"group\", \"hiliteids\", group.query],\n queryFn: async () => getHiliteIdsAndKeysetFromGroup(iModelConnection, group),\n enabled,\n staleTime: Infinity,\n meta: { errorCode:TErrCodes.QUERY_HILITE_FETCH_FAILED, message: `Failed to resolve ${group.groupName}.` },\n});\n\nexport const useGroupKeySetQuery = (group: Group, iModelConnection: IModelConnection, enabled: boolean) => {\n const query = useMemo(() => createQueryForHiliteIdsAndKeyset(group, iModelConnection, enabled), [enabled, group, iModelConnection]);\n\n return useQuery<QueryResults>(query);\n};\n\nexport const useKeySetHiliteQueries = (groups: Group[], enabled: boolean, iModelConnection: IModelConnection) => {\n const queries = useMemo(() => groups.map((group) => createQueryForHiliteIdsAndKeyset(group, iModelConnection, enabled)),\n [groups, iModelConnection, enabled]);\n\n const useQueriesHook = useQueries<TQueries>({ queries });\n\n const groupQueries = useMemoizedCollectionPick(useQueriesHook, [\"data\", \"isFetching\", \"isFetched\", \"refetch\"]);\n\n return { groupQueries };\n};\n"]}
@@ -36,52 +36,61 @@ const StatusIcon_1 = require("../../SharedComponents/StatusIcon");
36
36
  const ExtractionLogCustomFilter_1 = require("./ExtractionLogCustomFilter");
37
37
  const GroupingApiConfigContext_1 = require("../../context/GroupingApiConfigContext");
38
38
  const MappingClientContext_1 = require("../../context/MappingClientContext");
39
- const useMappingsOperations_1 = require("../hooks/useMappingsOperations");
40
39
  const react_query_1 = require("@tanstack/react-query");
41
40
  const useMemoizedCollectionPick_1 = require("../../../common/hooks/useMemoizedCollectionPick");
42
41
  const useFetchGroups_1 = require("../../Groups/hooks/useFetchGroups");
42
+ const useFetchMappings_1 = require("../hooks/useFetchMappings");
43
43
  const ExtractionMessageModal = ({ isOpen, onClose, extractionMessageData, timestamp }) => {
44
44
  const [formattedExtractionMessage, setFormattedExtractionMessage] = (0, react_1.useState)(undefined);
45
45
  const groupingMappingApiConfig = (0, GroupingApiConfigContext_1.useGroupingMappingApiConfig)();
46
+ const { iModelId, getAccessToken } = groupingMappingApiConfig;
46
47
  const mappingClient = (0, MappingClientContext_1.useMappingClient)();
47
- const { mappings, isLoading: isMappingsLoading } = (0, useMappingsOperations_1.useMappingsOperations)({ ...groupingMappingApiConfig, mappingClient });
48
+ const { data: mappings, isLoading: isMappingsLoading } = (0, useFetchMappings_1.useFetchMappings)(iModelId, getAccessToken, mappingClient);
48
49
  const [formattedTimestamp, setFormattedTimestamp] = (0, react_1.useState)("");
49
50
  const getMappingName = (0, react_1.useCallback)((mappingId, mappings) => {
50
51
  return mappings.find((mapping) => mapping.id === mappingId)?.mappingName ?? "";
51
52
  }, []);
52
- // Extract groupIds and mappingIds from messages
53
53
  const extractionInfo = (0, react_1.useMemo)(() => {
54
- return extractionMessageData.reduce((acc, message) => {
54
+ const infoMap = new Map();
55
+ extractionMessageData.forEach((message) => {
55
56
  const splittedMessage = message.message.split(" ");
56
57
  const mappingId = splittedMessage[splittedMessage.indexOf("MappingId:") + 1]?.match(/^([^,]+),$/)?.[1];
57
58
  const groupId = splittedMessage[splittedMessage.indexOf("GroupId:") + 1]?.match(/^([^,]+).$/)?.[1];
58
59
  if (mappingId && groupId) {
59
- acc.push({ mappingId, groupId });
60
+ infoMap.set(message.message, { mappingId, groupId });
60
61
  }
61
- return acc;
62
- }, []);
62
+ });
63
+ return infoMap;
63
64
  }, [extractionMessageData]);
64
65
  // useQueries to fetch all group names
65
66
  const groupQueriesResults = (0, react_query_1.useQueries)({
66
- queries: extractionInfo.map(({ mappingId }) => ({
67
+ queries: Array.from(extractionInfo.values()).map(({ mappingId }) => ({
67
68
  queryKey: ["groups", mappingId],
68
- queryFn: async () => (0, useFetchGroups_1.fetchGroups)(groupingMappingApiConfig.iModelId, mappingId, groupingMappingApiConfig.getAccessToken, mappingClient),
69
+ queryFn: async () => {
70
+ const groups = await (0, useFetchGroups_1.fetchGroups)(groupingMappingApiConfig.iModelId, mappingId, groupingMappingApiConfig.getAccessToken, mappingClient);
71
+ // Return both mappingId and groups in the result
72
+ return { mappingId, groups };
73
+ },
69
74
  })),
70
75
  });
71
76
  // Workaround to get data from useQueries with more stability
72
77
  const pickedResult = (0, useMemoizedCollectionPick_1.useMemoizedCollectionPick)(groupQueriesResults, ["data", "error", "isLoading", "isSuccess"]);
73
78
  (0, react_1.useEffect)(() => {
74
79
  if (pickedResult.every((query) => query.isSuccess) && mappings) {
75
- const formattedMessages = extractionMessageData.map((extractionMessage, index) => {
80
+ const formattedMessages = extractionMessageData.map((extractionMessage) => {
76
81
  let replacedMessage = extractionMessage.message;
77
- const { mappingId, groupId } = extractionInfo[index];
78
- const groupName = pickedResult[index].data.find((group) => group.id === groupId)?.groupName;
79
- if (replacedMessage.includes("MappingId:")) {
80
- const mappingName = getMappingName(mappingId, mappings);
81
- replacedMessage = replacedMessage.replace(/MappingId: [\w-]+/, `Mapping: ${mappingName}`);
82
- }
83
- if (replacedMessage.includes("GroupId:")) {
84
- replacedMessage = replacedMessage.replace(/GroupId: [\w-]+/, `Group: ${groupName ? groupName : "<Not Found>"}`);
82
+ const info = extractionInfo.get(extractionMessage.message);
83
+ if (info) {
84
+ const { mappingId, groupId } = info;
85
+ const queryResult = pickedResult.find((result) => result.data?.mappingId === mappingId);
86
+ const groupName = queryResult?.data?.groups?.find((group) => group.id === groupId)?.groupName;
87
+ if (replacedMessage.includes("MappingId:")) {
88
+ const mappingName = getMappingName(mappingId, mappings);
89
+ replacedMessage = replacedMessage.replace(/MappingId: [\w-]+/, `Mapping: ${mappingName}`);
90
+ }
91
+ if (replacedMessage.includes("GroupId:")) {
92
+ replacedMessage = replacedMessage.replace(/GroupId: [\w-]+/, `Group: ${groupName ? groupName : "<Not Found>"}`);
93
+ }
85
94
  }
86
95
  return { ...extractionMessage, message: replacedMessage };
87
96
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ExtractionMessageModal.js","sourceRoot":"","sources":["../../../../../src/components/Mappings/Extraction/ExtractionMessageModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAAiI;AACjI,+CAAyE;AAEzE,yCAAuC;AACvC,oEAAsD;AAEtD,kEAA+D;AAC/D,2EAAwE;AACxE,qFAAqF;AACrF,6EAAsE;AACtE,0EAAuE;AAEvE,uDAAmD;AACnD,+FAA4F;AAC5F,sEAAgE;AAgBzD,MAAM,sBAAsB,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAA+B,EAAE,EAAE;IAC3H,MAAM,CAAC,0BAA0B,EAAE,6BAA6B,CAAC,GAAG,IAAA,gBAAQ,EAAsC,SAAS,CAAC,CAAC;IAC7H,MAAM,wBAAwB,GAAG,IAAA,sDAA2B,GAAE,CAAC;IAC/D,MAAM,aAAa,GAAG,IAAA,uCAAgB,GAAE,CAAC;IACzC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,IAAA,6CAAqB,EAAC,EAAE,GAAG,wBAAwB,EAAE,aAAa,EAAE,CAAC,CAAC;IACzH,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,IAAA,gBAAQ,EAAS,EAAE,CAAC,CAAC;IAEzE,MAAM,cAAc,GAAG,IAAA,mBAAW,EAAC,CAAC,SAAiB,EAAE,QAAmB,EAAE,EAA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AAK,IACJ,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,0BAA0B,IAAI,EAAE,EACtC,iBAAiB,EAAE,EAAE,EACrB,yBAAyB,EAAC,2BAA2B,EACrD,SAAS,EAAC,wCAAwC,EAClD,SAAS,EAAE,SAAS,GACpB,CACW;QACf,8BAAC,8BAAc;YACb,8BAAC,sBAAM,IACL,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,iBAAiB,YAGpB,CACM,CACX,CACT,CAAC;AACJ,CAAC,CAAC;AAnKW,QAAA,sBAAsB,0BAmKjC","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 { Button, DefaultCell, Icon, Modal, ModalButtonBar, ModalContent, Table, tableFilters, Text } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"../../../common/utils\";\nimport \"./ExtractionMessageModal.scss\";\nimport { SvgClock } from \"@itwin/itwinui-icons-react\";\nimport type { CellRendererProps, Column } from \"react-table\";\nimport { StatusIcon } from \"../../SharedComponents/StatusIcon\";\nimport { ExtractionLogCustomFilter } from \"./ExtractionLogCustomFilter\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMappingClient } from \"../../context/MappingClientContext\";\nimport { useMappingsOperations } from \"../hooks/useMappingsOperations\";\nimport type { Mapping } from \"@itwin/insights-client\";\nimport { useQueries } from \"@tanstack/react-query\";\nimport { useMemoizedCollectionPick } from \"../../../common/hooks/useMemoizedCollectionPick\";\nimport { fetchGroups } from \"../../Groups/hooks/useFetchGroups\";\n\nexport interface ExtractionMessageData {\n date: string;\n category: string;\n level: string;\n message: string;\n}\n\nexport interface ExtractionMessageModalProps {\n isOpen: boolean;\n onClose: () => void;\n extractionMessageData: ExtractionMessageData[];\n timestamp: string;\n}\n\nexport const ExtractionMessageModal = ({ isOpen, onClose, extractionMessageData, timestamp }: ExtractionMessageModalProps) => {\n const [formattedExtractionMessage, setFormattedExtractionMessage] = useState<ExtractionMessageData[] | undefined>(undefined);\n const groupingMappingApiConfig = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const { mappings, isLoading: isMappingsLoading } = useMappingsOperations({ ...groupingMappingApiConfig, mappingClient });\n const [formattedTimestamp, setFormattedTimestamp] = useState<string>(\"\");\n\n const getMappingName = useCallback((mappingId: string, mappings: Mapping[]) => {\n return mappings.find((mapping) => mapping.id === mappingId)?.mappingName ?? \"\";\n }, []);\n\n // Extract groupIds and mappingIds from messages\n const extractionInfo = useMemo(() => {\n return extractionMessageData.reduce<{\n mappingId: string;\n groupId: string;\n }[]>((acc, message) => {\n const splittedMessage = message.message.split(\" \");\n const mappingId = splittedMessage[splittedMessage.indexOf(\"MappingId:\") + 1]?.match(/^([^,]+),$/)?.[1];\n const groupId = splittedMessage[splittedMessage.indexOf(\"GroupId:\") + 1]?.match(/^([^,]+).$/)?.[1];\n\n if (mappingId && groupId) {\n acc.push({ mappingId, groupId });\n }\n return acc;\n }, []);\n }, [extractionMessageData]);\n\n // useQueries to fetch all group names\n const groupQueriesResults = useQueries({\n queries: extractionInfo.map(({ mappingId }) => ({\n queryKey: [\"groups\", mappingId],\n queryFn: async () => fetchGroups(groupingMappingApiConfig.iModelId, mappingId, groupingMappingApiConfig.getAccessToken, mappingClient),\n })),\n });\n\n // Workaround to get data from useQueries with more stability\n const pickedResult = useMemoizedCollectionPick(groupQueriesResults, [\"data\", \"error\", \"isLoading\", \"isSuccess\"]);\n\n useEffect(() => {\n if (pickedResult.every((query) => query.isSuccess) && mappings) {\n const formattedMessages = extractionMessageData.map((extractionMessage, index) => {\n let replacedMessage: string = extractionMessage.message;\n\n const { mappingId, groupId } = extractionInfo[index];\n const groupName = pickedResult[index].data!.find((group) => group.id === groupId)?.groupName;\n\n if (replacedMessage.includes(\"MappingId:\")) {\n const mappingName = getMappingName(mappingId, mappings);\n replacedMessage = replacedMessage.replace(/MappingId: [\\w-]+/, `Mapping: ${mappingName}`);\n }\n\n if (replacedMessage.includes(\"GroupId:\")) {\n replacedMessage = replacedMessage.replace(/GroupId: [\\w-]+/, `Group: ${groupName ? groupName : \"<Not Found>\"}`);\n }\n\n return { ...extractionMessage, message: replacedMessage };\n });\n\n setFormattedExtractionMessage(formattedMessages);\n }\n }, [extractionMessageData, mappings, extractionInfo, getMappingName, pickedResult]);\n\n useEffect(() => {\n const newDateTime: Date = new Date(timestamp);\n const options: Intl.DateTimeFormatOptions = {\n day: \"numeric\", month: \"numeric\", year: \"numeric\",\n hour: \"2-digit\", minute: \"2-digit\",\n };\n setFormattedTimestamp(newDateTime.toLocaleString(undefined, options));\n }, [timestamp]);\n\n const translatedLabels = useMemo(() => ({\n filter: \"Filter\",\n clear: \"Clear\",\n }), []);\n\n const columns = useMemo(\n (): Column<CreateTypeFromInterface<ExtractionMessageData>>[] => [\n {\n id: \"category\",\n Header: \"Category\",\n accessor: \"category\",\n fieldType: \"text\",\n Filter: ExtractionLogCustomFilter,\n filter: \"equals\",\n },\n {\n id: \"level\",\n Header: \"Level\",\n accessor: \"level\",\n cellRenderer: ({ cellElementProps, cellProps }: CellRendererProps<CreateTypeFromInterface<ExtractionMessageData>>) => {\n const level = cellProps.row.original.level;\n return (\n <DefaultCell\n cellElementProps={cellElementProps}\n cellProps={cellProps}\n startIcon={\n level === \"Error\" ? (\n <StatusIcon status='error' />\n ) : level === \"Warning\" ? (\n <StatusIcon status='warning' />\n ) : level === \"Info\" ? (\n <StatusIcon status='informational' />\n ) : <StatusIcon status='trace' />\n }\n >\n {level}\n </DefaultCell>\n );\n },\n Filter: ExtractionLogCustomFilter,\n filter: \"equals\",\n },\n {\n id: \"message\",\n Header: \"Message\",\n accessor: \"message\",\n width: \"25vw\",\n fieldType: \"text\",\n Filter: tableFilters.TextFilter(translatedLabels),\n },\n ],\n [translatedLabels]\n );\n const isLoading = pickedResult.some((query) => query.isLoading) || isMappingsLoading;\n\n return (\n <Modal className=\"gmw-message-modal-container\"\n title=\"Extraction Logs\"\n isOpen={isOpen}\n onClose={onClose}\n closeOnExternalClick={false}\n >\n <ModalContent>\n <div className=\"gmw-timestamp-icon\">\n <Icon\n title=\"Extraction Timestamp\"\n size=\"medium\"\n >\n <SvgClock />\n </Icon>\n <Text>{formattedTimestamp}</Text>\n </div>\n <Table<CreateTypeFromInterface<ExtractionMessageData>>\n columns={columns}\n data={formattedExtractionMessage ?? []}\n emptyTableContent={\"\"}\n emptyFilteredTableContent=\"No results match filters.\"\n className=\"gmw-extraction-message-table-container\"\n isLoading={isLoading}\n />\n </ModalContent>\n <ModalButtonBar>\n <Button\n onClick={onClose}\n styleType=\"high-visibility\"\n >\n Close\n </Button>\n </ModalButtonBar>\n </Modal>\n );\n};\n"]}
1
+ {"version":3,"file":"ExtractionMessageModal.js","sourceRoot":"","sources":["../../../../../src/components/Mappings/Extraction/ExtractionMessageModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAAiI;AACjI,+CAAyE;AAEzE,yCAAuC;AACvC,oEAAsD;AAEtD,kEAA+D;AAC/D,2EAAwE;AACxE,qFAAqF;AACrF,6EAAsE;AAEtE,uDAAmD;AACnD,+FAA4F;AAC5F,sEAAgE;AAChE,gEAA6D;AAgBtD,MAAM,sBAAsB,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAA+B,EAAE,EAAE;IAC3H,MAAM,CAAC,0BAA0B,EAAE,6BAA6B,CAAC,GAAG,IAAA,gBAAQ,EAAsC,SAAS,CAAC,CAAC;IAC7H,MAAM,wBAAwB,GAAG,IAAA,sDAA2B,GAAE,CAAC;IAC/D,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,wBAAwB,CAAC;IAC9D,MAAM,aAAa,GAAG,IAAA,uCAAgB,GAAE,CAAC;IACzC,M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MAAM,EAAE,SAAS;YACjB,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,MAAM;YACb,SAAS,EAAE,MAAM;YACjB,MAAM,EAAE,4BAAY,CAAC,UAAU,CAAC,gBAAgB,CAAC;SAClD;KACF,EACD,CAAC,gBAAgB,CAAC,CACnB,CAAC;IACF,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,iBAAiB,CAAC;IAErF,OAAO,CACL,8BAAC,qBAAK,IAAC,SAAS,EAAC,6BAA6B,EAC5C,KAAK,EAAC,iBAAiB,EACvB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,oBAAoB,EAAE,KAAK;QAE3B,8BAAC,4BAAY;YACX,uCAAK,SAAS,EAAC,oBAAoB;gBACjC,8BAAC,oBAAI,IACH,KAAK,EAAC,sBAAsB,EAC5B,IAAI,EAAC,QAAQ;oBAEb,8BAAC,8BAAQ,OAAG,CACP;gBACP,8BAAC,oBAAI,QAAE,kBAAkB,CAAQ,CAC7B;YACN,8BAAC,qBAAK,IACJ,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,0BAA0B,IAAI,EAAE,EACtC,iBAAiB,EAAE,EAAE,EACrB,yBAAyB,EAAC,2BAA2B,EACrD,SAAS,EAAC,wCAAwC,EAClD,SAAS,EAAE,SAAS,GACpB,CACW;QACf,8BAAC,8BAAc;YACb,8BAAC,sBAAM,IACL,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,iBAAiB,YAGpB,CACM,CACX,CACT,CAAC;AACJ,CAAC,CAAC;AA5KW,QAAA,sBAAsB,0BA4KjC","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 { Button, DefaultCell, Icon, Modal, ModalButtonBar, ModalContent, Table, tableFilters, Text } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"../../../common/utils\";\nimport \"./ExtractionMessageModal.scss\";\nimport { SvgClock } from \"@itwin/itwinui-icons-react\";\nimport type { CellRendererProps, Column } from \"react-table\";\nimport { StatusIcon } from \"../../SharedComponents/StatusIcon\";\nimport { ExtractionLogCustomFilter } from \"./ExtractionLogCustomFilter\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMappingClient } from \"../../context/MappingClientContext\";\nimport type { Mapping } from \"@itwin/insights-client\";\nimport { useQueries } from \"@tanstack/react-query\";\nimport { useMemoizedCollectionPick } from \"../../../common/hooks/useMemoizedCollectionPick\";\nimport { fetchGroups } from \"../../Groups/hooks/useFetchGroups\";\nimport { useFetchMappings } from \"../hooks/useFetchMappings\";\n\nexport interface ExtractionMessageData {\n date: string;\n category: string;\n level: string;\n message: string;\n}\n\nexport interface ExtractionMessageModalProps {\n isOpen: boolean;\n onClose: () => void;\n extractionMessageData: ExtractionMessageData[];\n timestamp: string;\n}\n\nexport const ExtractionMessageModal = ({ isOpen, onClose, extractionMessageData, timestamp }: ExtractionMessageModalProps) => {\n const [formattedExtractionMessage, setFormattedExtractionMessage] = useState<ExtractionMessageData[] | undefined>(undefined);\n const groupingMappingApiConfig = useGroupingMappingApiConfig();\n const { iModelId, getAccessToken } = groupingMappingApiConfig;\n const mappingClient = useMappingClient();\n const { data: mappings, isLoading: isMappingsLoading } = useFetchMappings(iModelId, getAccessToken, mappingClient);\n const [formattedTimestamp, setFormattedTimestamp] = useState<string>(\"\");\n\n const getMappingName = useCallback((mappingId: string, mappings: Mapping[]) => {\n return mappings.find((mapping) => mapping.id === mappingId)?.mappingName ?? \"\";\n }, []);\n\n const extractionInfo = useMemo(() => {\n const infoMap = new Map<string, { mappingId: string, groupId: string }>();\n\n extractionMessageData.forEach((message) => {\n const splittedMessage = message.message.split(\" \");\n const mappingId = splittedMessage[splittedMessage.indexOf(\"MappingId:\") + 1]?.match(/^([^,]+),$/)?.[1];\n const groupId = splittedMessage[splittedMessage.indexOf(\"GroupId:\") + 1]?.match(/^([^,]+).$/)?.[1];\n\n if (mappingId && groupId) {\n infoMap.set(message.message, { mappingId, groupId });\n }\n });\n\n return infoMap;\n }, [extractionMessageData]);\n\n // useQueries to fetch all group names\n const groupQueriesResults = useQueries({\n queries: Array.from(extractionInfo.values()).map(({ mappingId }) => ({\n queryKey: [\"groups\", mappingId],\n queryFn: async () => {\n const groups = await fetchGroups(groupingMappingApiConfig.iModelId, mappingId, groupingMappingApiConfig.getAccessToken, mappingClient);\n // Return both mappingId and groups in the result\n return { mappingId, groups };\n },\n })),\n });\n\n // Workaround to get data from useQueries with more stability\n const pickedResult = useMemoizedCollectionPick(groupQueriesResults, [\"data\", \"error\", \"isLoading\", \"isSuccess\"]);\n\n useEffect(() => {\n if (pickedResult.every((query) => query.isSuccess) && mappings) {\n const formattedMessages = extractionMessageData.map((extractionMessage) => {\n let replacedMessage: string = extractionMessage.message;\n\n const info = extractionInfo.get(extractionMessage.message);\n if (info) {\n const { mappingId, groupId } = info;\n\n const queryResult = pickedResult.find((result) => result.data?.mappingId === mappingId);\n const groupName = queryResult?.data?.groups?.find((group) => group.id === groupId)?.groupName;\n\n if (replacedMessage.includes(\"MappingId:\")) {\n const mappingName = getMappingName(mappingId, mappings);\n replacedMessage = replacedMessage.replace(/MappingId: [\\w-]+/, `Mapping: ${mappingName}`);\n }\n\n if (replacedMessage.includes(\"GroupId:\")) {\n replacedMessage = replacedMessage.replace(/GroupId: [\\w-]+/, `Group: ${groupName ? groupName : \"<Not Found>\"}`);\n }\n }\n\n return { ...extractionMessage, message: replacedMessage };\n });\n\n setFormattedExtractionMessage(formattedMessages);\n }\n }, [extractionMessageData, mappings, extractionInfo, getMappingName, pickedResult]);\n\n useEffect(() => {\n const newDateTime: Date = new Date(timestamp);\n const options: Intl.DateTimeFormatOptions = {\n day: \"numeric\", month: \"numeric\", year: \"numeric\",\n hour: \"2-digit\", minute: \"2-digit\",\n };\n setFormattedTimestamp(newDateTime.toLocaleString(undefined, options));\n }, [timestamp]);\n\n const translatedLabels = useMemo(() => ({\n filter: \"Filter\",\n clear: \"Clear\",\n }), []);\n\n const columns = useMemo(\n (): Column<CreateTypeFromInterface<ExtractionMessageData>>[] => [\n {\n id: \"category\",\n Header: \"Category\",\n accessor: \"category\",\n fieldType: \"text\",\n Filter: ExtractionLogCustomFilter,\n filter: \"equals\",\n },\n {\n id: \"level\",\n Header: \"Level\",\n accessor: \"level\",\n cellRenderer: ({ cellElementProps, cellProps }: CellRendererProps<CreateTypeFromInterface<ExtractionMessageData>>) => {\n const level = cellProps.row.original.level;\n return (\n <DefaultCell\n cellElementProps={cellElementProps}\n cellProps={cellProps}\n startIcon={\n level === \"Error\" ? (\n <StatusIcon status='error' />\n ) : level === \"Warning\" ? (\n <StatusIcon status='warning' />\n ) : level === \"Info\" ? (\n <StatusIcon status='informational' />\n ) : <StatusIcon status='trace' />\n }\n >\n {level}\n </DefaultCell>\n );\n },\n Filter: ExtractionLogCustomFilter,\n filter: \"equals\",\n },\n {\n id: \"message\",\n Header: \"Message\",\n accessor: \"message\",\n width: \"25vw\",\n fieldType: \"text\",\n Filter: tableFilters.TextFilter(translatedLabels),\n },\n ],\n [translatedLabels]\n );\n const isLoading = pickedResult.some((query) => query.isLoading) || isMappingsLoading;\n\n return (\n <Modal className=\"gmw-message-modal-container\"\n title=\"Extraction Logs\"\n isOpen={isOpen}\n onClose={onClose}\n closeOnExternalClick={false}\n >\n <ModalContent>\n <div className=\"gmw-timestamp-icon\">\n <Icon\n title=\"Extraction Timestamp\"\n size=\"medium\"\n >\n <SvgClock />\n </Icon>\n <Text>{formattedTimestamp}</Text>\n </div>\n <Table<CreateTypeFromInterface<ExtractionMessageData>>\n columns={columns}\n data={formattedExtractionMessage ?? []}\n emptyTableContent={\"\"}\n emptyFilteredTableContent=\"No results match filters.\"\n className=\"gmw-extraction-message-table-container\"\n isLoading={isLoading}\n />\n </ModalContent>\n <ModalButtonBar>\n <Button\n onClick={onClose}\n styleType=\"high-visibility\"\n >\n Close\n </Button>\n </ModalButtonBar>\n </Modal>\n );\n};\n"]}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const QueuedExtractionState: () => JSX.Element;
3
+ //# sourceMappingURL=QueuedExtractionState.d.ts.map
@@ -0,0 +1,17 @@
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.QueuedExtractionState = 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 itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
13
+ const QueuedExtractionState = () => (react_1.default.createElement("div", { title: "Queued", className: "gmw-extraction-status" },
14
+ react_1.default.createElement("div", { className: "gmw-status-icon" },
15
+ react_1.default.createElement(itwinui_icons_react_1.SvgStatusPending, null))));
16
+ exports.QueuedExtractionState = QueuedExtractionState;
17
+ //# sourceMappingURL=QueuedExtractionState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueuedExtractionState.js","sourceRoot":"","sources":["../../../../../../src/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,oEAA8D;AAEvD,MAAM,qBAAqB,GAAG,GAAG,EAAE,CAAC,CACzC,uCACE,KAAK,EAAC,QAAQ,EACd,SAAS,EAAC,uBAAuB;IACjC,uCAAK,SAAS,EAAC,iBAAiB;QAC9B,8BAAC,sCAAgB,OAAG,CAChB,CACF,CACP,CAAC;AARW,QAAA,qBAAqB,yBAQhC","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 { SvgStatusPending } from \"@itwin/itwinui-icons-react\";\n\nexport const QueuedExtractionState = () => (\n <div\n title=\"Queued\"\n className=\"gmw-extraction-status\">\n <div className=\"gmw-status-icon\">\n <SvgStatusPending />\n </div>\n </div>\n);\n"]}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const RunningExtractionState: () => JSX.Element;
3
+ //# sourceMappingURL=RunningExtractionState.d.ts.map
@@ -0,0 +1,16 @@
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.RunningExtractionState = 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 itwinui_react_1 = require("@itwin/itwinui-react");
13
+ const RunningExtractionState = () => (react_1.default.createElement("div", { title: "Running", className: "gmw-extraction-status-running" },
14
+ react_1.default.createElement(itwinui_react_1.ProgressRadial, { size: "x-small", indeterminate: true })));
15
+ exports.RunningExtractionState = RunningExtractionState;
16
+ //# sourceMappingURL=RunningExtractionState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunningExtractionState.js","sourceRoot":"","sources":["../../../../../../src/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,wDAAsD;AAE/C,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,CAC1C,uCACE,KAAK,EAAC,SAAS,EACf,SAAS,EAAC,+BAA+B;IACzC,8BAAC,8BAAc,IAAC,IAAI,EAAC,SAAS,EAAC,aAAa,SAAG,CAC3C,CACP,CAAC;AANW,QAAA,sBAAsB,0BAMjC","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 { ProgressRadial } from \"@itwin/itwinui-react\";\n\nexport const RunningExtractionState = () => (\n <div\n title=\"Running\"\n className=\"gmw-extraction-status-running\">\n <ProgressRadial size=\"x-small\" indeterminate />\n </div>\n);\n"]}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const StartingExtractionState: () => JSX.Element;
3
+ //# sourceMappingURL=StartingExtractionState.d.ts.map
@@ -0,0 +1,17 @@
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.StartingExtractionState = 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 itwinui_icons_color_react_1 = require("@itwin/itwinui-icons-color-react");
13
+ const StartingExtractionState = () => (react_1.default.createElement("div", { title: "Starting", className: "gmw-extraction-status" },
14
+ react_1.default.createElement("div", { className: "gmw-status-icon" },
15
+ react_1.default.createElement(itwinui_icons_color_react_1.SvgStatusPendingHollow, null))));
16
+ exports.StartingExtractionState = StartingExtractionState;
17
+ //# sourceMappingURL=StartingExtractionState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StartingExtractionState.js","sourceRoot":"","sources":["../../../../../../src/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,gFAA0E;AAEnE,MAAM,uBAAuB,GAAG,GAAG,EAAE,CAAC,CAC3C,uCACE,KAAK,EAAC,UAAU,EAChB,SAAS,EAAC,uBAAuB;IACjC,uCAAK,SAAS,EAAC,iBAAiB;QAC9B,8BAAC,kDAAsB,OAAG,CACtB,CACF,CACP,CAAC;AARW,QAAA,uBAAuB,2BAQlC","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 { SvgStatusPendingHollow } from \"@itwin/itwinui-icons-color-react\";\n\nexport const StartingExtractionState = () => (\n <div\n title=\"Starting\"\n className=\"gmw-extraction-status\">\n <div className=\"gmw-status-icon\">\n <SvgStatusPendingHollow />\n </div>\n </div>\n);\n"]}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ interface ExtractionStateProps {
3
+ status: string;
4
+ animation: boolean;
5
+ onAnimationEnd: () => void;
6
+ }
7
+ export declare const TerminalExtractionState: ({ status, animation, onAnimationEnd }: ExtractionStateProps) => JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=TerminalExtractionState.d.ts.map
@@ -0,0 +1,21 @@
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.TerminalExtractionState = 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 itwinui_icons_color_react_1 = require("@itwin/itwinui-icons-color-react");
13
+ const Constants_1 = require("../../../Constants");
14
+ const TerminalExtractionState = ({ status, animation, onAnimationEnd }) => (react_1.default.createElement("div", { title: status, className: "gmw-extraction-status" },
15
+ react_1.default.createElement("div", { className: `gmw-status-icon`, style: {
16
+ animationName: animation ? "gmw-fade-out" : "",
17
+ animationDelay: Constants_1.ANIMATION_DELAY,
18
+ animationDuration: Constants_1.ANIMATION_DURATION,
19
+ }, onAnimationEnd: onAnimationEnd }, status === "Succeeded" ? react_1.default.createElement(itwinui_icons_color_react_1.SvgStatusSuccess, null) : react_1.default.createElement(itwinui_icons_color_react_1.SvgStatusError, null))));
20
+ exports.TerminalExtractionState = TerminalExtractionState;
21
+ //# sourceMappingURL=TerminalExtractionState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TerminalExtractionState.js","sourceRoot":"","sources":["../../../../../../src/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,gFAAoF;AACpF,kDAAyE;AAQlE,MAAM,uBAAuB,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAwB,EAAE,EAAE,CAAC,CACtG,uCACE,KAAK,EAAE,MAAM,EACb,SAAS,EAAC,uBAAuB;IACjC,uCACE,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE;YACL,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;YAC9C,cAAc,EAAE,2BAAe;YAC/B,iBAAiB,EAAE,8BAAkB;SACtC,EACD,cAAc,EAAE,cAAc,IAE7B,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,8BAAC,4CAAgB,OAAG,CAAC,CAAC,CAAC,8BAAC,0CAAc,OAAG,CAC/D,CACF,CACP,CAAC;AAhBW,QAAA,uBAAuB,2BAgBlC","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 { SvgStatusError, SvgStatusSuccess } from \"@itwin/itwinui-icons-color-react\";\nimport { ANIMATION_DELAY, ANIMATION_DURATION } from \"../../../Constants\";\n\ninterface ExtractionStateProps {\n status: string;\n animation: boolean;\n onAnimationEnd: () => void;\n}\n\nexport const TerminalExtractionState = ({ status, animation, onAnimationEnd }: ExtractionStateProps) => (\n <div\n title={status}\n className=\"gmw-extraction-status\">\n <div\n className={`gmw-status-icon`}\n style={{\n animationName: animation ? \"gmw-fade-out\" : \"\",\n animationDelay: ANIMATION_DELAY,\n animationDuration: ANIMATION_DURATION,\n }}\n onAnimationEnd={onAnimationEnd}\n >\n {status === \"Succeeded\" ? <SvgStatusSuccess /> : <SvgStatusError />}\n </div>\n </div>\n);\n"]}
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import "./ExtractionStatus.scss";
3
+ export declare enum ExtractionStates {
4
+ None = 0,
5
+ Starting = 1,
6
+ Queued = 2,
7
+ Running = 3,
8
+ Succeeded = 4,
9
+ Failed = 5
10
+ }
11
+ interface ExtractionStatusProps {
12
+ state: ExtractionStates | undefined;
13
+ clearExtractionState: () => void;
14
+ }
15
+ export declare const ExtractionStatus: ({ state, clearExtractionState, }: ExtractionStatusProps) => JSX.Element | null;
16
+ export {};
17
+ //# sourceMappingURL=ExtractionStatus.d.ts.map
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ExtractionStatus = exports.ExtractionStates = void 0;
27
+ /*---------------------------------------------------------------------------------------------
28
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
29
+ * See LICENSE.md in the project root for license terms and full copyright notice.
30
+ *--------------------------------------------------------------------------------------------*/
31
+ const react_1 = require("react");
32
+ const React = __importStar(require("react"));
33
+ const Constants_1 = require("../../Constants");
34
+ const StartingExtractionState_1 = require("./ExtractionStates/StartingExtractionState");
35
+ const QueuedExtractionState_1 = require("./ExtractionStates/QueuedExtractionState");
36
+ const TerminalExtractionState_1 = require("./ExtractionStates/TerminalExtractionState");
37
+ const RunningExtractionState_1 = require("./ExtractionStates/RunningExtractionState");
38
+ require("./ExtractionStatus.scss");
39
+ var ExtractionStates;
40
+ (function (ExtractionStates) {
41
+ ExtractionStates[ExtractionStates["None"] = 0] = "None";
42
+ ExtractionStates[ExtractionStates["Starting"] = 1] = "Starting";
43
+ ExtractionStates[ExtractionStates["Queued"] = 2] = "Queued";
44
+ ExtractionStates[ExtractionStates["Running"] = 3] = "Running";
45
+ ExtractionStates[ExtractionStates["Succeeded"] = 4] = "Succeeded";
46
+ ExtractionStates[ExtractionStates["Failed"] = 5] = "Failed";
47
+ })(ExtractionStates = exports.ExtractionStates || (exports.ExtractionStates = {}));
48
+ const ExtractionStatus = ({ state, clearExtractionState, }) => {
49
+ const [fadeOut, setFadeOut] = (0, react_1.useState)(false);
50
+ const onAnimationEnd = () => {
51
+ clearExtractionState();
52
+ setFadeOut(false);
53
+ };
54
+ (0, react_1.useEffect)(() => {
55
+ let timer;
56
+ switch (state) {
57
+ case ExtractionStates.Succeeded:
58
+ case ExtractionStates.Failed:
59
+ timer = window.setTimeout(() => setFadeOut(true), Constants_1.STATUS_CHECK_INTERVAL);
60
+ }
61
+ return () => window.clearTimeout(timer);
62
+ }, [state]);
63
+ switch (state) {
64
+ case ExtractionStates.Starting:
65
+ return (React.createElement(StartingExtractionState_1.StartingExtractionState, null));
66
+ case ExtractionStates.Queued:
67
+ return (React.createElement(QueuedExtractionState_1.QueuedExtractionState, null));
68
+ case ExtractionStates.Running:
69
+ return (React.createElement(RunningExtractionState_1.RunningExtractionState, null));
70
+ case ExtractionStates.Succeeded:
71
+ return (React.createElement(TerminalExtractionState_1.TerminalExtractionState, { status: "Succeeded", animation: fadeOut, onAnimationEnd: onAnimationEnd }));
72
+ case ExtractionStates.Failed:
73
+ return (React.createElement(TerminalExtractionState_1.TerminalExtractionState, { status: "Failed", animation: fadeOut, onAnimationEnd: onAnimationEnd }));
74
+ default:
75
+ return null;
76
+ }
77
+ };
78
+ exports.ExtractionStatus = ExtractionStatus;
79
+ //# sourceMappingURL=ExtractionStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExtractionStatus.js","sourceRoot":"","sources":["../../../../../src/components/Mappings/Extraction/ExtractionStatus.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,iCAA4C;AAC5C,6CAA+B;AAC/B,+CAAwD;AACxD,wFAAqF;AACrF,oFAAiF;AACjF,wFAAqF;AACrF,sFAAmF;AACnF,mCAAiC;AAEjC,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IAC1B,uDAAI,CAAA;IACJ,+DAAQ,CAAA;IACR,2DAAM,CAAA;IACN,6DAAO,CAAA;IACP,iEAAS,CAAA;IACT,2DAAM,CAAA;AACR,CAAC,EAPW,gBAAgB,GAAhB,wBAAgB,KAA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,EACf,SAAS,EAAE,OAAO,EAClB,cAAc,EAAE,cAAc,GAC9B,CAAC,CAAC;QACN;YACE,OAAO,IAAI,CAAC;KACf;AACH,CAAC,CAAC;AA3CW,QAAA,gBAAgB,oBA2C3B","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 { useEffect, useState } from \"react\";\nimport * as React from \"react\";\nimport { STATUS_CHECK_INTERVAL } from \"../../Constants\";\nimport { StartingExtractionState } from \"./ExtractionStates/StartingExtractionState\";\nimport { QueuedExtractionState } from \"./ExtractionStates/QueuedExtractionState\";\nimport { TerminalExtractionState } from \"./ExtractionStates/TerminalExtractionState\";\nimport { RunningExtractionState } from \"./ExtractionStates/RunningExtractionState\";\nimport \"./ExtractionStatus.scss\";\n\nexport enum ExtractionStates {\n None,\n Starting,\n Queued,\n Running,\n Succeeded,\n Failed,\n}\n\ninterface ExtractionStatusProps {\n state: ExtractionStates | undefined;\n clearExtractionState: () => void;\n}\n\nexport const ExtractionStatus = ({\n state,\n clearExtractionState,\n}: ExtractionStatusProps) => {\n const [fadeOut, setFadeOut] = useState<boolean>(false);\n\n const onAnimationEnd = () => {\n clearExtractionState();\n setFadeOut(false);\n };\n\n useEffect(() => {\n let timer: number;\n switch (state) {\n case ExtractionStates.Succeeded:\n case ExtractionStates.Failed:\n timer = window.setTimeout(() => setFadeOut(true), STATUS_CHECK_INTERVAL);\n }\n return () => window.clearTimeout(timer);\n }, [state]);\n\n switch (state) {\n case ExtractionStates.Starting:\n return (<StartingExtractionState />);\n case ExtractionStates.Queued:\n return (<QueuedExtractionState />);\n case ExtractionStates.Running:\n return (<RunningExtractionState />);\n case ExtractionStates.Succeeded:\n return (<TerminalExtractionState\n status=\"Succeeded\"\n animation={fadeOut}\n onAnimationEnd={onAnimationEnd}\n />);\n case ExtractionStates.Failed:\n return (<TerminalExtractionState\n status=\"Failed\"\n animation={fadeOut}\n onAnimationEnd={onAnimationEnd}\n />);\n default:\n return null;\n }\n};\n"]}
@@ -0,0 +1,40 @@
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
+
6
+ .gmw-extraction-status {
7
+ align-items: center;
8
+ height: 38px;
9
+ display: flex;
10
+
11
+ .gmw-status-icon {
12
+ width: var(--iui-size-m);
13
+ height: var(--iui-size-m);
14
+ align-items: center;
15
+ margin: auto calc(var(--iui-size-2xs) * 3);
16
+ display: flex;
17
+ }
18
+ }
19
+
20
+ .gmw-extraction-status-running {
21
+ align-items: center;
22
+ height: 38px;
23
+ display: flex;
24
+ margin: auto calc(var(--iui-size-2xs) * 3);
25
+
26
+ .gmw-status-icon {
27
+ width: var(--iui-size-m);
28
+ height: var(--iui-size-m);
29
+ }
30
+ }
31
+
32
+ @keyframes gmw-fade-out {
33
+ 0% {
34
+ opacity: 1;
35
+ }
36
+
37
+ 100% {
38
+ opacity: 0;
39
+ }
40
+ }
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import type { Mapping } from "@itwin/insights-client";
3
+ import type { BeEvent } from "@itwin/core-bentley";
4
+ import "./MappingListItem.scss";
5
+ export interface MappingListItemProps {
6
+ selected: boolean;
7
+ mapping: Mapping;
8
+ jobId: string;
9
+ jobStartEvent: BeEvent<(mappingId: string) => void>;
10
+ onSelectionChange?: (mapping: Mapping) => void;
11
+ onClickMappingTitle?: (mapping: Mapping) => void;
12
+ onClickMappingModify?: (mapping: Mapping) => void;
13
+ onRefreshMappings: () => Promise<void>;
14
+ onToggleExtraction: (mapping: Mapping) => Promise<void>;
15
+ setShowDeleteModal: (mapping?: Mapping) => void;
16
+ initialStateExtractionFlag?: boolean;
17
+ setInitialExtractionStateFlag?: (initialStateExtractionFlag: boolean) => void;
18
+ }
19
+ export declare const MappingListItem: ({ selected, onSelectionChange, mapping, jobId, jobStartEvent, onClickMappingModify, onClickMappingTitle, onRefreshMappings, onToggleExtraction, setShowDeleteModal, }: MappingListItemProps) => JSX.Element;
20
+ //# sourceMappingURL=MappingListItem.d.ts.map