@perses-dev/flame-chart-plugin 0.6.0 → 0.7.0-beta.2

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 (185) hide show
  1. package/__mf/js/FlameChart.33756535.js +7 -0
  2. package/__mf/js/async/121.ae51b948.js +2 -0
  3. package/__mf/js/async/168.ed0e0563.js +1 -0
  4. package/__mf/js/async/183.dc144550.js +2 -0
  5. package/__mf/js/async/192.3f1244ba.js +1 -0
  6. package/__mf/js/async/2.75224ecf.js +1 -0
  7. package/__mf/js/async/235.9348db07.js +1 -0
  8. package/__mf/js/async/274.0a78b5be.js +2 -0
  9. package/__mf/js/async/356.ee39adef.js +1 -0
  10. package/__mf/js/async/370.6c540347.js +43 -0
  11. package/__mf/js/async/{657.9473a80f.js.LICENSE.txt → 370.6c540347.js.LICENSE.txt} +41 -1
  12. package/__mf/js/async/392.f77064da.js +2 -0
  13. package/__mf/js/async/407.04a86ff1.js +4 -0
  14. package/__mf/js/async/407.04a86ff1.js.LICENSE.txt +9 -0
  15. package/__mf/js/async/43.0e1586c3.js +2 -0
  16. package/__mf/js/async/464.27f20b74.js +1 -0
  17. package/__mf/js/async/470.6bd2d801.js +2 -0
  18. package/__mf/js/async/496.05c3dd88.js +1 -0
  19. package/__mf/js/async/587.ef9e1dde.js +1 -0
  20. package/__mf/js/async/588.3789ede2.js +1 -0
  21. package/__mf/js/async/616.374f2afc.js +1 -0
  22. package/__mf/js/async/71.3a2deac6.js +1 -0
  23. package/__mf/js/async/77.c084c3a8.js +1 -0
  24. package/__mf/js/async/787.f52f7030.js +1 -0
  25. package/__mf/js/async/802.d67bb643.js +110 -0
  26. package/__mf/js/async/867.7ffd4a61.js +1 -0
  27. package/__mf/js/async/873.a9618120.js +1 -0
  28. package/__mf/js/async/941.16953d1e.js +2 -0
  29. package/__mf/js/async/968.0e172d86.js +1 -0
  30. package/__mf/js/async/978.490d8621.js +1 -0
  31. package/__mf/js/async/__federation_expose_FlameChart.a941b5b1.js +17 -0
  32. package/__mf/js/async/lib-router.59036814.js +2 -0
  33. package/__mf/js/{main.08e04feb.js → main.24fb9837.js} +2 -2
  34. package/lib/FlameChart.d.ts +3 -3
  35. package/lib/FlameChart.d.ts.map +1 -1
  36. package/lib/FlameChart.js +2 -2
  37. package/lib/FlameChart.js.map +1 -1
  38. package/lib/bootstrap.js +2 -2
  39. package/lib/components/CustomBreadcrumb.d.ts +1 -1
  40. package/lib/components/CustomBreadcrumb.d.ts.map +1 -1
  41. package/lib/components/CustomBreadcrumb.js +8 -8
  42. package/lib/components/CustomBreadcrumb.js.map +1 -1
  43. package/lib/components/FlameChart.d.ts +2 -2
  44. package/lib/components/FlameChart.d.ts.map +1 -1
  45. package/lib/components/FlameChart.js +10 -10
  46. package/lib/components/FlameChart.js.map +1 -1
  47. package/lib/components/FlameChartOptionsEditorSettings.d.ts +2 -2
  48. package/lib/components/FlameChartOptionsEditorSettings.d.ts.map +1 -1
  49. package/lib/components/FlameChartOptionsEditorSettings.js +6 -6
  50. package/lib/components/FlameChartOptionsEditorSettings.js.map +1 -1
  51. package/lib/components/FlameChartPanel.d.ts +4 -4
  52. package/lib/components/FlameChartPanel.d.ts.map +1 -1
  53. package/lib/components/FlameChartPanel.js +88 -71
  54. package/lib/components/FlameChartPanel.js.map +1 -1
  55. package/lib/components/PaletteSelector.d.ts +1 -1
  56. package/lib/components/PaletteSelector.d.ts.map +1 -1
  57. package/lib/components/PaletteSelector.js +2 -2
  58. package/lib/components/PaletteSelector.js.map +1 -1
  59. package/lib/components/SearchBar.d.ts +1 -1
  60. package/lib/components/SearchBar.d.ts.map +1 -1
  61. package/lib/components/SearchBar.js +3 -3
  62. package/lib/components/SearchBar.js.map +1 -1
  63. package/lib/components/SeriesChart.d.ts +2 -2
  64. package/lib/components/SeriesChart.d.ts.map +1 -1
  65. package/lib/components/SeriesChart.js +6 -6
  66. package/lib/components/SeriesChart.js.map +1 -1
  67. package/lib/components/Settings.d.ts +2 -2
  68. package/lib/components/Settings.d.ts.map +1 -1
  69. package/lib/components/Settings.js +6 -6
  70. package/lib/components/Settings.js.map +1 -1
  71. package/lib/components/SwitchSelector.d.ts +1 -1
  72. package/lib/components/SwitchSelector.d.ts.map +1 -1
  73. package/lib/components/SwitchSelector.js +3 -3
  74. package/lib/components/SwitchSelector.js.map +1 -1
  75. package/lib/components/TableChart.d.ts +2 -2
  76. package/lib/components/TableChart.d.ts.map +1 -1
  77. package/lib/components/TableChart.js +6 -6
  78. package/lib/components/TableChart.js.map +1 -1
  79. package/lib/components/index.js +10 -10
  80. package/lib/components/index.js.map +1 -1
  81. package/lib/flame-chart-model.d.ts +2 -2
  82. package/lib/flame-chart-model.d.ts.map +1 -1
  83. package/lib/flame-chart-model.js.map +1 -1
  84. package/lib/getPluginModule.d.ts +1 -1
  85. package/lib/getPluginModule.d.ts.map +1 -1
  86. package/lib/getPluginModule.js +3 -1
  87. package/lib/getPluginModule.js.map +1 -1
  88. package/lib/index-federation.js +1 -1
  89. package/lib/index.js +2 -2
  90. package/lib/index.js.map +1 -1
  91. package/lib/setup-tests.d.ts +1 -1
  92. package/lib/setup-tests.d.ts.map +1 -1
  93. package/lib/setup-tests.js +2 -2
  94. package/lib/setup-tests.js.map +1 -1
  95. package/lib/utils/data-transform.d.ts +2 -2
  96. package/lib/utils/data-transform.d.ts.map +1 -1
  97. package/lib/utils/data-transform.js +2 -2
  98. package/lib/utils/data-transform.js.map +1 -1
  99. package/lib/utils/format.js +2 -2
  100. package/lib/utils/palette-gen.js +1 -1
  101. package/lib/utils/palette-gen.js.map +1 -1
  102. package/lib/utils/palette.js +1 -1
  103. package/lib/utils/series-tooltip.d.ts +1 -1
  104. package/lib/utils/series-tooltip.d.ts.map +1 -1
  105. package/lib/utils/series-tooltip.js +1 -1
  106. package/lib/utils/series-tooltip.js.map +1 -1
  107. package/lib/utils/tooltip.d.ts +1 -1
  108. package/lib/utils/tooltip.d.ts.map +1 -1
  109. package/lib/utils/tooltip.js +2 -2
  110. package/lib/utils/tooltip.js.map +1 -1
  111. package/lib/utils/utils.d.ts +2 -2
  112. package/lib/utils/utils.d.ts.map +1 -1
  113. package/lib/utils/utils.js +1 -1
  114. package/lib/utils/utils.js.map +1 -1
  115. package/mf-manifest.json +35 -34
  116. package/mf-stats.json +35 -34
  117. package/package.json +10 -10
  118. package/__mf/js/FlameChart.8940202b.js +0 -7
  119. package/__mf/js/async/121.7241788e.js +0 -2
  120. package/__mf/js/async/177.d1b72566.js +0 -1
  121. package/__mf/js/async/187.d2c3954d.js +0 -7
  122. package/__mf/js/async/187.d2c3954d.js.LICENSE.txt +0 -39
  123. package/__mf/js/async/192.2e230dc2.js +0 -1
  124. package/__mf/js/async/2.3d2f3d32.js +0 -1
  125. package/__mf/js/async/235.f7949644.js +0 -1
  126. package/__mf/js/async/274.f1ae4a6c.js +0 -2
  127. package/__mf/js/async/356.941c6c54.js +0 -1
  128. package/__mf/js/async/367.8beb758e.js +0 -110
  129. package/__mf/js/async/392.157fda9a.js +0 -2
  130. package/__mf/js/async/43.2eeeac07.js +0 -2
  131. package/__mf/js/async/470.55030a0b.js +0 -2
  132. package/__mf/js/async/546.d47a49c6.js +0 -24
  133. package/__mf/js/async/546.d47a49c6.js.LICENSE.txt +0 -19
  134. package/__mf/js/async/587.8bcd9e70.js +0 -1
  135. package/__mf/js/async/588.0012e8ae.js +0 -1
  136. package/__mf/js/async/597.fee7f09c.js +0 -1
  137. package/__mf/js/async/616.da14f6a0.js +0 -1
  138. package/__mf/js/async/657.9473a80f.js +0 -39
  139. package/__mf/js/async/698.06b3786e.js +0 -1
  140. package/__mf/js/async/71.126af909.js +0 -1
  141. package/__mf/js/async/740.c1f5cc4b.js +0 -1
  142. package/__mf/js/async/873.cd4654cd.js +0 -1
  143. package/__mf/js/async/941.c00ae16d.js +0 -2
  144. package/__mf/js/async/968.f7510839.js +0 -1
  145. package/__mf/js/async/97.fd587361.js +0 -1
  146. package/__mf/js/async/978.e1b5b66e.js +0 -1
  147. package/__mf/js/async/__federation_expose_FlameChart.7a8d049a.js +0 -17
  148. package/__mf/js/async/lib-router.1a328ab9.js +0 -2
  149. package/lib/cjs/FlameChart.js +0 -37
  150. package/lib/cjs/bootstrap.js +0 -26
  151. package/lib/cjs/components/CustomBreadcrumb.js +0 -96
  152. package/lib/cjs/components/FlameChart.js +0 -341
  153. package/lib/cjs/components/FlameChartOptionsEditorSettings.js +0 -104
  154. package/lib/cjs/components/FlameChartPanel.js +0 -164
  155. package/lib/cjs/components/PaletteSelector.js +0 -49
  156. package/lib/cjs/components/SearchBar.js +0 -59
  157. package/lib/cjs/components/SeriesChart.js +0 -189
  158. package/lib/cjs/components/Settings.js +0 -202
  159. package/lib/cjs/components/SwitchSelector.js +0 -37
  160. package/lib/cjs/components/TableChart.js +0 -143
  161. package/lib/cjs/components/index.js +0 -39
  162. package/lib/cjs/env.d.js +0 -14
  163. package/lib/cjs/flame-chart-model.js +0 -31
  164. package/lib/cjs/getPluginModule.js +0 -39
  165. package/lib/cjs/index-federation.js +0 -55
  166. package/lib/cjs/index.js +0 -37
  167. package/lib/cjs/setup-tests.js +0 -19
  168. package/lib/cjs/utils/data-model.js +0 -18
  169. package/lib/cjs/utils/data-transform.js +0 -163
  170. package/lib/cjs/utils/format.js +0 -88
  171. package/lib/cjs/utils/palette-gen.js +0 -68
  172. package/lib/cjs/utils/palette.js +0 -62
  173. package/lib/cjs/utils/series-tooltip.js +0 -51
  174. package/lib/cjs/utils/tooltip.js +0 -76
  175. package/lib/cjs/utils/ui-text.js +0 -30
  176. package/lib/cjs/utils/utils.js +0 -122
  177. /package/__mf/css/async/{187.85c2cbf6.css → 370.85c2cbf6.css} +0 -0
  178. /package/__mf/js/async/{121.7241788e.js.LICENSE.txt → 121.ae51b948.js.LICENSE.txt} +0 -0
  179. /package/__mf/js/async/{274.f1ae4a6c.js.LICENSE.txt → 274.0a78b5be.js.LICENSE.txt} +0 -0
  180. /package/__mf/js/async/{392.157fda9a.js.LICENSE.txt → 392.f77064da.js.LICENSE.txt} +0 -0
  181. /package/__mf/js/async/{43.2eeeac07.js.LICENSE.txt → 43.0e1586c3.js.LICENSE.txt} +0 -0
  182. /package/__mf/js/async/{470.55030a0b.js.LICENSE.txt → 470.6bd2d801.js.LICENSE.txt} +0 -0
  183. /package/__mf/js/async/{367.8beb758e.js.LICENSE.txt → 802.d67bb643.js.LICENSE.txt} +0 -0
  184. /package/__mf/js/async/{941.c00ae16d.js.LICENSE.txt → 941.16953d1e.js.LICENSE.txt} +0 -0
  185. /package/__mf/js/async/{lib-router.1a328ab9.js.LICENSE.txt → lib-router.59036814.js.LICENSE.txt} +0 -0
@@ -1,59 +0,0 @@
1
- // Copyright The Perses 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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "SearchBar", {
18
- enumerable: true,
19
- get: function() {
20
- return SearchBar;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _material = require("@mui/material");
25
- const _Magnify = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Magnify"));
26
- function _interop_require_default(obj) {
27
- return obj && obj.__esModule ? obj : {
28
- default: obj
29
- };
30
- }
31
- function SearchBar(props) {
32
- const { searchValue, onSearchValueChange } = props;
33
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
34
- size: "small",
35
- variant: "outlined",
36
- placeholder: "Search...",
37
- fullWidth: true,
38
- value: searchValue,
39
- onChange: (event)=>onSearchValueChange(event.target.value),
40
- slotProps: {
41
- input: {
42
- startAdornment: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputAdornment, {
43
- position: "start",
44
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Magnify.default, {
45
- fontSize: "small"
46
- })
47
- }),
48
- endAdornment: searchValue !== '' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputAdornment, {
49
- position: "end",
50
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Chip, {
51
- label: "Clear",
52
- size: "small",
53
- onClick: ()=>onSearchValueChange('')
54
- })
55
- })
56
- }
57
- }
58
- });
59
- }
@@ -1,189 +0,0 @@
1
- // Copyright The Perses 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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "SeriesChart", {
18
- enumerable: true,
19
- get: function() {
20
- return SeriesChart;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _react = require("react");
25
- const _material = require("@mui/material");
26
- const _components = require("@perses-dev/components");
27
- const _pluginsystem = require("@perses-dev/plugin-system");
28
- const _format = require("../utils/format");
29
- const _seriestooltip = require("../utils/series-tooltip");
30
- const LINE_WIDTH = 1.25;
31
- const POINT_SIZE_OFFSET = 2;
32
- function SeriesChart(props) {
33
- const { width, height, data } = props;
34
- const chartsTheme = (0, _components.useChartsTheme)();
35
- const theme = (0, _material.useTheme)();
36
- const { setTimeRange } = (0, _pluginsystem.useTimeRange)();
37
- const chartRef = (0, _react.useRef)();
38
- const handleEvents = (0, _react.useMemo)(()=>{
39
- return {
40
- datazoom: (params)=>{
41
- if (params.batch[0] === undefined) return;
42
- const xAxisStartValue = params.batch?.[0]?.startValue;
43
- const xAxisEndValue = params.batch?.[0]?.endValue;
44
- if (xAxisStartValue !== undefined && xAxisEndValue !== undefined) {
45
- const zoomEvent = {
46
- start: xAxisStartValue,
47
- end: xAxisEndValue
48
- };
49
- setTimeRange({
50
- start: new Date(zoomEvent.start),
51
- end: new Date(zoomEvent.end)
52
- });
53
- }
54
- },
55
- finished: ()=>{
56
- if (chartRef.current !== undefined) {
57
- (0, _components.enableDataZoom)(chartRef.current);
58
- }
59
- }
60
- };
61
- }, [
62
- setTimeRange
63
- ]);
64
- const seriesData = (0, _react.useMemo)(()=>{
65
- const timeLine = data.timeline || {};
66
- const startTime = timeLine.startTime;
67
- const durationDelta = timeLine.durationDelta;
68
- return timeLine.samples.map((sample, index)=>({
69
- id: index,
70
- value: [
71
- (startTime + index * durationDelta) * 1000,
72
- Number(sample)
73
- ]
74
- }));
75
- }, [
76
- data.timeline
77
- ]);
78
- const option = (0, _react.useMemo)(()=>{
79
- const seriesMapping = {
80
- type: 'line',
81
- color: theme.palette.primary.main,
82
- sampling: 'lttb',
83
- showSymbol: true,
84
- showAllSymbol: true,
85
- symbolSize: LINE_WIDTH + POINT_SIZE_OFFSET,
86
- lineStyle: {
87
- width: LINE_WIDTH,
88
- opacity: 0.95
89
- },
90
- areaStyle: {
91
- opacity: 0
92
- },
93
- data: seriesData
94
- };
95
- const timeLine = data.timeline || {};
96
- const option = {
97
- series: seriesMapping,
98
- xAxis: {
99
- type: 'time',
100
- min: timeLine.startTime * 1000,
101
- max: (timeLine.startTime + timeLine.samples.length * timeLine.durationDelta) * 1000,
102
- axisLabel: {
103
- hideOverlap: true
104
- },
105
- axisPointer: {
106
- snap: false
107
- }
108
- },
109
- yAxis: {
110
- type: 'value',
111
- axisLabel: {
112
- formatter: (value)=>{
113
- return (0, _format.formatItemValue)(data.metadata?.units, value);
114
- }
115
- }
116
- },
117
- animation: false,
118
- tooltip: {
119
- show: true,
120
- showContent: true,
121
- trigger: 'axis',
122
- appendToBody: true,
123
- confine: true,
124
- backgroundColor: theme.palette.background.paper,
125
- borderColor: theme.palette.background.paper,
126
- textStyle: {
127
- color: theme.palette.text.primary
128
- },
129
- formatter: (params)=>(0, _seriestooltip.getSeriesTooltip)(params[0]?.data || {}, data.metadata?.units || '', data.metadata?.name || '', theme.palette.primary.main, theme.palette.divider)
130
- },
131
- axisPointer: {
132
- type: 'line',
133
- z: 0,
134
- triggerEmphasis: true,
135
- triggerTooltip: false,
136
- snap: false
137
- },
138
- toolbox: {
139
- feature: {
140
- dataZoom: {
141
- icon: null,
142
- yAxisIndex: 'none'
143
- }
144
- }
145
- },
146
- grid: {
147
- left: 10,
148
- right: 10,
149
- top: 10,
150
- bottom: 10
151
- }
152
- };
153
- return option;
154
- }, [
155
- data.timeline,
156
- data.metadata,
157
- seriesData,
158
- theme
159
- ]);
160
- const seriesChart = (0, _react.useMemo)(()=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.EChart, {
161
- style: {
162
- width: width,
163
- height: height
164
- },
165
- option: option,
166
- theme: chartsTheme.echartsTheme,
167
- onEvents: handleEvents,
168
- _instance: chartRef
169
- }), [
170
- chartsTheme.echartsTheme,
171
- height,
172
- option,
173
- width,
174
- handleEvents
175
- ]);
176
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
177
- width: width,
178
- height: height,
179
- alignItems: "center",
180
- justifyContent: "center",
181
- onMouseEnter: ()=>{
182
- // This is necessary to ensure that the data zoom feature is enabled after the theme is changed.
183
- if (chartRef.current !== undefined) {
184
- (0, _components.enableDataZoom)(chartRef.current);
185
- }
186
- },
187
- children: seriesChart
188
- });
189
- }
@@ -1,202 +0,0 @@
1
- // Copyright The Perses 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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "Settings", {
18
- enumerable: true,
19
- get: function() {
20
- return Settings;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _react = require("react");
25
- const _Refresh = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Refresh"));
26
- const _Palette = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Palette"));
27
- const _material = require("@mui/material");
28
- const _components = require("@perses-dev/components");
29
- const _uitext = require("../utils/ui-text");
30
- function _interop_require_default(obj) {
31
- return obj && obj.__esModule ? obj : {
32
- default: obj
33
- };
34
- }
35
- function Settings(props) {
36
- const { value, selectedId, onSelectedIdChange, onChangePalette, onDisplayChange } = props;
37
- const theme = (0, _material.useTheme)();
38
- const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
39
- const open = Boolean(anchorEl);
40
- const customButtonStyle = {
41
- fontSize: '12px',
42
- padding: '2px 6px',
43
- minWidth: 'auto'
44
- };
45
- const handleChangeColorShemeClick = (event)=>{
46
- setAnchorEl(event.currentTarget);
47
- };
48
- const handleByPackageNameClick = ()=>{
49
- onChangePalette('package-name');
50
- handleClose();
51
- };
52
- const handleByValueClick = ()=>{
53
- onChangePalette('value');
54
- handleClose();
55
- };
56
- const handleClose = ()=>{
57
- setAnchorEl(null);
58
- };
59
- const isTableSelected = ()=>selectedView === 'table';
60
- const isFlameGraphSelected = ()=>selectedView === 'flame-graph';
61
- const isBothSelected = ()=>selectedView === 'both';
62
- // Update selected view based on the value of showTable and showFlameGraph
63
- const selectedView = (0, _react.useMemo)(()=>{
64
- if (!value.showTable && !value.showFlameGraph) {
65
- return 'none';
66
- } else if (value.showTable && value.showFlameGraph) {
67
- return 'both';
68
- } else if (value.showTable) {
69
- return 'table';
70
- } else {
71
- return 'flame-graph';
72
- }
73
- }, [
74
- value.showTable,
75
- value.showFlameGraph
76
- ]);
77
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
78
- spacing: "10px",
79
- direction: "row",
80
- justifyContent: "center",
81
- alignItems: "center",
82
- children: [
83
- selectedId !== 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
84
- description: _uitext.TOOLTIP_TEXT.resetFlameGraph,
85
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ToolbarIconButton, {
86
- "aria-label": _uitext.TOOLTIP_TEXT.resetFlameGraph,
87
- onClick: ()=>onSelectedIdChange(0),
88
- color: "primary",
89
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Refresh.default, {
90
- fontSize: "small"
91
- })
92
- })
93
- }),
94
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
95
- children: [
96
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
97
- description: _uitext.TOOLTIP_TEXT.changeColorSheme,
98
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.ToolbarIconButton, {
99
- id: "change-color-sheme-button",
100
- "aria-label": _uitext.TOOLTIP_TEXT.changeColorSheme,
101
- "aria-controls": open ? 'change-color-sheme-menu' : undefined,
102
- "aria-haspopup": "true",
103
- "aria-expanded": open ? 'true' : undefined,
104
- onClick: handleChangeColorShemeClick,
105
- color: "primary",
106
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Palette.default, {
107
- fontSize: "small"
108
- })
109
- })
110
- }),
111
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Menu, {
112
- id: "change-color-sheme-menu",
113
- slotProps: {
114
- list: {
115
- 'aria-labelledby': 'change-color-sheme-button'
116
- }
117
- },
118
- anchorEl: anchorEl,
119
- open: open,
120
- onClose: handleClose,
121
- slots: {
122
- transition: _material.Fade
123
- },
124
- anchorOrigin: {
125
- vertical: 'bottom',
126
- horizontal: 'center'
127
- },
128
- transformOrigin: {
129
- vertical: 'top',
130
- horizontal: 'center'
131
- },
132
- sx: {
133
- mt: 1,
134
- '& .MuiPaper-root': {
135
- backgroundColor: theme.palette.background.paper,
136
- padding: '0 5px'
137
- },
138
- '& .MuiMenuItem-root:hover': {
139
- backgroundColor: theme.palette.action.hover
140
- }
141
- },
142
- children: [
143
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
144
- onClick: handleByPackageNameClick,
145
- selected: value.palette === 'package-name',
146
- children: "By package name"
147
- }),
148
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
149
- onClick: handleByValueClick,
150
- selected: value.palette === 'value',
151
- children: "By value"
152
- })
153
- ]
154
- })
155
- ]
156
- }),
157
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
158
- direction: "row",
159
- sx: {
160
- border: `1px solid ${theme.palette.primary.main}`,
161
- borderRadius: `${theme.shape.borderRadius}px`,
162
- padding: '2px'
163
- },
164
- children: [
165
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
166
- description: _uitext.TOOLTIP_TEXT.showTable,
167
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
168
- variant: isTableSelected() ? 'contained' : 'text',
169
- color: "primary",
170
- size: "small",
171
- onClick: ()=>onDisplayChange('table'),
172
- sx: customButtonStyle,
173
- children: "Table"
174
- })
175
- }),
176
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
177
- description: _uitext.TOOLTIP_TEXT.showFlameGraph,
178
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
179
- variant: isFlameGraphSelected() ? 'contained' : 'text',
180
- color: "primary",
181
- size: "small",
182
- onClick: ()=>onDisplayChange('flame-graph'),
183
- sx: customButtonStyle,
184
- children: "Flame Graph"
185
- })
186
- }),
187
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
188
- description: _uitext.TOOLTIP_TEXT.showBoth,
189
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
190
- variant: isBothSelected() ? 'contained' : 'text',
191
- color: "primary",
192
- size: "small",
193
- onClick: ()=>onDisplayChange('both'),
194
- sx: customButtonStyle,
195
- children: "Both"
196
- })
197
- })
198
- ]
199
- })
200
- ]
201
- });
202
- }
@@ -1,37 +0,0 @@
1
- // Copyright The Perses 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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "SwitchSelector", {
18
- enumerable: true,
19
- get: function() {
20
- return SwitchSelector;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _components = require("@perses-dev/components");
25
- const _material = require("@mui/material");
26
- function SwitchSelector({ onChange, value, label }) {
27
- const handleValuesChange = (_, checked)=>{
28
- onChange(checked);
29
- };
30
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
31
- label: label,
32
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
33
- checked: value,
34
- onChange: handleValuesChange
35
- })
36
- });
37
- }
@@ -1,143 +0,0 @@
1
- // Copyright The Perses 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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- Object.defineProperty(exports, "TableChart", {
18
- enumerable: true,
19
- get: function() {
20
- return TableChart;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _react = require("react");
25
- const _material = require("@mui/material");
26
- const _components = require("@perses-dev/components");
27
- const _datatransform = require("../utils/data-transform");
28
- const _format = require("../utils/format");
29
- const _SearchBar = require("./SearchBar");
30
- const LARGE_PANEL_TRESHOLD = 600; // heigth treshold to switch to large panel mode
31
- const PADDING_TOP = 8;
32
- const SCROLL_BAR_WIDTH = 15;
33
- const SEARCH_BAR_HEIGHT = 50;
34
- function TableChart(props) {
35
- const { width, height, data, searchValue, onSearchValueChange, onSelectedIdChange } = props;
36
- const theme = (0, _material.useTheme)();
37
- const availableHeight = height;
38
- const availableWidth = width - 10;
39
- const tableData = (0, _react.useMemo)(()=>{
40
- return (0, _datatransform.tableRecursionJson)(data.profile.stackTrace, searchValue);
41
- }, [
42
- data,
43
- searchValue
44
- ]);
45
- const columns = (0, _react.useMemo)(()=>{
46
- const unit = data.metadata?.units || '';
47
- const columnSettings = [
48
- {
49
- accessorKey: 'name',
50
- header: 'Name',
51
- headerDescription: 'Function name',
52
- align: 'left',
53
- enableSorting: true,
54
- width: 0.5 * availableWidth,
55
- cell: (ctx)=>{
56
- const cellValue = ctx.getValue();
57
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Link, {
58
- href: "#",
59
- underline: "hover",
60
- onClick: (e)=>{
61
- e.preventDefault();
62
- const currentSample = ctx.row.original;
63
- onSelectedIdChange(currentSample.id); // focus on this item in the flame graph
64
- onSearchValueChange(currentSample.name);
65
- },
66
- children: cellValue
67
- });
68
- },
69
- cellDescription: ()=>''
70
- },
71
- {
72
- accessorKey: 'self',
73
- header: 'Self',
74
- headerDescription: 'Function self samples',
75
- align: 'right',
76
- enableSorting: true,
77
- width: 0.25 * availableWidth - SCROLL_BAR_WIDTH,
78
- cell: (ctx)=>{
79
- const cellValue = ctx.getValue();
80
- return (0, _format.formatItemValue)(unit, cellValue);
81
- }
82
- },
83
- {
84
- accessorKey: 'total',
85
- header: 'Total',
86
- headerDescription: 'Function total samples',
87
- align: 'right',
88
- enableSorting: true,
89
- width: 0.25 * availableWidth,
90
- cell: (ctx)=>{
91
- const cellValue = ctx.getValue();
92
- return (0, _format.formatItemValue)(unit, cellValue);
93
- }
94
- }
95
- ];
96
- return columnSettings;
97
- }, [
98
- data.metadata?.units,
99
- availableWidth,
100
- onSearchValueChange,
101
- onSelectedIdChange
102
- ]);
103
- const [sorting, setSorting] = (0, _react.useState)([
104
- {
105
- id: 'total',
106
- desc: true
107
- }
108
- ]);
109
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
110
- width: availableWidth,
111
- height: availableHeight,
112
- gap: 1,
113
- sx: {
114
- '& .MuiTable-root': {
115
- borderCollapse: 'collapse'
116
- },
117
- '& .MuiTableCell-root': {
118
- borderBottom: `1px solid ${theme.palette.divider}`,
119
- borderRight: `1px solid ${theme.palette.divider}`,
120
- '&:last-child': {
121
- borderRight: 'none'
122
- }
123
- }
124
- },
125
- children: [
126
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_SearchBar.SearchBar, {
127
- searchValue: searchValue,
128
- onSearchValueChange: onSearchValueChange
129
- }),
130
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.Table, {
131
- data: tableData,
132
- columns: columns,
133
- height: availableHeight - PADDING_TOP - SEARCH_BAR_HEIGHT,
134
- width: availableWidth,
135
- density: availableHeight < LARGE_PANEL_TRESHOLD ? 'compact' : 'standard',
136
- defaultColumnWidth: "auto",
137
- defaultColumnHeight: "auto",
138
- sorting: sorting,
139
- onSortingChange: setSorting
140
- })
141
- ]
142
- });
143
- }
@@ -1,39 +0,0 @@
1
- // Copyright The Perses 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
- "use strict";
14
- Object.defineProperty(exports, "__esModule", {
15
- value: true
16
- });
17
- _export_star(require("./CustomBreadcrumb"), exports);
18
- _export_star(require("./FlameChart"), exports);
19
- _export_star(require("./FlameChartOptionsEditorSettings"), exports);
20
- _export_star(require("./FlameChartPanel"), exports);
21
- _export_star(require("./PaletteSelector"), exports);
22
- _export_star(require("./SearchBar"), exports);
23
- _export_star(require("./SeriesChart"), exports);
24
- _export_star(require("./Settings"), exports);
25
- _export_star(require("./SwitchSelector"), exports);
26
- _export_star(require("./TableChart"), exports);
27
- function _export_star(from, to) {
28
- Object.keys(from).forEach(function(k) {
29
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
30
- Object.defineProperty(to, k, {
31
- enumerable: true,
32
- get: function() {
33
- return from[k];
34
- }
35
- });
36
- }
37
- });
38
- return from;
39
- }
package/lib/cjs/env.d.js DELETED
@@ -1,14 +0,0 @@
1
- // Copyright The Perses 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
- /// <reference types="@rsbuild/core/types" />
14
- "use strict";