@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.
Files changed (170) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/GraphTooltipArrow/Content.js +224 -30
  3. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
  4. package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
  5. package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
  6. package/dist/GraphTooltipArrow/index.js +86 -56
  7. package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
  8. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +103 -73
  9. package/dist/MatchersInput/SuggestionItem.js +91 -12
  10. package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
  11. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  12. package/dist/MatchersInput/SuggestionsList.js +371 -157
  13. package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
  14. package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
  15. package/dist/MatchersInput/index.js +308 -115
  16. package/dist/MetricsCircle/index.js +39 -3
  17. package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
  18. package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
  19. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  20. package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
  21. package/dist/MetricsGraph/index.js +552 -203
  22. package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
  23. package/dist/MetricsGraph/utils/colorMapping.js +24 -17
  24. package/dist/MetricsSeries/index.js +70 -7
  25. package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
  26. package/dist/PreSelectedMatchers/index.js +249 -102
  27. package/dist/ProfileExplorer/ProfileExplorerCompare.js +240 -49
  28. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  29. package/dist/ProfileExplorer/index.js +183 -32
  30. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  31. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  32. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  33. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  34. package/dist/ProfileFlameChart/index.js +266 -134
  35. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +287 -88
  36. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  37. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  38. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  39. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +71 -45
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  55. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  56. package/dist/ProfileFlameGraph/index.js +324 -148
  57. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  58. package/dist/ProfileMetricsGraph/index.js +518 -259
  59. package/dist/ProfileSelector/CompareButton.js +132 -12
  60. package/dist/ProfileSelector/MetricsGraphSection.js +234 -67
  61. package/dist/ProfileSelector/index.d.ts.map +1 -1
  62. package/dist/ProfileSelector/index.js +730 -142
  63. package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
  64. package/dist/ProfileSource.js +230 -163
  65. package/dist/ProfileTypeSelector/index.js +214 -125
  66. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  67. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +139 -33
  68. package/dist/ProfileView/components/ColorStackLegend.js +184 -55
  69. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  70. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  71. package/dist/ProfileView/components/DiffLegend.js +172 -29
  72. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  73. package/dist/ProfileView/components/InvertCallStack/index.js +99 -10
  74. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  75. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  76. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  77. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -120
  78. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  79. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  80. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  81. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  82. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +675 -195
  83. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  84. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +198 -157
  85. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  86. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  87. package/dist/ProfileView/components/ViewSelector/index.js +211 -91
  88. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  89. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  90. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  91. package/dist/ProfileView/context/DashboardContext.js +84 -28
  92. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  93. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  94. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  95. package/dist/ProfileView/hooks/useResetFlameGraphState.js +31 -10
  96. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +72 -29
  97. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +39 -13
  98. package/dist/ProfileView/hooks/useVisualizationState.js +262 -87
  99. package/dist/ProfileView/index.js +383 -45
  100. package/dist/ProfileView/types/visualization.js +1 -13
  101. package/dist/ProfileView/utils/colorUtils.js +8 -7
  102. package/dist/ProfileViewWithData.js +332 -237
  103. package/dist/QueryControls/index.js +418 -47
  104. package/dist/Sandwich/components/CalleesSection.js +54 -4
  105. package/dist/Sandwich/components/CallersSection.js +97 -27
  106. package/dist/Sandwich/components/TableSection.js +77 -4
  107. package/dist/Sandwich/index.js +125 -12
  108. package/dist/Sandwich/utils/processRowData.js +48 -39
  109. package/dist/SelectWithRefresh/index.js +102 -28
  110. package/dist/SimpleMatchers/Select.js +520 -187
  111. package/dist/SimpleMatchers/index.js +590 -288
  112. package/dist/SourceView/Highlighter.js +230 -70
  113. package/dist/SourceView/LineNo.js +72 -17
  114. package/dist/SourceView/index.js +177 -101
  115. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  116. package/dist/SourceView/lang-detector/index.js +28 -14
  117. package/dist/SourceView/useSelectedLineRange.js +97 -16
  118. package/dist/Table/ColorCell.js +42 -1
  119. package/dist/Table/ColumnsVisibility.js +114 -6
  120. package/dist/Table/MoreDropdown.js +121 -27
  121. package/dist/Table/TableContextMenu.js +150 -139
  122. package/dist/Table/TableContextMenuWrapper.js +59 -14
  123. package/dist/Table/hooks/useColorManagement.js +58 -16
  124. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  125. package/dist/Table/hooks/useTableConfiguration.js +331 -168
  126. package/dist/Table/index.js +222 -126
  127. package/dist/Table/utils/functions.js +169 -144
  128. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  129. package/dist/TimelineGuide/index.js +209 -16
  130. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  131. package/dist/TopTable/index.js +340 -122
  132. package/dist/contexts/LabelsQueryProvider.js +94 -32
  133. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  134. package/dist/contexts/utils.js +37 -15
  135. package/dist/hooks/useCompareModeMeta.js +157 -94
  136. package/dist/hooks/useLabels.js +295 -52
  137. package/dist/hooks/useQueryState.js +371 -330
  138. package/dist/index.js +21 -16
  139. package/dist/testdata/fg-diff.json +3750 -0
  140. package/dist/testdata/fg-simple.json +1879 -0
  141. package/dist/testdata/link_data.json +56 -0
  142. package/dist/testdata/tabular.json +30 -0
  143. package/dist/testdata/test_flamegraph.json +26846 -0
  144. package/dist/testdata/test_graph.json +53 -0
  145. package/dist/useDelayedLoader.js +32 -18
  146. package/dist/useGrpcQuery/index.js +71 -11
  147. package/dist/useHasProfileData.js +90 -12
  148. package/dist/useQuery.js +205 -64
  149. package/dist/useSumBy.d.ts.map +1 -1
  150. package/dist/useSumBy.js +294 -138
  151. package/dist/utils.js +62 -30
  152. package/package.json +9 -9
  153. package/src/GraphTooltipArrow/index.tsx +3 -0
  154. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  155. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  156. package/src/MatchersInput/index.tsx +1 -1
  157. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  158. package/src/PreSelectedMatchers/index.tsx +3 -0
  159. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +3 -0
  160. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  161. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  162. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  163. package/src/ProfileSelector/index.tsx +30 -7
  164. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +3 -0
  165. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  166. package/src/Table/hooks/useTableConfiguration.tsx +7 -13
  167. package/src/useDelayedLoader.ts +10 -10
  168. package/src/useSumBy.ts +12 -18
  169. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -541
  170. package/dist/hooks/useQueryState.test.js +0 -984
@@ -1,4 +1,14 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ 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 }; })(); }
2
+ 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); }
3
+ 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); }
4
+ 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); }); }; }
5
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
+ 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."); }
7
+ 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; } }
8
+ 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; }
9
+ 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; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
+ import { c as _c } from "react-compiler-runtime";
2
12
  // Copyright 2022 The Parca Authors
3
13
  // Licensed under the Apache License, Version 2.0 (the "License");
4
14
  // you may not use this file except in compliance with the License.
@@ -11,74 +21,354 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
11
21
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
22
  // See the License for the specific language governing permissions and
13
23
  // limitations under the License.
14
- import { useState } from 'react';
24
+
25
+ import React, { useState } from 'react';
15
26
  import { Icon } from '@iconify/react';
16
27
  import { Button, Dropdown, Modal, useGrpcMetadata, useParcaContext } from '@parca/components';
17
28
  import ResultBox from './ResultBox';
18
- const ProfileShareModal = ({ isOpen, closeModal, queryRequest, queryClient, }) => {
19
- const [isShared, setIsShared] = useState(false);
20
- const [loading, setLoading] = useState(false);
21
- const [error, setError] = useState('');
22
- const [description, setDescription] = useState('');
23
- const [sharedLink, setSharedLink] = useState('');
24
- const { Spinner } = useParcaContext();
25
- const metadata = useGrpcMetadata();
26
- const isFormDataValid = () => true;
27
- const handleSubmit = async () => {
28
- try {
29
- setLoading(true);
30
- const { response } = await queryClient.shareProfile({ queryRequest, description }, { meta: metadata });
31
- setSharedLink(response.link);
32
- setLoading(false);
33
- setIsShared(true);
34
- }
35
- catch (err) {
36
- if (err instanceof Error) {
29
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
30
+ var ProfileShareModal = function ProfileShareModal(t0) {
31
+ var $ = _c(21);
32
+ var isOpen = t0.isOpen,
33
+ closeModal = t0.closeModal,
34
+ queryRequest = t0.queryRequest,
35
+ queryClient = t0.queryClient;
36
+ var _useState = useState(false),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ isShared = _useState2[0],
39
+ setIsShared = _useState2[1];
40
+ var _useState3 = useState(false),
41
+ _useState4 = _slicedToArray(_useState3, 2),
42
+ loading = _useState4[0],
43
+ setLoading = _useState4[1];
44
+ var _useState5 = useState(""),
45
+ _useState6 = _slicedToArray(_useState5, 2),
46
+ error = _useState6[0],
47
+ setError = _useState6[1];
48
+ var _useState7 = useState(""),
49
+ _useState8 = _slicedToArray(_useState7, 2),
50
+ description = _useState8[0],
51
+ setDescription = _useState8[1];
52
+ var _useState9 = useState(""),
53
+ _useState0 = _slicedToArray(_useState9, 2),
54
+ sharedLink = _useState0[0],
55
+ setSharedLink = _useState0[1];
56
+ var _useParcaContext = useParcaContext(),
57
+ Spinner = _useParcaContext.Spinner;
58
+ var metadata = useGrpcMetadata();
59
+ var isFormDataValid = _temp;
60
+ var t1;
61
+ if ($[0] !== description || $[1] !== metadata || $[2] !== queryClient || $[3] !== queryRequest) {
62
+ t1 = /*#__PURE__*/function () {
63
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
64
+ var _yield$queryClient$sh, response, err, _t;
65
+ return _regenerator().w(function (_context) {
66
+ while (1) switch (_context.p = _context.n) {
67
+ case 0:
68
+ ;
69
+ _context.p = 1;
70
+ setLoading(true);
71
+ _context.n = 2;
72
+ return queryClient.shareProfile({
73
+ queryRequest: queryRequest,
74
+ description: description
75
+ }, {
76
+ meta: metadata
77
+ });
78
+ case 2:
79
+ _yield$queryClient$sh = _context.v;
80
+ response = _yield$queryClient$sh.response;
81
+ setSharedLink(response.link);
82
+ setLoading(false);
83
+ setIsShared(true);
84
+ _context.n = 4;
85
+ break;
86
+ case 3:
87
+ _context.p = 3;
88
+ _t = _context.v;
89
+ err = _t;
90
+ if (err instanceof Error) {
37
91
  console.error(err);
38
92
  setLoading(false);
39
- // https://github.com/microsoft/TypeScript/issues/38347
40
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
41
93
  setError(err.toString());
42
- }
43
- }
94
+ }
95
+ case 4:
96
+ return _context.a(2);
97
+ }
98
+ }, _callee, null, [[1, 3]]);
99
+ }));
100
+ return function t1() {
101
+ return _ref.apply(this, arguments);
102
+ };
103
+ }();
104
+ $[0] = description;
105
+ $[1] = metadata;
106
+ $[2] = queryClient;
107
+ $[3] = queryRequest;
108
+ $[4] = t1;
109
+ } else {
110
+ t1 = $[4];
111
+ }
112
+ var handleSubmit = t1;
113
+ var t2;
114
+ if ($[5] !== closeModal) {
115
+ t2 = function t2() {
116
+ setLoading(false);
117
+ setError("");
118
+ setDescription("");
119
+ setIsShared(false);
120
+ closeModal();
44
121
  };
45
- const onClose = () => {
46
- setLoading(false);
47
- setError('');
48
- setDescription('');
49
- setIsShared(false);
50
- closeModal();
51
- };
52
- return (_jsx(Modal, { isOpen: isOpen, closeModal: onClose, title: "Share Profile", className: "w-[420px]", children: _jsxs("div", { className: "py-2", children: [_jsx("p", { className: "text-sm text-gray-500 dark:text-gray-300", children: "Note: Shared profiles can be accessed by anyone with the link, even from people outside your organisation." }), !isShared || error?.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "mb-2 mt-3 text-sm text-gray-500 dark:text-gray-300", children: "Enter a description (optional)" }), _jsx("textarea", { className: "w-full border bg-inherit px-2 py-2 text-sm text-gray-500 dark:text-gray-300", value: description, onChange: e => setDescription(e.target.value) }), _jsx(Button, { variant: "primary", className: "mt-4 h-[38px]", onClick: e => {
53
- e.preventDefault();
54
- void handleSubmit();
55
- }, disabled: loading || !isFormDataValid(), type: "submit", children: loading ? _jsx(Spinner, { paddingClasses: "p-0" }) : 'Share' }), error !== '' ? _jsx("p", { children: "Something went wrong please try again" }) : null] })) : (_jsxs(_Fragment, { children: [_jsx(ResultBox, { value: sharedLink, className: "mt-4" }), _jsx("div", { className: "mt-8 flex justify-center", children: _jsx(Button, { variant: "neutral", className: "w-fit", onClick: onClose, children: "Close" }) })] }))] }) }));
122
+ $[5] = closeModal;
123
+ $[6] = t2;
124
+ } else {
125
+ t2 = $[6];
126
+ }
127
+ var onClose = t2;
128
+ var t3;
129
+ if ($[7] === Symbol["for"]("react.memo_cache_sentinel")) {
130
+ t3 = /*#__PURE__*/_jsx("p", {
131
+ className: "text-sm text-gray-500 dark:text-gray-300",
132
+ children: "Note: Shared profiles can be accessed by anyone with the link, even from people outside your organisation."
133
+ });
134
+ $[7] = t3;
135
+ } else {
136
+ t3 = $[7];
137
+ }
138
+ var t4;
139
+ if ($[8] !== Spinner || $[9] !== description || $[10] !== error || $[11] !== handleSubmit || $[12] !== isShared || $[13] !== loading || $[14] !== onClose || $[15] !== sharedLink) {
140
+ t4 = /*#__PURE__*/_jsxs("div", {
141
+ className: "py-2",
142
+ children: [t3, !isShared || (error === null || error === void 0 ? void 0 : error.length) > 0 ? /*#__PURE__*/_jsxs(_Fragment, {
143
+ children: [/*#__PURE__*/_jsx("p", {
144
+ className: "mb-2 mt-3 text-sm text-gray-500 dark:text-gray-300",
145
+ children: "Enter a description (optional)"
146
+ }), /*#__PURE__*/_jsx("textarea", {
147
+ className: "w-full border bg-inherit px-2 py-2 text-sm text-gray-500 dark:text-gray-300",
148
+ value: description,
149
+ onChange: function onChange(e) {
150
+ return setDescription(e.target.value);
151
+ }
152
+ }), /*#__PURE__*/_jsx(Button, {
153
+ variant: "primary",
154
+ className: "mt-4 h-[38px]",
155
+ onClick: function onClick(e_0) {
156
+ e_0.preventDefault();
157
+ handleSubmit();
158
+ },
159
+ disabled: loading || !isFormDataValid(),
160
+ type: "submit",
161
+ children: loading ? /*#__PURE__*/_jsx(Spinner, {
162
+ paddingClasses: "p-0"
163
+ }) : "Share"
164
+ }), error !== "" ? /*#__PURE__*/_jsx("p", {
165
+ children: "Something went wrong please try again"
166
+ }) : null]
167
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
168
+ children: [/*#__PURE__*/_jsx(ResultBox, {
169
+ value: sharedLink,
170
+ className: "mt-4"
171
+ }), /*#__PURE__*/_jsx("div", {
172
+ className: "mt-8 flex justify-center",
173
+ children: /*#__PURE__*/_jsx(Button, {
174
+ variant: "neutral",
175
+ className: "w-fit",
176
+ onClick: onClose,
177
+ children: "Close"
178
+ })
179
+ })]
180
+ })]
181
+ });
182
+ $[8] = Spinner;
183
+ $[9] = description;
184
+ $[10] = error;
185
+ $[11] = handleSubmit;
186
+ $[12] = isShared;
187
+ $[13] = loading;
188
+ $[14] = onClose;
189
+ $[15] = sharedLink;
190
+ $[16] = t4;
191
+ } else {
192
+ t4 = $[16];
193
+ }
194
+ var t5;
195
+ if ($[17] !== isOpen || $[18] !== onClose || $[19] !== t4) {
196
+ t5 = /*#__PURE__*/_jsx(Modal, {
197
+ isOpen: isOpen,
198
+ closeModal: onClose,
199
+ title: "Share Profile",
200
+ className: "w-[420px]",
201
+ children: t4
202
+ });
203
+ $[17] = isOpen;
204
+ $[18] = onClose;
205
+ $[19] = t4;
206
+ $[20] = t5;
207
+ } else {
208
+ t5 = $[20];
209
+ }
210
+ return t5;
56
211
  };
57
- const ShareButton = ({ queryRequest, queryClient, profileSource, onDownloadPProf, pprofdownloading, profileViewExternalSubActions, }) => {
58
- const [showProfileShareModal, setShowProfileShareModal] = useState(false);
59
- const actions = [
60
- {
61
- key: 'shareProfile',
62
- label: 'Share profile via link',
63
- onSelect: () => setShowProfileShareModal(true),
64
- id: 'h-share-profile-button',
65
- disabled: profileSource === undefined && queryClient === undefined && queryRequest === undefined,
66
- icon: 'material-symbols-light:link',
67
- },
68
- {
69
- key: 'downloadProfile',
70
- label: pprofdownloading != null && pprofdownloading ? 'Downloading...' : 'Download as pprof',
71
- onSelect: () => onDownloadPProf(),
72
- id: 'h-download-pprof',
73
- disabled: pprofdownloading,
74
- icon: 'material-symbols:download',
75
- },
76
- ];
77
- return (_jsx(_Fragment, { children: profileViewExternalSubActions != null ? (_jsx(_Fragment, { children: _jsxs(Button, { className: "gap-2", variant: "neutral", onClick: e => {
78
- e.preventDefault();
79
- onDownloadPProf();
80
- }, disabled: pprofdownloading, id: "h-download-pprof", children: [pprofdownloading != null && pprofdownloading ? 'Downloading...' : 'Download pprof', _jsx(Icon, { icon: "material-symbols:download", width: 20 })] }) })) : (_jsxs(_Fragment, { children: [_jsxs(Dropdown, { dropdownWidth: "w-48", element: _jsxs(Button, { variant: "neutral", className: "flex items-center gap-2 pr-[1.7rem]", id: "h-share-dropdown-button", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Icon, { icon: "material-symbols:share", className: "w-4 h-4" }), _jsx("span", { children: "Share" })] }), _jsx("div", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-gray-400", children: _jsx(Icon, { icon: "heroicons:chevron-down-20-solid", "aria-hidden": "true" }) })] }), children: [_jsx("span", { className: "text-xs text-gray-400 capitalize px-2", children: "actions" }), actions.map(item => (_jsx(Dropdown.Item, { onSelect: item.onSelect, children: _jsxs("div", { id: item.id, className: "flex items-center gap-2", children: [_jsx(Icon, { icon: item.icon, className: "h-4 w-4" }), _jsx("span", { children: item.label })] }) }, item.key)))] }), profileSource !== undefined &&
81
- queryClient !== undefined &&
82
- queryRequest !== undefined && (_jsx(ProfileShareModal, { isOpen: showProfileShareModal, closeModal: () => setShowProfileShareModal(false), queryRequest: queryRequest, queryClient: queryClient }))] })) }));
212
+ var ShareButton = function ShareButton(t0) {
213
+ var $ = _c(21);
214
+ var queryRequest = t0.queryRequest,
215
+ queryClient = t0.queryClient,
216
+ profileSource = t0.profileSource,
217
+ onDownloadPProf = t0.onDownloadPProf,
218
+ pprofdownloading = t0.pprofdownloading,
219
+ profileViewExternalSubActions = t0.profileViewExternalSubActions;
220
+ var _useState1 = useState(false),
221
+ _useState10 = _slicedToArray(_useState1, 2),
222
+ showProfileShareModal = _useState10[0],
223
+ setShowProfileShareModal = _useState10[1];
224
+ var t1;
225
+ if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
226
+ t1 = function t1() {
227
+ return setShowProfileShareModal(true);
228
+ };
229
+ $[0] = t1;
230
+ } else {
231
+ t1 = $[0];
232
+ }
233
+ var t2 = profileSource === undefined && queryClient === undefined && queryRequest === undefined;
234
+ var t3;
235
+ if ($[1] !== t2) {
236
+ t3 = {
237
+ key: "shareProfile",
238
+ label: "Share profile via link",
239
+ onSelect: t1,
240
+ id: "h-share-profile-button",
241
+ disabled: t2,
242
+ icon: "material-symbols-light:link"
243
+ };
244
+ $[1] = t2;
245
+ $[2] = t3;
246
+ } else {
247
+ t3 = $[2];
248
+ }
249
+ var t4 = pprofdownloading != null && pprofdownloading ? "Downloading..." : "Download as pprof";
250
+ var t5;
251
+ if ($[3] !== onDownloadPProf) {
252
+ t5 = function t5() {
253
+ return onDownloadPProf();
254
+ };
255
+ $[3] = onDownloadPProf;
256
+ $[4] = t5;
257
+ } else {
258
+ t5 = $[4];
259
+ }
260
+ var t6;
261
+ if ($[5] !== pprofdownloading || $[6] !== t4 || $[7] !== t5) {
262
+ t6 = {
263
+ key: "downloadProfile",
264
+ label: t4,
265
+ onSelect: t5,
266
+ id: "h-download-pprof",
267
+ disabled: pprofdownloading,
268
+ icon: "material-symbols:download"
269
+ };
270
+ $[5] = pprofdownloading;
271
+ $[6] = t4;
272
+ $[7] = t5;
273
+ $[8] = t6;
274
+ } else {
275
+ t6 = $[8];
276
+ }
277
+ var t7;
278
+ if ($[9] !== t3 || $[10] !== t6) {
279
+ t7 = [t3, t6];
280
+ $[9] = t3;
281
+ $[10] = t6;
282
+ $[11] = t7;
283
+ } else {
284
+ t7 = $[11];
285
+ }
286
+ var actions = t7;
287
+ var t8;
288
+ if ($[12] !== actions || $[13] !== onDownloadPProf || $[14] !== pprofdownloading || $[15] !== profileSource || $[16] !== profileViewExternalSubActions || $[17] !== queryClient || $[18] !== queryRequest || $[19] !== showProfileShareModal) {
289
+ t8 = /*#__PURE__*/_jsx(_Fragment, {
290
+ children: profileViewExternalSubActions != null ? /*#__PURE__*/_jsx(_Fragment, {
291
+ children: /*#__PURE__*/_jsxs(Button, {
292
+ className: "gap-2",
293
+ variant: "neutral",
294
+ onClick: function onClick(e) {
295
+ e.preventDefault();
296
+ onDownloadPProf();
297
+ },
298
+ disabled: pprofdownloading,
299
+ id: "h-download-pprof",
300
+ children: [pprofdownloading != null && pprofdownloading ? "Downloading..." : "Download pprof", /*#__PURE__*/_jsx(Icon, {
301
+ icon: "material-symbols:download",
302
+ width: 20
303
+ })]
304
+ })
305
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
306
+ children: [/*#__PURE__*/_jsxs(Dropdown, {
307
+ dropdownWidth: "w-48",
308
+ element: /*#__PURE__*/_jsxs(Button, {
309
+ variant: "neutral",
310
+ className: "flex items-center gap-2 pr-[1.7rem]",
311
+ id: "h-share-dropdown-button",
312
+ children: [/*#__PURE__*/_jsxs("div", {
313
+ className: "flex items-center gap-2",
314
+ children: [/*#__PURE__*/_jsx(Icon, {
315
+ icon: "material-symbols:share",
316
+ className: "w-4 h-4"
317
+ }), /*#__PURE__*/_jsx("span", {
318
+ children: "Share"
319
+ })]
320
+ }), /*#__PURE__*/_jsx("div", {
321
+ className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-gray-400",
322
+ children: /*#__PURE__*/_jsx(Icon, {
323
+ icon: "heroicons:chevron-down-20-solid",
324
+ "aria-hidden": "true"
325
+ })
326
+ })]
327
+ }),
328
+ children: [/*#__PURE__*/_jsx("span", {
329
+ className: "text-xs text-gray-400 capitalize px-2",
330
+ children: "actions"
331
+ }), actions.map(_temp2)]
332
+ }), profileSource !== undefined && queryClient !== undefined && queryRequest !== undefined && /*#__PURE__*/_jsx(ProfileShareModal, {
333
+ isOpen: showProfileShareModal,
334
+ closeModal: function closeModal() {
335
+ return setShowProfileShareModal(false);
336
+ },
337
+ queryRequest: queryRequest,
338
+ queryClient: queryClient
339
+ })]
340
+ })
341
+ });
342
+ $[12] = actions;
343
+ $[13] = onDownloadPProf;
344
+ $[14] = pprofdownloading;
345
+ $[15] = profileSource;
346
+ $[16] = profileViewExternalSubActions;
347
+ $[17] = queryClient;
348
+ $[18] = queryRequest;
349
+ $[19] = showProfileShareModal;
350
+ $[20] = t8;
351
+ } else {
352
+ t8 = $[20];
353
+ }
354
+ return t8;
83
355
  };
84
356
  export default ShareButton;
357
+ function _temp() {
358
+ return true;
359
+ }
360
+ function _temp2(item) {
361
+ return /*#__PURE__*/_jsx(Dropdown.Item, {
362
+ onSelect: item.onSelect,
363
+ children: /*#__PURE__*/_jsxs("div", {
364
+ id: item.id,
365
+ className: "flex items-center gap-2",
366
+ children: [/*#__PURE__*/_jsx(Icon, {
367
+ icon: item.icon,
368
+ className: "h-4 w-4"
369
+ }), /*#__PURE__*/_jsx("span", {
370
+ children: item.label
371
+ })]
372
+ })
373
+ }, item.key);
374
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"MultiLevelDropdown.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAQtE,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAkK1C,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAsPzD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"MultiLevelDropdown.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAQtE,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAmK1C,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAsPzD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}