@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.
- package/CHANGELOG.md +5 -1
- package/dist/GraphTooltipArrow/Content.js +224 -30
- package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
- package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
- package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
- package/dist/GraphTooltipArrow/index.js +86 -56
- package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
- package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.d.ts.map +1 -1
- package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +104 -72
- package/dist/MatchersInput/SuggestionItem.js +91 -12
- package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
- package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
- package/dist/MatchersInput/SuggestionsList.js +371 -157
- package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
- package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
- package/dist/MatchersInput/index.js +308 -115
- package/dist/MetricsCircle/index.js +39 -3
- package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
- package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
- package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
- package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
- package/dist/MetricsGraph/index.js +552 -203
- package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
- package/dist/MetricsGraph/utils/colorMapping.js +24 -17
- package/dist/MetricsSeries/index.js +70 -7
- package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
- package/dist/PreSelectedMatchers/index.js +249 -102
- package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
- package/dist/ProfileExplorer/ProfileExplorerCompare.js +241 -45
- package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
- package/dist/ProfileExplorer/index.js +183 -32
- package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
- package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
- package/dist/ProfileFlameChart/SamplesStrips/index.d.ts +2 -2
- package/dist/ProfileFlameChart/SamplesStrips/index.d.ts.map +1 -1
- package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
- package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
- package/dist/ProfileFlameChart/index.d.ts.map +1 -1
- package/dist/ProfileFlameChart/index.js +267 -129
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +288 -89
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
- package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
- package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
- package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
- package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +72 -47
- package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
- package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
- package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
- package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
- package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
- package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
- package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
- package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
- package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
- package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
- package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
- package/dist/ProfileFlameGraph/index.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/index.js +324 -150
- package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
- package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
- package/dist/ProfileMetricsGraph/index.js +519 -258
- package/dist/ProfileSelector/CompareButton.js +132 -12
- package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
- package/dist/ProfileSelector/MetricsGraphSection.js +236 -64
- package/dist/ProfileSelector/index.d.ts.map +1 -1
- package/dist/ProfileSelector/index.js +727 -141
- package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
- package/dist/ProfileSource.js +230 -163
- package/dist/ProfileTypeSelector/index.js +214 -125
- package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
- package/dist/ProfileView/components/ActionButtons/SortByDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +141 -35
- package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -1
- package/dist/ProfileView/components/ColorStackLegend.js +185 -55
- package/dist/ProfileView/components/DashboardItems/index.js +87 -28
- package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
- package/dist/ProfileView/components/DiffLegend.js +172 -29
- package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
- package/dist/ProfileView/components/InvertCallStack/index.d.ts.map +1 -1
- package/dist/ProfileView/components/InvertCallStack/index.js +100 -12
- package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
- package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
- package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts +2 -1
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -1
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -118
- package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
- package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
- package/dist/ProfileView/components/ShareButton/index.js +352 -62
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +678 -194
- package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +199 -157
- package/dist/ProfileView/components/Toolbars/index.d.ts +2 -2
- package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/index.js +441 -21
- package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
- package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
- package/dist/ProfileView/components/ViewSelector/index.js +212 -86
- package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
- package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
- package/dist/ProfileView/components/VisualizationPanel.js +185 -8
- package/dist/ProfileView/context/DashboardContext.d.ts.map +1 -1
- package/dist/ProfileView/context/DashboardContext.js +85 -29
- package/dist/ProfileView/context/ProfileViewContext.js +56 -15
- package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
- package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
- package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetFlameGraphState.js +32 -12
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
- package/dist/ProfileView/hooks/useResetStateOnSeriesChange.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +40 -19
- package/dist/ProfileView/hooks/useVisualizationState.d.ts +3 -3
- package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useVisualizationState.js +258 -67
- package/dist/ProfileView/index.js +383 -45
- package/dist/ProfileView/types/visualization.js +1 -13
- package/dist/ProfileView/utils/colorUtils.js +8 -7
- package/dist/ProfileViewWithData.d.ts.map +1 -1
- package/dist/ProfileViewWithData.js +332 -228
- package/dist/QueryControls/index.js +418 -47
- package/dist/Sandwich/components/CalleesSection.js +54 -4
- package/dist/Sandwich/components/CallersSection.js +97 -27
- package/dist/Sandwich/components/TableSection.js +77 -4
- package/dist/Sandwich/index.d.ts.map +1 -1
- package/dist/Sandwich/index.js +126 -14
- package/dist/Sandwich/utils/processRowData.js +48 -39
- package/dist/SelectWithRefresh/index.js +102 -28
- package/dist/SimpleMatchers/Select.js +520 -187
- package/dist/SimpleMatchers/index.js +590 -288
- package/dist/SourceView/Highlighter.js +230 -70
- package/dist/SourceView/LineNo.js +72 -17
- package/dist/SourceView/index.d.ts.map +1 -1
- package/dist/SourceView/index.js +178 -104
- package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
- package/dist/SourceView/lang-detector/index.js +28 -14
- package/dist/SourceView/useSelectedLineRange.d.ts.map +1 -1
- package/dist/SourceView/useSelectedLineRange.js +99 -23
- package/dist/Table/ColorCell.js +42 -1
- package/dist/Table/ColumnsVisibility.js +114 -6
- package/dist/Table/MoreDropdown.d.ts.map +1 -1
- package/dist/Table/MoreDropdown.js +122 -25
- package/dist/Table/TableContextMenu.d.ts.map +1 -1
- package/dist/Table/TableContextMenu.js +151 -137
- package/dist/Table/TableContextMenuWrapper.js +59 -14
- package/dist/Table/hooks/useColorManagement.js +58 -16
- package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
- package/dist/Table/hooks/useTableConfiguration.js +333 -169
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +222 -128
- package/dist/Table/utils/functions.js +169 -144
- package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
- package/dist/TimelineGuide/index.js +209 -16
- package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
- package/dist/TopTable/index.d.ts.map +1 -1
- package/dist/TopTable/index.js +342 -123
- package/dist/contexts/LabelsQueryProvider.js +94 -32
- package/dist/contexts/UnifiedLabelsContext.js +114 -49
- package/dist/contexts/utils.js +37 -15
- package/dist/hooks/useCompareModeMeta.d.ts.map +1 -1
- package/dist/hooks/useCompareModeMeta.js +158 -64
- package/dist/hooks/useLabels.js +295 -52
- package/dist/hooks/useQueryState.d.ts +3 -3
- package/dist/hooks/useQueryState.d.ts.map +1 -1
- package/dist/hooks/useQueryState.js +373 -332
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -8
- package/dist/testdata/fg-diff.json +3750 -0
- package/dist/testdata/fg-simple.json +1879 -0
- package/dist/testdata/link_data.json +56 -0
- package/dist/testdata/tabular.json +30 -0
- package/dist/testdata/test_flamegraph.json +26846 -0
- package/dist/testdata/test_graph.json +53 -0
- package/dist/useDelayedLoader.js +32 -18
- package/dist/useGrpcQuery/index.js +71 -11
- package/dist/useHasProfileData.js +90 -12
- package/dist/useQuery.js +205 -64
- package/dist/useSumBy.d.ts +1 -1
- package/dist/useSumBy.d.ts.map +1 -1
- package/dist/useSumBy.js +294 -138
- package/dist/utils.js +62 -30
- package/package.json +9 -10
- package/src/GraphTooltipArrow/index.tsx +3 -0
- package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +13 -11
- package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
- package/src/MatchersInput/SuggestionsList.tsx +11 -10
- package/src/MatchersInput/index.tsx +1 -1
- package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
- package/src/PreSelectedMatchers/index.tsx +3 -0
- package/src/ProfileExplorer/ProfileExplorerCompare.tsx +9 -4
- package/src/ProfileFlameChart/SamplesStrips/index.tsx +2 -2
- package/src/ProfileFlameChart/index.tsx +28 -21
- package/src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx +9 -10
- package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +6 -5
- package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
- package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
- package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
- package/src/ProfileFlameGraph/index.tsx +9 -6
- package/src/ProfileMetricsGraph/index.tsx +8 -6
- package/src/ProfileSelector/MetricsGraphSection.tsx +10 -5
- package/src/ProfileSelector/index.tsx +61 -39
- package/src/ProfileView/components/ActionButtons/SortByDropdown.tsx +6 -10
- package/src/ProfileView/components/ColorStackLegend.tsx +4 -2
- package/src/ProfileView/components/InvertCallStack/index.tsx +4 -5
- package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.tsx +192 -94
- package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +21 -21
- package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +28 -24
- package/src/ProfileView/components/Toolbars/TableColumnsDropdown.tsx +5 -4
- package/src/ProfileView/components/Toolbars/index.tsx +3 -3
- package/src/ProfileView/components/ViewSelector/index.tsx +16 -9
- package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
- package/src/ProfileView/context/DashboardContext.tsx +6 -6
- package/src/ProfileView/hooks/useResetFlameGraphState.ts +4 -6
- package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +26 -24
- package/src/ProfileView/hooks/useResetStateOnSeriesChange.ts +8 -16
- package/src/ProfileView/hooks/useVisualizationState.ts +69 -61
- package/src/ProfileViewWithData.tsx +35 -29
- package/src/Sandwich/index.tsx +3 -4
- package/src/SourceView/index.tsx +2 -4
- package/src/SourceView/useSelectedLineRange.ts +19 -34
- package/src/Table/MoreDropdown.tsx +11 -9
- package/src/Table/TableContextMenu.tsx +13 -10
- package/src/Table/hooks/useTableConfiguration.tsx +11 -16
- package/src/Table/index.tsx +21 -12
- package/src/TopTable/index.tsx +4 -3
- package/src/hooks/useCompareModeMeta.ts +91 -61
- package/src/hooks/useQueryState.test.tsx +345 -275
- package/src/hooks/useQueryState.ts +118 -136
- package/src/index.tsx +15 -16
- package/src/useDelayedLoader.ts +10 -10
- package/src/useSumBy.ts +15 -21
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
- package/dist/hooks/urlParsers.d.ts +0 -18
- package/dist/hooks/urlParsers.d.ts.map +0 -1
- package/dist/hooks/urlParsers.js +0 -32
- package/dist/hooks/useColorBy.d.ts +0 -5
- package/dist/hooks/useColorBy.d.ts.map +0 -1
- package/dist/hooks/useColorBy.js +0 -26
- package/dist/hooks/useDashboardItems.d.ts +0 -5
- package/dist/hooks/useDashboardItems.d.ts.map +0 -1
- package/dist/hooks/useDashboardItems.js +0 -27
- package/dist/hooks/useQueryState.test.js +0 -868
- package/src/hooks/urlParsers.ts +0 -38
- package/src/hooks/useColorBy.ts +0 -42
- package/src/hooks/useDashboardItems.ts +0 -46
package/dist/useSumBy.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
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";
|
|
1
14
|
// Copyright 2022 The Parca Authors
|
|
2
15
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
16
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,155 +23,298 @@
|
|
|
10
23
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
24
|
// See the License for the specific language governing permissions and
|
|
12
25
|
// limitations under the License.
|
|
13
|
-
|
|
26
|
+
|
|
27
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
14
28
|
import { useLabelNames } from './hooks/useLabels';
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
if (!profile.delta) {
|
|
21
|
-
return DEFAULT_EMPTY_SUM_BY;
|
|
22
|
-
}
|
|
23
|
-
if (labels.includes('comm')) {
|
|
24
|
-
return ['comm'];
|
|
25
|
-
}
|
|
26
|
-
if (labels.includes('namespace')) {
|
|
27
|
-
return ['namespace'];
|
|
28
|
-
}
|
|
29
|
-
if (labels.includes('container')) {
|
|
30
|
-
return ['container'];
|
|
31
|
-
}
|
|
29
|
+
export var DEFAULT_EMPTY_SUM_BY = [];
|
|
30
|
+
var getDefaultSumBy = function getDefaultSumBy(profile, labels) {
|
|
31
|
+
if (profile === undefined || labels === undefined) {
|
|
32
32
|
return undefined;
|
|
33
|
+
}
|
|
34
|
+
if (!profile.delta) {
|
|
35
|
+
return DEFAULT_EMPTY_SUM_BY;
|
|
36
|
+
}
|
|
37
|
+
if (labels.includes('comm')) {
|
|
38
|
+
return ['comm'];
|
|
39
|
+
}
|
|
40
|
+
if (labels.includes('namespace')) {
|
|
41
|
+
return ['namespace'];
|
|
42
|
+
}
|
|
43
|
+
if (labels.includes('container')) {
|
|
44
|
+
return ['container'];
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
33
47
|
};
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const lastValidSumByRef = useRef(DEFAULT_EMPTY_SUM_BY);
|
|
59
|
-
const sumBy = useMemo(() => {
|
|
60
|
-
if (labelNamesLoading) {
|
|
61
|
-
// For smoother UX, return draftSumBy first if available during loading
|
|
62
|
-
// as this must be recently computed with the draft time range labels.
|
|
63
|
-
if (draftSumBy !== undefined) {
|
|
64
|
-
return draftSumBy;
|
|
65
|
-
}
|
|
66
|
-
if (lastValidSumByRef.current == null) {
|
|
67
|
-
return lastValidSumByRef.current;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
// Prefer non-empty URL default over auto-computed default to avoid a
|
|
71
|
-
// one-render race where defaultSumBy overwrites the default value from upstream.
|
|
72
|
-
const hasExplicitDefault = defaultValue != null && defaultValue.length > 0;
|
|
73
|
-
let result = userSelectedSumBy[profileType?.toString() ?? ''] ??
|
|
74
|
-
(hasExplicitDefault ? defaultValue : undefined) ??
|
|
75
|
-
defaultSumBy ??
|
|
76
|
-
DEFAULT_EMPTY_SUM_BY;
|
|
77
|
-
if (profileType?.delta !== true) {
|
|
78
|
-
result = DEFAULT_EMPTY_SUM_BY;
|
|
79
|
-
}
|
|
80
|
-
// Store the computed value for next loading state
|
|
81
|
-
lastValidSumByRef.current = result;
|
|
82
|
-
return result;
|
|
83
|
-
}, [userSelectedSumBy, profileType, defaultSumBy, labelNamesLoading, draftSumBy, defaultValue]);
|
|
84
|
-
return [
|
|
85
|
-
sumBy,
|
|
86
|
-
setSumBy,
|
|
87
|
-
{
|
|
88
|
-
isLoading: labelNamesLoading,
|
|
89
|
-
},
|
|
90
|
-
];
|
|
91
|
-
};
|
|
92
|
-
export const useDefaultSumBy = (profileType, labelNamesLoading, labels) => {
|
|
93
|
-
const defaultSumBy = useMemo(() => {
|
|
94
|
-
return getDefaultSumBy(profileType, labels);
|
|
95
|
-
}, [profileType, labels]);
|
|
96
|
-
return { defaultSumBy, isLoading: labelNamesLoading };
|
|
97
|
-
};
|
|
98
|
-
const getSumByFromParam = (param) => {
|
|
99
|
-
if (param?.length === 0) {
|
|
100
|
-
return undefined;
|
|
48
|
+
export var useSumBySelection = function useSumBySelection(profileType, labelNamesLoading, labels, draftSumBy) {
|
|
49
|
+
var _ref = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {},
|
|
50
|
+
defaultValue = _ref.defaultValue;
|
|
51
|
+
var _useState = useState(profileType != null ? _defineProperty({}, profileType.toString(), defaultValue) : {}),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
userSelectedSumBy = _useState2[0],
|
|
54
|
+
setUserSelectedSumBy = _useState2[1];
|
|
55
|
+
|
|
56
|
+
// Update userSelectedSumBy when defaultValue changes (e.g., during navigation)
|
|
57
|
+
var _useState3 = useState(profileType),
|
|
58
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
+
prevProfileType = _useState4[0],
|
|
60
|
+
setPrevProfileType = _useState4[1];
|
|
61
|
+
var _useState5 = useState(defaultValue),
|
|
62
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
63
|
+
prevDefaultValue = _useState6[0],
|
|
64
|
+
setPrevDefaultValue = _useState6[1];
|
|
65
|
+
if (prevProfileType !== profileType || prevDefaultValue !== defaultValue) {
|
|
66
|
+
setPrevProfileType(profileType);
|
|
67
|
+
setPrevDefaultValue(defaultValue);
|
|
68
|
+
if (profileType != null && defaultValue !== undefined) {
|
|
69
|
+
setUserSelectedSumBy(function (prev) {
|
|
70
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, profileType.toString(), defaultValue));
|
|
71
|
+
});
|
|
101
72
|
}
|
|
102
|
-
|
|
103
|
-
|
|
73
|
+
}
|
|
74
|
+
var setSumBy = useCallback(function (sumBy) {
|
|
75
|
+
setUserSelectedSumBy(function (prev_0) {
|
|
76
|
+
if (profileType == null) {
|
|
77
|
+
return prev_0;
|
|
78
|
+
}
|
|
79
|
+
return _objectSpread(_objectSpread({}, prev_0), {}, _defineProperty({}, profileType.toString(), sumBy));
|
|
80
|
+
});
|
|
81
|
+
}, [setUserSelectedSumBy, profileType]);
|
|
82
|
+
var _useDefaultSumBy = useDefaultSumBy(profileType, labelNamesLoading, labels),
|
|
83
|
+
defaultSumBy = _useDefaultSumBy.defaultSumBy;
|
|
84
|
+
var sumBy_0 = useMemo(function () {
|
|
85
|
+
var _ref3, _ref4, _userSelectedSumBy, _profileType$toString;
|
|
86
|
+
// For smoother UX, return draftSumBy first if available during loading
|
|
87
|
+
// as this must be recently computed with the draft time range labels.
|
|
88
|
+
if (labelNamesLoading && draftSumBy !== undefined) {
|
|
89
|
+
return draftSumBy;
|
|
104
90
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
return [param];
|
|
91
|
+
|
|
92
|
+
// Prefer non-empty URL default over auto-computed default to avoid a
|
|
93
|
+
// one-render race where defaultSumBy overwrites the default value from upstream.
|
|
94
|
+
var hasExplicitDefault = defaultValue != null && defaultValue.length > 0;
|
|
95
|
+
var result = (_ref3 = (_ref4 = (_userSelectedSumBy = userSelectedSumBy[(_profileType$toString = profileType === null || profileType === void 0 ? void 0 : profileType.toString()) !== null && _profileType$toString !== void 0 ? _profileType$toString : '']) !== null && _userSelectedSumBy !== void 0 ? _userSelectedSumBy : hasExplicitDefault ? defaultValue : undefined) !== null && _ref4 !== void 0 ? _ref4 : defaultSumBy) !== null && _ref3 !== void 0 ? _ref3 : DEFAULT_EMPTY_SUM_BY;
|
|
96
|
+
if ((profileType === null || profileType === void 0 ? void 0 : profileType.delta) !== true) {
|
|
97
|
+
result = DEFAULT_EMPTY_SUM_BY;
|
|
114
98
|
}
|
|
115
|
-
return
|
|
99
|
+
return result;
|
|
100
|
+
}, [userSelectedSumBy, profileType, defaultSumBy, labelNamesLoading, draftSumBy, defaultValue]);
|
|
101
|
+
return [sumBy_0, setSumBy, {
|
|
102
|
+
isLoading: labelNamesLoading
|
|
103
|
+
}];
|
|
116
104
|
};
|
|
117
|
-
export
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
105
|
+
export var useDefaultSumBy = function useDefaultSumBy(profileType, labelNamesLoading, labels) {
|
|
106
|
+
var $ = _c(6);
|
|
107
|
+
var t0;
|
|
108
|
+
if ($[0] !== labels || $[1] !== profileType) {
|
|
109
|
+
t0 = getDefaultSumBy(profileType, labels);
|
|
110
|
+
$[0] = labels;
|
|
111
|
+
$[1] = profileType;
|
|
112
|
+
$[2] = t0;
|
|
113
|
+
} else {
|
|
114
|
+
t0 = $[2];
|
|
115
|
+
}
|
|
116
|
+
var defaultSumBy = t0;
|
|
117
|
+
var t1;
|
|
118
|
+
if ($[3] !== defaultSumBy || $[4] !== labelNamesLoading) {
|
|
119
|
+
t1 = {
|
|
120
|
+
defaultSumBy: defaultSumBy,
|
|
121
|
+
isLoading: labelNamesLoading
|
|
122
|
+
};
|
|
123
|
+
$[3] = defaultSumBy;
|
|
124
|
+
$[4] = labelNamesLoading;
|
|
125
|
+
$[5] = t1;
|
|
126
|
+
} else {
|
|
127
|
+
t1 = $[5];
|
|
128
|
+
}
|
|
129
|
+
return t1;
|
|
122
130
|
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
131
|
+
var getSumByFromParam = function getSumByFromParam(param) {
|
|
132
|
+
if ((param === null || param === void 0 ? void 0 : param.length) === 0) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
if (param === '__none__') {
|
|
136
|
+
return DEFAULT_EMPTY_SUM_BY;
|
|
137
|
+
}
|
|
138
|
+
if (typeof param === 'string') {
|
|
139
|
+
// Handle comma-separated strings (e.g., "comm,node" -> ["comm", "node"])
|
|
140
|
+
if (param.includes(',')) {
|
|
141
|
+
return param.split(',').map(function (s) {
|
|
142
|
+
return s.trim();
|
|
143
|
+
}).filter(function (s) {
|
|
144
|
+
return s.length > 0;
|
|
145
|
+
});
|
|
129
146
|
}
|
|
130
|
-
return
|
|
147
|
+
return [param];
|
|
148
|
+
}
|
|
149
|
+
return param;
|
|
131
150
|
};
|
|
151
|
+
export var useSumByFromParams = function useSumByFromParams(param) {
|
|
152
|
+
var $ = _c(2);
|
|
153
|
+
var t0;
|
|
154
|
+
if ($[0] !== param) {
|
|
155
|
+
t0 = getSumByFromParam(param);
|
|
156
|
+
$[0] = param;
|
|
157
|
+
$[1] = t0;
|
|
158
|
+
} else {
|
|
159
|
+
t0 = $[1];
|
|
160
|
+
}
|
|
161
|
+
var sumBy = t0;
|
|
162
|
+
return sumBy;
|
|
163
|
+
};
|
|
164
|
+
export var sumByToParam = function sumByToParam(sumBy) {
|
|
165
|
+
if (sumBy === undefined) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
if (sumBy.length === 0) {
|
|
169
|
+
return '__none__';
|
|
170
|
+
}
|
|
171
|
+
return sumBy;
|
|
172
|
+
};
|
|
173
|
+
|
|
132
174
|
// Combined hook that handles all sumBy logic: fetching labels, computing defaults, and managing selection
|
|
133
|
-
export
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
175
|
+
export var useSumBy = function useSumBy(queryClient, profileType, timeRange, draftProfileType, draftTimeRange, defaultValue) {
|
|
176
|
+
var $ = _c(17);
|
|
177
|
+
var t0;
|
|
178
|
+
if ($[0] !== profileType) {
|
|
179
|
+
var _profileType$toString2;
|
|
180
|
+
t0 = (_profileType$toString2 = profileType === null || profileType === void 0 ? void 0 : profileType.toString()) !== null && _profileType$toString2 !== void 0 ? _profileType$toString2 : "";
|
|
181
|
+
$[0] = profileType;
|
|
182
|
+
$[1] = t0;
|
|
183
|
+
} else {
|
|
184
|
+
t0 = $[1];
|
|
185
|
+
}
|
|
186
|
+
var t1;
|
|
187
|
+
if ($[2] !== timeRange) {
|
|
188
|
+
t1 = timeRange.getFromMs();
|
|
189
|
+
$[2] = timeRange;
|
|
190
|
+
$[3] = t1;
|
|
191
|
+
} else {
|
|
192
|
+
t1 = $[3];
|
|
193
|
+
}
|
|
194
|
+
var t2;
|
|
195
|
+
if ($[4] !== timeRange) {
|
|
196
|
+
t2 = timeRange.getToMs();
|
|
197
|
+
$[4] = timeRange;
|
|
198
|
+
$[5] = t2;
|
|
199
|
+
} else {
|
|
200
|
+
t2 = $[5];
|
|
201
|
+
}
|
|
202
|
+
var _useLabelNames = useLabelNames(queryClient, t0, t1, t2),
|
|
203
|
+
labelNamesLoading = _useLabelNames.loading,
|
|
204
|
+
result = _useLabelNames.result;
|
|
205
|
+
var _useDraftSumBy = useDraftSumBy(queryClient, draftProfileType, draftTimeRange, defaultValue),
|
|
206
|
+
draftSumBy = _useDraftSumBy.draftSumBy,
|
|
207
|
+
setDraftSumBy = _useDraftSumBy.setDraftSumBy,
|
|
208
|
+
isDraftSumByLoading = _useDraftSumBy.isDraftSumByLoading;
|
|
209
|
+
var t3;
|
|
210
|
+
if ($[6] !== result.response) {
|
|
211
|
+
var _result$response;
|
|
212
|
+
t3 = ((_result$response = result.response) === null || _result$response === void 0 ? void 0 : _result$response.labelNames) === undefined ? [] : result.response.labelNames;
|
|
213
|
+
$[6] = result.response;
|
|
214
|
+
$[7] = t3;
|
|
215
|
+
} else {
|
|
216
|
+
t3 = $[7];
|
|
217
|
+
}
|
|
218
|
+
var labels = t3;
|
|
219
|
+
var t4;
|
|
220
|
+
if ($[8] !== defaultValue) {
|
|
221
|
+
t4 = {
|
|
222
|
+
defaultValue: defaultValue
|
|
147
223
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
224
|
+
$[8] = defaultValue;
|
|
225
|
+
$[9] = t4;
|
|
226
|
+
} else {
|
|
227
|
+
t4 = $[9];
|
|
228
|
+
}
|
|
229
|
+
var _useSumBySelection = useSumBySelection(profileType, labelNamesLoading, labels, draftSumBy, t4),
|
|
230
|
+
_useSumBySelection2 = _slicedToArray(_useSumBySelection, 3),
|
|
231
|
+
sumBySelection = _useSumBySelection2[0],
|
|
232
|
+
setSumByInternal = _useSumBySelection2[1],
|
|
233
|
+
t5 = _useSumBySelection2[2];
|
|
234
|
+
var isLoading = t5.isLoading;
|
|
235
|
+
var t6;
|
|
236
|
+
if ($[10] !== draftSumBy || $[11] !== isDraftSumByLoading || $[12] !== isLoading || $[13] !== setDraftSumBy || $[14] !== setSumByInternal || $[15] !== sumBySelection) {
|
|
237
|
+
t6 = {
|
|
238
|
+
sumBy: sumBySelection,
|
|
239
|
+
setSumBy: setSumByInternal,
|
|
240
|
+
isLoading: isLoading,
|
|
241
|
+
draftSumBy: draftSumBy,
|
|
242
|
+
setDraftSumBy: setDraftSumBy,
|
|
243
|
+
isDraftSumByLoading: isDraftSumByLoading
|
|
163
244
|
};
|
|
245
|
+
$[10] = draftSumBy;
|
|
246
|
+
$[11] = isDraftSumByLoading;
|
|
247
|
+
$[12] = isLoading;
|
|
248
|
+
$[13] = setDraftSumBy;
|
|
249
|
+
$[14] = setSumByInternal;
|
|
250
|
+
$[15] = sumBySelection;
|
|
251
|
+
$[16] = t6;
|
|
252
|
+
} else {
|
|
253
|
+
t6 = $[16];
|
|
254
|
+
}
|
|
255
|
+
return t6;
|
|
164
256
|
};
|
|
257
|
+
export var useDraftSumBy = function useDraftSumBy(queryClient, profileType, timeRange, defaultValue) {
|
|
258
|
+
var _ref5, _ref6;
|
|
259
|
+
var $ = _c(11);
|
|
260
|
+
var _useState7 = useState(defaultValue),
|
|
261
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
262
|
+
draftSumBy = _useState8[0],
|
|
263
|
+
setDraftSumBy = _useState8[1];
|
|
264
|
+
var t0;
|
|
265
|
+
if ($[0] !== profileType) {
|
|
266
|
+
var _profileType$toString3;
|
|
267
|
+
t0 = (_profileType$toString3 = profileType === null || profileType === void 0 ? void 0 : profileType.toString()) !== null && _profileType$toString3 !== void 0 ? _profileType$toString3 : "";
|
|
268
|
+
$[0] = profileType;
|
|
269
|
+
$[1] = t0;
|
|
270
|
+
} else {
|
|
271
|
+
t0 = $[1];
|
|
272
|
+
}
|
|
273
|
+
var t1;
|
|
274
|
+
if ($[2] !== timeRange) {
|
|
275
|
+
t1 = timeRange.getFromMs();
|
|
276
|
+
$[2] = timeRange;
|
|
277
|
+
$[3] = t1;
|
|
278
|
+
} else {
|
|
279
|
+
t1 = $[3];
|
|
280
|
+
}
|
|
281
|
+
var t2;
|
|
282
|
+
if ($[4] !== timeRange) {
|
|
283
|
+
t2 = timeRange.getToMs();
|
|
284
|
+
$[4] = timeRange;
|
|
285
|
+
$[5] = t2;
|
|
286
|
+
} else {
|
|
287
|
+
t2 = $[5];
|
|
288
|
+
}
|
|
289
|
+
var _useLabelNames2 = useLabelNames(queryClient, t0, t1, t2),
|
|
290
|
+
labelNamesLoading = _useLabelNames2.loading,
|
|
291
|
+
result = _useLabelNames2.result;
|
|
292
|
+
var t3;
|
|
293
|
+
if ($[6] !== result.response) {
|
|
294
|
+
var _result$response2;
|
|
295
|
+
t3 = ((_result$response2 = result.response) === null || _result$response2 === void 0 ? void 0 : _result$response2.labelNames) === undefined ? [] : result.response.labelNames;
|
|
296
|
+
$[6] = result.response;
|
|
297
|
+
$[7] = t3;
|
|
298
|
+
} else {
|
|
299
|
+
t3 = $[7];
|
|
300
|
+
}
|
|
301
|
+
var labels = t3;
|
|
302
|
+
var _useDefaultSumBy2 = useDefaultSumBy(profileType, labelNamesLoading, labels),
|
|
303
|
+
defaultSumBy = _useDefaultSumBy2.defaultSumBy,
|
|
304
|
+
isLoading = _useDefaultSumBy2.isLoading;
|
|
305
|
+
var t4 = (_ref5 = (_ref6 = draftSumBy !== null && draftSumBy !== void 0 ? draftSumBy : defaultValue != null && defaultValue.length > 0 ? defaultValue : undefined) !== null && _ref6 !== void 0 ? _ref6 : defaultSumBy) !== null && _ref5 !== void 0 ? _ref5 : DEFAULT_EMPTY_SUM_BY;
|
|
306
|
+
var t5;
|
|
307
|
+
if ($[8] !== isLoading || $[9] !== t4) {
|
|
308
|
+
t5 = {
|
|
309
|
+
draftSumBy: t4,
|
|
310
|
+
setDraftSumBy: setDraftSumBy,
|
|
311
|
+
isDraftSumByLoading: isLoading
|
|
312
|
+
};
|
|
313
|
+
$[8] = isLoading;
|
|
314
|
+
$[9] = t4;
|
|
315
|
+
$[10] = t5;
|
|
316
|
+
} else {
|
|
317
|
+
t5 = $[10];
|
|
318
|
+
}
|
|
319
|
+
return t5;
|
|
320
|
+
};
|
package/dist/utils.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
3
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
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); }
|
|
9
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
10
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
1
11
|
// Copyright 2022 The Parca Authors
|
|
2
12
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
13
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,42 +20,64 @@
|
|
|
10
20
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
21
|
// See the License for the specific language governing permissions and
|
|
12
22
|
// limitations under the License.
|
|
23
|
+
|
|
13
24
|
import { QueryRequest_ReportType } from '@parca/client';
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
export var hexifyAddress = function hexifyAddress(address) {
|
|
26
|
+
if (address == null) {
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
29
|
+
return "0x".concat(address.toString(16));
|
|
19
30
|
};
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
export var downloadPprof = /*#__PURE__*/function () {
|
|
32
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(request, queryClient, metadata) {
|
|
33
|
+
var req, _yield$queryClient$qu, response, blob;
|
|
34
|
+
return _regenerator().w(function (_context) {
|
|
35
|
+
while (1) switch (_context.n) {
|
|
36
|
+
case 0:
|
|
37
|
+
req = _objectSpread(_objectSpread({}, request), {}, {
|
|
38
|
+
reportType: QueryRequest_ReportType.PPROF
|
|
39
|
+
});
|
|
40
|
+
_context.n = 1;
|
|
41
|
+
return queryClient.query(req, {
|
|
42
|
+
meta: metadata
|
|
43
|
+
});
|
|
44
|
+
case 1:
|
|
45
|
+
_yield$queryClient$qu = _context.v;
|
|
46
|
+
response = _yield$queryClient$qu.response;
|
|
47
|
+
if (!(response.report.oneofKind !== 'pprof')) {
|
|
48
|
+
_context.n = 2;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
throw new Error("Expected pprof report, got: ".concat(response.report.oneofKind !== undefined ? response.report.oneofKind : 'undefined'));
|
|
52
|
+
case 2:
|
|
53
|
+
blob = new Blob([response.report.pprof.slice()], {
|
|
54
|
+
type: 'application/octet-stream'
|
|
55
|
+
});
|
|
56
|
+
return _context.a(2, blob);
|
|
57
|
+
}
|
|
58
|
+
}, _callee);
|
|
59
|
+
}));
|
|
60
|
+
return function downloadPprof(_x, _x2, _x3) {
|
|
61
|
+
return _ref.apply(this, arguments);
|
|
62
|
+
};
|
|
63
|
+
}();
|
|
64
|
+
export var truncateString = function truncateString(str, num) {
|
|
65
|
+
if (str.length <= num) {
|
|
66
|
+
return str;
|
|
67
|
+
}
|
|
68
|
+
return str.slice(0, num) + '...';
|
|
31
69
|
};
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
export const truncateStringReverse = (str, num) => {
|
|
39
|
-
if (str.length <= num) {
|
|
40
|
-
return str;
|
|
41
|
-
}
|
|
42
|
-
return '...' + str.slice(str.length - num);
|
|
70
|
+
export var truncateStringReverse = function truncateStringReverse(str, num) {
|
|
71
|
+
if (str.length <= num) {
|
|
72
|
+
return str;
|
|
73
|
+
}
|
|
74
|
+
return '...' + str.slice(str.length - num);
|
|
43
75
|
};
|
|
44
76
|
/**
|
|
45
77
|
* Ensures the buffer is 8-byte aligned for Arrow IPC parsing with BigInt support.
|
|
46
78
|
* Arrow's BigInt64Array/BigUint64Array require 8-byte aligned memory.
|
|
47
79
|
* If not aligned, creates a copy which will be properly aligned.
|
|
48
80
|
*/
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
};
|
|
81
|
+
export var alignedUint8Array = function alignedUint8Array(buffer) {
|
|
82
|
+
return buffer.byteOffset % 8 === 0 ? buffer : new Uint8Array(buffer);
|
|
83
|
+
};
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.142",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@floating-ui/react": "^0.27.12",
|
|
7
7
|
"@headlessui/react": "^1.7.19",
|
|
8
8
|
"@iconify/react": "^4.0.0",
|
|
9
|
-
"@parca/client": "0.17.
|
|
10
|
-
"@parca/components": "0.16.
|
|
9
|
+
"@parca/client": "0.17.23",
|
|
10
|
+
"@parca/components": "0.16.414",
|
|
11
11
|
"@parca/dynamicsize": "0.16.74",
|
|
12
|
-
"@parca/hooks": "0.0.
|
|
13
|
-
"@parca/icons": "0.16.
|
|
12
|
+
"@parca/hooks": "0.0.125",
|
|
13
|
+
"@parca/icons": "0.16.82",
|
|
14
14
|
"@parca/parser": "0.16.88",
|
|
15
|
-
"@parca/store": "0.16.
|
|
15
|
+
"@parca/store": "0.16.207",
|
|
16
16
|
"@parca/test-utils": "0.0.22",
|
|
17
|
-
"@parca/utilities": "0.0.
|
|
17
|
+
"@parca/utilities": "0.0.130",
|
|
18
18
|
"@popperjs/core": "^2.11.8",
|
|
19
19
|
"@protobuf-ts/runtime-rpc": "^2.5.0",
|
|
20
20
|
"@storybook/preview-api": "^8.4.3",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"graphviz-wasm": "3.0.2",
|
|
43
43
|
"lodash.throttle": "^4.1.1",
|
|
44
44
|
"lz4js": "^0.2.0",
|
|
45
|
-
"nuqs": "^2.4.1",
|
|
46
45
|
"react": "18.3.1",
|
|
47
46
|
"react-beautiful-dnd": "^13.1.1",
|
|
48
47
|
"react-contexify": "^6.0.0",
|
|
@@ -72,7 +71,7 @@
|
|
|
72
71
|
"scripts": {
|
|
73
72
|
"test": "jest --coverage --config ../../../jest.config.js ./src/*",
|
|
74
73
|
"prepublish": "pnpm run build",
|
|
75
|
-
"build": "tsc && pnpm run compile:styles",
|
|
74
|
+
"build": "babel src --out-dir dist --config-file ../../../babel.react-compiler.cjs --extensions .ts,.tsx --copy-files --no-copy-ignored && tsc --emitDeclarationOnly && pnpm run compile:styles",
|
|
76
75
|
"build-swc": "swc ./src -d dist --copy-files && pnpm run compile:styles",
|
|
77
76
|
"watch": "tsc-watch --onCompilationComplete 'pnpm run compile:styles'",
|
|
78
77
|
"compile:styles": "tailwindcss -o dist/styles.css --minify"
|
|
@@ -89,5 +88,5 @@
|
|
|
89
88
|
"access": "public",
|
|
90
89
|
"registry": "https://registry.npmjs.org/"
|
|
91
90
|
},
|
|
92
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "da48a5951aeae6ef6a314839a223522d651e8910"
|
|
93
92
|
}
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
|
|
14
|
+
/* eslint-disable react-hooks/refs */
|
|
15
|
+
|
|
14
16
|
import React, {useEffect, useState} from 'react';
|
|
15
17
|
|
|
16
18
|
import {flip, offset, shift, useFloating, type VirtualElement} from '@floating-ui/react';
|
|
@@ -39,6 +41,7 @@ function createPositionedVirtualElement(contextElement: Element, x = 0, y = 0):
|
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
const GraphTooltip = ({children, contextElement}: GraphTooltipProps): React.JSX.Element => {
|
|
44
|
+
'use no memo';
|
|
42
45
|
const [isPositioned, setIsPositioned] = useState(false);
|
|
43
46
|
|
|
44
47
|
const {refs, floatingStyles, update} = useFloating({
|