@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,6 +8,7 @@ import { UiPlay } from "../../icons/components/UiPlay.js";
8
8
  import { UiTable } from "../../icons/components/UiTable.js";
9
9
  import { cloneProfileDraft, mergeSampledProfileColumns, profileColumnResetState, profileEditorSectionStatus, profileEditorSections, profileGeneralOptionKeys, profileSampleSignature, profileUpdateConflictTarget, resetProfileColumns, validateProfileEditorDraft } from "./profileEditorModel.js";
10
10
  import { ProfileEditorPreview } from "./profileEditorPreview.js";
11
+ import { parseSampleError } from "./sampleError.js";
11
12
  import { ProfileEditorRail } from "./profileEditorRail.js";
12
13
  import { ProfileSaveAsDialog } from "./profileSaveAsDialog.js";
13
14
  import { ProfileGeneralSection, ProfileQuerySection, ProfileSchemaSection, ProfileSourceCard } from "./profileEditorSections.js";
@@ -30,13 +31,13 @@ import { useQuery } from "@tanstack/react-query";
30
31
  // src/profiles/editor/profileEditor.tsx
31
32
  var ProfileEditorRaw = lazy(() => import("./profileEditorRaw.js").then((module) => ({ default: module.ProfileEditorRaw })));
32
33
  /** The server answers a failed sample with a JSON diagnostics envelope; its `error` is the message, anything else is shown as sent. */
33
- function sampleErrorMessage(body) {
34
- try {
35
- const parsed = JSON.parse(body);
36
- if (typeof parsed === "object" && parsed !== null && "error" in parsed && typeof parsed.error === "string") return parsed.error;
37
- } catch {}
38
- return body;
39
- }
34
+ /** The Preview pane header's word on the preview, so it never claims "updates as you edit" while the preview is failing. */
35
+ var PREVIEW_STATUS_NOTES = {
36
+ idle: "not previewed",
37
+ updating: "updating…",
38
+ ready: "updates as you edit",
39
+ failed: "preview failed"
40
+ };
40
41
  /** The one request the editor makes to sample a profile: used by the traces source sample and by Run. */
41
42
  async function fetchEditorSample(draft) {
42
43
  const profile = sampleRequestProfile(draft);
@@ -50,7 +51,7 @@ async function fetchEditorSample(draft) {
50
51
  previewProcessors: true
51
52
  })
52
53
  });
53
- if (!response.ok) throw new Error(sampleErrorMessage(await response.text()));
54
+ if (!response.ok) throw new Error(parseSampleError(await response.text()).message);
54
55
  return await response.json();
55
56
  }
56
57
  /**
@@ -72,6 +73,8 @@ function ProfileEditor({ client, action, createAction, surfaceKey, initialValue,
72
73
  const [sampledColumns, setSampledColumns] = useState([]);
73
74
  const [sampleRows, setSampleRows] = useState([]);
74
75
  const [mappingRows, setMappingRows] = useState([]);
76
+ const [sampleId, setSampleId] = useState();
77
+ const [previewStatus, setPreviewStatus] = useState("idle");
75
78
  const [activeField, setActiveField] = useState(initialDraft.columns?.[0]?.name ?? "");
76
79
  const [activeParameter, setActiveParameter] = useState(0);
77
80
  const [activeProcessor, setActiveProcessor] = useState(0);
@@ -161,9 +164,11 @@ function ProfileEditor({ client, action, createAction, surfaceKey, initialValue,
161
164
  setSaving(false);
162
165
  }
163
166
  };
164
- const acceptSample = useCallback(({ columns, rows, sourceDraft, mappingInputRows }) => {
167
+ const acceptSample = useCallback(({ columns, rows, sourceDraft, mappingInputRows, sampleId: retained }) => {
165
168
  if (!mappingInputRows) throw new Error("Sample response is missing mappingInputRows");
169
+ if (!retained) throw new Error("Sample response is missing sampleId");
166
170
  setMappingRows(mappingInputRows);
171
+ setSampleId(retained);
167
172
  setSampledColumns(structuredClone(columns));
168
173
  if (sourceDraft.render !== "traces") setDiscovered(columns);
169
174
  setSampleRows(rows);
@@ -184,6 +189,7 @@ function ProfileEditor({ client, action, createAction, surfaceKey, initialValue,
184
189
  });
185
190
  const [sampling, setSampling] = useState(false);
186
191
  const runSample = async () => {
192
+ if (sampling) return;
187
193
  setSampling(true);
188
194
  setError("");
189
195
  try {
@@ -326,7 +332,7 @@ function ProfileEditor({ client, action, createAction, surfaceKey, initialValue,
326
332
  }) : null
327
333
  ]
328
334
  });
329
- const panes = useMemo(() => {
335
+ const panes = (() => {
330
336
  const result = [{
331
337
  id: "sections",
332
338
  label: "Profile",
@@ -401,34 +407,25 @@ function ProfileEditor({ client, action, createAction, surfaceKey, initialValue,
401
407
  maxHeightFraction: .8,
402
408
  slots: { headerTrailing: /* @__PURE__ */ jsx("span", {
403
409
  className: "text-[11px] text-muted-foreground",
404
- children: sampleRows.length ? `${sampleRows.length} sampled rows · updates as you edit` : "No sample yet"
410
+ children: sampleId ? `${mappingRows.length} sampled rows · ${PREVIEW_STATUS_NOTES[previewStatus]}` : "No sample yet"
405
411
  }) },
406
412
  content: /* @__PURE__ */ jsx(ProfileEditorPreview, {
407
413
  profile: draft,
408
414
  columns: draft.columns ?? [],
409
415
  rows: mappingRows,
416
+ sampleId,
410
417
  stale: sampleStale,
411
- onNormalized: acceptNormalized
418
+ onNormalized: acceptNormalized,
419
+ onSampleExpired: () => void runSample(),
420
+ onSelectColumn: (name) => {
421
+ fields.setActiveName(name);
422
+ setSection("columns");
423
+ },
424
+ onStatusChange: setPreviewStatus
412
425
  })
413
426
  });
414
427
  return result;
415
- }, [
416
- activeParameter,
417
- activeProcessor,
418
- draft,
419
- fields,
420
- resetState,
421
- sampleRows,
422
- mappingRows,
423
- sampleStale,
424
- section,
425
- sectionContent,
426
- pipelineCatalog,
427
- processors,
428
- setProcessors,
429
- traces,
430
- acceptNormalized
431
- ]);
428
+ })();
432
429
  const leave = () => dirty ? setConfirmDiscard(true) : onClose();
433
430
  return /* @__PURE__ */ jsxs(JsonPathSampleRowsContext.Provider, {
434
431
  value: section === "spans" ? mappingRows : normalizedRows.length ? normalizedRows : sampleRows,
@@ -621,7 +618,9 @@ function ProfileEditor({ client, action, createAction, surfaceKey, initialValue,
621
618
  });
622
619
  }
623
620
  function sectionLabel(section) {
624
- return profileEditorSections.find((entry) => entry.id === section).label;
621
+ const entry = profileEditorSections.find((entry) => entry.id === section);
622
+ if (!entry) throw new Error(`Unknown profile editor section: ${section}`);
623
+ return entry.label;
625
624
  }
626
625
  export { ProfileEditor };
627
626
 
@@ -1 +1 @@
1
- {"version":3,"file":"profileEditor.js","names":["_Fragment"],"sources":["../../../src/profiles/editor/profileEditor.tsx"],"sourcesContent":["import { Button } from \"../../components/button\";\nimport { Workspace } from \"../../layout/Workspace\";\nimport type { WorkspacePaneSpec } from \"../../layout/Workspace\";\nimport { Modal } from \"../../overlay/Modal\";\nimport { useOperationLookupFetcher } from \"../../rpc/operationLookupFetcher\";\nimport type { ResolvedOperation } from \"../../rpc/types\";\nimport type { OperationsApiClient } from \"../../rpc/useOperations\";\nimport { Icon } from \"../../data/Icon\";\nimport { UiListTree, UiPlay, UiTable } from \"../../icons\";\nimport {\n lazy,\n Suspense,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport {\n cloneProfileDraft,\n mergeSampledProfileColumns,\n profileColumnResetState,\n profileEditorSectionStatus,\n profileEditorSections,\n profileGeneralOptionKeys,\n profileSampleSignature,\n profileUpdateConflictTarget,\n resetProfileColumns,\n validateProfileEditorDraft,\n type ProfileEditorSection,\n} from \"./profileEditorModel\";\nimport { ProfileEditorPreview } from \"./profileEditorPreview\";\nimport { ProfileEditorRail } from \"./profileEditorRail\";\nimport { ProfileSaveAsDialog } from \"./profileSaveAsDialog\";\nimport {\n ProfileGeneralSection,\n ProfileSchemaSection,\n ProfileQuerySection,\n ProfileSourceCard,\n} from \"./profileEditorSections\";\nimport { ProfileFieldSidebarList } from \"../fields/profileFieldList\";\nimport {\n ProfileFieldEditorForm,\n profileFieldEditorEmptyMessage,\n} from \"../fields/profileFieldEditor\";\nimport { useProfileFieldState } from \"../fields/profileFieldState\";\nimport type { ProfileSample } from \"../wizard/profileWizardQueryStep\";\nimport { useProfileInspection } from \"../wizard/useProfileInspection\";\nimport {\n profileConnectionID,\n type ProfileColumn,\n type ProfileWizardDraft,\n} from \"../wizard/profileWizardModel\";\nimport { resolveProfileUpdatePath } from \"./profileEditorRoutes\";\nimport {\n ProfileParameterDetail,\n ProfileParameterSidebar,\n} from \"./profileParameterEditor\";\nimport { ProcessorPipeline } from \"../processor/processorPipeline\";\nimport {\n processorCatalog,\n type ProcessorSpec,\n} from \"../processor/processorConfig\";\nimport { profileSchema } from \"../profileApi\";\nimport { profileApiPath } from \"../profileApi\";\nimport { sampleRequestProfile, JsonPathSampleRowsContext } from \"../query/jsonPathSample\";\nimport { defaultSpanColumns } from \"./spanColumns\";\nimport { ProfileSpansSection } from \"./profileSpansSection\";\nimport { useQuery } from \"@tanstack/react-query\";\n\nconst ProfileEditorRaw = lazy(() =>\n import(\"./profileEditorRaw\").then((module) => ({\n default: module.ProfileEditorRaw,\n })),\n);\n\n/** The server answers a failed sample with a JSON diagnostics envelope; its `error` is the message, anything else is shown as sent. */\nfunction sampleErrorMessage(body: string): string {\n try {\n const parsed: unknown = JSON.parse(body);\n if (typeof parsed === \"object\" && parsed !== null && \"error\" in parsed && typeof parsed.error === \"string\") return parsed.error;\n } catch {\n // Not JSON: the body is the message.\n }\n return body;\n}\n\n/** The one request the editor makes to sample a profile: used by the traces source sample and by Run. */\nasync function fetchEditorSample(draft: ProfileWizardDraft): Promise<Omit<ProfileSample, \"sourceDraft\">> {\n const profile = sampleRequestProfile(draft);\n if (!profile) throw new Error(\"Cannot sample a profile without a provider\");\n const response = await fetch(profileApiPath(\"profile/sample\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ profile, params: {}, previewProcessors: true }),\n });\n if (!response.ok) throw new Error(sampleErrorMessage(await response.text()));\n return (await response.json()) as Omit<ProfileSample, \"sourceDraft\">;\n}\n\n/**\n * The profile editor as a route rather than a dialog.\n *\n * Six sections, ~130 discoverable fields and a CEL editor per column outgrew a\n * modal: the layout is a clicky-ui Workspace, so the section rail, the column\n * grid and the sampled preview are panes the user can resize, collapse and keep\n * across visits. Collection fields stay in the rail while the selected item is\n * edited in the center, keeping names and icons visible throughout the edit.\n */\nexport function ProfileEditor({\n client,\n action,\n createAction,\n surfaceKey,\n initialValue,\n onClose,\n onSuccess,\n}: {\n client: OperationsApiClient;\n action: ResolvedOperation;\n /** The profiles collection's create operation; when given, the header offers\n * \"Save as new…\", which saves the draft under a new name and leaves the\n * edited profile as it was. */\n createAction?: ResolvedOperation | undefined;\n surfaceKey: string;\n initialValue: Record<string, unknown>;\n onClose: () => void;\n onSuccess: (name: string) => void | Promise<void>;\n}) {\n const lookupFetcher = useOperationLookupFetcher(client);\n const initialDraft = useMemo(\n () => cloneProfileDraft(initialValue),\n [initialValue],\n );\n const initialSerialized = useMemo(\n () => JSON.stringify(initialDraft),\n [initialDraft],\n );\n const [draft, setDraft] = useState<ProfileWizardDraft>(initialDraft);\n const [section, setSection] = useState<ProfileEditorSection>(initialDraft.render === \"traces\" ? \"spans\" : \"general\");\n const [discovered, setDiscovered] = useState<ProfileColumn[]>(\n initialDraft.render === \"traces\" ? defaultSpanColumns() : initialDraft.columns ?? [],\n );\n const [sampledColumns, setSampledColumns] = useState<ProfileColumn[]>([]);\n const [sampleRows, setSampleRows] = useState<Record<string, unknown>[]>([]);\n const [mappingRows, setMappingRows] = useState<Record<string, unknown>[]>([]);\n const [activeField, setActiveField] = useState(\n initialDraft.columns?.[0]?.name ?? \"\",\n );\n const [activeParameter, setActiveParameter] = useState(0);\n const [activeProcessor, setActiveProcessor] = useState(0);\n const [lastSampleSignature, setLastSampleSignature] = useState(() =>\n profileSampleSignature(initialDraft),\n );\n const [rawValid, setRawValid] = useState(true);\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState(\"\");\n const [replaceTarget, setReplaceTarget] = useState(\"\");\n const [savingAs, setSavingAs] = useState(false);\n const [confirmDiscard, setConfirmDiscard] = useState(false);\n const [confirmResetColumns, setConfirmResetColumns] = useState(false);\n // The Source section's query workspace portals its Run button here, so Run\n // sits beside Save profile and keeps the workspace's own pending/selection state.\n const [runSlot, setRunSlot] = useState<HTMLElement | null>(null);\n const dirty = JSON.stringify(draft) !== initialSerialized;\n const [normalizedRows, setNormalizedRows] = useState<Record<string, unknown>[]>([]);\n const traces = draft.render === \"traces\";\n const validationError = validateProfileEditorDraft(draft);\n const saveBlocked = saving || Boolean(validationError) || (section === \"raw\" && !rawValid);\n const sampleStale = profileSampleSignature(draft) !== lastSampleSignature;\n // The same inspection the Query workspace reads, so the source field pickers\n // and the workspace share one fetch of the index's mapped fields.\n const sourceInspection = useProfileInspection({\n connectionID: profileConnectionID(draft.provider?.connection ?? \"\"),\n providerOptions: draft.provider?.options ?? {},\n });\n const indexFields =\n sourceInspection.inspection.completion?.kind === \"json-fields\"\n ? sourceInspection.inspection.completion.fields\n : [];\n const resetState = traces ? {visible:true, disabled:false, title:\"Reset to default\"} : profileColumnResetState({\n providerType: draft.provider?.type ?? \"\",\n sampledColumnCount: sampledColumns.length,\n sampleStale,\n });\n\n const fields = useProfileFieldState({\n normalizedOnly: traces,\n discovered,\n configured: draft.columns ?? [],\n activeName: activeField,\n onConfiguredChange: (columns) =>\n setDraft((current) => ({ ...current, columns })),\n onActiveNameChange: setActiveField,\n });\n const processors = Array.isArray(draft.processors)\n ? (draft.processors as ProcessorSpec[])\n : [];\n const pipelineCatalog = useMemo(\n () => processorCatalog(profileSchema().properties?.processors),\n [],\n );\n const setProcessors = useCallback(\n (next: ProcessorSpec[]) =>\n setDraft((current) => ({ ...current, processors: next })),\n [],\n );\n\n // A route can be refreshed or navigated away from; the dialog used to guard\n // unsaved edits with confirmClose, so the route has to guard them too.\n useEffect(() => {\n if (!dirty) return;\n const warn = (event: BeforeUnloadEvent) => event.preventDefault();\n window.addEventListener(\"beforeunload\", warn);\n return () => window.removeEventListener(\"beforeunload\", warn);\n }, [dirty]);\n\n const save = async (replaceExisting = false) => {\n if (validationError) {\n setError(validationError);\n return;\n }\n if (!client.submitForm) {\n setError(\"Profile updates are unavailable\");\n return;\n }\n setSaving(true);\n setError(\"\");\n try {\n const body = {\n ...draft,\n id: surfaceKey,\n ...(replaceExisting ? { replaceExisting: true } : {}),\n };\n const response = await client.submitForm(\n resolveProfileUpdatePath(action.path, surfaceKey),\n action.method,\n body,\n );\n if (!response.success) {\n const message =\n response.error || response.message || \"Profile update failed\";\n const target = profileUpdateConflictTarget(message);\n if (target && !replaceExisting) {\n setReplaceTarget(target);\n return;\n }\n throw new Error(message);\n }\n await onSuccess(draft.profile!.trim());\n } catch (saveError) {\n setError(\n saveError instanceof Error\n ? saveError.message\n : \"Profile update failed\",\n );\n } finally {\n setSaving(false);\n }\n };\n\n const acceptSample = useCallback(({ columns, rows, sourceDraft, mappingInputRows }: ProfileSample) => {\n if (!mappingInputRows) throw new Error(\"Sample response is missing mappingInputRows\");\n setMappingRows(mappingInputRows);\n setSampledColumns(structuredClone(columns));\n if (sourceDraft.render !== \"traces\") setDiscovered(columns);\n setSampleRows(rows);\n setDraft((current) => ({\n ...current,\n columns: current.render === \"traces\" ? current.columns ?? defaultSpanColumns() : mergeSampledProfileColumns(current.columns ?? [], columns),\n }));\n setActiveField((current) => current || columns[0]?.name || \"\");\n setLastSampleSignature(profileSampleSignature(sourceDraft));\n }, []);\n\n const sourceSample = useQuery({\n queryKey:[\"profile-editor-source\", profileSampleSignature(initialDraft)],\n enabled:initialDraft.render === \"traces\", staleTime:Infinity, retry:false, refetchOnWindowFocus:false,\n queryFn:() => fetchEditorSample(initialDraft),\n });\n // Run on Columns and Spans: the same request the traces source sample makes,\n // for the draft as it stands, accepted the same way.\n const [sampling, setSampling] = useState(false);\n const runSample = async () => {\n setSampling(true);\n setError(\"\");\n try {\n acceptSample({ ...(await fetchEditorSample(draft)), sourceDraft: draft });\n } catch (sampleError) {\n setError(sampleError instanceof Error ? sampleError.message : \"Sample failed\");\n } finally {\n setSampling(false);\n }\n };\n useEffect(() => {\n if (sourceSample.data) acceptSample({...sourceSample.data,sourceDraft:initialDraft});\n if (sourceSample.error) setError(sourceSample.error.message);\n }, [sourceSample.data,sourceSample.error,initialDraft,acceptSample]);\n\n const acceptNormalized = useCallback((rows: Record<string, unknown>[], columns: ProfileColumn[]) => {\n setNormalizedRows(rows);\n setDiscovered(columns);\n }, []);\n\n const resetColumns = () => {\n const defaults = traces ? defaultSpanColumns() : sampledColumns;\n const first = defaults[0];\n if (!first) throw new Error(\"cannot reset columns without a sample\");\n setDraft((current) => resetProfileColumns(current, defaults));\n setActiveField(first.name);\n setConfirmResetColumns(false);\n };\n\n const sectionContent = (\n <div className=\"@container h-full overflow-auto p-5\">\n {traces && (section === \"spans\" || section === \"columns\") ? <div className=\"mb-4 flex items-center gap-3\">\n <Button type=\"button\" variant=\"outline\" onClick={() => setConfirmResetColumns(true)}>Reset to default</Button>\n {validationError ? <p role=\"alert\" className=\"text-sm text-destructive\">{validationError}</p> : null}\n </div> : null}\n {section === \"general\" ? (\n <div className=\"space-y-4\">\n <ProfileGeneralSection draft={draft} onChange={setDraft} />\n <ProfileSourceCard\n draft={draft}\n // The provider's documents as read, ahead of any processor, are what\n // a source field name or an unwrap rule refers to.\n indexFields={indexFields}\n sampleRows={mappingRows.length ? mappingRows : sampleRows}\n {...(lookupFetcher ? { lookupFetcher } : {})}\n onChange={setDraft}\n />\n <ProfileSchemaSection\n draft={draft}\n keys={profileGeneralOptionKeys}\n title=\"General options\"\n description=\"Compose profiles with imports and aliases, choose the output fields, and ignore values that should not be retained.\"\n idPrefix=\"profile-general-options\"\n {...(lookupFetcher ? { lookupFetcher } : {})}\n onChange={setDraft}\n />\n </div>\n ) : null}\n {section === \"source\" ? (\n <ProfileQuerySection\n draft={draft}\n discovered={discovered}\n sampleStale={sampleStale}\n runSlot={runSlot}\n onChange={setDraft}\n onSample={acceptSample}\n />\n ) : null}\n {section === \"spans\" && traces ? <>\n <ProfileSpansSection draft={draft} rows={mappingRows} normalizedRows={normalizedRows} onChange={setDraft} />\n <details className=\"mt-4\"><summary>Source sample</summary><pre className=\"overflow-auto text-xs\">{JSON.stringify(mappingRows[0] ?? {}, null, 2)}</pre></details>\n </> : null}\n {section === \"columns\" ? (\n fields.activeField ? (\n <section className=\"rounded-xl border bg-card p-5\">\n <div className=\"max-w-6xl\">\n <ProfileFieldEditorForm\n field={fields.activeField}\n onChange={fields.updateActiveField}\n providerType={draft.provider?.type}\n />\n </div>\n </section>\n ) : (\n <div className=\"grid h-full place-items-center text-sm text-muted-foreground\">\n {profileFieldEditorEmptyMessage}\n </div>\n )\n ) : null}\n {section === \"parameters\" ? (\n <ProfileParameterDetail\n draft={draft}\n activeIndex={activeParameter}\n onChange={setDraft}\n />\n ) : null}\n {section === \"processors\" ? (\n <div className=\"max-w-5xl\">\n <ProcessorPipeline\n steps={processors}\n catalog={pipelineCatalog}\n profile={draft}\n selectedIndex={activeProcessor}\n showSteps={false}\n onSelectedIndexChange={setActiveProcessor}\n onChange={setProcessors}\n />\n </div>\n ) : null}\n {section === \"raw\" ? (\n <Suspense\n fallback={\n <p className=\"text-sm text-muted-foreground\">\n Loading YAML editor…\n </p>\n }\n >\n <ProfileEditorRaw\n draft={draft}\n onChange={setDraft}\n onValidityChange={setRawValid}\n />\n </Suspense>\n ) : null}\n </div>\n );\n\n const panes = useMemo<WorkspacePaneSpec[]>(() => {\n const rail: WorkspacePaneSpec = {\n id: \"sections\",\n label: \"Profile\",\n icon: <UiListTree />,\n location: \"left\",\n width: 340,\n minWidth: 280,\n maxWidth: 480,\n content: (\n <ProfileEditorRail\n traces={traces}\n value={section}\n status={profileEditorSectionStatus({\n draft,\n availableColumns: fields.available.length,\n sampleStale,\n })}\n collections={{\n columns: (\n <ProfileFieldSidebarList\n state={fields}\n onFieldSelect={(name) => {\n fields.setActiveName(name);\n setSection(\"columns\");\n }}\n onAdd={() => setSection(\"columns\")}\n {...(resetState.visible\n ? {\n reset: {\n disabled: resetState.disabled,\n title: resetState.title,\n onReset: () => setConfirmResetColumns(true),\n },\n }\n : {})}\n />\n ),\n parameters: (\n <ProfileParameterSidebar\n draft={draft}\n activeIndex={activeParameter}\n onActiveIndexChange={(index) => {\n setActiveParameter(index);\n setSection(\"parameters\");\n }}\n onChange={setDraft}\n />\n ),\n processors: (\n <ProcessorPipeline\n steps={processors}\n catalog={pipelineCatalog}\n profile={draft}\n selectedIndex={activeProcessor}\n showEditor={false}\n tree\n onSelectedIndexChange={(index) => {\n setActiveProcessor(index);\n setSection(\"processors\");\n }}\n onChange={setProcessors}\n />\n ),\n }}\n onChange={setSection}\n />\n ),\n };\n\n const result: WorkspacePaneSpec[] = [\n rail,\n {\n id: \"section\",\n label: sectionLabel(section),\n location: \"center\",\n collapsible: false,\n showHeader: false,\n contentClassName: \"p-0\",\n content: sectionContent,\n },\n ];\n if (section === \"columns\" || section === \"spans\" || (section === \"source\" && draft.search)) {\n result.push({\n id: \"preview\",\n label: \"Preview\",\n icon: <UiTable />,\n location: \"bottom\",\n height: 400,\n minHeightFraction: 0.2,\n maxHeightFraction: 0.8,\n slots: {\n headerTrailing: (\n <span className=\"text-[11px] text-muted-foreground\">\n {sampleRows.length\n ? `${sampleRows.length} sampled rows · updates as you edit`\n : \"No sample yet\"}\n </span>\n ),\n },\n content: (\n <ProfileEditorPreview\n profile={draft}\n columns={draft.columns ?? []}\n rows={mappingRows}\n stale={sampleStale}\n onNormalized={acceptNormalized}\n />\n ),\n });\n }\n return result;\n }, [\n activeParameter,\n activeProcessor,\n draft,\n fields,\n resetState,\n sampleRows,\n mappingRows,\n sampleStale,\n section,\n sectionContent,\n pipelineCatalog,\n processors,\n setProcessors,\n traces,\n acceptNormalized,\n ]);\n\n const leave = () => (dirty ? setConfirmDiscard(true) : onClose());\n\n return (\n <JsonPathSampleRowsContext.Provider value={section === \"spans\" ? mappingRows : normalizedRows.length ? normalizedRows : sampleRows}>\n <div className=\"grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)] bg-background\">\n <header className=\"flex items-center gap-3 border-b border-border px-4 py-2.5\">\n <nav className=\"flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground\">\n <button\n type=\"button\"\n className=\"hover:text-foreground\"\n onClick={leave}\n >\n Profiles\n </button>\n <span>/</span>\n <button\n type=\"button\"\n className=\"min-w-0 truncate hover:text-foreground\"\n onClick={leave}\n >\n {initialDraft.profile ?? surfaceKey}\n </button>\n <span>/</span>\n <span className=\"font-medium text-foreground\">Edit</span>\n </nav>\n {error ? (\n <span className=\"min-w-0 truncate text-sm text-destructive\" title={error}>{error}</span>\n ) : null}\n <span className=\"ml-auto hidden shrink-0 text-xs text-muted-foreground md:block\">\n {dirty ? \"Unsaved changes\" : \"No changes\"}\n </span>\n <Button type=\"button\" size=\"sm\" variant=\"ghost\" onClick={leave}>\n Discard\n </Button>\n {createAction ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={saveBlocked}\n title={validationError ?? undefined}\n onClick={() => setSavingAs(true)}\n >\n Save as new…\n </Button>\n ) : null}\n <span ref={setRunSlot} className=\"contents\" />\n {section === \"columns\" || section === \"spans\" ? (\n <Button\n type=\"button\"\n size=\"sm\"\n disabled={!draft.provider?.type}\n title={draft.provider?.type ? undefined : \"Choose a provider before running a sample\"}\n loading={sampling}\n loadingLabel=\"Running\"\n onClick={() => void runSample()}\n >\n <Icon icon={UiPlay} className=\"size-4\" />\n Run\n </Button>\n ) : null}\n <Button\n type=\"button\"\n size=\"sm\"\n disabled={saveBlocked}\n title={validationError ?? undefined}\n onClick={() => void save()}\n >\n {saving ? \"Saving…\" : \"Save profile\"}\n </Button>\n </header>\n\n <Workspace panes={panes} storageKey=\"profile-editor-v2\" />\n </div>\n\n {confirmDiscard ? (\n <Modal\n open\n onClose={() => setConfirmDiscard(false)}\n title=\"Discard profile changes?\"\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => setConfirmDiscard(false)}\n >\n Keep editing\n </Button>\n <Button type=\"button\" variant=\"destructive\" onClick={onClose}>\n Discard changes\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n Your unsaved profile changes will be lost.\n </p>\n </Modal>\n ) : null}\n\n {confirmResetColumns ? (\n <Modal\n open\n onClose={() => setConfirmResetColumns(false)}\n title={traces ? \"Reset to default?\" : \"Reset columns from latest sample?\"}\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => setConfirmResetColumns(false)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant=\"destructive\"\n disabled={resetState.disabled}\n onClick={resetColumns}\n >\n {traces ? \"Reset to default\" : \"Reset columns\"}\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n Replace {fields.configuredCount} configured column\n {fields.configuredCount === 1 ? \"\" : \"s\"} with{\" \"}\n {traces ? \"the canonical default columns\" : `${sampledColumns.length} columns from the latest sample`}.\n Custom labels, expressions, formatting, filtering, ordering, and\n manually added columns will be removed. The profile will remain\n unsaved until you save it.\n </p>\n </Modal>\n ) : null}\n\n {savingAs && createAction ? (\n <ProfileSaveAsDialog\n client={client}\n action={createAction}\n draft={draft}\n onCancel={() => setSavingAs(false)}\n onSaved={async (name) => {\n await onSuccess(name);\n setSavingAs(false);\n }}\n />\n ) : null}\n\n {replaceTarget ? (\n <Modal\n open\n onClose={() => setReplaceTarget(\"\")}\n title={`Replace ${replaceTarget}?`}\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => setReplaceTarget(\"\")}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant=\"destructive\"\n disabled={saving}\n onClick={() => {\n setReplaceTarget(\"\");\n void save(true);\n }}\n >\n Replace profile\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n A profile named {replaceTarget} already exists. Its definition will\n be overwritten, the current profile will be renamed, and dependent\n imports will be updated atomically.\n </p>\n </Modal>\n ) : null}\n </JsonPathSampleRowsContext.Provider>\n );\n}\n\nfunction sectionLabel(section: ProfileEditorSection): string {\n return profileEditorSections.find((entry) => entry.id === section)!.label;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,IAAM,mBAAmB,WACvB,OAAO,wBAAqB,CAAC,MAAM,YAAY,EAC7C,SAAS,OAAO,iBAClB,EAAE,CACJ;;AAGA,SAAS,mBAAmB,MAAsB;CAChD,IAAI;EACF,MAAM,SAAkB,KAAK,MAAM,IAAI;EACvC,IAAI,OAAO,WAAW,YAAY,WAAW,QAAQ,WAAW,UAAU,OAAO,OAAO,UAAU,UAAU,OAAO,OAAO;CAC5H,QAAQ,CAER;CACA,OAAO;AACT;;AAGA,eAAe,kBAAkB,OAAwE;CACvG,MAAM,UAAU,qBAAq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,MAAK;IACL,QACE,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,oBAAC,QAAD;MACE,MAAK;MACL,SAAQ;MACR,eAAe,iBAAiB,EAAE;MACnC,UAAA;KAEO,CAAA,GACR,oBAAC,QAAD;MACE,MAAK;MACL,SAAQ;MACR,UAAU;MACV,eAAe;OACb,iBAAiB,EAAE;OACnB,KAAU,IAAI;MAChB;MACD,UAAA;KAEO,CAAA,CACL;;IAGP,UAAA,qBAAC,KAAD;KAAG,WAAU;KAAb,UAAA;MAA6C;MAC1B;MAAc;KAG9B;;GACE,CAAA,IACL;EAC8B;;AAExC;AAEA,SAAS,aAAa,SAAuC;CAC3D,OAAO,sBAAsB,MAAM,UAAU,MAAM,OAAO,OAAO,CAAC,CAAE;AACtE"}
1
+ {"version":3,"file":"profileEditor.js","names":["_Fragment"],"sources":["../../../src/profiles/editor/profileEditor.tsx"],"sourcesContent":["import { Button } from \"../../components/button\";\nimport { Workspace } from \"../../layout/Workspace\";\nimport type { WorkspacePaneSpec } from \"../../layout/Workspace\";\nimport { Modal } from \"../../overlay/Modal\";\nimport { useOperationLookupFetcher } from \"../../rpc/operationLookupFetcher\";\nimport type { ResolvedOperation } from \"../../rpc/types\";\nimport type { OperationsApiClient } from \"../../rpc/useOperations\";\nimport { Icon } from \"../../data/Icon\";\nimport { UiListTree, UiPlay, UiTable } from \"../../icons\";\nimport {\n lazy,\n Suspense,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport {\n cloneProfileDraft,\n mergeSampledProfileColumns,\n profileColumnResetState,\n profileEditorSectionStatus,\n profileEditorSections,\n profileGeneralOptionKeys,\n profileSampleSignature,\n profileUpdateConflictTarget,\n resetProfileColumns,\n validateProfileEditorDraft,\n type ProfileEditorSection,\n} from \"./profileEditorModel\";\nimport { ProfileEditorPreview } from \"./profileEditorPreview\";\nimport type { ProfileMappingPreviewStatus } from \"./profileMappingPreview\";\nimport { parseSampleError } from \"./sampleError\";\nimport { ProfileEditorRail } from \"./profileEditorRail\";\nimport { ProfileSaveAsDialog } from \"./profileSaveAsDialog\";\nimport {\n ProfileGeneralSection,\n ProfileSchemaSection,\n ProfileQuerySection,\n ProfileSourceCard,\n} from \"./profileEditorSections\";\nimport { ProfileFieldSidebarList } from \"../fields/profileFieldList\";\nimport {\n ProfileFieldEditorForm,\n profileFieldEditorEmptyMessage,\n} from \"../fields/profileFieldEditor\";\nimport { useProfileFieldState } from \"../fields/profileFieldState\";\nimport type { ProfileSample } from \"../wizard/profileWizardQueryStep\";\nimport { useProfileInspection } from \"../wizard/useProfileInspection\";\nimport {\n profileConnectionID,\n type ProfileColumn,\n type ProfileWizardDraft,\n} from \"../wizard/profileWizardModel\";\nimport { resolveProfileUpdatePath } from \"./profileEditorRoutes\";\nimport {\n ProfileParameterDetail,\n ProfileParameterSidebar,\n} from \"./profileParameterEditor\";\nimport { ProcessorPipeline } from \"../processor/processorPipeline\";\nimport {\n processorCatalog,\n type ProcessorSpec,\n} from \"../processor/processorConfig\";\nimport { profileSchema } from \"../profileApi\";\nimport { profileApiPath } from \"../profileApi\";\nimport { sampleRequestProfile, JsonPathSampleRowsContext } from \"../query/jsonPathSample\";\nimport { defaultSpanColumns } from \"./spanColumns\";\nimport { ProfileSpansSection } from \"./profileSpansSection\";\nimport { useQuery } from \"@tanstack/react-query\";\n\nconst ProfileEditorRaw = lazy(() =>\n import(\"./profileEditorRaw\").then((module) => ({\n default: module.ProfileEditorRaw,\n })),\n);\n\n/** The server answers a failed sample with a JSON diagnostics envelope; its `error` is the message, anything else is shown as sent. */\n/** The Preview pane header's word on the preview, so it never claims \"updates as you edit\" while the preview is failing. */\nconst PREVIEW_STATUS_NOTES: Record<ProfileMappingPreviewStatus, string> = {\n idle: \"not previewed\",\n updating: \"updating…\",\n ready: \"updates as you edit\",\n failed: \"preview failed\",\n};\n\n/** The one request the editor makes to sample a profile: used by the traces source sample and by Run. */\nasync function fetchEditorSample(draft: ProfileWizardDraft): Promise<Omit<ProfileSample, \"sourceDraft\">> {\n const profile = sampleRequestProfile(draft);\n if (!profile) throw new Error(\"Cannot sample a profile without a provider\");\n const response = await fetch(profileApiPath(\"profile/sample\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ profile, params: {}, previewProcessors: true }),\n });\n if (!response.ok) throw new Error(parseSampleError(await response.text()).message);\n return (await response.json()) as Omit<ProfileSample, \"sourceDraft\">;\n}\n\n/**\n * The profile editor as a route rather than a dialog.\n *\n * Six sections, ~130 discoverable fields and a CEL editor per column outgrew a\n * modal: the layout is a clicky-ui Workspace, so the section rail, the column\n * grid and the sampled preview are panes the user can resize, collapse and keep\n * across visits. Collection fields stay in the rail while the selected item is\n * edited in the center, keeping names and icons visible throughout the edit.\n */\nexport function ProfileEditor({\n client,\n action,\n createAction,\n surfaceKey,\n initialValue,\n onClose,\n onSuccess,\n}: {\n client: OperationsApiClient;\n action: ResolvedOperation;\n /** The profiles collection's create operation; when given, the header offers\n * \"Save as new…\", which saves the draft under a new name and leaves the\n * edited profile as it was. */\n createAction?: ResolvedOperation | undefined;\n surfaceKey: string;\n initialValue: Record<string, unknown>;\n onClose: () => void;\n onSuccess: (name: string) => void | Promise<void>;\n}) {\n const lookupFetcher = useOperationLookupFetcher(client);\n const initialDraft = useMemo(\n () => cloneProfileDraft(initialValue),\n [initialValue],\n );\n const initialSerialized = useMemo(\n () => JSON.stringify(initialDraft),\n [initialDraft],\n );\n const [draft, setDraft] = useState<ProfileWizardDraft>(initialDraft);\n const [section, setSection] = useState<ProfileEditorSection>(initialDraft.render === \"traces\" ? \"spans\" : \"general\");\n const [discovered, setDiscovered] = useState<ProfileColumn[]>(\n initialDraft.render === \"traces\" ? defaultSpanColumns() : initialDraft.columns ?? [],\n );\n const [sampledColumns, setSampledColumns] = useState<ProfileColumn[]>([]);\n const [sampleRows, setSampleRows] = useState<Record<string, unknown>[]>([]);\n const [mappingRows, setMappingRows] = useState<Record<string, unknown>[]>([]);\n // The service keeps the sample it took; the preview maps it by this id, so the\n // rows (often megabytes of documents) never travel back on an edit.\n const [sampleId, setSampleId] = useState<string>();\n const [previewStatus, setPreviewStatus] = useState<ProfileMappingPreviewStatus>(\"idle\");\n const [activeField, setActiveField] = useState(\n initialDraft.columns?.[0]?.name ?? \"\",\n );\n const [activeParameter, setActiveParameter] = useState(0);\n const [activeProcessor, setActiveProcessor] = useState(0);\n const [lastSampleSignature, setLastSampleSignature] = useState(() =>\n profileSampleSignature(initialDraft),\n );\n const [rawValid, setRawValid] = useState(true);\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState(\"\");\n const [replaceTarget, setReplaceTarget] = useState(\"\");\n const [savingAs, setSavingAs] = useState(false);\n const [confirmDiscard, setConfirmDiscard] = useState(false);\n const [confirmResetColumns, setConfirmResetColumns] = useState(false);\n // The Source section's query workspace portals its Run button here, so Run\n // sits beside Save profile and keeps the workspace's own pending/selection state.\n const [runSlot, setRunSlot] = useState<HTMLElement | null>(null);\n const dirty = JSON.stringify(draft) !== initialSerialized;\n const [normalizedRows, setNormalizedRows] = useState<Record<string, unknown>[]>([]);\n const traces = draft.render === \"traces\";\n const validationError = validateProfileEditorDraft(draft);\n const saveBlocked = saving || Boolean(validationError) || (section === \"raw\" && !rawValid);\n const sampleStale = profileSampleSignature(draft) !== lastSampleSignature;\n // The same inspection the Query workspace reads, so the source field pickers\n // and the workspace share one fetch of the index's mapped fields.\n const sourceInspection = useProfileInspection({\n connectionID: profileConnectionID(draft.provider?.connection ?? \"\"),\n providerOptions: draft.provider?.options ?? {},\n });\n const indexFields =\n sourceInspection.inspection.completion?.kind === \"json-fields\"\n ? sourceInspection.inspection.completion.fields\n : [];\n const resetState = traces ? {visible:true, disabled:false, title:\"Reset to default\"} : profileColumnResetState({\n providerType: draft.provider?.type ?? \"\",\n sampledColumnCount: sampledColumns.length,\n sampleStale,\n });\n\n const fields = useProfileFieldState({\n normalizedOnly: traces,\n discovered,\n configured: draft.columns ?? [],\n activeName: activeField,\n onConfiguredChange: (columns) =>\n setDraft((current) => ({ ...current, columns })),\n onActiveNameChange: setActiveField,\n });\n const processors = Array.isArray(draft.processors)\n ? (draft.processors as ProcessorSpec[])\n : [];\n const pipelineCatalog = useMemo(\n () => processorCatalog(profileSchema().properties?.processors),\n [],\n );\n const setProcessors = useCallback(\n (next: ProcessorSpec[]) =>\n setDraft((current) => ({ ...current, processors: next })),\n [],\n );\n\n // A route can be refreshed or navigated away from; the dialog used to guard\n // unsaved edits with confirmClose, so the route has to guard them too.\n useEffect(() => {\n if (!dirty) return;\n const warn = (event: BeforeUnloadEvent) => event.preventDefault();\n window.addEventListener(\"beforeunload\", warn);\n return () => window.removeEventListener(\"beforeunload\", warn);\n }, [dirty]);\n\n const save = async (replaceExisting = false) => {\n if (validationError) {\n setError(validationError);\n return;\n }\n if (!client.submitForm) {\n setError(\"Profile updates are unavailable\");\n return;\n }\n setSaving(true);\n setError(\"\");\n try {\n const body = {\n ...draft,\n id: surfaceKey,\n ...(replaceExisting ? { replaceExisting: true } : {}),\n };\n const response = await client.submitForm(\n resolveProfileUpdatePath(action.path, surfaceKey),\n action.method,\n body,\n );\n if (!response.success) {\n const message =\n response.error || response.message || \"Profile update failed\";\n const target = profileUpdateConflictTarget(message);\n if (target && !replaceExisting) {\n setReplaceTarget(target);\n return;\n }\n throw new Error(message);\n }\n await onSuccess(draft.profile!.trim());\n } catch (saveError) {\n setError(\n saveError instanceof Error\n ? saveError.message\n : \"Profile update failed\",\n );\n } finally {\n setSaving(false);\n }\n };\n\n const acceptSample = useCallback(({ columns, rows, sourceDraft, mappingInputRows, sampleId: retained }: ProfileSample) => {\n if (!mappingInputRows) throw new Error(\"Sample response is missing mappingInputRows\");\n if (!retained) throw new Error(\"Sample response is missing sampleId\");\n setMappingRows(mappingInputRows);\n setSampleId(retained);\n setSampledColumns(structuredClone(columns));\n if (sourceDraft.render !== \"traces\") setDiscovered(columns);\n setSampleRows(rows);\n setDraft((current) => ({\n ...current,\n columns: current.render === \"traces\" ? current.columns ?? defaultSpanColumns() : mergeSampledProfileColumns(current.columns ?? [], columns),\n }));\n setActiveField((current) => current || columns[0]?.name || \"\");\n setLastSampleSignature(profileSampleSignature(sourceDraft));\n }, []);\n\n const sourceSample = useQuery({\n queryKey:[\"profile-editor-source\", profileSampleSignature(initialDraft)],\n enabled:initialDraft.render === \"traces\", staleTime:Infinity, retry:false, refetchOnWindowFocus:false,\n queryFn:() => fetchEditorSample(initialDraft),\n });\n // Run on Columns and Spans: the same request the traces source sample makes,\n // for the draft as it stands, accepted the same way.\n const [sampling, setSampling] = useState(false);\n const runSample = async () => {\n if (sampling) return;\n setSampling(true);\n setError(\"\");\n try {\n acceptSample({ ...(await fetchEditorSample(draft)), sourceDraft: draft });\n } catch (sampleError) {\n setError(sampleError instanceof Error ? sampleError.message : \"Sample failed\");\n } finally {\n setSampling(false);\n }\n };\n useEffect(() => {\n if (sourceSample.data) acceptSample({...sourceSample.data,sourceDraft:initialDraft});\n if (sourceSample.error) setError(sourceSample.error.message);\n }, [sourceSample.data,sourceSample.error,initialDraft,acceptSample]);\n\n const acceptNormalized = useCallback((rows: Record<string, unknown>[], columns: ProfileColumn[]) => {\n setNormalizedRows(rows);\n setDiscovered(columns);\n }, []);\n\n const resetColumns = () => {\n const defaults = traces ? defaultSpanColumns() : sampledColumns;\n const first = defaults[0];\n if (!first) throw new Error(\"cannot reset columns without a sample\");\n setDraft((current) => resetProfileColumns(current, defaults));\n setActiveField(first.name);\n setConfirmResetColumns(false);\n };\n\n const sectionContent = (\n <div className=\"@container h-full overflow-auto p-5\">\n {traces && (section === \"spans\" || section === \"columns\") ? <div className=\"mb-4 flex items-center gap-3\">\n <Button type=\"button\" variant=\"outline\" onClick={() => setConfirmResetColumns(true)}>Reset to default</Button>\n {validationError ? <p role=\"alert\" className=\"text-sm text-destructive\">{validationError}</p> : null}\n </div> : null}\n {section === \"general\" ? (\n <div className=\"space-y-4\">\n <ProfileGeneralSection draft={draft} onChange={setDraft} />\n <ProfileSourceCard\n draft={draft}\n // The provider's documents as read, ahead of any processor, are what\n // a source field name or an unwrap rule refers to.\n indexFields={indexFields}\n sampleRows={mappingRows.length ? mappingRows : sampleRows}\n {...(lookupFetcher ? { lookupFetcher } : {})}\n onChange={setDraft}\n />\n <ProfileSchemaSection\n draft={draft}\n keys={profileGeneralOptionKeys}\n title=\"General options\"\n description=\"Compose profiles with imports and aliases, choose the output fields, and ignore values that should not be retained.\"\n idPrefix=\"profile-general-options\"\n {...(lookupFetcher ? { lookupFetcher } : {})}\n onChange={setDraft}\n />\n </div>\n ) : null}\n {section === \"source\" ? (\n <ProfileQuerySection\n draft={draft}\n discovered={discovered}\n sampleStale={sampleStale}\n runSlot={runSlot}\n onChange={setDraft}\n onSample={acceptSample}\n />\n ) : null}\n {section === \"spans\" && traces ? <>\n <ProfileSpansSection draft={draft} rows={mappingRows} normalizedRows={normalizedRows} onChange={setDraft} />\n <details className=\"mt-4\"><summary>Source sample</summary><pre className=\"overflow-auto text-xs\">{JSON.stringify(mappingRows[0] ?? {}, null, 2)}</pre></details>\n </> : null}\n {section === \"columns\" ? (\n fields.activeField ? (\n <section className=\"rounded-xl border bg-card p-5\">\n <div className=\"max-w-6xl\">\n <ProfileFieldEditorForm\n field={fields.activeField}\n onChange={fields.updateActiveField}\n providerType={draft.provider?.type}\n />\n </div>\n </section>\n ) : (\n <div className=\"grid h-full place-items-center text-sm text-muted-foreground\">\n {profileFieldEditorEmptyMessage}\n </div>\n )\n ) : null}\n {section === \"parameters\" ? (\n <ProfileParameterDetail\n draft={draft}\n activeIndex={activeParameter}\n onChange={setDraft}\n />\n ) : null}\n {section === \"processors\" ? (\n <div className=\"max-w-5xl\">\n <ProcessorPipeline\n steps={processors}\n catalog={pipelineCatalog}\n profile={draft}\n selectedIndex={activeProcessor}\n showSteps={false}\n onSelectedIndexChange={setActiveProcessor}\n onChange={setProcessors}\n />\n </div>\n ) : null}\n {section === \"raw\" ? (\n <Suspense\n fallback={\n <p className=\"text-sm text-muted-foreground\">\n Loading YAML editor…\n </p>\n }\n >\n <ProfileEditorRaw\n draft={draft}\n onChange={setDraft}\n onValidityChange={setRawValid}\n />\n </Suspense>\n ) : null}\n </div>\n );\n\n const panes: WorkspacePaneSpec[] = (() => {\n const rail: WorkspacePaneSpec = {\n id: \"sections\",\n label: \"Profile\",\n icon: <UiListTree />,\n location: \"left\",\n width: 340,\n minWidth: 280,\n maxWidth: 480,\n content: (\n <ProfileEditorRail\n traces={traces}\n value={section}\n status={profileEditorSectionStatus({\n draft,\n availableColumns: fields.available.length,\n sampleStale,\n })}\n collections={{\n columns: (\n <ProfileFieldSidebarList\n state={fields}\n onFieldSelect={(name) => {\n fields.setActiveName(name);\n setSection(\"columns\");\n }}\n onAdd={() => setSection(\"columns\")}\n {...(resetState.visible\n ? {\n reset: {\n disabled: resetState.disabled,\n title: resetState.title,\n onReset: () => setConfirmResetColumns(true),\n },\n }\n : {})}\n />\n ),\n parameters: (\n <ProfileParameterSidebar\n draft={draft}\n activeIndex={activeParameter}\n onActiveIndexChange={(index) => {\n setActiveParameter(index);\n setSection(\"parameters\");\n }}\n onChange={setDraft}\n />\n ),\n processors: (\n <ProcessorPipeline\n steps={processors}\n catalog={pipelineCatalog}\n profile={draft}\n selectedIndex={activeProcessor}\n showEditor={false}\n tree\n onSelectedIndexChange={(index) => {\n setActiveProcessor(index);\n setSection(\"processors\");\n }}\n onChange={setProcessors}\n />\n ),\n }}\n onChange={setSection}\n />\n ),\n };\n\n const result: WorkspacePaneSpec[] = [\n rail,\n {\n id: \"section\",\n label: sectionLabel(section),\n location: \"center\",\n collapsible: false,\n showHeader: false,\n contentClassName: \"p-0\",\n content: sectionContent,\n },\n ];\n if (section === \"columns\" || section === \"spans\" || (section === \"source\" && draft.search)) {\n result.push({\n id: \"preview\",\n label: \"Preview\",\n icon: <UiTable />,\n location: \"bottom\",\n height: 400,\n minHeightFraction: 0.2,\n maxHeightFraction: 0.8,\n slots: {\n headerTrailing: (\n <span className=\"text-[11px] text-muted-foreground\">\n {sampleId\n ? `${mappingRows.length} sampled rows · ${PREVIEW_STATUS_NOTES[previewStatus]}`\n : \"No sample yet\"}\n </span>\n ),\n },\n content: (\n <ProfileEditorPreview\n profile={draft}\n columns={draft.columns ?? []}\n rows={mappingRows}\n sampleId={sampleId}\n stale={sampleStale}\n onNormalized={acceptNormalized}\n onSampleExpired={() => void runSample()}\n onSelectColumn={(name) => {\n fields.setActiveName(name);\n setSection(\"columns\");\n }}\n onStatusChange={setPreviewStatus}\n />\n ),\n });\n }\n return result;\n })();\n\n const leave = () => (dirty ? setConfirmDiscard(true) : onClose());\n\n return (\n <JsonPathSampleRowsContext.Provider value={section === \"spans\" ? mappingRows : normalizedRows.length ? normalizedRows : sampleRows}>\n <div className=\"grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)] bg-background\">\n <header className=\"flex items-center gap-3 border-b border-border px-4 py-2.5\">\n <nav className=\"flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground\">\n <button\n type=\"button\"\n className=\"hover:text-foreground\"\n onClick={leave}\n >\n Profiles\n </button>\n <span>/</span>\n <button\n type=\"button\"\n className=\"min-w-0 truncate hover:text-foreground\"\n onClick={leave}\n >\n {initialDraft.profile ?? surfaceKey}\n </button>\n <span>/</span>\n <span className=\"font-medium text-foreground\">Edit</span>\n </nav>\n {error ? (\n <span className=\"min-w-0 truncate text-sm text-destructive\" title={error}>{error}</span>\n ) : null}\n <span className=\"ml-auto hidden shrink-0 text-xs text-muted-foreground md:block\">\n {dirty ? \"Unsaved changes\" : \"No changes\"}\n </span>\n <Button type=\"button\" size=\"sm\" variant=\"ghost\" onClick={leave}>\n Discard\n </Button>\n {createAction ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={saveBlocked}\n title={validationError ?? undefined}\n onClick={() => setSavingAs(true)}\n >\n Save as new…\n </Button>\n ) : null}\n <span ref={setRunSlot} className=\"contents\" />\n {section === \"columns\" || section === \"spans\" ? (\n <Button\n type=\"button\"\n size=\"sm\"\n disabled={!draft.provider?.type}\n title={draft.provider?.type ? undefined : \"Choose a provider before running a sample\"}\n loading={sampling}\n loadingLabel=\"Running\"\n onClick={() => void runSample()}\n >\n <Icon icon={UiPlay} className=\"size-4\" />\n Run\n </Button>\n ) : null}\n <Button\n type=\"button\"\n size=\"sm\"\n disabled={saveBlocked}\n title={validationError ?? undefined}\n onClick={() => void save()}\n >\n {saving ? \"Saving…\" : \"Save profile\"}\n </Button>\n </header>\n\n <Workspace panes={panes} storageKey=\"profile-editor-v2\" />\n </div>\n\n {confirmDiscard ? (\n <Modal\n open\n onClose={() => setConfirmDiscard(false)}\n title=\"Discard profile changes?\"\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => setConfirmDiscard(false)}\n >\n Keep editing\n </Button>\n <Button type=\"button\" variant=\"destructive\" onClick={onClose}>\n Discard changes\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n Your unsaved profile changes will be lost.\n </p>\n </Modal>\n ) : null}\n\n {confirmResetColumns ? (\n <Modal\n open\n onClose={() => setConfirmResetColumns(false)}\n title={traces ? \"Reset to default?\" : \"Reset columns from latest sample?\"}\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => setConfirmResetColumns(false)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant=\"destructive\"\n disabled={resetState.disabled}\n onClick={resetColumns}\n >\n {traces ? \"Reset to default\" : \"Reset columns\"}\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n Replace {fields.configuredCount} configured column\n {fields.configuredCount === 1 ? \"\" : \"s\"} with{\" \"}\n {traces ? \"the canonical default columns\" : `${sampledColumns.length} columns from the latest sample`}.\n Custom labels, expressions, formatting, filtering, ordering, and\n manually added columns will be removed. The profile will remain\n unsaved until you save it.\n </p>\n </Modal>\n ) : null}\n\n {savingAs && createAction ? (\n <ProfileSaveAsDialog\n client={client}\n action={createAction}\n draft={draft}\n onCancel={() => setSavingAs(false)}\n onSaved={async (name) => {\n await onSuccess(name);\n setSavingAs(false);\n }}\n />\n ) : null}\n\n {replaceTarget ? (\n <Modal\n open\n onClose={() => setReplaceTarget(\"\")}\n title={`Replace ${replaceTarget}?`}\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => setReplaceTarget(\"\")}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant=\"destructive\"\n disabled={saving}\n onClick={() => {\n setReplaceTarget(\"\");\n void save(true);\n }}\n >\n Replace profile\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n A profile named {replaceTarget} already exists. Its definition will\n be overwritten, the current profile will be renamed, and dependent\n imports will be updated atomically.\n </p>\n </Modal>\n ) : null}\n </JsonPathSampleRowsContext.Provider>\n );\n}\n\nfunction sectionLabel(section: ProfileEditorSection): string {\n const entry = profileEditorSections.find((entry) => entry.id === section);\n if (!entry) throw new Error(`Unknown profile editor section: ${section}`);\n return entry.label;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,IAAM,mBAAmB,WACvB,OAAO,wBAAqB,CAAC,MAAM,YAAY,EAC7C,SAAS,OAAO,iBAClB,EAAE,CACJ;;;AAIA,IAAM,uBAAoE;CACxE,MAAM;CACN,UAAU;CACV,OAAO;CACP,QAAQ;AACV;;AAGA,eAAe,kBAAkB,OAAwE;CACvG,MAAM,UAAU,qBAAqB,KAAK;CAC1C,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,4CAA4C;CAC1E,MAAM,WAAW,MAAM,MAAM,eAAe,gBAAgB,GAAG;EAC7D,QAAQ;EACR,SAAS,EAAE,gBAAgB,mBAAmB;EAC9C,MAAM,KAAK,UAAU;GAAE;GAAS,QAAQ,CAAC;GAAG,mBAAmB;EAAK,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AChC,MAAK;IACL,QACE,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,oBAAC,QAAD;MACE,MAAK;MACL,SAAQ;MACR,eAAe,iBAAiB,EAAE;MACnC,UAAA;KAEO,CAAA,GACR,oBAAC,QAAD;MACE,MAAK;MACL,SAAQ;MACR,UAAU;MACV,eAAe;OACb,iBAAiB,EAAE;OACnB,KAAU,IAAI;MAChB;MACD,UAAA;KAEO,CAAA,CACL;;IAGP,UAAA,qBAAC,KAAD;KAAG,WAAU;KAAb,UAAA;MAA6C;MAC1B;MAAc;KAG9B;;GACE,CAAA,IACL;EAC8B;;AAExC;AAEA,SAAS,aAAa,SAAuC;CAC3D,MAAM,QAAQ,sBAAsB,MAAM,UAAU,MAAM,OAAO,OAAO;CACxE,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,mCAAmC,SAAS;CACxE,OAAO,MAAM;AACf"}
@@ -8,30 +8,16 @@ let react = require("react");
8
8
  let react_jsx_runtime = require("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__ */ (0, react_jsx_runtime.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__ */ (0, react_jsx_runtime.jsx)(require_profileMappingPreview.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__ */ (0, react_jsx_runtime.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] = (0, react.useState)(NO_FILTERS);
49
36
  const filtered = useFilteredSample({
50
37
  profile,
51
38
  selection
52
39
  });
53
- (0, react.useEffect)(() => setSelection(NO_FILTERS), [rows]);
40
+ (0, react.useEffect)(() => setSelection(NO_FILTERS), [sampleId]);
41
+ const expired = filtered.sampleId ? filtered.refresh : onSampleExpired;
54
42
  const lookupValues = (0, react.useCallback)((request) => require_profileSampleFilterLookup.lookupProfileSampleFilterValues({
55
43
  draft: profile,
56
44
  params: {},
@@ -65,27 +53,38 @@ function FilterableTablePreview({ profile, rows }) {
65
53
  children: [filtered.error ? /* @__PURE__ */ (0, react_jsx_runtime.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__ */ (0, react_jsx_runtime.jsx)(require_profileMappingPreview.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] = (0, react.useState)({
86
- rows: null,
83
+ sampleId: null,
87
84
  error: ""
88
85
  });
86
+ const [attempt, setAttempt] = (0, react.useState)(0);
87
+ const refresh = (0, react.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 = (0, react.useRef)(profile);
@@ -93,17 +92,18 @@ function useFilteredSample({ profile, selection }) {
93
92
  (0, react.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 = require_jsonPathSample.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
  exports.ProfileEditorPreview = ProfileEditorPreview;
150
151
 
@@ -1 +1 @@
1
- {"version":3,"file":"profileEditorPreview.cjs","names":["ProfileMappingPreview","useState","useCallback","lookupProfileSampleFilterValues","useRef","sampleRequestProfile","profileApiPath","debugCaptureHeaders"],"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,IAA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AM,CAAC;IAAG,OAAO;GAAkD,CAAC;GACxF,SAAS;IAAE,MAAM,SAAS;IAAkB,OAAO;GAAG,CAAC;EACzD,IACC,UAAmB;GAClB,IAAI,SAAS,SAAS;IAAE,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.cjs","names":["ProfileMappingPreview","useState","useCallback","lookupProfileSampleFilterValues","useRef","sampleRequestProfile","profileApiPath","debugCaptureHeaders"],"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,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EAAG,MAAK;EAAS,UAAA;CAGd,CAAA;CAEP,IAAI,QAAQ,WAAW,UACrB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,8BAAAA,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,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EAAG,WAAU;EACV,UAAA,WAAW,2CAA2C;CACtD,CAAA;CAGP,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAD;EAAiC;EAAmB;EAAU,GAAI;CAAiB,CAAA;AAC5F;AAEA,SAAS,uBAAuB,EAC9B,SACA,UACA,iBACA,GAAG,aAIuC;CAC1C,MAAM,CAAC,WAAW,iBAAA,GAAgBC,MAAAA,SAAAA,CAAS,UAAU;CACrD,MAAM,WAAW,kBAAkB;EAAE;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AAA,OAAAA,CAAO,OAAO;CAC5B,MAAM,UAAU;CAEhB,CAAA,GAAA,MAAA,UAAA,OAAgB;EACd,IAAI,CAAC,QAAQ;GACX,SAAS;IAAE,UAAU;IAAM,OAAO;GAAG,CAAC;GACtC;EACF;EACA,MAAM,UAAU,UAAkB,UAAU,cAAc;GAAE,GAAG;GAAU;EAAM,EAAE;EACjF,MAAM,UAAUC,uBAAAA,qBAAqB,MAAM,OAAO;EAClD,IAAI,CAAC,SAAS;GACZ,OAAO,qCAAqC;GAC5C;EACF;EACA,IAAI,UAAU;EACd,UAAU,cAAc;GAAE,GAAG;GAAU,OAAO;EAAG,EAAE;EACnD,+BAAA,UAAiCC,mBAAAA,eAAe,gBAAgB,GAAG;GACjE,QAAQ;GACR,SAAS;IAAE,gBAAgB;IAAoB,GAAGC,2BAAAA,oBAAoB;GAAE;GACxE,MAAM,KAAK,UAAU;IACnB,SAAS;IACT,QAAQ,CAAC;IACT,mBAAmB;IAGnB,eAAe,MAAM,QAAQ,WAAW,CAAC;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"}
@@ -1,11 +1,14 @@
1
+ import { ComponentProps } from 'react';
1
2
  import { ProfileColumn, ProfileWizardDraft } from '../wizard/profileWizardModel.js';
3
+ import { ProfileMappingPreview } from './profileMappingPreview.js';
2
4
  /**
3
5
  * The draft's results as the saved profile's page will show them, so the effect
4
6
  * of including a field, relabelling it, typing it or hiding it is visible
5
7
  * without leaving the editor.
6
8
  *
7
9
  * The rows are the sample's source rows, not a client-side projection of them:
8
- * the profile service maps them through the draft's columns and renders the same
10
+ * the profile service keeps the sample it took, maps it by id through the
11
+ * draft's columns, so the rows never travel back, and renders the same
9
12
  * clicky document it serves the saved profile's results page, which this shows
10
13
  * with the same Clicky component — a key_values column is tag pills, a datetime
11
14
  * is a timestamp, a duration is a duration. Rows only exist after a sample runs —
@@ -15,14 +18,16 @@ import { ProfileColumn, ProfileWizardDraft } from '../wizard/profileWizardModel.
15
18
  * the backend's, so applying one samples again with it; the rows are never
16
19
  * filtered in the browser.
17
20
  */
18
- export declare function ProfileEditorPreview({ columns, rows, profile, stale, onNormalized, }: {
21
+ type PreviewCallbacks = Pick<ComponentProps<typeof ProfileMappingPreview>, "onNormalized" | "onSampleExpired" | "onSelectColumn" | "onStatusChange">;
22
+ export declare function ProfileEditorPreview({ columns, rows, sampleId, profile, stale, ...callbacks }: {
19
23
  columns: ProfileColumn[];
20
24
  /** The sample's source rows, ahead of the draft's column mapping. */
21
25
  rows: Record<string, unknown>[];
26
+ /** The id the service retained those rows under: what the preview maps. */
27
+ sampleId: string | undefined;
22
28
  /** The draft being edited: its columns, aliases and filters are what the rows are mapped through. */
23
29
  profile: ProfileWizardDraft;
24
30
  stale?: boolean;
25
- /** Receives the span-normalised rows and columns of a traces profile. */
26
- onNormalized?: (rows: Record<string, unknown>[], columns: ProfileColumn[]) => void;
27
- }): import("react").JSX.Element;
31
+ } & PreviewCallbacks): import("react").JSX.Element;
32
+ export {};
28
33
  //# sourceMappingURL=profileEditorPreview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"profileEditorPreview.d.ts","sourceRoot":"","sources":["../../../src/profiles/editor/profileEditorPreview.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAKvE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,IAAI,EACJ,OAAO,EACP,KAAa,EACb,YAAY,GACb,EAAE;IACD,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,qGAAqG;IACrG,OAAO,EAAE,kBAAkB,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yEAAyE;IACzE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;CACpF,+BAoBA"}
1
+ {"version":3,"file":"profileEditorPreview.d.ts","sourceRoot":"","sources":["../../../src/profiles/editor/profileEditorPreview.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAQtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAIhE;;;;;;;;;;;;;;;;GAgBG;AACH,KAAK,gBAAgB,GAAG,IAAI,CAC1B,cAAc,CAAC,OAAO,qBAAqB,CAAC,EAC5C,cAAc,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,gBAAgB,CACzE,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,KAAa,EACb,GAAG,SAAS,EACb,EAAE;IACD,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACh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