@perses-dev/tracing-gantt-chart-plugin 0.13.0 → 0.14.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 (223) hide show
  1. package/__mf/js/{TracingGanttChart.ca3d72b7.js → TracingGanttChart.4460ff1c.js} +4 -4
  2. package/__mf/js/async/121.5b3411ef.js +2 -0
  3. package/__mf/js/async/192.b0550d58.js +1 -0
  4. package/__mf/js/async/2.2a545358.js +1 -0
  5. package/__mf/js/async/235.831bea3e.js +1 -0
  6. package/__mf/js/async/247.e4d2c197.js +1 -0
  7. package/__mf/js/async/274.eee92e86.js +2 -0
  8. package/__mf/js/async/356.43c6ada2.js +1 -0
  9. package/__mf/js/async/392.a3f49cf0.js +2 -0
  10. package/__mf/js/async/407.6e0c3fb4.js +4 -0
  11. package/__mf/js/async/407.6e0c3fb4.js.LICENSE.txt +9 -0
  12. package/__mf/js/async/43.cbae1eef.js +2 -0
  13. package/__mf/js/async/436.4db73a03.js +110 -0
  14. package/__mf/js/async/470.8d6cfc01.js +2 -0
  15. package/__mf/js/async/496.9a3d3d3d.js +1 -0
  16. package/__mf/js/async/587.849f1255.js +1 -0
  17. package/__mf/js/async/588.39275df8.js +1 -0
  18. package/__mf/js/async/616.4d217c10.js +1 -0
  19. package/__mf/js/async/665.2b61216d.js +2 -0
  20. package/__mf/js/async/672.790df7d1.js +1 -0
  21. package/__mf/js/async/71.4eb8fa2f.js +1 -0
  22. package/__mf/js/async/77.27ff39b8.js +1 -0
  23. package/__mf/js/async/776.f19f62f3.js +43 -0
  24. package/__mf/js/async/{30.991f7ee4.js.LICENSE.txt → 776.f19f62f3.js.LICENSE.txt} +41 -1
  25. package/__mf/js/async/873.a00a9302.js +1 -0
  26. package/__mf/js/async/941.7ee2dbf0.js +2 -0
  27. package/__mf/js/async/968.b61d3c02.js +1 -0
  28. package/__mf/js/async/978.4227a27e.js +1 -0
  29. package/__mf/js/async/__federation_expose_TracingGanttChart.303e7806.js +1 -0
  30. package/__mf/js/async/lib-router.a8607481.js +2 -0
  31. package/__mf/js/{main.9e057781.js → main.7b791d2a.js} +2 -2
  32. package/lib/PanelActions.d.ts +3 -3
  33. package/lib/PanelActions.d.ts.map +1 -1
  34. package/lib/PanelActions.js +4 -4
  35. package/lib/PanelActions.js.map +1 -1
  36. package/lib/TracingGanttChart/DetailPane/Attributes.d.ts +4 -4
  37. package/lib/TracingGanttChart/DetailPane/Attributes.d.ts.map +1 -1
  38. package/lib/TracingGanttChart/DetailPane/Attributes.js +4 -4
  39. package/lib/TracingGanttChart/DetailPane/Attributes.js.map +1 -1
  40. package/lib/TracingGanttChart/DetailPane/DetailPane.d.ts +3 -3
  41. package/lib/TracingGanttChart/DetailPane/DetailPane.d.ts.map +1 -1
  42. package/lib/TracingGanttChart/DetailPane/DetailPane.js +6 -6
  43. package/lib/TracingGanttChart/DetailPane/DetailPane.js.map +1 -1
  44. package/lib/TracingGanttChart/DetailPane/SpanEvents.d.ts +3 -3
  45. package/lib/TracingGanttChart/DetailPane/SpanEvents.d.ts.map +1 -1
  46. package/lib/TracingGanttChart/DetailPane/SpanEvents.js +7 -7
  47. package/lib/TracingGanttChart/DetailPane/SpanEvents.js.map +1 -1
  48. package/lib/TracingGanttChart/DetailPane/SpanLinks.d.ts +3 -3
  49. package/lib/TracingGanttChart/DetailPane/SpanLinks.d.ts.map +1 -1
  50. package/lib/TracingGanttChart/DetailPane/SpanLinks.js +4 -4
  51. package/lib/TracingGanttChart/DetailPane/SpanLinks.js.map +1 -1
  52. package/lib/TracingGanttChart/GanttTable/GanttTable.d.ts +4 -4
  53. package/lib/TracingGanttChart/GanttTable/GanttTable.d.ts.map +1 -1
  54. package/lib/TracingGanttChart/GanttTable/GanttTable.js +8 -8
  55. package/lib/TracingGanttChart/GanttTable/GanttTable.js.map +1 -1
  56. package/lib/TracingGanttChart/GanttTable/GanttTableHeader.d.ts +3 -3
  57. package/lib/TracingGanttChart/GanttTable/GanttTableHeader.d.ts.map +1 -1
  58. package/lib/TracingGanttChart/GanttTable/GanttTableHeader.js +3 -3
  59. package/lib/TracingGanttChart/GanttTable/GanttTableHeader.js.map +1 -1
  60. package/lib/TracingGanttChart/GanttTable/GanttTableProvider.d.ts +1 -1
  61. package/lib/TracingGanttChart/GanttTable/GanttTableProvider.d.ts.map +1 -1
  62. package/lib/TracingGanttChart/GanttTable/GanttTableProvider.js +2 -2
  63. package/lib/TracingGanttChart/GanttTable/GanttTableProvider.js.map +1 -1
  64. package/lib/TracingGanttChart/GanttTable/GanttTableRow.d.ts +3 -3
  65. package/lib/TracingGanttChart/GanttTable/GanttTableRow.d.ts.map +1 -1
  66. package/lib/TracingGanttChart/GanttTable/GanttTableRow.js +5 -5
  67. package/lib/TracingGanttChart/GanttTable/GanttTableRow.js.map +1 -1
  68. package/lib/TracingGanttChart/GanttTable/ResizableDivider.d.ts +1 -1
  69. package/lib/TracingGanttChart/GanttTable/ResizableDivider.d.ts.map +1 -1
  70. package/lib/TracingGanttChart/GanttTable/ResizableDivider.js +3 -3
  71. package/lib/TracingGanttChart/GanttTable/ResizableDivider.js.map +1 -1
  72. package/lib/TracingGanttChart/GanttTable/SpanDuration.d.ts +4 -4
  73. package/lib/TracingGanttChart/GanttTable/SpanDuration.d.ts.map +1 -1
  74. package/lib/TracingGanttChart/GanttTable/SpanDuration.js +4 -4
  75. package/lib/TracingGanttChart/GanttTable/SpanDuration.js.map +1 -1
  76. package/lib/TracingGanttChart/GanttTable/SpanIndents.d.ts +2 -2
  77. package/lib/TracingGanttChart/GanttTable/SpanIndents.d.ts.map +1 -1
  78. package/lib/TracingGanttChart/GanttTable/SpanIndents.js +5 -5
  79. package/lib/TracingGanttChart/GanttTable/SpanIndents.js.map +1 -1
  80. package/lib/TracingGanttChart/GanttTable/SpanLinksButton.d.ts +3 -3
  81. package/lib/TracingGanttChart/GanttTable/SpanLinksButton.d.ts.map +1 -1
  82. package/lib/TracingGanttChart/GanttTable/SpanLinksButton.js +5 -5
  83. package/lib/TracingGanttChart/GanttTable/SpanLinksButton.js.map +1 -1
  84. package/lib/TracingGanttChart/GanttTable/SpanName.d.ts +3 -3
  85. package/lib/TracingGanttChart/GanttTable/SpanName.d.ts.map +1 -1
  86. package/lib/TracingGanttChart/GanttTable/SpanName.js +5 -5
  87. package/lib/TracingGanttChart/GanttTable/SpanName.js.map +1 -1
  88. package/lib/TracingGanttChart/MiniGanttChart/Canvas.d.ts +4 -4
  89. package/lib/TracingGanttChart/MiniGanttChart/Canvas.d.ts.map +1 -1
  90. package/lib/TracingGanttChart/MiniGanttChart/Canvas.js +8 -8
  91. package/lib/TracingGanttChart/MiniGanttChart/Canvas.js.map +1 -1
  92. package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.d.ts +4 -4
  93. package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.d.ts.map +1 -1
  94. package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.js +4 -4
  95. package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.js.map +1 -1
  96. package/lib/TracingGanttChart/MiniGanttChart/draw.d.ts +1 -1
  97. package/lib/TracingGanttChart/MiniGanttChart/draw.d.ts.map +1 -1
  98. package/lib/TracingGanttChart/MiniGanttChart/draw.js +2 -2
  99. package/lib/TracingGanttChart/MiniGanttChart/draw.js.map +1 -1
  100. package/lib/TracingGanttChart/Search.d.ts +2 -2
  101. package/lib/TracingGanttChart/Search.d.ts.map +1 -1
  102. package/lib/TracingGanttChart/Search.js +7 -7
  103. package/lib/TracingGanttChart/Search.js.map +1 -1
  104. package/lib/TracingGanttChart/Ticks.d.ts +3 -3
  105. package/lib/TracingGanttChart/Ticks.d.ts.map +1 -1
  106. package/lib/TracingGanttChart/Ticks.js +3 -3
  107. package/lib/TracingGanttChart/Ticks.js.map +1 -1
  108. package/lib/TracingGanttChart/TraceHeaderBar.d.ts +3 -3
  109. package/lib/TracingGanttChart/TraceHeaderBar.d.ts.map +1 -1
  110. package/lib/TracingGanttChart/TraceHeaderBar.js +6 -6
  111. package/lib/TracingGanttChart/TraceHeaderBar.js.map +1 -1
  112. package/lib/TracingGanttChart/TracingGanttChart.d.ts +3 -3
  113. package/lib/TracingGanttChart/TracingGanttChart.d.ts.map +1 -1
  114. package/lib/TracingGanttChart/TracingGanttChart.js +13 -11
  115. package/lib/TracingGanttChart/TracingGanttChart.js.map +1 -1
  116. package/lib/TracingGanttChart/palette.js +1 -1
  117. package/lib/TracingGanttChart/palette.js.map +1 -1
  118. package/lib/TracingGanttChart/trace.d.ts +2 -2
  119. package/lib/TracingGanttChart/trace.d.ts.map +1 -1
  120. package/lib/TracingGanttChart/trace.js +1 -1
  121. package/lib/TracingGanttChart/trace.js.map +1 -1
  122. package/lib/TracingGanttChart/utils.d.ts +3 -3
  123. package/lib/TracingGanttChart/utils.d.ts.map +1 -1
  124. package/lib/TracingGanttChart/utils.js +2 -2
  125. package/lib/TracingGanttChart/utils.js.map +1 -1
  126. package/lib/TracingGanttChart.d.ts +3 -3
  127. package/lib/TracingGanttChart.d.ts.map +1 -1
  128. package/lib/TracingGanttChart.js +3 -3
  129. package/lib/TracingGanttChart.js.map +1 -1
  130. package/lib/TracingGanttChartPanel.d.ts +4 -4
  131. package/lib/TracingGanttChartPanel.d.ts.map +1 -1
  132. package/lib/TracingGanttChartPanel.js +4 -4
  133. package/lib/TracingGanttChartPanel.js.map +1 -1
  134. package/lib/bootstrap.js +2 -2
  135. package/lib/getPluginModule.d.ts +1 -1
  136. package/lib/getPluginModule.d.ts.map +1 -1
  137. package/lib/getPluginModule.js +3 -1
  138. package/lib/getPluginModule.js.map +1 -1
  139. package/lib/index-federation.js +1 -1
  140. package/lib/index.js +4 -4
  141. package/lib/index.js.map +1 -1
  142. package/lib/setup-tests.d.ts +1 -1
  143. package/lib/setup-tests.d.ts.map +1 -1
  144. package/lib/setup-tests.js +2 -2
  145. package/lib/setup-tests.js.map +1 -1
  146. package/lib/test/convert/jaeger.d.ts +1 -1
  147. package/lib/test/convert/jaeger.d.ts.map +1 -1
  148. package/lib/test/convert/jaeger.js.map +1 -1
  149. package/mf-manifest.json +35 -34
  150. package/mf-stats.json +35 -34
  151. package/package.json +10 -10
  152. package/__mf/js/async/121.1fc97c57.js +0 -2
  153. package/__mf/js/async/177.27fced63.js +0 -1
  154. package/__mf/js/async/192.ea308602.js +0 -1
  155. package/__mf/js/async/193.6692daa9.js +0 -1
  156. package/__mf/js/async/2.c5f68593.js +0 -1
  157. package/__mf/js/async/235.4f4ad5f0.js +0 -1
  158. package/__mf/js/async/274.03fc3289.js +0 -2
  159. package/__mf/js/async/30.991f7ee4.js +0 -39
  160. package/__mf/js/async/356.2e3c02c9.js +0 -1
  161. package/__mf/js/async/392.eb9b3bb9.js +0 -2
  162. package/__mf/js/async/43.b9d7bc56.js +0 -2
  163. package/__mf/js/async/47.514dc87f.js +0 -1
  164. package/__mf/js/async/470.9743e21d.js +0 -2
  165. package/__mf/js/async/546.b40699cb.js +0 -24
  166. package/__mf/js/async/546.b40699cb.js.LICENSE.txt +0 -19
  167. package/__mf/js/async/570.9d51e826.js +0 -7
  168. package/__mf/js/async/570.9d51e826.js.LICENSE.txt +0 -39
  169. package/__mf/js/async/581.aa52d024.js +0 -1
  170. package/__mf/js/async/587.f49a06d9.js +0 -1
  171. package/__mf/js/async/588.46394f24.js +0 -1
  172. package/__mf/js/async/616.09a93b54.js +0 -1
  173. package/__mf/js/async/71.f0d71a40.js +0 -1
  174. package/__mf/js/async/873.34370b2c.js +0 -1
  175. package/__mf/js/async/887.027eb62b.js +0 -110
  176. package/__mf/js/async/941.3d671d54.js +0 -2
  177. package/__mf/js/async/968.1ac51448.js +0 -1
  178. package/__mf/js/async/978.0c50ecf5.js +0 -1
  179. package/__mf/js/async/__federation_expose_TracingGanttChart.9c074bea.js +0 -1
  180. package/__mf/js/async/lib-router.5f492283.js +0 -2
  181. package/lib/cjs/PanelActions.js +0 -88
  182. package/lib/cjs/TracingGanttChart/DetailPane/Attributes.js +0 -204
  183. package/lib/cjs/TracingGanttChart/DetailPane/DetailPane.js +0 -129
  184. package/lib/cjs/TracingGanttChart/DetailPane/SpanEvents.js +0 -113
  185. package/lib/cjs/TracingGanttChart/DetailPane/SpanLinks.js +0 -72
  186. package/lib/cjs/TracingGanttChart/GanttTable/GanttTable.js +0 -154
  187. package/lib/cjs/TracingGanttChart/GanttTable/GanttTableHeader.js +0 -64
  188. package/lib/cjs/TracingGanttChart/GanttTable/GanttTableProvider.js +0 -60
  189. package/lib/cjs/TracingGanttChart/GanttTable/GanttTableRow.js +0 -77
  190. package/lib/cjs/TracingGanttChart/GanttTable/ResizableDivider.js +0 -98
  191. package/lib/cjs/TracingGanttChart/GanttTable/SpanDuration.js +0 -81
  192. package/lib/cjs/TracingGanttChart/GanttTable/SpanIndents.js +0 -97
  193. package/lib/cjs/TracingGanttChart/GanttTable/SpanLinksButton.js +0 -108
  194. package/lib/cjs/TracingGanttChart/GanttTable/SpanName.js +0 -83
  195. package/lib/cjs/TracingGanttChart/MiniGanttChart/Canvas.js +0 -256
  196. package/lib/cjs/TracingGanttChart/MiniGanttChart/MiniGanttChart.js +0 -59
  197. package/lib/cjs/TracingGanttChart/MiniGanttChart/draw.js +0 -45
  198. package/lib/cjs/TracingGanttChart/Search.js +0 -154
  199. package/lib/cjs/TracingGanttChart/Ticks.js +0 -106
  200. package/lib/cjs/TracingGanttChart/TraceHeaderBar.js +0 -159
  201. package/lib/cjs/TracingGanttChart/TracingGanttChart.js +0 -122
  202. package/lib/cjs/TracingGanttChart/palette.js +0 -83
  203. package/lib/cjs/TracingGanttChart/trace.js +0 -137
  204. package/lib/cjs/TracingGanttChart/utils.js +0 -117
  205. package/lib/cjs/TracingGanttChart.js +0 -37
  206. package/lib/cjs/TracingGanttChartPanel.js +0 -66
  207. package/lib/cjs/bootstrap.js +0 -26
  208. package/lib/cjs/env.d.js +0 -14
  209. package/lib/cjs/gantt-chart-model.js +0 -28
  210. package/lib/cjs/getPluginModule.js +0 -39
  211. package/lib/cjs/index-federation.js +0 -55
  212. package/lib/cjs/index.js +0 -39
  213. package/lib/cjs/setup-tests.js +0 -19
  214. package/lib/cjs/test/convert/jaeger.js +0 -86
  215. /package/__mf/css/async/{570.85c2cbf6.css → 776.85c2cbf6.css} +0 -0
  216. /package/__mf/js/async/{121.1fc97c57.js.LICENSE.txt → 121.5b3411ef.js.LICENSE.txt} +0 -0
  217. /package/__mf/js/async/{274.03fc3289.js.LICENSE.txt → 274.eee92e86.js.LICENSE.txt} +0 -0
  218. /package/__mf/js/async/{392.eb9b3bb9.js.LICENSE.txt → 392.a3f49cf0.js.LICENSE.txt} +0 -0
  219. /package/__mf/js/async/{43.b9d7bc56.js.LICENSE.txt → 43.cbae1eef.js.LICENSE.txt} +0 -0
  220. /package/__mf/js/async/{887.027eb62b.js.LICENSE.txt → 436.4db73a03.js.LICENSE.txt} +0 -0
  221. /package/__mf/js/async/{470.9743e21d.js.LICENSE.txt → 470.8d6cfc01.js.LICENSE.txt} +0 -0
  222. /package/__mf/js/async/{941.3d671d54.js.LICENSE.txt → 941.7ee2dbf0.js.LICENSE.txt} +0 -0
  223. /package/__mf/js/async/{lib-router.5f492283.js.LICENSE.txt → lib-router.a8607481.js.LICENSE.txt} +0 -0
@@ -1,256 +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, "Canvas", {
18
- enumerable: true,
19
- get: function() {
20
- return Canvas;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _material = require("@mui/material");
25
- const _useresizeobserver = /*#__PURE__*/ _interop_require_default(require("use-resize-observer"));
26
- const _react = require("react");
27
- const _pluginsystem = require("@perses-dev/plugin-system");
28
- const _components = require("@perses-dev/components");
29
- const _Ticks = require("../Ticks");
30
- const _utils = require("../utils");
31
- const _draw = require("./draw");
32
- function _interop_require_default(obj) {
33
- return obj && obj.__esModule ? obj : {
34
- default: obj
35
- };
36
- }
37
- const CANVAS_HEIGHT = 60;
38
- function Canvas(props) {
39
- const { options, trace, viewport, setViewport } = props;
40
- const muiTheme = (0, _material.useTheme)();
41
- const chartsTheme = (0, _components.useChartsTheme)();
42
- // the <canvas> element must have an absolute width and height to avoid rendering problems
43
- // the wrapper box is required to get the available dimensions for the <canvas> element
44
- const { width, ref: wrapperRef } = (0, _useresizeobserver.default)();
45
- const height = CANVAS_HEIGHT;
46
- const canvasRef = (0, _react.useRef)(null);
47
- const [mouseState, setMouseState] = (0, _react.useState)({
48
- type: 'none'
49
- });
50
- const traceDuration = trace.endTimeUnixMs - trace.startTimeUnixMs;
51
- const relativeCutoffLeft = (viewport.startTimeUnixMs - trace.startTimeUnixMs) / traceDuration;
52
- const relativeCutoffRight = (trace.endTimeUnixMs - viewport.endTimeUnixMs) / traceDuration;
53
- const spanColorGenerator = (0, _react.useCallback)((span)=>(0, _utils.getSpanColor)(muiTheme, chartsTheme, options.visual?.palette?.mode, span), [
54
- muiTheme,
55
- chartsTheme,
56
- options.visual?.palette?.mode
57
- ]);
58
- (0, _react.useEffect)(()=>{
59
- if (!canvasRef.current || !width || !height) return;
60
- const ctx = canvasRef.current.getContext('2d');
61
- if (!ctx) return;
62
- (0, _draw.drawSpans)(ctx, width, height, trace, spanColorGenerator);
63
- }, [
64
- width,
65
- height,
66
- trace,
67
- spanColorGenerator
68
- ]);
69
- const translateCursorToTime = (e)=>{
70
- if (!canvasRef.current || !width) return 0;
71
- // e.nativeEvent.offsetX doesn't work when sliding over a tick box
72
- const offsetX = e.clientX - canvasRef.current.getBoundingClientRect().left;
73
- return trace.startTimeUnixMs + offsetX / width * traceDuration;
74
- };
75
- const handleMouseDown = (e)=>{
76
- e.preventDefault();
77
- if (!(e.target instanceof HTMLElement)) return;
78
- const isDefaultViewport = viewport.startTimeUnixMs === trace.startTimeUnixMs && viewport.endTimeUnixMs === trace.endTimeUnixMs;
79
- const elem = e.target.dataset['elem'];
80
- const cursor = translateCursorToTime(e);
81
- if (elem === 'resizerLeft') {
82
- setMouseState({
83
- type: 'resize',
84
- fixedPoint: viewport.endTimeUnixMs
85
- });
86
- } else if (elem === 'resizerRight') {
87
- setMouseState({
88
- type: 'resize',
89
- fixedPoint: viewport.startTimeUnixMs
90
- });
91
- } else if (elem === 'cutoffBox' || isDefaultViewport) {
92
- setMouseState({
93
- type: 'resize',
94
- fixedPoint: cursor
95
- });
96
- setViewport({
97
- startTimeUnixMs: cursor,
98
- endTimeUnixMs: cursor
99
- });
100
- } else {
101
- setMouseState({
102
- type: 'drag',
103
- start: cursor - viewport.startTimeUnixMs,
104
- end: viewport.endTimeUnixMs - cursor
105
- });
106
- }
107
- };
108
- // need stable reference for window.removeEventListener() in useEffect() below
109
- const handleMouseMove = (0, _pluginsystem.useEvent)((e)=>{
110
- e.preventDefault();
111
- switch(mouseState.type){
112
- case 'none':
113
- return;
114
- case 'resize':
115
- {
116
- const pointA = mouseState.fixedPoint;
117
- const pointB = translateCursorToTime(e);
118
- let start, end;
119
- if (pointA < pointB) {
120
- start = pointA;
121
- end = pointB;
122
- } else {
123
- start = pointB;
124
- end = pointA;
125
- }
126
- setViewport({
127
- startTimeUnixMs: Math.max(start, trace.startTimeUnixMs),
128
- endTimeUnixMs: Math.min(end, trace.endTimeUnixMs)
129
- });
130
- return;
131
- }
132
- case 'drag':
133
- {
134
- // avoid using e.movementX here, as it skips events in chrome,
135
- // resulting in the mouse pointer moving faster than the viewport box
136
- const { start, end } = mouseState;
137
- let cursor = translateCursorToTime(e);
138
- if (cursor - start < trace.startTimeUnixMs) {
139
- cursor = trace.startTimeUnixMs + start;
140
- }
141
- if (cursor + end > trace.endTimeUnixMs) {
142
- cursor = trace.endTimeUnixMs - end;
143
- }
144
- setViewport({
145
- startTimeUnixMs: cursor - start,
146
- endTimeUnixMs: cursor + end
147
- });
148
- return;
149
- }
150
- }
151
- });
152
- // need stable reference for window.removeEventListener() in useEffect() below
153
- const handleMouseUp = (0, _pluginsystem.useEvent)((e)=>{
154
- e.preventDefault();
155
- setMouseState({
156
- type: 'none'
157
- });
158
- // reset viewport if start === end, i.e. a click without movement
159
- if (viewport.startTimeUnixMs === viewport.endTimeUnixMs) {
160
- setViewport({
161
- startTimeUnixMs: trace.startTimeUnixMs,
162
- endTimeUnixMs: trace.endTimeUnixMs
163
- });
164
- }
165
- });
166
- // capture mouseMove and mouseUp outside the element by attaching them to the window object
167
- (0, _react.useEffect)(()=>{
168
- function startMouseAction() {
169
- window.addEventListener('mousemove', handleMouseMove);
170
- window.addEventListener('mouseup', handleMouseUp);
171
- document.body.style.cursor = mouseState.type === 'resize' ? 'col-resize' : 'move';
172
- }
173
- function stopMouseAction() {
174
- window.removeEventListener('mousemove', handleMouseMove);
175
- window.removeEventListener('mouseup', handleMouseUp);
176
- document.body.style.cursor = 'inherit';
177
- }
178
- if (mouseState.type === 'none') {
179
- stopMouseAction();
180
- } else {
181
- startMouseAction();
182
- }
183
- return stopMouseAction;
184
- }, [
185
- mouseState,
186
- handleMouseMove,
187
- handleMouseUp
188
- ]);
189
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
190
- ref: wrapperRef,
191
- sx: {
192
- position: 'relative',
193
- height
194
- },
195
- onMouseDown: handleMouseDown,
196
- children: [
197
- /*#__PURE__*/ (0, _jsxruntime.jsx)("canvas", {
198
- ref: canvasRef,
199
- width: width,
200
- height: height,
201
- style: {
202
- position: 'absolute'
203
- }
204
- }),
205
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_Ticks.Ticks, {}),
206
- /*#__PURE__*/ (0, _jsxruntime.jsx)(CutoffBox, {
207
- "data-elem": "cutoffBox",
208
- style: {
209
- left: 0,
210
- width: `${relativeCutoffLeft * 100}%`
211
- }
212
- }),
213
- /*#__PURE__*/ (0, _jsxruntime.jsx)(Resizer, {
214
- "data-elem": "resizerLeft",
215
- style: {
216
- left: `${relativeCutoffLeft * 100}%`
217
- }
218
- }),
219
- /*#__PURE__*/ (0, _jsxruntime.jsx)(Resizer, {
220
- "data-elem": "resizerRight",
221
- style: {
222
- right: `${relativeCutoffRight * 100}%`
223
- }
224
- }),
225
- /*#__PURE__*/ (0, _jsxruntime.jsx)(CutoffBox, {
226
- "data-elem": "cutoffBox",
227
- style: {
228
- right: 0,
229
- width: `${relativeCutoffRight * 100}%`
230
- }
231
- })
232
- ]
233
- });
234
- }
235
- const CutoffBox = (0, _material.styled)(_material.Box)({
236
- position: 'absolute',
237
- height: '100%',
238
- backgroundColor: 'rgba(225, 225, 225, .5)'
239
- });
240
- const Resizer = (0, _material.styled)(_material.Box)(({ theme })=>({
241
- position: 'absolute',
242
- height: '100%',
243
- backgroundColor: theme.palette.divider,
244
- width: '2px',
245
- cursor: 'col-resize',
246
- // increase clickable area from 2px to 8px
247
- '&:before': {
248
- position: 'absolute',
249
- width: '8px',
250
- left: '-3px',
251
- top: 0,
252
- bottom: 0,
253
- content: '" "',
254
- zIndex: 1
255
- }
256
- }));
@@ -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, "MiniGanttChart", {
18
- enumerable: true,
19
- get: function() {
20
- return MiniGanttChart;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _material = require("@mui/material");
25
- const _Ticks = require("../Ticks");
26
- const _utils = require("../utils");
27
- const _Canvas = require("./Canvas");
28
- function MiniGanttChart(props) {
29
- const { options, trace, viewport, setViewport } = props;
30
- const theme = (0, _material.useTheme)();
31
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
32
- sx: {
33
- border: `1px solid ${theme.palette.divider}`,
34
- borderRadius: `${theme.shape.borderRadius}px`
35
- },
36
- children: [
37
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
38
- sx: {
39
- position: 'relative',
40
- height: _utils.rowHeight,
41
- borderBottom: `1px solid ${theme.palette.divider}`
42
- },
43
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Ticks.TicksHeader, {
44
- trace: trace,
45
- viewport: {
46
- startTimeUnixMs: trace.startTimeUnixMs,
47
- endTimeUnixMs: trace.endTimeUnixMs
48
- }
49
- })
50
- }),
51
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_Canvas.Canvas, {
52
- options: options,
53
- trace: trace,
54
- viewport: viewport,
55
- setViewport: setViewport
56
- })
57
- ]
58
- });
59
- }
@@ -1,45 +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, "drawSpans", {
18
- enumerable: true,
19
- get: function() {
20
- return drawSpans;
21
- }
22
- });
23
- const _trace = require("../trace");
24
- const _utils = require("../utils");
25
- const MIN_BAR_HEIGHT = 1;
26
- const MAX_BAR_HEIGHT = 7;
27
- function drawSpans(ctx, width, height, trace, spanColorGenerator) {
28
- // calculate optimal height, enforce min and max bar height and finally round to an integer
29
- const numSpans = trace.spanById.size;
30
- const barHeight = Math.round(Math.min(Math.max(height / numSpans, MIN_BAR_HEIGHT), MAX_BAR_HEIGHT));
31
- const traceDuration = trace.endTimeUnixMs - trace.startTimeUnixMs;
32
- const yChange = height / numSpans;
33
- let y = 0;
34
- const drawSpan = (span)=>{
35
- const spanDuration = span.endTimeUnixMs - span.startTimeUnixMs;
36
- const relativeDuration = spanDuration / traceDuration;
37
- const relativeStart = (span.startTimeUnixMs - trace.startTimeUnixMs) / traceDuration;
38
- ctx.fillStyle = spanColorGenerator(span);
39
- ctx.beginPath();
40
- ctx.rect(Math.round(relativeStart * width), Math.round(y), Math.max(_utils.minSpanWidthPx, Math.round(relativeDuration * width)), barHeight);
41
- ctx.fill();
42
- y += yChange;
43
- };
44
- (0, _trace.forEachSpan)(trace.rootSpans, drawSpan);
45
- }
@@ -1,154 +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
- function _export(target, all) {
18
- for(var name in all)Object.defineProperty(target, name, {
19
- enumerable: true,
20
- get: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get SearchBar () {
25
- return SearchBar;
26
- },
27
- get useSpanSearch () {
28
- return useSpanSearch;
29
- }
30
- });
31
- const _jsxruntime = require("react/jsx-runtime");
32
- const _material = require("@mui/material");
33
- const _ChevronUp = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ChevronUp"));
34
- const _ChevronDown = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ChevronDown"));
35
- const _Close = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Close"));
36
- const _react = require("react");
37
- const _Attributes = require("./DetailPane/Attributes");
38
- const _trace = require("./trace");
39
- function _interop_require_default(obj) {
40
- return obj && obj.__esModule ? obj : {
41
- default: obj
42
- };
43
- }
44
- function SearchBar(props) {
45
- const { search } = props;
46
- const { searchQuery, setSearchQuery, matchingSpanIds, focusedMatchIndex, setFocusedMatchIndex } = search;
47
- const hasQuery = searchQuery.length > 0;
48
- const matchCount = matchingSpanIds.length;
49
- const hasMatches = matchCount > 0;
50
- function handlePrev() {
51
- if (!hasMatches) return;
52
- setFocusedMatchIndex((focusedMatchIndex - 1 + matchCount) % matchCount);
53
- }
54
- function handleNext() {
55
- if (!hasMatches) return;
56
- setFocusedMatchIndex((focusedMatchIndex + 1) % matchCount);
57
- }
58
- function handleKeyDown(e) {
59
- if (e.key === 'Enter') {
60
- e.preventDefault();
61
- if (e.shiftKey) {
62
- handlePrev();
63
- } else {
64
- handleNext();
65
- }
66
- }
67
- }
68
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
69
- direction: "row",
70
- sx: {
71
- alignItems: 'center',
72
- gap: 0.5,
73
- minWidth: 300
74
- },
75
- children: [
76
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
77
- size: "small",
78
- placeholder: "Search spans...",
79
- value: searchQuery,
80
- onChange: (e)=>setSearchQuery(e.target.value),
81
- onKeyDown: handleKeyDown,
82
- slotProps: {
83
- input: {
84
- endAdornment: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputAdornment, {
85
- position: "end",
86
- sx: {
87
- visibility: hasQuery ? 'visible' : 'hidden',
88
- whiteSpace: 'nowrap'
89
- },
90
- children: hasMatches ? `${focusedMatchIndex + 1}/${matchCount}` : '0/0'
91
- })
92
- }
93
- },
94
- sx: {
95
- minWidth: 200
96
- }
97
- }),
98
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
99
- size: "small",
100
- disabled: !hasMatches,
101
- "aria-label": "Previous match",
102
- onClick: handlePrev,
103
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChevronUp.default, {})
104
- }),
105
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
106
- size: "small",
107
- disabled: !hasMatches,
108
- "aria-label": "Next match",
109
- onClick: handleNext,
110
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChevronDown.default, {})
111
- }),
112
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
113
- size: "small",
114
- disabled: !hasQuery,
115
- "aria-label": "Clear search",
116
- onClick: ()=>setSearchQuery(''),
117
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Close.default, {})
118
- })
119
- ]
120
- });
121
- }
122
- function spanMatchesQuery(span, query) {
123
- const attrMatches = (attr)=>attr.key.toLowerCase().includes(query) || (0, _Attributes.renderAttributeValue)(attr.value).toLowerCase().includes(query);
124
- return span.resource.serviceName?.toLowerCase().includes(query) || span.name.toLowerCase().includes(query) || span.spanId.toLowerCase().includes(query) || span.attributes.some(attrMatches) || span.resource.attributes.some(attrMatches);
125
- }
126
- function useSpanSearch(trace) {
127
- const [searchQuery, setSearchQueryRaw] = (0, _react.useState)('');
128
- const [focusedMatchIndex, setFocusedMatchIndex] = (0, _react.useState)(0);
129
- const matchingSpanIds = (0, _react.useMemo)(()=>{
130
- if (searchQuery.length === 0) return [];
131
- const query = searchQuery.toLowerCase();
132
- const matches = [];
133
- (0, _trace.forEachSpan)(trace.rootSpans, (span)=>{
134
- if (spanMatchesQuery(span, query)) {
135
- matches.push(span.spanId);
136
- }
137
- });
138
- return matches;
139
- }, [
140
- searchQuery,
141
- trace.rootSpans
142
- ]);
143
- const setSearchQuery = (0, _react.useCallback)((query)=>{
144
- setSearchQueryRaw(query);
145
- setFocusedMatchIndex(0);
146
- }, []);
147
- return {
148
- searchQuery,
149
- setSearchQuery,
150
- matchingSpanIds,
151
- focusedMatchIndex,
152
- setFocusedMatchIndex
153
- };
154
- }
@@ -1,106 +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
- function _export(target, all) {
18
- for(var name in all)Object.defineProperty(target, name, {
19
- enumerable: true,
20
- get: Object.getOwnPropertyDescriptor(all, name).get
21
- });
22
- }
23
- _export(exports, {
24
- get Ticks () {
25
- return Ticks;
26
- },
27
- get TicksHeader () {
28
- return TicksHeader;
29
- }
30
- });
31
- const _jsxruntime = require("react/jsx-runtime");
32
- const _material = require("@mui/material");
33
- const _utils = require("./utils");
34
- function TicksHeader(props) {
35
- const { trace, viewport } = props;
36
- const duration = viewport.endTimeUnixMs - viewport.startTimeUnixMs;
37
- const startAt = viewport.startTimeUnixMs - trace.startTimeUnixMs;
38
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
39
- children: [
40
- /*#__PURE__*/ (0, _jsxruntime.jsx)(TickBox, {
41
- style: {
42
- left: '0%',
43
- borderWidth: 0
44
- },
45
- children: (0, _utils.formatDuration)(startAt + duration * 0)
46
- }),
47
- /*#__PURE__*/ (0, _jsxruntime.jsx)(TickBox, {
48
- style: {
49
- left: '25%'
50
- },
51
- children: (0, _utils.formatDuration)(startAt + duration * 0.25)
52
- }),
53
- /*#__PURE__*/ (0, _jsxruntime.jsx)(TickBox, {
54
- style: {
55
- left: '50%'
56
- },
57
- children: (0, _utils.formatDuration)(startAt + duration * 0.5)
58
- }),
59
- /*#__PURE__*/ (0, _jsxruntime.jsx)(TickBox, {
60
- style: {
61
- left: '75%'
62
- },
63
- children: (0, _utils.formatDuration)(startAt + duration * 0.75)
64
- }),
65
- /*#__PURE__*/ (0, _jsxruntime.jsx)(TickBox, {
66
- style: {
67
- left: '100%'
68
- },
69
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
70
- style: {
71
- position: 'absolute',
72
- right: '.75rem'
73
- },
74
- children: (0, _utils.formatDuration)(startAt + duration * 1)
75
- })
76
- })
77
- ]
78
- });
79
- }
80
- function Ticks() {
81
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
82
- children: [
83
- /*#__PURE__*/ (0, _jsxruntime.jsx)(TickBox, {
84
- style: {
85
- left: '25%'
86
- }
87
- }),
88
- /*#__PURE__*/ (0, _jsxruntime.jsx)(TickBox, {
89
- style: {
90
- left: '50%'
91
- }
92
- }),
93
- /*#__PURE__*/ (0, _jsxruntime.jsx)(TickBox, {
94
- style: {
95
- left: '75%'
96
- }
97
- })
98
- ]
99
- });
100
- }
101
- const TickBox = (0, _material.styled)(_material.Box)(({ theme })=>({
102
- position: 'absolute',
103
- height: '100%',
104
- borderLeft: `1px solid ${theme.palette.divider}`,
105
- padding: '.25rem'
106
- }));