@parca/profile 0.19.140 → 0.19.142

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 (253) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/dist/GraphTooltipArrow/Content.js +224 -30
  3. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
  4. package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
  5. package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
  6. package/dist/GraphTooltipArrow/index.js +86 -56
  7. package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
  8. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.d.ts.map +1 -1
  9. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +104 -72
  10. package/dist/MatchersInput/SuggestionItem.js +91 -12
  11. package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
  12. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  13. package/dist/MatchersInput/SuggestionsList.js +371 -157
  14. package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
  15. package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
  16. package/dist/MatchersInput/index.js +308 -115
  17. package/dist/MetricsCircle/index.js +39 -3
  18. package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
  19. package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
  20. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  21. package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
  22. package/dist/MetricsGraph/index.js +552 -203
  23. package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
  24. package/dist/MetricsGraph/utils/colorMapping.js +24 -17
  25. package/dist/MetricsSeries/index.js +70 -7
  26. package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
  27. package/dist/PreSelectedMatchers/index.js +249 -102
  28. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
  29. package/dist/ProfileExplorer/ProfileExplorerCompare.js +241 -45
  30. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  31. package/dist/ProfileExplorer/index.js +183 -32
  32. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  33. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  34. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts +2 -2
  35. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts.map +1 -1
  36. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  37. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  38. package/dist/ProfileFlameChart/index.d.ts.map +1 -1
  39. package/dist/ProfileFlameChart/index.js +267 -129
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.d.ts.map +1 -1
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +288 -89
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +72 -47
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  55. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  56. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  57. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  58. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  59. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  60. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  61. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  62. package/dist/ProfileFlameGraph/index.d.ts.map +1 -1
  63. package/dist/ProfileFlameGraph/index.js +324 -150
  64. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  65. package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
  66. package/dist/ProfileMetricsGraph/index.js +519 -258
  67. package/dist/ProfileSelector/CompareButton.js +132 -12
  68. package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
  69. package/dist/ProfileSelector/MetricsGraphSection.js +236 -64
  70. package/dist/ProfileSelector/index.d.ts.map +1 -1
  71. package/dist/ProfileSelector/index.js +727 -141
  72. package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
  73. package/dist/ProfileSource.js +230 -163
  74. package/dist/ProfileTypeSelector/index.js +214 -125
  75. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  76. package/dist/ProfileView/components/ActionButtons/SortByDropdown.d.ts.map +1 -1
  77. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +141 -35
  78. package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -1
  79. package/dist/ProfileView/components/ColorStackLegend.js +185 -55
  80. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  81. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  82. package/dist/ProfileView/components/DiffLegend.js +172 -29
  83. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  84. package/dist/ProfileView/components/InvertCallStack/index.d.ts.map +1 -1
  85. package/dist/ProfileView/components/InvertCallStack/index.js +100 -12
  86. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  87. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  88. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  89. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts +2 -1
  90. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -1
  91. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -118
  92. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  93. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  94. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  95. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  96. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +678 -194
  97. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  98. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -1
  99. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +199 -157
  100. package/dist/ProfileView/components/Toolbars/index.d.ts +2 -2
  101. package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
  102. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  103. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  104. package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
  105. package/dist/ProfileView/components/ViewSelector/index.js +212 -86
  106. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  107. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  108. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  109. package/dist/ProfileView/context/DashboardContext.d.ts.map +1 -1
  110. package/dist/ProfileView/context/DashboardContext.js +85 -29
  111. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  112. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  113. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  114. package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts.map +1 -1
  115. package/dist/ProfileView/hooks/useResetFlameGraphState.js +32 -12
  116. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -1
  117. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
  118. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.d.ts.map +1 -1
  119. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +40 -19
  120. package/dist/ProfileView/hooks/useVisualizationState.d.ts +3 -3
  121. package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
  122. package/dist/ProfileView/hooks/useVisualizationState.js +258 -67
  123. package/dist/ProfileView/index.js +383 -45
  124. package/dist/ProfileView/types/visualization.js +1 -13
  125. package/dist/ProfileView/utils/colorUtils.js +8 -7
  126. package/dist/ProfileViewWithData.d.ts.map +1 -1
  127. package/dist/ProfileViewWithData.js +332 -228
  128. package/dist/QueryControls/index.js +418 -47
  129. package/dist/Sandwich/components/CalleesSection.js +54 -4
  130. package/dist/Sandwich/components/CallersSection.js +97 -27
  131. package/dist/Sandwich/components/TableSection.js +77 -4
  132. package/dist/Sandwich/index.d.ts.map +1 -1
  133. package/dist/Sandwich/index.js +126 -14
  134. package/dist/Sandwich/utils/processRowData.js +48 -39
  135. package/dist/SelectWithRefresh/index.js +102 -28
  136. package/dist/SimpleMatchers/Select.js +520 -187
  137. package/dist/SimpleMatchers/index.js +590 -288
  138. package/dist/SourceView/Highlighter.js +230 -70
  139. package/dist/SourceView/LineNo.js +72 -17
  140. package/dist/SourceView/index.d.ts.map +1 -1
  141. package/dist/SourceView/index.js +178 -104
  142. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  143. package/dist/SourceView/lang-detector/index.js +28 -14
  144. package/dist/SourceView/useSelectedLineRange.d.ts.map +1 -1
  145. package/dist/SourceView/useSelectedLineRange.js +99 -23
  146. package/dist/Table/ColorCell.js +42 -1
  147. package/dist/Table/ColumnsVisibility.js +114 -6
  148. package/dist/Table/MoreDropdown.d.ts.map +1 -1
  149. package/dist/Table/MoreDropdown.js +122 -25
  150. package/dist/Table/TableContextMenu.d.ts.map +1 -1
  151. package/dist/Table/TableContextMenu.js +151 -137
  152. package/dist/Table/TableContextMenuWrapper.js +59 -14
  153. package/dist/Table/hooks/useColorManagement.js +58 -16
  154. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  155. package/dist/Table/hooks/useTableConfiguration.js +333 -169
  156. package/dist/Table/index.d.ts.map +1 -1
  157. package/dist/Table/index.js +222 -128
  158. package/dist/Table/utils/functions.js +169 -144
  159. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  160. package/dist/TimelineGuide/index.js +209 -16
  161. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  162. package/dist/TopTable/index.d.ts.map +1 -1
  163. package/dist/TopTable/index.js +342 -123
  164. package/dist/contexts/LabelsQueryProvider.js +94 -32
  165. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  166. package/dist/contexts/utils.js +37 -15
  167. package/dist/hooks/useCompareModeMeta.d.ts.map +1 -1
  168. package/dist/hooks/useCompareModeMeta.js +158 -64
  169. package/dist/hooks/useLabels.js +295 -52
  170. package/dist/hooks/useQueryState.d.ts +3 -3
  171. package/dist/hooks/useQueryState.d.ts.map +1 -1
  172. package/dist/hooks/useQueryState.js +373 -332
  173. package/dist/index.d.ts +2 -3
  174. package/dist/index.d.ts.map +1 -1
  175. package/dist/index.js +22 -8
  176. package/dist/testdata/fg-diff.json +3750 -0
  177. package/dist/testdata/fg-simple.json +1879 -0
  178. package/dist/testdata/link_data.json +56 -0
  179. package/dist/testdata/tabular.json +30 -0
  180. package/dist/testdata/test_flamegraph.json +26846 -0
  181. package/dist/testdata/test_graph.json +53 -0
  182. package/dist/useDelayedLoader.js +32 -18
  183. package/dist/useGrpcQuery/index.js +71 -11
  184. package/dist/useHasProfileData.js +90 -12
  185. package/dist/useQuery.js +205 -64
  186. package/dist/useSumBy.d.ts +1 -1
  187. package/dist/useSumBy.d.ts.map +1 -1
  188. package/dist/useSumBy.js +294 -138
  189. package/dist/utils.js +62 -30
  190. package/package.json +9 -10
  191. package/src/GraphTooltipArrow/index.tsx +3 -0
  192. package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +13 -11
  193. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  194. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  195. package/src/MatchersInput/index.tsx +1 -1
  196. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  197. package/src/PreSelectedMatchers/index.tsx +3 -0
  198. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +9 -4
  199. package/src/ProfileFlameChart/SamplesStrips/index.tsx +2 -2
  200. package/src/ProfileFlameChart/index.tsx +28 -21
  201. package/src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx +9 -10
  202. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +6 -5
  203. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  204. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  205. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  206. package/src/ProfileFlameGraph/index.tsx +9 -6
  207. package/src/ProfileMetricsGraph/index.tsx +8 -6
  208. package/src/ProfileSelector/MetricsGraphSection.tsx +10 -5
  209. package/src/ProfileSelector/index.tsx +61 -39
  210. package/src/ProfileView/components/ActionButtons/SortByDropdown.tsx +6 -10
  211. package/src/ProfileView/components/ColorStackLegend.tsx +4 -2
  212. package/src/ProfileView/components/InvertCallStack/index.tsx +4 -5
  213. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.tsx +192 -94
  214. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +21 -21
  215. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +28 -24
  216. package/src/ProfileView/components/Toolbars/TableColumnsDropdown.tsx +5 -4
  217. package/src/ProfileView/components/Toolbars/index.tsx +3 -3
  218. package/src/ProfileView/components/ViewSelector/index.tsx +16 -9
  219. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  220. package/src/ProfileView/context/DashboardContext.tsx +6 -6
  221. package/src/ProfileView/hooks/useResetFlameGraphState.ts +4 -6
  222. package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +26 -24
  223. package/src/ProfileView/hooks/useResetStateOnSeriesChange.ts +8 -16
  224. package/src/ProfileView/hooks/useVisualizationState.ts +69 -61
  225. package/src/ProfileViewWithData.tsx +35 -29
  226. package/src/Sandwich/index.tsx +3 -4
  227. package/src/SourceView/index.tsx +2 -4
  228. package/src/SourceView/useSelectedLineRange.ts +19 -34
  229. package/src/Table/MoreDropdown.tsx +11 -9
  230. package/src/Table/TableContextMenu.tsx +13 -10
  231. package/src/Table/hooks/useTableConfiguration.tsx +11 -16
  232. package/src/Table/index.tsx +21 -12
  233. package/src/TopTable/index.tsx +4 -3
  234. package/src/hooks/useCompareModeMeta.ts +91 -61
  235. package/src/hooks/useQueryState.test.tsx +345 -275
  236. package/src/hooks/useQueryState.ts +118 -136
  237. package/src/index.tsx +15 -16
  238. package/src/useDelayedLoader.ts +10 -10
  239. package/src/useSumBy.ts +15 -21
  240. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
  241. package/dist/hooks/urlParsers.d.ts +0 -18
  242. package/dist/hooks/urlParsers.d.ts.map +0 -1
  243. package/dist/hooks/urlParsers.js +0 -32
  244. package/dist/hooks/useColorBy.d.ts +0 -5
  245. package/dist/hooks/useColorBy.d.ts.map +0 -1
  246. package/dist/hooks/useColorBy.js +0 -26
  247. package/dist/hooks/useDashboardItems.d.ts +0 -5
  248. package/dist/hooks/useDashboardItems.d.ts.map +0 -1
  249. package/dist/hooks/useDashboardItems.js +0 -27
  250. package/dist/hooks/useQueryState.test.js +0 -868
  251. package/src/hooks/urlParsers.ts +0 -38
  252. package/src/hooks/useColorBy.ts +0 -42
  253. package/src/hooks/useDashboardItems.ts +0 -46
@@ -1,4 +1,16 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
13
+ import { c as _c } from "react-compiler-runtime";
2
14
  // Copyright 2022 The Parca Authors
3
15
  // Licensed under the Apache License, Version 2.0 (the "License");
4
16
  // you may not use this file except in compliance with the License.
@@ -11,6 +23,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
11
23
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
24
  // See the License for the specific language governing permissions and
13
25
  // limitations under the License.
26
+
14
27
  import { useRef, useState } from 'react';
15
28
  import { Switch } from '@headlessui/react';
16
29
  import { Button, DateTimeRangePicker, useParcaContext } from '@parca/components';
@@ -21,50 +34,408 @@ import ProfileTypeSelector from '../ProfileTypeSelector';
21
34
  import { SelectWithRefresh } from '../SelectWithRefresh';
22
35
  import SimpleMatchers from '../SimpleMatchers/';
23
36
  import { useLabelNames } from '../hooks/useLabels';
24
- export function QueryControls({ profileType, timeRangeSelection, setTimeRangeSelection, setQueryExpression, searchDisabled, showProfileTypeSelector = false, showSumBySelector = false, showAdvancedMode = true, profileTypesData, profileTypesLoading = false, selectedProfileName, setProfileName, profileTypesError, externalProfilerComponent, setQueryBrowserMode, advancedModeForQueryBrowser = false, setAdvancedModeForQueryBrowser, queryBrowserRef, labels = [], sumBySelection = [], sumBySelectionLoading = false, setUserSumBySelection, sumByRef, queryClient, draftSelection, setDraftMatchers, draftParsedQuery, commitDraft, }) {
25
- const { timezone } = useParcaContext();
26
- const defaultQueryBrowserRef = useRef(null);
27
- const actualQueryBrowserRef = queryBrowserRef ?? defaultQueryBrowserRef;
28
- const [searchExecutedTimestamp, setSearchExecutedTimestamp] = useState(0);
29
- const { refetch: refetchLabelNames } = useLabelNames(queryClient, profileType, timeRangeSelection.getFromMs(), timeRangeSelection.getToMs());
30
- return (_jsxs("div", { className: "flex w-full flex-wrap items-start gap-2", ...testId(TEST_IDS.QUERY_CONTROLS_CONTAINER), children: [showProfileTypeSelector && (_jsxs("div", { children: [_jsx("label", { className: "text-xs", ...testId(TEST_IDS.PROFILE_TYPE_LABEL), children: "Profile type" }), _jsx(ProfileTypeSelector, { profileTypesData: profileTypesData, loading: profileTypesLoading, selectedKey: selectedProfileName, onSelection: setProfileName ?? (() => { }), error: profileTypesError, disabled: externalProfilerComponent?.disableProfileTypesDropdown })] })), _jsxs("div", { className: "w-full flex-1 flex flex-col gap-1 mt-auto", ref: actualQueryBrowserRef, ...testId(TEST_IDS.QUERY_BROWSER_CONTAINER), children: [_jsx("div", { className: "flex items-center justify-between", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("label", { className: "text-xs", ...testId(TEST_IDS.QUERY_LABEL), children: "Query" }), showAdvancedMode && externalProfilerComponent?.disableExplorativeQuerying !== true && (_jsxs(_Fragment, { children: [_jsxs(Switch, { checked: advancedModeForQueryBrowser, onChange: () => {
31
- setAdvancedModeForQueryBrowser?.(!advancedModeForQueryBrowser);
32
- setQueryBrowserMode?.(advancedModeForQueryBrowser ? 'simple' : 'advanced');
33
- }, className: `${advancedModeForQueryBrowser ? 'bg-indigo-600' : 'bg-gray-400 dark:bg-gray-800'} relative inline-flex h-[20px] w-[44px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white/75`, ...testId(TEST_IDS.ADVANCED_MODE_SWITCH), children: [_jsx("span", { className: "sr-only", children: "Use setting" }), _jsx("span", { "aria-hidden": "true", className: `${advancedModeForQueryBrowser ? 'translate-x-6' : 'translate-x-0'} pointer-events-none inline-block h-[16px] w-[16px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out` })] }), _jsx("label", { className: "text-xs", ...testId(TEST_IDS.QUERY_MODE_LABEL), children: "Advanced Mode" })] }))] }) }), externalProfilerComponent?.configuredLabelNames !== undefined &&
34
- externalProfilerComponent?.configuredLabelNames.length >= 1 ? (_jsx(PreSelectedMatchers, { labelNames: externalProfilerComponent.configuredLabelNames })) : showAdvancedMode && advancedModeForQueryBrowser ? (_jsx(MatchersInput, { setDraftMatchers: setDraftMatchers, draftParsedQuery: draftParsedQuery, commitDraft: commitDraft })) : (_jsx(SimpleMatchers, { queryBrowserRef: actualQueryBrowserRef, searchExecutedTimestamp: searchExecutedTimestamp, draftSelection: draftSelection, setDraftMatchers: setDraftMatchers, draftParsedQuery: draftParsedQuery }))] }), showSumBySelector && (_jsxs("div", { ...testId(TEST_IDS.SUM_BY_CONTAINER), children: [_jsx("div", { className: "mb-0.5 mt-1.5 flex items-center justify-between", children: _jsx("label", { className: "text-xs", ...testId(TEST_IDS.SUM_BY_LABEL), children: "Sum by" }) }), _jsx(SelectWithRefresh, { id: "h-sum-by-selector", "data-testid": testId(TEST_IDS.SUM_BY_SELECT)['data-testid'], defaultValue: [], isMulti: true, isClearable: false, name: "colors", options: labels.map(label => ({ label, value: label })), className: "parca-select-container text-sm w-full max-w-80", classNamePrefix: "parca-select", value: sumBySelection.map(sumBy => ({ label: sumBy, value: sumBy })), onChange: newValue => {
35
- setUserSumBySelection?.(newValue.map(option => option.value));
36
- }, placeholder: "Labels...", styles: {
37
- indicatorSeparator: () => ({ display: 'none' }),
38
- menu: provided => ({
39
- ...provided,
40
- marginBottom: 0,
41
- boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)',
42
- marginTop: 10,
43
- zIndex: 50,
44
- minWidth: '320px',
45
- position: 'absolute',
46
- }),
47
- }, isLoading: sumBySelectionLoading, isDisabled: !profileType?.delta,
48
- // @ts-expect-error
49
- ref: sumByRef, onKeyDown: e => {
50
- const currentRef = sumByRef?.current;
51
- if (currentRef == null) {
52
- return;
53
- }
54
- const inputRef = currentRef.inputRef;
55
- if (inputRef == null) {
56
- return;
57
- }
58
- if (e.key === 'Enter' &&
59
- inputRef.value === '' &&
60
- currentRef.state.focusedOptionId === null // menu is not open
61
- ) {
62
- setQueryExpression(true);
63
- currentRef.blur();
64
- }
65
- }, onRefresh: refetchLabelNames, refreshTitle: "Refresh label names", refreshTestId: "sum-by-refresh-button", menuTestId: TEST_IDS.SUM_BY_SELECT_FLYOUT })] })), _jsx(DateTimeRangePicker, { onRangeSelection: setTimeRangeSelection, range: timeRangeSelection, timezone: timezone, ...testId(TEST_IDS.DATE_TIME_RANGE_PICKER) }), _jsxs("div", { children: [_jsx("label", { className: "text-xs", ...testId(TEST_IDS.SEARCH_BUTTON_LABEL), children: "\u00A0" }), _jsx(Button, { disabled: searchDisabled, onClick: (e) => {
66
- e.preventDefault();
67
- setSearchExecutedTimestamp(Date.now());
68
- setQueryExpression(true);
69
- }, id: "h-matcher-search-button", ...testId(TEST_IDS.SEARCH_BUTTON), children: "Search" })] })] }));
37
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
38
+ export function QueryControls(t0) {
39
+ var $ = _c(69);
40
+ var profileType = t0.profileType,
41
+ timeRangeSelection = t0.timeRangeSelection,
42
+ setTimeRangeSelection = t0.setTimeRangeSelection,
43
+ setQueryExpression = t0.setQueryExpression,
44
+ searchDisabled = t0.searchDisabled,
45
+ t1 = t0.showProfileTypeSelector,
46
+ t2 = t0.showSumBySelector,
47
+ t3 = t0.showAdvancedMode,
48
+ profileTypesData = t0.profileTypesData,
49
+ t4 = t0.profileTypesLoading,
50
+ selectedProfileName = t0.selectedProfileName,
51
+ setProfileName = t0.setProfileName,
52
+ profileTypesError = t0.profileTypesError,
53
+ externalProfilerComponent = t0.externalProfilerComponent,
54
+ setQueryBrowserMode = t0.setQueryBrowserMode,
55
+ t5 = t0.advancedModeForQueryBrowser,
56
+ setAdvancedModeForQueryBrowser = t0.setAdvancedModeForQueryBrowser,
57
+ queryBrowserRef = t0.queryBrowserRef,
58
+ t6 = t0.labels,
59
+ t7 = t0.sumBySelection,
60
+ t8 = t0.sumBySelectionLoading,
61
+ setUserSumBySelection = t0.setUserSumBySelection,
62
+ sumByRef = t0.sumByRef,
63
+ queryClient = t0.queryClient,
64
+ draftSelection = t0.draftSelection,
65
+ setDraftMatchers = t0.setDraftMatchers,
66
+ draftParsedQuery = t0.draftParsedQuery,
67
+ commitDraft = t0.commitDraft;
68
+ var showProfileTypeSelector = t1 === undefined ? false : t1;
69
+ var showSumBySelector = t2 === undefined ? false : t2;
70
+ var showAdvancedMode = t3 === undefined ? true : t3;
71
+ var profileTypesLoading = t4 === undefined ? false : t4;
72
+ var advancedModeForQueryBrowser = t5 === undefined ? false : t5;
73
+ var t9;
74
+ if ($[0] !== t6) {
75
+ t9 = t6 === undefined ? [] : t6;
76
+ $[0] = t6;
77
+ $[1] = t9;
78
+ } else {
79
+ t9 = $[1];
80
+ }
81
+ var labels = t9;
82
+ var t10;
83
+ if ($[2] !== t7) {
84
+ t10 = t7 === undefined ? [] : t7;
85
+ $[2] = t7;
86
+ $[3] = t10;
87
+ } else {
88
+ t10 = $[3];
89
+ }
90
+ var sumBySelection = t10;
91
+ var sumBySelectionLoading = t8 === undefined ? false : t8;
92
+ var _useParcaContext = useParcaContext(),
93
+ timezone = _useParcaContext.timezone;
94
+ var defaultQueryBrowserRef = useRef(null);
95
+ var actualQueryBrowserRef = queryBrowserRef !== null && queryBrowserRef !== void 0 ? queryBrowserRef : defaultQueryBrowserRef;
96
+ var _useState = useState(0),
97
+ _useState2 = _slicedToArray(_useState, 2),
98
+ searchExecutedTimestamp = _useState2[0],
99
+ setSearchExecutedTimestamp = _useState2[1];
100
+ var t11;
101
+ if ($[4] !== timeRangeSelection) {
102
+ t11 = timeRangeSelection.getFromMs();
103
+ $[4] = timeRangeSelection;
104
+ $[5] = t11;
105
+ } else {
106
+ t11 = $[5];
107
+ }
108
+ var t12;
109
+ if ($[6] !== timeRangeSelection) {
110
+ t12 = timeRangeSelection.getToMs();
111
+ $[6] = timeRangeSelection;
112
+ $[7] = t12;
113
+ } else {
114
+ t12 = $[7];
115
+ }
116
+ var _useLabelNames = useLabelNames(queryClient, profileType, t11, t12),
117
+ refetchLabelNames = _useLabelNames.refetch;
118
+ var t13;
119
+ if ($[8] === Symbol["for"]("react.memo_cache_sentinel")) {
120
+ t13 = testId(TEST_IDS.QUERY_CONTROLS_CONTAINER);
121
+ $[8] = t13;
122
+ } else {
123
+ t13 = $[8];
124
+ }
125
+ var t14;
126
+ if ($[9] !== (externalProfilerComponent === null || externalProfilerComponent === void 0 ? void 0 : externalProfilerComponent.disableProfileTypesDropdown) || $[10] !== profileTypesData || $[11] !== profileTypesError || $[12] !== profileTypesLoading || $[13] !== selectedProfileName || $[14] !== setProfileName || $[15] !== showProfileTypeSelector) {
127
+ t14 = showProfileTypeSelector && /*#__PURE__*/_jsxs("div", {
128
+ children: [/*#__PURE__*/_jsx("label", _objectSpread(_objectSpread({
129
+ className: "text-xs"
130
+ }, testId(TEST_IDS.PROFILE_TYPE_LABEL)), {}, {
131
+ children: "Profile type"
132
+ })), /*#__PURE__*/_jsx(ProfileTypeSelector, {
133
+ profileTypesData: profileTypesData,
134
+ loading: profileTypesLoading,
135
+ selectedKey: selectedProfileName,
136
+ onSelection: setProfileName !== null && setProfileName !== void 0 ? setProfileName : _temp,
137
+ error: profileTypesError,
138
+ disabled: externalProfilerComponent === null || externalProfilerComponent === void 0 ? void 0 : externalProfilerComponent.disableProfileTypesDropdown
139
+ })]
140
+ });
141
+ $[9] = externalProfilerComponent === null || externalProfilerComponent === void 0 ? void 0 : externalProfilerComponent.disableProfileTypesDropdown;
142
+ $[10] = profileTypesData;
143
+ $[11] = profileTypesError;
144
+ $[12] = profileTypesLoading;
145
+ $[13] = selectedProfileName;
146
+ $[14] = setProfileName;
147
+ $[15] = showProfileTypeSelector;
148
+ $[16] = t14;
149
+ } else {
150
+ t14 = $[16];
151
+ }
152
+ var t15;
153
+ if ($[17] === Symbol["for"]("react.memo_cache_sentinel")) {
154
+ t15 = testId(TEST_IDS.QUERY_BROWSER_CONTAINER);
155
+ $[17] = t15;
156
+ } else {
157
+ t15 = $[17];
158
+ }
159
+ var t16;
160
+ if ($[18] === Symbol["for"]("react.memo_cache_sentinel")) {
161
+ t16 = /*#__PURE__*/_jsx("label", _objectSpread(_objectSpread({
162
+ className: "text-xs"
163
+ }, testId(TEST_IDS.QUERY_LABEL)), {}, {
164
+ children: "Query"
165
+ }));
166
+ $[18] = t16;
167
+ } else {
168
+ t16 = $[18];
169
+ }
170
+ var t17;
171
+ if ($[19] !== advancedModeForQueryBrowser || $[20] !== (externalProfilerComponent === null || externalProfilerComponent === void 0 ? void 0 : externalProfilerComponent.disableExplorativeQuerying) || $[21] !== setAdvancedModeForQueryBrowser || $[22] !== setQueryBrowserMode || $[23] !== showAdvancedMode) {
172
+ t17 = showAdvancedMode && (externalProfilerComponent === null || externalProfilerComponent === void 0 ? void 0 : externalProfilerComponent.disableExplorativeQuerying) !== true && /*#__PURE__*/_jsxs(_Fragment, {
173
+ children: [/*#__PURE__*/_jsxs(Switch, _objectSpread(_objectSpread({
174
+ checked: advancedModeForQueryBrowser,
175
+ onChange: function onChange() {
176
+ setAdvancedModeForQueryBrowser === null || setAdvancedModeForQueryBrowser === void 0 || setAdvancedModeForQueryBrowser(!advancedModeForQueryBrowser);
177
+ setQueryBrowserMode === null || setQueryBrowserMode === void 0 || setQueryBrowserMode(advancedModeForQueryBrowser ? "simple" : "advanced");
178
+ },
179
+ className: "".concat(advancedModeForQueryBrowser ? "bg-indigo-600" : "bg-gray-400 dark:bg-gray-800", " relative inline-flex h-[20px] w-[44px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white/75")
180
+ }, testId(TEST_IDS.ADVANCED_MODE_SWITCH)), {}, {
181
+ children: [/*#__PURE__*/_jsx("span", {
182
+ className: "sr-only",
183
+ children: "Use setting"
184
+ }), /*#__PURE__*/_jsx("span", {
185
+ "aria-hidden": "true",
186
+ className: "".concat(advancedModeForQueryBrowser ? "translate-x-6" : "translate-x-0", " pointer-events-none inline-block h-[16px] w-[16px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out")
187
+ })]
188
+ })), /*#__PURE__*/_jsx("label", _objectSpread(_objectSpread({
189
+ className: "text-xs"
190
+ }, testId(TEST_IDS.QUERY_MODE_LABEL)), {}, {
191
+ children: "Advanced Mode"
192
+ }))]
193
+ });
194
+ $[19] = advancedModeForQueryBrowser;
195
+ $[20] = externalProfilerComponent === null || externalProfilerComponent === void 0 ? void 0 : externalProfilerComponent.disableExplorativeQuerying;
196
+ $[21] = setAdvancedModeForQueryBrowser;
197
+ $[22] = setQueryBrowserMode;
198
+ $[23] = showAdvancedMode;
199
+ $[24] = t17;
200
+ } else {
201
+ t17 = $[24];
202
+ }
203
+ var t18;
204
+ if ($[25] !== t17) {
205
+ t18 = /*#__PURE__*/_jsx("div", {
206
+ className: "flex items-center justify-between",
207
+ children: /*#__PURE__*/_jsxs("div", {
208
+ className: "flex items-center gap-3",
209
+ children: [t16, t17]
210
+ })
211
+ });
212
+ $[25] = t17;
213
+ $[26] = t18;
214
+ } else {
215
+ t18 = $[26];
216
+ }
217
+ var t19;
218
+ if ($[27] !== actualQueryBrowserRef || $[28] !== advancedModeForQueryBrowser || $[29] !== commitDraft || $[30] !== draftParsedQuery || $[31] !== draftSelection || $[32] !== externalProfilerComponent || $[33] !== searchExecutedTimestamp || $[34] !== setDraftMatchers || $[35] !== showAdvancedMode) {
219
+ t19 = (externalProfilerComponent === null || externalProfilerComponent === void 0 ? void 0 : externalProfilerComponent.configuredLabelNames) !== undefined && (externalProfilerComponent === null || externalProfilerComponent === void 0 ? void 0 : externalProfilerComponent.configuredLabelNames.length) >= 1 ? /*#__PURE__*/_jsx(PreSelectedMatchers, {
220
+ labelNames: externalProfilerComponent.configuredLabelNames
221
+ }) : showAdvancedMode && advancedModeForQueryBrowser ? /*#__PURE__*/_jsx(MatchersInput, {
222
+ setDraftMatchers: setDraftMatchers,
223
+ draftParsedQuery: draftParsedQuery,
224
+ commitDraft: commitDraft
225
+ }) : /*#__PURE__*/_jsx(SimpleMatchers, {
226
+ queryBrowserRef: actualQueryBrowserRef,
227
+ searchExecutedTimestamp: searchExecutedTimestamp,
228
+ draftSelection: draftSelection,
229
+ setDraftMatchers: setDraftMatchers,
230
+ draftParsedQuery: draftParsedQuery
231
+ });
232
+ $[27] = actualQueryBrowserRef;
233
+ $[28] = advancedModeForQueryBrowser;
234
+ $[29] = commitDraft;
235
+ $[30] = draftParsedQuery;
236
+ $[31] = draftSelection;
237
+ $[32] = externalProfilerComponent;
238
+ $[33] = searchExecutedTimestamp;
239
+ $[34] = setDraftMatchers;
240
+ $[35] = showAdvancedMode;
241
+ $[36] = t19;
242
+ } else {
243
+ t19 = $[36];
244
+ }
245
+ var t20;
246
+ if ($[37] !== actualQueryBrowserRef || $[38] !== t18 || $[39] !== t19) {
247
+ t20 = /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
248
+ className: "w-full flex-1 flex flex-col gap-1 mt-auto",
249
+ ref: actualQueryBrowserRef
250
+ }, t15), {}, {
251
+ children: [t18, t19]
252
+ }));
253
+ $[37] = actualQueryBrowserRef;
254
+ $[38] = t18;
255
+ $[39] = t19;
256
+ $[40] = t20;
257
+ } else {
258
+ t20 = $[40];
259
+ }
260
+ var t21;
261
+ if ($[41] !== labels || $[42] !== profileType || $[43] !== refetchLabelNames || $[44] !== setQueryExpression || $[45] !== setUserSumBySelection || $[46] !== showSumBySelector || $[47] !== sumByRef || $[48] !== sumBySelection || $[49] !== sumBySelectionLoading) {
262
+ t21 = showSumBySelector && /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({}, testId(TEST_IDS.SUM_BY_CONTAINER)), {}, {
263
+ children: [/*#__PURE__*/_jsx("div", {
264
+ className: "mb-0.5 mt-1.5 flex items-center justify-between",
265
+ children: /*#__PURE__*/_jsx("label", _objectSpread(_objectSpread({
266
+ className: "text-xs"
267
+ }, testId(TEST_IDS.SUM_BY_LABEL)), {}, {
268
+ children: "Sum by"
269
+ }))
270
+ }), /*#__PURE__*/_jsx(SelectWithRefresh, {
271
+ id: "h-sum-by-selector",
272
+ "data-testid": testId(TEST_IDS.SUM_BY_SELECT)["data-testid"],
273
+ defaultValue: [],
274
+ isMulti: true,
275
+ isClearable: false,
276
+ name: "colors",
277
+ options: labels.map(_temp2),
278
+ className: "parca-select-container text-sm w-full max-w-80",
279
+ classNamePrefix: "parca-select",
280
+ value: sumBySelection.map(_temp3),
281
+ onChange: function onChange(newValue) {
282
+ setUserSumBySelection === null || setUserSumBySelection === void 0 || setUserSumBySelection(newValue.map(_temp4));
283
+ },
284
+ placeholder: "Labels...",
285
+ styles: {
286
+ indicatorSeparator: _temp5,
287
+ menu: _temp6
288
+ },
289
+ isLoading: sumBySelectionLoading,
290
+ isDisabled: !(profileType !== null && profileType !== void 0 && profileType.delta),
291
+ ref: sumByRef,
292
+ onKeyDown: function onKeyDown(e) {
293
+ var currentRef = sumByRef === null || sumByRef === void 0 ? void 0 : sumByRef.current;
294
+ if (currentRef == null) {
295
+ return;
296
+ }
297
+ var inputRef = currentRef.inputRef;
298
+ if (inputRef == null) {
299
+ return;
300
+ }
301
+ if (e.key === "Enter" && inputRef.value === "" && currentRef.state.focusedOptionId === null) {
302
+ setQueryExpression(true);
303
+ currentRef.blur();
304
+ }
305
+ },
306
+ onRefresh: refetchLabelNames,
307
+ refreshTitle: "Refresh label names",
308
+ refreshTestId: "sum-by-refresh-button",
309
+ menuTestId: TEST_IDS.SUM_BY_SELECT_FLYOUT
310
+ })]
311
+ }));
312
+ $[41] = labels;
313
+ $[42] = profileType;
314
+ $[43] = refetchLabelNames;
315
+ $[44] = setQueryExpression;
316
+ $[45] = setUserSumBySelection;
317
+ $[46] = showSumBySelector;
318
+ $[47] = sumByRef;
319
+ $[48] = sumBySelection;
320
+ $[49] = sumBySelectionLoading;
321
+ $[50] = t21;
322
+ } else {
323
+ t21 = $[50];
324
+ }
325
+ var t22;
326
+ if ($[51] === Symbol["for"]("react.memo_cache_sentinel")) {
327
+ t22 = testId(TEST_IDS.DATE_TIME_RANGE_PICKER);
328
+ $[51] = t22;
329
+ } else {
330
+ t22 = $[51];
331
+ }
332
+ var t23;
333
+ if ($[52] !== setTimeRangeSelection || $[53] !== timeRangeSelection || $[54] !== timezone) {
334
+ t23 = /*#__PURE__*/_jsx(DateTimeRangePicker, _objectSpread({
335
+ onRangeSelection: setTimeRangeSelection,
336
+ range: timeRangeSelection,
337
+ timezone: timezone
338
+ }, t22));
339
+ $[52] = setTimeRangeSelection;
340
+ $[53] = timeRangeSelection;
341
+ $[54] = timezone;
342
+ $[55] = t23;
343
+ } else {
344
+ t23 = $[55];
345
+ }
346
+ var t24;
347
+ if ($[56] === Symbol["for"]("react.memo_cache_sentinel")) {
348
+ t24 = /*#__PURE__*/_jsx("label", _objectSpread(_objectSpread({
349
+ className: "text-xs"
350
+ }, testId(TEST_IDS.SEARCH_BUTTON_LABEL)), {}, {
351
+ children: "\xA0"
352
+ }));
353
+ $[56] = t24;
354
+ } else {
355
+ t24 = $[56];
356
+ }
357
+ var t25;
358
+ if ($[57] !== setQueryExpression) {
359
+ t25 = function t25(e_0) {
360
+ e_0.preventDefault();
361
+ setSearchExecutedTimestamp(Date.now());
362
+ setQueryExpression(true);
363
+ };
364
+ $[57] = setQueryExpression;
365
+ $[58] = t25;
366
+ } else {
367
+ t25 = $[58];
368
+ }
369
+ var t26;
370
+ if ($[59] === Symbol["for"]("react.memo_cache_sentinel")) {
371
+ t26 = testId(TEST_IDS.SEARCH_BUTTON);
372
+ $[59] = t26;
373
+ } else {
374
+ t26 = $[59];
375
+ }
376
+ var t27;
377
+ if ($[60] !== searchDisabled || $[61] !== t25) {
378
+ t27 = /*#__PURE__*/_jsxs("div", {
379
+ children: [t24, /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
380
+ disabled: searchDisabled,
381
+ onClick: t25,
382
+ id: "h-matcher-search-button"
383
+ }, t26), {}, {
384
+ children: "Search"
385
+ }))]
386
+ });
387
+ $[60] = searchDisabled;
388
+ $[61] = t25;
389
+ $[62] = t27;
390
+ } else {
391
+ t27 = $[62];
392
+ }
393
+ var t28;
394
+ if ($[63] !== t14 || $[64] !== t20 || $[65] !== t21 || $[66] !== t23 || $[67] !== t27) {
395
+ t28 = /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
396
+ className: "flex w-full flex-wrap items-start gap-2"
397
+ }, t13), {}, {
398
+ children: [t14, t20, t21, t23, t27]
399
+ }));
400
+ $[63] = t14;
401
+ $[64] = t20;
402
+ $[65] = t21;
403
+ $[66] = t23;
404
+ $[67] = t27;
405
+ $[68] = t28;
406
+ } else {
407
+ t28 = $[68];
408
+ }
409
+ return t28;
410
+ }
411
+ function _temp6(provided) {
412
+ return _objectSpread(_objectSpread({}, provided), {}, {
413
+ marginBottom: 0,
414
+ boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
415
+ marginTop: 10,
416
+ zIndex: 50,
417
+ minWidth: "320px",
418
+ position: "absolute"
419
+ });
420
+ }
421
+ function _temp5() {
422
+ return {
423
+ display: "none"
424
+ };
425
+ }
426
+ function _temp4(option) {
427
+ return option.value;
428
+ }
429
+ function _temp3(sumBy) {
430
+ return {
431
+ label: sumBy,
432
+ value: sumBy
433
+ };
434
+ }
435
+ function _temp2(label) {
436
+ return {
437
+ label: label,
438
+ value: label
439
+ };
70
440
  }
441
+ function _temp() {}
@@ -1,6 +1,56 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ // Copyright 2022 The Parca Authors
8
+ // Licensed under the Apache License, Version 2.0 (the "License");
9
+ // you may not use this file except in compliance with the License.
10
+ // You may obtain a copy of the License at
11
+ //
12
+ // http://www.apache.org/licenses/LICENSE-2.0
13
+ //
14
+ // Unless required by applicable law or agreed to in writing, software
15
+ // distributed under the License is distributed on an "AS IS" BASIS,
16
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ // See the License for the specific language governing permissions and
18
+ // limitations under the License.
19
+
20
+ import React from 'react';
2
21
  import { TEST_IDS, testId } from '@parca/test-utils';
3
22
  import ProfileFlameGraph from '../../ProfileFlameGraph';
4
- export function CalleesSection({ calleesRef, calleesFlamegraphData, profileSource, curPathArrow, setCurPathArrow, }) {
5
- return (_jsxs("div", { className: "flex relative items-start flex-row", ref: calleesRef, ...testId(TEST_IDS.SANDWICH_CALLEES_SECTION), children: [_jsxs("div", { className: "[writing-mode:vertical-lr] -rotate-180 px-1 uppercase text-[10px] text-left", children: ['<-', " Callees"] }), _jsx(ProfileFlameGraph, { arrow: calleesFlamegraphData?.arrow, total: calleesFlamegraphData.total ?? BigInt(0), filtered: calleesFlamegraphData.filtered ?? BigInt(0), profileType: profileSource?.ProfileType(), loading: calleesFlamegraphData.loading, error: calleesFlamegraphData.error, isHalfScreen: true, width: calleesRef.current != null ? calleesRef.current.getBoundingClientRect().width - 25 : 0, metadataMappingFiles: calleesFlamegraphData.metadataMappingFiles, metadataLoading: calleesFlamegraphData.metadataLoading, isInSandwichView: true, curPathArrow: curPathArrow, setNewCurPathArrow: setCurPathArrow, profileSource: profileSource, tooltipId: "callees" })] }));
6
- }
23
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
24
+ export function CalleesSection(_ref) {
25
+ var _calleesFlamegraphDat, _calleesFlamegraphDat2;
26
+ var calleesRef = _ref.calleesRef,
27
+ calleesFlamegraphData = _ref.calleesFlamegraphData,
28
+ profileSource = _ref.profileSource,
29
+ curPathArrow = _ref.curPathArrow,
30
+ setCurPathArrow = _ref.setCurPathArrow;
31
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
32
+ className: "flex relative items-start flex-row",
33
+ ref: calleesRef
34
+ }, testId(TEST_IDS.SANDWICH_CALLEES_SECTION)), {}, {
35
+ children: [/*#__PURE__*/_jsxs("div", {
36
+ className: "[writing-mode:vertical-lr] -rotate-180 px-1 uppercase text-[10px] text-left",
37
+ children: ['<-', " Callees"]
38
+ }), /*#__PURE__*/_jsx(ProfileFlameGraph, {
39
+ arrow: calleesFlamegraphData === null || calleesFlamegraphData === void 0 ? void 0 : calleesFlamegraphData.arrow,
40
+ total: (_calleesFlamegraphDat = calleesFlamegraphData.total) !== null && _calleesFlamegraphDat !== void 0 ? _calleesFlamegraphDat : BigInt(0),
41
+ filtered: (_calleesFlamegraphDat2 = calleesFlamegraphData.filtered) !== null && _calleesFlamegraphDat2 !== void 0 ? _calleesFlamegraphDat2 : BigInt(0),
42
+ profileType: profileSource === null || profileSource === void 0 ? void 0 : profileSource.ProfileType(),
43
+ loading: calleesFlamegraphData.loading,
44
+ error: calleesFlamegraphData.error,
45
+ isHalfScreen: true,
46
+ width: calleesRef.current != null ? calleesRef.current.getBoundingClientRect().width - 25 : 0,
47
+ metadataMappingFiles: calleesFlamegraphData.metadataMappingFiles,
48
+ metadataLoading: calleesFlamegraphData.metadataLoading,
49
+ isInSandwichView: true,
50
+ curPathArrow: curPathArrow,
51
+ setNewCurPathArrow: setCurPathArrow,
52
+ profileSource: profileSource,
53
+ tooltipId: "callees"
54
+ })]
55
+ }));
56
+ }