@parca/profile 0.15.18 → 0.15.25
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 +47 -0
- package/package.json +7 -4
- package/src/IcicleGraph.tsx +3 -2
- package/src/TopTable.tsx +27 -10
- package/src/components/ProfileShareButton/index.tsx +7 -3
- package/src/useDelayedLoader.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,53 @@
|
|
|
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.15.25](https://github.com/parca-dev/parca/compare/ui-v0.15.24...ui-v0.15.25) (2022-09-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @parca/profile
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.15.24](https://github.com/parca-dev/parca/compare/ui-v0.15.23...ui-v0.15.24) (2022-09-13)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [0.15.19](https://github.com/parca-dev/parca/compare/ui-v0.15.17...ui-v0.15.19) (2022-09-08)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.15.17](https://github.com/parca-dev/parca/compare/ui-v0.15.10...ui-v0.15.17) (2022-09-07)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **ui:** type all the things (string mode) ([e91ac9d](https://github.com/parca-dev/parca/commit/e91ac9deb8a200ed3c9a9c5d81ae71e13d49466e))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## 0.15.10 (2022-08-30)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## [0.15.19](https://github.com/parca-dev/parca/compare/ui-v0.15.18...ui-v0.15.19) (2022-09-08)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## [0.15.17](https://github.com/parca-dev/parca/compare/ui-v0.15.10...ui-v0.15.17) (2022-09-07)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## [0.15.10](https://github.com/parca-dev/parca/compare/ui-v0.15.8...ui-v0.15.10) (2022-08-30)
|
|
46
|
+
|
|
47
|
+
**Note:** Version bump only for package @parca/profile
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
6
53
|
## [0.15.18](https://github.com/parca-dev/parca/compare/ui-v0.15.17...ui-v0.15.18) (2022-09-08)
|
|
7
54
|
|
|
8
55
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parca/profile",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.25",
|
|
4
4
|
"description": "Profile viewing libraries",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@iconify/react": "^3.2.2",
|
|
7
7
|
"@parca/client": "^0.15.11",
|
|
8
8
|
"@parca/dynamicsize": "^0.15.17",
|
|
9
|
-
"@parca/functions": "^0.15.
|
|
10
|
-
"@parca/parser": "^0.15.
|
|
9
|
+
"@parca/functions": "^0.15.24",
|
|
10
|
+
"@parca/parser": "^0.15.24",
|
|
11
11
|
"d3-scale": "^4.0.2",
|
|
12
12
|
"d3-selection": "3.0.0",
|
|
13
13
|
"react-copy-to-clipboard": "^5.1.0"
|
|
14
14
|
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/react-copy-to-clipboard": "5.0.4"
|
|
17
|
+
},
|
|
15
18
|
"main": "src/index.tsx",
|
|
16
19
|
"scripts": {
|
|
17
20
|
"test": "jest --coverage --config ../../../jest.config.js ./src/*"
|
|
@@ -23,5 +26,5 @@
|
|
|
23
26
|
"access": "public",
|
|
24
27
|
"registry": "https://registry.npmjs.org/"
|
|
25
28
|
},
|
|
26
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "e1d9e99542f9b1ac0b8c98a97379c784e50d2cea"
|
|
27
30
|
}
|
package/src/IcicleGraph.tsx
CHANGED
|
@@ -22,6 +22,7 @@ import {getLastItem, diffColor, isSearchMatch} from '@parca/functions';
|
|
|
22
22
|
import {useAppSelector, selectDarkMode, selectSearchNodeString} from '@parca/store';
|
|
23
23
|
|
|
24
24
|
import {hexifyAddress} from './utils';
|
|
25
|
+
import {HoveringNode} from '@parca/components/src/GraphTooltip';
|
|
25
26
|
|
|
26
27
|
interface IcicleGraphProps {
|
|
27
28
|
graph: Flamegraph;
|
|
@@ -260,7 +261,7 @@ export function IcicleGraphRootNode({
|
|
|
260
261
|
const onClick = (): void => setCurPath([]);
|
|
261
262
|
const onMouseEnter = (): void => setHoveringNode(node);
|
|
262
263
|
const onMouseLeave = (): void => setHoveringNode(undefined);
|
|
263
|
-
const path = [];
|
|
264
|
+
const path: string[] = [];
|
|
264
265
|
|
|
265
266
|
return (
|
|
266
267
|
<g transform={'translate(0, 0)'}>
|
|
@@ -336,7 +337,7 @@ export default function IcicleGraph({
|
|
|
336
337
|
total={total}
|
|
337
338
|
x={pos[0]}
|
|
338
339
|
y={pos[1]}
|
|
339
|
-
hoveringNode={hoveringNode}
|
|
340
|
+
hoveringNode={hoveringNode as HoveringNode}
|
|
340
341
|
contextElement={svg.current}
|
|
341
342
|
/>
|
|
342
343
|
<svg
|
package/src/TopTable.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import React from 'react';
|
|
|
15
15
|
|
|
16
16
|
import {getLastItem, valueFormatter, isSearchMatch} from '@parca/functions';
|
|
17
17
|
import {useAppSelector, selectCompareMode, selectSearchNodeString} from '@parca/store';
|
|
18
|
-
import {TopNodeMeta, Top} from '@parca/client';
|
|
18
|
+
import {TopNode, TopNodeMeta, Top} from '@parca/client';
|
|
19
19
|
|
|
20
20
|
import {hexifyAddress} from './utils';
|
|
21
21
|
|
|
@@ -43,7 +43,10 @@ const Arrow = ({direction}: {direction: string | undefined}): JSX.Element => {
|
|
|
43
43
|
|
|
44
44
|
const useSortableData = (
|
|
45
45
|
top?: Top,
|
|
46
|
-
config
|
|
46
|
+
config: {key: keyof TopNode | 'name'; direction: 'asc' | 'desc'} = {
|
|
47
|
+
key: 'cumulative',
|
|
48
|
+
direction: 'desc',
|
|
49
|
+
}
|
|
47
50
|
): {
|
|
48
51
|
items:
|
|
49
52
|
| Array<{
|
|
@@ -54,17 +57,20 @@ const useSortableData = (
|
|
|
54
57
|
meta?: TopNodeMeta | undefined;
|
|
55
58
|
}>
|
|
56
59
|
| undefined;
|
|
57
|
-
requestSort: (key:
|
|
58
|
-
sortConfig: {key:
|
|
60
|
+
requestSort: (key: keyof TopNode | 'name') => void;
|
|
61
|
+
sortConfig: {key: keyof TopNode | 'name'; direction: string} | null;
|
|
59
62
|
} => {
|
|
60
|
-
const [sortConfig, setSortConfig] = React.useState<{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
const [sortConfig, setSortConfig] = React.useState<{
|
|
64
|
+
key: keyof TopNode | 'name';
|
|
65
|
+
direction: string;
|
|
66
|
+
} | null>(config);
|
|
63
67
|
|
|
64
68
|
const rawTableReport = top != null ? top.list : [];
|
|
65
69
|
|
|
66
70
|
const items = rawTableReport.map(node => ({
|
|
67
71
|
...node,
|
|
72
|
+
// Warning: string to number can overflow
|
|
73
|
+
// https://github.com/timostamm/protobuf-ts/blob/master/MANUAL.md#bigint-support
|
|
68
74
|
diff: Number(node.diff),
|
|
69
75
|
cumulative: Number(node.cumulative),
|
|
70
76
|
flat: Number(node.flat),
|
|
@@ -77,10 +83,21 @@ const useSortableData = (
|
|
|
77
83
|
const sortableItems = [...items];
|
|
78
84
|
if (sortConfig !== null) {
|
|
79
85
|
sortableItems.sort((a, b) => {
|
|
80
|
-
|
|
86
|
+
const itemA = a[sortConfig.key];
|
|
87
|
+
const itemB = b[sortConfig.key];
|
|
88
|
+
if (itemA === undefined && itemB === undefined) {
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
91
|
+
if (itemA === undefined) {
|
|
92
|
+
return sortConfig.direction === 'asc' ? -1 : 1;
|
|
93
|
+
}
|
|
94
|
+
if (itemB === undefined) {
|
|
95
|
+
return sortConfig.direction === 'asc' ? 1 : -1;
|
|
96
|
+
}
|
|
97
|
+
if (itemA < itemB) {
|
|
81
98
|
return sortConfig.direction === 'asc' ? -1 : 1;
|
|
82
99
|
}
|
|
83
|
-
if (
|
|
100
|
+
if (itemA > itemB) {
|
|
84
101
|
return sortConfig.direction === 'asc' ? 1 : -1;
|
|
85
102
|
}
|
|
86
103
|
return 0;
|
|
@@ -89,7 +106,7 @@ const useSortableData = (
|
|
|
89
106
|
return sortableItems;
|
|
90
107
|
}, [items, sortConfig]);
|
|
91
108
|
|
|
92
|
-
const requestSort = (key:
|
|
109
|
+
const requestSort = (key: keyof TopNode | 'name'): void => {
|
|
93
110
|
let direction = 'desc';
|
|
94
111
|
if (sortConfig != null && sortConfig.key === key && sortConfig.direction === 'desc') {
|
|
95
112
|
direction = 'asc';
|
|
@@ -54,9 +54,13 @@ const ProfileShareModal = ({
|
|
|
54
54
|
setLoading(false);
|
|
55
55
|
setIsShared(true);
|
|
56
56
|
} catch (err) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
if (err instanceof Error) {
|
|
58
|
+
console.error(err);
|
|
59
|
+
setLoading(false);
|
|
60
|
+
// https://github.com/microsoft/TypeScript/issues/38347
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
62
|
+
setError(err.toString());
|
|
63
|
+
}
|
|
60
64
|
}
|
|
61
65
|
};
|
|
62
66
|
|
package/src/useDelayedLoader.ts
CHANGED
|
@@ -27,7 +27,7 @@ const useDelayedLoader = (isLoading = false, options?: DelayedLoaderOptions): bo
|
|
|
27
27
|
showLoaderTimeout = setTimeout(() => {
|
|
28
28
|
setIsLoaderVisible(true);
|
|
29
29
|
}, delay);
|
|
30
|
-
} else {
|
|
30
|
+
} else if (!isLoading && isLoaderVisible) {
|
|
31
31
|
setIsLoaderVisible(false);
|
|
32
32
|
}
|
|
33
33
|
return () => clearTimeout(showLoaderTimeout);
|