@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,10 +1,55 @@
1
- import { 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
+ /* eslint-disable react-hooks/refs */
21
+
2
22
  import cx from 'classnames';
3
23
  import { useDashboard } from '../../context/DashboardContext';
4
24
  import { VisualizationPanel } from '../VisualizationPanel';
5
- export const VisualizationContainer = ({ provided, snapshot, dashboardItem, getDashboardItemByType, isMultiPanelView, index, actionButtons, }) => {
6
- const { handleClosePanel } = useDashboard();
7
- return (_jsx("div", { ref: provided.innerRef, ...provided.draggableProps, className: cx('w-full min-h-96', snapshot.isDragging ? 'bg-gray-200 dark:bg-gray-500' : 'bg-inherit dark:bg-gray-900', isMultiPanelView ? 'border-2 border-gray-100 dark:border-gray-700 rounded-md p-3' : '', dashboardItem === 'source' && isMultiPanelView ? 'sticky top-0 self-start' : ''), style: dashboardItem === 'source' && isMultiPanelView
8
- ? { maxHeight: 'calc(100vh - 50px)' }
9
- : undefined, children: _jsx(VisualizationPanel, { handleClosePanel: handleClosePanel, isMultiPanelView: isMultiPanelView, dashboardItem: dashboardItem, getDashboardItemByType: getDashboardItemByType, dragHandleProps: provided.dragHandleProps, index: index, actionButtons: actionButtons }) }));
10
- };
25
+ import { jsx as _jsx } from "react/jsx-runtime";
26
+ export var VisualizationContainer = function VisualizationContainer(_ref) {
27
+ 'use no memo';
28
+
29
+ var provided = _ref.provided,
30
+ snapshot = _ref.snapshot,
31
+ dashboardItem = _ref.dashboardItem,
32
+ getDashboardItemByType = _ref.getDashboardItemByType,
33
+ isMultiPanelView = _ref.isMultiPanelView,
34
+ index = _ref.index,
35
+ actionButtons = _ref.actionButtons;
36
+ var _useDashboard = useDashboard(),
37
+ handleClosePanel = _useDashboard.handleClosePanel;
38
+ return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
39
+ ref: provided.innerRef
40
+ }, provided.draggableProps), {}, {
41
+ className: cx('w-full min-h-96', snapshot.isDragging ? 'bg-gray-200 dark:bg-gray-500' : 'bg-inherit dark:bg-gray-900', isMultiPanelView ? 'border-2 border-gray-100 dark:border-gray-700 rounded-md p-3' : '', dashboardItem === 'source' && isMultiPanelView ? 'sticky top-0 self-start' : ''),
42
+ style: dashboardItem === 'source' && isMultiPanelView ? {
43
+ maxHeight: 'calc(100vh - 50px)'
44
+ } : undefined,
45
+ children: /*#__PURE__*/_jsx(VisualizationPanel, {
46
+ handleClosePanel: handleClosePanel,
47
+ isMultiPanelView: isMultiPanelView,
48
+ dashboardItem: dashboardItem,
49
+ getDashboardItemByType: getDashboardItemByType,
50
+ dragHandleProps: provided.dragHandleProps,
51
+ index: index,
52
+ actionButtons: actionButtons
53
+ })
54
+ }));
55
+ };
@@ -1,4 +1,10 @@
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
+ import { c as _c } from "react-compiler-runtime";
2
8
  // Copyright 2022 The Parca Authors
3
9
  // Licensed under the Apache License, Version 2.0 (the "License");
4
10
  // you may not use this file except in compliance with the License.
@@ -11,15 +17,186 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
11
17
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
18
  // See the License for the specific language governing permissions and
13
19
  // limitations under the License.
20
+
14
21
  import React from 'react';
15
22
  import { Icon } from '@iconify/react';
16
23
  import cx from 'classnames';
17
24
  import { IconButton, useParcaContext } from '@parca/components';
18
25
  import { CloseIcon } from '@parca/icons';
19
- export const VisualizationPanel = React.memo(function VisualizationPanel({ dashboardItem, isMultiPanelView, handleClosePanel, dragHandleProps, getDashboardItemByType, actionButtons, }) {
20
- const { flamegraphHint } = useParcaContext();
21
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex w-full items-center justify-end gap-2 pb-2", children: [_jsxs("div", { className: cx('flex w-full justify-between flex-col-reverse md:flex-row', isMultiPanelView && dashboardItem === 'flamegraph' ? 'items-end gap-x-2' : 'items-end'), children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: cx(isMultiPanelView ? '' : 'hidden', 'flex items-center'), ...dragHandleProps, children: _jsx(Icon, { className: "text-xl", icon: "material-symbols:drag-indicator" }) }), isMultiPanelView ? (_jsx("div", { className: "flex gap-2", children: actionButtons[dashboardItem] })) : null] }), _jsx("div", { className: cx('flex flex-row items-center gap-4', isMultiPanelView && dashboardItem === 'flamegraph' && 'pb-[10px]'), children: dashboardItem === 'flamegraph' && flamegraphHint != null ? (_jsx("div", { className: "px-2", children: flamegraphHint })) : null })] }), isMultiPanelView && (_jsx(IconButton, { className: "py-0", onClick: () => handleClosePanel(dashboardItem), icon: _jsx(CloseIcon, {}) }))] }), getDashboardItemByType({
22
- type: dashboardItem,
23
- isHalfScreen: isMultiPanelView,
24
- })] }));
25
- });
26
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
27
+ export var VisualizationPanel = /*#__PURE__*/React.memo(function VisualizationPanel(t0) {
28
+ var $ = _c(41);
29
+ var dashboardItem = t0.dashboardItem,
30
+ isMultiPanelView = t0.isMultiPanelView,
31
+ handleClosePanel = t0.handleClosePanel,
32
+ dragHandleProps = t0.dragHandleProps,
33
+ getDashboardItemByType = t0.getDashboardItemByType,
34
+ actionButtons = t0.actionButtons;
35
+ var _useParcaContext = useParcaContext(),
36
+ flamegraphHint = _useParcaContext.flamegraphHint;
37
+ var t1 = isMultiPanelView && dashboardItem === "flamegraph" ? "items-end gap-x-2" : "items-end";
38
+ var t2;
39
+ if ($[0] !== t1) {
40
+ t2 = cx("flex w-full justify-between flex-col-reverse md:flex-row", t1);
41
+ $[0] = t1;
42
+ $[1] = t2;
43
+ } else {
44
+ t2 = $[1];
45
+ }
46
+ var t3 = isMultiPanelView ? "" : "hidden";
47
+ var t4;
48
+ if ($[2] !== t3) {
49
+ t4 = cx(t3, "flex items-center");
50
+ $[2] = t3;
51
+ $[3] = t4;
52
+ } else {
53
+ t4 = $[3];
54
+ }
55
+ var t5;
56
+ if ($[4] === Symbol["for"]("react.memo_cache_sentinel")) {
57
+ t5 = /*#__PURE__*/_jsx(Icon, {
58
+ className: "text-xl",
59
+ icon: "material-symbols:drag-indicator"
60
+ });
61
+ $[4] = t5;
62
+ } else {
63
+ t5 = $[4];
64
+ }
65
+ var t6;
66
+ if ($[5] !== dragHandleProps || $[6] !== t4) {
67
+ t6 = /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
68
+ className: t4
69
+ }, dragHandleProps), {}, {
70
+ children: t5
71
+ }));
72
+ $[5] = dragHandleProps;
73
+ $[6] = t4;
74
+ $[7] = t6;
75
+ } else {
76
+ t6 = $[7];
77
+ }
78
+ var t7;
79
+ if ($[8] !== actionButtons || $[9] !== dashboardItem || $[10] !== isMultiPanelView) {
80
+ t7 = isMultiPanelView ? /*#__PURE__*/_jsx("div", {
81
+ className: "flex gap-2",
82
+ children: actionButtons[dashboardItem]
83
+ }) : null;
84
+ $[8] = actionButtons;
85
+ $[9] = dashboardItem;
86
+ $[10] = isMultiPanelView;
87
+ $[11] = t7;
88
+ } else {
89
+ t7 = $[11];
90
+ }
91
+ var t8;
92
+ if ($[12] !== t6 || $[13] !== t7) {
93
+ t8 = /*#__PURE__*/_jsxs("div", {
94
+ className: "flex items-center gap-2",
95
+ children: [t6, t7]
96
+ });
97
+ $[12] = t6;
98
+ $[13] = t7;
99
+ $[14] = t8;
100
+ } else {
101
+ t8 = $[14];
102
+ }
103
+ var t9 = isMultiPanelView && dashboardItem === "flamegraph" && "pb-[10px]";
104
+ var t10;
105
+ if ($[15] !== t9) {
106
+ t10 = cx("flex flex-row items-center gap-4", t9);
107
+ $[15] = t9;
108
+ $[16] = t10;
109
+ } else {
110
+ t10 = $[16];
111
+ }
112
+ var t11;
113
+ if ($[17] !== dashboardItem || $[18] !== flamegraphHint) {
114
+ t11 = dashboardItem === "flamegraph" && flamegraphHint != null ? /*#__PURE__*/_jsx("div", {
115
+ className: "px-2",
116
+ children: flamegraphHint
117
+ }) : null;
118
+ $[17] = dashboardItem;
119
+ $[18] = flamegraphHint;
120
+ $[19] = t11;
121
+ } else {
122
+ t11 = $[19];
123
+ }
124
+ var t12;
125
+ if ($[20] !== t10 || $[21] !== t11) {
126
+ t12 = /*#__PURE__*/_jsx("div", {
127
+ className: t10,
128
+ children: t11
129
+ });
130
+ $[20] = t10;
131
+ $[21] = t11;
132
+ $[22] = t12;
133
+ } else {
134
+ t12 = $[22];
135
+ }
136
+ var t13;
137
+ if ($[23] !== t12 || $[24] !== t2 || $[25] !== t8) {
138
+ t13 = /*#__PURE__*/_jsxs("div", {
139
+ className: t2,
140
+ children: [t8, t12]
141
+ });
142
+ $[23] = t12;
143
+ $[24] = t2;
144
+ $[25] = t8;
145
+ $[26] = t13;
146
+ } else {
147
+ t13 = $[26];
148
+ }
149
+ var t14;
150
+ if ($[27] !== dashboardItem || $[28] !== handleClosePanel || $[29] !== isMultiPanelView) {
151
+ t14 = isMultiPanelView && /*#__PURE__*/_jsx(IconButton, {
152
+ className: "py-0",
153
+ onClick: function onClick() {
154
+ return handleClosePanel(dashboardItem);
155
+ },
156
+ icon: /*#__PURE__*/_jsx(CloseIcon, {})
157
+ });
158
+ $[27] = dashboardItem;
159
+ $[28] = handleClosePanel;
160
+ $[29] = isMultiPanelView;
161
+ $[30] = t14;
162
+ } else {
163
+ t14 = $[30];
164
+ }
165
+ var t15;
166
+ if ($[31] !== t13 || $[32] !== t14) {
167
+ t15 = /*#__PURE__*/_jsxs("div", {
168
+ className: "flex w-full items-center justify-end gap-2 pb-2",
169
+ children: [t13, t14]
170
+ });
171
+ $[31] = t13;
172
+ $[32] = t14;
173
+ $[33] = t15;
174
+ } else {
175
+ t15 = $[33];
176
+ }
177
+ var t16;
178
+ if ($[34] !== dashboardItem || $[35] !== getDashboardItemByType || $[36] !== isMultiPanelView) {
179
+ t16 = getDashboardItemByType({
180
+ type: dashboardItem,
181
+ isHalfScreen: isMultiPanelView
182
+ });
183
+ $[34] = dashboardItem;
184
+ $[35] = getDashboardItemByType;
185
+ $[36] = isMultiPanelView;
186
+ $[37] = t16;
187
+ } else {
188
+ t16 = $[37];
189
+ }
190
+ var t17;
191
+ if ($[38] !== t15 || $[39] !== t16) {
192
+ t17 = /*#__PURE__*/_jsxs(_Fragment, {
193
+ children: [t15, t16]
194
+ });
195
+ $[38] = t15;
196
+ $[39] = t16;
197
+ $[40] = t17;
198
+ } else {
199
+ t17 = $[40];
200
+ }
201
+ return t17;
202
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"DashboardContext.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/context/DashboardContext.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAC,EAAE,EAAE,iBAAiB,EAA4B,MAAM,OAAO,CAAC;AAMvE,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAEzD,UAAU,oBAAoB;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC7C,gBAAgB,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjE,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAID,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CA4BnD,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,oBAM/B,CAAC"}
1
+ {"version":3,"file":"DashboardContext.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/context/DashboardContext.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAC,EAAE,EAAE,iBAAiB,EAA4B,MAAM,OAAO,CAAC;AAIvE,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAEzD,UAAU,oBAAoB;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC7C,gBAAgB,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjE,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAID,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CA8BnD,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,oBAM/B,CAAC"}
@@ -1,4 +1,10 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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; } }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ import { c as _c } from "react-compiler-runtime";
2
8
  // Copyright 2022 The Parca Authors
3
9
  // Licensed under the Apache License, Version 2.0 (the "License");
4
10
  // you may not use this file except in compliance with the License.
@@ -11,34 +17,84 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
17
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
18
  // See the License for the specific language governing permissions and
13
19
  // limitations under the License.
20
+
14
21
  import { createContext, useContext } from 'react';
15
- import { useQueryState } from 'nuqs';
16
- import { stringParam } from '../../hooks/urlParsers';
17
- import { useDashboardItems } from '../../hooks/useDashboardItems';
18
- const DashboardContext = createContext(undefined);
19
- export const DashboardProvider = ({ children }) => {
20
- const { dashboardItems, setDashboardItems } = useDashboardItems();
21
- const [, setSandwichFunctionName] = useQueryState('sandwich_function_name', stringParam);
22
- const handleClosePanel = (visualizationType) => {
23
- const newDashboardItems = dashboardItems.filter(item => item !== visualizationType);
24
- setDashboardItems(newDashboardItems);
25
- // Reset sandwich function name when closing sandwich panel
26
- if (visualizationType === 'sandwich') {
27
- void setSandwichFunctionName(null);
28
- }
22
+ import { useURLState } from '@parca/components';
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ var DashboardContext = /*#__PURE__*/createContext(undefined);
25
+ export var DashboardProvider = function DashboardProvider(t0) {
26
+ var $ = _c(13);
27
+ var children = t0.children;
28
+ var t1;
29
+ if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
30
+ t1 = {
31
+ alwaysReturnArray: true
29
32
  };
30
- const isMultiPanelView = dashboardItems.length > 1;
31
- return (_jsx(DashboardContext.Provider, { value: {
32
- dashboardItems,
33
- setDashboardItems,
34
- handleClosePanel,
35
- isMultiPanelView,
36
- }, children: children }));
37
- };
38
- export const useDashboard = () => {
39
- const context = useContext(DashboardContext);
40
- if (context === undefined) {
41
- throw new Error('useDashboard must be used within a DashboardProvider');
42
- }
43
- return context;
33
+ $[0] = t1;
34
+ } else {
35
+ t1 = $[0];
36
+ }
37
+ var _useURLState = useURLState("dashboard_items", t1),
38
+ _useURLState2 = _slicedToArray(_useURLState, 2),
39
+ dashboardItems = _useURLState2[0],
40
+ setDashboardItems = _useURLState2[1];
41
+ var _useURLState3 = useURLState("sandwich_function_name"),
42
+ _useURLState4 = _slicedToArray(_useURLState3, 2),
43
+ setSandwichFunctionName = _useURLState4[1];
44
+ var t2;
45
+ if ($[1] !== dashboardItems || $[2] !== setDashboardItems || $[3] !== setSandwichFunctionName) {
46
+ t2 = function t2(visualizationType) {
47
+ var newDashboardItems = dashboardItems.filter(function (item) {
48
+ return item !== visualizationType;
49
+ });
50
+ setDashboardItems(newDashboardItems);
51
+ if (visualizationType === "sandwich") {
52
+ setSandwichFunctionName(undefined);
53
+ }
54
+ };
55
+ $[1] = dashboardItems;
56
+ $[2] = setDashboardItems;
57
+ $[3] = setSandwichFunctionName;
58
+ $[4] = t2;
59
+ } else {
60
+ t2 = $[4];
61
+ }
62
+ var handleClosePanel = t2;
63
+ var isMultiPanelView = dashboardItems.length > 1;
64
+ var t3;
65
+ if ($[5] !== dashboardItems || $[6] !== handleClosePanel || $[7] !== isMultiPanelView || $[8] !== setDashboardItems) {
66
+ t3 = {
67
+ dashboardItems: dashboardItems,
68
+ setDashboardItems: setDashboardItems,
69
+ handleClosePanel: handleClosePanel,
70
+ isMultiPanelView: isMultiPanelView
71
+ };
72
+ $[5] = dashboardItems;
73
+ $[6] = handleClosePanel;
74
+ $[7] = isMultiPanelView;
75
+ $[8] = setDashboardItems;
76
+ $[9] = t3;
77
+ } else {
78
+ t3 = $[9];
79
+ }
80
+ var t4;
81
+ if ($[10] !== children || $[11] !== t3) {
82
+ t4 = /*#__PURE__*/_jsx(DashboardContext.Provider, {
83
+ value: t3,
84
+ children: children
85
+ });
86
+ $[10] = children;
87
+ $[11] = t3;
88
+ $[12] = t4;
89
+ } else {
90
+ t4 = $[12];
91
+ }
92
+ return t4;
44
93
  };
94
+ export var useDashboard = function useDashboard() {
95
+ var context = useContext(DashboardContext);
96
+ if (context === undefined) {
97
+ throw new Error("useDashboard must be used within a DashboardProvider");
98
+ }
99
+ return context;
100
+ };
@@ -1,4 +1,10 @@
1
- import { 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
+ import { c as _c } from "react-compiler-runtime";
2
8
  // Copyright 2022 The Parca Authors
3
9
  // Licensed under the Apache License, Version 2.0 (the "License");
4
10
  // you may not use this file except in compliance with the License.
@@ -11,21 +17,56 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
17
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
18
  // See the License for the specific language governing permissions and
13
19
  // limitations under the License.
20
+
14
21
  import { createContext, useContext } from 'react';
15
- export const defaultValue = {
16
- profileSource: undefined,
17
- compareMode: false,
18
- timelineGuide: { show: false },
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ export var defaultValue = {
24
+ profileSource: undefined,
25
+ compareMode: false,
26
+ timelineGuide: {
27
+ show: false
28
+ }
19
29
  };
20
- const ProfileViewContext = createContext(defaultValue);
21
- export const ProfileViewContextProvider = ({ children, value, }) => {
22
- return (_jsx(ProfileViewContext.Provider, { value: { ...defaultValue, ...(value ?? {}) }, children: children }));
30
+ var ProfileViewContext = /*#__PURE__*/createContext(defaultValue);
31
+ export var ProfileViewContextProvider = function ProfileViewContextProvider(t0) {
32
+ var $ = _c(7);
33
+ var children = t0.children,
34
+ value = t0.value;
35
+ var t1;
36
+ if ($[0] !== value) {
37
+ t1 = value !== null && value !== void 0 ? value : {};
38
+ $[0] = value;
39
+ $[1] = t1;
40
+ } else {
41
+ t1 = $[1];
42
+ }
43
+ var t2;
44
+ if ($[2] !== t1) {
45
+ t2 = _objectSpread(_objectSpread({}, defaultValue), t1);
46
+ $[2] = t1;
47
+ $[3] = t2;
48
+ } else {
49
+ t2 = $[3];
50
+ }
51
+ var t3;
52
+ if ($[4] !== children || $[5] !== t2) {
53
+ t3 = /*#__PURE__*/_jsx(ProfileViewContext.Provider, {
54
+ value: t2,
55
+ children: children
56
+ });
57
+ $[4] = children;
58
+ $[5] = t2;
59
+ $[6] = t3;
60
+ } else {
61
+ t3 = $[6];
62
+ }
63
+ return t3;
23
64
  };
24
- export const useProfileViewContext = () => {
25
- const context = useContext(ProfileViewContext);
26
- if (context == null) {
27
- return defaultValue;
28
- }
29
- return context;
65
+ export var useProfileViewContext = function useProfileViewContext() {
66
+ var context = useContext(ProfileViewContext);
67
+ if (context == null) {
68
+ return defaultValue;
69
+ }
70
+ return context;
30
71
  };
31
- export default ProfileViewContext;
72
+ export default ProfileViewContext;
@@ -1,3 +1,4 @@
1
+ import { c as _c } from "react-compiler-runtime";
1
2
  // Copyright 2022 The Parca Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
@@ -10,24 +11,26 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
14
+
13
15
  import { useEffect, useRef } from 'react';
14
16
  import { wellKnownProfiles } from '../../ProfileTypeSelector';
15
- const CPU_PREFERRED_DIMENSIONS = ['cpu', 'cpuid', 'thread', 'thread_id'];
16
- const GPU_DIMENSIONS = ['node', 'gpu', 'stream'];
17
- const getWellKnownProfileName = (profileType) => {
18
- if (profileType == null)
19
- return undefined;
20
- const key = profileType.toString();
21
- return wellKnownProfiles[key]?.name;
17
+ var CPU_PREFERRED_DIMENSIONS = ['cpu', 'cpuid', 'thread', 'thread_id'];
18
+ var GPU_DIMENSIONS = ['node', 'gpu', 'stream'];
19
+ var getWellKnownProfileName = function getWellKnownProfileName(profileType) {
20
+ var _wellKnownProfiles$ke;
21
+ if (profileType == null) return undefined;
22
+ var key = profileType.toString();
23
+ return (_wellKnownProfiles$ke = wellKnownProfiles[key]) === null || _wellKnownProfiles$ke === void 0 ? void 0 : _wellKnownProfiles$ke.name;
22
24
  };
23
- const isOnGpuProfile = (profileType) => {
24
- const wellKnownName = getWellKnownProfileName(profileType);
25
- return wellKnownName === 'On-GPU';
25
+ var isOnGpuProfile = function isOnGpuProfile(profileType) {
26
+ var wellKnownName = getWellKnownProfileName(profileType);
27
+ return wellKnownName === 'On-GPU';
26
28
  };
27
- const isOnCpuProfile = (profileType) => {
28
- const wellKnownName = getWellKnownProfileName(profileType);
29
- return wellKnownName === 'On-CPU';
29
+ var isOnCpuProfile = function isOnCpuProfile(profileType) {
30
+ var wellKnownName = getWellKnownProfileName(profileType);
31
+ return wellKnownName === 'On-CPU';
30
32
  };
33
+
31
34
  /**
32
35
  * Auto-selects the best flamechart "group by" dimension on first load.
33
36
  *
@@ -41,35 +44,62 @@ const isOnCpuProfile = (profileType) => {
41
44
  * For all other profile types:
42
45
  * - No auto-selection
43
46
  */
44
- export const useAutoSelectDimension = (metadataLabels, flamechartDimension, setFlamechartDimension, profileType) => {
45
- const hasAutoSelected = useRef(false);
46
- useEffect(() => {
47
- if (hasAutoSelected.current)
48
- return;
49
- if (metadataLabels == null || metadataLabels.length === 0)
50
- return;
51
- if ((flamechartDimension ?? []).length > 0) {
47
+ export var useAutoSelectDimension = function useAutoSelectDimension(metadataLabels, flamechartDimension, setFlamechartDimension, profileType) {
48
+ var $ = _c(6);
49
+ var hasAutoSelected = useRef(false);
50
+ var t0;
51
+ var t1;
52
+ if ($[0] !== flamechartDimension || $[1] !== metadataLabels || $[2] !== profileType || $[3] !== setFlamechartDimension) {
53
+ t0 = function t0() {
54
+ if (hasAutoSelected.current) {
55
+ return;
56
+ }
57
+ if (metadataLabels == null || metadataLabels.length === 0) {
58
+ return;
59
+ }
60
+ if ((flamechartDimension !== null && flamechartDimension !== void 0 ? flamechartDimension : []).length > 0) {
61
+ hasAutoSelected.current = true;
62
+ return;
63
+ }
64
+ if (isOnGpuProfile(profileType)) {
65
+ var availableGpuDims = GPU_DIMENSIONS.filter(function (d) {
66
+ return metadataLabels.includes(d);
67
+ });
68
+ if (availableGpuDims.length > 0) {
69
+ setFlamechartDimension(availableGpuDims.map(_temp));
70
+ hasAutoSelected.current = true;
71
+ return;
72
+ }
73
+ }
74
+ if (isOnCpuProfile(profileType)) {
75
+ var hasNode = metadataLabels.includes("node");
76
+ for (var _i = 0, _CPU_PREFERRED_DIMENS = CPU_PREFERRED_DIMENSIONS; _i < _CPU_PREFERRED_DIMENS.length; _i++) {
77
+ var name = _CPU_PREFERRED_DIMENS[_i];
78
+ if (metadataLabels.includes(name)) {
79
+ var dims = hasNode ? ["node", name] : [name];
80
+ setFlamechartDimension(dims.map(_temp2));
52
81
  hasAutoSelected.current = true;
53
82
  return;
83
+ }
54
84
  }
55
- if (isOnGpuProfile(profileType)) {
56
- const availableGpuDims = GPU_DIMENSIONS.filter(d => metadataLabels.includes(d));
57
- if (availableGpuDims.length > 0) {
58
- setFlamechartDimension(availableGpuDims.map(d => `labels.${d}`));
59
- hasAutoSelected.current = true;
60
- return;
61
- }
62
- }
63
- if (isOnCpuProfile(profileType)) {
64
- const hasNode = metadataLabels.includes('node');
65
- for (const name of CPU_PREFERRED_DIMENSIONS) {
66
- if (metadataLabels.includes(name)) {
67
- const dims = hasNode ? ['node', name] : [name];
68
- setFlamechartDimension(dims.map(d => `labels.${d}`));
69
- hasAutoSelected.current = true;
70
- return;
71
- }
72
- }
73
- }
74
- }, [metadataLabels, flamechartDimension, setFlamechartDimension, profileType]);
85
+ }
86
+ };
87
+ t1 = [metadataLabels, flamechartDimension, setFlamechartDimension, profileType];
88
+ $[0] = flamechartDimension;
89
+ $[1] = metadataLabels;
90
+ $[2] = profileType;
91
+ $[3] = setFlamechartDimension;
92
+ $[4] = t0;
93
+ $[5] = t1;
94
+ } else {
95
+ t0 = $[4];
96
+ t1 = $[5];
97
+ }
98
+ useEffect(t0, t1);
75
99
  };
100
+ function _temp(d_0) {
101
+ return "labels.".concat(d_0);
102
+ }
103
+ function _temp2(d_1) {
104
+ return "labels.".concat(d_1);
105
+ }