@flanksource/clicky-ui 0.3.83 → 0.3.85

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 (344) hide show
  1. package/dist/components/Combobox.cjs +8 -6
  2. package/dist/components/Combobox.cjs.map +1 -1
  3. package/dist/components/Combobox.d.ts.map +1 -1
  4. package/dist/components/Combobox.js +8 -6
  5. package/dist/components/Combobox.js.map +1 -1
  6. package/dist/components/ComboboxMenu.cjs +7 -4
  7. package/dist/components/ComboboxMenu.cjs.map +1 -1
  8. package/dist/components/ComboboxMenu.d.ts +3 -2
  9. package/dist/components/ComboboxMenu.d.ts.map +1 -1
  10. package/dist/components/ComboboxMenu.js +7 -4
  11. package/dist/components/ComboboxMenu.js.map +1 -1
  12. package/dist/components/DateField.cjs.map +1 -1
  13. package/dist/components/DateField.d.ts +3 -2
  14. package/dist/components/DateField.d.ts.map +1 -1
  15. package/dist/components/DateField.js.map +1 -1
  16. package/dist/components/DatePicker.cjs +9 -61
  17. package/dist/components/DatePicker.cjs.map +1 -1
  18. package/dist/components/DatePicker.d.ts +5 -19
  19. package/dist/components/DatePicker.d.ts.map +1 -1
  20. package/dist/components/DatePicker.js +11 -63
  21. package/dist/components/DatePicker.js.map +1 -1
  22. package/dist/components/DateTimePicker.cjs +9 -78
  23. package/dist/components/DateTimePicker.cjs.map +1 -1
  24. package/dist/components/DateTimePicker.d.ts +5 -19
  25. package/dist/components/DateTimePicker.d.ts.map +1 -1
  26. package/dist/components/DateTimePicker.js +11 -80
  27. package/dist/components/DateTimePicker.js.map +1 -1
  28. package/dist/components/FilterBar.cjs +64 -47
  29. package/dist/components/FilterBar.cjs.map +1 -1
  30. package/dist/components/FilterBar.d.ts +20 -2
  31. package/dist/components/FilterBar.d.ts.map +1 -1
  32. package/dist/components/FilterBar.js +63 -46
  33. package/dist/components/FilterBar.js.map +1 -1
  34. package/dist/components/TimeRange.cjs +156 -128
  35. package/dist/components/TimeRange.cjs.map +1 -1
  36. package/dist/components/TimeRange.d.ts +8 -1
  37. package/dist/components/TimeRange.d.ts.map +1 -1
  38. package/dist/components/TimeRange.js +156 -128
  39. package/dist/components/TimeRange.js.map +1 -1
  40. package/dist/components/calendar-grid.cjs +83 -0
  41. package/dist/components/calendar-grid.cjs.map +1 -0
  42. package/dist/components/calendar-grid.d.ts +9 -0
  43. package/dist/components/calendar-grid.d.ts.map +1 -0
  44. package/dist/components/calendar-grid.js +83 -0
  45. package/dist/components/calendar-grid.js.map +1 -0
  46. package/dist/components/combobox-types.d.ts +5 -0
  47. package/dist/components/combobox-types.d.ts.map +1 -1
  48. package/dist/components/date-input-field.cjs +88 -0
  49. package/dist/components/date-input-field.cjs.map +1 -0
  50. package/dist/components/date-input-field.d.ts +37 -0
  51. package/dist/components/date-input-field.d.ts.map +1 -0
  52. package/dist/components/date-input-field.js +88 -0
  53. package/dist/components/date-input-field.js.map +1 -0
  54. package/dist/components/date-math.cjs +67 -0
  55. package/dist/components/date-math.cjs.map +1 -0
  56. package/dist/components/date-math.d.ts +33 -0
  57. package/dist/components/date-math.d.ts.map +1 -0
  58. package/dist/components/date-math.js +60 -0
  59. package/dist/components/date-math.js.map +1 -0
  60. package/dist/components/date-picker-menu.cjs +129 -0
  61. package/dist/components/date-picker-menu.cjs.map +1 -0
  62. package/dist/components/date-picker-menu.d.ts +18 -0
  63. package/dist/components/date-picker-menu.d.ts.map +1 -0
  64. package/dist/components/date-picker-menu.js +129 -0
  65. package/dist/components/date-picker-menu.js.map +1 -0
  66. package/dist/components/filter-bar-context.cjs.map +1 -1
  67. package/dist/components/filter-bar-context.d.ts +2 -0
  68. package/dist/components/filter-bar-context.d.ts.map +1 -1
  69. package/dist/components/filter-bar-context.js.map +1 -1
  70. package/dist/components/filter-bar-field-utils.cjs +18 -4
  71. package/dist/components/filter-bar-field-utils.cjs.map +1 -1
  72. package/dist/components/filter-bar-field-utils.d.ts +3 -2
  73. package/dist/components/filter-bar-field-utils.d.ts.map +1 -1
  74. package/dist/components/filter-bar-field-utils.js +19 -5
  75. package/dist/components/filter-bar-field-utils.js.map +1 -1
  76. package/dist/components/filter-bar-menu.cjs +189 -0
  77. package/dist/components/filter-bar-menu.cjs.map +1 -0
  78. package/dist/components/filter-bar-menu.d.ts +25 -0
  79. package/dist/components/filter-bar-menu.d.ts.map +1 -0
  80. package/dist/components/filter-bar-menu.js +189 -0
  81. package/dist/components/filter-bar-menu.js.map +1 -0
  82. package/dist/components/filter-bar-multi.cjs +1 -1
  83. package/dist/components/filter-bar-multi.cjs.map +1 -1
  84. package/dist/components/filter-bar-multi.js +2 -2
  85. package/dist/components/filter-bar-multi.js.map +1 -1
  86. package/dist/components/filter-bar-popup.cjs +37 -0
  87. package/dist/components/filter-bar-popup.cjs.map +1 -0
  88. package/dist/components/filter-bar-popup.d.ts +32 -0
  89. package/dist/components/filter-bar-popup.d.ts.map +1 -0
  90. package/dist/components/filter-bar-popup.js +37 -0
  91. package/dist/components/filter-bar-popup.js.map +1 -0
  92. package/dist/components/filter-bar-tree.cjs +1 -1
  93. package/dist/components/filter-bar-tree.cjs.map +1 -1
  94. package/dist/components/filter-bar-tree.js +2 -2
  95. package/dist/components/filter-bar-tree.js.map +1 -1
  96. package/dist/components/json-schema-form-date-math.cjs +15 -11
  97. package/dist/components/json-schema-form-date-math.cjs.map +1 -1
  98. package/dist/components/json-schema-form-date-math.d.ts +3 -0
  99. package/dist/components/json-schema-form-date-math.d.ts.map +1 -1
  100. package/dist/components/json-schema-form-date-math.js +15 -12
  101. package/dist/components/json-schema-form-date-math.js.map +1 -1
  102. package/dist/components/json-schema-form-table-array.cjs +5 -3
  103. package/dist/components/json-schema-form-table-array.cjs.map +1 -1
  104. package/dist/components/json-schema-form-table-array.d.ts.map +1 -1
  105. package/dist/components/json-schema-form-table-array.js +5 -3
  106. package/dist/components/json-schema-form-table-array.js.map +1 -1
  107. package/dist/components.cjs +1 -1
  108. package/dist/components.d.ts +1 -0
  109. package/dist/components.d.ts.map +1 -1
  110. package/dist/components.js +1 -1
  111. package/dist/connections/ConnectionPicker.cjs +6 -2
  112. package/dist/connections/ConnectionPicker.cjs.map +1 -1
  113. package/dist/connections/ConnectionPicker.d.ts.map +1 -1
  114. package/dist/connections/ConnectionPicker.js +6 -2
  115. package/dist/connections/ConnectionPicker.js.map +1 -1
  116. package/dist/connections/CreateConnectionDialog.cjs +8 -21
  117. package/dist/connections/CreateConnectionDialog.cjs.map +1 -1
  118. package/dist/connections/CreateConnectionDialog.d.ts +2 -1
  119. package/dist/connections/CreateConnectionDialog.d.ts.map +1 -1
  120. package/dist/connections/CreateConnectionDialog.js +8 -21
  121. package/dist/connections/CreateConnectionDialog.js.map +1 -1
  122. package/dist/data/ExpandableMarkdown.cjs +59 -0
  123. package/dist/data/ExpandableMarkdown.cjs.map +1 -0
  124. package/dist/data/ExpandableMarkdown.d.ts +17 -0
  125. package/dist/data/ExpandableMarkdown.d.ts.map +1 -0
  126. package/dist/data/ExpandableMarkdown.js +59 -0
  127. package/dist/data/ExpandableMarkdown.js.map +1 -0
  128. package/dist/data/MultiGaugeBar.cjs +49 -21
  129. package/dist/data/MultiGaugeBar.cjs.map +1 -1
  130. package/dist/data/MultiGaugeBar.d.ts +5 -2
  131. package/dist/data/MultiGaugeBar.d.ts.map +1 -1
  132. package/dist/data/MultiGaugeBar.js +49 -21
  133. package/dist/data/MultiGaugeBar.js.map +1 -1
  134. package/dist/data/PromptDialog.cjs +19 -5
  135. package/dist/data/PromptDialog.cjs.map +1 -1
  136. package/dist/data/PromptDialog.d.ts +15 -1
  137. package/dist/data/PromptDialog.d.ts.map +1 -1
  138. package/dist/data/PromptDialog.js +19 -5
  139. package/dist/data/PromptDialog.js.map +1 -1
  140. package/dist/data/PromptIndicator.cjs +3 -2
  141. package/dist/data/PromptIndicator.cjs.map +1 -1
  142. package/dist/data/PromptIndicator.d.ts +4 -1
  143. package/dist/data/PromptIndicator.d.ts.map +1 -1
  144. package/dist/data/PromptIndicator.js +3 -2
  145. package/dist/data/PromptIndicator.js.map +1 -1
  146. package/dist/data/diagnostics/ErrorDetails.cjs +155 -110
  147. package/dist/data/diagnostics/ErrorDetails.cjs.map +1 -1
  148. package/dist/data/diagnostics/ErrorDetails.d.ts.map +1 -1
  149. package/dist/data/diagnostics/ErrorDetails.js +155 -110
  150. package/dist/data/diagnostics/ErrorDetails.js.map +1 -1
  151. package/dist/data/flow-node/BoxNode.cjs +45 -0
  152. package/dist/data/flow-node/BoxNode.cjs.map +1 -0
  153. package/dist/data/flow-node/BoxNode.d.ts +28 -0
  154. package/dist/data/flow-node/BoxNode.d.ts.map +1 -0
  155. package/dist/data/flow-node/BoxNode.js +45 -0
  156. package/dist/data/flow-node/BoxNode.js.map +1 -0
  157. package/dist/data/flow-node/FlowMetrics.cjs +208 -0
  158. package/dist/data/flow-node/FlowMetrics.cjs.map +1 -0
  159. package/dist/data/flow-node/FlowMetrics.d.ts +60 -0
  160. package/dist/data/flow-node/FlowMetrics.d.ts.map +1 -0
  161. package/dist/data/flow-node/FlowMetrics.js +206 -0
  162. package/dist/data/flow-node/FlowMetrics.js.map +1 -0
  163. package/dist/data/flow-node/WorkloadNode.cjs +63 -0
  164. package/dist/data/flow-node/WorkloadNode.cjs.map +1 -0
  165. package/dist/data/flow-node/WorkloadNode.d.ts +42 -0
  166. package/dist/data/flow-node/WorkloadNode.d.ts.map +1 -0
  167. package/dist/data/flow-node/WorkloadNode.js +63 -0
  168. package/dist/data/flow-node/WorkloadNode.js.map +1 -0
  169. package/dist/data/flow-node/index.d.ts +5 -0
  170. package/dist/data/flow-node/index.d.ts.map +1 -0
  171. package/dist/data/flow-node/latency.cjs +37 -0
  172. package/dist/data/flow-node/latency.cjs.map +1 -0
  173. package/dist/data/flow-node/latency.d.ts +13 -0
  174. package/dist/data/flow-node/latency.d.ts.map +1 -0
  175. package/dist/data/flow-node/latency.js +35 -0
  176. package/dist/data/flow-node/latency.js.map +1 -0
  177. package/dist/data/test-runner/TestDetailPanel.cjs +109 -46
  178. package/dist/data/test-runner/TestDetailPanel.cjs.map +1 -1
  179. package/dist/data/test-runner/TestDetailPanel.d.ts.map +1 -1
  180. package/dist/data/test-runner/TestDetailPanel.js +110 -47
  181. package/dist/data/test-runner/TestDetailPanel.js.map +1 -1
  182. package/dist/data/test-runner/TestTreeNode.cjs +84 -63
  183. package/dist/data/test-runner/TestTreeNode.cjs.map +1 -1
  184. package/dist/data/test-runner/TestTreeNode.d.ts.map +1 -1
  185. package/dist/data/test-runner/TestTreeNode.js +84 -63
  186. package/dist/data/test-runner/TestTreeNode.js.map +1 -1
  187. package/dist/data/test-runner/adapter.cjs.map +1 -1
  188. package/dist/data/test-runner/adapter.d.ts +2 -2
  189. package/dist/data/test-runner/adapter.d.ts.map +1 -1
  190. package/dist/data/test-runner/adapter.js.map +1 -1
  191. package/dist/data/test-runner/copy.cjs +62 -10
  192. package/dist/data/test-runner/copy.cjs.map +1 -1
  193. package/dist/data/test-runner/copy.d.ts +52 -9
  194. package/dist/data/test-runner/copy.d.ts.map +1 -1
  195. package/dist/data/test-runner/copy.js +60 -11
  196. package/dist/data/test-runner/copy.js.map +1 -1
  197. package/dist/data/test-runner/index.d.ts +1 -1
  198. package/dist/data/test-runner/index.d.ts.map +1 -1
  199. package/dist/data/traces/index.d.ts +1 -0
  200. package/dist/data/traces/index.d.ts.map +1 -1
  201. package/dist/data/traces/otel/OtelTraceDetail.cjs +4 -7
  202. package/dist/data/traces/otel/OtelTraceDetail.cjs.map +1 -1
  203. package/dist/data/traces/otel/OtelTraceDetail.js +4 -7
  204. package/dist/data/traces/otel/OtelTraceDetail.js.map +1 -1
  205. package/dist/data/traces/otel/OtelTraceSearch.cjs +90 -56
  206. package/dist/data/traces/otel/OtelTraceSearch.cjs.map +1 -1
  207. package/dist/data/traces/otel/OtelTraceSearch.d.ts.map +1 -1
  208. package/dist/data/traces/otel/OtelTraceSearch.js +91 -57
  209. package/dist/data/traces/otel/OtelTraceSearch.js.map +1 -1
  210. package/dist/data/traces/otel/QueryBar.cjs +83 -10
  211. package/dist/data/traces/otel/QueryBar.cjs.map +1 -1
  212. package/dist/data/traces/otel/QueryBar.d.ts.map +1 -1
  213. package/dist/data/traces/otel/QueryBar.js +83 -10
  214. package/dist/data/traces/otel/QueryBar.js.map +1 -1
  215. package/dist/data/traces/otel/TraceResults.cjs +81 -13
  216. package/dist/data/traces/otel/TraceResults.cjs.map +1 -1
  217. package/dist/data/traces/otel/TraceResults.d.ts +11 -3
  218. package/dist/data/traces/otel/TraceResults.d.ts.map +1 -1
  219. package/dist/data/traces/otel/TraceResults.js +81 -13
  220. package/dist/data/traces/otel/TraceResults.js.map +1 -1
  221. package/dist/data/traces/otel/api.cjs.map +1 -1
  222. package/dist/data/traces/otel/api.d.ts +14 -0
  223. package/dist/data/traces/otel/api.d.ts.map +1 -1
  224. package/dist/data/traces/otel/api.js.map +1 -1
  225. package/dist/data/traces/otel/query.cjs +2 -2
  226. package/dist/data/traces/otel/query.cjs.map +1 -1
  227. package/dist/data/traces/otel/query.d.ts +1 -1
  228. package/dist/data/traces/otel/query.d.ts.map +1 -1
  229. package/dist/data/traces/otel/query.js +2 -2
  230. package/dist/data/traces/otel/query.js.map +1 -1
  231. package/dist/data/verification/StepFilesView.cjs +90 -0
  232. package/dist/data/verification/StepFilesView.cjs.map +1 -0
  233. package/dist/data/verification/StepFilesView.d.ts +9 -0
  234. package/dist/data/verification/StepFilesView.d.ts.map +1 -0
  235. package/dist/data/verification/StepFilesView.js +90 -0
  236. package/dist/data/verification/StepFilesView.js.map +1 -0
  237. package/dist/data/verification/adapterViews.cjs +129 -69
  238. package/dist/data/verification/adapterViews.cjs.map +1 -1
  239. package/dist/data/verification/adapterViews.d.ts +3 -1
  240. package/dist/data/verification/adapterViews.d.ts.map +1 -1
  241. package/dist/data/verification/adapterViews.js +130 -70
  242. package/dist/data/verification/adapterViews.js.map +1 -1
  243. package/dist/data/verification/adapters.cjs +9 -0
  244. package/dist/data/verification/adapters.cjs.map +1 -1
  245. package/dist/data/verification/adapters.d.ts +2 -0
  246. package/dist/data/verification/adapters.d.ts.map +1 -1
  247. package/dist/data/verification/adapters.js +11 -2
  248. package/dist/data/verification/adapters.js.map +1 -1
  249. package/dist/data/verification/index.d.ts +2 -1
  250. package/dist/data/verification/index.d.ts.map +1 -1
  251. package/dist/data/verification/stepKind.cjs +63 -7
  252. package/dist/data/verification/stepKind.cjs.map +1 -1
  253. package/dist/data/verification/stepKind.d.ts +55 -6
  254. package/dist/data/verification/stepKind.d.ts.map +1 -1
  255. package/dist/data/verification/stepKind.js +62 -8
  256. package/dist/data/verification/stepKind.js.map +1 -1
  257. package/dist/data/verification/stepKindViews.cjs +318 -106
  258. package/dist/data/verification/stepKindViews.cjs.map +1 -1
  259. package/dist/data/verification/stepKindViews.d.ts +17 -6
  260. package/dist/data/verification/stepKindViews.d.ts.map +1 -1
  261. package/dist/data/verification/stepKindViews.js +319 -108
  262. package/dist/data/verification/stepKindViews.js.map +1 -1
  263. package/dist/data/version-info.cjs +3 -3
  264. package/dist/data/version-info.cjs.map +1 -1
  265. package/dist/data/version-info.js +3 -3
  266. package/dist/data/version-info.js.map +1 -1
  267. package/dist/data/workload-panel/MemoryStack.cjs +38 -1
  268. package/dist/data/workload-panel/MemoryStack.cjs.map +1 -1
  269. package/dist/data/workload-panel/MemoryStack.d.ts.map +1 -1
  270. package/dist/data/workload-panel/MemoryStack.js +38 -1
  271. package/dist/data/workload-panel/MemoryStack.js.map +1 -1
  272. package/dist/data.cjs +22 -1
  273. package/dist/data.d.ts +3 -1
  274. package/dist/data.d.ts.map +1 -1
  275. package/dist/data.js +10 -3
  276. package/dist/file-findings/AnnotatedCode.cjs +18 -2
  277. package/dist/file-findings/AnnotatedCode.cjs.map +1 -1
  278. package/dist/file-findings/AnnotatedCode.d.ts +2 -0
  279. package/dist/file-findings/AnnotatedCode.d.ts.map +1 -1
  280. package/dist/file-findings/AnnotatedCode.js +18 -2
  281. package/dist/file-findings/AnnotatedCode.js.map +1 -1
  282. package/dist/file-findings/FileFindingsView.cjs.map +1 -1
  283. package/dist/file-findings/FileFindingsView.d.ts +2 -0
  284. package/dist/file-findings/FileFindingsView.d.ts.map +1 -1
  285. package/dist/file-findings/FileFindingsView.js.map +1 -1
  286. package/dist/file-findings/file-review/FileReview.cjs +2 -1
  287. package/dist/file-findings/file-review/FileReview.cjs.map +1 -1
  288. package/dist/file-findings/file-review/FileReview.d.ts +3 -1
  289. package/dist/file-findings/file-review/FileReview.d.ts.map +1 -1
  290. package/dist/file-findings/file-review/FileReview.js +2 -1
  291. package/dist/file-findings/file-review/FileReview.js.map +1 -1
  292. package/dist/hooks/use-prompts.cjs +52 -30
  293. package/dist/hooks/use-prompts.cjs.map +1 -1
  294. package/dist/hooks/use-prompts.d.ts +6 -0
  295. package/dist/hooks/use-prompts.d.ts.map +1 -1
  296. package/dist/hooks/use-prompts.js +52 -30
  297. package/dist/hooks/use-prompts.js.map +1 -1
  298. package/dist/index.cjs +23 -2
  299. package/dist/index.js +11 -4
  300. package/dist/profiles/editor/profileEditor.cjs +29 -30
  301. package/dist/profiles/editor/profileEditor.cjs.map +1 -1
  302. package/dist/profiles/editor/profileEditor.d.ts.map +1 -1
  303. package/dist/profiles/editor/profileEditor.js +29 -30
  304. package/dist/profiles/editor/profileEditor.js.map +1 -1
  305. package/dist/profiles/editor/profileEditorPreview.cjs +44 -43
  306. package/dist/profiles/editor/profileEditorPreview.cjs.map +1 -1
  307. package/dist/profiles/editor/profileEditorPreview.d.ts +10 -5
  308. package/dist/profiles/editor/profileEditorPreview.d.ts.map +1 -1
  309. package/dist/profiles/editor/profileEditorPreview.js +44 -43
  310. package/dist/profiles/editor/profileEditorPreview.js.map +1 -1
  311. package/dist/profiles/editor/profileMappingPreview.cjs +153 -48
  312. package/dist/profiles/editor/profileMappingPreview.cjs.map +1 -1
  313. package/dist/profiles/editor/profileMappingPreview.d.ts +16 -2
  314. package/dist/profiles/editor/profileMappingPreview.d.ts.map +1 -1
  315. package/dist/profiles/editor/profileMappingPreview.js +155 -50
  316. package/dist/profiles/editor/profileMappingPreview.js.map +1 -1
  317. package/dist/profiles/editor/sampleError.cjs +29 -0
  318. package/dist/profiles/editor/sampleError.cjs.map +1 -0
  319. package/dist/profiles/editor/sampleError.d.ts +16 -0
  320. package/dist/profiles/editor/sampleError.d.ts.map +1 -0
  321. package/dist/profiles/editor/sampleError.js +27 -0
  322. package/dist/profiles/editor/sampleError.js.map +1 -0
  323. package/dist/profiles/query/profileSampleResult.cjs.map +1 -1
  324. package/dist/profiles/query/profileSampleResult.d.ts +2 -0
  325. package/dist/profiles/query/profileSampleResult.d.ts.map +1 -1
  326. package/dist/profiles/query/profileSampleResult.js.map +1 -1
  327. package/dist/profiles/wizard/profileWizardQueryStep.cjs +1 -0
  328. package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
  329. package/dist/profiles/wizard/profileWizardQueryStep.d.ts +2 -0
  330. package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
  331. package/dist/profiles/wizard/profileWizardQueryStep.js +1 -0
  332. package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
  333. package/dist/react-grab/core/index.js +1 -1
  334. package/dist/react-grab/{core-BERtFDWh.js → core-BK5CU6Lb.js} +2 -2
  335. package/dist/react-grab/index.js +1 -1
  336. package/dist/react-grab/{renderer-KT3FY3K2.js → renderer-DcHrsQ8k.js} +1 -1
  337. package/dist/rpc/apiClient.cjs +12 -15
  338. package/dist/rpc/apiClient.cjs.map +1 -1
  339. package/dist/rpc/apiClient.js +12 -15
  340. package/dist/rpc/apiClient.js.map +1 -1
  341. package/dist/runtime/barrels.json +6507 -6460
  342. package/dist/runtime/importmap.json +2198 -2185
  343. package/dist/styles.css +1 -1
  344. package/package.json +1 -1
@@ -8,30 +8,16 @@ import { useCallback, useEffect, useRef, useState } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  // src/profiles/editor/profileEditorPreview.tsx
10
10
  var NO_FILTERS = {};
11
- /**
12
- * The draft's results as the saved profile's page will show them, so the effect
13
- * of including a field, relabelling it, typing it or hiding it is visible
14
- * without leaving the editor.
15
- *
16
- * The rows are the sample's source rows, not a client-side projection of them:
17
- * the profile service maps them through the draft's columns and renders the same
18
- * clicky document it serves the saved profile's results page, which this shows
19
- * with the same Clicky component — a key_values column is tag pills, a datetime
20
- * is a timestamp, a duration is a duration. Rows only exist after a sample runs —
21
- * there is no placeholder data, because a fabricated preview is worse than none.
22
- *
23
- * The filter bar offers the filters the draft's columns declare. Filtering is
24
- * the backend's, so applying one samples again with it; the rows are never
25
- * filtered in the browser.
26
- */
27
- function ProfileEditorPreview({ columns, rows, profile, stale = false, onNormalized }) {
11
+ function ProfileEditorPreview({ columns, rows, sampleId, profile, stale = false, ...callbacks }) {
12
+ const { onNormalized, ...tableCallbacks } = callbacks;
28
13
  if (stale) return /* @__PURE__ */ jsx("p", {
29
14
  role: "status",
30
15
  children: "Source or query settings changed. Run a new sample to refresh the mapping preview."
31
16
  });
32
17
  if (profile.render === "traces") return /* @__PURE__ */ jsx(ProfileMappingPreview, {
33
18
  profile,
34
- rows,
19
+ sampleId,
20
+ ...tableCallbacks,
35
21
  ...onNormalized ? { onNormalized } : {}
36
22
  });
37
23
  const included = columns.some((column) => !column.hidden);
@@ -41,16 +27,18 @@ function ProfileEditorPreview({ columns, rows, profile, stale = false, onNormali
41
27
  });
42
28
  return /* @__PURE__ */ jsx(FilterableTablePreview, {
43
29
  profile,
44
- rows
30
+ sampleId,
31
+ ...tableCallbacks
45
32
  });
46
33
  }
47
- function FilterableTablePreview({ profile, rows }) {
34
+ function FilterableTablePreview({ profile, sampleId, onSampleExpired, ...callbacks }) {
48
35
  const [selection, setSelection] = useState(NO_FILTERS);
49
36
  const filtered = useFilteredSample({
50
37
  profile,
51
38
  selection
52
39
  });
53
- useEffect(() => setSelection(NO_FILTERS), [rows]);
40
+ useEffect(() => setSelection(NO_FILTERS), [sampleId]);
41
+ const expired = filtered.sampleId ? filtered.refresh : onSampleExpired;
54
42
  const lookupValues = useCallback((request) => lookupProfileSampleFilterValues({
55
43
  draft: profile,
56
44
  params: {},
@@ -65,27 +53,38 @@ function FilterableTablePreview({ profile, rows }) {
65
53
  children: [filtered.error ? /* @__PURE__ */ jsxs("p", {
66
54
  role: "alert",
67
55
  className: "shrink-0 px-3 py-1 text-xs text-destructive",
68
- children: ["Cannot apply the filter to the sample: ", filtered.error]
56
+ children: [
57
+ "Cannot apply the filter to the sample: ",
58
+ filtered.error,
59
+ ". The rows below are from before this filter."
60
+ ]
69
61
  }) : null, /* @__PURE__ */ jsx(ProfileMappingPreview, {
70
62
  profile,
71
- rows: filtered.error ? [] : filtered.rows ?? rows,
63
+ sampleId: filtered.sampleId ?? sampleId,
64
+ stale: Boolean(filtered.error),
72
65
  filters: {
73
66
  selection,
74
67
  onChange: setSelection,
75
68
  lookupValues
76
- }
69
+ },
70
+ ...callbacks,
71
+ ...expired ? { onSampleExpired: expired } : {}
77
72
  })]
78
73
  });
79
74
  }
80
75
  /**
81
- * The sample's source rows for a draft with `selection` applied by the backend,
82
- * or null rows while nothing is selected (the unfiltered sample stands).
76
+ * The retained sample for a draft with `selection` applied by the backend, or
77
+ * a null id while nothing is selected (the unfiltered sample stands). A failed
78
+ * filter keeps the sample it had, so the preview can still offer the filter bar
79
+ * that changes it.
83
80
  */
84
81
  function useFilteredSample({ profile, selection }) {
85
82
  const [state, setState] = useState({
86
- rows: null,
83
+ sampleId: null,
87
84
  error: ""
88
85
  });
86
+ const [attempt, setAttempt] = useState(0);
87
+ const refresh = useCallback(() => setAttempt((count) => count + 1), []);
89
88
  const active = Object.keys(selection).length > 0;
90
89
  const selectionKey = JSON.stringify(selection);
91
90
  const draft = useRef(profile);
@@ -93,17 +92,18 @@ function useFilteredSample({ profile, selection }) {
93
92
  useEffect(() => {
94
93
  if (!active) {
95
94
  setState({
96
- rows: null,
95
+ sampleId: null,
97
96
  error: ""
98
97
  });
99
98
  return;
100
99
  }
100
+ const failed = (error) => setState((previous) => ({
101
+ ...previous,
102
+ error
103
+ }));
101
104
  const sampled = sampleRequestProfile(draft.current);
102
105
  if (!sampled) {
103
- setState({
104
- rows: [],
105
- error: "the draft has no provider to sample"
106
- });
106
+ failed("the draft has no provider to sample");
107
107
  return;
108
108
  }
109
109
  let current = true;
@@ -126,25 +126,26 @@ function useFilteredSample({ profile, selection }) {
126
126
  })
127
127
  }).then((response) => {
128
128
  if (!current) return;
129
- if (!response.mappingInputRows) return setState({
130
- rows: [],
131
- error: "the sample response is missing mappingInputRows"
132
- });
129
+ if (!response.sampleId) return failed("the sample response is missing sampleId");
133
130
  setState({
134
- rows: response.mappingInputRows,
131
+ sampleId: response.sampleId,
135
132
  error: ""
136
133
  });
137
134
  }, (error) => {
138
- if (current) setState({
139
- rows: [],
140
- error: error instanceof Error ? error.message : String(error)
141
- });
135
+ if (current) failed(error instanceof Error ? error.message : String(error));
142
136
  });
143
137
  return () => {
144
138
  current = false;
145
139
  };
146
- }, [active, selectionKey]);
147
- return state;
140
+ }, [
141
+ active,
142
+ selectionKey,
143
+ attempt
144
+ ]);
145
+ return {
146
+ ...state,
147
+ refresh
148
+ };
148
149
  }
149
150
  export { ProfileEditorPreview };
150
151
 
@@ -1 +1 @@
1
- {"version":3,"file":"profileEditorPreview.js","names":[],"sources":["../../../src/profiles/editor/profileEditorPreview.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { DataTableFilterSelection } from \"../../data/data-table-filter-values\";\nimport type { DataTableFilterLookup } from \"../../data/data-table-server-filters\";\nimport { debugCaptureHeaders } from \"../../data/debugConsoleSignal\";\nimport { fetchJSON } from \"../connections/connectionBrowserModel\";\nimport { profileApiPath } from \"../profileApi\";\nimport { lookupProfileSampleFilterValues } from \"../query/profileSampleFilterLookup\";\nimport { sampleRequestProfile } from \"../query/jsonPathSample\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport type { ProfileWizardDraft } from \"../wizard/profileWizardModel\";\nimport { ProfileMappingPreview } from \"./profileMappingPreview\";\n\nconst NO_FILTERS: DataTableFilterSelection = {};\n\n/**\n * The draft's results as the saved profile's page will show them, so the effect\n * of including a field, relabelling it, typing it or hiding it is visible\n * without leaving the editor.\n *\n * The rows are the sample's source rows, not a client-side projection of them:\n * the profile service maps them through the draft's columns and renders the same\n * clicky document it serves the saved profile's results page, which this shows\n * with the same Clicky component — a key_values column is tag pills, a datetime\n * is a timestamp, a duration is a duration. Rows only exist after a sample runs —\n * there is no placeholder data, because a fabricated preview is worse than none.\n *\n * The filter bar offers the filters the draft's columns declare. Filtering is\n * the backend's, so applying one samples again with it; the rows are never\n * filtered in the browser.\n */\nexport function ProfileEditorPreview({\n columns,\n rows,\n profile,\n stale = false,\n onNormalized,\n}: {\n columns: ProfileColumn[];\n /** The sample's source rows, ahead of the draft's column mapping. */\n rows: Record<string, unknown>[];\n /** The draft being edited: its columns, aliases and filters are what the rows are mapped through. */\n profile: ProfileWizardDraft;\n stale?: boolean;\n /** Receives the span-normalised rows and columns of a traces profile. */\n onNormalized?: (rows: Record<string, unknown>[], columns: ProfileColumn[]) => void;\n}) {\n if (stale)\n return (\n <p role=\"status\">\n Source or query settings changed. Run a new sample to refresh the\n mapping preview.\n </p>\n );\n if (profile.render === \"traces\")\n return <ProfileMappingPreview profile={profile} rows={rows} {...(onNormalized ? {onNormalized} : {})} />;\n\n const included = columns.some((column) => !column.hidden);\n if (rows.length === 0 || !included) {\n return (\n <p className=\"grid h-full place-items-center px-6 text-center text-xs text-muted-foreground\">\n {included ? \"Run a sample in Query to preview rows.\" : \"No columns included yet.\"}\n </p>\n );\n }\n return <FilterableTablePreview profile={profile} rows={rows} />;\n}\n\nfunction FilterableTablePreview({\n profile,\n rows,\n}: {\n profile: ProfileWizardDraft;\n rows: Record<string, unknown>[];\n}) {\n const [selection, setSelection] = useState(NO_FILTERS);\n const filtered = useFilteredSample({ profile, selection });\n // A new sample starts from no filters: the filtered rows belong to the old one.\n useEffect(() => setSelection(NO_FILTERS), [rows]);\n\n const lookupValues = useCallback<DataTableFilterLookup>(\n (request) =>\n lookupProfileSampleFilterValues({\n draft: profile,\n params: {},\n filterColumns: profile.columns ?? [],\n request: { ...request, filters: selection },\n }),\n [profile, selection],\n );\n\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {filtered.error ? (\n <p role=\"alert\" className=\"shrink-0 px-3 py-1 text-xs text-destructive\">\n Cannot apply the filter to the sample: {filtered.error}\n </p>\n ) : null}\n <ProfileMappingPreview\n profile={profile}\n rows={filtered.error ? [] : (filtered.rows ?? rows)}\n filters={{ selection, onChange: setSelection, lookupValues }}\n />\n </div>\n );\n}\n\n/**\n * The sample's source rows for a draft with `selection` applied by the backend,\n * or null rows while nothing is selected (the unfiltered sample stands).\n */\nfunction useFilteredSample({\n profile,\n selection,\n}: {\n profile: ProfileWizardDraft;\n selection: DataTableFilterSelection;\n}): { rows: Record<string, unknown>[] | null; error: string } {\n const [state, setState] = useState<{ rows: Record<string, unknown>[] | null; error: string }>({\n rows: null,\n error: \"\",\n });\n const active = Object.keys(selection).length > 0;\n const selectionKey = JSON.stringify(selection);\n // The draft's columns are edited without sampling again: only a changed\n // selection queries the backend, with the draft as it stands then.\n const draft = useRef(profile);\n draft.current = profile;\n\n useEffect(() => {\n if (!active) {\n setState({ rows: null, error: \"\" });\n return;\n }\n const sampled = sampleRequestProfile(draft.current);\n if (!sampled) {\n setState({ rows: [], error: \"the draft has no provider to sample\" });\n return;\n }\n let current = true;\n setState((previous) => ({ ...previous, error: \"\" }));\n fetchJSON<{ mappingInputRows?: Record<string, unknown>[] }>(profileApiPath(\"profile/sample\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...debugCaptureHeaders() },\n body: JSON.stringify({\n profile: sampled,\n params: {},\n previewProcessors: true,\n // The sample request leaves the draft's columns out, so the columns that\n // bind each filter key to a field travel beside the selection.\n filterColumns: draft.current.columns ?? [],\n filters: JSON.parse(selectionKey) as DataTableFilterSelection,\n }),\n }).then(\n (response) => {\n if (!current) return;\n if (!response.mappingInputRows)\n return setState({ rows: [], error: \"the sample response is missing mappingInputRows\" });\n setState({ rows: response.mappingInputRows, error: \"\" });\n },\n (error: unknown) => {\n if (current) setState({ rows: [], error: error instanceof Error ? error.message : String(error) });\n },\n );\n return () => {\n current = false;\n };\n }, [active, selectionKey]);\n\n return state;\n}\n"],"mappings":";;;;;;;;;AAYA,IAAM,aAAuC,CAAC;;;;;;;;;;;;;;;;;AAkB9C,SAAgB,qBAAqB,EACnC,SACA,MACA,SACA,QAAQ,OACR,gBAUC;CACD,IAAI,OACF,OACE,oBAAC,KAAD;EAAG,MAAK;EAAS,UAAA;CAGd,CAAA;CAEP,IAAI,QAAQ,WAAW,UACrB,OAAO,oBAAC,uBAAD;EAAgC;EAAe;EAAM,GAAK,eAAe,EAAC,aAAY,IAAI,CAAC;CAAK,CAAA;CAEzG,MAAM,WAAW,QAAQ,MAAM,WAAW,CAAC,OAAO,MAAM;CACxD,IAAI,KAAK,WAAW,KAAK,CAAC,UACxB,OACE,oBAAC,KAAD;EAAG,WAAU;EACV,UAAA,WAAW,2CAA2C;CACtD,CAAA;CAGP,OAAO,oBAAC,wBAAD;EAAiC;EAAe;CAAO,CAAA;AAChE;AAEA,SAAS,uBAAuB,EAC9B,SACA,QAIC;CACD,MAAM,CAAC,WAAW,gBAAgB,SAAS,UAAU;CACrD,MAAM,WAAW,kBAAkB;EAAE;EAAS;CAAU,CAAC;CAEzD,gBAAgB,aAAa,UAAU,GAAG,CAAC,IAAI,CAAC;CAEhD,MAAM,eAAe,aAClB,YACC,gCAAgC;EAC9B,OAAO;EACP,QAAQ,CAAC;EACT,eAAe,QAAQ,WAAW,CAAC;EACnC,SAAS;GAAE,GAAG;GAAS,SAAS;EAAU;CAC5C,CAAC,GACH,CAAC,SAAS,SAAS,CACrB;CAEA,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACG,SAAS,QACR,qBAAC,KAAD;GAAG,MAAK;GAAQ,WAAU;GAA1B,UAAA,CAA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MAAM,CAAC;IAAG,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAAE,CAAC;EACnG,CACF;EACA,aAAa;GACX,UAAU;EACZ;CACF,GAAG,CAAC,QAAQ,YAAY,CAAC;CAEzB,OAAO;AACT"}
1
+ {"version":3,"file":"profileEditorPreview.js","names":[],"sources":["../../../src/profiles/editor/profileEditorPreview.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState, type ComponentProps } from \"react\";\nimport type { DataTableFilterSelection } from \"../../data/data-table-filter-values\";\nimport type { DataTableFilterLookup } from \"../../data/data-table-server-filters\";\nimport { debugCaptureHeaders } from \"../../data/debugConsoleSignal\";\nimport { fetchJSON } from \"../connections/connectionBrowserModel\";\nimport { profileApiPath } from \"../profileApi\";\nimport { lookupProfileSampleFilterValues } from \"../query/profileSampleFilterLookup\";\nimport { sampleRequestProfile } from \"../query/jsonPathSample\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport type { ProfileWizardDraft } from \"../wizard/profileWizardModel\";\nimport { ProfileMappingPreview } from \"./profileMappingPreview\";\n\nconst NO_FILTERS: DataTableFilterSelection = {};\n\n/**\n * The draft's results as the saved profile's page will show them, so the effect\n * of including a field, relabelling it, typing it or hiding it is visible\n * without leaving the editor.\n *\n * The rows are the sample's source rows, not a client-side projection of them:\n * the profile service keeps the sample it took, maps it by id through the\n * draft's columns, so the rows never travel back, and renders the same\n * clicky document it serves the saved profile's results page, which this shows\n * with the same Clicky component — a key_values column is tag pills, a datetime\n * is a timestamp, a duration is a duration. Rows only exist after a sample runs —\n * there is no placeholder data, because a fabricated preview is worse than none.\n *\n * The filter bar offers the filters the draft's columns declare. Filtering is\n * the backend's, so applying one samples again with it; the rows are never\n * filtered in the browser.\n */\ntype PreviewCallbacks = Pick<\n ComponentProps<typeof ProfileMappingPreview>,\n \"onNormalized\" | \"onSampleExpired\" | \"onSelectColumn\" | \"onStatusChange\"\n>;\n\nexport function ProfileEditorPreview({\n columns,\n rows,\n sampleId,\n profile,\n stale = false,\n ...callbacks\n}: {\n columns: ProfileColumn[];\n /** The sample's source rows, ahead of the draft's column mapping. */\n rows: Record<string, unknown>[];\n /** The id the service retained those rows under: what the preview maps. */\n sampleId: string | undefined;\n /** The draft being edited: its columns, aliases and filters are what the rows are mapped through. */\n profile: ProfileWizardDraft;\n stale?: boolean;\n} & PreviewCallbacks) {\n const { onNormalized, ...tableCallbacks } = callbacks;\n if (stale)\n return (\n <p role=\"status\">\n Source or query settings changed. Run a new sample to refresh the\n mapping preview.\n </p>\n );\n if (profile.render === \"traces\")\n return (\n <ProfileMappingPreview\n profile={profile}\n sampleId={sampleId}\n {...tableCallbacks}\n {...(onNormalized ? { onNormalized } : {})}\n />\n );\n\n const included = columns.some((column) => !column.hidden);\n if (rows.length === 0 || !included) {\n return (\n <p className=\"grid h-full place-items-center px-6 text-center text-xs text-muted-foreground\">\n {included ? \"Run a sample in Query to preview rows.\" : \"No columns included yet.\"}\n </p>\n );\n }\n return <FilterableTablePreview profile={profile} sampleId={sampleId} {...tableCallbacks} />;\n}\n\nfunction FilterableTablePreview({\n profile,\n sampleId,\n onSampleExpired,\n ...callbacks\n}: {\n profile: ProfileWizardDraft;\n sampleId: string | undefined;\n} & Omit<PreviewCallbacks, \"onNormalized\">) {\n const [selection, setSelection] = useState(NO_FILTERS);\n const filtered = useFilteredSample({ profile, selection });\n // A new sample starts from no filters: the filtered sample belongs to the old one.\n useEffect(() => setSelection(NO_FILTERS), [sampleId]);\n // An expired filtered sample is the filter's to take again; the unfiltered\n // one is the editor's.\n const expired = filtered.sampleId ? filtered.refresh : onSampleExpired;\n\n const lookupValues = useCallback<DataTableFilterLookup>(\n (request) =>\n lookupProfileSampleFilterValues({\n draft: profile,\n params: {},\n filterColumns: profile.columns ?? [],\n request: { ...request, filters: selection },\n }),\n [profile, selection],\n );\n\n return (\n <div className=\"flex h-full min-h-0 flex-col\">\n {filtered.error ? (\n <p role=\"alert\" className=\"shrink-0 px-3 py-1 text-xs text-destructive\">\n Cannot apply the filter to the sample: {filtered.error}. The rows below\n are from before this filter.\n </p>\n ) : null}\n <ProfileMappingPreview\n profile={profile}\n sampleId={filtered.sampleId ?? sampleId}\n stale={Boolean(filtered.error)}\n filters={{ selection, onChange: setSelection, lookupValues }}\n {...callbacks}\n {...(expired ? { onSampleExpired: expired } : {})}\n />\n </div>\n );\n}\n\ntype FilteredSample = { sampleId: string | null; error: string };\n\n/**\n * The retained sample for a draft with `selection` applied by the backend, or\n * a null id while nothing is selected (the unfiltered sample stands). A failed\n * filter keeps the sample it had, so the preview can still offer the filter bar\n * that changes it.\n */\nfunction useFilteredSample({\n profile,\n selection,\n}: {\n profile: ProfileWizardDraft;\n selection: DataTableFilterSelection;\n}): FilteredSample & { refresh: () => void } {\n const [state, setState] = useState<FilteredSample>({ sampleId: null, error: \"\" });\n const [attempt, setAttempt] = useState(0);\n const refresh = useCallback(() => setAttempt((count) => count + 1), []);\n const active = Object.keys(selection).length > 0;\n const selectionKey = JSON.stringify(selection);\n // The draft's columns are edited without sampling again: only a changed\n // selection queries the backend, with the draft as it stands then.\n const draft = useRef(profile);\n draft.current = profile;\n\n useEffect(() => {\n if (!active) {\n setState({ sampleId: null, error: \"\" });\n return;\n }\n const failed = (error: string) => setState((previous) => ({ ...previous, error }));\n const sampled = sampleRequestProfile(draft.current);\n if (!sampled) {\n failed(\"the draft has no provider to sample\");\n return;\n }\n let current = true;\n setState((previous) => ({ ...previous, error: \"\" }));\n fetchJSON<{ sampleId?: string }>(profileApiPath(\"profile/sample\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...debugCaptureHeaders() },\n body: JSON.stringify({\n profile: sampled,\n params: {},\n previewProcessors: true,\n // The sample request leaves the draft's columns out, so the columns that\n // bind each filter key to a field travel beside the selection.\n filterColumns: draft.current.columns ?? [],\n filters: JSON.parse(selectionKey) as DataTableFilterSelection,\n }),\n }).then(\n (response) => {\n if (!current) return;\n if (!response.sampleId) return failed(\"the sample response is missing sampleId\");\n setState({ sampleId: response.sampleId, error: \"\" });\n },\n (error: unknown) => {\n if (current) failed(error instanceof Error ? error.message : String(error));\n },\n );\n return () => {\n current = false;\n };\n }, [active, selectionKey, attempt]);\n\n return { ...state, refresh };\n}\n"],"mappings":";;;;;;;;;AAYA,IAAM,aAAuC,CAAC;AAwB9C,SAAgB,qBAAqB,EACnC,SACA,MACA,UACA,SACA,QAAQ,OACR,GAAG,aAUiB;CACpB,MAAM,EAAE,cAAc,GAAG,mBAAmB;CAC5C,IAAI,OACF,OACE,oBAAC,KAAD;EAAG,MAAK;EAAS,UAAA;CAGd,CAAA;CAEP,IAAI,QAAQ,WAAW,UACrB,OACE,oBAAC,uBAAD;EACW;EACC;EACV,GAAI;EACJ,GAAK,eAAe,EAAE,aAAa,IAAI,CAAC;CACzC,CAAA;CAGL,MAAM,WAAW,QAAQ,MAAM,WAAW,CAAC,OAAO,MAAM;CACxD,IAAI,KAAK,WAAW,KAAK,CAAC,UACxB,OACE,oBAAC,KAAD;EAAG,WAAU;EACV,UAAA,WAAW,2CAA2C;CACtD,CAAA;CAGP,OAAO,oBAAC,wBAAD;EAAiC;EAAmB;EAAU,GAAI;CAAiB,CAAA;AAC5F;AAEA,SAAS,uBAAuB,EAC9B,SACA,UACA,iBACA,GAAG,aAIuC;CAC1C,MAAM,CAAC,WAAW,gBAAgB,SAAS,UAAU;CACrD,MAAM,WAAW,kBAAkB;EAAE;EAAS;CAAU,CAAC;CAEzD,gBAAgB,aAAa,UAAU,GAAG,CAAC,QAAQ,CAAC;CAGpD,MAAM,UAAU,SAAS,WAAW,SAAS,UAAU;CAEvD,MAAM,eAAe,aAClB,YACC,gCAAgC;EAC9B,OAAO;EACP,QAAQ,CAAC;EACT,eAAe,QAAQ,WAAW,CAAC;EACnC,SAAS;GAAE,GAAG;GAAS,SAAS;EAAU;CAC5C,CAAC,GACH,CAAC,SAAS,SAAS,CACrB;CAEA,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACG,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C;IACzC,SAAS,KAAK,MAAM,YAAY;GAClC,CAAC;EACH,CAAC,CAAC,CAAC,MACA,aAAa;GACZ,IAAI,CAAC,SAAS;GACd,IAAI,CAAC,SAAS,UAAU,OAAO,OAAO,yCAAyC;GAC/E,SAAS;IAAE,UAAU,SAAS;IAAU,OAAO;GAAG,CAAC;EACrD,IACC,UAAmB;GAClB,IAAI,SAAS,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;EAC5E,CACF;EACA,aAAa;GACX,UAAU;EACZ;CACF,GAAG;EAAC;EAAQ;EAAc;CAAO,CAAC;CAElC,OAAO;EAAE,GAAG;EAAO;CAAQ;AAC7B"}
@@ -4,19 +4,33 @@ const require_profile_spans = require("../../data/traces/otel/profile-spans.cjs"
4
4
  const require_profile_listing = require("../../data/traces/otel/profile-listing.cjs");
5
5
  const require_Clicky = require("../../data/Clicky.cjs");
6
6
  const require_Callout = require("../../data/Callout.cjs");
7
+ const require_utils = require("../../lib/utils.cjs");
7
8
  const require_profileApi = require("../profileApi.cjs");
9
+ const require_sampleError = require("./sampleError.cjs");
8
10
  let react = require("react");
9
11
  let react_jsx_runtime = require("react/jsx-runtime");
10
12
  // src/profiles/editor/profileMappingPreview.tsx
11
- function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
13
+ var UNRESOLVED_REASONS = /* @__PURE__ */ new Set(["no_source", "no_value"]);
14
+ function ProfileMappingPreview({ profile, sampleId, onNormalized, filters, stale = false, onSampleExpired, onSelectColumn, onStatusChange }) {
12
15
  const normalizedCallback = (0, react.useRef)(onNormalized);
13
- normalizedCallback.current = onNormalized;
16
+ const expiredCallback = (0, react.useRef)(onSampleExpired);
17
+ const statusCallback = (0, react.useRef)(onStatusChange);
14
18
  const [result, setResult] = (0, react.useState)();
15
19
  const filtersRef = (0, react.useRef)(filters);
16
- filtersRef.current = filters;
20
+ (0, react.useLayoutEffect)(() => {
21
+ normalizedCallback.current = onNormalized;
22
+ expiredCallback.current = onSampleExpired;
23
+ statusCallback.current = onStatusChange;
24
+ filtersRef.current = filters;
25
+ }, [
26
+ onNormalized,
27
+ onSampleExpired,
28
+ onStatusChange,
29
+ filters
30
+ ]);
17
31
  const filterConfig = (0, react.useMemo)(() => filters && result?.resultColumns ? require_data_table_server_filters.serverFiltersToFilterBar(result.resultColumns, filters.selection, filters.onChange, filters.lookupValues ? { lookupValues: filters.lookupValues } : {}) : void 0, [filters, result]);
18
- const idle = rows.length === 0 && !filters;
19
- const [error, setError] = (0, react.useState)("");
32
+ const idle = !sampleId;
33
+ const [failure, setFailure] = (0, react.useState)();
20
34
  const [pending, setPending] = (0, react.useState)(false);
21
35
  const [trace, setTrace] = (0, react.useState)();
22
36
  const [span, setSpan] = (0, react.useState)();
@@ -32,13 +46,12 @@ function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
32
46
  ignore: profile.ignore,
33
47
  filters: profile.filters
34
48
  },
35
- rows
49
+ sampleId
36
50
  });
37
51
  (0, react.useEffect)(() => {
38
52
  if (idle) return;
39
53
  const controller = new AbortController();
40
54
  setPending(true);
41
- setError("");
42
55
  const timer = setTimeout(() => {
43
56
  (async () => {
44
57
  try {
@@ -48,16 +61,25 @@ function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
48
61
  body,
49
62
  signal: controller.signal
50
63
  });
51
- if (!response.ok) throw new Error(await response.text());
64
+ if (!response.ok) {
65
+ const error = require_sampleError.parseSampleError(await response.text());
66
+ if (controller.signal.aborted) return;
67
+ setFailure(error);
68
+ if (error.code === "sample_expired") expiredCallback.current?.();
69
+ return;
70
+ }
52
71
  const next = await response.json();
53
72
  if (!next.document?.node) throw new Error("the mapping response carried no rendered document");
54
73
  if (filtersRef.current && !Array.isArray(next.resultColumns)) throw new Error("the mapping response carried no resultColumns to build filters from");
74
+ const unknown = next.unresolvedColumns?.find((column) => !UNRESOLVED_REASONS.has(column.reason));
75
+ if (unknown) throw new Error(`the mapping response gave column ${unknown.name} an unknown unresolved reason ${String(unknown.reason)}`);
55
76
  if (!controller.signal.aborted) {
56
77
  setResult(next);
78
+ setFailure(void 0);
57
79
  normalizedCallback.current?.(next.normalizedRows, next.availableColumns);
58
80
  }
59
81
  } catch (error) {
60
- if (!controller.signal.aborted) setError(error instanceof Error ? error.message : String(error));
82
+ if (!controller.signal.aborted) setFailure({ message: error instanceof Error ? error.message : String(error) });
61
83
  } finally {
62
84
  if (!controller.signal.aborted) setPending(false);
63
85
  }
@@ -68,56 +90,72 @@ function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
68
90
  controller.abort();
69
91
  };
70
92
  }, [body, idle]);
93
+ const resampling = failure?.code === "sample_expired" && Boolean(onSampleExpired);
94
+ const status = idle ? "idle" : failure && !resampling ? "failed" : pending || !result || resampling ? "updating" : "ready";
95
+ (0, react.useEffect)(() => {
96
+ statusCallback.current?.(status);
97
+ }, [status]);
71
98
  if (idle) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: "Run a sample in Query to preview mappings." });
72
- if (error) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
73
- role: "alert",
74
- children: ["Cannot preview mappings: ", error]
75
- });
76
- if (!result || pending && profile.render === "traces") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
99
+ const notice = failure ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MappingFailure, {
100
+ failure,
101
+ kept: Boolean(result),
102
+ resampling
103
+ }) : null;
104
+ if (!result) return notice ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
77
105
  role: "status",
78
106
  children: "Updating mapping preview…"
79
107
  });
80
- const unresolved = result.unresolvedColumns?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
108
+ if (pending && !failure && profile.render === "traces") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
81
109
  role: "status",
82
- "aria-label": "Unresolved columns",
83
- className: "shrink-0",
84
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Callout.Callout, {
85
- variant: "warning",
86
- label: "No sampled values",
87
- className: "my-0 mb-2",
88
- children: [
89
- "No sampled row has a value for ",
90
- result.unresolvedColumns.join(", "),
91
- ". They fill in once the data carries their source; otherwise check where they read from."
92
- ]
93
- })
110
+ children: "Updating mapping preview…"
111
+ });
112
+ const dimmed = stale || Boolean(failure);
113
+ const unresolved = result.unresolvedColumns?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnresolvedColumns, {
114
+ columns: result.unresolvedColumns,
115
+ dimmed,
116
+ ...onSelectColumn ? { onSelectColumn } : {}
94
117
  }) : null;
95
118
  if (profile.render !== "traces") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
96
119
  "aria-busy": pending,
97
120
  className: "flex h-full min-h-0 flex-col",
98
- children: [unresolved, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Clicky.Clicky, {
99
- data: result.document.node,
100
- className: "flex min-h-0 flex-1 flex-col",
101
- ...filterConfig?.filters.length ? { externalFilters: filterConfig.filters } : {},
102
- ...filterConfig?.timeRange ? { timeRange: filterConfig.timeRange } : {}
103
- })]
121
+ children: [
122
+ notice,
123
+ unresolved,
124
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Clicky.Clicky, {
125
+ data: result.document.node,
126
+ className: require_utils.cn("flex min-h-0 flex-1 flex-col", dimmed && "opacity-50"),
127
+ ...filterConfig?.filters.length ? { externalFilters: filterConfig.filters } : {},
128
+ ...filterConfig?.timeRange ? { timeRange: filterConfig.timeRange } : {}
129
+ })
130
+ ]
104
131
  });
105
132
  try {
106
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [unresolved, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_OtelTraceTable.OtelTraceTable, {
107
- spans: require_profile_spans.profileSpans(result.rows),
108
- listing: {
109
- ...require_profile_listing.profileTraceListing(result.rows, result.document.node),
110
- linkRows: false
111
- },
112
- onSelectTrace: (id) => {
113
- setTrace(id);
114
- setSpan(void 0);
115
- },
116
- onSelectSpan: setSpan,
117
- traceHref: (id) => `#trace=${encodeURIComponent(id)}`,
118
- ...trace ? { selectedTraceId: trace } : {},
119
- ...span ? { selectedSpanId: span } : {}
120
- })] });
133
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
134
+ "aria-busy": pending,
135
+ className: "flex h-full min-h-0 flex-col",
136
+ children: [
137
+ notice,
138
+ unresolved,
139
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
140
+ className: require_utils.cn("min-h-0 flex-1", dimmed && "opacity-50"),
141
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_OtelTraceTable.OtelTraceTable, {
142
+ spans: require_profile_spans.profileSpans(result.rows),
143
+ listing: {
144
+ ...require_profile_listing.profileTraceListing(result.rows, result.document.node),
145
+ linkRows: false
146
+ },
147
+ onSelectTrace: (id) => {
148
+ setTrace(id);
149
+ setSpan(void 0);
150
+ },
151
+ onSelectSpan: setSpan,
152
+ traceHref: (id) => `#trace=${encodeURIComponent(id)}`,
153
+ ...trace ? { selectedTraceId: trace } : {},
154
+ ...span ? { selectedSpanId: span } : {}
155
+ })
156
+ })
157
+ ]
158
+ });
121
159
  } catch (error) {
122
160
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
123
161
  role: "alert",
@@ -129,6 +167,73 @@ function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
129
167
  });
130
168
  }
131
169
  }
170
+ var FAILURE_TITLES = {
171
+ [require_sampleError.SAMPLE_EXPIRED]: "Sample expired",
172
+ [require_sampleError.PAYLOAD_TOO_LARGE]: "Preview request too large"
173
+ };
174
+ /**
175
+ * What went wrong, in the service's words, with its hint and with what the
176
+ * pane still shows. An expired sample the editor is replacing is a status, not
177
+ * an alert: nothing is wrong with the draft.
178
+ */
179
+ function MappingFailure({ failure, kept, resampling }) {
180
+ const title = failure.code && FAILURE_TITLES[failure.code] || "Preview failed";
181
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
182
+ role: resampling ? "status" : "alert",
183
+ "aria-label": resampling ? title : void 0,
184
+ className: "shrink-0",
185
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Callout.Callout, {
186
+ variant: resampling ? "note" : "caution",
187
+ label: title,
188
+ className: "my-0 mb-2",
189
+ children: [
190
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: ["Cannot preview mappings: ", failure.message] }),
191
+ failure.hint ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: failure.hint }) : null,
192
+ resampling ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: "Sampling again…" }) : null,
193
+ kept ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
194
+ className: "text-muted-foreground",
195
+ children: "The table below is the last preview that succeeded."
196
+ }) : null
197
+ ]
198
+ })
199
+ });
200
+ }
201
+ function UnresolvedColumns({ columns, dimmed, onSelectColumn }) {
202
+ const names = (list) => list.map((column, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [index > 0 ? ", " : null, onSelectColumn ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
203
+ type: "button",
204
+ className: "font-medium underline underline-offset-2",
205
+ onClick: () => onSelectColumn(column.name),
206
+ children: column.name
207
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
208
+ className: "font-medium",
209
+ children: column.name
210
+ })] }, column.name));
211
+ const noSource = columns.filter((column) => column.reason === "no_source");
212
+ const noValue = columns.filter((column) => column.reason === "no_value");
213
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
214
+ role: "status",
215
+ "aria-label": "Unresolved columns",
216
+ className: require_utils.cn("shrink-0", dimmed && "opacity-50"),
217
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Callout.Callout, {
218
+ variant: "warning",
219
+ label: "No sampled values",
220
+ className: "my-0 mb-2",
221
+ children: [noSource.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
222
+ names(noSource),
223
+ " ",
224
+ noSource.length === 1 ? "has" : "have",
225
+ " no source yet: pick a field or write an expression for",
226
+ " ",
227
+ noSource.length === 1 ? "it" : "them",
228
+ "."
229
+ ] }) : null, noValue.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
230
+ "No sampled row has a value for ",
231
+ names(noValue),
232
+ ". They fill in once the data carries what they read; otherwise check their source."
233
+ ] }) : null]
234
+ })
235
+ });
236
+ }
132
237
  exports.ProfileMappingPreview = ProfileMappingPreview;
133
238
 
134
239
  //# sourceMappingURL=profileMappingPreview.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"profileMappingPreview.cjs","names":["useRef","useState","useMemo","serverFiltersToFilterBar","profileApiPath","Callout","Clicky","_Fragment","OtelTraceTable","profileSpans","profileTraceListing"],"sources":["../../../src/profiles/editor/profileMappingPreview.tsx"],"sourcesContent":["import {\n useEffect,\n useMemo,\n useState,\n useRef,\n type Dispatch,\n type SetStateAction,\n} from \"react\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport type { DataTableFilterSelection } from \"../../data/data-table-filter-values\";\nimport {\n serverFiltersToFilterBar,\n type DataTableFilterLookup,\n type DataTableServerColumn,\n} from \"../../data/data-table-server-filters\";\nimport { OtelTraceTable } from \"../../data/traces/otel/OtelTraceTable\";\nimport { profileSpans } from \"../../data/traces/otel/profile-spans\";\nimport { profileTraceListing } from \"../../data/traces/otel/profile-listing\";\nimport { Clicky, type ClickyNode } from \"../../data/Clicky\";\nimport { Callout } from \"../../data/Callout\";\nimport { profileApiPath } from \"../profileApi\";\nimport type { ProfileWizardDraft } from \"../wizard/profileWizardModel\";\n\n/**\n * The filters a table preview offers. The controls are the ones the service\n * describes for the draft's columns (the result columns of the mapping\n * response), built by the same serverFiltersToFilterBar the profile query\n * results use; applying one is the caller's to do, server-side, by sampling\n * again — the table never filters the rows it was given.\n */\nexport type ProfileMappingFilters = {\n selection: DataTableFilterSelection;\n onChange: Dispatch<SetStateAction<DataTableFilterSelection>>;\n lookupValues?: DataTableFilterLookup;\n};\n\nexport function ProfileMappingPreview({\n profile,\n rows,\n onNormalized,\n filters,\n}: {\n profile: ProfileWizardDraft;\n rows: Record<string, unknown>[];\n onNormalized?: (\n rows: Record<string, unknown>[],\n columns: ProfileColumn[]\n ) => void;\n filters?: ProfileMappingFilters;\n}) {\n const normalizedCallback = useRef(onNormalized);\n normalizedCallback.current = onNormalized;\n const [result, setResult] = useState<{\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n unresolvedColumns?: string[];\n }>();\n const filtersRef = useRef(filters);\n filtersRef.current = filters;\n const filterConfig = useMemo(\n () =>\n filters && result?.resultColumns\n ? serverFiltersToFilterBar(\n result.resultColumns,\n filters.selection,\n filters.onChange,\n filters.lookupValues ? { lookupValues: filters.lookupValues } : {}\n )\n : undefined,\n [filters, result]\n );\n // A filtered sample may legitimately be empty, and its filter bar is how the\n // filter is cleared, so a preview that offers filters renders zero rows too.\n const idle = rows.length === 0 && !filters;\n const [error, setError] = useState(\"\");\n const [pending, setPending] = useState(false);\n const [trace, setTrace] = useState<string>();\n const [span, setSpan] = useState<string>();\n const body = JSON.stringify({\n profile: {\n profile: profile.profile,\n provider: profile.provider,\n spans: profile.spans,\n search: profile.search,\n render: profile.render,\n columns: profile.columns,\n aliases: profile.aliases,\n ignore: profile.ignore,\n filters: profile.filters,\n },\n rows,\n });\n useEffect(() => {\n if (idle) return;\n const controller = new AbortController();\n setPending(true);\n setError(\"\");\n const timer = setTimeout(() => {\n void (async () => {\n try {\n const response = await fetch(\n profileApiPath(\"profile/sample/mapping\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body,\n signal: controller.signal,\n }\n );\n if (!response.ok) throw new Error(await response.text());\n const next = (await response.json()) as {\n normalizedRows: Record<string, unknown>[];\n availableColumns: ProfileColumn[];\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n unresolvedColumns?: string[];\n };\n if (!next.document?.node)\n throw new Error(\n \"the mapping response carried no rendered document\"\n );\n if (filtersRef.current && !Array.isArray(next.resultColumns))\n throw new Error(\n \"the mapping response carried no resultColumns to build filters from\"\n );\n if (!controller.signal.aborted) {\n setResult(next);\n normalizedCallback.current?.(\n next.normalizedRows,\n next.availableColumns\n );\n }\n } catch (error) {\n if (!controller.signal.aborted)\n setError(error instanceof Error ? error.message : String(error));\n } finally {\n if (!controller.signal.aborted) setPending(false);\n }\n })();\n }, 250);\n return () => {\n clearTimeout(timer);\n controller.abort();\n };\n }, [body, idle]);\n if (idle) return <p>Run a sample in Query to preview mappings.</p>;\n if (error) return <p role=\"alert\">Cannot preview mappings: {error}</p>;\n // A table keeps showing the last rendering while an edit is remapped, so the\n // preview updates in place instead of blinking to a status line per keystroke.\n if (!result || (pending && profile.render === \"traces\"))\n return <p role=\"status\">Updating mapping preview…</p>;\n // The service names the declared columns no sampled row has a value for. That\n // is a warning, never a refusal: the data may simply not carry them yet.\n const unresolved = result.unresolvedColumns?.length ? (\n <div role=\"status\" aria-label=\"Unresolved columns\" className=\"shrink-0\">\n <Callout\n variant=\"warning\"\n label=\"No sampled values\"\n className=\"my-0 mb-2\"\n >\n No sampled row has a value for {result.unresolvedColumns.join(\", \")}.\n They fill in once the data carries their source; otherwise check where\n they read from.\n </Callout>\n </div>\n ) : null;\n if (profile.render !== \"traces\")\n return (\n <div aria-busy={pending} className=\"flex h-full min-h-0 flex-col\">\n {unresolved}\n <Clicky\n data={result.document.node}\n className=\"flex min-h-0 flex-1 flex-col\"\n {...(filterConfig?.filters.length\n ? { externalFilters: filterConfig.filters }\n : {})}\n {...(filterConfig?.timeRange\n ? { timeRange: filterConfig.timeRange }\n : {})}\n />\n </div>\n );\n try {\n return (\n <>\n {unresolved}\n <OtelTraceTable\n spans={profileSpans(result.rows)}\n listing={{\n ...profileTraceListing(result.rows, result.document.node),\n linkRows: false,\n }}\n onSelectTrace={(id) => {\n setTrace(id);\n setSpan(undefined);\n }}\n onSelectSpan={setSpan}\n traceHref={(id) => `#trace=${encodeURIComponent(id)}`}\n {...(trace ? { selectedTraceId: trace } : {})}\n {...(span ? { selectedSpanId: span } : {})}\n />\n </>\n );\n } catch (error) {\n return (\n <p role=\"alert\">\n Cannot preview traces:{\" \"}\n {error instanceof Error ? error.message : String(error)}\n </p>\n );\n }\n}\n"],"mappings":";;;;;;;;;;AAoCA,SAAgB,sBAAsB,EACpC,SACA,MACA,cACA,WASC;CACD,MAAM,sBAAA,GAAqBA,MAAAA,OAAAA,CAAO,YAAY;CAC9C,mBAAmB,UAAU;CAC7B,MAAM,CAAC,QAAQ,cAAA,GAAaC,MAAAA,SAAAA,CAKzB;CACH,MAAM,cAAA,GAAaD,MAAAA,OAAAA,CAAO,OAAO;CACjC,WAAW,UAAU;CACrB,MAAM,gBAAA,GAAeE,MAAAA,QAAAA,OAEjB,WAAW,QAAQ,gBACfC,kCAAAA,yBACE,OAAO,eACP,QAAQ,WACR,QAAQ,UACR,QAAQ,eAAe,EAAE,cAAc,QAAQ,aAAa,IAAI,CAAC,CACnE,IACA,KAAA,GACN,CAAC,SAAS,MAAM,CAClB;CAGA,MAAM,OAAO,KAAK,WAAW,KAAK,CAAC;CACnC,MAAM,CAAC,OAAO,aAAA,GAAYF,MAAAA,SAAAA,CAAS,EAAE;CACrC,MAAM,CAAC,SAAS,eAAA,GAAcA,MAAAA,SAAAA,CAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,aAAA,GAAYA,MAAAA,SAAAA,CAAiB;CAC3C,MAAM,CAAC,MAAM,YAAA,GAAWA,MAAAA,SAAAA,CAAiB;CACzC,MAAM,OAAO,KAAK,UAAU;EAC1B,SAAS;GACP,SAAS,QAAQ;GACjB,UAAU,QAAQ;GAClB,OAAO,QAAQ;GACf,QAAQ,QAAQ;GAChB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;GACjB,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gBAAgB,KAAK,IAAI,CAAC;EACzC,CAAA,CACD,EAAA,CAAA;CAEN,SAAS,OAAO;EACd,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,KAAD;GAAG,MAAK;GAAR,UAAA;IAAgB;IACS;IACtB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GACrD;;CAEP;AACF"}
1
+ {"version":3,"file":"profileMappingPreview.cjs","names":["useRef","useState","useMemo","serverFiltersToFilterBar","profileApiPath","parseSampleError","Clicky","cn","OtelTraceTable","profileSpans","profileTraceListing","SAMPLE_EXPIRED","PAYLOAD_TOO_LARGE","Callout","Fragment"],"sources":["../../../src/profiles/editor/profileMappingPreview.tsx"],"sourcesContent":["import {\n Fragment,\n useEffect,\n useLayoutEffect,\n useMemo,\n useState,\n useRef,\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n} from \"react\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport type { DataTableFilterSelection } from \"../../data/data-table-filter-values\";\nimport {\n serverFiltersToFilterBar,\n type DataTableFilterLookup,\n type DataTableServerColumn,\n} from \"../../data/data-table-server-filters\";\nimport { OtelTraceTable } from \"../../data/traces/otel/OtelTraceTable\";\nimport { profileSpans } from \"../../data/traces/otel/profile-spans\";\nimport { profileTraceListing } from \"../../data/traces/otel/profile-listing\";\nimport { Clicky, type ClickyNode } from \"../../data/Clicky\";\nimport { Callout } from \"../../data/Callout\";\nimport { cn } from \"../../lib/utils\";\nimport { profileApiPath } from \"../profileApi\";\nimport type { ProfileWizardDraft } from \"../wizard/profileWizardModel\";\nimport { parseSampleError, PAYLOAD_TOO_LARGE, SAMPLE_EXPIRED, type SampleError } from \"./sampleError\";\n\n/**\n * The filters a table preview offers. The controls are the ones the service\n * describes for the draft's columns (the result columns of the mapping\n * response), built by the same serverFiltersToFilterBar the profile query\n * results use; applying one is the caller's to do, server-side, by sampling\n * again — the table never filters the rows it was given.\n */\nexport type ProfileMappingFilters = {\n selection: DataTableFilterSelection;\n onChange: Dispatch<SetStateAction<DataTableFilterSelection>>;\n lookupValues?: DataTableFilterLookup;\n};\n\n/** Where the preview stands, for a caller that summarises it elsewhere. */\nexport type ProfileMappingPreviewStatus = \"idle\" | \"updating\" | \"ready\" | \"failed\";\n\n/** Why the service found no sampled value for a declared column. */\ntype UnresolvedColumn = { name: string; reason: \"no_source\" | \"no_value\" };\n\ntype MappingResult = {\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n unresolvedColumns?: UnresolvedColumn[];\n};\n\nconst UNRESOLVED_REASONS = new Set([\"no_source\", \"no_value\"]);\n\nexport function ProfileMappingPreview({\n profile,\n sampleId,\n onNormalized,\n filters,\n stale = false,\n onSampleExpired,\n onSelectColumn,\n onStatusChange,\n}: {\n profile: ProfileWizardDraft;\n /**\n * The sample /profile/sample retained. The service maps its rows where they\n * are: they are its own output, often megabytes of documents, and sending\n * them back on every edit overran the request limit.\n */\n sampleId: string | undefined;\n onNormalized?: (\n rows: Record<string, unknown>[],\n columns: ProfileColumn[]\n ) => void;\n filters?: ProfileMappingFilters;\n /** The rows shown are not the ones last asked for; they are dimmed. */\n stale?: boolean;\n /** The service no longer holds the sample: sample again. */\n onSampleExpired?: () => void;\n /** Opens a column the unresolved-columns warning names. */\n onSelectColumn?: (name: string) => void;\n onStatusChange?: (status: ProfileMappingPreviewStatus) => void;\n}) {\n const normalizedCallback = useRef(onNormalized);\n const expiredCallback = useRef(onSampleExpired);\n const statusCallback = useRef(onStatusChange);\n const [result, setResult] = useState<MappingResult>();\n const filtersRef = useRef(filters);\n useLayoutEffect(() => {\n normalizedCallback.current = onNormalized;\n expiredCallback.current = onSampleExpired;\n statusCallback.current = onStatusChange;\n filtersRef.current = filters;\n }, [onNormalized, onSampleExpired, onStatusChange, filters]);\n const filterConfig = useMemo(\n () =>\n filters && result?.resultColumns\n ? serverFiltersToFilterBar(\n result.resultColumns,\n filters.selection,\n filters.onChange,\n filters.lookupValues ? { lookupValues: filters.lookupValues } : {}\n )\n : undefined,\n [filters, result]\n );\n const idle = !sampleId;\n const [failure, setFailure] = useState<SampleError>();\n const [pending, setPending] = useState(false);\n const [trace, setTrace] = useState<string>();\n const [span, setSpan] = useState<string>();\n const body = JSON.stringify({\n profile: {\n profile: profile.profile,\n provider: profile.provider,\n spans: profile.spans,\n search: profile.search,\n render: profile.render,\n columns: profile.columns,\n aliases: profile.aliases,\n ignore: profile.ignore,\n filters: profile.filters,\n },\n sampleId,\n });\n useEffect(() => {\n if (idle) return;\n const controller = new AbortController();\n setPending(true);\n const timer = setTimeout(() => {\n void (async () => {\n try {\n const response = await fetch(\n profileApiPath(\"profile/sample/mapping\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body,\n signal: controller.signal,\n }\n );\n if (!response.ok) {\n const error = parseSampleError(await response.text());\n if (controller.signal.aborted) return;\n setFailure(error);\n if (error.code === SAMPLE_EXPIRED) expiredCallback.current?.();\n return;\n }\n const next = (await response.json()) as MappingResult & {\n normalizedRows: Record<string, unknown>[];\n availableColumns: ProfileColumn[];\n };\n if (!next.document?.node)\n throw new Error(\n \"the mapping response carried no rendered document\"\n );\n if (filtersRef.current && !Array.isArray(next.resultColumns))\n throw new Error(\n \"the mapping response carried no resultColumns to build filters from\"\n );\n const unknown = next.unresolvedColumns?.find((column) => !UNRESOLVED_REASONS.has(column.reason));\n if (unknown)\n throw new Error(\n `the mapping response gave column ${unknown.name} an unknown unresolved reason ${String(unknown.reason)}`\n );\n if (!controller.signal.aborted) {\n setResult(next);\n setFailure(undefined);\n normalizedCallback.current?.(\n next.normalizedRows,\n next.availableColumns\n );\n }\n } catch (error) {\n if (!controller.signal.aborted)\n setFailure({ message: error instanceof Error ? error.message : String(error) });\n } finally {\n if (!controller.signal.aborted) setPending(false);\n }\n })();\n }, 250);\n return () => {\n clearTimeout(timer);\n controller.abort();\n };\n }, [body, idle]);\n // An expired sample the caller is replacing is an update in progress, not a\n // failure the author has to act on.\n const resampling = failure?.code === SAMPLE_EXPIRED && Boolean(onSampleExpired);\n const status: ProfileMappingPreviewStatus = idle\n ? \"idle\"\n : failure && !resampling\n ? \"failed\"\n : pending || !result || resampling\n ? \"updating\"\n : \"ready\";\n useEffect(() => {\n statusCallback.current?.(status);\n }, [status]);\n\n if (idle) return <p>Run a sample in Query to preview mappings.</p>;\n const notice = failure ? (\n <MappingFailure failure={failure} kept={Boolean(result)} resampling={resampling} />\n ) : null;\n // A table keeps showing the last rendering while an edit is remapped, so the\n // preview updates in place instead of blinking to a status line per keystroke.\n if (!result)\n return notice ?? <p role=\"status\">Updating mapping preview…</p>;\n if (pending && !failure && profile.render === \"traces\")\n return <p role=\"status\">Updating mapping preview…</p>;\n // Everything under a failure describes the last preview that succeeded.\n const dimmed = stale || Boolean(failure);\n // The service names the declared columns no sampled row has a value for. That\n // is a warning, never a refusal: the data may simply not carry them yet.\n const unresolved = result.unresolvedColumns?.length ? (\n <UnresolvedColumns\n columns={result.unresolvedColumns}\n dimmed={dimmed}\n {...(onSelectColumn ? { onSelectColumn } : {})}\n />\n ) : null;\n if (profile.render !== \"traces\")\n return (\n <div aria-busy={pending} className=\"flex h-full min-h-0 flex-col\">\n {notice}\n {unresolved}\n <Clicky\n data={result.document.node}\n className={cn(\"flex min-h-0 flex-1 flex-col\", dimmed && \"opacity-50\")}\n {...(filterConfig?.filters.length\n ? { externalFilters: filterConfig.filters }\n : {})}\n {...(filterConfig?.timeRange\n ? { timeRange: filterConfig.timeRange }\n : {})}\n />\n </div>\n );\n try {\n return (\n <div aria-busy={pending} className=\"flex h-full min-h-0 flex-col\">\n {notice}\n {unresolved}\n <div className={cn(\"min-h-0 flex-1\", dimmed && \"opacity-50\")}>\n <OtelTraceTable\n spans={profileSpans(result.rows)}\n listing={{\n ...profileTraceListing(result.rows, result.document.node),\n linkRows: false,\n }}\n onSelectTrace={(id) => {\n setTrace(id);\n setSpan(undefined);\n }}\n onSelectSpan={setSpan}\n traceHref={(id) => `#trace=${encodeURIComponent(id)}`}\n {...(trace ? { selectedTraceId: trace } : {})}\n {...(span ? { selectedSpanId: span } : {})}\n />\n </div>\n </div>\n );\n } catch (error) {\n return (\n <p role=\"alert\">\n Cannot preview traces:{\" \"}\n {error instanceof Error ? error.message : String(error)}\n </p>\n );\n }\n}\n\nconst FAILURE_TITLES: Record<string, string> = {\n [SAMPLE_EXPIRED]: \"Sample expired\",\n [PAYLOAD_TOO_LARGE]: \"Preview request too large\",\n};\n\n/**\n * What went wrong, in the service's words, with its hint and with what the\n * pane still shows. An expired sample the editor is replacing is a status, not\n * an alert: nothing is wrong with the draft.\n */\nfunction MappingFailure({\n failure,\n kept,\n resampling,\n}: {\n failure: SampleError;\n kept: boolean;\n resampling: boolean;\n}) {\n const title = (failure.code && FAILURE_TITLES[failure.code]) || \"Preview failed\";\n return (\n <div\n role={resampling ? \"status\" : \"alert\"}\n aria-label={resampling ? title : undefined}\n className=\"shrink-0\"\n >\n <Callout variant={resampling ? \"note\" : \"caution\"} label={title} className=\"my-0 mb-2\">\n <p>Cannot preview mappings: {failure.message}</p>\n {failure.hint ? <p>{failure.hint}</p> : null}\n {resampling ? <p>Sampling again…</p> : null}\n {kept ? (\n <p className=\"text-muted-foreground\">\n The table below is the last preview that succeeded.\n </p>\n ) : null}\n </Callout>\n </div>\n );\n}\n\nfunction UnresolvedColumns({\n columns,\n dimmed,\n onSelectColumn,\n}: {\n columns: UnresolvedColumn[];\n dimmed: boolean;\n onSelectColumn?: (name: string) => void;\n}) {\n const names = (list: UnresolvedColumn[]): ReactNode =>\n list.map((column, index) => (\n <Fragment key={column.name}>\n {index > 0 ? \", \" : null}\n {onSelectColumn ? (\n <button\n type=\"button\"\n className=\"font-medium underline underline-offset-2\"\n onClick={() => onSelectColumn(column.name)}\n >\n {column.name}\n </button>\n ) : (\n <span className=\"font-medium\">{column.name}</span>\n )}\n </Fragment>\n ));\n const noSource = columns.filter((column) => column.reason === \"no_source\");\n const noValue = columns.filter((column) => column.reason === \"no_value\");\n return (\n <div role=\"status\" aria-label=\"Unresolved columns\" className={cn(\"shrink-0\", dimmed && \"opacity-50\")}>\n <Callout variant=\"warning\" label=\"No sampled values\" className=\"my-0 mb-2\">\n {noSource.length ? (\n <p>\n {names(noSource)} {noSource.length === 1 ? \"has\" : \"have\"} no source\n yet: pick a field or write an expression for{\" \"}\n {noSource.length === 1 ? \"it\" : \"them\"}.\n </p>\n ) : null}\n {noValue.length ? (\n <p>\n No sampled row has a value for {names(noValue)}. They fill in once\n the data carries what they read; otherwise check their source.\n </p>\n ) : null}\n </Callout>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAsDA,IAAM,qCAAqB,IAAI,IAAI,CAAC,aAAa,UAAU,CAAC;AAE5D,SAAgB,sBAAsB,EACpC,SACA,UACA,cACA,SACA,QAAQ,OACR,iBACA,gBACA,kBAqBC;CACD,MAAM,sBAAA,GAAqBA,MAAAA,OAAAA,CAAO,YAAY;CAC9C,MAAM,mBAAA,GAAkBA,MAAAA,OAAAA,CAAO,eAAe;CAC9C,MAAM,kBAAA,GAAiBA,MAAAA,OAAAA,CAAO,cAAc;CAC5C,MAAM,CAAC,QAAQ,cAAA,GAAaC,MAAAA,SAAAA,CAAwB;CACpD,MAAM,cAAA,GAAaD,MAAAA,OAAAA,CAAO,OAAO;CACjC,CAAA,GAAA,MAAA,gBAAA,OAAsB;EACpB,mBAAmB,UAAU;EAC7B,gBAAgB,UAAU;EAC1B,eAAe,UAAU;EACzB,WAAW,UAAU;CACvB,GAAG;EAAC;EAAc;EAAiB;EAAgB;CAAO,CAAC;CAC3D,MAAM,gBAAA,GAAeE,MAAAA,QAAAA,OAEjB,WAAW,QAAQ,gBACfC,kCAAAA,yBACE,OAAO,eACP,QAAQ,WACR,QAAQ,UACR,QAAQ,eAAe,EAAE,cAAc,QAAQ,aAAa,IAAI,CAAC,CACnE,IACA,KAAA,GACN,CAAC,SAAS,MAAM,CAClB;CACA,MAAM,OAAO,CAAC;CACd,MAAM,CAAC,SAAS,eAAA,G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AAC,QAAD;EAAM,WAAU;EAAe,UAAA,OAAO;CAAW,CAAA,CAE3C,EAAA,GAbK,OAAO,IAaZ,CACX;CACH,MAAM,WAAW,QAAQ,QAAQ,WAAW,OAAO,WAAW,WAAW;CACzE,MAAM,UAAU,QAAQ,QAAQ,WAAW,OAAO,WAAW,UAAU;CACvE,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,MAAK;EAAS,cAAW;EAAqB,WAAWP,cAAAA,GAAG,YAAY,UAAU,YAAY;EACjG,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAACM,gBAAAA,SAAD;GAAS,SAAQ;GAAU,OAAM;GAAoB,WAAU;GAA/D,UAAA,CACG,SAAS,SACR,iBAAA,GAAA,kBAAA,KAAA,CAAC,KAAD,EAAA,UAAA;IACG,MAAM,QAAQ;IAAE;IAAE,SAAS,WAAW,IAAI,QAAQ;IAAO;IACb;IAC5C,SAAS,WAAW,IAAI,OAAO;IAAO;GACtC,EAAA,CAAA,IACD,MACH,QAAQ,SACP,iBAAA,GAAA,kBAAA,KAAA,CAAC,KAAD,EAAA,UAAA;IAAG;IAC+B,MAAM,OAAO;IAAE;GAE9C,EAAA,CAAA,IACD,IACG;;CACN,CAAA;AAET"}
@@ -14,10 +14,24 @@ export type ProfileMappingFilters = {
14
14
  onChange: Dispatch<SetStateAction<DataTableFilterSelection>>;
15
15
  lookupValues?: DataTableFilterLookup;
16
16
  };
17
- export declare function ProfileMappingPreview({ profile, rows, onNormalized, filters, }: {
17
+ /** Where the preview stands, for a caller that summarises it elsewhere. */
18
+ export type ProfileMappingPreviewStatus = "idle" | "updating" | "ready" | "failed";
19
+ export declare function ProfileMappingPreview({ profile, sampleId, onNormalized, filters, stale, onSampleExpired, onSelectColumn, onStatusChange, }: {
18
20
  profile: ProfileWizardDraft;
19
- rows: Record<string, unknown>[];
21
+ /**
22
+ * The sample /profile/sample retained. The service maps its rows where they
23
+ * are: they are its own output, often megabytes of documents, and sending
24
+ * them back on every edit overran the request limit.
25
+ */
26
+ sampleId: string | undefined;
20
27
  onNormalized?: (rows: Record<string, unknown>[], columns: ProfileColumn[]) => void;
21
28
  filters?: ProfileMappingFilters;
29
+ /** The rows shown are not the ones last asked for; they are dimmed. */
30
+ stale?: boolean;
31
+ /** The service no longer holds the sample: sample again. */
32
+ onSampleExpired?: () => void;
33
+ /** Opens a column the unresolved-columns warning names. */
34
+ onSelectColumn?: (name: string) => void;
35
+ onStatusChange?: (status: ProfileMappingPreviewStatus) => void;
22
36
  }): import("react").JSX.Element;
23
37
  //# sourceMappingURL=profileMappingPreview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"profileMappingPreview.d.ts","sourceRoot":"","sources":["../../../src/profiles/editor/profileMappingPreview.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,QAAQ,EACb,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,sCAAsC,CAAC;AAO9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,wBAAwB,CAAC;IACpC,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAC7D,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,OAAO,GACR,EAAE;IACD,OAAO,EAAE,kBAAkB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,CACb,IAAI,EAAE,MAAM,CAAC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