@parca/profile 0.16.449 → 0.16.451
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/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +1 -1
- package/dist/MetricsGraphStrips/AreaGraph/index.d.ts +1 -1
- package/dist/MetricsGraphStrips/AreaGraph/index.d.ts.map +1 -1
- package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.d.ts +2 -1
- package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.d.ts.map +1 -1
- package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.js +8 -1
- package/dist/MetricsGraphStrips/index.d.ts +2 -1
- package/dist/MetricsGraphStrips/index.d.ts.map +1 -1
- package/dist/MetricsGraphStrips/index.js +13 -3
- package/dist/ProfileIcicleGraph/IcicleGraph/index.js +1 -1
- package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.js +2 -2
- package/dist/ProfileIcicleGraph/index.js +2 -2
- package/dist/ProfileView/components/ActionButtons/GroupByDropdown.d.ts.map +1 -0
- package/dist/{components → ProfileView/components}/ActionButtons/GroupByDropdown.js +1 -1
- package/dist/ProfileView/components/ActionButtons/SortByDropdown.d.ts.map +1 -0
- package/dist/{components → ProfileView/components}/ActionButtons/SortByDropdown.js +2 -2
- package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -0
- package/dist/ProfileView/{ColorStackLegend.js → components/ColorStackLegend.js} +2 -2
- package/dist/ProfileView/components/DashboardItems/index.d.ts +26 -0
- package/dist/ProfileView/components/DashboardItems/index.d.ts.map +1 -0
- package/dist/ProfileView/components/DashboardItems/index.js +42 -0
- package/dist/ProfileView/components/DashboardLayout/index.d.ts +15 -0
- package/dist/ProfileView/components/DashboardLayout/index.d.ts.map +1 -0
- package/dist/ProfileView/components/DashboardLayout/index.js +20 -0
- package/dist/ProfileView/components/DiffLegend.d.ts.map +1 -0
- package/dist/ProfileView/components/FilterByFunctionButton.d.ts.map +1 -0
- package/dist/ProfileView/components/ProfileHeader/index.d.ts +9 -0
- package/dist/ProfileView/components/ProfileHeader/index.d.ts.map +1 -0
- package/dist/ProfileView/components/ProfileHeader/index.js +12 -0
- package/dist/ProfileView/components/ShareButton/ResultBox.d.ts.map +1 -0
- package/dist/{components → ProfileView/components}/ShareButton/index.d.ts +1 -1
- package/dist/ProfileView/components/ShareButton/index.d.ts.map +1 -0
- package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -0
- package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/MultiLevelDropdown.js +2 -2
- package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -0
- package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/TableColumnsDropdown.js +4 -4
- package/dist/ProfileView/components/Toolbars/index.d.ts +41 -0
- package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -0
- package/dist/ProfileView/components/Toolbars/index.js +24 -0
- package/dist/ProfileView/components/ViewSelector/Dropdown.d.ts.map +1 -0
- package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -0
- package/dist/ProfileView/components/VisualizationContainer/index.d.ts +21 -0
- package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -0
- package/dist/ProfileView/components/VisualizationContainer/index.js +8 -0
- package/dist/ProfileView/{VisualizationPanel.d.ts → components/VisualizationPanel.d.ts} +4 -3
- package/dist/ProfileView/components/VisualizationPanel.d.ts.map +1 -0
- package/dist/ProfileView/context/DashboardContext.d.ts +12 -0
- package/dist/ProfileView/context/DashboardContext.d.ts.map +1 -0
- package/dist/ProfileView/context/DashboardContext.js +39 -0
- package/dist/ProfileView/{ProfileViewContext.d.ts → context/ProfileViewContext.d.ts} +1 -1
- package/dist/ProfileView/context/ProfileViewContext.d.ts.map +1 -0
- package/dist/ProfileView/hooks/useGraphviz.d.ts +12 -0
- package/dist/ProfileView/hooks/useGraphviz.d.ts.map +1 -0
- package/dist/ProfileView/hooks/useGraphviz.js +42 -0
- package/dist/ProfileView/hooks/useProfileMetadata.d.ts +17 -0
- package/dist/ProfileView/hooks/useProfileMetadata.d.ts.map +1 -0
- package/dist/ProfileView/hooks/useProfileMetadata.js +30 -0
- package/dist/ProfileView/hooks/useVisualizationState.d.ts +14 -0
- package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -0
- package/dist/ProfileView/hooks/useVisualizationState.js +52 -0
- package/dist/ProfileView/index.d.ts +2 -49
- package/dist/ProfileView/index.d.ts.map +1 -1
- package/dist/ProfileView/index.js +54 -173
- package/dist/ProfileView/types/visualization.d.ts +49 -0
- package/dist/ProfileView/types/visualization.d.ts.map +1 -0
- package/dist/ProfileView/types/visualization.js +13 -0
- package/dist/ProfileView/utils/colorUtils.d.ts +3 -0
- package/dist/ProfileView/utils/colorUtils.d.ts.map +1 -0
- package/dist/ProfileView/utils/colorUtils.js +21 -0
- package/dist/ProfileViewWithData.d.ts +2 -1
- package/dist/ProfileViewWithData.d.ts.map +1 -1
- package/dist/ProfileViewWithData.js +2 -2
- package/dist/SourceView/Highlighter.js +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/TimelineGuide/index.d.ts +11 -0
- package/dist/TimelineGuide/index.d.ts.map +1 -0
- package/dist/{MetricsGraphStrips/TimelineGuide → TimelineGuide}/index.js +3 -13
- package/dist/TopTable/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +1 -1
- package/src/MetricsGraphStrips/AreaGraph/index.tsx +2 -2
- package/src/MetricsGraphStrips/MetricsGraphStrips.stories.tsx +11 -2
- package/src/MetricsGraphStrips/index.tsx +16 -4
- package/src/ProfileIcicleGraph/IcicleGraph/index.tsx +1 -1
- package/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx +2 -2
- package/src/ProfileIcicleGraph/index.tsx +2 -2
- package/src/{components → ProfileView/components}/ActionButtons/GroupByDropdown.tsx +1 -1
- package/src/{components → ProfileView/components}/ActionButtons/SortByDropdown.tsx +2 -2
- package/src/ProfileView/{ColorStackLegend.tsx → components/ColorStackLegend.tsx} +2 -2
- package/src/ProfileView/components/DashboardItems/index.tsx +148 -0
- package/src/ProfileView/components/DashboardLayout/index.tsx +96 -0
- package/src/ProfileView/components/ProfileHeader/index.tsx +68 -0
- package/src/{components → ProfileView/components}/ShareButton/index.tsx +1 -1
- package/src/{components/VisualisationToolbar → ProfileView/components/Toolbars}/MultiLevelDropdown.tsx +2 -6
- package/src/{components/VisualisationToolbar → ProfileView/components/Toolbars}/TableColumnsDropdown.tsx +4 -4
- package/src/ProfileView/components/Toolbars/index.tsx +193 -0
- package/src/ProfileView/components/VisualizationContainer/index.tsx +68 -0
- package/src/ProfileView/{VisualizationPanel.tsx → components/VisualizationPanel.tsx} +5 -3
- package/src/ProfileView/context/DashboardContext.tsx +61 -0
- package/src/ProfileView/{ProfileViewContext.tsx → context/ProfileViewContext.tsx} +1 -1
- package/src/ProfileView/hooks/useGraphviz.ts +69 -0
- package/src/ProfileView/hooks/useProfileMetadata.ts +59 -0
- package/src/ProfileView/hooks/useVisualizationState.ts +82 -0
- package/src/ProfileView/index.tsx +126 -451
- package/src/ProfileView/types/visualization.ts +75 -0
- package/src/ProfileView/utils/colorUtils.ts +24 -0
- package/src/ProfileViewWithData.tsx +3 -0
- package/src/SourceView/Highlighter.tsx +1 -1
- package/src/Table/index.tsx +1 -1
- package/src/{MetricsGraphStrips/TimelineGuide → TimelineGuide}/index.tsx +7 -17
- package/src/TopTable/index.tsx +1 -1
- package/src/utils.ts +2 -0
- package/dist/MetricsGraphStrips/TimelineGuide/index.d.ts +0 -10
- package/dist/MetricsGraphStrips/TimelineGuide/index.d.ts.map +0 -1
- package/dist/ProfileView/ColorStackLegend.d.ts.map +0 -1
- package/dist/ProfileView/ProfileViewContext.d.ts.map +0 -1
- package/dist/ProfileView/VisualizationPanel.d.ts.map +0 -1
- package/dist/components/ActionButtons/GroupByDropdown.d.ts.map +0 -1
- package/dist/components/ActionButtons/SortByDropdown.d.ts.map +0 -1
- package/dist/components/DiffLegend.d.ts.map +0 -1
- package/dist/components/FilterByFunctionButton.d.ts.map +0 -1
- package/dist/components/ShareButton/ResultBox.d.ts.map +0 -1
- package/dist/components/ShareButton/index.d.ts.map +0 -1
- package/dist/components/ViewSelector/Dropdown.d.ts.map +0 -1
- package/dist/components/ViewSelector/index.d.ts.map +0 -1
- package/dist/components/VisualisationToolbar/MultiLevelDropdown.d.ts.map +0 -1
- package/dist/components/VisualisationToolbar/TableColumnsDropdown.d.ts.map +0 -1
- package/dist/components/VisualisationToolbar/index.d.ts +0 -37
- package/dist/components/VisualisationToolbar/index.d.ts.map +0 -1
- package/dist/components/VisualisationToolbar/index.js +0 -64
- package/src/components/VisualisationToolbar/index.tsx +0 -228
- /package/dist/{components → ProfileView/components}/ActionButtons/GroupByDropdown.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/ActionButtons/SortByDropdown.d.ts +0 -0
- /package/dist/ProfileView/{ColorStackLegend.d.ts → components/ColorStackLegend.d.ts} +0 -0
- /package/dist/{components → ProfileView/components}/DiffLegend.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/DiffLegend.js +0 -0
- /package/dist/{components → ProfileView/components}/FilterByFunctionButton.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/FilterByFunctionButton.js +0 -0
- /package/dist/{components → ProfileView/components}/ShareButton/ResultBox.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/ShareButton/ResultBox.js +0 -0
- /package/dist/{components → ProfileView/components}/ShareButton/index.js +0 -0
- /package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/MultiLevelDropdown.d.ts +0 -0
- /package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/TableColumnsDropdown.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/ViewSelector/Dropdown.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/ViewSelector/Dropdown.js +0 -0
- /package/dist/{components → ProfileView/components}/ViewSelector/index.d.ts +0 -0
- /package/dist/{components → ProfileView/components}/ViewSelector/index.js +0 -0
- /package/dist/ProfileView/{VisualizationPanel.js → components/VisualizationPanel.js} +0 -0
- /package/dist/ProfileView/{ProfileViewContext.js → context/ProfileViewContext.js} +0 -0
- /package/src/{components → ProfileView/components}/DiffLegend.tsx +0 -0
- /package/src/{components → ProfileView/components}/FilterByFunctionButton.tsx +0 -0
- /package/src/{components → ProfileView/components}/ShareButton/ResultBox.tsx +0 -0
- /package/src/{components → ProfileView/components}/ViewSelector/Dropdown.tsx +0 -0
- /package/src/{components → ProfileView/components}/ViewSelector/index.tsx +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
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, useState} from 'react';
|
|
15
|
+
|
|
16
|
+
import {useURLState} from '@parca/components';
|
|
17
|
+
|
|
18
|
+
import {FIELD_FUNCTION_NAME, FIELD_LABELS} from '../../ProfileIcicleGraph/IcicleGraphArrow';
|
|
19
|
+
|
|
20
|
+
export const useVisualizationState = (): {
|
|
21
|
+
curPath: string[];
|
|
22
|
+
setCurPath: (path: string[]) => void;
|
|
23
|
+
currentSearchString: string | undefined;
|
|
24
|
+
setSearchString: (searchString: string | undefined) => void;
|
|
25
|
+
colorStackLegend: string | undefined;
|
|
26
|
+
colorBy: string;
|
|
27
|
+
groupBy: string[];
|
|
28
|
+
setGroupBy: (keys: string[]) => void;
|
|
29
|
+
toggleGroupBy: (key: string) => void;
|
|
30
|
+
clearSelection: () => void;
|
|
31
|
+
setGroupByLabels: (labels: string[]) => void;
|
|
32
|
+
} => {
|
|
33
|
+
const [curPath, setCurPath] = useState<string[]>([]);
|
|
34
|
+
const [currentSearchString, setSearchString] = useURLState<string | undefined>('search_string');
|
|
35
|
+
const [colorStackLegend] = useURLState<string | undefined>('color_stack_legend');
|
|
36
|
+
const [colorBy] = useURLState('color_by');
|
|
37
|
+
const [groupBy, setStoreGroupBy] = useURLState<string[]>('group_by', {
|
|
38
|
+
defaultValue: [FIELD_FUNCTION_NAME],
|
|
39
|
+
alwaysReturnArray: true,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const setGroupBy = useCallback(
|
|
43
|
+
(keys: string[]): void => {
|
|
44
|
+
setStoreGroupBy(keys);
|
|
45
|
+
},
|
|
46
|
+
[setStoreGroupBy]
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const toggleGroupBy = useCallback(
|
|
50
|
+
(key: string): void => {
|
|
51
|
+
groupBy.includes(key)
|
|
52
|
+
? setGroupBy(groupBy.filter(v => v !== key)) // remove
|
|
53
|
+
: setGroupBy([...groupBy, key]); // add
|
|
54
|
+
},
|
|
55
|
+
[groupBy, setGroupBy]
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const setGroupByLabels = useCallback(
|
|
59
|
+
(labels: string[]): void => {
|
|
60
|
+
setGroupBy(groupBy.filter(l => !l.startsWith(`${FIELD_LABELS}.`)).concat(labels));
|
|
61
|
+
},
|
|
62
|
+
[groupBy, setGroupBy]
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const clearSelection = useCallback((): void => {
|
|
66
|
+
setSearchString?.('');
|
|
67
|
+
}, [setSearchString]);
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
curPath,
|
|
71
|
+
setCurPath,
|
|
72
|
+
currentSearchString,
|
|
73
|
+
setSearchString,
|
|
74
|
+
colorStackLegend,
|
|
75
|
+
colorBy: (colorBy as string) ?? '',
|
|
76
|
+
groupBy,
|
|
77
|
+
setGroupBy,
|
|
78
|
+
toggleGroupBy,
|
|
79
|
+
setGroupByLabels,
|
|
80
|
+
clearSelection,
|
|
81
|
+
};
|
|
82
|
+
};
|