@itwin/grouping-mapping-widget 0.23.0 → 0.24.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 (211) 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/components/Constants.d.ts +3 -0
  4. package/lib/cjs/components/Constants.js +5 -2
  5. package/lib/cjs/components/Constants.js.map +1 -1
  6. package/lib/cjs/components/GroupingMappingContext.js +12 -14
  7. package/lib/cjs/components/GroupingMappingContext.js.map +1 -1
  8. package/lib/cjs/components/Groups/Editing/GroupAction.js +5 -1
  9. package/lib/cjs/components/Groups/Editing/GroupAction.js.map +1 -1
  10. package/lib/cjs/components/Groups/GroupsVisualization.js +44 -12
  11. package/lib/cjs/components/Groups/GroupsVisualization.js.map +1 -1
  12. package/lib/cjs/components/Groups/groupsHelpers.d.ts +2 -1
  13. package/lib/cjs/components/Groups/groupsHelpers.js +8 -5
  14. package/lib/cjs/components/Groups/groupsHelpers.js.map +1 -1
  15. package/lib/cjs/components/Groups/hooks/useKeySetHiliteQueries.d.ts +2 -2
  16. package/lib/cjs/components/Groups/hooks/useKeySetHiliteQueries.js.map +1 -1
  17. package/lib/cjs/components/Mappings/Extraction/ExtractionMessageModal.js +27 -18
  18. package/lib/cjs/components/Mappings/Extraction/ExtractionMessageModal.js.map +1 -1
  19. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.d.ts +3 -0
  20. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js +17 -0
  21. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js.map +1 -0
  22. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.d.ts +3 -0
  23. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js +16 -0
  24. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js.map +1 -0
  25. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.d.ts +3 -0
  26. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js +17 -0
  27. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js.map +1 -0
  28. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.d.ts +9 -0
  29. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js +21 -0
  30. package/lib/cjs/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js.map +1 -0
  31. package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.d.ts +17 -0
  32. package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.js +79 -0
  33. package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.js.map +1 -0
  34. package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.scss +40 -0
  35. package/lib/cjs/components/Mappings/Import/SelectIModel.js +1 -2
  36. package/lib/cjs/components/Mappings/Import/SelectIModel.js.map +1 -1
  37. package/lib/cjs/components/Mappings/MappingListItem.d.ts +20 -0
  38. package/lib/cjs/components/Mappings/MappingListItem.js +96 -0
  39. package/lib/cjs/components/Mappings/MappingListItem.js.map +1 -0
  40. package/lib/cjs/components/Mappings/MappingListItem.scss +25 -0
  41. package/lib/cjs/components/Mappings/MappingsView.d.ts +2 -0
  42. package/lib/cjs/components/Mappings/MappingsView.js +28 -4
  43. package/lib/cjs/components/Mappings/MappingsView.js.map +1 -1
  44. package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.d.ts +3 -1
  45. package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.js +7 -4
  46. package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.js.map +1 -1
  47. package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.d.ts +20 -0
  48. package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.js +55 -0
  49. package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.js.map +1 -0
  50. package/lib/cjs/components/Mappings/hooks/useMappingsOperations.d.ts +8 -0
  51. package/lib/cjs/components/Mappings/hooks/useMappingsOperations.js +29 -5
  52. package/lib/cjs/components/Mappings/hooks/useMappingsOperations.js.map +1 -1
  53. package/lib/cjs/components/Mappings/hooks/useRunExtraction.d.ts +14 -0
  54. package/lib/cjs/components/Mappings/hooks/useRunExtraction.js +42 -0
  55. package/lib/cjs/components/Mappings/hooks/useRunExtraction.js.map +1 -0
  56. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +17 -25
  57. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
  58. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +18 -25
  59. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
  60. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +35 -38
  61. package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +1 -1
  62. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js +28 -59
  63. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
  64. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js +37 -40
  65. package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js.map +1 -1
  66. package/lib/cjs/components/Properties/GroupColorToggle.js +30 -26
  67. package/lib/cjs/components/Properties/GroupColorToggle.js.map +1 -1
  68. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js +61 -166
  69. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
  70. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.scss +1 -46
  71. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js +34 -37
  72. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
  73. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyUtils.js +65 -51
  74. package/lib/cjs/components/Properties/GroupProperties/GroupPropertyUtils.js.map +1 -1
  75. package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.d.ts +12 -0
  76. package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js +147 -0
  77. package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js.map +1 -0
  78. package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.scss +49 -0
  79. package/lib/cjs/components/Properties/PropertyMenu.js +11 -15
  80. package/lib/cjs/components/Properties/PropertyMenu.js.map +1 -1
  81. package/lib/cjs/components/Properties/PropertyTable.js +1 -1
  82. package/lib/cjs/components/Properties/PropertyTable.js.map +1 -1
  83. package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.d.ts +4 -0
  84. package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.js +12 -0
  85. package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.js.map +1 -0
  86. package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.d.ts +4 -0
  87. package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.js +12 -0
  88. package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.js.map +1 -0
  89. package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.d.ts +4 -0
  90. package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.js +12 -0
  91. package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.js.map +1 -0
  92. package/lib/cjs/components/SharedComponents/DeleteModal.d.ts +1 -2
  93. package/lib/cjs/components/SharedComponents/DeleteModal.js +1 -2
  94. package/lib/cjs/components/SharedComponents/DeleteModal.js.map +1 -1
  95. package/lib/cjs/components/context/ExtractionStateJobContext.d.ts +8 -0
  96. package/lib/cjs/components/context/ExtractionStateJobContext.js +44 -0
  97. package/lib/cjs/components/context/ExtractionStateJobContext.js.map +1 -0
  98. package/lib/cjs/components/context/PropertiesGroupColorContext.d.ts +8 -0
  99. package/lib/cjs/components/context/{PropertiesContext.js → PropertiesGroupColorContext.js} +7 -10
  100. package/lib/cjs/components/context/PropertiesGroupColorContext.js.map +1 -0
  101. package/lib/esm/WidgetShell/GroupingMappingContent.js +2 -2
  102. package/lib/esm/WidgetShell/GroupingMappingContent.js.map +1 -1
  103. package/lib/esm/components/Constants.d.ts +3 -0
  104. package/lib/esm/components/Constants.js +3 -0
  105. package/lib/esm/components/Constants.js.map +1 -1
  106. package/lib/esm/components/GroupingMappingContext.js +12 -14
  107. package/lib/esm/components/GroupingMappingContext.js.map +1 -1
  108. package/lib/esm/components/Groups/Editing/GroupAction.js +5 -1
  109. package/lib/esm/components/Groups/Editing/GroupAction.js.map +1 -1
  110. package/lib/esm/components/Groups/GroupsVisualization.js +45 -13
  111. package/lib/esm/components/Groups/GroupsVisualization.js.map +1 -1
  112. package/lib/esm/components/Groups/groupsHelpers.d.ts +2 -1
  113. package/lib/esm/components/Groups/groupsHelpers.js +6 -4
  114. package/lib/esm/components/Groups/groupsHelpers.js.map +1 -1
  115. package/lib/esm/components/Groups/hooks/useKeySetHiliteQueries.d.ts +2 -2
  116. package/lib/esm/components/Groups/hooks/useKeySetHiliteQueries.js.map +1 -1
  117. package/lib/esm/components/Mappings/Extraction/ExtractionMessageModal.js +27 -18
  118. package/lib/esm/components/Mappings/Extraction/ExtractionMessageModal.js.map +1 -1
  119. package/lib/esm/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.d.ts +3 -0
  120. package/lib/esm/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js +10 -0
  121. package/lib/esm/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js.map +1 -0
  122. package/lib/esm/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.d.ts +3 -0
  123. package/lib/esm/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js +9 -0
  124. package/lib/esm/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js.map +1 -0
  125. package/lib/esm/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.d.ts +3 -0
  126. package/lib/esm/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js +10 -0
  127. package/lib/esm/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js.map +1 -0
  128. package/lib/esm/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.d.ts +9 -0
  129. package/lib/esm/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js +14 -0
  130. package/lib/esm/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js.map +1 -0
  131. package/lib/esm/components/Mappings/Extraction/ExtractionStatus.d.ts +17 -0
  132. package/lib/esm/components/Mappings/Extraction/ExtractionStatus.js +52 -0
  133. package/lib/esm/components/Mappings/Extraction/ExtractionStatus.js.map +1 -0
  134. package/lib/esm/components/Mappings/Extraction/ExtractionStatus.scss +40 -0
  135. package/lib/esm/components/Mappings/Import/SelectIModel.js +1 -2
  136. package/lib/esm/components/Mappings/Import/SelectIModel.js.map +1 -1
  137. package/lib/esm/components/Mappings/MappingListItem.d.ts +20 -0
  138. package/lib/esm/components/Mappings/MappingListItem.js +69 -0
  139. package/lib/esm/components/Mappings/MappingListItem.js.map +1 -0
  140. package/lib/esm/components/Mappings/MappingListItem.scss +25 -0
  141. package/lib/esm/components/Mappings/MappingsView.d.ts +2 -0
  142. package/lib/esm/components/Mappings/MappingsView.js +30 -6
  143. package/lib/esm/components/Mappings/MappingsView.js.map +1 -1
  144. package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.d.ts +3 -1
  145. package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.js +7 -4
  146. package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.js.map +1 -1
  147. package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.d.ts +20 -0
  148. package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.js +49 -0
  149. package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.js.map +1 -0
  150. package/lib/esm/components/Mappings/hooks/useMappingsOperations.d.ts +8 -0
  151. package/lib/esm/components/Mappings/hooks/useMappingsOperations.js +30 -6
  152. package/lib/esm/components/Mappings/hooks/useMappingsOperations.js.map +1 -1
  153. package/lib/esm/components/Mappings/hooks/useRunExtraction.d.ts +14 -0
  154. package/lib/esm/components/Mappings/hooks/useRunExtraction.js +38 -0
  155. package/lib/esm/components/Mappings/hooks/useRunExtraction.js.map +1 -0
  156. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +17 -25
  157. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
  158. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +18 -25
  159. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
  160. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +35 -38
  161. package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +1 -1
  162. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js +29 -60
  163. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
  164. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js +37 -40
  165. package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js.map +1 -1
  166. package/lib/esm/components/Properties/GroupColorToggle.js +32 -28
  167. package/lib/esm/components/Properties/GroupColorToggle.js.map +1 -1
  168. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js +63 -168
  169. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
  170. package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.scss +1 -46
  171. package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js +34 -37
  172. package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
  173. package/lib/esm/components/Properties/GroupProperties/GroupPropertyUtils.js +65 -51
  174. package/lib/esm/components/Properties/GroupProperties/GroupPropertyUtils.js.map +1 -1
  175. package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.d.ts +12 -0
  176. package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js +117 -0
  177. package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js.map +1 -0
  178. package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.scss +49 -0
  179. package/lib/esm/components/Properties/PropertyMenu.js +12 -16
  180. package/lib/esm/components/Properties/PropertyMenu.js.map +1 -1
  181. package/lib/esm/components/Properties/PropertyTable.js +1 -1
  182. package/lib/esm/components/Properties/PropertyTable.js.map +1 -1
  183. package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.d.ts +4 -0
  184. package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.js +8 -0
  185. package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.js.map +1 -0
  186. package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.d.ts +4 -0
  187. package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.js +8 -0
  188. package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.js.map +1 -0
  189. package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.d.ts +4 -0
  190. package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.js +8 -0
  191. package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.js.map +1 -0
  192. package/lib/esm/components/SharedComponents/DeleteModal.d.ts +1 -2
  193. package/lib/esm/components/SharedComponents/DeleteModal.js +1 -2
  194. package/lib/esm/components/SharedComponents/DeleteModal.js.map +1 -1
  195. package/lib/esm/components/context/ExtractionStateJobContext.d.ts +8 -0
  196. package/lib/esm/components/context/ExtractionStateJobContext.js +17 -0
  197. package/lib/esm/components/context/ExtractionStateJobContext.js.map +1 -0
  198. package/lib/esm/components/context/PropertiesGroupColorContext.d.ts +8 -0
  199. package/lib/esm/components/context/{PropertiesContext.js → PropertiesGroupColorContext.js} +5 -8
  200. package/lib/esm/components/context/PropertiesGroupColorContext.js.map +1 -0
  201. package/package.json +3 -2
  202. package/lib/cjs/components/Properties/hooks/useFetchData.d.ts +0 -7
  203. package/lib/cjs/components/Properties/hooks/useFetchData.js +0 -43
  204. package/lib/cjs/components/Properties/hooks/useFetchData.js.map +0 -1
  205. package/lib/cjs/components/context/PropertiesContext.d.ts +0 -15
  206. package/lib/cjs/components/context/PropertiesContext.js.map +0 -1
  207. package/lib/esm/components/Properties/hooks/useFetchData.d.ts +0 -7
  208. package/lib/esm/components/Properties/hooks/useFetchData.js +0 -37
  209. package/lib/esm/components/Properties/hooks/useFetchData.js.map +0 -1
  210. package/lib/esm/components/context/PropertiesContext.d.ts +0 -15
  211. package/lib/esm/components/context/PropertiesContext.js.map +0 -1
@@ -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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,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,k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AAE,EAAE,SAAS;YACb,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;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,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,IAAA,mCAAgB,EAAC,QAAQ,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;IACnH,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,EAAE;QAC5E,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,SAAS,CAAC,EAAE,WAAW,IAAI,EAAE,CAAC;IACjF,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,cAAc,GAAG,IAAA,e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,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,KAAhB,wBAAgB,QAO3B;AAOM,MAAM,gBAAgB,GAAG,CAAC,EAC/B,KAAK,EACL,oBAAoB,GACE,EAAE,EAAE;IAC1B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IAEvD,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,oBAAoB,EAAE,CAAC;QACvB,UAAU,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC,CAAC;IAEF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,KAAa,CAAC;QAClB,QAAQ,KAAK,EAAE;YACb,KAAK,gBAAgB,CAAC,SAAS,CAAC;YAChC,KAAK,gBAAgB,CAAC,MAAM;gBAC1B,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,iCAAqB,CAAC,CAAC;SAC5E;QACD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,QAAQ,KAAK,EAAE;QACb,KAAK,gBAAgB,CAAC,QAAQ;YAC5B,OAAO,CAAC,oBAAC,iDAAuB,OAAG,CAAC,CAAC;QACvC,KAAK,gBAAgB,CAAC,MAAM;YAC1B,OAAO,CAAC,oBAAC,6CAAqB,OAAG,CAAC,CAAC;QACrC,KAAK,gBAAgB,CAAC,OAAO;YAC3B,OAAO,CAAC,oBAAC,+CAAsB,OAAG,CAAC,CAAC;QACtC,KAAK,gBAAgB,CAAC,SAAS;YAC7B,OAAO,CAAC,oBAAC,iDAAuB,IAC9B,MAAM,EAAC,WAAW,EAClB,SAAS,EAAE,OAAO,EAClB,cAAc,EAAE,cAAc,GAC9B,CAAC,CAAC;QACN,KAAK,gBAAgB,CAAC,MAAM;YAC1B,OAAO,CAAC,oBAAC,iDAAuB,IAC9B,MAAM,EAAC,QAAQ,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
+ }
@@ -56,7 +56,6 @@ const SelectIModel = ({ iTwinId: iTwinId, onSelect, onCancel, backFn, displayStr
56
56
  const { data: iModels, isFetching: isLoading } = (0, react_query_1.useQuery)({
57
57
  queryKey: ["iModels", iTwinId],
58
58
  queryFn: async () => fetchIModels(getAccessToken, iTwinId, iModelsClient),
59
- initialData: [],
60
59
  });
61
60
  const displayStrings = react_1.default.useMemo(() => ({ ...defaultDisplayStrings, ...userDisplayStrings }), [userDisplayStrings]);
62
61
  const iModelsColumns = (0, react_1.useMemo)(() => [
@@ -76,7 +75,7 @@ const SelectIModel = ({ iTwinId: iTwinId, onSelect, onCancel, backFn, displayStr
76
75
  const pageSizeList = (0, react_1.useMemo)(() => [10, 25, 50], []);
77
76
  const paginator = (0, react_1.useCallback)((props) => (react_1.default.createElement(itwinui_react_1.TablePaginator, { ...props, pageSizeList: pageSizeList })), [pageSizeList]);
78
77
  return (react_1.default.createElement("div", { className: 'gmw-select-imodel-table-container' },
79
- react_1.default.createElement(itwinui_react_1.Table, { data: iModels, columns: iModelsColumns, className: 'gmw-select-imodel-table', emptyTableContent: `No ${displayStrings.iModels} available.`, isSortable: true, isLoading: isLoading, onRowClick: (_, row) => {
78
+ react_1.default.createElement(itwinui_react_1.Table, { data: iModels ?? [], columns: iModelsColumns, className: 'gmw-select-imodel-table', emptyTableContent: `No ${displayStrings.iModels} available.`, isSortable: true, isLoading: isLoading, onRowClick: (_, row) => {
80
79
  onSelect(row.original.id);
81
80
  }, paginatorRenderer: paginator }),
82
81
  react_1.default.createElement("div", { className: 'gmw-import-action-panel' },
@@ -1 +1 @@
1
- {"version":3,"file":"SelectIModel.js","sourceRoot":"","sources":["../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E,SAAS,EACpB,UAAU,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;gBACrB,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC5B,CAAC,EACD,iBAAiB,EAAE,SAAS,GAC5B;QACF,uCAAK,SAAS,EAAC,yBAAyB;YACtC,8BAAC,sBAAM,IAAC,OAAO,EAAE,MAAM,WAAe;YACtC,8BAAC,sBAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { IModel, IModelsClient } from \"@itwin/imodels-client-management\";\nimport type { TablePaginatorRendererProps } from \"@itwin/itwinui-react\";\nimport { Button, Table, tableFilters, TablePaginator } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useMemo } from \"react\";\nimport type { CreateTypeFromInterface } from \"../../../common/utils\";\nimport \"./SelectIModel.scss\";\nimport type { GetAccessTokenFn } from \"../../context/GroupingApiConfigContext\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useIModelsClient } from \"../../context/IModelsClientContext\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport type { Column } from \"react-table\";\nimport { AccessTokenAdapter } from \"@itwin/imodels-access-frontend\";\n\ntype IIModelTyped = CreateTypeFromInterface<IModel>;\n\nconst defaultDisplayStrings = {\n iModels: \"iModels\",\n iModelName: \"Name\",\n iModelDescription: \"Description\",\n};\n\nconst fetchIModels = async (\n getAccessToken: GetAccessTokenFn,\n iTwinId: string,\n iModelsClient: IModelsClient,\n) => {\n const accessToken = await getAccessToken();\n const authorization = AccessTokenAdapter.toAuthorizationCallback(accessToken);\n const iModelIterator = iModelsClient.iModels.getRepresentationList({\n authorization,\n urlParams: {\n iTwinId,\n },\n });\n\n const iModels = [];\n for await (const iModel of iModelIterator) {\n iModels.push(iModel);\n }\n return iModels;\n};\n\ninterface SelectIModelProps {\n iTwinId: string;\n onSelect: (iModelId: string) => void;\n onCancel: () => void;\n backFn: () => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\nconst SelectIModel = ({\n iTwinId: iTwinId,\n onSelect,\n onCancel,\n backFn,\n displayStrings: userDisplayStrings,\n}: SelectIModelProps) => {\n const { getAccessToken } = useGroupingMappingApiConfig();\n const iModelsClient = useIModelsClient();\n\n const { data: iModels, isFetching: isLoading } = useQuery({\n queryKey: [\"iModels\", iTwinId],\n queryFn: async () => fetchIModels(getAccessToken, iTwinId, iModelsClient),\n initialData: [],\n });\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n const iModelsColumns = useMemo<Column<IIModelTyped>[]>(\n () => [\n {\n id: \"iModelName\",\n Header: `${displayStrings.iModelName}`,\n accessor: \"name\",\n Filter: tableFilters.TextFilter(),\n },\n {\n id: \"iModelDescription\",\n Header: `${displayStrings.iModelDescription}`,\n accessor: \"description\",\n Filter: tableFilters.TextFilter(),\n },\n ],\n [displayStrings.iModelName, displayStrings.iModelDescription]\n );\n\n const pageSizeList = useMemo(() => [10, 25, 50], []);\n const paginator = useCallback(\n (props: TablePaginatorRendererProps) => (\n <TablePaginator {...props} pageSizeList={pageSizeList} />\n ),\n [pageSizeList]\n );\n\n return (\n <div className='gmw-select-imodel-table-container'>\n <Table<IIModelTyped>\n data={iModels}\n columns={iModelsColumns}\n className='gmw-select-imodel-table'\n emptyTableContent={`No ${displayStrings.iModels} available.`}\n isSortable\n isLoading={isLoading}\n onRowClick={(_, row) => {\n onSelect(row.original.id);\n }}\n paginatorRenderer={paginator}\n />\n <div className='gmw-import-action-panel'>\n <Button onClick={backFn}>Back</Button>\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n );\n};\n\nexport default SelectIModel;\n"]}
1
+ {"version":3,"file":"SelectIModel.js","sourceRoot":"","sources":["../../../../../src/components/Mappings/Import/SelectIModel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wDAAmF;AACnF,+CAAoD;AAEpD,+BAA6B;AAE7B,qFAAqF;AACrF,6EAAsE;AACtE,uDAAiD;AAEjD,4EAAoE;AAIpE,MAAM,qBAAqB,GAAG;IAC5B,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,MAAM;IAClB,iBAAiB,EAAE,aAAa;CACjC,CAAC;AAEF,MAAM,YAAY,GAAG,KAAK,EACxB,cAAgC,EAChC,OAAe,EACf,aAA4B,EAC5B,EAAE;IACF,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;IAC3C,MAAM,aAAa,GAAG,4CAAkB,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAC9E,MAAM,cAAc,GAAG,aAAa,CAAC,OAAO,CAAC,qBAAqB,CAAC;QACjE,aAAa;QACb,SAAS,EAAE;YACT,OAAO;SACR;KACF,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,cAAc,EAAE;QACzC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACtB;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AASF,MAAM,YAAY,GAAG,CAAC,EACpB,OAAO,EAAE,OAAO,EAChB,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,cAAc,EAAE,kBAAkB,GAChB,EAAE,EAAE;IACtB,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,sDAA2B,GAAE,CAAC;IACzD,MAAM,aAAa,GAAG,IAAA,uCAAgB,GAAE,CAAC;IAEzC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAA,sBAAQ,EAAC;QACxD,QAAQ,EAAE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,MAAM,cAAc,CAAC,OAAO,aAAa,EAC5D,UAAU,QACV,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;gBACrB,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC5B,CAAC,EACD,iBAAiB,EAAE,SAAS,GAC5B;QACF,uCAAK,SAAS,EAAC,yBAAyB;YACtC,8BAAC,sBAAM,IAAC,OAAO,EAAE,MAAM,WAAe;YACtC,8BAAC,sBAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { IModel, IModelsClient } from \"@itwin/imodels-client-management\";\nimport type { TablePaginatorRendererProps } from \"@itwin/itwinui-react\";\nimport { Button, Table, tableFilters, TablePaginator } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useMemo } from \"react\";\nimport type { CreateTypeFromInterface } from \"../../../common/utils\";\nimport \"./SelectIModel.scss\";\nimport type { GetAccessTokenFn } from \"../../context/GroupingApiConfigContext\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useIModelsClient } from \"../../context/IModelsClientContext\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport type { Column } from \"react-table\";\nimport { AccessTokenAdapter } from \"@itwin/imodels-access-frontend\";\n\ntype IIModelTyped = CreateTypeFromInterface<IModel>;\n\nconst defaultDisplayStrings = {\n iModels: \"iModels\",\n iModelName: \"Name\",\n iModelDescription: \"Description\",\n};\n\nconst fetchIModels = async (\n getAccessToken: GetAccessTokenFn,\n iTwinId: string,\n iModelsClient: IModelsClient,\n) => {\n const accessToken = await getAccessToken();\n const authorization = AccessTokenAdapter.toAuthorizationCallback(accessToken);\n const iModelIterator = iModelsClient.iModels.getRepresentationList({\n authorization,\n urlParams: {\n iTwinId,\n },\n });\n\n const iModels = [];\n for await (const iModel of iModelIterator) {\n iModels.push(iModel);\n }\n return iModels;\n};\n\ninterface SelectIModelProps {\n iTwinId: string;\n onSelect: (iModelId: string) => void;\n onCancel: () => void;\n backFn: () => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\nconst SelectIModel = ({\n iTwinId: iTwinId,\n onSelect,\n onCancel,\n backFn,\n displayStrings: userDisplayStrings,\n}: SelectIModelProps) => {\n const { getAccessToken } = useGroupingMappingApiConfig();\n const iModelsClient = useIModelsClient();\n\n const { data: iModels, isFetching: isLoading } = useQuery({\n queryKey: [\"iModels\", iTwinId],\n queryFn: async () => fetchIModels(getAccessToken, iTwinId, iModelsClient),\n });\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n const iModelsColumns = useMemo<Column<IIModelTyped>[]>(\n () => [\n {\n id: \"iModelName\",\n Header: `${displayStrings.iModelName}`,\n accessor: \"name\",\n Filter: tableFilters.TextFilter(),\n },\n {\n id: \"iModelDescription\",\n Header: `${displayStrings.iModelDescription}`,\n accessor: \"description\",\n Filter: tableFilters.TextFilter(),\n },\n ],\n [displayStrings.iModelName, displayStrings.iModelDescription]\n );\n\n const pageSizeList = useMemo(() => [10, 25, 50], []);\n const paginator = useCallback(\n (props: TablePaginatorRendererProps) => (\n <TablePaginator {...props} pageSizeList={pageSizeList} />\n ),\n [pageSizeList]\n );\n\n return (\n <div className='gmw-select-imodel-table-container'>\n <Table<IIModelTyped>\n data={iModels ?? []}\n columns={iModelsColumns}\n className='gmw-select-imodel-table'\n emptyTableContent={`No ${displayStrings.iModels} available.`}\n isSortable\n isLoading={isLoading}\n onRowClick={(_, row) => {\n onSelect(row.original.id);\n }}\n paginatorRenderer={paginator}\n />\n <div className='gmw-import-action-panel'>\n <Button onClick={backFn}>Back</Button>\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n );\n};\n\nexport default SelectIModel;\n"]}
@@ -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
+ onSelectionChange: (mapping: Mapping) => void;
8
+ mapping: Mapping;
9
+ jobId: string;
10
+ jobStartEvent: BeEvent<(mappingId: string) => 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