@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
|
@@ -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,32 +11,52 @@
|
|
|
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 { useWindowSize } from 'react-use';
|
|
14
16
|
import { useParcaContext } from '@parca/components';
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
var margin = 50;
|
|
18
|
+
export var useMetricsGraphDimensions = function useMetricsGraphDimensions(comparing, t0) {
|
|
19
|
+
var $ = _c(5);
|
|
20
|
+
var maxHeight = t0 === undefined ? 402 : t0;
|
|
21
|
+
var _useWindowSize = useWindowSize(),
|
|
22
|
+
width = _useWindowSize.width;
|
|
23
|
+
var _useParcaContext = useParcaContext(),
|
|
24
|
+
profileExplorer = _useParcaContext.profileExplorer;
|
|
25
|
+
if (profileExplorer == null) {
|
|
26
|
+
var _t;
|
|
27
|
+
if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
|
|
28
|
+
_t = {
|
|
29
|
+
width: 0,
|
|
30
|
+
height: 0,
|
|
31
|
+
heightStyle: "0",
|
|
32
|
+
margin: 0
|
|
33
|
+
};
|
|
34
|
+
$[0] = _t;
|
|
35
|
+
} else {
|
|
36
|
+
_t = $[0];
|
|
26
37
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
return _t;
|
|
39
|
+
}
|
|
40
|
+
width = width - profileExplorer.PaddingX;
|
|
41
|
+
if (comparing) {
|
|
42
|
+
width = width / 2 - 32;
|
|
43
|
+
}
|
|
44
|
+
var height = Math.min(width / 2.5, maxHeight);
|
|
45
|
+
var heightStyle = "min(".concat(maxHeight + margin, "px, ").concat(comparing ? profileExplorer.metricsGraph.maxHeightStyle.compareMode : profileExplorer.metricsGraph.maxHeightStyle["default"], ")");
|
|
46
|
+
var t1;
|
|
47
|
+
if ($[1] !== height || $[2] !== heightStyle || $[3] !== width) {
|
|
48
|
+
t1 = {
|
|
49
|
+
width: width,
|
|
50
|
+
height: height,
|
|
51
|
+
heightStyle: heightStyle,
|
|
52
|
+
margin: margin
|
|
40
53
|
};
|
|
41
|
-
|
|
54
|
+
$[1] = height;
|
|
55
|
+
$[2] = heightStyle;
|
|
56
|
+
$[3] = width;
|
|
57
|
+
$[4] = t1;
|
|
58
|
+
} else {
|
|
59
|
+
t1 = $[4];
|
|
60
|
+
}
|
|
61
|
+
return t1;
|
|
62
|
+
};
|
|
@@ -10,27 +10,34 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
+
|
|
13
14
|
import * as d3 from 'd3';
|
|
15
|
+
|
|
14
16
|
// Cache to store color mappings
|
|
15
|
-
|
|
17
|
+
var colorCache = new Map();
|
|
18
|
+
|
|
16
19
|
// Create a color scale using d3's category10 scheme
|
|
17
|
-
|
|
20
|
+
var colorScale = d3.scaleOrdinal(d3.schemeCategory10);
|
|
21
|
+
|
|
18
22
|
/**
|
|
19
23
|
* Generates a consistent color for a series based on its identifying properties
|
|
20
24
|
*/
|
|
21
25
|
export function getSeriesColor(labels) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
// Create a key from all labels to ensure unique identification
|
|
27
|
+
var key = labels.filter(function (l) {
|
|
28
|
+
return l.name !== '__type__' && l.name !== 'limit';
|
|
29
|
+
}) // ignore injected virtual labels
|
|
30
|
+
.map(function (l) {
|
|
31
|
+
return "".concat(l.name, "=").concat(l.value);
|
|
32
|
+
}).sort().join(',');
|
|
33
|
+
|
|
34
|
+
// Return cached color if exists
|
|
35
|
+
if (colorCache.has(key)) {
|
|
36
|
+
return colorCache.get(key);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Generate new color and cache it
|
|
40
|
+
var color = colorScale(key);
|
|
41
|
+
colorCache.set(key, color);
|
|
42
|
+
return color;
|
|
43
|
+
}
|
|
@@ -1,8 +1,71 @@
|
|
|
1
|
+
import { c as _c } from "react-compiler-runtime"; // Copyright 2022 The Parca Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
1
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
var MetricsSeries = function MetricsSeries(t0) {
|
|
15
|
+
var $ = _c(12);
|
|
16
|
+
var data = t0.data,
|
|
17
|
+
line = t0.line,
|
|
18
|
+
color = t0.color,
|
|
19
|
+
strokeWidth = t0.strokeWidth,
|
|
20
|
+
t1 = t0.strokeDasharray,
|
|
21
|
+
t2 = t0.strokeLinecap,
|
|
22
|
+
onClick = t0.onClick;
|
|
23
|
+
var strokeDasharray = t1 === undefined ? "" : t1;
|
|
24
|
+
var strokeLinecap = t2 === undefined ? "round" : t2;
|
|
25
|
+
var t3;
|
|
26
|
+
if ($[0] !== data.values || $[1] !== line) {
|
|
27
|
+
var _line;
|
|
28
|
+
t3 = (_line = line(data.values)) !== null && _line !== void 0 ? _line : undefined;
|
|
29
|
+
$[0] = data.values;
|
|
30
|
+
$[1] = line;
|
|
31
|
+
$[2] = t3;
|
|
32
|
+
} else {
|
|
33
|
+
t3 = $[2];
|
|
34
|
+
}
|
|
35
|
+
var t4;
|
|
36
|
+
if ($[3] !== color || $[4] !== strokeDasharray || $[5] !== strokeLinecap || $[6] !== strokeWidth) {
|
|
37
|
+
t4 = {
|
|
38
|
+
stroke: color,
|
|
39
|
+
strokeWidth: strokeWidth,
|
|
40
|
+
strokeDasharray: strokeDasharray,
|
|
41
|
+
strokeLinecap: strokeLinecap
|
|
42
|
+
};
|
|
43
|
+
$[3] = color;
|
|
44
|
+
$[4] = strokeDasharray;
|
|
45
|
+
$[5] = strokeLinecap;
|
|
46
|
+
$[6] = strokeWidth;
|
|
47
|
+
$[7] = t4;
|
|
48
|
+
} else {
|
|
49
|
+
t4 = $[7];
|
|
50
|
+
}
|
|
51
|
+
var t5;
|
|
52
|
+
if ($[8] !== onClick || $[9] !== t3 || $[10] !== t4) {
|
|
53
|
+
t5 = /*#__PURE__*/_jsx("g", {
|
|
54
|
+
className: "line-group",
|
|
55
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
56
|
+
className: "line",
|
|
57
|
+
d: t3,
|
|
58
|
+
style: t4,
|
|
59
|
+
onClick: onClick
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
$[8] = onClick;
|
|
63
|
+
$[9] = t3;
|
|
64
|
+
$[10] = t4;
|
|
65
|
+
$[11] = t5;
|
|
66
|
+
} else {
|
|
67
|
+
t5 = $[11];
|
|
68
|
+
}
|
|
69
|
+
return t5;
|
|
70
|
+
};
|
|
71
|
+
export default MetricsSeries;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PreSelectedMatchers/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PreSelectedMatchers/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAatE,UAAU,KAAK;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAyKxC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
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 _regeneratorValues(e) { if (null != e) { var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"], r = 0; if (t) return t.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) return { next: function next() { return e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }; } }; } throw new TypeError(_typeof(e) + " is not iterable"); }
|
|
3
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
4
|
+
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 }; })(); }
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
10
|
+
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); }
|
|
11
|
+
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); }
|
|
12
|
+
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); }); }; }
|
|
13
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
14
|
+
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."); }
|
|
15
|
+
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; } }
|
|
16
|
+
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; }
|
|
17
|
+
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; } }
|
|
18
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
2
19
|
// Copyright 2022 The Parca Authors
|
|
3
20
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
21
|
// you may not use this file except in compliance with the License.
|
|
@@ -11,7 +28,10 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
11
28
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
29
|
// See the License for the specific language governing permissions and
|
|
13
30
|
// limitations under the License.
|
|
14
|
-
|
|
31
|
+
|
|
32
|
+
/* eslint-disable react-hooks/refs */
|
|
33
|
+
|
|
34
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
15
35
|
import { Icon } from '@iconify/react';
|
|
16
36
|
import cx from 'classnames';
|
|
17
37
|
import { useGrpcMetadata, useParcaContext } from '@parca/components';
|
|
@@ -20,106 +40,233 @@ import { millisToProtoTimestamp, sanitizeLabelValue } from '@parca/utilities';
|
|
|
20
40
|
import CustomSelect from '../SimpleMatchers/Select';
|
|
21
41
|
import { useUnifiedLabels } from '../contexts/UnifiedLabelsContext';
|
|
22
42
|
import { useQueryState } from '../hooks/useQueryState';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
43
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
44
|
+
var PreSelectedMatchers = function PreSelectedMatchers(_ref) {
|
|
45
|
+
'use no memo';
|
|
46
|
+
|
|
47
|
+
var labelNames = _ref.labelNames;
|
|
48
|
+
var _useState = useState({}),
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
labelValuesMap = _useState2[0],
|
|
51
|
+
setLabelValuesMap = _useState2[1];
|
|
52
|
+
var _useState3 = useState({}),
|
|
53
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
54
|
+
isLoading = _useState4[0],
|
|
55
|
+
setIsLoading = _useState4[1];
|
|
56
|
+
var metadata = useGrpcMetadata();
|
|
57
|
+
var _useParcaContext = useParcaContext(),
|
|
58
|
+
parcaQueryClient = _useParcaContext.queryServiceClient;
|
|
59
|
+
var _useUnifiedLabels = useUnifiedLabels(),
|
|
60
|
+
suffix = _useUnifiedLabels.suffix;
|
|
61
|
+
var _useQueryState = useQueryState({
|
|
62
|
+
suffix: suffix
|
|
63
|
+
}),
|
|
64
|
+
draftSelection = _useQueryState.draftSelection,
|
|
65
|
+
setDraftMatchers = _useQueryState.setDraftMatchers,
|
|
66
|
+
commitDraft = _useQueryState.commitDraft,
|
|
67
|
+
draftParsedQuery = _useQueryState.draftParsedQuery;
|
|
68
|
+
var currentMatchers = draftParsedQuery === null || draftParsedQuery === void 0 ? void 0 : draftParsedQuery.matchersString();
|
|
69
|
+
var profileType = draftParsedQuery === null || draftParsedQuery === void 0 ? void 0 : draftParsedQuery.profileType().toString();
|
|
70
|
+
var start = draftSelection.from;
|
|
71
|
+
var end = draftSelection.to;
|
|
72
|
+
var parseCurrentMatchers = useCallback(function (matchersString) {
|
|
73
|
+
var matches = matchersString.match(/(\w+)="([^"]+)"/g);
|
|
74
|
+
if (matches === null) return {};
|
|
75
|
+
return matches.reduce(function (acc, match) {
|
|
76
|
+
var _match$split = match.split('='),
|
|
77
|
+
_match$split2 = _slicedToArray(_match$split, 2),
|
|
78
|
+
label = _match$split2[0],
|
|
79
|
+
value = _match$split2[1];
|
|
80
|
+
if (label !== undefined) {
|
|
81
|
+
acc[label] = value.replace(/"/g, '');
|
|
82
|
+
}
|
|
83
|
+
return acc;
|
|
84
|
+
},
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
86
|
+
{});
|
|
87
|
+
}, []);
|
|
88
|
+
var initialSelections = parseCurrentMatchers(currentMatchers !== null && currentMatchers !== void 0 ? currentMatchers : '');
|
|
89
|
+
var selectionsRef = useRef(initialSelections);
|
|
90
|
+
var commitDraftRef = useRef(commitDraft);
|
|
91
|
+
var timeoutRef = useRef(null);
|
|
92
|
+
useEffect(function () {
|
|
93
|
+
commitDraftRef.current = commitDraft;
|
|
94
|
+
}, [commitDraft]);
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
selectionsRef.current = initialSelections;
|
|
97
|
+
}, [initialSelections]);
|
|
98
|
+
var fetchLabelValues = useCallback(/*#__PURE__*/function () {
|
|
99
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(labelName) {
|
|
100
|
+
var response, _t;
|
|
101
|
+
return _regenerator().w(function (_context) {
|
|
102
|
+
while (1) switch (_context.p = _context.n) {
|
|
103
|
+
case 0:
|
|
104
|
+
_context.p = 0;
|
|
105
|
+
_context.n = 1;
|
|
106
|
+
return parcaQueryClient.values(_objectSpread({
|
|
107
|
+
labelName: labelName,
|
|
108
|
+
match: [],
|
|
109
|
+
profileType: profileType
|
|
110
|
+
}, start !== undefined && end !== undefined ? {
|
|
111
|
+
start: millisToProtoTimestamp(start),
|
|
112
|
+
end: millisToProtoTimestamp(end)
|
|
113
|
+
} : {}), {
|
|
114
|
+
meta: metadata
|
|
115
|
+
}).response;
|
|
116
|
+
case 1:
|
|
117
|
+
response = _context.v;
|
|
118
|
+
return _context.a(2, sanitizeLabelValue(response.labelValues));
|
|
119
|
+
case 2:
|
|
120
|
+
_context.p = 2;
|
|
121
|
+
_t = _context.v;
|
|
122
|
+
console.error('Error fetching label values:', _t);
|
|
123
|
+
return _context.a(2, []);
|
|
87
124
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
125
|
+
}, _callee, null, [[0, 2]]);
|
|
126
|
+
}));
|
|
127
|
+
return function (_x) {
|
|
128
|
+
return _ref2.apply(this, arguments);
|
|
129
|
+
};
|
|
130
|
+
}(), [parcaQueryClient, metadata, profileType, start, end]);
|
|
131
|
+
var fetchAllLabelValues = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
132
|
+
var newLabelValuesMap, newIsLoading, _iterator, _step, _loop, _t2;
|
|
133
|
+
return _regenerator().w(function (_context3) {
|
|
134
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
135
|
+
case 0:
|
|
136
|
+
newLabelValuesMap = {};
|
|
137
|
+
newIsLoading = {};
|
|
138
|
+
_iterator = _createForOfIteratorHelper(labelNames);
|
|
139
|
+
_context3.p = 1;
|
|
140
|
+
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
141
|
+
var labelName_0, values;
|
|
142
|
+
return _regenerator().w(function (_context2) {
|
|
143
|
+
while (1) switch (_context2.n) {
|
|
144
|
+
case 0:
|
|
145
|
+
labelName_0 = _step.value;
|
|
146
|
+
newIsLoading[labelName_0] = true;
|
|
147
|
+
setIsLoading(function (prev) {
|
|
148
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, labelName_0, true));
|
|
149
|
+
});
|
|
150
|
+
_context2.n = 1;
|
|
151
|
+
return fetchLabelValues(labelName_0);
|
|
152
|
+
case 1:
|
|
153
|
+
values = _context2.v;
|
|
154
|
+
newLabelValuesMap[labelName_0] = values;
|
|
155
|
+
newIsLoading[labelName_0] = false;
|
|
156
|
+
case 2:
|
|
157
|
+
return _context2.a(2);
|
|
158
|
+
}
|
|
159
|
+
}, _loop);
|
|
160
|
+
});
|
|
161
|
+
_iterator.s();
|
|
162
|
+
case 2:
|
|
163
|
+
if ((_step = _iterator.n()).done) {
|
|
164
|
+
_context3.n = 4;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
return _context3.d(_regeneratorValues(_loop()), 3);
|
|
168
|
+
case 3:
|
|
169
|
+
_context3.n = 2;
|
|
170
|
+
break;
|
|
171
|
+
case 4:
|
|
172
|
+
_context3.n = 6;
|
|
173
|
+
break;
|
|
174
|
+
case 5:
|
|
175
|
+
_context3.p = 5;
|
|
176
|
+
_t2 = _context3.v;
|
|
177
|
+
_iterator.e(_t2);
|
|
178
|
+
case 6:
|
|
179
|
+
_context3.p = 6;
|
|
180
|
+
_iterator.f();
|
|
181
|
+
return _context3.f(6);
|
|
182
|
+
case 7:
|
|
183
|
+
setLabelValuesMap(newLabelValuesMap);
|
|
184
|
+
setIsLoading(newIsLoading);
|
|
185
|
+
case 8:
|
|
186
|
+
return _context3.a(2);
|
|
187
|
+
}
|
|
188
|
+
}, _callee2, null, [[1, 5, 6, 7]]);
|
|
189
|
+
})), [labelNames, fetchLabelValues]);
|
|
190
|
+
useEffect(function () {
|
|
191
|
+
void fetchAllLabelValues();
|
|
192
|
+
}, [fetchAllLabelValues]);
|
|
193
|
+
var updateMatcherString = useCallback(function () {
|
|
194
|
+
var matcherParts = Object.entries(selectionsRef.current).filter(function (_ref4) {
|
|
195
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
196
|
+
_ = _ref5[0],
|
|
197
|
+
v = _ref5[1];
|
|
198
|
+
return v !== null && v !== '';
|
|
199
|
+
}).map(function (_ref6) {
|
|
200
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
201
|
+
ln = _ref7[0],
|
|
202
|
+
v_0 = _ref7[1];
|
|
203
|
+
return "".concat(ln, "=\"").concat(v_0, "\"");
|
|
204
|
+
});
|
|
205
|
+
var matcherString = matcherParts.join(',');
|
|
206
|
+
setDraftMatchers(matcherString);
|
|
207
|
+
if (timeoutRef.current !== null) {
|
|
208
|
+
clearTimeout(timeoutRef.current);
|
|
209
|
+
}
|
|
210
|
+
timeoutRef.current = setTimeout(function () {
|
|
211
|
+
commitDraftRef.current();
|
|
212
|
+
}, 300);
|
|
213
|
+
}, [setDraftMatchers]);
|
|
214
|
+
var handleSelection = useCallback(function (labelName_1, value_0) {
|
|
215
|
+
selectionsRef.current = _objectSpread(_objectSpread({}, selectionsRef.current), {}, _defineProperty({}, labelName_1, value_0));
|
|
216
|
+
updateMatcherString();
|
|
217
|
+
}, [updateMatcherString]);
|
|
218
|
+
var handleReset = useCallback(function (labelName_2) {
|
|
219
|
+
handleSelection(labelName_2, null);
|
|
220
|
+
}, [handleSelection]);
|
|
221
|
+
var transformValuesForSelect = useCallback(function (values_0) {
|
|
222
|
+
return values_0.map(function (value_1) {
|
|
223
|
+
return {
|
|
224
|
+
key: value_1,
|
|
225
|
+
element: {
|
|
226
|
+
active: /*#__PURE__*/_jsx(_Fragment, {
|
|
227
|
+
children: value_1
|
|
228
|
+
}),
|
|
229
|
+
expanded: /*#__PURE__*/_jsx(_Fragment, {
|
|
230
|
+
children: value_1
|
|
231
|
+
})
|
|
102
232
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
233
|
+
};
|
|
234
|
+
});
|
|
235
|
+
}, []);
|
|
236
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
237
|
+
className: "flex flex-wrap gap-2"
|
|
238
|
+
}, testId(TEST_IDS.VIEW_MATCHERS_CONTAINER)), {}, {
|
|
239
|
+
children: labelNames.map(function (labelName_3) {
|
|
240
|
+
var _labelValuesMap$label, _selectionsRef$curren, _isLoading$labelName_;
|
|
241
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
242
|
+
className: "flex items-center",
|
|
243
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
244
|
+
className: "relative border shadow-sm px-4 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 text-sm flex gap-2 items-center justify-between bg-gray-100 dark:bg-gray-700 rounded-l-md border-gray-300 dark:border-gray-600",
|
|
245
|
+
children: labelName_3
|
|
246
|
+
}), /*#__PURE__*/_jsx(CustomSelect, {
|
|
247
|
+
searchable: true,
|
|
248
|
+
placeholder: "Select value",
|
|
249
|
+
items: transformValuesForSelect((_labelValuesMap$label = labelValuesMap[labelName_3]) !== null && _labelValuesMap$label !== void 0 ? _labelValuesMap$label : []),
|
|
250
|
+
onSelection: function onSelection(value_2) {
|
|
251
|
+
return handleSelection(labelName_3, value_2);
|
|
252
|
+
},
|
|
253
|
+
selectedKey: (_selectionsRef$curren = selectionsRef.current[labelName_3]) !== null && _selectionsRef$curren !== void 0 ? _selectionsRef$curren : undefined,
|
|
254
|
+
className: cx('rounded-l-none border-l-0', selectionsRef.current[labelName_3] != null && 'border-r-0 rounded-r-none'),
|
|
255
|
+
loading: (_isLoading$labelName_ = isLoading[labelName_3]) !== null && _isLoading$labelName_ !== void 0 ? _isLoading$labelName_ : false
|
|
256
|
+
}), selectionsRef.current[labelName_3] != null && /*#__PURE__*/_jsx("button", {
|
|
257
|
+
onClick: function onClick() {
|
|
258
|
+
return handleReset(labelName_3);
|
|
259
|
+
},
|
|
260
|
+
className: "p-2 border-gray-200 bg-white dark:bg-gray-900 dark:border-gray-600 border rounded-r-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",
|
|
261
|
+
"aria-label": "Reset ".concat(labelName_3, " selection"),
|
|
262
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
263
|
+
icon: "mdi:close",
|
|
264
|
+
className: "h-5 w-5 text-gray-400",
|
|
265
|
+
"aria-hidden": "true"
|
|
266
|
+
})
|
|
267
|
+
})]
|
|
268
|
+
}, labelName_3);
|
|
269
|
+
})
|
|
270
|
+
}));
|
|
124
271
|
};
|
|
125
|
-
export default PreSelectedMatchers;
|
|
272
|
+
export default PreSelectedMatchers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileExplorerCompare.d.ts","sourceRoot":"","sources":["../../src/ProfileExplorer/ProfileExplorerCompare.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ProfileExplorerCompare.d.ts","sourceRoot":"","sources":["../../src/ProfileExplorer/ProfileExplorerCompare.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAIjD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAOvD,UAAU,2BAA2B;IACnC,WAAW,EAAE,kBAAkB,CAAC;IAChC,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAED,QAAA,MAAM,sBAAsB,GAAI,8BAG7B,2BAA2B,KAAG,GAAG,CAAC,OAmHpC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|