@parca/profile 0.19.6 → 0.19.8
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 +1 -0
- package/dist/ProfileExplorer/index.d.ts.map +1 -1
- package/dist/ProfileExplorer/index.js +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.d.ts.map +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.js +1 -1
- package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
- package/dist/ProfileView/components/Toolbars/index.js +1 -1
- package/dist/ProfileView/hooks/useResetStateOnNewSearch.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetStateOnNewSearch.js +4 -1
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -1
- package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +20 -10
- package/package.json +2 -2
- package/src/ProfileExplorer/index.test.ts +97 -0
- package/src/ProfileExplorer/index.tsx +1 -1
- package/src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx +1 -0
- package/src/ProfileView/components/Toolbars/index.tsx +1 -0
- package/src/ProfileView/hooks/useResetStateOnNewSearch.ts +4 -1
- package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +20 -10
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.8](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.7...@parca/profile@0.19.8) (2025-06-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
## [0.19.7](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.6...@parca/profile@0.19.7) (2025-06-24)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @parca/profile
|
|
13
|
+
|
|
6
14
|
## [0.19.6](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.5...@parca/profile@0.19.6) (2025-06-23)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @parca/profile
|
|
@@ -6,6 +6,7 @@ interface ProfileExplorerProps {
|
|
|
6
6
|
navigateTo: NavigateFunction;
|
|
7
7
|
}
|
|
8
8
|
export declare const getExpressionAsAString: (expression: string | []) => string;
|
|
9
|
+
export declare const filterEmptyParams: (o: Record<string, any>) => Record<string, any>;
|
|
9
10
|
declare const ProfileExplorer: ({ queryClient, queryParams, navigateTo, }: ProfileExplorerProps) => JSX.Element;
|
|
10
11
|
export default ProfileExplorer;
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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;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;
|
|
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;AAiBF,eAAO,MAAM,iBAAiB,MAAO,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAiB5E,CAAC;AA+UF,QAAA,MAAM,eAAe,8CAIlB,oBAAoB,KAAG,GAAG,CAAC,OAkB7B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -41,7 +41,7 @@ const sanitizeDateRange = (time_selection_a, from_a, to_a) => {
|
|
|
41
41
|
return { time_selection_a: range.getRangeKey(), from_a, to_a };
|
|
42
42
|
};
|
|
43
43
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
44
|
-
const filterEmptyParams = (o) => {
|
|
44
|
+
export const filterEmptyParams = (o) => {
|
|
45
45
|
return Object.fromEntries(Object.entries(o)
|
|
46
46
|
.filter(([_, value]) => value !== '' && value !== undefined && (Array.isArray(value) ? value.length > 0 : true))
|
|
47
47
|
.map(([key, value]) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IcicleGraphNodes.d.ts","sourceRoot":"","sources":["../../../src/ProfileIcicleGraph/IcicleGraphArrow/IcicleGraphNodes.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAgB,MAAM,OAAO,CAAC;AAErC,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AAMnC,OAAO,yCAAyC,CAAC;AAIjD,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAgBlD,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC,GAAG,C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vB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CACnD;AAED,eAAO,MAAM,gBAAgB;;;CAG5B,CAAC;AACF,eAAO,MAAM,qBAAqB;;;;CAIjC,CAAC;AAEF,eAAO,MAAM,UAAU,6CA2MrB,CAAC"}
|
|
@@ -129,7 +129,7 @@ export const IcicleNode = React.memo(function IcicleNodeNoMemo({ table, row, col
|
|
|
129
129
|
return depth * height;
|
|
130
130
|
};
|
|
131
131
|
const y = calculateY(isFlamegraph, isSandwich, isIcicleChart, maxDepth, depth, height);
|
|
132
|
-
return (_jsx(_Fragment, { children: _jsxs("g", { transform: `translate(${x + 1}, ${y + 1})`, style: styles, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: onClick, onContextMenu: handleContextMenu, children: [_jsx("rect", { x: 0, y: 0, width: width, height: height, style: {
|
|
132
|
+
return (_jsx(_Fragment, { children: _jsxs("g", { id: row === 0 ? 'root-span' : undefined, transform: `translate(${x + 1}, ${y + 1})`, style: styles, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: onClick, onContextMenu: handleContextMenu, children: [_jsx("rect", { x: 0, y: 0, width: width, height: height, style: {
|
|
133
133
|
fill: colorResult,
|
|
134
134
|
}, className: cx(shouldBeHighlighted
|
|
135
135
|
? `${colorForSimilarNodes} stroke-[3] [stroke-dasharray:6,4] [stroke-linecap:round] [stroke-linejoin:round] h-6`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/Toolbars/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAIzB,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oDAAoD,CAAC;AACpF,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AASrD,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,aAAa,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;IAClD,WAA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,EAAE,MAAM,CAAC;IAC9B,uBAAuB,EAAE,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC5E,yBAAyB,EAAE,MAAM,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,aAAa,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAC;CACnD;AAED,MAAM,WAAW,+BAA+B;IAC9C,yBAAyB,EAAE,MAAM,IAAI,CAAC;IACtC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAwB9C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAiB1D,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,EAAE,CAAC,+BAA+B,CAmB1E,CAAC;AAMF,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CA8F9D,CAAC"}
|
|
@@ -12,7 +12,7 @@ export const TableToolbar = ({ profileType, total, filtered, clearSelection, cur
|
|
|
12
12
|
return (_jsx(_Fragment, { children: _jsxs("div", { className: "flex w-full gap-2 items-end", children: [_jsx(TableColumnsDropdown, { profileType: profileType, total: total, filtered: filtered }), _jsx(Button, { color: "neutral", onClick: clearSelection, className: "w-auto", variant: "neutral", disabled: currentSearchString === undefined || currentSearchString.length === 0, children: "Clear selection" })] }) }));
|
|
13
13
|
};
|
|
14
14
|
export const IcicleGraphToolbar = ({ curPath, setNewCurPath }) => {
|
|
15
|
-
return (_jsx(_Fragment, { children: _jsx("div", { className: "flex w-full gap-2 items-end", children: _jsxs(Button, { variant: "neutral", className: "gap-2 w-max h-fit", onClick: () => setNewCurPath([]), disabled: curPath.length === 0, children: ["Reset graph", _jsx(Icon, { icon: "system-uicons:reset", width: 20 })] }) }) }));
|
|
15
|
+
return (_jsx(_Fragment, { children: _jsx("div", { className: "flex w-full gap-2 items-end", children: _jsxs(Button, { variant: "neutral", className: "gap-2 w-max h-fit", onClick: () => setNewCurPath([]), disabled: curPath.length === 0, id: "h-reset-graph", children: ["Reset graph", _jsx(Icon, { icon: "system-uicons:reset", width: 20 })] }) }) }));
|
|
16
16
|
};
|
|
17
17
|
export const SandwichIcicleGraphToolbar = ({ resetSandwichFunctionName, sandwichFunctionName, }) => {
|
|
18
18
|
return (_jsx(_Fragment, { children: _jsx("div", { className: "flex w-full gap-2 items-end justify-between", children: _jsx(Button, { color: "neutral", onClick: () => resetSandwichFunctionName(), className: "w-auto", variant: "neutral", disabled: sandwichFunctionName === undefined || sandwichFunctionName.length === 0, children: "Reset view" }) }) }));
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"useResetStateOnNewSearch.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/hooks/useResetStateOnNewSearch.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,wBAAwB,QAAO,CAAC,MAAM,IAAI,CAWtD,CAAC"}
|
|
@@ -12,9 +12,12 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { useURLState } from '@parca/components';
|
|
14
14
|
export const useResetStateOnNewSearch = () => {
|
|
15
|
-
const [, setCurPath] = useURLState('cur_path');
|
|
15
|
+
const [val, setCurPath] = useURLState('cur_path');
|
|
16
16
|
return () => {
|
|
17
17
|
setTimeout(() => {
|
|
18
|
+
if (val === undefined) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
18
21
|
setCurPath(undefined);
|
|
19
22
|
});
|
|
20
23
|
};
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"useResetStateOnProfileTypeChange.d.ts","sourceRoot":"","sources":["../../../src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gCAAgC,QAAO,CAAC,MAAM,IAAI,CA0B9D,CAAC"}
|
|
@@ -12,18 +12,28 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { useURLState } from '@parca/components';
|
|
14
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');
|
|
15
|
+
const [groupBy, setGroupBy] = useURLState('group_by');
|
|
16
|
+
const [filterByFunction, setFilterByFunction] = useURLState('filter_by_function');
|
|
17
|
+
const [excludeFunction, setExcludeFunction] = useURLState('exclude_function');
|
|
18
|
+
const [searchString, setSearchString] = useURLState('search_string');
|
|
19
|
+
const [curPath, setCurPath] = useURLState('cur_path');
|
|
20
20
|
return () => {
|
|
21
21
|
setTimeout(() => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
if (groupBy !== undefined) {
|
|
23
|
+
setGroupBy(undefined);
|
|
24
|
+
}
|
|
25
|
+
if (filterByFunction !== undefined) {
|
|
26
|
+
setFilterByFunction(undefined);
|
|
27
|
+
}
|
|
28
|
+
if (excludeFunction !== undefined) {
|
|
29
|
+
setExcludeFunction(undefined);
|
|
30
|
+
}
|
|
31
|
+
if (searchString !== undefined) {
|
|
32
|
+
setSearchString(undefined);
|
|
33
|
+
}
|
|
34
|
+
if (curPath !== undefined) {
|
|
35
|
+
setCurPath(undefined);
|
|
36
|
+
}
|
|
27
37
|
});
|
|
28
38
|
};
|
|
29
39
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.8",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@floating-ui/react": "^0.27.12",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"access": "public",
|
|
79
79
|
"registry": "https://registry.npmjs.org/"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "1a6da3c30760730db55896eb9b665cf3d41229b5"
|
|
82
82
|
}
|
|
@@ -0,0 +1,97 @@
|
|
|
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 {describe, expect, it} from 'vitest';
|
|
15
|
+
|
|
16
|
+
import {filterEmptyParams} from './index';
|
|
17
|
+
|
|
18
|
+
describe('filterEmptyParams', () => {
|
|
19
|
+
it('should return an array with 2 elements when given object with 2 valid and multiple invalid values', () => {
|
|
20
|
+
const input = {
|
|
21
|
+
validString: 'hello',
|
|
22
|
+
validArray: ['item1', 'item2'],
|
|
23
|
+
emptyString: '',
|
|
24
|
+
undefinedValue: undefined,
|
|
25
|
+
emptyArray: [],
|
|
26
|
+
anotherEmptyString: '',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const result = filterEmptyParams(input);
|
|
30
|
+
const resultEntries = Object.entries(result);
|
|
31
|
+
|
|
32
|
+
expect(resultEntries).toHaveLength(2);
|
|
33
|
+
expect(result).toEqual({
|
|
34
|
+
validString: 'hello',
|
|
35
|
+
validArray: ['item1', 'item2'],
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should filter out empty strings', () => {
|
|
40
|
+
const input = {
|
|
41
|
+
valid: 'test',
|
|
42
|
+
empty: '',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const result = filterEmptyParams(input);
|
|
46
|
+
expect(result).toEqual({valid: 'test'});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should filter out undefined values', () => {
|
|
50
|
+
const input = {
|
|
51
|
+
valid: 'test',
|
|
52
|
+
notDefined: undefined,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const result = filterEmptyParams(input);
|
|
56
|
+
expect(result).toEqual({valid: 'test'});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should filter out empty arrays', () => {
|
|
60
|
+
const input = {
|
|
61
|
+
valid: 'test',
|
|
62
|
+
emptyArray: [],
|
|
63
|
+
nonEmptyArray: ['item'],
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const result = filterEmptyParams(input);
|
|
67
|
+
expect(result).toEqual({
|
|
68
|
+
valid: 'test',
|
|
69
|
+
nonEmptyArray: ['item'],
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should keep all valid values including numbers, booleans, and objects', () => {
|
|
74
|
+
const input = {
|
|
75
|
+
string: 'test',
|
|
76
|
+
number: 0,
|
|
77
|
+
boolean: false,
|
|
78
|
+
object: {key: 'value'},
|
|
79
|
+
array: ['item'],
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const result = filterEmptyParams(input);
|
|
83
|
+
expect(result).toEqual(input);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should return empty object when all values are invalid', () => {
|
|
87
|
+
const input = {
|
|
88
|
+
empty1: '',
|
|
89
|
+
empty2: '',
|
|
90
|
+
undefined1: undefined,
|
|
91
|
+
emptyArray: [],
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const result = filterEmptyParams(input);
|
|
95
|
+
expect(result).toEqual({});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -71,7 +71,7 @@ const sanitizeDateRange = (
|
|
|
71
71
|
};
|
|
72
72
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
73
73
|
|
|
74
|
-
const filterEmptyParams = (o: Record<string, any>): Record<string, any> => {
|
|
74
|
+
export const filterEmptyParams = (o: Record<string, any>): Record<string, any> => {
|
|
75
75
|
return Object.fromEntries(
|
|
76
76
|
Object.entries(o)
|
|
77
77
|
.filter(
|
|
@@ -108,6 +108,7 @@ export const IcicleGraphToolbar: FC<IcicleGraphToolbarProps> = ({curPath, setNew
|
|
|
108
108
|
className="gap-2 w-max h-fit"
|
|
109
109
|
onClick={() => setNewCurPath([])}
|
|
110
110
|
disabled={curPath.length === 0}
|
|
111
|
+
id="h-reset-graph"
|
|
111
112
|
>
|
|
112
113
|
Reset graph
|
|
113
114
|
<Icon icon="system-uicons:reset" width={20} />
|
|
@@ -14,10 +14,13 @@
|
|
|
14
14
|
import {useURLState} from '@parca/components';
|
|
15
15
|
|
|
16
16
|
export const useResetStateOnNewSearch = (): (() => void) => {
|
|
17
|
-
const [, setCurPath] = useURLState('cur_path');
|
|
17
|
+
const [val, setCurPath] = useURLState('cur_path');
|
|
18
18
|
|
|
19
19
|
return () => {
|
|
20
20
|
setTimeout(() => {
|
|
21
|
+
if (val === undefined) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
21
24
|
setCurPath(undefined);
|
|
22
25
|
});
|
|
23
26
|
};
|
|
@@ -14,19 +14,29 @@
|
|
|
14
14
|
import {useURLState} from '@parca/components';
|
|
15
15
|
|
|
16
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');
|
|
17
|
+
const [groupBy, setGroupBy] = useURLState('group_by');
|
|
18
|
+
const [filterByFunction, setFilterByFunction] = useURLState('filter_by_function');
|
|
19
|
+
const [excludeFunction, setExcludeFunction] = useURLState('exclude_function');
|
|
20
|
+
const [searchString, setSearchString] = useURLState('search_string');
|
|
21
|
+
const [curPath, setCurPath] = useURLState('cur_path');
|
|
22
22
|
|
|
23
23
|
return () => {
|
|
24
24
|
setTimeout(() => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
if (groupBy !== undefined) {
|
|
26
|
+
setGroupBy(undefined);
|
|
27
|
+
}
|
|
28
|
+
if (filterByFunction !== undefined) {
|
|
29
|
+
setFilterByFunction(undefined);
|
|
30
|
+
}
|
|
31
|
+
if (excludeFunction !== undefined) {
|
|
32
|
+
setExcludeFunction(undefined);
|
|
33
|
+
}
|
|
34
|
+
if (searchString !== undefined) {
|
|
35
|
+
setSearchString(undefined);
|
|
36
|
+
}
|
|
37
|
+
if (curPath !== undefined) {
|
|
38
|
+
setCurPath(undefined);
|
|
39
|
+
}
|
|
30
40
|
});
|
|
31
41
|
};
|
|
32
42
|
};
|