@parca/profile 0.19.0 → 0.19.2
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/ProfileExplorer/index.d.ts.map +1 -1
- package/dist/ProfileExplorer/index.js +16 -0
- package/dist/ProfileSelector/QueryControls.d.ts.map +1 -1
- package/dist/ProfileSelector/QueryControls.js +1 -1
- package/dist/ProfileView/components/FilterByFunctionButton.d.ts.map +1 -1
- package/dist/ProfileView/components/FilterByFunctionButton.js +7 -1
- package/dist/ProfileView/hooks/useResetStateOnNewSearch.d.ts +2 -0
- package/dist/ProfileView/hooks/useResetStateOnNewSearch.d.ts.map +1 -0
- package/dist/ProfileView/hooks/useResetStateOnNewSearch.js +21 -0
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts +2 -0
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -0
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +29 -0
- package/dist/SimpleMatchers/index.d.ts.map +1 -1
- package/dist/SimpleMatchers/index.js +18 -4
- package/dist/Table/MoreDropdown.js +1 -1
- package/package.json +2 -2
- package/src/ProfileExplorer/index.tsx +17 -0
- package/src/ProfileSelector/QueryControls.tsx +1 -0
- package/src/ProfileView/components/FilterByFunctionButton.tsx +8 -1
- package/src/ProfileView/hooks/useResetStateOnNewSearch.ts +24 -0
- package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +32 -0
- package/src/SimpleMatchers/index.tsx +20 -4
- package/src/Table/MoreDropdown.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.19.2 (2025-06-19)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
## [0.19.1](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.0...@parca/profile@0.19.1) (2025-06-18)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @parca/profile
|
|
13
|
+
|
|
6
14
|
# [0.19.0](https://github.com/parca-dev/parca/compare/@parca/profile@0.18.4...@parca/profile@0.19.0) (2025-06-18)
|
|
7
15
|
|
|
8
16
|
### Features
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileExplorer/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ProfileExplorer/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAIjD,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAU1B,UAAU,oBAAoB;IAC5B,WAAW,EAAE,kBAAkB,CAAC;IAChC,WAAW,EAAE,GAAG,CAAC;IACjB,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAaD,eAAO,MAAM,sBAAsB,eAAgB,MAAM,GAAG,EAAE,KAAG,MAGhE,CAAC;AAiXF,QAAA,MAAM,eAAe,8CAIlB,oBAAoB,KAAG,GAAG,CAAC,OAkB7B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -14,10 +14,13 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
14
14
|
import { useEffect, useMemo, useState } from 'react';
|
|
15
15
|
import { Provider } from 'react-redux';
|
|
16
16
|
import { DateTimeRange, KeyDownProvider, useParcaContext } from '@parca/components';
|
|
17
|
+
import { Query } from '@parca/parser';
|
|
17
18
|
import { createStore } from '@parca/store';
|
|
18
19
|
import { capitalizeOnlyFirstLetter, decodeMultipleEncodings, isUrlEncoded, } from '@parca/utilities';
|
|
19
20
|
import { ProfileSelectionFromParams, SuffixParams } from '..';
|
|
20
21
|
import { useProfileTypes } from '../ProfileSelector';
|
|
22
|
+
import { useResetStateOnNewSearch } from '../ProfileView/hooks/useResetStateOnNewSearch';
|
|
23
|
+
import { useResetStateOnProfileTypeChange } from '../ProfileView/hooks/useResetStateOnProfileTypeChange';
|
|
21
24
|
import { sumByToParam, useSumByFromParams } from '../useSumBy';
|
|
22
25
|
import ProfileExplorerCompare from './ProfileExplorerCompare';
|
|
23
26
|
import ProfileExplorerSingle from './ProfileExplorerSingle';
|
|
@@ -93,6 +96,8 @@ const ProfileExplorerApp = ({ queryClient, queryParams, navigateTo, }) => {
|
|
|
93
96
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
94
97
|
const [profileA, setProfileA] = useState(null);
|
|
95
98
|
const [profileB, setProfileB] = useState(null);
|
|
99
|
+
const resetStateOnProfileTypeChange = useResetStateOnProfileTypeChange();
|
|
100
|
+
const resetStateOnNewSearch = useResetStateOnNewSearch();
|
|
96
101
|
const sumByA = useSumByFromParams(sum_by_a);
|
|
97
102
|
const sumByB = useSumByFromParams(sum_by_b);
|
|
98
103
|
useEffect(() => {
|
|
@@ -151,6 +156,17 @@ const ProfileExplorerApp = ({ queryClient, queryParams, navigateTo, }) => {
|
|
|
151
156
|
// Show the SingleProfileExplorer when not comparing
|
|
152
157
|
if (compare_a !== 'true' && compare_b !== 'true') {
|
|
153
158
|
const selectQuery = (q) => {
|
|
159
|
+
const profileNameAfter = Query.parse(q.expression).profileName();
|
|
160
|
+
if (profileA != null) {
|
|
161
|
+
if (profileA.ProfileName() !== profileNameAfter) {
|
|
162
|
+
// Reset required state when the profile type changes.
|
|
163
|
+
resetStateOnProfileTypeChange();
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
// Reset the state when a new search is performed.
|
|
167
|
+
resetStateOnNewSearch();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
154
170
|
const mergeParams = q.mergeFrom !== undefined && q.mergeTo !== undefined
|
|
155
171
|
? {
|
|
156
172
|
merge_from_a: q.mergeFrom,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryControls.d.ts","sourceRoot":"","sources":["../../src/ProfileSelector/QueryControls.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAClD,OAAe,EAAC,KAAK,cAAc,EAAC,MAAM,cAAc,CAAC;AAEzD,OAAO,EAAC,oBAAoB,EAAE,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACvE,OAAO,EAAS,aAAa,EAAsB,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAC,WAAW,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAYjD,UAAU,kBAAkB;IAC1B,uBAAuB,EAAE,OAAO,CAAC;IACjC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,0BAA0B,EAAE,OAAO,CAAC;IACpC,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACnD,iBAAiB,CAAC,EAAE,QAAQ,CAAC;IAC7B,aAAa,CAAC,EAAE;QACd,2BAA2B,CAAC,EAAE,OAAO,CAAC;QACtC,0BAA0B,CAAC,EAAE,OAAO,CAAC;QACrC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;KACvC,CAAC;IACF,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,2BAA2B,EAAE,OAAO,CAAC;IACrC,8BAA8B,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,iBAAiB,EAAE,CAAC,QAAQ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,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,kBAAkB,CAAC;IAChC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACjD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,wBAAgB,aAAa,CAAC,EAC5B,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,2BAA2B,EAC3B,8BAA8B,EAC9B,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,WAAW,EACX,MAAM,EACN,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,iBAAiB,GAClB,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAkJlC"}
|
|
@@ -24,7 +24,7 @@ export function QueryControls({ showProfileTypeSelector, profileTypesData, profi
|
|
|
24
24
|
setQueryBrowserMode(advancedModeForQueryBrowser ? 'simple' : 'advanced');
|
|
25
25
|
}, className: `${advancedModeForQueryBrowser ? 'bg-indigo-600' : 'bg-gray-400 dark:bg-gray-800'} relative inline-flex h-[20px] w-[44px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white/75`, children: [_jsx("span", { className: "sr-only", children: "Use setting" }), _jsx("span", { "aria-hidden": "true", className: `${advancedModeForQueryBrowser ? 'translate-x-6' : 'translate-x-0'} pointer-events-none inline-block h-[16px] w-[16px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out` })] }), _jsx("label", { className: "text-xs", children: "Advanced Mode" })] }))] }), viewComponent?.createViewComponent] }), viewComponent?.disableExplorativeQuerying === true &&
|
|
26
26
|
viewComponent?.labelnames !== undefined &&
|
|
27
|
-
viewComponent?.labelnames.length >= 1 ? (_jsx(ViewMatchers, { labelNames: viewComponent.labelnames, setMatchersString: setMatchersString, profileType: selectedProfileName, runQuery: setQueryExpression, currentQuery: query, queryClient: queryClient })) : advancedModeForQueryBrowser ? (_jsx(MatchersInput, { setMatchersString: setMatchersString, runQuery: setQueryExpression, currentQuery: query, profileType: selectedProfileName, queryClient: queryClient })) : (_jsx(SimpleMatchers, { setMatchersString: setMatchersString, runQuery: setQueryExpression, currentQuery: query, profileType: selectedProfileName, queryBrowserRef: queryBrowserRef, queryClient: queryClient }))] }), showSumBySelector && (_jsxs("div", { children: [_jsx("div", { className: "mb-0.5 mt-1.5 flex items-center justify-between", children: _jsx("label", { className: "text-xs", children: "Sum by" }) }), _jsx(Select, { id: "h-sum-by-selector", defaultValue: [], isMulti: true, name: "colors", options: labels.map(label => ({ label, value: label })), className: "parca-select-container text-sm w-full max-w-80", classNamePrefix: "parca-select", value: (sumBySelection ?? []).map(sumBy => ({ label: sumBy, value: sumBy })), onChange: newValue => {
|
|
27
|
+
viewComponent?.labelnames.length >= 1 ? (_jsx(ViewMatchers, { labelNames: viewComponent.labelnames, setMatchersString: setMatchersString, profileType: selectedProfileName, runQuery: setQueryExpression, currentQuery: query, queryClient: queryClient })) : advancedModeForQueryBrowser ? (_jsx(MatchersInput, { setMatchersString: setMatchersString, runQuery: setQueryExpression, currentQuery: query, profileType: selectedProfileName, queryClient: queryClient })) : (_jsx(SimpleMatchers, { setMatchersString: setMatchersString, runQuery: setQueryExpression, currentQuery: query, profileType: selectedProfileName, queryBrowserRef: queryBrowserRef, queryClient: queryClient }, query.toString()))] }), showSumBySelector && (_jsxs("div", { children: [_jsx("div", { className: "mb-0.5 mt-1.5 flex items-center justify-between", children: _jsx("label", { className: "text-xs", children: "Sum by" }) }), _jsx(Select, { id: "h-sum-by-selector", defaultValue: [], isMulti: true, name: "colors", options: labels.map(label => ({ label, value: label })), className: "parca-select-container text-sm w-full max-w-80", classNamePrefix: "parca-select", value: (sumBySelection ?? []).map(sumBy => ({ label: sumBy, value: sumBy })), onChange: newValue => {
|
|
28
28
|
setUserSumBySelection(newValue.map(option => option.value));
|
|
29
29
|
}, placeholder: "Labels...", styles: {
|
|
30
30
|
indicatorSeparator: () => ({ display: 'none' }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterByFunctionButton.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/components/FilterByFunctionButton.tsx"],"names":[],"mappings":"AAoBA,QAAA,MAAM,sBAAsB,QAAO,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"FilterByFunctionButton.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/components/FilterByFunctionButton.tsx"],"names":[],"mappings":"AAoBA,QAAA,MAAM,sBAAsB,QAAO,GAAG,CAAC,OAyGtC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
14
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
15
15
|
import { Icon } from '@iconify/react';
|
|
16
16
|
import { Input, Select, useURLState } from '@parca/components';
|
|
17
17
|
import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
|
|
@@ -30,6 +30,12 @@ const FilterByFunctionButton = () => {
|
|
|
30
30
|
? excludeFunctionStoreValue === 'true'
|
|
31
31
|
: excludeFunctionStoreValue !== 'true'));
|
|
32
32
|
}, [localValue, storeValue, excludeFunction, excludeFunctionStoreValue]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (storeValue === undefined) {
|
|
35
|
+
setLocalValue('');
|
|
36
|
+
setExcludeFunction(false);
|
|
37
|
+
}
|
|
38
|
+
}, [storeValue]);
|
|
33
39
|
const onAction = useCallback(() => {
|
|
34
40
|
if (isClearAction) {
|
|
35
41
|
setLocalValue('');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResetStateOnNewSearch.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/hooks/useResetStateOnNewSearch.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,wBAAwB,QAAO,CAAC,MAAM,IAAI,CAQtD,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// 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.
|
|
13
|
+
import { useURLState } from '@parca/components';
|
|
14
|
+
export const useResetStateOnNewSearch = () => {
|
|
15
|
+
const [, setCurPath] = useURLState('cur_path');
|
|
16
|
+
return () => {
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
setCurPath(undefined);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResetStateOnProfileTypeChange.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gCAAgC,QAAO,CAAC,MAAM,IAAI,CAgB9D,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// 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.
|
|
13
|
+
import { useURLState } from '@parca/components';
|
|
14
|
+
export const useResetStateOnProfileTypeChange = () => {
|
|
15
|
+
const [, setGroupBy] = useURLState('group_by');
|
|
16
|
+
const [, setFilterByFunction] = useURLState('filter_by_function');
|
|
17
|
+
const [, setExcludeFunction] = useURLState('exclude_function');
|
|
18
|
+
const [, setSearchString] = useURLState('search_string');
|
|
19
|
+
const [, setCurPath] = useURLState('cur_path');
|
|
20
|
+
return () => {
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
setGroupBy(undefined);
|
|
23
|
+
setFilterByFunction(undefined);
|
|
24
|
+
setExcludeFunction(undefined);
|
|
25
|
+
setSearchString(undefined);
|
|
26
|
+
setCurPath(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SimpleMatchers/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAKpC,OAAe,EAAC,KAAK,UAAU,EAAC,MAAM,UAAU,CAAC;AAEjD,UAAU,KAAK;IACb,WAAW,EAAE,kBAAkB,CAAC;IAChC,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,EAAE,KAAK,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;CAClD;AAoBD,eAAO,MAAM,wBAAwB,eAAgB,MAAM,EAAE,KAAG,UAAU,EAQzE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/SimpleMatchers/index.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAKpC,OAAe,EAAC,KAAK,UAAU,EAAC,MAAM,UAAU,CAAC;AAEjD,UAAU,KAAK;IACb,WAAW,EAAE,kBAAkB,CAAC;IAChC,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,EAAE,KAAK,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;CAClD;AAoBD,eAAO,MAAM,wBAAwB,eAAgB,MAAM,EAAE,KAAG,UAAU,EAQzE,CAAC;AAwVF,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAkB3E"}
|
|
@@ -119,8 +119,17 @@ const SimpleMatchers = ({ queryClient, setMatchersString, currentQuery, profileT
|
|
|
119
119
|
}, [fetchLabelValues, fetchLabelValuesUtilization, labelNameOptions]);
|
|
120
120
|
useEffect(() => {
|
|
121
121
|
if (currentMatchers === '') {
|
|
122
|
+
const defaultRow = {
|
|
123
|
+
labelName: '',
|
|
124
|
+
operator: '=',
|
|
125
|
+
labelValue: '',
|
|
126
|
+
labelValues: [],
|
|
127
|
+
isLoading: false,
|
|
128
|
+
};
|
|
129
|
+
setQueryRows([defaultRow]);
|
|
122
130
|
return;
|
|
123
131
|
}
|
|
132
|
+
let isCancelled = false;
|
|
124
133
|
const fetchAndSetQueryRows = async () => {
|
|
125
134
|
const newRows = await Promise.all(currentMatchers.split(',').map(async (matcher) => {
|
|
126
135
|
const match = matcher.match(/([^=!~]+)([=!~]{1,2})(.+)/);
|
|
@@ -139,14 +148,19 @@ const SimpleMatchers = ({ queryClient, setMatchersString, currentQuery, profileT
|
|
|
139
148
|
operator,
|
|
140
149
|
labelValue: sanitizedLabelValue,
|
|
141
150
|
labelValues,
|
|
151
|
+
isLoading: false,
|
|
142
152
|
};
|
|
143
153
|
}));
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
154
|
+
if (!isCancelled) {
|
|
155
|
+
const filteredRows = newRows.filter((row) => row !== null);
|
|
156
|
+
setQueryRows(filteredRows);
|
|
157
|
+
}
|
|
147
158
|
};
|
|
148
159
|
void fetchAndSetQueryRows();
|
|
149
|
-
|
|
160
|
+
return () => {
|
|
161
|
+
isCancelled = true;
|
|
162
|
+
};
|
|
163
|
+
}, [currentMatchers, fetchLabelValuesUnified]);
|
|
150
164
|
const updateRow = useCallback(async (index, field, value) => {
|
|
151
165
|
const updatedRows = [...queryRows];
|
|
152
166
|
const prevLabelName = updatedRows[index].labelName;
|
|
@@ -30,7 +30,7 @@ const MoreDropdown = ({ functionName }) => {
|
|
|
30
30
|
action: () => onSandwichViewSelect(),
|
|
31
31
|
},
|
|
32
32
|
];
|
|
33
|
-
return (_jsx("div", { children: _jsx(Menu, { children: ({ open, close }) => (_jsxs(_Fragment, { children: [_jsx(Menu.Button, { onClick: () => {
|
|
33
|
+
return (_jsx("div", { className: "relative", children: _jsx(Menu, { children: ({ open, close }) => (_jsxs(_Fragment, { children: [_jsx(Menu.Button, { onClick: () => {
|
|
34
34
|
if (open) {
|
|
35
35
|
close();
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@headlessui/react": "^1.7.19",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"access": "public",
|
|
78
78
|
"registry": "https://registry.npmjs.org/"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "a921a622ad49debb9ed7279b98d23938cd06cab4"
|
|
81
81
|
}
|
|
@@ -17,6 +17,7 @@ import {Provider} from 'react-redux';
|
|
|
17
17
|
|
|
18
18
|
import {QueryServiceClient} from '@parca/client';
|
|
19
19
|
import {DateTimeRange, KeyDownProvider, useParcaContext} from '@parca/components';
|
|
20
|
+
import {Query} from '@parca/parser';
|
|
20
21
|
import {createStore} from '@parca/store';
|
|
21
22
|
import {
|
|
22
23
|
capitalizeOnlyFirstLetter,
|
|
@@ -27,6 +28,8 @@ import {
|
|
|
27
28
|
|
|
28
29
|
import {ProfileSelection, ProfileSelectionFromParams, SuffixParams} from '..';
|
|
29
30
|
import {QuerySelection, useProfileTypes} from '../ProfileSelector';
|
|
31
|
+
import {useResetStateOnNewSearch} from '../ProfileView/hooks/useResetStateOnNewSearch';
|
|
32
|
+
import {useResetStateOnProfileTypeChange} from '../ProfileView/hooks/useResetStateOnProfileTypeChange';
|
|
30
33
|
import {sumByToParam, useSumByFromParams} from '../useSumBy';
|
|
31
34
|
import ProfileExplorerCompare from './ProfileExplorerCompare';
|
|
32
35
|
import ProfileExplorerSingle from './ProfileExplorerSingle';
|
|
@@ -173,6 +176,9 @@ const ProfileExplorerApp = ({
|
|
|
173
176
|
const [profileA, setProfileA] = useState<ProfileSelection | null>(null);
|
|
174
177
|
const [profileB, setProfileB] = useState<ProfileSelection | null>(null);
|
|
175
178
|
|
|
179
|
+
const resetStateOnProfileTypeChange = useResetStateOnProfileTypeChange();
|
|
180
|
+
const resetStateOnNewSearch = useResetStateOnNewSearch();
|
|
181
|
+
|
|
176
182
|
const sumByA = useSumByFromParams(sum_by_a);
|
|
177
183
|
const sumByB = useSumByFromParams(sum_by_b);
|
|
178
184
|
|
|
@@ -258,6 +264,17 @@ const ProfileExplorerApp = ({
|
|
|
258
264
|
// Show the SingleProfileExplorer when not comparing
|
|
259
265
|
if (compare_a !== 'true' && compare_b !== 'true') {
|
|
260
266
|
const selectQuery = (q: QuerySelection): void => {
|
|
267
|
+
const profileNameAfter = Query.parse(q.expression).profileName();
|
|
268
|
+
if (profileA != null) {
|
|
269
|
+
if (profileA.ProfileName() !== profileNameAfter) {
|
|
270
|
+
// Reset required state when the profile type changes.
|
|
271
|
+
resetStateOnProfileTypeChange();
|
|
272
|
+
} else {
|
|
273
|
+
// Reset the state when a new search is performed.
|
|
274
|
+
resetStateOnNewSearch();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
261
278
|
const mergeParams =
|
|
262
279
|
q.mergeFrom !== undefined && q.mergeTo !== undefined
|
|
263
280
|
? {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
|
|
14
|
-
import {useCallback, useMemo, useState} from 'react';
|
|
14
|
+
import {useCallback, useEffect, useMemo, useState} from 'react';
|
|
15
15
|
|
|
16
16
|
import {Icon} from '@iconify/react';
|
|
17
17
|
|
|
@@ -39,6 +39,13 @@ const FilterByFunctionButton = (): JSX.Element => {
|
|
|
39
39
|
);
|
|
40
40
|
}, [localValue, storeValue, excludeFunction, excludeFunctionStoreValue]);
|
|
41
41
|
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (storeValue === undefined) {
|
|
44
|
+
setLocalValue('');
|
|
45
|
+
setExcludeFunction(false);
|
|
46
|
+
}
|
|
47
|
+
}, [storeValue]);
|
|
48
|
+
|
|
42
49
|
const onAction = useCallback((): void => {
|
|
43
50
|
if (isClearAction) {
|
|
44
51
|
setLocalValue('');
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// 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.
|
|
13
|
+
|
|
14
|
+
import {useURLState} from '@parca/components';
|
|
15
|
+
|
|
16
|
+
export const useResetStateOnNewSearch = (): (() => void) => {
|
|
17
|
+
const [, setCurPath] = useURLState('cur_path');
|
|
18
|
+
|
|
19
|
+
return () => {
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
setCurPath(undefined);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// 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.
|
|
13
|
+
|
|
14
|
+
import {useURLState} from '@parca/components';
|
|
15
|
+
|
|
16
|
+
export const useResetStateOnProfileTypeChange = (): (() => void) => {
|
|
17
|
+
const [, setGroupBy] = useURLState('group_by');
|
|
18
|
+
const [, setFilterByFunction] = useURLState('filter_by_function');
|
|
19
|
+
const [, setExcludeFunction] = useURLState('exclude_function');
|
|
20
|
+
const [, setSearchString] = useURLState('search_string');
|
|
21
|
+
const [, setCurPath] = useURLState('cur_path');
|
|
22
|
+
|
|
23
|
+
return () => {
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
setGroupBy(undefined);
|
|
26
|
+
setFilterByFunction(undefined);
|
|
27
|
+
setExcludeFunction(undefined);
|
|
28
|
+
setSearchString(undefined);
|
|
29
|
+
setCurPath(undefined);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -198,9 +198,19 @@ const SimpleMatchers = ({
|
|
|
198
198
|
|
|
199
199
|
useEffect(() => {
|
|
200
200
|
if (currentMatchers === '') {
|
|
201
|
+
const defaultRow = {
|
|
202
|
+
labelName: '',
|
|
203
|
+
operator: '=',
|
|
204
|
+
labelValue: '',
|
|
205
|
+
labelValues: [],
|
|
206
|
+
isLoading: false,
|
|
207
|
+
};
|
|
208
|
+
setQueryRows([defaultRow]);
|
|
201
209
|
return;
|
|
202
210
|
}
|
|
203
211
|
|
|
212
|
+
let isCancelled = false;
|
|
213
|
+
|
|
204
214
|
const fetchAndSetQueryRows = async (): Promise<void> => {
|
|
205
215
|
const newRows = await Promise.all(
|
|
206
216
|
currentMatchers.split(',').map(async matcher => {
|
|
@@ -222,17 +232,23 @@ const SimpleMatchers = ({
|
|
|
222
232
|
operator,
|
|
223
233
|
labelValue: sanitizedLabelValue,
|
|
224
234
|
labelValues,
|
|
235
|
+
isLoading: false,
|
|
225
236
|
};
|
|
226
237
|
})
|
|
227
238
|
);
|
|
228
239
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
240
|
+
if (!isCancelled) {
|
|
241
|
+
const filteredRows = newRows.filter((row): row is QueryRow => row !== null);
|
|
242
|
+
setQueryRows(filteredRows);
|
|
243
|
+
}
|
|
232
244
|
};
|
|
233
245
|
|
|
234
246
|
void fetchAndSetQueryRows();
|
|
235
|
-
|
|
247
|
+
|
|
248
|
+
return () => {
|
|
249
|
+
isCancelled = true;
|
|
250
|
+
};
|
|
251
|
+
}, [currentMatchers, fetchLabelValuesUnified]);
|
|
236
252
|
|
|
237
253
|
const updateRow = useCallback(
|
|
238
254
|
async (index: number, field: keyof QueryRow, value: string): Promise<void> => {
|