@parca/profile 0.19.140 → 0.19.143

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 (182) hide show
  1. package/CHANGELOG.md +9 -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.js +94 -68
  9. package/dist/MatchersInput/SuggestionItem.js +91 -12
  10. package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
  11. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  12. package/dist/MatchersInput/SuggestionsList.js +371 -157
  13. package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
  14. package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
  15. package/dist/MatchersInput/index.js +308 -115
  16. package/dist/MetricsCircle/index.js +39 -3
  17. package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
  18. package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
  19. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  20. package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
  21. package/dist/MetricsGraph/index.js +552 -203
  22. package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
  23. package/dist/MetricsGraph/utils/colorMapping.js +24 -17
  24. package/dist/MetricsSeries/index.js +70 -7
  25. package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
  26. package/dist/PreSelectedMatchers/index.js +249 -102
  27. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
  28. package/dist/ProfileExplorer/ProfileExplorerCompare.js +240 -45
  29. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  30. package/dist/ProfileExplorer/index.js +183 -32
  31. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  32. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  33. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  34. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  35. package/dist/ProfileFlameChart/index.js +260 -126
  36. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +283 -85
  37. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  38. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  39. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +71 -45
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  55. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  56. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  57. package/dist/ProfileFlameGraph/index.js +322 -147
  58. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  59. package/dist/ProfileMetricsGraph/index.js +515 -256
  60. package/dist/ProfileSelector/CompareButton.js +132 -12
  61. package/dist/ProfileSelector/MetricsGraphSection.js +228 -63
  62. package/dist/ProfileSelector/index.d.ts +1 -1
  63. package/dist/ProfileSelector/index.d.ts.map +1 -1
  64. package/dist/ProfileSelector/index.js +734 -142
  65. package/dist/ProfileSelector/useAutoQuerySelector.d.ts +1 -3
  66. package/dist/ProfileSelector/useAutoQuerySelector.d.ts.map +1 -1
  67. package/dist/ProfileSelector/useAutoQuerySelector.js +280 -132
  68. package/dist/ProfileSource.js +230 -163
  69. package/dist/ProfileTypeSelector/index.js +214 -125
  70. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  71. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +137 -32
  72. package/dist/ProfileView/components/ColorStackLegend.js +182 -54
  73. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  74. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  75. package/dist/ProfileView/components/DiffLegend.js +172 -29
  76. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  77. package/dist/ProfileView/components/InvertCallStack/index.js +97 -9
  78. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  79. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  80. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  81. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +191 -118
  82. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  83. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  84. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  85. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  86. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +664 -192
  87. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  88. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +196 -155
  89. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  90. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  91. package/dist/ProfileView/components/ViewSelector/index.js +186 -82
  92. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  93. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  94. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  95. package/dist/ProfileView/context/DashboardContext.js +74 -26
  96. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  97. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  98. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  99. package/dist/ProfileView/hooks/useResetFlameGraphState.js +31 -10
  100. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
  101. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +53 -17
  102. package/dist/ProfileView/hooks/useVisualizationState.js +229 -69
  103. package/dist/ProfileView/index.js +383 -45
  104. package/dist/ProfileView/types/visualization.js +1 -13
  105. package/dist/ProfileView/utils/colorUtils.js +8 -7
  106. package/dist/ProfileViewWithData.js +319 -225
  107. package/dist/QueryControls/index.js +418 -47
  108. package/dist/Sandwich/components/CalleesSection.js +54 -4
  109. package/dist/Sandwich/components/CallersSection.js +97 -27
  110. package/dist/Sandwich/components/TableSection.js +77 -4
  111. package/dist/Sandwich/index.js +125 -12
  112. package/dist/Sandwich/utils/processRowData.js +48 -39
  113. package/dist/SelectWithRefresh/index.js +102 -28
  114. package/dist/SimpleMatchers/Select.js +520 -187
  115. package/dist/SimpleMatchers/index.js +590 -288
  116. package/dist/SourceView/Highlighter.js +230 -70
  117. package/dist/SourceView/LineNo.js +72 -17
  118. package/dist/SourceView/index.js +177 -101
  119. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  120. package/dist/SourceView/lang-detector/index.js +28 -14
  121. package/dist/SourceView/useSelectedLineRange.js +72 -20
  122. package/dist/Table/ColorCell.js +42 -1
  123. package/dist/Table/ColumnsVisibility.js +114 -6
  124. package/dist/Table/MoreDropdown.js +107 -21
  125. package/dist/Table/TableContextMenu.js +144 -134
  126. package/dist/Table/TableContextMenuWrapper.js +59 -14
  127. package/dist/Table/hooks/useColorManagement.js +58 -16
  128. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  129. package/dist/Table/hooks/useTableConfiguration.js +323 -167
  130. package/dist/Table/index.js +217 -123
  131. package/dist/Table/utils/functions.js +169 -144
  132. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  133. package/dist/TimelineGuide/index.js +209 -16
  134. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  135. package/dist/TopTable/index.js +325 -121
  136. package/dist/contexts/LabelsQueryProvider.js +94 -32
  137. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  138. package/dist/contexts/utils.js +37 -15
  139. package/dist/hooks/urlParsers.js +27 -15
  140. package/dist/hooks/useColorBy.js +47 -10
  141. package/dist/hooks/useCompareModeMeta.js +112 -62
  142. package/dist/hooks/useDashboardItems.js +52 -11
  143. package/dist/hooks/useLabels.js +295 -52
  144. package/dist/hooks/useQueryState.d.ts +1 -1
  145. package/dist/hooks/useQueryState.d.ts.map +1 -1
  146. package/dist/hooks/useQueryState.js +375 -329
  147. package/dist/index.js +11 -6
  148. package/dist/testdata/fg-diff.json +3750 -0
  149. package/dist/testdata/fg-simple.json +1879 -0
  150. package/dist/testdata/link_data.json +56 -0
  151. package/dist/testdata/tabular.json +30 -0
  152. package/dist/testdata/test_flamegraph.json +26846 -0
  153. package/dist/testdata/test_graph.json +53 -0
  154. package/dist/useDelayedLoader.js +32 -18
  155. package/dist/useGrpcQuery/index.js +71 -11
  156. package/dist/useHasProfileData.js +90 -12
  157. package/dist/useQuery.js +205 -64
  158. package/dist/useSumBy.d.ts.map +1 -1
  159. package/dist/useSumBy.js +294 -138
  160. package/dist/utils.js +62 -30
  161. package/package.json +9 -9
  162. package/src/GraphTooltipArrow/index.tsx +3 -0
  163. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  164. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  165. package/src/MatchersInput/index.tsx +1 -1
  166. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  167. package/src/PreSelectedMatchers/index.tsx +3 -0
  168. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +9 -2
  169. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +3 -0
  170. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  171. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  172. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  173. package/src/ProfileSelector/index.tsx +31 -9
  174. package/src/ProfileSelector/useAutoQuerySelector.ts +64 -42
  175. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +3 -0
  176. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  177. package/src/Table/hooks/useTableConfiguration.tsx +7 -13
  178. package/src/hooks/useQueryState.ts +18 -3
  179. package/src/useDelayedLoader.ts +10 -10
  180. package/src/useSumBy.ts +12 -18
  181. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
  182. package/dist/hooks/useQueryState.test.js +0 -868
@@ -1,4 +1,10 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } 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,7 +17,8 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } 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.
14
- import { useMemo } from 'react';
20
+
21
+ import React, { useMemo } from 'react';
15
22
  import { Icon } from '@iconify/react';
16
23
  import cx from 'classnames';
17
24
  import { USER_PREFERENCES, useCurrentColorProfile, useUserPreference } from '@parca/hooks';
@@ -20,60 +27,181 @@ import { getMappingColors } from '../../ProfileFlameGraph/FlameGraphArrow';
20
27
  import useMappingList from '../../ProfileFlameGraph/FlameGraphArrow/useMappingList';
21
28
  import { useColorBy } from '../../hooks/useColorBy';
22
29
  import { useProfileFilters } from './ProfileFilters/useProfileFilters';
23
- const ColorStackLegend = ({ mappings, compareMode = false, loading }) => {
24
- const isDarkMode = useAppSelector(selectDarkMode);
25
- const currentColorProfile = useCurrentColorProfile();
26
- const [colorProfileName] = useUserPreference(USER_PREFERENCES.FLAMEGRAPH_COLOR_PROFILE.key);
27
- const { colorBy } = useColorBy();
28
- const { appliedFilters, removeExcludeBinary, excludeBinary } = useProfileFilters();
29
- // Get current binary filters from the new ProfileFilters system
30
- const currentBinaryFilters = useMemo(() => {
31
- return (appliedFilters ?? [])
32
- .filter(f => f.type === 'frame' && f.field === 'binary')
33
- .map(f => f.value);
34
- }, [appliedFilters]);
35
- const mappingsList = useMappingList(mappings);
36
- const mappingColors = useMemo(() => {
37
- const colors = getMappingColors(mappingsList, isDarkMode, currentColorProfile);
38
- return colors;
39
- }, [isDarkMode, mappingsList, currentColorProfile]);
40
- const stackColorArray = useMemo(() => {
41
- return Object.entries(mappingColors).sort(([featureA], [featureB]) => {
42
- if (featureA === EVERYTHING_ELSE) {
43
- return 1;
44
- }
45
- if (featureB === EVERYTHING_ELSE) {
46
- return -1;
47
- }
48
- return featureA?.localeCompare(featureB ?? '') ?? 0;
49
- });
50
- }, [mappingColors]);
51
- if (stackColorArray.length === 0 && loading === false) {
52
- return _jsx(_Fragment, {});
30
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
31
+ var ColorStackLegend = function ColorStackLegend(t0) {
32
+ var $ = _c(24);
33
+ var mappings = t0.mappings,
34
+ t1 = t0.compareMode,
35
+ loading = t0.loading;
36
+ var compareMode = t1 === undefined ? false : t1;
37
+ var isDarkMode = useAppSelector(selectDarkMode);
38
+ var currentColorProfile = useCurrentColorProfile();
39
+ var _useUserPreference = useUserPreference(USER_PREFERENCES.FLAMEGRAPH_COLOR_PROFILE.key),
40
+ _useUserPreference2 = _slicedToArray(_useUserPreference, 1),
41
+ colorProfileName = _useUserPreference2[0];
42
+ var _useColorBy = useColorBy(),
43
+ colorBy = _useColorBy.colorBy;
44
+ var _useProfileFilters = useProfileFilters(),
45
+ appliedFilters = _useProfileFilters.appliedFilters,
46
+ removeExcludeBinary = _useProfileFilters.removeExcludeBinary,
47
+ excludeBinary = _useProfileFilters.excludeBinary;
48
+ var t2;
49
+ if ($[0] !== appliedFilters) {
50
+ t2 = (appliedFilters !== null && appliedFilters !== void 0 ? appliedFilters : []).filter(_temp).map(_temp2);
51
+ $[0] = appliedFilters;
52
+ $[1] = t2;
53
+ } else {
54
+ t2 = $[1];
55
+ }
56
+ var currentBinaryFilters = t2;
57
+ var mappingsList = useMappingList(mappings);
58
+ var t3;
59
+ if ($[2] !== currentColorProfile || $[3] !== isDarkMode || $[4] !== mappingsList) {
60
+ t3 = getMappingColors(mappingsList, isDarkMode, currentColorProfile);
61
+ $[2] = currentColorProfile;
62
+ $[3] = isDarkMode;
63
+ $[4] = mappingsList;
64
+ $[5] = t3;
65
+ } else {
66
+ t3 = $[5];
67
+ }
68
+ var colors = t3;
69
+ var mappingColors = colors;
70
+ var t4;
71
+ if ($[6] !== mappingColors) {
72
+ t4 = Object.entries(mappingColors).sort(_temp3);
73
+ $[6] = mappingColors;
74
+ $[7] = t4;
75
+ } else {
76
+ t4 = $[7];
77
+ }
78
+ var stackColorArray = t4;
79
+ if (stackColorArray.length === 0 && loading === false) {
80
+ var _t;
81
+ if ($[8] === Symbol["for"]("react.memo_cache_sentinel")) {
82
+ _t = /*#__PURE__*/_jsx(_Fragment, {});
83
+ $[8] = _t;
84
+ } else {
85
+ _t = $[8];
86
+ }
87
+ return _t;
88
+ }
89
+ if (Object.entries(mappingColors).length === 0) {
90
+ var _t2;
91
+ if ($[9] === Symbol["for"]("react.memo_cache_sentinel")) {
92
+ _t2 = /*#__PURE__*/_jsx(_Fragment, {});
93
+ $[9] = _t2;
94
+ } else {
95
+ _t2 = $[9];
53
96
  }
54
- if (Object.entries(mappingColors).length === 0) {
55
- return _jsx(_Fragment, {});
97
+ return _t2;
98
+ }
99
+ if (colorProfileName === "default" || compareMode) {
100
+ var _t3;
101
+ if ($[10] === Symbol["for"]("react.memo_cache_sentinel")) {
102
+ _t3 = /*#__PURE__*/_jsx(_Fragment, {});
103
+ $[10] = _t3;
104
+ } else {
105
+ _t3 = $[10];
56
106
  }
57
- if (colorProfileName === 'default' || compareMode) {
58
- return _jsx(_Fragment, {});
107
+ return _t3;
108
+ }
109
+ var t5;
110
+ if ($[11] !== colorBy || $[12] !== currentBinaryFilters || $[13] !== excludeBinary || $[14] !== removeExcludeBinary || $[15] !== stackColorArray) {
111
+ var _t4;
112
+ if ($[17] !== colorBy || $[18] !== currentBinaryFilters || $[19] !== excludeBinary || $[20] !== removeExcludeBinary) {
113
+ _t4 = function _t4(t7) {
114
+ var _t5 = _slicedToArray(t7, 2),
115
+ feature = _t5[0],
116
+ color = _t5[1];
117
+ var filteringAllowed = feature !== EVERYTHING_ELSE;
118
+ var isHighlighted = currentBinaryFilters.includes(feature);
119
+ return /*#__PURE__*/_jsxs("div", {
120
+ className: cx("flex-no-wrap mb-1 flex w-[19.25%] items-center justify-between text-ellipsis p-1", {
121
+ "cursor-pointer": filteringAllowed && colorBy === "binary",
122
+ "bg-gray-200 dark:bg-gray-800": isHighlighted
123
+ }),
124
+ onClick: function onClick() {
125
+ if (!filteringAllowed || isHighlighted || colorBy !== "binary") {
126
+ return;
127
+ }
128
+ removeExcludeBinary(feature);
129
+ },
130
+ children: [/*#__PURE__*/_jsxs("div", {
131
+ className: "flex w-11/12 items-center justify-start",
132
+ children: [/*#__PURE__*/_jsx("div", {
133
+ className: "flex w-5 items-center",
134
+ children: /*#__PURE__*/_jsx("div", {
135
+ className: "mr-1 inline-block h-4 w-4 rounded-[4px]",
136
+ style: {
137
+ backgroundColor: color
138
+ }
139
+ })
140
+ }), /*#__PURE__*/_jsx("div", {
141
+ className: "shrink overflow-hidden text-ellipsis whitespace-nowrap text-sm hover:whitespace-normal",
142
+ children: feature
143
+ })]
144
+ }), /*#__PURE__*/_jsx("div", {
145
+ className: "flex w-1/12 justify-end",
146
+ children: isHighlighted && /*#__PURE__*/_jsx(Icon, {
147
+ icon: "radix-icons:cross-circled",
148
+ onClick: function onClick(e) {
149
+ excludeBinary(feature);
150
+ e.stopPropagation();
151
+ }
152
+ })
153
+ })]
154
+ }, feature);
155
+ };
156
+ $[17] = colorBy;
157
+ $[18] = currentBinaryFilters;
158
+ $[19] = excludeBinary;
159
+ $[20] = removeExcludeBinary;
160
+ $[21] = _t4;
161
+ } else {
162
+ _t4 = $[21];
59
163
  }
60
- return (_jsx("div", { className: "my-4 flex w-full flex-wrap justify-start column-gap-2", children: stackColorArray.map(([feature, color]) => {
61
- const filteringAllowed = feature !== EVERYTHING_ELSE;
62
- const isHighlighted = currentBinaryFilters.includes(feature);
63
- return (_jsxs("div", { className: cx('flex-no-wrap mb-1 flex w-[19.25%] items-center justify-between text-ellipsis p-1', {
64
- 'cursor-pointer': filteringAllowed && colorBy === 'binary',
65
- 'bg-gray-200 dark:bg-gray-800': isHighlighted,
66
- }), onClick: () => {
67
- if (!filteringAllowed || isHighlighted || colorBy !== 'binary') {
68
- return;
69
- }
70
- // Remove the exclude filter for this binary
71
- removeExcludeBinary(feature);
72
- }, children: [_jsxs("div", { className: "flex w-11/12 items-center justify-start", children: [_jsx("div", { className: "flex w-5 items-center", children: _jsx("div", { className: "mr-1 inline-block h-4 w-4 rounded-[4px]", style: { backgroundColor: color } }) }), _jsx("div", { className: "shrink overflow-hidden text-ellipsis whitespace-nowrap text-sm hover:whitespace-normal", children: feature })] }), _jsx("div", { className: "flex w-1/12 justify-end", children: isHighlighted && (_jsx(Icon, { icon: "radix-icons:cross-circled", onClick: e => {
73
- // Find and remove the filter for this binary
74
- excludeBinary(feature);
75
- e.stopPropagation();
76
- } })) })] }, feature));
77
- }) }));
164
+ t5 = stackColorArray.map(_t4);
165
+ $[11] = colorBy;
166
+ $[12] = currentBinaryFilters;
167
+ $[13] = excludeBinary;
168
+ $[14] = removeExcludeBinary;
169
+ $[15] = stackColorArray;
170
+ $[16] = t5;
171
+ } else {
172
+ t5 = $[16];
173
+ }
174
+ var t6;
175
+ if ($[22] !== t5) {
176
+ t6 = /*#__PURE__*/_jsx("div", {
177
+ className: "my-4 flex w-full flex-wrap justify-start column-gap-2",
178
+ children: t5
179
+ });
180
+ $[22] = t5;
181
+ $[23] = t6;
182
+ } else {
183
+ t6 = $[23];
184
+ }
185
+ return t6;
78
186
  };
79
187
  export default ColorStackLegend;
188
+ function _temp(f) {
189
+ return f.type === "frame" && f.field === "binary";
190
+ }
191
+ function _temp2(f_0) {
192
+ return f_0.value;
193
+ }
194
+ function _temp3(t0, t1) {
195
+ var _featureA$localeCompa;
196
+ var _t6 = _slicedToArray(t0, 1),
197
+ featureA = _t6[0];
198
+ var _t7 = _slicedToArray(t1, 1),
199
+ featureB = _t7[0];
200
+ if (featureA === EVERYTHING_ELSE) {
201
+ return 1;
202
+ }
203
+ if (featureB === EVERYTHING_ELSE) {
204
+ return -1;
205
+ }
206
+ return (_featureA$localeCompa = featureA === null || featureA === void 0 ? void 0 : featureA.localeCompare(featureB !== null && featureB !== void 0 ? featureB : "")) !== null && _featureA$localeCompa !== void 0 ? _featureA$localeCompa : 0;
207
+ }
@@ -1,4 +1,3 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
1
  // Copyright 2022 The Parca Authors
3
2
  // Licensed under the Apache License, Version 2.0 (the "License");
4
3
  // you may not use this file except in compliance with the License.
@@ -11,6 +10,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
11
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
11
  // See the License for the specific language governing permissions and
13
12
  // limitations under the License.
13
+
14
14
  import { Profiler } from 'react';
15
15
  import { ConditionalWrapper } from '@parca/components';
16
16
  import ProfileFlameChart from '../../../ProfileFlameChart';
@@ -18,30 +18,89 @@ import ProfileFlameGraph from '../../../ProfileFlameGraph';
18
18
  import Sandwich from '../../../Sandwich';
19
19
  import { SourceView } from '../../../SourceView';
20
20
  import { Table } from '../../../Table';
21
- export const getDashboardItem = ({ type, isHalfScreen, dimensions, flamegraphData, samplesData, topTableData, sourceData, sandwichData, profileSource, total, filtered, curPathArrow, setNewCurPathArrow, perf, queryClient, onSwitchToFifteenMinutes, }) => {
22
- switch (type) {
23
- case 'flamegraph':
24
- return (_jsx(ConditionalWrapper, { condition: perf?.onRender != null, WrapperComponent: Profiler, wrapperProps: {
25
- id: 'flameGraph',
26
- onRender: perf?.onRender ?? (() => { }),
27
- }, children: _jsx(ProfileFlameGraph, { curPathArrow: curPathArrow, setNewCurPathArrow: setNewCurPathArrow, arrow: flamegraphData?.arrow, total: total, filtered: filtered, profileType: profileSource?.ProfileType(), loading: flamegraphData.loading, error: flamegraphData.error, isHalfScreen: isHalfScreen, width: dimensions?.width !== undefined
28
- ? isHalfScreen
29
- ? (dimensions.width - 54) / 2
30
- : dimensions.width - 16
31
- : 0, metadataMappingFiles: flamegraphData.metadataMappingFiles, metadataLoading: flamegraphData.metadataLoading, profileSource: profileSource }) }));
32
- case 'flamechart':
33
- return (_jsx(ProfileFlameChart, { samplesData: samplesData, queryClient: queryClient, profileSource: profileSource, width: dimensions?.width !== undefined
34
- ? isHalfScreen
35
- ? (dimensions.width - 54) / 2
36
- : dimensions.width - 16
37
- : 0, total: total, filtered: filtered, profileType: profileSource?.ProfileType(), isHalfScreen: isHalfScreen, metadataMappingFiles: flamegraphData.metadataMappingFiles, metadataLoading: flamegraphData.metadataLoading, onSwitchToFifteenMinutes: onSwitchToFifteenMinutes }));
38
- case 'table':
39
- return topTableData != null ? (_jsx(Table, { error: topTableData.error, total: total, filtered: filtered, loading: topTableData.loading, data: topTableData.arrow?.record, unit: topTableData.unit, profileType: profileSource?.ProfileType(), isHalfScreen: isHalfScreen, metadataMappingFiles: flamegraphData.metadataMappingFiles })) : (_jsx(_Fragment, {}));
40
- case 'sandwich':
41
- return topTableData != null ? (_jsx(Sandwich, { profileSource: profileSource, sandwichData: sandwichData })) : (_jsx(_Fragment, {}));
42
- case 'source':
43
- return sourceData != null ? (_jsx(SourceView, { loading: sourceData.loading, data: sourceData.data, total: total, filtered: filtered })) : (_jsx(_Fragment, {}));
44
- default:
45
- return _jsx(_Fragment, {});
46
- }
47
- };
21
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
22
+ export var getDashboardItem = function getDashboardItem(_ref) {
23
+ var _perf$onRender, _topTableData$arrow;
24
+ var type = _ref.type,
25
+ isHalfScreen = _ref.isHalfScreen,
26
+ dimensions = _ref.dimensions,
27
+ flamegraphData = _ref.flamegraphData,
28
+ samplesData = _ref.samplesData,
29
+ topTableData = _ref.topTableData,
30
+ sourceData = _ref.sourceData,
31
+ sandwichData = _ref.sandwichData,
32
+ profileSource = _ref.profileSource,
33
+ total = _ref.total,
34
+ filtered = _ref.filtered,
35
+ curPathArrow = _ref.curPathArrow,
36
+ setNewCurPathArrow = _ref.setNewCurPathArrow,
37
+ perf = _ref.perf,
38
+ queryClient = _ref.queryClient,
39
+ onSwitchToFifteenMinutes = _ref.onSwitchToFifteenMinutes;
40
+ switch (type) {
41
+ case 'flamegraph':
42
+ return /*#__PURE__*/_jsx(ConditionalWrapper, {
43
+ condition: (perf === null || perf === void 0 ? void 0 : perf.onRender) != null,
44
+ WrapperComponent: Profiler,
45
+ wrapperProps: {
46
+ id: 'flameGraph',
47
+ onRender: (_perf$onRender = perf === null || perf === void 0 ? void 0 : perf.onRender) !== null && _perf$onRender !== void 0 ? _perf$onRender : function () {}
48
+ },
49
+ children: /*#__PURE__*/_jsx(ProfileFlameGraph, {
50
+ curPathArrow: curPathArrow,
51
+ setNewCurPathArrow: setNewCurPathArrow,
52
+ arrow: flamegraphData === null || flamegraphData === void 0 ? void 0 : flamegraphData.arrow,
53
+ total: total,
54
+ filtered: filtered,
55
+ profileType: profileSource === null || profileSource === void 0 ? void 0 : profileSource.ProfileType(),
56
+ loading: flamegraphData.loading,
57
+ error: flamegraphData.error,
58
+ isHalfScreen: isHalfScreen,
59
+ width: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) !== undefined ? isHalfScreen ? (dimensions.width - 54) / 2 : dimensions.width - 16 : 0,
60
+ metadataMappingFiles: flamegraphData.metadataMappingFiles,
61
+ metadataLoading: flamegraphData.metadataLoading,
62
+ profileSource: profileSource
63
+ })
64
+ });
65
+ case 'flamechart':
66
+ return /*#__PURE__*/_jsx(ProfileFlameChart, {
67
+ samplesData: samplesData,
68
+ queryClient: queryClient,
69
+ profileSource: profileSource,
70
+ width: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) !== undefined ? isHalfScreen ? (dimensions.width - 54) / 2 : dimensions.width - 16 : 0,
71
+ total: total,
72
+ filtered: filtered,
73
+ profileType: profileSource === null || profileSource === void 0 ? void 0 : profileSource.ProfileType(),
74
+ isHalfScreen: isHalfScreen,
75
+ metadataMappingFiles: flamegraphData.metadataMappingFiles,
76
+ metadataLoading: flamegraphData.metadataLoading,
77
+ onSwitchToFifteenMinutes: onSwitchToFifteenMinutes
78
+ });
79
+ case 'table':
80
+ return topTableData != null ? /*#__PURE__*/_jsx(Table, {
81
+ error: topTableData.error,
82
+ total: total,
83
+ filtered: filtered,
84
+ loading: topTableData.loading,
85
+ data: (_topTableData$arrow = topTableData.arrow) === null || _topTableData$arrow === void 0 ? void 0 : _topTableData$arrow.record,
86
+ unit: topTableData.unit,
87
+ profileType: profileSource === null || profileSource === void 0 ? void 0 : profileSource.ProfileType(),
88
+ isHalfScreen: isHalfScreen,
89
+ metadataMappingFiles: flamegraphData.metadataMappingFiles
90
+ }) : /*#__PURE__*/_jsx(_Fragment, {});
91
+ case 'sandwich':
92
+ return topTableData != null ? /*#__PURE__*/_jsx(Sandwich, {
93
+ profileSource: profileSource,
94
+ sandwichData: sandwichData
95
+ }) : /*#__PURE__*/_jsx(_Fragment, {});
96
+ case 'source':
97
+ return sourceData != null ? /*#__PURE__*/_jsx(SourceView, {
98
+ loading: sourceData.loading,
99
+ data: sourceData.data,
100
+ total: total,
101
+ filtered: filtered
102
+ }) : /*#__PURE__*/_jsx(_Fragment, {});
103
+ default:
104
+ return /*#__PURE__*/_jsx(_Fragment, {});
105
+ }
106
+ };
@@ -1,20 +1,112 @@
1
- import { jsx as _jsx, jsxs as _jsxs } 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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
8
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread 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 _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
11
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
12
+ 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; }
13
+ import { c as _c } from "react-compiler-runtime"; // Copyright 2022 The Parca Authors
14
+ // Licensed under the Apache License, Version 2.0 (the "License");
15
+ // you may not use this file except in compliance with the License.
16
+ // You may obtain a copy of the License at
17
+ //
18
+ // http://www.apache.org/licenses/LICENSE-2.0
19
+ //
20
+ // Unless required by applicable law or agreed to in writing, software
21
+ // distributed under the License is distributed on an "AS IS" BASIS,
22
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
+ // See the License for the specific language governing permissions and
24
+ // limitations under the License.
2
25
  import cx from 'classnames';
3
- import { DragDropContext, Draggable, Droppable, } from 'react-beautiful-dnd';
26
+ import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
4
27
  import { useDashboard } from '../../context/DashboardContext';
5
28
  import { VisualizationContainer } from '../VisualizationContainer';
6
- export const DashboardLayout = ({ getDashboardItemByType, actionButtons, }) => {
7
- const { dashboardItems, setDashboardItems, isMultiPanelView } = useDashboard();
8
- const onDragEnd = (result) => {
9
- const { destination, source, draggableId } = result;
10
- if (Boolean(destination) && destination?.index !== source.index) {
11
- const targetItem = draggableId;
12
- const otherItems = dashboardItems.filter(item => item !== targetItem);
13
- const newDashboardItems = destination.index < source.index
14
- ? [targetItem, ...otherItems]
15
- : [...otherItems, targetItem];
16
- setDashboardItems(newDashboardItems);
17
- }
29
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
30
+ export var DashboardLayout = function DashboardLayout(t0) {
31
+ var $ = _c(11);
32
+ var getDashboardItemByType = t0.getDashboardItemByType,
33
+ actionButtons = t0.actionButtons;
34
+ var _useDashboard = useDashboard(),
35
+ dashboardItems = _useDashboard.dashboardItems,
36
+ setDashboardItems = _useDashboard.setDashboardItems,
37
+ isMultiPanelView = _useDashboard.isMultiPanelView;
38
+ var t1;
39
+ if ($[0] !== dashboardItems || $[1] !== setDashboardItems) {
40
+ t1 = function t1(result) {
41
+ var destination = result.destination,
42
+ source = result.source,
43
+ draggableId = result.draggableId;
44
+ if (Boolean(destination) && (destination === null || destination === void 0 ? void 0 : destination.index) !== source.index) {
45
+ var targetItem = draggableId;
46
+ var otherItems = dashboardItems.filter(function (item) {
47
+ return item !== targetItem;
48
+ });
49
+ var newDashboardItems = destination.index < source.index ? [targetItem].concat(_toConsumableArray(otherItems)) : [].concat(_toConsumableArray(otherItems), [targetItem]);
50
+ setDashboardItems(newDashboardItems);
51
+ }
18
52
  };
19
- return (_jsx(DragDropContext, { onDragEnd: onDragEnd, children: _jsx(Droppable, { droppableId: "droppable", direction: "horizontal", children: provided => (_jsxs("div", { ref: provided.innerRef, className: cx('grid w-full gap-2', isMultiPanelView ? 'grid-cols-2 mt-4' : 'grid-cols-1'), ...provided.droppableProps, children: [dashboardItems.map((dashboardItem, index) => (_jsx(Draggable, { draggableId: dashboardItem, index: index, isDragDisabled: !isMultiPanelView, children: (provided, snapshot) => (_jsx(VisualizationContainer, { provided: provided, snapshot: snapshot, dashboardItem: dashboardItem, getDashboardItemByType: getDashboardItemByType, isMultiPanelView: isMultiPanelView, index: index, actionButtons: actionButtons })) }, dashboardItem))), provided.placeholder] })) }) }));
20
- };
53
+ $[0] = dashboardItems;
54
+ $[1] = setDashboardItems;
55
+ $[2] = t1;
56
+ } else {
57
+ t1 = $[2];
58
+ }
59
+ var onDragEnd = t1;
60
+ var t2;
61
+ if ($[3] !== actionButtons || $[4] !== dashboardItems || $[5] !== getDashboardItemByType || $[6] !== isMultiPanelView) {
62
+ t2 = /*#__PURE__*/_jsx(Droppable, {
63
+ droppableId: "droppable",
64
+ direction: "horizontal",
65
+ children: function children(provided) {
66
+ return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
67
+ ref: provided.innerRef,
68
+ className: cx("grid w-full gap-2", isMultiPanelView ? "grid-cols-2 mt-4" : "grid-cols-1")
69
+ }, provided.droppableProps), {}, {
70
+ children: [dashboardItems.map(function (dashboardItem, index) {
71
+ return /*#__PURE__*/_jsx(Draggable, {
72
+ draggableId: dashboardItem,
73
+ index: index,
74
+ isDragDisabled: !isMultiPanelView,
75
+ children: function children(provided_0, snapshot) {
76
+ return /*#__PURE__*/_jsx(VisualizationContainer, {
77
+ provided: provided_0,
78
+ snapshot: snapshot,
79
+ dashboardItem: dashboardItem,
80
+ getDashboardItemByType: getDashboardItemByType,
81
+ isMultiPanelView: isMultiPanelView,
82
+ index: index,
83
+ actionButtons: actionButtons
84
+ });
85
+ }
86
+ }, dashboardItem);
87
+ }), provided.placeholder]
88
+ }));
89
+ }
90
+ });
91
+ $[3] = actionButtons;
92
+ $[4] = dashboardItems;
93
+ $[5] = getDashboardItemByType;
94
+ $[6] = isMultiPanelView;
95
+ $[7] = t2;
96
+ } else {
97
+ t2 = $[7];
98
+ }
99
+ var t3;
100
+ if ($[8] !== onDragEnd || $[9] !== t2) {
101
+ t3 = /*#__PURE__*/_jsx(DragDropContext, {
102
+ onDragEnd: onDragEnd,
103
+ children: t2
104
+ });
105
+ $[8] = onDragEnd;
106
+ $[9] = t2;
107
+ $[10] = t3;
108
+ } else {
109
+ t3 = $[10];
110
+ }
111
+ return t3;
112
+ };