@parca/profile 0.19.19 → 0.19.21
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/ProfileExplorerCompare.d.ts.map +1 -1
- package/dist/ProfileExplorer/ProfileExplorerCompare.js +1 -3
- package/dist/ProfileExplorer/index.d.ts.map +1 -1
- package/dist/ProfileExplorer/index.js +5 -8
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +0 -2
- package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.d.ts +0 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +2 -11
- package/dist/ProfileFlameGraph/FlameGraphArrow/index.d.ts.map +1 -1
- package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +6 -14
- package/dist/ProfileSelector/useAutoQuerySelector.d.ts.map +1 -1
- package/dist/ProfileSelector/useAutoQuerySelector.js +1 -1
- package/dist/ProfileSource.d.ts +4 -11
- package/dist/ProfileSource.d.ts.map +1 -1
- package/dist/ProfileSource.js +6 -14
- package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -1
- package/dist/ProfileView/components/ColorStackLegend.js +14 -10
- package/dist/ProfileView/components/DashboardItems/index.d.ts +1 -3
- package/dist/ProfileView/components/DashboardItems/index.d.ts.map +1 -1
- package/dist/ProfileView/components/DashboardItems/index.js +2 -2
- package/dist/ProfileView/components/GroupByLabelsDropdown/index.d.ts.map +1 -1
- package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +14 -1
- package/dist/ProfileView/components/InvertCallStack/index.js +1 -1
- package/dist/ProfileView/components/ProfileFilters/index.d.ts +5 -0
- package/dist/ProfileView/components/ProfileFilters/index.d.ts.map +1 -0
- package/dist/ProfileView/components/ProfileFilters/index.js +173 -0
- package/dist/ProfileView/components/ProfileFilters/useProfileFilters.d.ts +17 -0
- package/dist/ProfileView/components/ProfileFilters/useProfileFilters.d.ts.map +1 -0
- package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +209 -0
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts +8 -0
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -0
- package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +87 -0
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +21 -11
- package/dist/ProfileView/components/Toolbars/index.d.ts +0 -5
- package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/index.js +6 -6
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +3 -12
- package/dist/ProfileView/hooks/useVisualizationState.d.ts +0 -3
- package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useVisualizationState.js +0 -7
- package/dist/ProfileView/index.d.ts.map +1 -1
- package/dist/ProfileView/index.js +3 -5
- package/dist/ProfileViewWithData.d.ts.map +1 -1
- package/dist/ProfileViewWithData.js +8 -7
- package/dist/Sandwich/index.d.ts.map +1 -1
- package/dist/Sandwich/index.js +4 -2
- package/dist/Table/index.d.ts +0 -2
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +5 -32
- package/dist/styles.css +1 -1
- package/dist/useQuery.d.ts +1 -1
- package/dist/useQuery.d.ts.map +1 -1
- package/dist/useQuery.js +7 -40
- package/package.json +7 -7
- package/src/ProfileExplorer/ProfileExplorerCompare.tsx +0 -4
- package/src/ProfileExplorer/index.tsx +4 -13
- package/src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx +0 -2
- package/src/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.tsx +1 -14
- package/src/ProfileFlameGraph/FlameGraphArrow/index.tsx +4 -16
- package/src/ProfileSelector/useAutoQuerySelector.ts +1 -2
- package/src/ProfileSource.tsx +6 -49
- package/src/ProfileView/components/ColorStackLegend.tsx +16 -12
- package/src/ProfileView/components/DashboardItems/index.tsx +0 -6
- package/src/ProfileView/components/GroupByLabelsDropdown/index.tsx +15 -2
- package/src/ProfileView/components/InvertCallStack/index.tsx +1 -1
- package/src/ProfileView/components/ProfileFilters/index.tsx +294 -0
- package/src/ProfileView/components/ProfileFilters/useProfileFilters.ts +284 -0
- package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +103 -0
- package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +30 -18
- package/src/ProfileView/components/Toolbars/index.tsx +5 -35
- package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +5 -12
- package/src/ProfileView/hooks/useVisualizationState.ts +0 -11
- package/src/ProfileView/index.tsx +1 -15
- package/src/ProfileViewWithData.tsx +9 -9
- package/src/Sandwich/index.tsx +5 -2
- package/src/Table/index.tsx +3 -44
- package/src/useQuery.tsx +11 -43
- package/dist/ProfileView/components/FilterByFunctionButton.d.ts +0 -3
- package/dist/ProfileView/components/FilterByFunctionButton.d.ts.map +0 -1
- package/dist/ProfileView/components/FilterByFunctionButton.js +0 -89
- package/src/ProfileView/components/FilterByFunctionButton.tsx +0 -128
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Copyright 2022 The Parca Authors
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
15
|
-
import { Icon } from '@iconify/react';
|
|
16
|
-
import { Input, Select, useURLState } from '@parca/components';
|
|
17
|
-
import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
|
|
18
|
-
const FilterByFunctionButton = () => {
|
|
19
|
-
const [highlightAfterFilteringEnabled] = useUserPreference(USER_PREFERENCES.HIGHTLIGHT_AFTER_FILTERING.key);
|
|
20
|
-
const [storeValue, setStoreValue] = useURLState('filter_by_function');
|
|
21
|
-
const [excludeFunctionStoreValue, setExcludeFunctionStoreValue] = useURLState('exclude_function');
|
|
22
|
-
const [excludeFunction, setExcludeFunction] = useState(excludeFunctionStoreValue === 'true');
|
|
23
|
-
const [_, setSearchString] = useURLState('search_string');
|
|
24
|
-
const [localValue, setLocalValue] = useState(storeValue);
|
|
25
|
-
const isClearAction = useMemo(() => {
|
|
26
|
-
return (localValue === storeValue &&
|
|
27
|
-
localValue != null &&
|
|
28
|
-
localValue !== '' &&
|
|
29
|
-
(excludeFunction
|
|
30
|
-
? excludeFunctionStoreValue === 'true'
|
|
31
|
-
: excludeFunctionStoreValue !== 'true'));
|
|
32
|
-
}, [localValue, storeValue, excludeFunction, excludeFunctionStoreValue]);
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (storeValue === undefined) {
|
|
35
|
-
setLocalValue('');
|
|
36
|
-
setExcludeFunction(false);
|
|
37
|
-
}
|
|
38
|
-
}, [storeValue]);
|
|
39
|
-
const onAction = useCallback(() => {
|
|
40
|
-
if (isClearAction) {
|
|
41
|
-
setLocalValue('');
|
|
42
|
-
setStoreValue('');
|
|
43
|
-
setExcludeFunction(false);
|
|
44
|
-
setExcludeFunctionStoreValue('');
|
|
45
|
-
if (highlightAfterFilteringEnabled) {
|
|
46
|
-
setSearchString('');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
setStoreValue(localValue);
|
|
51
|
-
setExcludeFunctionStoreValue(excludeFunction ? 'true' : '');
|
|
52
|
-
if (!excludeFunction && highlightAfterFilteringEnabled) {
|
|
53
|
-
setSearchString(localValue);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
setSearchString('');
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}, [
|
|
60
|
-
localValue,
|
|
61
|
-
isClearAction,
|
|
62
|
-
setStoreValue,
|
|
63
|
-
setExcludeFunctionStoreValue,
|
|
64
|
-
excludeFunction,
|
|
65
|
-
highlightAfterFilteringEnabled,
|
|
66
|
-
setSearchString,
|
|
67
|
-
]);
|
|
68
|
-
const filterModeItems = [
|
|
69
|
-
{
|
|
70
|
-
key: 'include',
|
|
71
|
-
element: {
|
|
72
|
-
active: _jsx(_Fragment, { children: "Contains" }),
|
|
73
|
-
expanded: _jsx(_Fragment, { children: "Contains" }),
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
key: 'exclude',
|
|
78
|
-
element: {
|
|
79
|
-
active: _jsx(_Fragment, { children: "Not Contains" }),
|
|
80
|
-
expanded: _jsx(_Fragment, { children: "Not Contains" }),
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
];
|
|
84
|
-
const handleFilterModeChange = useCallback((key) => {
|
|
85
|
-
setExcludeFunction(key === 'exclude');
|
|
86
|
-
}, []);
|
|
87
|
-
return (_jsxs("div", { className: "relative", children: [_jsx("div", { className: "absolute inset-y-0 left-0 z-10 flex items-center", children: _jsx("div", { className: "h-full", children: _jsx(Select, { items: filterModeItems, selectedKey: excludeFunction ? 'exclude' : 'include', onSelection: handleFilterModeChange, className: "h-full rounded-l-md rounded-r-none w-[148px]" }) }) }), _jsx("div", { className: "flex", children: _jsx(Input, { placeholder: "Filter by function", className: "pl-[152px] text-sm", onAction: onAction, onChange: e => setLocalValue(e.target.value), value: localValue ?? '', onBlur: () => setLocalValue(storeValue), actionIcon: isClearAction ? _jsx(Icon, { icon: "ep:circle-close" }) : _jsx(Icon, { icon: "ep:arrow-right" }), id: "h-filter-by-function" }) })] }));
|
|
88
|
-
};
|
|
89
|
-
export default FilterByFunctionButton;
|
|
@@ -1,128 +0,0 @@
|
|
|
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 {useCallback, useEffect, useMemo, useState} from 'react';
|
|
15
|
-
|
|
16
|
-
import {Icon} from '@iconify/react';
|
|
17
|
-
|
|
18
|
-
import {Input, Select, useURLState, type SelectItem} from '@parca/components';
|
|
19
|
-
import {USER_PREFERENCES, useUserPreference} from '@parca/hooks';
|
|
20
|
-
|
|
21
|
-
const FilterByFunctionButton = (): JSX.Element => {
|
|
22
|
-
const [highlightAfterFilteringEnabled] = useUserPreference<boolean>(
|
|
23
|
-
USER_PREFERENCES.HIGHTLIGHT_AFTER_FILTERING.key
|
|
24
|
-
);
|
|
25
|
-
const [storeValue, setStoreValue] = useURLState('filter_by_function');
|
|
26
|
-
const [excludeFunctionStoreValue, setExcludeFunctionStoreValue] = useURLState('exclude_function');
|
|
27
|
-
const [excludeFunction, setExcludeFunction] = useState(excludeFunctionStoreValue === 'true');
|
|
28
|
-
const [_, setSearchString] = useURLState('search_string');
|
|
29
|
-
const [localValue, setLocalValue] = useState(storeValue as string);
|
|
30
|
-
|
|
31
|
-
const isClearAction = useMemo(() => {
|
|
32
|
-
return (
|
|
33
|
-
localValue === storeValue &&
|
|
34
|
-
localValue != null &&
|
|
35
|
-
localValue !== '' &&
|
|
36
|
-
(excludeFunction
|
|
37
|
-
? excludeFunctionStoreValue === 'true'
|
|
38
|
-
: excludeFunctionStoreValue !== 'true')
|
|
39
|
-
);
|
|
40
|
-
}, [localValue, storeValue, excludeFunction, excludeFunctionStoreValue]);
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (storeValue === undefined) {
|
|
44
|
-
setLocalValue('');
|
|
45
|
-
setExcludeFunction(false);
|
|
46
|
-
}
|
|
47
|
-
}, [storeValue]);
|
|
48
|
-
|
|
49
|
-
const onAction = useCallback((): void => {
|
|
50
|
-
if (isClearAction) {
|
|
51
|
-
setLocalValue('');
|
|
52
|
-
setStoreValue('');
|
|
53
|
-
setExcludeFunction(false);
|
|
54
|
-
setExcludeFunctionStoreValue('');
|
|
55
|
-
if (highlightAfterFilteringEnabled) {
|
|
56
|
-
setSearchString('');
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
setStoreValue(localValue);
|
|
60
|
-
setExcludeFunctionStoreValue(excludeFunction ? 'true' : '');
|
|
61
|
-
if (!excludeFunction && highlightAfterFilteringEnabled) {
|
|
62
|
-
setSearchString(localValue);
|
|
63
|
-
} else {
|
|
64
|
-
setSearchString('');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, [
|
|
68
|
-
localValue,
|
|
69
|
-
isClearAction,
|
|
70
|
-
setStoreValue,
|
|
71
|
-
setExcludeFunctionStoreValue,
|
|
72
|
-
excludeFunction,
|
|
73
|
-
highlightAfterFilteringEnabled,
|
|
74
|
-
setSearchString,
|
|
75
|
-
]);
|
|
76
|
-
|
|
77
|
-
const filterModeItems: SelectItem[] = [
|
|
78
|
-
{
|
|
79
|
-
key: 'include',
|
|
80
|
-
element: {
|
|
81
|
-
active: <>Contains</>,
|
|
82
|
-
expanded: <>Contains</>,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
key: 'exclude',
|
|
87
|
-
element: {
|
|
88
|
-
active: <>Not Contains</>,
|
|
89
|
-
expanded: <>Not Contains</>,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
];
|
|
93
|
-
|
|
94
|
-
const handleFilterModeChange = useCallback((key: string): void => {
|
|
95
|
-
setExcludeFunction(key === 'exclude');
|
|
96
|
-
}, []);
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<div className="relative">
|
|
100
|
-
<div className="absolute inset-y-0 left-0 z-10 flex items-center">
|
|
101
|
-
<div className="h-full">
|
|
102
|
-
<Select
|
|
103
|
-
items={filterModeItems}
|
|
104
|
-
selectedKey={excludeFunction ? 'exclude' : 'include'}
|
|
105
|
-
onSelection={handleFilterModeChange}
|
|
106
|
-
className="h-full rounded-l-md rounded-r-none w-[148px]"
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
<div className="flex">
|
|
111
|
-
<Input
|
|
112
|
-
placeholder="Filter by function"
|
|
113
|
-
className="pl-[152px] text-sm"
|
|
114
|
-
onAction={onAction}
|
|
115
|
-
onChange={e => setLocalValue(e.target.value)}
|
|
116
|
-
value={localValue ?? ''}
|
|
117
|
-
onBlur={() => setLocalValue(storeValue as string)}
|
|
118
|
-
actionIcon={
|
|
119
|
-
isClearAction ? <Icon icon="ep:circle-close" /> : <Icon icon="ep:arrow-right" />
|
|
120
|
-
}
|
|
121
|
-
id="h-filter-by-function"
|
|
122
|
-
/>
|
|
123
|
-
</div>
|
|
124
|
-
</div>
|
|
125
|
-
);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
export default FilterByFunctionButton;
|