@perses-dev/tracing-gantt-chart-plugin 0.6.0

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 (189) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/341.6c6463ea.css +1 -0
  4. package/__mf/css/async/759.6c6463ea.css +1 -0
  5. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  6. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  7. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  8. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  9. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  10. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  11. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  12. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  13. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  14. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  17. package/__mf/js/788.91bbf7bd.js +5 -0
  18. package/__mf/js/TracingGanttChart.1a922a19.js +5 -0
  19. package/__mf/js/async/156.5a401ecb.js +1 -0
  20. package/__mf/js/async/173.6314a363.js +2 -0
  21. package/__mf/js/async/173.6314a363.js.LICENSE.txt +19 -0
  22. package/__mf/js/async/620.1d1ce390.js +2 -0
  23. package/__mf/js/async/620.1d1ce390.js.LICENSE.txt +9 -0
  24. package/__mf/js/async/651.3ea371e5.js +1 -0
  25. package/__mf/js/async/694.4580ad20.js +1 -0
  26. package/__mf/js/async/740.babbb403.js +1 -0
  27. package/__mf/js/async/75.d81e6bbf.js +1 -0
  28. package/__mf/js/async/770.5431adef.js +1 -0
  29. package/__mf/js/async/783.3c2c57f6.js +110 -0
  30. package/__mf/js/async/783.3c2c57f6.js.LICENSE.txt +27 -0
  31. package/__mf/js/async/844.556cc34d.js +66 -0
  32. package/__mf/js/async/844.556cc34d.js.LICENSE.txt +84 -0
  33. package/__mf/js/async/928.096f73eb.js +1 -0
  34. package/__mf/js/async/960.478a8f11.js +2 -0
  35. package/__mf/js/async/960.478a8f11.js.LICENSE.txt +8 -0
  36. package/__mf/js/async/964.a98cab40.js +2 -0
  37. package/__mf/js/async/964.a98cab40.js.LICENSE.txt +9 -0
  38. package/__mf/js/async/981.bc5132f8.js +2 -0
  39. package/__mf/js/async/981.bc5132f8.js.LICENSE.txt +8 -0
  40. package/__mf/js/async/__federation_expose_TracingGanttChart.5ab86c44.js +1 -0
  41. package/__mf/js/async/lib-router.36c0d526.js +2 -0
  42. package/__mf/js/async/lib-router.36c0d526.js.LICENSE.txt +32 -0
  43. package/__mf/js/main.e75dea7b.js +1 -0
  44. package/lib/TracingGanttChart/DetailPane/Attributes.d.ts +9 -0
  45. package/lib/TracingGanttChart/DetailPane/Attributes.d.ts.map +1 -0
  46. package/lib/TracingGanttChart/DetailPane/Attributes.js +66 -0
  47. package/lib/TracingGanttChart/DetailPane/Attributes.js.map +1 -0
  48. package/lib/TracingGanttChart/DetailPane/DetailPane.d.ts +14 -0
  49. package/lib/TracingGanttChart/DetailPane/DetailPane.d.ts.map +1 -0
  50. package/lib/TracingGanttChart/DetailPane/DetailPane.js +95 -0
  51. package/lib/TracingGanttChart/DetailPane/DetailPane.js.map +1 -0
  52. package/lib/TracingGanttChart/DetailPane/SpanEvents.d.ts +8 -0
  53. package/lib/TracingGanttChart/DetailPane/SpanEvents.d.ts.map +1 -0
  54. package/lib/TracingGanttChart/DetailPane/SpanEvents.js +54 -0
  55. package/lib/TracingGanttChart/DetailPane/SpanEvents.js.map +1 -0
  56. package/lib/TracingGanttChart/GanttTable/GanttTable.d.ts +13 -0
  57. package/lib/TracingGanttChart/GanttTable/GanttTable.d.ts.map +1 -0
  58. package/lib/TracingGanttChart/GanttTable/GanttTable.js +93 -0
  59. package/lib/TracingGanttChart/GanttTable/GanttTable.js.map +1 -0
  60. package/lib/TracingGanttChart/GanttTable/GanttTableHeader.d.ts +12 -0
  61. package/lib/TracingGanttChart/GanttTable/GanttTableHeader.d.ts.map +1 -0
  62. package/lib/TracingGanttChart/GanttTable/GanttTableHeader.js +56 -0
  63. package/lib/TracingGanttChart/GanttTable/GanttTableHeader.js.map +1 -0
  64. package/lib/TracingGanttChart/GanttTable/GanttTableProvider.d.ts +23 -0
  65. package/lib/TracingGanttChart/GanttTable/GanttTableProvider.d.ts.map +1 -0
  66. package/lib/TracingGanttChart/GanttTable/GanttTableProvider.js +45 -0
  67. package/lib/TracingGanttChart/GanttTable/GanttTableProvider.js.map +1 -0
  68. package/lib/TracingGanttChart/GanttTable/GanttTableRow.d.ts +15 -0
  69. package/lib/TracingGanttChart/GanttTable/GanttTableRow.d.ts.map +1 -0
  70. package/lib/TracingGanttChart/GanttTable/GanttTableRow.js +56 -0
  71. package/lib/TracingGanttChart/GanttTable/GanttTableRow.js.map +1 -0
  72. package/lib/TracingGanttChart/GanttTable/ResizableDivider.d.ts +9 -0
  73. package/lib/TracingGanttChart/GanttTable/ResizableDivider.d.ts.map +1 -0
  74. package/lib/TracingGanttChart/GanttTable/ResizableDivider.js +86 -0
  75. package/lib/TracingGanttChart/GanttTable/ResizableDivider.js.map +1 -0
  76. package/lib/TracingGanttChart/GanttTable/SpanDuration.d.ts +14 -0
  77. package/lib/TracingGanttChart/GanttTable/SpanDuration.d.ts.map +1 -0
  78. package/lib/TracingGanttChart/GanttTable/SpanDuration.js +75 -0
  79. package/lib/TracingGanttChart/GanttTable/SpanDuration.js.map +1 -0
  80. package/lib/TracingGanttChart/GanttTable/SpanIndents.d.ts +14 -0
  81. package/lib/TracingGanttChart/GanttTable/SpanIndents.d.ts.map +1 -0
  82. package/lib/TracingGanttChart/GanttTable/SpanIndents.js +90 -0
  83. package/lib/TracingGanttChart/GanttTable/SpanIndents.js.map +1 -0
  84. package/lib/TracingGanttChart/GanttTable/SpanName.d.ts +11 -0
  85. package/lib/TracingGanttChart/GanttTable/SpanName.d.ts.map +1 -0
  86. package/lib/TracingGanttChart/GanttTable/SpanName.js +61 -0
  87. package/lib/TracingGanttChart/GanttTable/SpanName.js.map +1 -0
  88. package/lib/TracingGanttChart/MiniGanttChart/Canvas.d.ts +13 -0
  89. package/lib/TracingGanttChart/MiniGanttChart/Canvas.d.ts.map +1 -0
  90. package/lib/TracingGanttChart/MiniGanttChart/Canvas.js +243 -0
  91. package/lib/TracingGanttChart/MiniGanttChart/Canvas.js.map +1 -0
  92. package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.d.ts +13 -0
  93. package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.d.ts.map +1 -0
  94. package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.js +51 -0
  95. package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.js.map +1 -0
  96. package/lib/TracingGanttChart/MiniGanttChart/draw.d.ts +3 -0
  97. package/lib/TracingGanttChart/MiniGanttChart/draw.d.ts.map +1 -0
  98. package/lib/TracingGanttChart/MiniGanttChart/draw.js +48 -0
  99. package/lib/TracingGanttChart/MiniGanttChart/draw.js.map +1 -0
  100. package/lib/TracingGanttChart/Ticks.d.ts +16 -0
  101. package/lib/TracingGanttChart/Ticks.d.ts.map +1 -0
  102. package/lib/TracingGanttChart/Ticks.js +94 -0
  103. package/lib/TracingGanttChart/Ticks.js.map +1 -0
  104. package/lib/TracingGanttChart/TracingGanttChart.d.ts +17 -0
  105. package/lib/TracingGanttChart/TracingGanttChart.d.ts.map +1 -0
  106. package/lib/TracingGanttChart/TracingGanttChart.js +106 -0
  107. package/lib/TracingGanttChart/TracingGanttChart.js.map +1 -0
  108. package/lib/TracingGanttChart/palette.d.ts +6 -0
  109. package/lib/TracingGanttChart/palette.d.ts.map +1 -0
  110. package/lib/TracingGanttChart/palette.js +64 -0
  111. package/lib/TracingGanttChart/palette.js.map +1 -0
  112. package/lib/TracingGanttChart/trace.d.ts +45 -0
  113. package/lib/TracingGanttChart/trace.d.ts.map +1 -0
  114. package/lib/TracingGanttChart/trace.js +109 -0
  115. package/lib/TracingGanttChart/trace.js.map +1 -0
  116. package/lib/TracingGanttChart/utils.d.ts +18 -0
  117. package/lib/TracingGanttChart/utils.d.ts.map +1 -0
  118. package/lib/TracingGanttChart/utils.js +48 -0
  119. package/lib/TracingGanttChart/utils.js.map +1 -0
  120. package/lib/TracingGanttChart.d.ts +5 -0
  121. package/lib/TracingGanttChart.d.ts.map +1 -0
  122. package/lib/TracingGanttChart.js +23 -0
  123. package/lib/TracingGanttChart.js.map +1 -0
  124. package/lib/TracingGanttChartPanel.d.ts +17 -0
  125. package/lib/TracingGanttChartPanel.d.ts.map +1 -0
  126. package/lib/TracingGanttChartPanel.js +45 -0
  127. package/lib/TracingGanttChartPanel.js.map +1 -0
  128. package/lib/bootstrap.d.ts +2 -0
  129. package/lib/bootstrap.d.ts.map +1 -0
  130. package/lib/bootstrap.js +19 -0
  131. package/lib/bootstrap.js.map +1 -0
  132. package/lib/cjs/TracingGanttChart/DetailPane/Attributes.js +74 -0
  133. package/lib/cjs/TracingGanttChart/DetailPane/DetailPane.js +106 -0
  134. package/lib/cjs/TracingGanttChart/DetailPane/SpanEvents.js +67 -0
  135. package/lib/cjs/TracingGanttChart/GanttTable/GanttTable.js +101 -0
  136. package/lib/cjs/TracingGanttChart/GanttTable/GanttTableHeader.js +64 -0
  137. package/lib/cjs/TracingGanttChart/GanttTable/GanttTableProvider.js +60 -0
  138. package/lib/cjs/TracingGanttChart/GanttTable/GanttTableRow.js +64 -0
  139. package/lib/cjs/TracingGanttChart/GanttTable/ResizableDivider.js +94 -0
  140. package/lib/cjs/TracingGanttChart/GanttTable/SpanDuration.js +81 -0
  141. package/lib/cjs/TracingGanttChart/GanttTable/SpanIndents.js +97 -0
  142. package/lib/cjs/TracingGanttChart/GanttTable/SpanName.js +72 -0
  143. package/lib/cjs/TracingGanttChart/MiniGanttChart/Canvas.js +256 -0
  144. package/lib/cjs/TracingGanttChart/MiniGanttChart/MiniGanttChart.js +59 -0
  145. package/lib/cjs/TracingGanttChart/MiniGanttChart/draw.js +56 -0
  146. package/lib/cjs/TracingGanttChart/Ticks.js +106 -0
  147. package/lib/cjs/TracingGanttChart/TracingGanttChart.js +109 -0
  148. package/lib/cjs/TracingGanttChart/palette.js +83 -0
  149. package/lib/cjs/TracingGanttChart/trace.js +113 -0
  150. package/lib/cjs/TracingGanttChart/utils.js +76 -0
  151. package/lib/cjs/TracingGanttChart.js +31 -0
  152. package/lib/cjs/TracingGanttChartPanel.js +53 -0
  153. package/lib/cjs/bootstrap.js +26 -0
  154. package/lib/cjs/env.d.js +14 -0
  155. package/lib/cjs/gantt-chart-model.js +28 -0
  156. package/lib/cjs/getPluginModule.js +27 -0
  157. package/lib/cjs/index-federation.js +55 -0
  158. package/lib/cjs/index.js +27 -0
  159. package/lib/cjs/setup-tests.js +19 -0
  160. package/lib/cjs/test/convert/jaeger.js +86 -0
  161. package/lib/env.d.js +15 -0
  162. package/lib/env.d.js.map +1 -0
  163. package/lib/gantt-chart-model.d.ts +17 -0
  164. package/lib/gantt-chart-model.d.ts.map +1 -0
  165. package/lib/gantt-chart-model.js +22 -0
  166. package/lib/gantt-chart-model.js.map +1 -0
  167. package/lib/getPluginModule.d.ts +6 -0
  168. package/lib/getPluginModule.d.ts.map +1 -0
  169. package/lib/getPluginModule.js +16 -0
  170. package/lib/getPluginModule.js.map +1 -0
  171. package/lib/index-federation.d.ts +1 -0
  172. package/lib/index-federation.d.ts.map +1 -0
  173. package/lib/index-federation.js +15 -0
  174. package/lib/index-federation.js.map +1 -0
  175. package/lib/index.d.ts +5 -0
  176. package/lib/index.d.ts.map +1 -0
  177. package/lib/index.js +6 -0
  178. package/lib/index.js.map +1 -0
  179. package/lib/setup-tests.d.ts +2 -0
  180. package/lib/setup-tests.d.ts.map +1 -0
  181. package/lib/setup-tests.js +17 -0
  182. package/lib/setup-tests.js.map +1 -0
  183. package/lib/test/convert/jaeger.d.ts +41 -0
  184. package/lib/test/convert/jaeger.d.ts.map +1 -0
  185. package/lib/test/convert/jaeger.js +78 -0
  186. package/lib/test/convert/jaeger.js.map +1 -0
  187. package/mf-manifest.json +233 -0
  188. package/mf-stats.json +269 -0
  189. package/package.json +58 -0
@@ -0,0 +1,74 @@
1
+ // Copyright 2024 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, "AttributeList", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return AttributeList;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _react = require("react");
25
+ const _material = require("@mui/material");
26
+ const _reactrouterdom = require("react-router-dom");
27
+ function AttributeList(props) {
28
+ const { attributeLinks, attributes } = props;
29
+ const attributesMap = (0, _react.useMemo)(()=>Object.fromEntries(attributes.map((attr)=>[
30
+ attr.key,
31
+ attr.value
32
+ ])), [
33
+ attributes
34
+ ]);
35
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
36
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.List, {
37
+ children: attributes.sort((a, b)=>a.key.localeCompare(b.key)).map((attribute, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(AttributeItem, {
38
+ attribute: attribute,
39
+ linkTo: attributeLinks?.[attribute.key]?.(attributesMap)
40
+ }, i))
41
+ })
42
+ });
43
+ }
44
+ function AttributeItem(props) {
45
+ const { attribute, linkTo } = props;
46
+ const value = linkTo ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Link, {
47
+ component: _reactrouterdom.Link,
48
+ to: linkTo,
49
+ children: renderAttributeValue(attribute.value)
50
+ }) : renderAttributeValue(attribute.value);
51
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ListItem, {
52
+ disablePadding: true,
53
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ListItemText, {
54
+ primary: attribute.key,
55
+ secondary: value,
56
+ primaryTypographyProps: {
57
+ variant: 'h5'
58
+ },
59
+ secondaryTypographyProps: {
60
+ variant: 'body1',
61
+ sx: {
62
+ wordBreak: 'break-word'
63
+ }
64
+ }
65
+ })
66
+ });
67
+ }
68
+ function renderAttributeValue(value) {
69
+ if ('stringValue' in value) return value.stringValue.length > 0 ? value.stringValue : '<empty string>';
70
+ if ('intValue' in value) return value.intValue;
71
+ if ('boolValue' in value) return value.boolValue.toString();
72
+ if ('arrayValue' in value) return value.arrayValue.values.map(renderAttributeValue).join(', ');
73
+ return 'unknown';
74
+ }
@@ -0,0 +1,106 @@
1
+ // Copyright 2024 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, "DetailPane", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return DetailPane;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ const _react = require("react");
26
+ const _Close = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Close"));
27
+ const _Attributes = require("./Attributes");
28
+ const _SpanEvents = require("./SpanEvents");
29
+ function _interop_require_default(obj) {
30
+ return obj && obj.__esModule ? obj : {
31
+ default: obj
32
+ };
33
+ }
34
+ function DetailPane(props) {
35
+ const { attributeLinks, trace, span, onCloseBtnClick } = props;
36
+ const [tab, setTab] = (0, _react.useState)('attributes');
37
+ // if the events tab is selected, and then a span without events is clicked,
38
+ // we need to switch the current selected tab back to the attributes tab.
39
+ if (tab === 'events' && span.events.length === 0) {
40
+ setTab('attributes');
41
+ }
42
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
43
+ children: [
44
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
45
+ sx: {
46
+ float: 'right'
47
+ },
48
+ onClick: onCloseBtnClick,
49
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Close.default, {})
50
+ }),
51
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
52
+ sx: {
53
+ wordBreak: 'break-word'
54
+ },
55
+ children: span.resource.serviceName
56
+ }),
57
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
58
+ variant: "h2",
59
+ sx: {
60
+ wordBreak: 'break-word'
61
+ },
62
+ children: span.name
63
+ }),
64
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
65
+ sx: {
66
+ borderBottom: 1,
67
+ borderColor: 'divider'
68
+ },
69
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Tabs, {
70
+ value: tab,
71
+ onChange: (_, tab)=>setTab(tab),
72
+ children: [
73
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tab, {
74
+ sx: {
75
+ p: 0
76
+ },
77
+ value: "attributes",
78
+ label: "Attributes"
79
+ }),
80
+ span.events.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tab, {
81
+ value: "events",
82
+ label: "Events"
83
+ })
84
+ ]
85
+ })
86
+ }),
87
+ tab === 'attributes' && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
88
+ children: [
89
+ span.attributes.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_Attributes.AttributeList, {
90
+ attributeLinks: attributeLinks,
91
+ attributes: span.attributes
92
+ }),
93
+ span.attributes.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {}),
94
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Attributes.AttributeList, {
95
+ attributeLinks: attributeLinks,
96
+ attributes: span.resource.attributes
97
+ })
98
+ ]
99
+ }),
100
+ tab === 'events' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_SpanEvents.SpanEventList, {
101
+ trace: trace,
102
+ span: span
103
+ })
104
+ ]
105
+ });
106
+ }
@@ -0,0 +1,67 @@
1
+ // Copyright 2024 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, "SpanEventList", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return SpanEventList;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ const _ChevronDown = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ChevronDown"));
26
+ const _utils = require("../utils");
27
+ const _Attributes = require("./Attributes");
28
+ function _interop_require_default(obj) {
29
+ return obj && obj.__esModule ? obj : {
30
+ default: obj
31
+ };
32
+ }
33
+ function SpanEventList(props) {
34
+ const { trace, span } = props;
35
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {
36
+ children: span.events.sort((a, b)=>a.timeUnixMs - b.timeUnixMs).map((event, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(SpanEventItem, {
37
+ trace: trace,
38
+ event: event
39
+ }, i))
40
+ });
41
+ }
42
+ function SpanEventItem(props) {
43
+ const { trace, event } = props;
44
+ const relativeTime = event.timeUnixMs - trace.startTimeUnixMs;
45
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Accordion, {
46
+ disableGutters: true,
47
+ children: [
48
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.AccordionSummary, {
49
+ expandIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChevronDown.default, {}),
50
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
51
+ children: (0, _utils.formatDuration)(relativeTime)
52
+ })
53
+ }),
54
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.AccordionDetails, {
55
+ children: [
56
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
57
+ variant: "subtitle1",
58
+ children: event.name
59
+ }),
60
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Attributes.AttributeList, {
61
+ attributes: event.attributes
62
+ })
63
+ ]
64
+ })
65
+ ]
66
+ });
67
+ }
@@ -0,0 +1,101 @@
1
+ // Copyright 2024 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, "GanttTable", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return GanttTable;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _reactvirtuoso = require("react-virtuoso");
25
+ const _react = require("react");
26
+ const _material = require("@mui/material");
27
+ const _GanttTableProvider = require("./GanttTableProvider");
28
+ const _GanttTableRow = require("./GanttTableRow");
29
+ const _GanttTableHeader = require("./GanttTableHeader");
30
+ const _ResizableDivider = require("./ResizableDivider");
31
+ function GanttTable(props) {
32
+ const { options, trace, viewport, selectedSpan, onSpanClick } = props;
33
+ const { collapsedSpans, setVisibleSpans } = (0, _GanttTableProvider.useGanttTableContext)();
34
+ const [nameColumnWidth, setNameColumnWidth] = (0, _react.useState)(0.25);
35
+ const tableRef = (0, _react.useRef)(null);
36
+ const theme = (0, _material.useTheme)();
37
+ const rows = (0, _react.useMemo)(()=>{
38
+ const rows = [];
39
+ for (const rootSpan of trace.rootSpans){
40
+ treeToRows(rows, rootSpan, collapsedSpans);
41
+ }
42
+ return rows;
43
+ }, [
44
+ trace.rootSpans,
45
+ collapsedSpans
46
+ ]);
47
+ const divider = /*#__PURE__*/ (0, _jsxruntime.jsx)(_ResizableDivider.ResizableDivider, {
48
+ parentRef: tableRef,
49
+ onMove: setNameColumnWidth
50
+ });
51
+ // update currently visible spans
52
+ function handleRangeChange({ startIndex, endIndex }) {
53
+ const visibleSpans = [];
54
+ for(let i = startIndex; i <= endIndex; i++){
55
+ visibleSpans.push(rows[i].spanId);
56
+ }
57
+ setVisibleSpans(visibleSpans);
58
+ }
59
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
60
+ ref: tableRef,
61
+ sx: {
62
+ display: 'flex',
63
+ flexDirection: 'column',
64
+ flexGrow: 1,
65
+ border: `1px solid ${theme.palette.divider}`,
66
+ borderRadius: `${theme.shape.borderRadius}px`
67
+ },
68
+ children: [
69
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_GanttTableHeader.GanttTableHeader, {
70
+ trace: trace,
71
+ viewport: viewport,
72
+ nameColumnWidth: nameColumnWidth,
73
+ divider: divider
74
+ }),
75
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactvirtuoso.Virtuoso, {
76
+ data: rows,
77
+ itemContent: (_, span)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_GanttTableRow.GanttTableRow, {
78
+ options: options,
79
+ span: span,
80
+ viewport: viewport,
81
+ selected: span === selectedSpan,
82
+ nameColumnWidth: nameColumnWidth,
83
+ divider: divider,
84
+ onClick: onSpanClick
85
+ }),
86
+ rangeChanged: handleRangeChange
87
+ })
88
+ ]
89
+ });
90
+ }
91
+ /**
92
+ * treeToRows recursively transforms the span tree to a list of rows and
93
+ * hides collapsed child spans.
94
+ */ function treeToRows(rows, span, collapsedSpans) {
95
+ rows.push(span);
96
+ if (!collapsedSpans.includes(span.spanId)) {
97
+ for (const child of span.childSpans){
98
+ treeToRows(rows, child, collapsedSpans);
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,64 @@
1
+ // Copyright 2024 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, "GanttTableHeader", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return GanttTableHeader;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ const _utils = require("../utils");
26
+ const _Ticks = require("../Ticks");
27
+ function GanttTableHeader(props) {
28
+ const { trace, viewport, nameColumnWidth, divider } = props;
29
+ const theme = (0, _material.useTheme)();
30
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
31
+ direction: "row",
32
+ alignItems: "center",
33
+ sx: {
34
+ height: _utils.rowHeight,
35
+ fontSize: '0.9rem',
36
+ borderBottom: `1px solid ${theme.palette.divider}`
37
+ },
38
+ children: [
39
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
40
+ style: {
41
+ width: `${nameColumnWidth * 100}%`
42
+ },
43
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
44
+ style: {
45
+ padding: '.25rem'
46
+ },
47
+ children: "Service & Operation"
48
+ })
49
+ }),
50
+ divider,
51
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
52
+ sx: {
53
+ position: 'relative',
54
+ height: '100%',
55
+ flexGrow: 1
56
+ },
57
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Ticks.TicksHeader, {
58
+ trace: trace,
59
+ viewport: viewport
60
+ })
61
+ })
62
+ ]
63
+ });
64
+ }
@@ -0,0 +1,60 @@
1
+ // Copyright 2024 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: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ GanttTableContext: function() {
25
+ return GanttTableContext;
26
+ },
27
+ GanttTableProvider: function() {
28
+ return GanttTableProvider;
29
+ },
30
+ useGanttTableContext: function() {
31
+ return useGanttTableContext;
32
+ }
33
+ });
34
+ const _jsxruntime = require("react/jsx-runtime");
35
+ const _react = require("react");
36
+ const GanttTableContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
37
+ function GanttTableProvider(props) {
38
+ const { children } = props;
39
+ const [collapsedSpans, setCollapsedSpans] = (0, _react.useState)([]);
40
+ const [visibleSpans, setVisibleSpans] = (0, _react.useState)([]);
41
+ const [hoveredParent, setHoveredParent] = (0, _react.useState)(undefined);
42
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(GanttTableContext.Provider, {
43
+ value: {
44
+ collapsedSpans,
45
+ setCollapsedSpans,
46
+ visibleSpans,
47
+ setVisibleSpans,
48
+ hoveredParent,
49
+ setHoveredParent
50
+ },
51
+ children: children
52
+ });
53
+ }
54
+ function useGanttTableContext() {
55
+ const ctx = (0, _react.useContext)(GanttTableContext);
56
+ if (ctx === undefined) {
57
+ throw new Error('No GanttTableContext found. Did you forget a Provider?');
58
+ }
59
+ return ctx;
60
+ }
@@ -0,0 +1,64 @@
1
+ // Copyright 2024 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, "GanttTableRow", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return GanttTableRow;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ const _react = require("react");
26
+ const _utils = require("../utils");
27
+ const _SpanName = require("./SpanName");
28
+ const _SpanDuration = require("./SpanDuration");
29
+ const GanttTableRow = /*#__PURE__*/ (0, _react.memo)(function GanttTableRow(props) {
30
+ const { options, span, viewport, selected, nameColumnWidth, divider, onClick } = props;
31
+ const theme = (0, _material.useTheme)();
32
+ const handleOnClick = ()=>{
33
+ // ignore event if triggered by selecting text
34
+ if (document.getSelection()?.type === 'Range') return;
35
+ onClick(span);
36
+ };
37
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(RowContainer, {
38
+ sx: {
39
+ backgroundColor: selected ? theme.palette.action.selected : 'inherit'
40
+ },
41
+ direction: "row",
42
+ onClick: handleOnClick,
43
+ children: [
44
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_SpanName.SpanName, {
45
+ span: span,
46
+ nameColumnWidth: nameColumnWidth
47
+ }),
48
+ divider,
49
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_SpanDuration.SpanDuration, {
50
+ options: options,
51
+ span: span,
52
+ viewport: viewport
53
+ })
54
+ ]
55
+ });
56
+ });
57
+ const RowContainer = (0, _material.styled)(_material.Stack)(({ theme })=>({
58
+ height: _utils.rowHeight,
59
+ '&:hover': {
60
+ backgroundColor: theme.palette.action.hover,
61
+ borderTop: `1px solid ${theme.palette.divider}`,
62
+ borderBottom: `1px solid ${theme.palette.divider}`
63
+ }
64
+ }));
@@ -0,0 +1,94 @@
1
+ // Copyright 2024 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, "ResizableDivider", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return ResizableDivider;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _react = require("react");
25
+ const _material = require("@mui/material");
26
+ const _core = require("@perses-dev/core");
27
+ function ResizableDivider(props) {
28
+ const { parentRef, spacing = 0, onMove } = props;
29
+ const [isResizing, setResizing] = (0, _react.useState)(false);
30
+ const handleMouseDown = (e)=>{
31
+ // disable any default actions (text selection, etc.)
32
+ e.preventDefault();
33
+ setResizing(true);
34
+ };
35
+ // need stable reference for window.removeEventListener() in useEffect() below
36
+ const handleMouseMove = (0, _core.useEvent)((e)=>{
37
+ if (!parentRef.current) return;
38
+ const offsetX = e.clientX - parentRef.current.getBoundingClientRect().left + spacing;
39
+ const leftPercent = offsetX / parentRef.current.getBoundingClientRect().width;
40
+ if (0.05 <= leftPercent && leftPercent <= 0.95) {
41
+ onMove(leftPercent);
42
+ }
43
+ });
44
+ // need stable reference for window.removeEventListener() in useEffect() below
45
+ const handleMouseUp = (0, _core.useEvent)(()=>{
46
+ setResizing(false);
47
+ });
48
+ // capture mouseMove and mouseUp outside the element by attaching them to the window object
49
+ (0, _react.useEffect)(()=>{
50
+ function startMouseAction() {
51
+ window.addEventListener('mousemove', handleMouseMove);
52
+ window.addEventListener('mouseup', handleMouseUp);
53
+ document.body.style.cursor = 'col-resize';
54
+ }
55
+ function stopMouseAction() {
56
+ window.removeEventListener('mousemove', handleMouseMove);
57
+ window.removeEventListener('mouseup', handleMouseUp);
58
+ document.body.style.cursor = 'inherit';
59
+ }
60
+ if (isResizing) {
61
+ startMouseAction();
62
+ } else {
63
+ stopMouseAction();
64
+ }
65
+ return stopMouseAction;
66
+ }, [
67
+ isResizing,
68
+ handleMouseMove,
69
+ handleMouseUp
70
+ ]);
71
+ // prevent onClick event when clicking on a divider
72
+ const stopEventPropagation = (e)=>e.stopPropagation();
73
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(ResizableDividerBox, {
74
+ onMouseDown: handleMouseDown,
75
+ onClick: stopEventPropagation
76
+ });
77
+ }
78
+ const ResizableDividerBox = (0, _material.styled)(_material.Box)(({ theme })=>({
79
+ position: 'relative',
80
+ width: '1px',
81
+ height: '100%',
82
+ backgroundColor: theme.palette.divider,
83
+ cursor: 'col-resize',
84
+ // increase clickable area from 1px to 7px
85
+ '&:before': {
86
+ position: 'absolute',
87
+ width: '7px',
88
+ left: '-3px',
89
+ top: 0,
90
+ bottom: 0,
91
+ content: '" "',
92
+ zIndex: 1
93
+ }
94
+ }));