@parca/profile 0.19.139 → 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 +8 -0
- 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.js +103 -73
- 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.js +240 -49
- 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.js +645 -134
- package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
- package/dist/ProfileFlameChart/index.js +266 -134
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +287 -88
- 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 +71 -45
- 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.js +324 -148
- package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
- package/dist/ProfileMetricsGraph/index.js +518 -259
- package/dist/ProfileSelector/CompareButton.js +132 -12
- package/dist/ProfileSelector/MetricsGraphSection.js +234 -67
- package/dist/ProfileSelector/index.d.ts.map +1 -1
- package/dist/ProfileSelector/index.js +730 -142
- 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.js +139 -33
- package/dist/ProfileView/components/ColorStackLegend.js +184 -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.js +99 -10
- 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.js +188 -120
- 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 +675 -195
- package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +198 -157
- package/dist/ProfileView/components/Toolbars/index.js +441 -21
- package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
- package/dist/ProfileView/components/ViewSelector/index.js +211 -91
- 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.js +84 -28
- 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.js +31 -10
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +72 -29
- package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +39 -13
- package/dist/ProfileView/hooks/useVisualizationState.js +262 -87
- 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.js +332 -237
- 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.js +125 -12
- 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.js +177 -101
- package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
- package/dist/SourceView/lang-detector/index.js +28 -14
- package/dist/SourceView/useSelectedLineRange.js +97 -16
- package/dist/Table/ColorCell.js +42 -1
- package/dist/Table/ColumnsVisibility.js +114 -6
- package/dist/Table/MoreDropdown.js +121 -27
- package/dist/Table/TableContextMenu.js +150 -139
- 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 +331 -168
- package/dist/Table/index.js +222 -126
- 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.js +340 -122
- 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.js +157 -94
- package/dist/hooks/useLabels.js +295 -52
- package/dist/hooks/useQueryState.js +371 -330
- package/dist/index.js +21 -16
- 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.map +1 -1
- package/dist/useSumBy.js +294 -138
- package/dist/utils.js +62 -30
- package/package.json +9 -9
- package/src/GraphTooltipArrow/index.tsx +3 -0
- 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/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +3 -0
- 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/ProfileSelector/index.tsx +30 -7
- package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +3 -0
- package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
- package/src/Table/hooks/useTableConfiguration.tsx +7 -13
- package/src/useDelayedLoader.ts +10 -10
- package/src/useSumBy.ts +12 -18
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -541
- package/dist/hooks/useQueryState.test.js +0 -984
|
@@ -1,4 +1,23 @@
|
|
|
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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
5
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
6
|
+
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 }; })(); }
|
|
7
|
+
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); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
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); }
|
|
13
|
+
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); }
|
|
14
|
+
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); }); }; }
|
|
15
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
16
|
+
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."); }
|
|
17
|
+
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; } }
|
|
18
|
+
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; }
|
|
19
|
+
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; } }
|
|
20
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
2
21
|
// Copyright 2022 The Parca Authors
|
|
3
22
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
23
|
// you may not use this file except in compliance with the License.
|
|
@@ -11,6 +30,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
11
30
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
31
|
// See the License for the specific language governing permissions and
|
|
13
32
|
// limitations under the License.
|
|
33
|
+
|
|
14
34
|
import { useCallback, useEffect, useState } from 'react';
|
|
15
35
|
import { Icon } from '@iconify/react';
|
|
16
36
|
import { useQueryClient } from '@tanstack/react-query';
|
|
@@ -21,306 +41,588 @@ import { millisToProtoTimestamp, sanitizeLabelValue } from '@parca/utilities';
|
|
|
21
41
|
import { useUnifiedLabels } from '../contexts/UnifiedLabelsContext';
|
|
22
42
|
import { transformLabelName } from '../contexts/utils';
|
|
23
43
|
import Select from './Select';
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
44
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
45
|
+
export var transformLabelsForSelect = function transformLabelsForSelect(labelNames) {
|
|
46
|
+
return labelNames.map(function (labelName) {
|
|
47
|
+
return {
|
|
48
|
+
key: labelName,
|
|
49
|
+
element: {
|
|
50
|
+
active: /*#__PURE__*/_jsx(_Fragment, {
|
|
51
|
+
children: transformLabelName(labelName)
|
|
52
|
+
}),
|
|
53
|
+
expanded: /*#__PURE__*/_jsx(_Fragment, {
|
|
54
|
+
children: transformLabelName(labelName)
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
});
|
|
32
59
|
};
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
60
|
+
var operatorOptions = [{
|
|
61
|
+
key: '=',
|
|
62
|
+
element: {
|
|
63
|
+
active: /*#__PURE__*/_jsx(_Fragment, {
|
|
64
|
+
children: "Equals"
|
|
65
|
+
}),
|
|
66
|
+
expanded: /*#__PURE__*/_jsx(_Fragment, {
|
|
67
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
68
|
+
children: "Equals"
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: '!=',
|
|
74
|
+
element: {
|
|
75
|
+
active: /*#__PURE__*/_jsx(_Fragment, {
|
|
76
|
+
children: "Not Equals"
|
|
77
|
+
}),
|
|
78
|
+
expanded: /*#__PURE__*/_jsx(_Fragment, {
|
|
79
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
80
|
+
children: "Not Equals"
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
key: '=~',
|
|
86
|
+
element: {
|
|
87
|
+
active: /*#__PURE__*/_jsx(_Fragment, {
|
|
88
|
+
children: "Regex"
|
|
89
|
+
}),
|
|
90
|
+
expanded: /*#__PURE__*/_jsx(_Fragment, {
|
|
91
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
92
|
+
children: "Regex"
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: '!~',
|
|
98
|
+
element: {
|
|
99
|
+
active: /*#__PURE__*/_jsx(_Fragment, {
|
|
100
|
+
children: "Not Regex"
|
|
101
|
+
}),
|
|
102
|
+
expanded: /*#__PURE__*/_jsx(_Fragment, {
|
|
103
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
104
|
+
children: "Not Regex"
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
}];
|
|
109
|
+
var SimpleMatchers = function SimpleMatchers(_ref) {
|
|
110
|
+
var _queryBrowserRef$curr;
|
|
111
|
+
var queryBrowserRef = _ref.queryBrowserRef,
|
|
112
|
+
searchExecutedTimestamp = _ref.searchExecutedTimestamp,
|
|
113
|
+
draftSelection = _ref.draftSelection,
|
|
114
|
+
setDraftMatchers = _ref.setDraftMatchers,
|
|
115
|
+
draftParsedQuery = _ref.draftParsedQuery;
|
|
116
|
+
var _useState = useState([{
|
|
117
|
+
labelName: '',
|
|
118
|
+
operator: '=',
|
|
119
|
+
labelValue: '',
|
|
120
|
+
labelValues: [],
|
|
121
|
+
isLoading: false
|
|
122
|
+
}]),
|
|
123
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
124
|
+
queryRows = _useState2[0],
|
|
125
|
+
setQueryRows = _useState2[1];
|
|
126
|
+
var reactQueryClient = useQueryClient();
|
|
127
|
+
var metadata = useGrpcMetadata();
|
|
128
|
+
var _useParcaContext = useParcaContext(),
|
|
129
|
+
parcaQueryClient = _useParcaContext.queryServiceClient;
|
|
130
|
+
var _useState3 = useState(false),
|
|
131
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
132
|
+
showAll = _useState4[0],
|
|
133
|
+
setShowAll = _useState4[1];
|
|
134
|
+
var _useState5 = useState(false),
|
|
135
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
136
|
+
isActivelyEditing = _useState6[0],
|
|
137
|
+
setIsActivelyEditing = _useState6[1];
|
|
138
|
+
var _useUnifiedLabels = useUnifiedLabels(),
|
|
139
|
+
labelNameOptions = _useUnifiedLabels.labelNameMappingsForSimpleMatchers,
|
|
140
|
+
labelNamesLoading = _useUnifiedLabels.isLabelNamesLoading,
|
|
141
|
+
refetchLabelNames = _useUnifiedLabels.refetchLabelNames;
|
|
142
|
+
|
|
143
|
+
// Reset editing mode when search is executed
|
|
144
|
+
useEffect(function () {
|
|
145
|
+
if (searchExecutedTimestamp !== undefined && searchExecutedTimestamp > 0) {
|
|
146
|
+
setIsActivelyEditing(false);
|
|
147
|
+
setShowAll(false);
|
|
148
|
+
}
|
|
149
|
+
}, [searchExecutedTimestamp]);
|
|
150
|
+
var visibleRows = showAll || isActivelyEditing ? queryRows : queryRows.slice(0, 3);
|
|
151
|
+
var hiddenRowsCount = queryRows.length - 3;
|
|
152
|
+
var maxWidthInPixels = "max-w-[".concat((_queryBrowserRef$curr = queryBrowserRef.current) === null || _queryBrowserRef$curr === void 0 ? void 0 : _queryBrowserRef$curr.offsetWidth.toString(), "px]");
|
|
153
|
+
var currentMatchers = draftParsedQuery === null || draftParsedQuery === void 0 ? void 0 : draftParsedQuery.matchersString();
|
|
154
|
+
var profileType = draftParsedQuery === null || draftParsedQuery === void 0 ? void 0 : draftParsedQuery.profileType().toString();
|
|
155
|
+
var start = draftSelection.from;
|
|
156
|
+
var end = draftSelection.to;
|
|
157
|
+
var fetchLabelValues = useCallback(/*#__PURE__*/function () {
|
|
158
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(labelName) {
|
|
159
|
+
var values, _t;
|
|
160
|
+
return _regenerator().w(function (_context2) {
|
|
161
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
162
|
+
case 0:
|
|
163
|
+
if (!(labelName == null || labelName === '')) {
|
|
164
|
+
_context2.n = 1;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
return _context2.a(2, []);
|
|
168
|
+
case 1:
|
|
169
|
+
if (!(profileType == null || profileType === '')) {
|
|
170
|
+
_context2.n = 2;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
return _context2.a(2, []);
|
|
174
|
+
case 2:
|
|
175
|
+
_context2.p = 2;
|
|
176
|
+
_context2.n = 3;
|
|
177
|
+
return reactQueryClient.fetchQuery([labelName, profileType, start, end], /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
178
|
+
var response, sanitizedValues;
|
|
179
|
+
return _regenerator().w(function (_context) {
|
|
180
|
+
while (1) switch (_context.n) {
|
|
181
|
+
case 0:
|
|
182
|
+
_context.n = 1;
|
|
183
|
+
return parcaQueryClient.values(_objectSpread({
|
|
184
|
+
labelName: labelName,
|
|
185
|
+
match: [],
|
|
186
|
+
profileType: profileType
|
|
187
|
+
}, start !== undefined && end !== undefined ? {
|
|
188
|
+
start: millisToProtoTimestamp(start),
|
|
189
|
+
end: millisToProtoTimestamp(end)
|
|
190
|
+
} : {}), {
|
|
191
|
+
meta: metadata
|
|
192
|
+
}).response;
|
|
193
|
+
case 1:
|
|
194
|
+
response = _context.v;
|
|
195
|
+
console.log('Fetched label values:', response.labelValues);
|
|
196
|
+
sanitizedValues = sanitizeLabelValue(response.labelValues);
|
|
197
|
+
return _context.a(2, sanitizedValues);
|
|
198
|
+
}
|
|
199
|
+
}, _callee);
|
|
200
|
+
})));
|
|
201
|
+
case 3:
|
|
202
|
+
values = _context2.v;
|
|
203
|
+
return _context2.a(2, values);
|
|
204
|
+
case 4:
|
|
205
|
+
_context2.p = 4;
|
|
206
|
+
_t = _context2.v;
|
|
207
|
+
console.error('Error fetching label values:', _t);
|
|
208
|
+
return _context2.a(2, []);
|
|
90
209
|
}
|
|
91
|
-
|
|
92
|
-
|
|
210
|
+
}, _callee2, null, [[2, 4]]);
|
|
211
|
+
}));
|
|
212
|
+
return function (_x) {
|
|
213
|
+
return _ref2.apply(this, arguments);
|
|
214
|
+
};
|
|
215
|
+
}(), [parcaQueryClient, metadata, profileType, reactQueryClient, start, end]);
|
|
216
|
+
var updateMatchersString = useCallback(function (rows) {
|
|
217
|
+
var matcherString = rows.filter(function (row) {
|
|
218
|
+
return row.labelName.length > 0 && row.labelValue;
|
|
219
|
+
}).map(function (row_0) {
|
|
220
|
+
return "".concat(row_0.labelName).concat(row_0.operator, "\"").concat(row_0.labelValue, "\"");
|
|
221
|
+
}).join(',');
|
|
222
|
+
setDraftMatchers(matcherString);
|
|
223
|
+
}, [setDraftMatchers]);
|
|
224
|
+
|
|
225
|
+
// Helper to ensure selected label name is in the options (for page load before API returns)
|
|
226
|
+
var getLabelNameOptionsWithSelected = useCallback(function (selectedLabelName) {
|
|
227
|
+
if (selectedLabelName === '') return labelNameOptions;
|
|
228
|
+
|
|
229
|
+
// Check if the selected label name exists in any group
|
|
230
|
+
var existsInOptions = labelNameOptions.some(function (group) {
|
|
231
|
+
return group.values.some(function (item) {
|
|
232
|
+
return item.key === selectedLabelName;
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
if (existsInOptions) return labelNameOptions;
|
|
236
|
+
|
|
237
|
+
// Add it temporarily to a group with type '' (matching non-matching labels group)
|
|
238
|
+
if (labelNameOptions.length === 0) {
|
|
239
|
+
return [{
|
|
240
|
+
type: '',
|
|
241
|
+
values: [{
|
|
242
|
+
key: selectedLabelName,
|
|
243
|
+
element: {
|
|
244
|
+
active: /*#__PURE__*/_jsx(_Fragment, {
|
|
245
|
+
children: selectedLabelName
|
|
246
|
+
}),
|
|
247
|
+
expanded: /*#__PURE__*/_jsx(_Fragment, {
|
|
248
|
+
children: selectedLabelName
|
|
249
|
+
})
|
|
250
|
+
}
|
|
251
|
+
}]
|
|
252
|
+
}];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Find the group with type '' (non-matching labels) or create it
|
|
256
|
+
var emptyTypeGroupIndex = labelNameOptions.findIndex(function (group_0) {
|
|
257
|
+
return group_0.type === '';
|
|
258
|
+
});
|
|
259
|
+
if (emptyTypeGroupIndex !== -1) {
|
|
260
|
+
// Add to existing '' type group
|
|
261
|
+
var updatedOptions = _toConsumableArray(labelNameOptions);
|
|
262
|
+
updatedOptions[emptyTypeGroupIndex] = _objectSpread(_objectSpread({}, updatedOptions[emptyTypeGroupIndex]), {}, {
|
|
263
|
+
values: [].concat(_toConsumableArray(updatedOptions[emptyTypeGroupIndex].values), [{
|
|
264
|
+
key: selectedLabelName,
|
|
265
|
+
element: {
|
|
266
|
+
active: /*#__PURE__*/_jsx(_Fragment, {
|
|
267
|
+
children: selectedLabelName
|
|
268
|
+
}),
|
|
269
|
+
expanded: /*#__PURE__*/_jsx(_Fragment, {
|
|
270
|
+
children: selectedLabelName
|
|
271
|
+
})
|
|
272
|
+
}
|
|
273
|
+
}])
|
|
274
|
+
});
|
|
275
|
+
return updatedOptions;
|
|
276
|
+
} else {
|
|
277
|
+
// Create new '' type group
|
|
278
|
+
return [].concat(_toConsumableArray(labelNameOptions), [{
|
|
279
|
+
type: '',
|
|
280
|
+
values: [{
|
|
281
|
+
key: selectedLabelName,
|
|
282
|
+
element: {
|
|
283
|
+
active: /*#__PURE__*/_jsx(_Fragment, {
|
|
284
|
+
children: selectedLabelName
|
|
285
|
+
}),
|
|
286
|
+
expanded: /*#__PURE__*/_jsx(_Fragment, {
|
|
287
|
+
children: selectedLabelName
|
|
288
|
+
})
|
|
289
|
+
}
|
|
290
|
+
}]
|
|
291
|
+
}]);
|
|
292
|
+
}
|
|
293
|
+
}, [labelNameOptions]);
|
|
294
|
+
var fetchLabelValuesUnified = useCallback(/*#__PURE__*/function () {
|
|
295
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(labelName_0) {
|
|
296
|
+
return _regenerator().w(function (_context3) {
|
|
297
|
+
while (1) switch (_context3.n) {
|
|
298
|
+
case 0:
|
|
299
|
+
_context3.n = 1;
|
|
300
|
+
return fetchLabelValues(labelName_0);
|
|
301
|
+
case 1:
|
|
302
|
+
return _context3.a(2, _context3.v);
|
|
93
303
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
304
|
+
}, _callee3);
|
|
305
|
+
}));
|
|
306
|
+
return function (_x2) {
|
|
307
|
+
return _ref4.apply(this, arguments);
|
|
308
|
+
};
|
|
309
|
+
}(), [fetchLabelValues]);
|
|
310
|
+
useEffect(function () {
|
|
311
|
+
if (currentMatchers === '' || currentMatchers === undefined) {
|
|
312
|
+
var defaultRow = {
|
|
313
|
+
labelName: '',
|
|
314
|
+
operator: '=',
|
|
315
|
+
labelValue: '',
|
|
316
|
+
labelValues: [],
|
|
317
|
+
isLoading: false
|
|
318
|
+
};
|
|
319
|
+
setQueryRows([defaultRow]);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
var isCancelled = false;
|
|
323
|
+
var fetchAndSetQueryRows = /*#__PURE__*/function () {
|
|
324
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
325
|
+
var newRows, filteredRows;
|
|
326
|
+
return _regenerator().w(function (_context5) {
|
|
327
|
+
while (1) switch (_context5.n) {
|
|
328
|
+
case 0:
|
|
329
|
+
_context5.n = 1;
|
|
330
|
+
return Promise.all(currentMatchers.split(',').map(/*#__PURE__*/function () {
|
|
331
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(matcher) {
|
|
332
|
+
var match, _match, labelName_1, operator, labelValue, trimmedLabelName, labelValues, sanitizedLabelValue;
|
|
333
|
+
return _regenerator().w(function (_context4) {
|
|
334
|
+
while (1) switch (_context4.n) {
|
|
335
|
+
case 0:
|
|
336
|
+
match = matcher.match(/^([^=!~]+)([=!~]{1,2})(.+)$/);
|
|
337
|
+
if (!(match === null)) {
|
|
338
|
+
_context4.n = 1;
|
|
339
|
+
break;
|
|
104
340
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return labelNameOptions;
|
|
133
|
-
// Add it temporarily to a group with type '' (matching non-matching labels group)
|
|
134
|
-
if (labelNameOptions.length === 0) {
|
|
135
|
-
return [
|
|
136
|
-
{
|
|
137
|
-
type: '',
|
|
138
|
-
values: [
|
|
139
|
-
{
|
|
140
|
-
key: selectedLabelName,
|
|
141
|
-
element: { active: _jsx(_Fragment, { children: selectedLabelName }), expanded: _jsx(_Fragment, { children: selectedLabelName }) },
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
},
|
|
145
|
-
];
|
|
146
|
-
}
|
|
147
|
-
// Find the group with type '' (non-matching labels) or create it
|
|
148
|
-
const emptyTypeGroupIndex = labelNameOptions.findIndex(group => group.type === '');
|
|
149
|
-
if (emptyTypeGroupIndex !== -1) {
|
|
150
|
-
// Add to existing '' type group
|
|
151
|
-
const updatedOptions = [...labelNameOptions];
|
|
152
|
-
updatedOptions[emptyTypeGroupIndex] = {
|
|
153
|
-
...updatedOptions[emptyTypeGroupIndex],
|
|
154
|
-
values: [
|
|
155
|
-
...updatedOptions[emptyTypeGroupIndex].values,
|
|
156
|
-
{
|
|
157
|
-
key: selectedLabelName,
|
|
158
|
-
element: { active: _jsx(_Fragment, { children: selectedLabelName }), expanded: _jsx(_Fragment, { children: selectedLabelName }) },
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
};
|
|
162
|
-
return updatedOptions;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
// Create new '' type group
|
|
166
|
-
return [
|
|
167
|
-
...labelNameOptions,
|
|
168
|
-
{
|
|
169
|
-
type: '',
|
|
170
|
-
values: [
|
|
171
|
-
{
|
|
172
|
-
key: selectedLabelName,
|
|
173
|
-
element: { active: _jsx(_Fragment, { children: selectedLabelName }), expanded: _jsx(_Fragment, { children: selectedLabelName }) },
|
|
174
|
-
},
|
|
175
|
-
],
|
|
176
|
-
},
|
|
177
|
-
];
|
|
178
|
-
}
|
|
179
|
-
}, [labelNameOptions]);
|
|
180
|
-
const fetchLabelValuesUnified = useCallback(async (labelName) => {
|
|
181
|
-
return await fetchLabelValues(labelName);
|
|
182
|
-
}, [fetchLabelValues]);
|
|
183
|
-
useEffect(() => {
|
|
184
|
-
if (currentMatchers === '' || currentMatchers === undefined) {
|
|
185
|
-
const defaultRow = {
|
|
186
|
-
labelName: '',
|
|
187
|
-
operator: '=',
|
|
188
|
-
labelValue: '',
|
|
189
|
-
labelValues: [],
|
|
190
|
-
isLoading: false,
|
|
191
|
-
};
|
|
192
|
-
setQueryRows([defaultRow]);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
let isCancelled = false;
|
|
196
|
-
const fetchAndSetQueryRows = async () => {
|
|
197
|
-
const newRows = await Promise.all(currentMatchers.split(',').map(async (matcher) => {
|
|
198
|
-
const match = matcher.match(/^([^=!~]+)([=!~]{1,2})(.+)$/);
|
|
199
|
-
if (match === null)
|
|
200
|
-
return null;
|
|
201
|
-
const [, labelName, operator, labelValue] = match;
|
|
202
|
-
const trimmedLabelName = labelName.trim();
|
|
203
|
-
if (trimmedLabelName === '')
|
|
204
|
-
return null;
|
|
205
|
-
const labelValues = await fetchLabelValuesUnified(trimmedLabelName);
|
|
206
|
-
const sanitizedLabelValue = labelValue.startsWith('"') && labelValue.endsWith('"')
|
|
207
|
-
? labelValue.slice(1, -1)
|
|
208
|
-
: labelValue;
|
|
209
|
-
return {
|
|
210
|
-
labelName: trimmedLabelName,
|
|
211
|
-
operator,
|
|
212
|
-
labelValue: sanitizedLabelValue,
|
|
213
|
-
labelValues,
|
|
214
|
-
isLoading: false,
|
|
341
|
+
return _context4.a(2, null);
|
|
342
|
+
case 1:
|
|
343
|
+
_match = _slicedToArray(match, 4), labelName_1 = _match[1], operator = _match[2], labelValue = _match[3];
|
|
344
|
+
trimmedLabelName = labelName_1.trim();
|
|
345
|
+
if (!(trimmedLabelName === '')) {
|
|
346
|
+
_context4.n = 2;
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
return _context4.a(2, null);
|
|
350
|
+
case 2:
|
|
351
|
+
_context4.n = 3;
|
|
352
|
+
return fetchLabelValuesUnified(trimmedLabelName);
|
|
353
|
+
case 3:
|
|
354
|
+
labelValues = _context4.v;
|
|
355
|
+
sanitizedLabelValue = labelValue.startsWith('"') && labelValue.endsWith('"') ? labelValue.slice(1, -1) : labelValue;
|
|
356
|
+
return _context4.a(2, {
|
|
357
|
+
labelName: trimmedLabelName,
|
|
358
|
+
operator: operator,
|
|
359
|
+
labelValue: sanitizedLabelValue,
|
|
360
|
+
labelValues: labelValues,
|
|
361
|
+
isLoading: false
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}, _callee4);
|
|
365
|
+
}));
|
|
366
|
+
return function (_x3) {
|
|
367
|
+
return _ref6.apply(this, arguments);
|
|
215
368
|
};
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
369
|
+
}()));
|
|
370
|
+
case 1:
|
|
371
|
+
newRows = _context5.v;
|
|
372
|
+
if (!isCancelled) {
|
|
373
|
+
filteredRows = newRows.filter(function (row_1) {
|
|
374
|
+
return row_1 !== null;
|
|
375
|
+
});
|
|
219
376
|
setQueryRows(filteredRows);
|
|
377
|
+
}
|
|
378
|
+
case 2:
|
|
379
|
+
return _context5.a(2);
|
|
380
|
+
}
|
|
381
|
+
}, _callee5);
|
|
382
|
+
}));
|
|
383
|
+
return function fetchAndSetQueryRows() {
|
|
384
|
+
return _ref5.apply(this, arguments);
|
|
385
|
+
};
|
|
386
|
+
}();
|
|
387
|
+
void fetchAndSetQueryRows();
|
|
388
|
+
return function () {
|
|
389
|
+
isCancelled = true;
|
|
390
|
+
};
|
|
391
|
+
}, [currentMatchers, fetchLabelValuesUnified]);
|
|
392
|
+
var updateRow = useCallback(/*#__PURE__*/function () {
|
|
393
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(index, field, value) {
|
|
394
|
+
var updatedRows, prevLabelName, labelValues_0;
|
|
395
|
+
return _regenerator().w(function (_context6) {
|
|
396
|
+
while (1) switch (_context6.n) {
|
|
397
|
+
case 0:
|
|
398
|
+
updatedRows = _toConsumableArray(queryRows);
|
|
399
|
+
prevLabelName = updatedRows[index].labelName;
|
|
400
|
+
updatedRows[index] = _objectSpread(_objectSpread({}, updatedRows[index]), {}, _defineProperty({}, field, value));
|
|
401
|
+
if (!(field === 'labelName' && value !== prevLabelName)) {
|
|
402
|
+
_context6.n = 2;
|
|
403
|
+
break;
|
|
220
404
|
}
|
|
221
|
-
};
|
|
222
|
-
void fetchAndSetQueryRows();
|
|
223
|
-
return () => {
|
|
224
|
-
isCancelled = true;
|
|
225
|
-
};
|
|
226
|
-
}, [currentMatchers, fetchLabelValuesUnified]);
|
|
227
|
-
const updateRow = useCallback(async (index, field, value) => {
|
|
228
|
-
const updatedRows = [...queryRows];
|
|
229
|
-
const prevLabelName = updatedRows[index].labelName;
|
|
230
|
-
updatedRows[index] = { ...updatedRows[index], [field]: value };
|
|
231
|
-
if (field === 'labelName' && value !== prevLabelName) {
|
|
232
405
|
updatedRows[index].labelValues = [];
|
|
233
406
|
updatedRows[index].labelValue = '';
|
|
234
407
|
updatedRows[index].isLoading = true;
|
|
235
|
-
setQueryRows(
|
|
236
|
-
|
|
237
|
-
|
|
408
|
+
setQueryRows(_toConsumableArray(updatedRows));
|
|
409
|
+
_context6.n = 1;
|
|
410
|
+
return fetchLabelValuesUnified(value);
|
|
411
|
+
case 1:
|
|
412
|
+
labelValues_0 = _context6.v;
|
|
413
|
+
updatedRows[index].labelValues = labelValues_0;
|
|
238
414
|
updatedRows[index].isLoading = false;
|
|
415
|
+
case 2:
|
|
416
|
+
setQueryRows(_toConsumableArray(updatedRows));
|
|
417
|
+
updateMatchersString(updatedRows);
|
|
418
|
+
case 3:
|
|
419
|
+
return _context6.a(2);
|
|
239
420
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
421
|
+
}, _callee6);
|
|
422
|
+
}));
|
|
423
|
+
return function (_x4, _x5, _x6) {
|
|
424
|
+
return _ref7.apply(this, arguments);
|
|
425
|
+
};
|
|
426
|
+
}(), [queryRows, fetchLabelValuesUnified, updateMatchersString]);
|
|
427
|
+
var handleUpdateRow = useCallback(function (index_0, field_0, value_0) {
|
|
428
|
+
// Only set actively editing if not already showing all
|
|
429
|
+
// If showAll is true, user has explicitly expanded, so keep that state
|
|
430
|
+
if (!showAll) {
|
|
431
|
+
setIsActivelyEditing(true);
|
|
432
|
+
}
|
|
433
|
+
void updateRow(index_0, field_0, value_0);
|
|
434
|
+
}, [updateRow, showAll]);
|
|
435
|
+
var addNewRow = useCallback(function () {
|
|
436
|
+
// Only set actively editing if not already showing all label names and values
|
|
437
|
+
// If showAll is true, user has explicitly expanded, so keep that state
|
|
438
|
+
if (!showAll) {
|
|
439
|
+
setIsActivelyEditing(true);
|
|
440
|
+
}
|
|
441
|
+
var newRows_0 = [].concat(_toConsumableArray(queryRows), [{
|
|
442
|
+
labelName: '',
|
|
443
|
+
operator: '=',
|
|
444
|
+
labelValue: '',
|
|
445
|
+
labelValues: [],
|
|
446
|
+
isLoading: false
|
|
447
|
+
}]);
|
|
448
|
+
setQueryRows(newRows_0);
|
|
449
|
+
updateMatchersString(newRows_0);
|
|
450
|
+
}, [queryRows, updateMatchersString, showAll]);
|
|
451
|
+
var removeRow = useCallback(function (index_1) {
|
|
452
|
+
if (queryRows.length === 1) {
|
|
453
|
+
// Reset the single row instead of removing it
|
|
454
|
+
var resetRow = {
|
|
455
|
+
labelName: '',
|
|
456
|
+
operator: '=',
|
|
457
|
+
labelValue: '',
|
|
458
|
+
labelValues: [],
|
|
459
|
+
isLoading: false
|
|
460
|
+
};
|
|
461
|
+
setQueryRows([resetRow]);
|
|
462
|
+
updateMatchersString([resetRow]);
|
|
463
|
+
} else {
|
|
464
|
+
var updatedRows_0 = queryRows.filter(function (_, i) {
|
|
465
|
+
return i !== index_1;
|
|
466
|
+
});
|
|
467
|
+
setQueryRows(updatedRows_0);
|
|
468
|
+
updateMatchersString(updatedRows_0);
|
|
469
|
+
}
|
|
470
|
+
}, [queryRows, updateMatchersString]);
|
|
471
|
+
var handleLabelValueClick = useCallback(function (index_2) {
|
|
472
|
+
return /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
473
|
+
var updatedRows_1, labelValues_1, _t2;
|
|
474
|
+
return _regenerator().w(function (_context7) {
|
|
475
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
476
|
+
case 0:
|
|
477
|
+
updatedRows_1 = _toConsumableArray(queryRows);
|
|
478
|
+
if (!(updatedRows_1[index_2].labelValues.length === 0 && updatedRows_1[index_2].labelName !== '')) {
|
|
479
|
+
_context7.n = 6;
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
updatedRows_1[index_2].isLoading = true;
|
|
483
|
+
setQueryRows(_toConsumableArray(updatedRows_1));
|
|
484
|
+
_context7.p = 1;
|
|
485
|
+
_context7.n = 2;
|
|
486
|
+
return fetchLabelValuesUnified(updatedRows_1[index_2].labelName);
|
|
487
|
+
case 2:
|
|
488
|
+
labelValues_1 = _context7.v;
|
|
489
|
+
updatedRows_1[index_2].labelValues = labelValues_1;
|
|
490
|
+
_context7.n = 4;
|
|
491
|
+
break;
|
|
492
|
+
case 3:
|
|
493
|
+
_context7.p = 3;
|
|
494
|
+
_t2 = _context7.v;
|
|
495
|
+
console.error('Error fetching label values:', _t2);
|
|
496
|
+
case 4:
|
|
497
|
+
_context7.p = 4;
|
|
498
|
+
updatedRows_1[index_2].isLoading = false;
|
|
499
|
+
setQueryRows(_toConsumableArray(updatedRows_1));
|
|
500
|
+
return _context7.f(4);
|
|
501
|
+
case 5:
|
|
502
|
+
_context7.n = 7;
|
|
503
|
+
break;
|
|
504
|
+
case 6:
|
|
505
|
+
console.log("Label values already present or empty label name");
|
|
506
|
+
case 7:
|
|
507
|
+
return _context7.a(2);
|
|
256
508
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
isLoading: false,
|
|
273
|
-
};
|
|
274
|
-
setQueryRows([resetRow]);
|
|
275
|
-
updateMatchersString([resetRow]);
|
|
509
|
+
}, _callee7, null, [[1, 3, 4, 5]]);
|
|
510
|
+
}));
|
|
511
|
+
}, [queryRows, fetchLabelValuesUnified]);
|
|
512
|
+
var isRowRegex = function isRowRegex(row_2) {
|
|
513
|
+
return row_2.operator === '=~' || row_2.operator === '!~';
|
|
514
|
+
};
|
|
515
|
+
var handleRefetchForLabelValues = useCallback(/*#__PURE__*/function () {
|
|
516
|
+
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(labelName_2) {
|
|
517
|
+
return _regenerator().w(function (_context8) {
|
|
518
|
+
while (1) switch (_context8.n) {
|
|
519
|
+
case 0:
|
|
520
|
+
_context8.n = 1;
|
|
521
|
+
return fetchLabelValuesUnified(labelName_2);
|
|
522
|
+
case 1:
|
|
523
|
+
return _context8.a(2);
|
|
276
524
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
525
|
+
}, _callee8);
|
|
526
|
+
}));
|
|
527
|
+
return function (_x7) {
|
|
528
|
+
return _ref9.apply(this, arguments);
|
|
529
|
+
};
|
|
530
|
+
}(), [fetchLabelValuesUnified]);
|
|
531
|
+
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
532
|
+
className: "flex items-center gap-3 ".concat(maxWidthInPixels, " w-full flex-wrap"),
|
|
533
|
+
id: "simple-matchers"
|
|
534
|
+
}, testId(TEST_IDS.SIMPLE_MATCHERS_CONTAINER)), {}, {
|
|
535
|
+
children: [visibleRows.map(function (row_3, index_3) {
|
|
536
|
+
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
537
|
+
className: "flex items-center"
|
|
538
|
+
}, testId(TEST_IDS.SIMPLE_MATCHER_ROW)), {}, {
|
|
539
|
+
children: [/*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({
|
|
540
|
+
items: getLabelNameOptionsWithSelected(row_3.labelName),
|
|
541
|
+
onSelection: function onSelection(value_1) {
|
|
542
|
+
return handleUpdateRow(index_3, 'labelName', value_1);
|
|
543
|
+
},
|
|
544
|
+
placeholder: "Select label name",
|
|
545
|
+
selectedKey: row_3.labelName,
|
|
546
|
+
className: "rounded-tr-none rounded-br-none ring-0 focus:ring-0 outline-none",
|
|
547
|
+
loading: labelNamesLoading,
|
|
548
|
+
searchable: true
|
|
549
|
+
}, testId(TEST_IDS.LABEL_NAME_SELECT)), {}, {
|
|
550
|
+
refetchValues: refetchLabelNames
|
|
551
|
+
})), /*#__PURE__*/_jsx(Select, _objectSpread({
|
|
552
|
+
items: operatorOptions,
|
|
553
|
+
onSelection: function onSelection(value_2) {
|
|
554
|
+
return handleUpdateRow(index_3, 'operator', value_2);
|
|
555
|
+
},
|
|
556
|
+
selectedKey: row_3.operator,
|
|
557
|
+
className: "rounded-none ring-0 focus:ring-0 outline-none"
|
|
558
|
+
}, testId(TEST_IDS.OPERATOR_SELECT))), /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({
|
|
559
|
+
items: transformLabelsForSelect(row_3.labelValue !== '' && !row_3.labelValues.includes(row_3.labelValue) ? [].concat(_toConsumableArray(row_3.labelValues), [row_3.labelValue]) : row_3.labelValues),
|
|
560
|
+
onSelection: function onSelection(value_3) {
|
|
561
|
+
return handleUpdateRow(index_3, 'labelValue', value_3);
|
|
562
|
+
},
|
|
563
|
+
placeholder: "Select label value",
|
|
564
|
+
selectedKey: row_3.labelValue,
|
|
565
|
+
className: "rounded-none ring-0 focus:ring-0 outline-none max-w-48",
|
|
566
|
+
optionsClassname: cx('max-w-[600px]', {
|
|
567
|
+
'w-[300px]': isRowRegex(row_3)
|
|
568
|
+
}),
|
|
569
|
+
searchable: true,
|
|
570
|
+
disabled: row_3.labelName === '',
|
|
571
|
+
loading: row_3.isLoading,
|
|
572
|
+
onButtonClick: function onButtonClick() {
|
|
573
|
+
return handleLabelValueClick(index_3);
|
|
574
|
+
},
|
|
575
|
+
editable: isRowRegex(row_3)
|
|
576
|
+
}, testId(TEST_IDS.LABEL_VALUE_SELECT)), {}, {
|
|
577
|
+
refetchValues: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
578
|
+
return _regenerator().w(function (_context9) {
|
|
579
|
+
while (1) switch (_context9.n) {
|
|
580
|
+
case 0:
|
|
581
|
+
_context9.n = 1;
|
|
582
|
+
return handleRefetchForLabelValues(row_3.labelName);
|
|
583
|
+
case 1:
|
|
584
|
+
return _context9.a(2, _context9.v);
|
|
585
|
+
}
|
|
586
|
+
}, _callee9);
|
|
587
|
+
})),
|
|
588
|
+
showLoadingInButton: true
|
|
589
|
+
})), /*#__PURE__*/_jsx("button", _objectSpread(_objectSpread({
|
|
590
|
+
onClick: function onClick() {
|
|
591
|
+
return removeRow(index_3);
|
|
592
|
+
},
|
|
593
|
+
className: cx('p-2 border-gray-200 border rounded rounded-tl-none rounded-bl-none focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-900')
|
|
594
|
+
}, testId(TEST_IDS.REMOVE_MATCHER_BUTTON)), {}, {
|
|
595
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
596
|
+
icon: "carbon:close",
|
|
597
|
+
className: "h-5 w-5 text-gray-400",
|
|
598
|
+
"aria-hidden": "true"
|
|
599
|
+
})
|
|
600
|
+
}))]
|
|
601
|
+
}), index_3);
|
|
602
|
+
}), queryRows.length > 3 && !isActivelyEditing && /*#__PURE__*/_jsx("button", _objectSpread(_objectSpread({
|
|
603
|
+
onClick: function onClick() {
|
|
604
|
+
if (showAll) {
|
|
605
|
+
// Clicking "Show less" - collapse and stop editing mode
|
|
606
|
+
setShowAll(false);
|
|
607
|
+
setIsActivelyEditing(false);
|
|
608
|
+
} else {
|
|
609
|
+
// Clicking "Show more" - just expand
|
|
610
|
+
setShowAll(true);
|
|
281
611
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
updatedRows[index].isLoading = false;
|
|
298
|
-
setQueryRows([...updatedRows]);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
console.log(`Label values already present or empty label name`);
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
}, [queryRows, fetchLabelValuesUnified]);
|
|
306
|
-
const isRowRegex = (row) => row.operator === '=~' || row.operator === '!~';
|
|
307
|
-
const handleRefetchForLabelValues = useCallback(async (labelName) => {
|
|
308
|
-
await fetchLabelValuesUnified(labelName);
|
|
309
|
-
}, [fetchLabelValuesUnified]);
|
|
310
|
-
return (_jsxs("div", { className: `flex items-center gap-3 ${maxWidthInPixels} w-full flex-wrap`, id: "simple-matchers", ...testId(TEST_IDS.SIMPLE_MATCHERS_CONTAINER), children: [visibleRows.map((row, index) => (_jsxs("div", { className: "flex items-center", ...testId(TEST_IDS.SIMPLE_MATCHER_ROW), children: [_jsx(Select, { items: getLabelNameOptionsWithSelected(row.labelName), onSelection: value => handleUpdateRow(index, 'labelName', value), placeholder: "Select label name", selectedKey: row.labelName, className: "rounded-tr-none rounded-br-none ring-0 focus:ring-0 outline-none", loading: labelNamesLoading, searchable: true, ...testId(TEST_IDS.LABEL_NAME_SELECT), refetchValues: refetchLabelNames }), _jsx(Select, { items: operatorOptions, onSelection: value => handleUpdateRow(index, 'operator', value), selectedKey: row.operator, className: "rounded-none ring-0 focus:ring-0 outline-none", ...testId(TEST_IDS.OPERATOR_SELECT) }), _jsx(Select, { items: transformLabelsForSelect(row.labelValue !== '' && !row.labelValues.includes(row.labelValue)
|
|
311
|
-
? [...row.labelValues, row.labelValue]
|
|
312
|
-
: row.labelValues), onSelection: value => handleUpdateRow(index, 'labelValue', value), placeholder: "Select label value", selectedKey: row.labelValue, className: "rounded-none ring-0 focus:ring-0 outline-none max-w-48", optionsClassname: cx('max-w-[600px]', {
|
|
313
|
-
'w-[300px]': isRowRegex(row),
|
|
314
|
-
}), searchable: true, disabled: row.labelName === '', loading: row.isLoading, onButtonClick: () => handleLabelValueClick(index), editable: isRowRegex(row), ...testId(TEST_IDS.LABEL_VALUE_SELECT), refetchValues: async () => await handleRefetchForLabelValues(row.labelName), showLoadingInButton: true }), _jsx("button", { onClick: () => removeRow(index), className: cx('p-2 border-gray-200 border rounded rounded-tl-none rounded-bl-none focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-900'), ...testId(TEST_IDS.REMOVE_MATCHER_BUTTON), children: _jsx(Icon, { icon: "carbon:close", className: "h-5 w-5 text-gray-400", "aria-hidden": "true" }) })] }, index))), queryRows.length > 3 && !isActivelyEditing && (_jsx("button", { onClick: () => {
|
|
315
|
-
if (showAll) {
|
|
316
|
-
// Clicking "Show less" - collapse and stop editing mode
|
|
317
|
-
setShowAll(false);
|
|
318
|
-
setIsActivelyEditing(false);
|
|
319
|
-
}
|
|
320
|
-
else {
|
|
321
|
-
// Clicking "Show more" - just expand
|
|
322
|
-
setShowAll(true);
|
|
323
|
-
}
|
|
324
|
-
}, className: "mr-2 px-3 py-1 text-sm font-medium text-gray-700 dark:text-gray-200 bg-gray-100 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:bg-gray-900", ...testId(showAll ? TEST_IDS.SHOW_LESS_BUTTON : TEST_IDS.SHOW_MORE_BUTTON), children: showAll ? 'Show less' : `Show ${hiddenRowsCount} more` })), _jsx("button", { onClick: addNewRow, className: "p-2 border-gray-200 dark:bg-gray-900 dark:border-gray-600 border rounded focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500", ...testId(TEST_IDS.ADD_MATCHER_BUTTON), children: _jsx(Icon, { icon: "material-symbols:add", className: "h-5 w-5 text-gray-400", "aria-hidden": "true" }) })] }));
|
|
612
|
+
},
|
|
613
|
+
className: "mr-2 px-3 py-1 text-sm font-medium text-gray-700 dark:text-gray-200 bg-gray-100 rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:bg-gray-900"
|
|
614
|
+
}, testId(showAll ? TEST_IDS.SHOW_LESS_BUTTON : TEST_IDS.SHOW_MORE_BUTTON)), {}, {
|
|
615
|
+
children: showAll ? 'Show less' : "Show ".concat(hiddenRowsCount, " more")
|
|
616
|
+
})), /*#__PURE__*/_jsx("button", _objectSpread(_objectSpread({
|
|
617
|
+
onClick: addNewRow,
|
|
618
|
+
className: "p-2 border-gray-200 dark:bg-gray-900 dark:border-gray-600 border rounded focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
|
|
619
|
+
}, testId(TEST_IDS.ADD_MATCHER_BUTTON)), {}, {
|
|
620
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
621
|
+
icon: "material-symbols:add",
|
|
622
|
+
className: "h-5 w-5 text-gray-400",
|
|
623
|
+
"aria-hidden": "true"
|
|
624
|
+
})
|
|
625
|
+
}))]
|
|
626
|
+
}));
|
|
325
627
|
};
|
|
326
|
-
export default SimpleMatchers;
|
|
628
|
+
export default SimpleMatchers;
|