@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.
Files changed (158) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +1 -1
  3. package/dist/MetricsGraphStrips/AreaGraph/index.d.ts +1 -1
  4. package/dist/MetricsGraphStrips/AreaGraph/index.d.ts.map +1 -1
  5. package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.d.ts +2 -1
  6. package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.d.ts.map +1 -1
  7. package/dist/MetricsGraphStrips/MetricsGraphStrips.stories.js +8 -1
  8. package/dist/MetricsGraphStrips/index.d.ts +2 -1
  9. package/dist/MetricsGraphStrips/index.d.ts.map +1 -1
  10. package/dist/MetricsGraphStrips/index.js +13 -3
  11. package/dist/ProfileIcicleGraph/IcicleGraph/index.js +1 -1
  12. package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.js +2 -2
  13. package/dist/ProfileIcicleGraph/index.js +2 -2
  14. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.d.ts.map +1 -0
  15. package/dist/{components → ProfileView/components}/ActionButtons/GroupByDropdown.js +1 -1
  16. package/dist/ProfileView/components/ActionButtons/SortByDropdown.d.ts.map +1 -0
  17. package/dist/{components → ProfileView/components}/ActionButtons/SortByDropdown.js +2 -2
  18. package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -0
  19. package/dist/ProfileView/{ColorStackLegend.js → components/ColorStackLegend.js} +2 -2
  20. package/dist/ProfileView/components/DashboardItems/index.d.ts +26 -0
  21. package/dist/ProfileView/components/DashboardItems/index.d.ts.map +1 -0
  22. package/dist/ProfileView/components/DashboardItems/index.js +42 -0
  23. package/dist/ProfileView/components/DashboardLayout/index.d.ts +15 -0
  24. package/dist/ProfileView/components/DashboardLayout/index.d.ts.map +1 -0
  25. package/dist/ProfileView/components/DashboardLayout/index.js +20 -0
  26. package/dist/ProfileView/components/DiffLegend.d.ts.map +1 -0
  27. package/dist/ProfileView/components/FilterByFunctionButton.d.ts.map +1 -0
  28. package/dist/ProfileView/components/ProfileHeader/index.d.ts +9 -0
  29. package/dist/ProfileView/components/ProfileHeader/index.d.ts.map +1 -0
  30. package/dist/ProfileView/components/ProfileHeader/index.js +12 -0
  31. package/dist/ProfileView/components/ShareButton/ResultBox.d.ts.map +1 -0
  32. package/dist/{components → ProfileView/components}/ShareButton/index.d.ts +1 -1
  33. package/dist/ProfileView/components/ShareButton/index.d.ts.map +1 -0
  34. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -0
  35. package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/MultiLevelDropdown.js +2 -2
  36. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -0
  37. package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/TableColumnsDropdown.js +4 -4
  38. package/dist/ProfileView/components/Toolbars/index.d.ts +41 -0
  39. package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -0
  40. package/dist/ProfileView/components/Toolbars/index.js +24 -0
  41. package/dist/ProfileView/components/ViewSelector/Dropdown.d.ts.map +1 -0
  42. package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -0
  43. package/dist/ProfileView/components/VisualizationContainer/index.d.ts +21 -0
  44. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -0
  45. package/dist/ProfileView/components/VisualizationContainer/index.js +8 -0
  46. package/dist/ProfileView/{VisualizationPanel.d.ts → components/VisualizationPanel.d.ts} +4 -3
  47. package/dist/ProfileView/components/VisualizationPanel.d.ts.map +1 -0
  48. package/dist/ProfileView/context/DashboardContext.d.ts +12 -0
  49. package/dist/ProfileView/context/DashboardContext.d.ts.map +1 -0
  50. package/dist/ProfileView/context/DashboardContext.js +39 -0
  51. package/dist/ProfileView/{ProfileViewContext.d.ts → context/ProfileViewContext.d.ts} +1 -1
  52. package/dist/ProfileView/context/ProfileViewContext.d.ts.map +1 -0
  53. package/dist/ProfileView/hooks/useGraphviz.d.ts +12 -0
  54. package/dist/ProfileView/hooks/useGraphviz.d.ts.map +1 -0
  55. package/dist/ProfileView/hooks/useGraphviz.js +42 -0
  56. package/dist/ProfileView/hooks/useProfileMetadata.d.ts +17 -0
  57. package/dist/ProfileView/hooks/useProfileMetadata.d.ts.map +1 -0
  58. package/dist/ProfileView/hooks/useProfileMetadata.js +30 -0
  59. package/dist/ProfileView/hooks/useVisualizationState.d.ts +14 -0
  60. package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -0
  61. package/dist/ProfileView/hooks/useVisualizationState.js +52 -0
  62. package/dist/ProfileView/index.d.ts +2 -49
  63. package/dist/ProfileView/index.d.ts.map +1 -1
  64. package/dist/ProfileView/index.js +54 -173
  65. package/dist/ProfileView/types/visualization.d.ts +49 -0
  66. package/dist/ProfileView/types/visualization.d.ts.map +1 -0
  67. package/dist/ProfileView/types/visualization.js +13 -0
  68. package/dist/ProfileView/utils/colorUtils.d.ts +3 -0
  69. package/dist/ProfileView/utils/colorUtils.d.ts.map +1 -0
  70. package/dist/ProfileView/utils/colorUtils.js +21 -0
  71. package/dist/ProfileViewWithData.d.ts +2 -1
  72. package/dist/ProfileViewWithData.d.ts.map +1 -1
  73. package/dist/ProfileViewWithData.js +2 -2
  74. package/dist/SourceView/Highlighter.js +1 -1
  75. package/dist/Table/index.js +1 -1
  76. package/dist/TimelineGuide/index.d.ts +11 -0
  77. package/dist/TimelineGuide/index.d.ts.map +1 -0
  78. package/dist/{MetricsGraphStrips/TimelineGuide → TimelineGuide}/index.js +3 -13
  79. package/dist/TopTable/index.js +1 -1
  80. package/dist/styles.css +1 -1
  81. package/dist/utils.d.ts +1 -0
  82. package/dist/utils.d.ts.map +1 -1
  83. package/package.json +2 -2
  84. package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +1 -1
  85. package/src/MetricsGraphStrips/AreaGraph/index.tsx +2 -2
  86. package/src/MetricsGraphStrips/MetricsGraphStrips.stories.tsx +11 -2
  87. package/src/MetricsGraphStrips/index.tsx +16 -4
  88. package/src/ProfileIcicleGraph/IcicleGraph/index.tsx +1 -1
  89. package/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx +2 -2
  90. package/src/ProfileIcicleGraph/index.tsx +2 -2
  91. package/src/{components → ProfileView/components}/ActionButtons/GroupByDropdown.tsx +1 -1
  92. package/src/{components → ProfileView/components}/ActionButtons/SortByDropdown.tsx +2 -2
  93. package/src/ProfileView/{ColorStackLegend.tsx → components/ColorStackLegend.tsx} +2 -2
  94. package/src/ProfileView/components/DashboardItems/index.tsx +148 -0
  95. package/src/ProfileView/components/DashboardLayout/index.tsx +96 -0
  96. package/src/ProfileView/components/ProfileHeader/index.tsx +68 -0
  97. package/src/{components → ProfileView/components}/ShareButton/index.tsx +1 -1
  98. package/src/{components/VisualisationToolbar → ProfileView/components/Toolbars}/MultiLevelDropdown.tsx +2 -6
  99. package/src/{components/VisualisationToolbar → ProfileView/components/Toolbars}/TableColumnsDropdown.tsx +4 -4
  100. package/src/ProfileView/components/Toolbars/index.tsx +193 -0
  101. package/src/ProfileView/components/VisualizationContainer/index.tsx +68 -0
  102. package/src/ProfileView/{VisualizationPanel.tsx → components/VisualizationPanel.tsx} +5 -3
  103. package/src/ProfileView/context/DashboardContext.tsx +61 -0
  104. package/src/ProfileView/{ProfileViewContext.tsx → context/ProfileViewContext.tsx} +1 -1
  105. package/src/ProfileView/hooks/useGraphviz.ts +69 -0
  106. package/src/ProfileView/hooks/useProfileMetadata.ts +59 -0
  107. package/src/ProfileView/hooks/useVisualizationState.ts +82 -0
  108. package/src/ProfileView/index.tsx +126 -451
  109. package/src/ProfileView/types/visualization.ts +75 -0
  110. package/src/ProfileView/utils/colorUtils.ts +24 -0
  111. package/src/ProfileViewWithData.tsx +3 -0
  112. package/src/SourceView/Highlighter.tsx +1 -1
  113. package/src/Table/index.tsx +1 -1
  114. package/src/{MetricsGraphStrips/TimelineGuide → TimelineGuide}/index.tsx +7 -17
  115. package/src/TopTable/index.tsx +1 -1
  116. package/src/utils.ts +2 -0
  117. package/dist/MetricsGraphStrips/TimelineGuide/index.d.ts +0 -10
  118. package/dist/MetricsGraphStrips/TimelineGuide/index.d.ts.map +0 -1
  119. package/dist/ProfileView/ColorStackLegend.d.ts.map +0 -1
  120. package/dist/ProfileView/ProfileViewContext.d.ts.map +0 -1
  121. package/dist/ProfileView/VisualizationPanel.d.ts.map +0 -1
  122. package/dist/components/ActionButtons/GroupByDropdown.d.ts.map +0 -1
  123. package/dist/components/ActionButtons/SortByDropdown.d.ts.map +0 -1
  124. package/dist/components/DiffLegend.d.ts.map +0 -1
  125. package/dist/components/FilterByFunctionButton.d.ts.map +0 -1
  126. package/dist/components/ShareButton/ResultBox.d.ts.map +0 -1
  127. package/dist/components/ShareButton/index.d.ts.map +0 -1
  128. package/dist/components/ViewSelector/Dropdown.d.ts.map +0 -1
  129. package/dist/components/ViewSelector/index.d.ts.map +0 -1
  130. package/dist/components/VisualisationToolbar/MultiLevelDropdown.d.ts.map +0 -1
  131. package/dist/components/VisualisationToolbar/TableColumnsDropdown.d.ts.map +0 -1
  132. package/dist/components/VisualisationToolbar/index.d.ts +0 -37
  133. package/dist/components/VisualisationToolbar/index.d.ts.map +0 -1
  134. package/dist/components/VisualisationToolbar/index.js +0 -64
  135. package/src/components/VisualisationToolbar/index.tsx +0 -228
  136. /package/dist/{components → ProfileView/components}/ActionButtons/GroupByDropdown.d.ts +0 -0
  137. /package/dist/{components → ProfileView/components}/ActionButtons/SortByDropdown.d.ts +0 -0
  138. /package/dist/ProfileView/{ColorStackLegend.d.ts → components/ColorStackLegend.d.ts} +0 -0
  139. /package/dist/{components → ProfileView/components}/DiffLegend.d.ts +0 -0
  140. /package/dist/{components → ProfileView/components}/DiffLegend.js +0 -0
  141. /package/dist/{components → ProfileView/components}/FilterByFunctionButton.d.ts +0 -0
  142. /package/dist/{components → ProfileView/components}/FilterByFunctionButton.js +0 -0
  143. /package/dist/{components → ProfileView/components}/ShareButton/ResultBox.d.ts +0 -0
  144. /package/dist/{components → ProfileView/components}/ShareButton/ResultBox.js +0 -0
  145. /package/dist/{components → ProfileView/components}/ShareButton/index.js +0 -0
  146. /package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/MultiLevelDropdown.d.ts +0 -0
  147. /package/dist/{components/VisualisationToolbar → ProfileView/components/Toolbars}/TableColumnsDropdown.d.ts +0 -0
  148. /package/dist/{components → ProfileView/components}/ViewSelector/Dropdown.d.ts +0 -0
  149. /package/dist/{components → ProfileView/components}/ViewSelector/Dropdown.js +0 -0
  150. /package/dist/{components → ProfileView/components}/ViewSelector/index.d.ts +0 -0
  151. /package/dist/{components → ProfileView/components}/ViewSelector/index.js +0 -0
  152. /package/dist/ProfileView/{VisualizationPanel.js → components/VisualizationPanel.js} +0 -0
  153. /package/dist/ProfileView/{ProfileViewContext.js → context/ProfileViewContext.js} +0 -0
  154. /package/src/{components → ProfileView/components}/DiffLegend.tsx +0 -0
  155. /package/src/{components → ProfileView/components}/FilterByFunctionButton.tsx +0 -0
  156. /package/src/{components → ProfileView/components}/ShareButton/ResultBox.tsx +0 -0
  157. /package/src/{components → ProfileView/components}/ViewSelector/Dropdown.tsx +0 -0
  158. /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
+ };