@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.
- package/__mf/js/{TracingGanttChart.ca3d72b7.js → TracingGanttChart.4460ff1c.js} +4 -4
- package/__mf/js/async/121.5b3411ef.js +2 -0
- package/__mf/js/async/192.b0550d58.js +1 -0
- package/__mf/js/async/2.2a545358.js +1 -0
- package/__mf/js/async/235.831bea3e.js +1 -0
- package/__mf/js/async/247.e4d2c197.js +1 -0
- package/__mf/js/async/274.eee92e86.js +2 -0
- package/__mf/js/async/356.43c6ada2.js +1 -0
- package/__mf/js/async/392.a3f49cf0.js +2 -0
- package/__mf/js/async/407.6e0c3fb4.js +4 -0
- package/__mf/js/async/407.6e0c3fb4.js.LICENSE.txt +9 -0
- package/__mf/js/async/43.cbae1eef.js +2 -0
- package/__mf/js/async/436.4db73a03.js +110 -0
- package/__mf/js/async/470.8d6cfc01.js +2 -0
- package/__mf/js/async/496.9a3d3d3d.js +1 -0
- package/__mf/js/async/587.849f1255.js +1 -0
- package/__mf/js/async/588.39275df8.js +1 -0
- package/__mf/js/async/616.4d217c10.js +1 -0
- package/__mf/js/async/665.2b61216d.js +2 -0
- package/__mf/js/async/672.790df7d1.js +1 -0
- package/__mf/js/async/71.4eb8fa2f.js +1 -0
- package/__mf/js/async/77.27ff39b8.js +1 -0
- package/__mf/js/async/776.f19f62f3.js +43 -0
- package/__mf/js/async/{30.991f7ee4.js.LICENSE.txt → 776.f19f62f3.js.LICENSE.txt} +41 -1
- package/__mf/js/async/873.a00a9302.js +1 -0
- package/__mf/js/async/941.7ee2dbf0.js +2 -0
- package/__mf/js/async/968.b61d3c02.js +1 -0
- package/__mf/js/async/978.4227a27e.js +1 -0
- package/__mf/js/async/__federation_expose_TracingGanttChart.303e7806.js +1 -0
- package/__mf/js/async/lib-router.a8607481.js +2 -0
- package/__mf/js/{main.9e057781.js → main.7b791d2a.js} +2 -2
- package/lib/PanelActions.d.ts +3 -3
- package/lib/PanelActions.d.ts.map +1 -1
- package/lib/PanelActions.js +4 -4
- package/lib/PanelActions.js.map +1 -1
- package/lib/TracingGanttChart/DetailPane/Attributes.d.ts +4 -4
- package/lib/TracingGanttChart/DetailPane/Attributes.d.ts.map +1 -1
- package/lib/TracingGanttChart/DetailPane/Attributes.js +4 -4
- package/lib/TracingGanttChart/DetailPane/Attributes.js.map +1 -1
- package/lib/TracingGanttChart/DetailPane/DetailPane.d.ts +3 -3
- package/lib/TracingGanttChart/DetailPane/DetailPane.d.ts.map +1 -1
- package/lib/TracingGanttChart/DetailPane/DetailPane.js +6 -6
- package/lib/TracingGanttChart/DetailPane/DetailPane.js.map +1 -1
- package/lib/TracingGanttChart/DetailPane/SpanEvents.d.ts +3 -3
- package/lib/TracingGanttChart/DetailPane/SpanEvents.d.ts.map +1 -1
- package/lib/TracingGanttChart/DetailPane/SpanEvents.js +7 -7
- package/lib/TracingGanttChart/DetailPane/SpanEvents.js.map +1 -1
- package/lib/TracingGanttChart/DetailPane/SpanLinks.d.ts +3 -3
- package/lib/TracingGanttChart/DetailPane/SpanLinks.d.ts.map +1 -1
- package/lib/TracingGanttChart/DetailPane/SpanLinks.js +4 -4
- package/lib/TracingGanttChart/DetailPane/SpanLinks.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTable.d.ts +4 -4
- package/lib/TracingGanttChart/GanttTable/GanttTable.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTable.js +8 -8
- package/lib/TracingGanttChart/GanttTable/GanttTable.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableHeader.d.ts +3 -3
- package/lib/TracingGanttChart/GanttTable/GanttTableHeader.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableHeader.js +3 -3
- package/lib/TracingGanttChart/GanttTable/GanttTableHeader.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.d.ts +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.js +2 -2
- package/lib/TracingGanttChart/GanttTable/GanttTableProvider.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.d.ts +3 -3
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.js +5 -5
- package/lib/TracingGanttChart/GanttTable/GanttTableRow.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/ResizableDivider.d.ts +1 -1
- package/lib/TracingGanttChart/GanttTable/ResizableDivider.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/ResizableDivider.js +3 -3
- package/lib/TracingGanttChart/GanttTable/ResizableDivider.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/SpanDuration.d.ts +4 -4
- package/lib/TracingGanttChart/GanttTable/SpanDuration.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/SpanDuration.js +4 -4
- package/lib/TracingGanttChart/GanttTable/SpanDuration.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/SpanIndents.d.ts +2 -2
- package/lib/TracingGanttChart/GanttTable/SpanIndents.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/SpanIndents.js +5 -5
- package/lib/TracingGanttChart/GanttTable/SpanIndents.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/SpanLinksButton.d.ts +3 -3
- package/lib/TracingGanttChart/GanttTable/SpanLinksButton.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/SpanLinksButton.js +5 -5
- package/lib/TracingGanttChart/GanttTable/SpanLinksButton.js.map +1 -1
- package/lib/TracingGanttChart/GanttTable/SpanName.d.ts +3 -3
- package/lib/TracingGanttChart/GanttTable/SpanName.d.ts.map +1 -1
- package/lib/TracingGanttChart/GanttTable/SpanName.js +5 -5
- package/lib/TracingGanttChart/GanttTable/SpanName.js.map +1 -1
- package/lib/TracingGanttChart/MiniGanttChart/Canvas.d.ts +4 -4
- package/lib/TracingGanttChart/MiniGanttChart/Canvas.d.ts.map +1 -1
- package/lib/TracingGanttChart/MiniGanttChart/Canvas.js +8 -8
- package/lib/TracingGanttChart/MiniGanttChart/Canvas.js.map +1 -1
- package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.d.ts +4 -4
- package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.d.ts.map +1 -1
- package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.js +4 -4
- package/lib/TracingGanttChart/MiniGanttChart/MiniGanttChart.js.map +1 -1
- package/lib/TracingGanttChart/MiniGanttChart/draw.d.ts +1 -1
- package/lib/TracingGanttChart/MiniGanttChart/draw.d.ts.map +1 -1
- package/lib/TracingGanttChart/MiniGanttChart/draw.js +2 -2
- package/lib/TracingGanttChart/MiniGanttChart/draw.js.map +1 -1
- package/lib/TracingGanttChart/Search.d.ts +2 -2
- package/lib/TracingGanttChart/Search.d.ts.map +1 -1
- package/lib/TracingGanttChart/Search.js +7 -7
- package/lib/TracingGanttChart/Search.js.map +1 -1
- package/lib/TracingGanttChart/Ticks.d.ts +3 -3
- package/lib/TracingGanttChart/Ticks.d.ts.map +1 -1
- package/lib/TracingGanttChart/Ticks.js +3 -3
- package/lib/TracingGanttChart/Ticks.js.map +1 -1
- package/lib/TracingGanttChart/TraceHeaderBar.d.ts +3 -3
- package/lib/TracingGanttChart/TraceHeaderBar.d.ts.map +1 -1
- package/lib/TracingGanttChart/TraceHeaderBar.js +6 -6
- package/lib/TracingGanttChart/TraceHeaderBar.js.map +1 -1
- package/lib/TracingGanttChart/TracingGanttChart.d.ts +3 -3
- package/lib/TracingGanttChart/TracingGanttChart.d.ts.map +1 -1
- package/lib/TracingGanttChart/TracingGanttChart.js +13 -11
- package/lib/TracingGanttChart/TracingGanttChart.js.map +1 -1
- package/lib/TracingGanttChart/palette.js +1 -1
- package/lib/TracingGanttChart/palette.js.map +1 -1
- package/lib/TracingGanttChart/trace.d.ts +2 -2
- package/lib/TracingGanttChart/trace.d.ts.map +1 -1
- package/lib/TracingGanttChart/trace.js +1 -1
- package/lib/TracingGanttChart/trace.js.map +1 -1
- package/lib/TracingGanttChart/utils.d.ts +3 -3
- package/lib/TracingGanttChart/utils.d.ts.map +1 -1
- package/lib/TracingGanttChart/utils.js +2 -2
- package/lib/TracingGanttChart/utils.js.map +1 -1
- package/lib/TracingGanttChart.d.ts +3 -3
- package/lib/TracingGanttChart.d.ts.map +1 -1
- package/lib/TracingGanttChart.js +3 -3
- package/lib/TracingGanttChart.js.map +1 -1
- package/lib/TracingGanttChartPanel.d.ts +4 -4
- package/lib/TracingGanttChartPanel.d.ts.map +1 -1
- package/lib/TracingGanttChartPanel.js +4 -4
- package/lib/TracingGanttChartPanel.js.map +1 -1
- package/lib/bootstrap.js +2 -2
- package/lib/getPluginModule.d.ts +1 -1
- package/lib/getPluginModule.d.ts.map +1 -1
- package/lib/getPluginModule.js +3 -1
- package/lib/getPluginModule.js.map +1 -1
- package/lib/index-federation.js +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/setup-tests.d.ts +1 -1
- package/lib/setup-tests.d.ts.map +1 -1
- package/lib/setup-tests.js +2 -2
- package/lib/setup-tests.js.map +1 -1
- package/lib/test/convert/jaeger.d.ts +1 -1
- package/lib/test/convert/jaeger.d.ts.map +1 -1
- package/lib/test/convert/jaeger.js.map +1 -1
- package/mf-manifest.json +35 -34
- package/mf-stats.json +35 -34
- package/package.json +10 -10
- package/__mf/js/async/121.1fc97c57.js +0 -2
- package/__mf/js/async/177.27fced63.js +0 -1
- package/__mf/js/async/192.ea308602.js +0 -1
- package/__mf/js/async/193.6692daa9.js +0 -1
- package/__mf/js/async/2.c5f68593.js +0 -1
- package/__mf/js/async/235.4f4ad5f0.js +0 -1
- package/__mf/js/async/274.03fc3289.js +0 -2
- package/__mf/js/async/30.991f7ee4.js +0 -39
- package/__mf/js/async/356.2e3c02c9.js +0 -1
- package/__mf/js/async/392.eb9b3bb9.js +0 -2
- package/__mf/js/async/43.b9d7bc56.js +0 -2
- package/__mf/js/async/47.514dc87f.js +0 -1
- package/__mf/js/async/470.9743e21d.js +0 -2
- package/__mf/js/async/546.b40699cb.js +0 -24
- package/__mf/js/async/546.b40699cb.js.LICENSE.txt +0 -19
- package/__mf/js/async/570.9d51e826.js +0 -7
- package/__mf/js/async/570.9d51e826.js.LICENSE.txt +0 -39
- package/__mf/js/async/581.aa52d024.js +0 -1
- package/__mf/js/async/587.f49a06d9.js +0 -1
- package/__mf/js/async/588.46394f24.js +0 -1
- package/__mf/js/async/616.09a93b54.js +0 -1
- package/__mf/js/async/71.f0d71a40.js +0 -1
- package/__mf/js/async/873.34370b2c.js +0 -1
- package/__mf/js/async/887.027eb62b.js +0 -110
- package/__mf/js/async/941.3d671d54.js +0 -2
- package/__mf/js/async/968.1ac51448.js +0 -1
- package/__mf/js/async/978.0c50ecf5.js +0 -1
- package/__mf/js/async/__federation_expose_TracingGanttChart.9c074bea.js +0 -1
- package/__mf/js/async/lib-router.5f492283.js +0 -2
- package/lib/cjs/PanelActions.js +0 -88
- package/lib/cjs/TracingGanttChart/DetailPane/Attributes.js +0 -204
- package/lib/cjs/TracingGanttChart/DetailPane/DetailPane.js +0 -129
- package/lib/cjs/TracingGanttChart/DetailPane/SpanEvents.js +0 -113
- package/lib/cjs/TracingGanttChart/DetailPane/SpanLinks.js +0 -72
- package/lib/cjs/TracingGanttChart/GanttTable/GanttTable.js +0 -154
- package/lib/cjs/TracingGanttChart/GanttTable/GanttTableHeader.js +0 -64
- package/lib/cjs/TracingGanttChart/GanttTable/GanttTableProvider.js +0 -60
- package/lib/cjs/TracingGanttChart/GanttTable/GanttTableRow.js +0 -77
- package/lib/cjs/TracingGanttChart/GanttTable/ResizableDivider.js +0 -98
- package/lib/cjs/TracingGanttChart/GanttTable/SpanDuration.js +0 -81
- package/lib/cjs/TracingGanttChart/GanttTable/SpanIndents.js +0 -97
- package/lib/cjs/TracingGanttChart/GanttTable/SpanLinksButton.js +0 -108
- package/lib/cjs/TracingGanttChart/GanttTable/SpanName.js +0 -83
- package/lib/cjs/TracingGanttChart/MiniGanttChart/Canvas.js +0 -256
- package/lib/cjs/TracingGanttChart/MiniGanttChart/MiniGanttChart.js +0 -59
- package/lib/cjs/TracingGanttChart/MiniGanttChart/draw.js +0 -45
- package/lib/cjs/TracingGanttChart/Search.js +0 -154
- package/lib/cjs/TracingGanttChart/Ticks.js +0 -106
- package/lib/cjs/TracingGanttChart/TraceHeaderBar.js +0 -159
- package/lib/cjs/TracingGanttChart/TracingGanttChart.js +0 -122
- package/lib/cjs/TracingGanttChart/palette.js +0 -83
- package/lib/cjs/TracingGanttChart/trace.js +0 -137
- package/lib/cjs/TracingGanttChart/utils.js +0 -117
- package/lib/cjs/TracingGanttChart.js +0 -37
- package/lib/cjs/TracingGanttChartPanel.js +0 -66
- package/lib/cjs/bootstrap.js +0 -26
- package/lib/cjs/env.d.js +0 -14
- package/lib/cjs/gantt-chart-model.js +0 -28
- package/lib/cjs/getPluginModule.js +0 -39
- package/lib/cjs/index-federation.js +0 -55
- package/lib/cjs/index.js +0 -39
- package/lib/cjs/setup-tests.js +0 -19
- package/lib/cjs/test/convert/jaeger.js +0 -86
- /package/__mf/css/async/{570.85c2cbf6.css → 776.85c2cbf6.css} +0 -0
- /package/__mf/js/async/{121.1fc97c57.js.LICENSE.txt → 121.5b3411ef.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{274.03fc3289.js.LICENSE.txt → 274.eee92e86.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.eb9b3bb9.js.LICENSE.txt → 392.a3f49cf0.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{43.b9d7bc56.js.LICENSE.txt → 43.cbae1eef.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{887.027eb62b.js.LICENSE.txt → 436.4db73a03.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{470.9743e21d.js.LICENSE.txt → 470.8d6cfc01.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.3d671d54.js.LICENSE.txt → 941.7ee2dbf0.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.5f492283.js.LICENSE.txt → lib-router.a8607481.js.LICENSE.txt} +0 -0
|
@@ -11,11 +11,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { Stack, styled, useTheme } from
|
|
15
|
-
import { memo } from
|
|
16
|
-
import { rowHeight } from
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
14
|
+
import { Stack, styled, useTheme } from "@mui/material";
|
|
15
|
+
import { memo } from "react";
|
|
16
|
+
import { rowHeight } from "../utils.js";
|
|
17
|
+
import { SpanDuration } from "./SpanDuration.js";
|
|
18
|
+
import { SpanName } from "./SpanName.js";
|
|
19
19
|
export const GanttTableRow = /*#__PURE__*/ memo(function GanttTableRow(props) {
|
|
20
20
|
const { options, customLinks, span, viewport, selected, matched, focused, nameColumnWidth, divider, onClick } = props;
|
|
21
21
|
const theme = useTheme();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/GanttTableRow.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Stack, styled, useTheme } from '@mui/material';\nimport { memo } from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/GanttTableRow.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Stack, styled, useTheme } from '@mui/material';\nimport { memo } from 'react';\n\nimport type { CustomLinks, TracingGanttChartOptions } from '../../gantt-chart-model';\nimport type { Span } from '../trace';\nimport type { Viewport } from '../utils';\nimport { rowHeight } from '../utils';\nimport { SpanDuration } from './SpanDuration';\nimport { SpanName } from './SpanName';\n\ninterface GanttTableRowProps {\n options: TracingGanttChartOptions;\n customLinks?: CustomLinks;\n span: Span;\n viewport: Viewport;\n /** this span is opened in the attribute pane */\n selected?: boolean;\n /** this span is matched in the search results */\n matched?: boolean;\n /** this span is focused by clicking prev/next in the search bar */\n focused?: boolean;\n nameColumnWidth: number;\n divider: React.ReactNode;\n onClick: (span: Span) => void;\n}\n\nexport const GanttTableRow = memo(function GanttTableRow(props: GanttTableRowProps) {\n const { options, customLinks, span, viewport, selected, matched, focused, nameColumnWidth, divider, onClick } = props;\n const theme = useTheme();\n\n const handleOnClick = (): void => {\n // ignore event if triggered by selecting text\n if (document.getSelection()?.type === 'Range') return;\n\n onClick(span);\n };\n\n let backgroundColor: string | undefined;\n if (selected) {\n backgroundColor = theme.palette.action.focus;\n } else if (focused) {\n backgroundColor = theme.palette.action.selected;\n } else if (matched) {\n backgroundColor = theme.palette.action.hover;\n }\n\n return (\n <RowContainer\n sx={{\n backgroundColor,\n // overwrite hover if background color is set (selected, focused or matched)\n '&:hover': backgroundColor ? { backgroundColor } : undefined,\n }}\n direction=\"row\"\n onClick={handleOnClick}\n >\n <SpanName customLinks={customLinks} span={span} nameColumnWidth={nameColumnWidth} />\n {divider}\n <SpanDuration options={options} span={span} viewport={viewport} />\n </RowContainer>\n );\n});\n\nconst RowContainer = styled(Stack)(({ theme }) => ({\n height: rowHeight,\n '&:hover': {\n backgroundColor: theme.palette.action.hover,\n borderTop: `1px solid ${theme.palette.divider}`,\n borderBottom: `1px solid ${theme.palette.divider}`,\n },\n}));\n"],"names":["Stack","styled","useTheme","memo","rowHeight","SpanDuration","SpanName","GanttTableRow","props","options","customLinks","span","viewport","selected","matched","focused","nameColumnWidth","divider","onClick","theme","handleOnClick","document","getSelection","type","backgroundColor","palette","action","focus","hover","RowContainer","sx","undefined","direction","height","borderTop","borderBottom"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,gBAAgB;AACxD,SAASC,IAAI,QAAQ,QAAQ;AAK7B,SAASC,SAAS,QAAQ,cAAW;AACrC,SAASC,YAAY,QAAQ,oBAAiB;AAC9C,SAASC,QAAQ,QAAQ,gBAAa;AAkBtC,OAAO,MAAMC,8BAAgBJ,KAAK,SAASI,cAAcC,KAAyB;IAChF,MAAM,EAAEC,OAAO,EAAEC,WAAW,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,EAAEC,eAAe,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGV;IAChH,MAAMW,QAAQjB;IAEd,MAAMkB,gBAAgB;QACpB,8CAA8C;QAC9C,IAAIC,SAASC,YAAY,IAAIC,SAAS,SAAS;QAE/CL,QAAQP;IACV;IAEA,IAAIa;IACJ,IAAIX,UAAU;QACZW,kBAAkBL,MAAMM,OAAO,CAACC,MAAM,CAACC,KAAK;IAC9C,OAAO,IAAIZ,SAAS;QAClBS,kBAAkBL,MAAMM,OAAO,CAACC,MAAM,CAACb,QAAQ;IACjD,OAAO,IAAIC,SAAS;QAClBU,kBAAkBL,MAAMM,OAAO,CAACC,MAAM,CAACE,KAAK;IAC9C;IAEA,qBACE,MAACC;QACCC,IAAI;YACFN;YACA,4EAA4E;YAC5E,WAAWA,kBAAkB;gBAAEA;YAAgB,IAAIO;QACrD;QACAC,WAAU;QACVd,SAASE;;0BAET,KAACd;gBAASI,aAAaA;gBAAaC,MAAMA;gBAAMK,iBAAiBA;;YAChEC;0BACD,KAACZ;gBAAaI,SAASA;gBAASE,MAAMA;gBAAMC,UAAUA;;;;AAG5D,GAAG;AAEH,MAAMiB,eAAe5B,OAAOD,OAAO,CAAC,EAAEmB,KAAK,EAAE,GAAM,CAAA;QACjDc,QAAQ7B;QACR,WAAW;YACToB,iBAAiBL,MAAMM,OAAO,CAACC,MAAM,CAACE,KAAK;YAC3CM,WAAW,CAAC,UAAU,EAAEf,MAAMM,OAAO,CAACR,OAAO,EAAE;YAC/CkB,cAAc,CAAC,UAAU,EAAEhB,MAAMM,OAAO,CAACR,OAAO,EAAE;QACpD;IACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResizableDivider.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/GanttTable/ResizableDivider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResizableDivider.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/GanttTable/ResizableDivider.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAiC,YAAY,EAAE,MAAM,OAAO,CAAC;AAGzE,UAAU,qBAAqB;IAC7B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CA2D3E"}
|
|
@@ -11,9 +11,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
14
|
+
import { Box, styled } from "@mui/material";
|
|
15
|
+
import { useEvent } from "@perses-dev/plugin-system";
|
|
16
|
+
import { useEffect, useState } from "react";
|
|
17
17
|
export function ResizableDivider(props) {
|
|
18
18
|
const { parentRef, spacing = 0, onMove } = props;
|
|
19
19
|
const [isResizing, setResizing] = useState(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/ResizableDivider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/ResizableDivider.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, styled } from '@mui/material';\nimport { useEvent } from '@perses-dev/plugin-system';\nimport type { MouseEvent as ReactMouseEvent, ReactElement } from 'react';\nimport { useEffect, useState } from 'react';\n\ninterface ResizableDividerProps {\n parentRef: React.RefObject<Element>;\n spacing?: number;\n onMove: (left: number) => void;\n}\n\nexport function ResizableDivider(props: ResizableDividerProps): ReactElement {\n const { parentRef, spacing = 0, onMove } = props;\n const [isResizing, setResizing] = useState(false);\n\n const handleMouseDown = (e: ReactMouseEvent): void => {\n // disable any default actions (text selection, etc.)\n e.preventDefault();\n\n setResizing(true);\n };\n\n // need stable reference for window.removeEventListener() in useEffect() below\n const handleMouseMove = useEvent((e: MouseEvent) => {\n if (!parentRef.current) return;\n\n const parentRect = parentRef.current.getBoundingClientRect();\n\n // The parent can be a flex row, for example: [leftPercent] [gap] [divider] [gap] [1-leftPercent].\n // Without considering spacing, leftPercent would be wrong because it ignores the flex gap between the divider and the element.\n const offsetX = e.clientX - parentRect.left + spacing;\n const leftPercent = offsetX / parentRect.width;\n\n if (0.05 <= leftPercent && leftPercent <= 0.95) {\n onMove(leftPercent);\n }\n });\n\n // need stable reference for window.removeEventListener() in useEffect() below\n const handleMouseUp = useEvent(() => {\n setResizing(false);\n });\n\n // capture mouseMove and mouseUp outside the element by attaching them to the window object\n useEffect(() => {\n function startMouseAction(): void {\n window.addEventListener('mousemove', handleMouseMove);\n window.addEventListener('mouseup', handleMouseUp);\n document.body.style.cursor = 'col-resize';\n }\n\n function stopMouseAction(): void {\n window.removeEventListener('mousemove', handleMouseMove);\n window.removeEventListener('mouseup', handleMouseUp);\n document.body.style.cursor = 'inherit';\n }\n\n if (isResizing) {\n startMouseAction();\n } else {\n stopMouseAction();\n }\n\n return stopMouseAction;\n }, [isResizing, handleMouseMove, handleMouseUp]);\n\n // prevent onClick event when clicking on a divider\n const stopEventPropagation = (e: ReactMouseEvent): void => e.stopPropagation();\n\n return <ResizableDividerBox onMouseDown={handleMouseDown} onClick={stopEventPropagation} />;\n}\n\nconst ResizableDividerBox = styled(Box)(({ theme }) => ({\n position: 'relative',\n width: '1px',\n minWidth: '1px',\n height: '100%',\n backgroundColor: theme.palette.divider,\n cursor: 'col-resize',\n\n // increase clickable area from 1px to 7px\n '&:before': {\n position: 'absolute',\n width: '7px',\n left: '-3px',\n top: 0,\n bottom: 0,\n content: '\" \"',\n zIndex: 1, // without zIndex, the span duration row hides the right side of this element\n },\n}));\n"],"names":["Box","styled","useEvent","useEffect","useState","ResizableDivider","props","parentRef","spacing","onMove","isResizing","setResizing","handleMouseDown","e","preventDefault","handleMouseMove","current","parentRect","getBoundingClientRect","offsetX","clientX","left","leftPercent","width","handleMouseUp","startMouseAction","window","addEventListener","document","body","style","cursor","stopMouseAction","removeEventListener","stopEventPropagation","stopPropagation","ResizableDividerBox","onMouseDown","onClick","theme","position","minWidth","height","backgroundColor","palette","divider","top","bottom","content","zIndex"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,EAAEC,MAAM,QAAQ,gBAAgB;AAC5C,SAASC,QAAQ,QAAQ,4BAA4B;AAErD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAQ5C,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,SAAS,EAAEC,UAAU,CAAC,EAAEC,MAAM,EAAE,GAAGH;IAC3C,MAAM,CAACI,YAAYC,YAAY,GAAGP,SAAS;IAE3C,MAAMQ,kBAAkB,CAACC;QACvB,qDAAqD;QACrDA,EAAEC,cAAc;QAEhBH,YAAY;IACd;IAEA,8EAA8E;IAC9E,MAAMI,kBAAkBb,SAAS,CAACW;QAChC,IAAI,CAACN,UAAUS,OAAO,EAAE;QAExB,MAAMC,aAAaV,UAAUS,OAAO,CAACE,qBAAqB;QA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type { ReactElement } from 'react';
|
|
2
|
+
import type { TracingGanttChartOptions } from '../../gantt-chart-model';
|
|
3
|
+
import type { Span } from '../trace';
|
|
4
|
+
import type { Viewport } from '../utils';
|
|
5
5
|
export interface SpanDurationProps {
|
|
6
6
|
options: TracingGanttChartOptions;
|
|
7
7
|
span: Span;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpanDuration.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/GanttTable/SpanDuration.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SpanDuration.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/GanttTable/SpanDuration.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,wBAAwB,CAAC;IAClC,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CAuDnE"}
|
|
@@ -11,10 +11,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { Box, useTheme } from
|
|
15
|
-
import { useChartsTheme } from
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
14
|
+
import { Box, useTheme } from "@mui/material";
|
|
15
|
+
import { useChartsTheme } from "@perses-dev/components";
|
|
16
|
+
import { Ticks } from "../Ticks.js";
|
|
17
|
+
import { formatDuration, getSpanColor, minSpanWidthPx } from "../utils.js";
|
|
18
18
|
/**
|
|
19
19
|
* SpanDuration renders the right column of a SpanRow, i.e. the span bar and span duration
|
|
20
20
|
*/ export function SpanDuration(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/SpanDuration.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, useTheme } from '@mui/material';\nimport { useChartsTheme } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/SpanDuration.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, useTheme } from '@mui/material';\nimport { useChartsTheme } from '@perses-dev/components';\nimport type { ReactElement } from 'react';\n\nimport type { TracingGanttChartOptions } from '../../gantt-chart-model';\nimport { Ticks } from '../Ticks';\nimport type { Span } from '../trace';\nimport type { Viewport } from '../utils';\nimport { formatDuration, getSpanColor, minSpanWidthPx } from '../utils';\n\nexport interface SpanDurationProps {\n options: TracingGanttChartOptions;\n span: Span;\n viewport: Viewport;\n}\n\n/**\n * SpanDuration renders the right column of a SpanRow, i.e. the span bar and span duration\n */\nexport function SpanDuration(props: SpanDurationProps): ReactElement {\n const { options, span, viewport } = props;\n const muiTheme = useTheme();\n const chartsTheme = useChartsTheme();\n\n const spanDuration = span.endTimeUnixMs - span.startTimeUnixMs;\n const viewportDuration = viewport.endTimeUnixMs - viewport.startTimeUnixMs;\n const relativeDuration = spanDuration / viewportDuration;\n const relativeStart = (span.startTimeUnixMs - viewport.startTimeUnixMs) / viewportDuration;\n\n return (\n <Box sx={{ position: 'relative', height: '100%', flexGrow: 1, overflow: 'hidden' }}>\n <Ticks />\n <Box\n data-testid=\"span-duration-bar\"\n sx={{\n position: 'absolute',\n top: 0,\n bottom: 0,\n margin: 'auto',\n minWidth: `${minSpanWidthPx}px`,\n height: '8px',\n borderRadius: muiTheme.shape.borderRadius,\n }}\n style={{\n left: `${relativeStart * 100}%`,\n width: `${relativeDuration * 100}%`,\n backgroundColor: getSpanColor(muiTheme, chartsTheme, options.visual?.palette?.mode, span),\n }}\n />\n <Box\n sx={{\n position: 'absolute',\n top: '50%',\n transform: 'translateY(-50%)',\n padding: '0 8px',\n color: muiTheme.palette.grey[700],\n fontSize: '.7rem',\n }}\n style={\n /* print span duration on right side of the span bar, if there is space */\n relativeStart + relativeDuration < 0.95\n ? {\n left: `${(relativeStart + relativeDuration) * 100}%`,\n }\n : {\n left: `${relativeStart * 100}%`,\n transform: 'translateY(-50%) translateX(-100%)',\n }\n }\n >\n {formatDuration(spanDuration)}\n </Box>\n </Box>\n );\n}\n"],"names":["Box","useTheme","useChartsTheme","Ticks","formatDuration","getSpanColor","minSpanWidthPx","SpanDuration","props","options","span","viewport","muiTheme","chartsTheme","spanDuration","endTimeUnixMs","startTimeUnixMs","viewportDuration","relativeDuration","relativeStart","sx","position","height","flexGrow","overflow","data-testid","top","bottom","margin","minWidth","borderRadius","shape","style","left","width","backgroundColor","visual","palette","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MAAM,EAAEC,SAASC,MAAM5B;gBACtF;;0BAEF,KAACV;gBACCoB,IAAI;oBACFC,UAAU;oBACVK,KAAK;oBACLa,WAAW;oBACXC,SAAS;oBACTC,OAAO7B,SAASyB,OAAO,CAACK,IAAI,CAAC,IAAI;oBACjCC,UAAU;gBACZ;gBACAX,OACE,wEAAwE,GACxEb,gBAAgBD,mBAAmB,OAC/B;oBACEe,MAAM,GAAG,AAACd,CAAAA,gBAAgBD,gBAAe,IAAK,IAAI,CAAC,CAAC;gBACtD,IACA;oBACEe,MAAM,GAAGd,gBAAgB,IAAI,CAAC,CAAC;oBAC/BoB,WAAW;gBACb;0BAGLnC,eAAeU;;;;AAIxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpanIndents.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/GanttTable/SpanIndents.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"SpanIndents.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/GanttTable/SpanIndents.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAMrC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,IAAI,CAAC;CACZ;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CA2DjE"}
|
|
@@ -11,11 +11,11 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { styled, useTheme } from
|
|
15
|
-
import ChevronDownIcon from
|
|
16
|
-
import ChevronRightIcon from
|
|
17
|
-
import { useCallback } from
|
|
18
|
-
import { useGanttTableContext } from
|
|
14
|
+
import { styled, useTheme } from "@mui/material";
|
|
15
|
+
import ChevronDownIcon from "mdi-material-ui/ChevronDown";
|
|
16
|
+
import ChevronRightIcon from "mdi-material-ui/ChevronRight";
|
|
17
|
+
import { useCallback } from "react";
|
|
18
|
+
import { useGanttTableContext } from "./GanttTableProvider.js";
|
|
19
19
|
const MIN_INDENT_WIDTH = 8;
|
|
20
20
|
const MAX_INDENT_WIDTH = 24;
|
|
21
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/SpanIndents.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { styled, useTheme } from '@mui/material';\nimport ChevronDownIcon from 'mdi-material-ui/ChevronDown';\nimport ChevronRightIcon from 'mdi-material-ui/ChevronRight';\nimport { MouseEvent, ReactElement
|
|
1
|
+
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/SpanIndents.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { styled, useTheme } from '@mui/material';\nimport ChevronDownIcon from 'mdi-material-ui/ChevronDown';\nimport ChevronRightIcon from 'mdi-material-ui/ChevronRight';\nimport type { MouseEvent, ReactElement } from 'react';\nimport { useCallback } from 'react';\n\nimport type { Span } from '../trace';\nimport { useGanttTableContext } from './GanttTableProvider';\n\nconst MIN_INDENT_WIDTH = 8;\nconst MAX_INDENT_WIDTH = 24;\n\nexport interface SpanIndentsProps {\n span: Span;\n}\n\n/**\n * SpanIndents renders the indention boxes,\n * and handles the click and mouseOver events\n *\n * Note: This component gets re-rendered on every hover of any indention box,\n * therefore rendering performance is essential.\n */\nexport function SpanIndents(props: SpanIndentsProps): ReactElement {\n const { span } = props;\n const { collapsedSpans, setCollapsedSpans, visibleSpans, hoveredParent, setHoveredParent } = useGanttTableContext();\n const theme = useTheme();\n\n const handleToggleClick = useCallback(\n (e: MouseEvent) => {\n e.stopPropagation();\n setCollapsedSpans((prev) => {\n const next = new Set(prev);\n if (next.has(span.spanId)) {\n next.delete(span.spanId);\n } else {\n next.add(span.spanId);\n }\n return next;\n });\n },\n [span, setCollapsedSpans],\n );\n\n const handleIconMouseEnter = useCallback(() => {\n setHoveredParent(span.spanId);\n }, [span, setHoveredParent]);\n\n const spans = [span];\n let parent = span.parentSpan;\n while (parent) {\n spans.unshift(parent);\n parent = parent.parentSpan;\n }\n\n // on first render visibleSpans is empty, therefore let's use MAX_INDENT_WIDTH to avoid an animation on page load.\n return (\n <>\n {spans.map((span, i) => (\n <SpanIndentBox\n key={span.spanId}\n style={{\n width:\n i === spans.length - 1 || visibleSpans.length === 0 || visibleSpans.includes(span.spanId)\n ? MAX_INDENT_WIDTH\n : MIN_INDENT_WIDTH,\n borderLeft: `${hoveredParent === (span.parentSpanId ?? '') ? 3 : 1}px solid ${theme.palette.divider}`,\n }}\n onMouseEnter={() => setHoveredParent(span.parentSpanId ?? '')}\n onMouseLeave={() => setHoveredParent(undefined)}\n >\n {i === spans.length - 1 &&\n span.childSpans.length > 0 &&\n (collapsedSpans.has(span.spanId) ? (\n <ChevronRightIcon titleAccess=\"expand\" onClick={handleToggleClick} onMouseEnter={handleIconMouseEnter} />\n ) : (\n <ChevronDownIcon titleAccess=\"collapse\" onClick={handleToggleClick} onMouseEnter={handleIconMouseEnter} />\n ))}\n </SpanIndentBox>\n ))}\n </>\n );\n}\n\nconst SpanIndentBox = styled('div')({\n display: 'flex',\n height: '100%',\n alignItems: 'center',\n justifyContent: 'flex-end',\n flexShrink: 0,\n transition: 'width 1s',\n});\n"],"names":["styled","useTheme","ChevronDownIcon","ChevronRightIcon","useCallback","useGanttTableContext","MIN_INDENT_WIDTH","MAX_INDENT_WIDTH","SpanIndents","props","span","collapsedSpans","setCollapsedSpans","visibleSpans","hoveredParent","setHoveredParent","theme","handleToggleClick","e","stopPropagation","prev","next","Set","has","spanId","delete","add","handleIconMouseEnter","spans","parent","parentSpan","unshift","map","i","SpanIndentBox","style","width","length","includes","borderLeft","parentSpanId","palette","divider","onMouseEnter","onMouseLeave","undefined","childSpans","titleAccess","onClick","display","height","alignItems","justifyContent","flexShrink","transition"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,EAAEC,QAAQ,QAAQ,gBAAgB;AACjD,OAAOC,qBAAqB,8BAA8B;AAC1D,OAAOC,sBAAsB,+BAA+B;AAE5D,SAASC,WAAW,QAAQ,QAAQ;AAGpC,SAASC,oBAAoB,QAAQ,0BAAuB;AAE5D,MAAMC,mBAAmB;AACzB,MAAMC,mBAAmB;AAMzB;;;;;;CAMC,GACD,OAAO,SAASC,YAAYC,KAAuB;IACjD,MAAM,EAAEC,IAAI,EAAE,GAAGD;IACjB,MAAM,EAAEE,cAAc,EAAEC,iBAAiB,EAAEC,YAAY,EAAEC,aAAa,EAAEC,gBAAgB,EAAE,GAAGV;IAC7F,MAAMW,QAAQf;IAEd,MAAMgB,oBAA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cAAchB;kBACpF;eAjBGjB,KAAKc,MAAM;;AAsB1B;AAEA,MAAMU,gBAAgBlC,OAAO,OAAO;IAClCiD,SAAS;IACTC,QAAQ;IACRC,YAAY;IACZC,gBAAgB;IAChBC,YAAY;IACZC,YAAY;AACd"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { CustomLinks } from '../../gantt-chart-model';
|
|
3
|
+
import type { Span } from '../trace';
|
|
4
4
|
export interface SpanLinksButtonProps {
|
|
5
5
|
customLinks: CustomLinks;
|
|
6
6
|
span: Span;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpanLinksButton.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/GanttTable/SpanLinksButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SpanLinksButton.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/GanttTable/SpanLinksButton.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,WAAW,CAAC;IACzB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,GAAG,IAAI,CA6EhF"}
|
|
@@ -11,11 +11,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { IconButton, Menu, MenuItem } from
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
14
|
+
import { IconButton, Menu, MenuItem } from "@mui/material";
|
|
15
|
+
import { InfoTooltip } from "@perses-dev/components";
|
|
16
|
+
import { replaceVariablesInString, useAllVariableValues, useRouterContext } from "@perses-dev/plugin-system";
|
|
17
|
+
import LaunchIcon from "mdi-material-ui/Launch";
|
|
18
|
+
import { useState } from "react";
|
|
19
19
|
export function SpanLinksButton(props) {
|
|
20
20
|
const { customLinks, span } = props;
|
|
21
21
|
const variableValues = useAllVariableValues();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/SpanLinksButton.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { IconButton, Menu, MenuItem } from '@mui/material';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/SpanLinksButton.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { IconButton, Menu, MenuItem } from '@mui/material';\nimport { InfoTooltip } from '@perses-dev/components';\nimport { replaceVariablesInString, useAllVariableValues, useRouterContext } from '@perses-dev/plugin-system';\nimport LaunchIcon from 'mdi-material-ui/Launch';\nimport type { MouseEvent, ReactElement } from 'react';\nimport { useState } from 'react';\n\nimport type { CustomLinks } from '../../gantt-chart-model';\nimport type { Span } from '../trace';\n\nexport interface SpanLinksButtonProps {\n customLinks: CustomLinks;\n span: Span;\n}\n\nexport function SpanLinksButton(props: SpanLinksButtonProps): ReactElement | null {\n const { customLinks, span } = props;\n const variableValues = useAllVariableValues();\n const { RouterComponent } = useRouterContext();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n const isOpen = Boolean(anchorEl);\n\n if (!RouterComponent || !customLinks.links.span) {\n return null;\n }\n\n // if there is a single span link, render the button directly without a menu\n if (span.links.length === 1 && span.links[0]) {\n const link = span.links[0];\n return (\n <InfoTooltip description=\"open linked span\">\n <IconButton\n size=\"small\"\n component={RouterComponent}\n to={replaceVariablesInString(customLinks.links.span, variableValues, {\n ...customLinks.variables,\n traceId: link.traceId,\n spanId: link.spanId,\n })}\n >\n <LaunchIcon fontSize=\"inherit\" />\n </IconButton>\n </InfoTooltip>\n );\n }\n\n const handleOpenMenu = (event: MouseEvent<HTMLButtonElement>): void => {\n // do not propagate onClick event to the table row (otherwise, the detail pane would open)\n event.stopPropagation();\n\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = (event: MouseEvent): void => {\n // Closing the menu, i.e. clicking on the fullscreen transparent MUI backdrop element, does trigger a click on the table row (which opens the detail pane).\n // Therefore, stop propagating this event\n event.stopPropagation();\n\n setAnchorEl(null);\n };\n\n return (\n <>\n <InfoTooltip description={`${span.links.length} linked spans`}>\n <IconButton\n aria-label=\"span links\"\n aria-haspopup=\"true\"\n aria-expanded={isOpen ? 'true' : undefined}\n size=\"small\"\n onClick={handleOpenMenu}\n >\n <LaunchIcon fontSize=\"inherit\" />\n </IconButton>\n </InfoTooltip>\n <Menu anchorEl={anchorEl} open={isOpen} onClose={handleClose}>\n {span.links.map((link) => (\n <MenuItem\n key={link.spanId}\n component={RouterComponent}\n onClick={handleClose}\n to={replaceVariablesInString(customLinks.links.span!, variableValues, {\n ...customLinks.variables,\n traceId: link.traceId,\n spanId: link.spanId,\n })}\n >\n Open linked span {link.spanId}\n </MenuItem>\n ))}\n </Menu>\n </>\n );\n}\n"],"names":["IconButton","Menu","MenuItem","InfoTooltip","replaceVariablesInString","useAllVariableValues","useRouterContext","LaunchIcon","useState","SpanLinksButton","props","customLinks","span","variableValues","RouterComponent","anchorEl","setAnchorEl","isOpen","Boolean","links","length","link","description","size","component","to","variables","traceId","spanId","fontSize","handleOpenMenu","event","stopPropagation","currentTarget","handleClose","aria-label","aria-haspopup","aria-expanded","undefined","onClick","open","onClose","map"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,UAAU,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,gBAAgB;AAC3D,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,wBAAwB,EAAEC,oBAAoB,EAAEC,gBAAgB,QAAQ,4BAA4B;AAC7G,OAAOC,gBAAgB,yBAAyB;AAEhD,SAASC,QAAQ,QAAQ,QAAQ;AAUjC,OAAO,SAASC,gBAAgBC,KAA2B;IACzD,MAAM,EAAEC,WAAW,EAAEC,IAAI,EAAE,GAAGF;IAC9B,MAAMG,iBAAiBR;IACvB,MAAM,EAAES,eAAe,EAAE,GAAGR;IAC5B,MAAM,CAACS,UAAUC,YAAY,GAAGR,SAA6B;IAC7D,MAAMS,SAASC,QAAQH;IAEvB,IAAI,CAACD,mBAAmB,CAACH,YAAYQ,KAAK,CAACP,IAAI,EAAE;QAC/C,OAAO;IACT;IAEA,4EAA4E;IAC5E,IAAIA,KAAKO,KAAK,CAACC,MAAM,KAAK,KAAKR,KAAKO,KAAK,CAAC,E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|
|
3
|
-
import {
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { CustomLinks } from '../../gantt-chart-model';
|
|
3
|
+
import type { Span } from '../trace';
|
|
4
4
|
export interface SpanNameProps {
|
|
5
5
|
customLinks?: CustomLinks;
|
|
6
6
|
span: Span;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpanName.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/GanttTable/SpanName.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SpanName.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/GanttTable/SpanName.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAKrC,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CAiB3D"}
|
|
@@ -11,11 +11,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { Box, Stack } from
|
|
15
|
-
import AlertIcon from
|
|
16
|
-
import { spanHasError } from
|
|
17
|
-
import { SpanIndents } from
|
|
18
|
-
import { SpanLinksButton } from
|
|
14
|
+
import { Box, Stack } from "@mui/material";
|
|
15
|
+
import AlertIcon from "mdi-material-ui/AlertCircleOutline";
|
|
16
|
+
import { spanHasError } from "../utils.js";
|
|
17
|
+
import { SpanIndents } from "./SpanIndents.js";
|
|
18
|
+
import { SpanLinksButton } from "./SpanLinksButton.js";
|
|
19
19
|
/**
|
|
20
20
|
* SpanName renders the entire left column of a SpanRow, i.e. the hierarchy and the service and span name
|
|
21
21
|
*/ export function SpanName(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/SpanName.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Stack } from '@mui/material';\nimport AlertIcon from 'mdi-material-ui/AlertCircleOutline';\nimport { ReactElement } from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/TracingGanttChart/GanttTable/SpanName.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, Stack } from '@mui/material';\nimport AlertIcon from 'mdi-material-ui/AlertCircleOutline';\nimport type { ReactElement } from 'react';\n\nimport type { CustomLinks } from '../../gantt-chart-model';\nimport type { Span } from '../trace';\nimport { spanHasError } from '../utils';\nimport { SpanIndents } from './SpanIndents';\nimport { SpanLinksButton } from './SpanLinksButton';\n\nexport interface SpanNameProps {\n customLinks?: CustomLinks;\n span: Span;\n nameColumnWidth: number;\n}\n\n/**\n * SpanName renders the entire left column of a SpanRow, i.e. the hierarchy and the service and span name\n */\nexport function SpanName(props: SpanNameProps): ReactElement {\n const { customLinks, span, nameColumnWidth } = props;\n\n return (\n <Stack direction=\"row\" sx={{ alignItems: 'center' }} style={{ width: `${nameColumnWidth * 100}%` }}>\n <SpanIndents span={span} />\n {spanHasError(span) && <AlertIcon titleAccess=\"error\" color=\"error\" sx={{ marginRight: '5px' }} />}\n <Box sx={{ whiteSpace: 'nowrap', overflow: 'hidden' }}>\n <strong>{span.resource.serviceName}:</strong> {span.name}\n </Box>\n {customLinks && customLinks.links.span && span.links.length > 0 && (\n <Box sx={{ marginLeft: 'auto', px: 1 }}>\n <SpanLinksButton customLinks={customLinks} span={span} />\n </Box>\n )}\n </Stack>\n );\n}\n"],"names":["Box","Stack","AlertIcon","spanHasError","SpanIndents","SpanLinksButton","SpanName","props","customLinks","span","nameColumnWidth","direction","sx","alignItems","style","width","titleAccess","color","marginRight","whiteSpace","overflow","strong","resource","serviceName","name","links","length","marginLeft","px"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,EAAEC,KAAK,QAAQ,gBAAgB;AAC3C,OAAOC,eAAe,qCAAqC;AAK3D,SAASC,YAAY,QAAQ,cAAW;AACxC,SAASC,WAAW,QAAQ,mBAAgB;AAC5C,SAASC,eAAe,QAAQ,uBAAoB;AAQpD;;CAEC,GACD,OAAO,SAASC,SAASC,KAAoB;IAC3C,MAAM,EAAEC,WAAW,EAAEC,IAAI,EAAEC,eAAe,EAAE,GAAGH;IAE/C,qBACE,MAACN;QAAMU,WAAU;QAAMC,IAAI;YAAEC,YAAY;QAAS;QAAGC,OAAO;YAAEC,OAAO,GAAGL,kBAAkB,IAAI,CAAC,CAAC;QAAC;;0BAC/F,KAACN;gBAAYK,MAAMA;;YAClBN,aAAaM,uBAAS,KAACP;gBAAUc,aAAY;gBAAQC,OAAM;gBAAQL,IAAI;oBAAEM,aAAa;gBAAM;;0BAC7F,MAAClB;gBAAIY,IAAI;oBAAEO,YAAY;oBAAUC,UAAU;gBAAS;;kCAClD,MAACC;;4BAAQZ,KAAKa,QAAQ,CAACC,WAAW;4BAAC;;;oBAAU;oBAAEd,KAAKe,IAAI;;;YAEzDhB,eAAeA,YAAYiB,KAAK,CAAChB,IAAI,IAAIA,KAAKgB,KAAK,CAACC,MAAM,GAAG,mBAC5D,KAAC1B;gBAAIY,IAAI;oBAAEe,YAAY;oBAAQC,IAAI;gBAAE;0BACnC,cAAA,KAACvB;oBAAgBG,aAAaA;oBAAaC,MAAMA;;;;;AAK3D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { TracingGanttChartOptions } from '../../gantt-chart-model';
|
|
3
|
+
import type { Trace } from '../trace';
|
|
4
|
+
import type { Viewport } from '../utils';
|
|
5
5
|
interface CanvasProps {
|
|
6
6
|
options: TracingGanttChartOptions;
|
|
7
7
|
trace: Trace;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/MiniGanttChart/Canvas.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Canvas.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/MiniGanttChart/Canvas.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAiC,YAAY,EAAE,MAAM,OAAO,CAAC;AAIzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,KAAK,EAAQ,KAAK,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAMzC,UAAU,WAAW;IACnB,OAAO,EAAE,wBAAwB,CAAC;IAClC,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;CACpC;AAOD,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CA2JvD"}
|
|
@@ -11,14 +11,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { Box, styled, useTheme } from
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import { Ticks } from
|
|
20
|
-
import { getSpanColor } from
|
|
21
|
-
import { drawSpans } from
|
|
14
|
+
import { Box, styled, useTheme } from "@mui/material";
|
|
15
|
+
import { useChartsTheme } from "@perses-dev/components";
|
|
16
|
+
import { useEvent } from "@perses-dev/plugin-system";
|
|
17
|
+
import { useEffect, useRef, useState, useCallback } from "react";
|
|
18
|
+
import useResizeObserver from "use-resize-observer";
|
|
19
|
+
import { Ticks } from "../Ticks.js";
|
|
20
|
+
import { getSpanColor } from "../utils.js";
|
|
21
|
+
import { drawSpans } from "./draw.js";
|
|
22
22
|
const CANVAS_HEIGHT = 60;
|
|
23
23
|
export function Canvas(props) {
|
|
24
24
|
const { options, trace, viewport, setViewport } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/TracingGanttChart/MiniGanttChart/Canvas.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, styled, useTheme } from '@mui/material';\nimport useResizeObserver from 'use-resize-observer';\nimport { useEffect, useRef, MouseEvent as ReactMouseEvent, useState, useCallback, ReactElement } from 'react';\nimport { useEvent } from '@perses-dev/plugin-system';\nimport { useChartsTheme } from '@perses-dev/components';\nimport { Ticks } from '../Ticks';\nimport { getSpanColor, Viewport } from '../utils';\nimport { TracingGanttChartOptions } from '../../gantt-chart-model';\nimport { Span, Trace } from '../trace';\nimport { drawSpans } from './draw';\n\nconst CANVAS_HEIGHT = 60;\n\ninterface CanvasProps {\n options: TracingGanttChartOptions;\n trace: Trace;\n viewport: Viewport;\n setViewport: (v: Viewport) => void;\n}\n\ntype MouseState =\n { type: 'none' } | { type: 'resize'; fixedPoint: number } | { type: 'drag'; start: number; end: number };\n\nexport function Canvas(props: CanvasProps): ReactElement {\n const { options, trace, viewport, setViewport } = props;\n const muiTheme = useTheme();\n const chartsTheme = useChartsTheme();\n // the <canvas> element must have an absolute width and height to avoid rendering problems\n // the wrapper box is required to get the available dimensions for the <canvas> element\n const { width, ref: wrapperRef } = useResizeObserver();\n const height = CANVAS_HEIGHT;\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const [mouseState, setMouseState] = useState<MouseState>({ type: 'none' });\n\n const traceDuration = trace.endTimeUnixMs - trace.startTimeUnixMs;\n const relativeCutoffLeft = (viewport.startTimeUnixMs - trace.startTimeUnixMs) / traceDuration;\n const relativeCutoffRight = (trace.endTimeUnixMs - viewport.endTimeUnixMs) / traceDuration;\n\n const spanColorGenerator = useCallback(\n (span: Span) => getSpanColor(muiTheme, chartsTheme, options.visual?.palette?.mode, span),\n [muiTheme, chartsTheme, options.visual?.palette?.mode]\n );\n\n useEffect(() => {\n if (!canvasRef.current || !width || !height) return;\n\n const ctx = canvasRef.current.getContext('2d');\n if (!ctx) return;\n\n drawSpans(ctx, width, height, trace, spanColorGenerator);\n }, [width, height, trace, spanColorGenerator]);\n\n const translateCursorToTime = (e: ReactMouseEvent | MouseEvent): number => {\n if (!canvasRef.current || !width) return 0;\n // e.nativeEvent.offsetX doesn't work when sliding over a tick box\n const offsetX = e.clientX - canvasRef.current.getBoundingClientRect().left;\n return trace.startTimeUnixMs + (offsetX / width) * traceDuration;\n };\n\n const handleMouseDown = (e: ReactMouseEvent<HTMLDivElement>): void => {\n e.preventDefault();\n if (!(e.target instanceof HTMLElement)) return;\n\n const isDefaultViewport =\n viewport.startTimeUnixMs === trace.startTimeUnixMs && viewport.endTimeUnixMs === trace.endTimeUnixMs;\n const elem = e.target.dataset['elem'];\n const cursor = translateCursorToTime(e);\n\n if (elem === 'resizerLeft') {\n setMouseState({ type: 'resize', fixedPoint: viewport.endTimeUnixMs });\n } else if (elem === 'resizerRight') {\n setMouseState({ type: 'resize', fixedPoint: viewport.startTimeUnixMs });\n } else if (elem === 'cutoffBox' || isDefaultViewport) {\n setMouseState({ type: 'resize', fixedPoint: cursor });\n setViewport({ startTimeUnixMs: cursor, endTimeUnixMs: cursor });\n } else {\n setMouseState({\n type: 'drag',\n start: cursor - viewport.startTimeUnixMs,\n end: viewport.endTimeUnixMs - cursor,\n });\n }\n };\n\n // need stable reference for window.removeEventListener() in useEffect() below\n const handleMouseMove = useEvent((e: MouseEvent) => {\n e.preventDefault();\n\n switch (mouseState.type) {\n case 'none':\n return;\n\n case 'resize': {\n const pointA = mouseState.fixedPoint;\n const pointB = translateCursorToTime(e);\n\n let start, end;\n if (pointA < pointB) {\n start = pointA;\n end = pointB;\n } else {\n start = pointB;\n end = pointA;\n }\n\n setViewport({\n startTimeUnixMs: Math.max(start, trace.startTimeUnixMs),\n endTimeUnixMs: Math.min(end, trace.endTimeUnixMs),\n });\n return;\n }\n\n case 'drag': {\n // avoid using e.movementX here, as it skips events in chrome,\n // resulting in the mouse pointer moving faster than the viewport box\n const { start, end } = mouseState;\n let cursor = translateCursorToTime(e);\n\n if (cursor - start < trace.startTimeUnixMs) {\n cursor = trace.startTimeUnixMs + start;\n }\n if (cursor + end > trace.endTimeUnixMs) {\n cursor = trace.endTimeUnixMs - end;\n }\n\n setViewport({\n startTimeUnixMs: cursor - start,\n endTimeUnixMs: cursor + end,\n });\n return;\n }\n }\n });\n\n // need stable reference for window.removeEventListener() in useEffect() below\n const handleMouseUp = useEvent((e: MouseEvent) => {\n e.preventDefault();\n setMouseState({ type: 'none' });\n\n // reset viewport if start === end, i.e. a click without movement\n if (viewport.startTimeUnixMs === viewport.endTimeUnixMs) {\n setViewport({ startTimeUnixMs: trace.startTimeUnixMs, endTimeUnixMs: trace.endTimeUnixMs });\n }\n });\n\n // capture mouseMove and mouseUp outside the element by attaching them to the window object\n useEffect(() => {\n function startMouseAction(): void {\n window.addEventListener('mousemove', handleMouseMove);\n window.addEventListener('mouseup', handleMouseUp);\n document.body.style.cursor = mouseState.type === 'resize' ? 'col-resize' : 'move';\n }\n\n function stopMouseAction(): void {\n window.removeEventListener('mousemove', handleMouseMove);\n window.removeEventListener('mouseup', handleMouseUp);\n document.body.style.cursor = 'inherit';\n }\n\n if (mouseState.type === 'none') {\n stopMouseAction();\n } else {\n startMouseAction();\n }\n\n return stopMouseAction;\n }, [mouseState, handleMouseMove, handleMouseUp]);\n\n return (\n <Box ref={wrapperRef} sx={{ position: 'relative', height }} onMouseDown={handleMouseDown}>\n <canvas ref={canvasRef} width={width} height={height} style={{ position: 'absolute' }} />\n <Ticks />\n <CutoffBox data-elem=\"cutoffBox\" style={{ left: 0, width: `${relativeCutoffLeft * 100}%` }} />\n <Resizer data-elem=\"resizerLeft\" style={{ left: `${relativeCutoffLeft * 100}%` }} />\n <Resizer data-elem=\"resizerRight\" style={{ right: `${relativeCutoffRight * 100}%` }} />\n <CutoffBox data-elem=\"cutoffBox\" style={{ right: 0, width: `${relativeCutoffRight * 100}%` }} />\n </Box>\n );\n}\n\nconst CutoffBox = styled(Box)({\n position: 'absolute',\n height: '100%',\n backgroundColor: 'rgba(225, 225, 225, .5)',\n});\n\nconst Resizer = styled(Box)(({ theme }) => ({\n position: 'absolute',\n height: '100%',\n backgroundColor: theme.palette.divider,\n width: '2px',\n cursor: 'col-resize',\n\n // increase clickable area from 2px to 8px\n '&:before': {\n position: 'absolute',\n width: '8px',\n left: '-3px',\n top: 0,\n bottom: 0,\n content: '\" \"',\n zIndex: 1, // without zIndex, the cutoff boxes partially hide this element\n },\n}));\n"],"names":["Box","styled","useTheme","useResizeObserver","useEffect","useRef","useState","useCallback","useEvent","useChartsTheme","Ticks","getSpanColor","drawSpans","CANVAS_HEIGHT","Canvas","props","options","trace","viewport","setViewport","muiTheme","chartsTheme","width","ref","wrapperRef","height","canvasRef","mouseState","setMouseState","type","traceDuration","endTimeUnixMs","startTimeUnixMs","relativeCutoffLeft","relativeCutoffRight","spanColorGenerator","span","visual","palette","mode","current","ctx","getContext","translateCursorToTime","e","offsetX","clientX","getBoundingClientRect","left","handleMouseDown","preventDefault","target","HTMLElement","isDefaultViewport","elem","dataset","cursor","fixedPoint","start","end","handleMouseMove","pointA","pointB","Math","max","min","handleMouseUp","startMouseAction","window","addEventListener","document","body","style","stopMouseAction","removeEventListener","sx","position","onMouseDown","canvas","CutoffBox","data-elem","Resizer","right","backgroundColor","theme","divider","top","bottom","content","zIndex"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,gBAAgB;AACtD,OAAOC,uBAAuB,sBAAsB;AACpD,SAASC,SAAS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RC,SAAS;YACTC,QAAQ;QACV;IACF,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/TracingGanttChart/MiniGanttChart/Canvas.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, styled, useTheme } from '@mui/material';\nimport { useChartsTheme } from '@perses-dev/components';\nimport { useEvent } from '@perses-dev/plugin-system';\nimport type { MouseEvent as ReactMouseEvent, ReactElement } from 'react';\nimport { useEffect, useRef, useState, useCallback } from 'react';\nimport useResizeObserver from 'use-resize-observer';\n\nimport type { TracingGanttChartOptions } from '../../gantt-chart-model';\nimport { Ticks } from '../Ticks';\nimport type { Span, Trace } from '../trace';\nimport type { Viewport } from '../utils';\nimport { getSpanColor } from '../utils';\nimport { drawSpans } from './draw';\n\nconst CANVAS_HEIGHT = 60;\n\ninterface CanvasProps {\n options: TracingGanttChartOptions;\n trace: Trace;\n viewport: Viewport;\n setViewport: (v: Viewport) => void;\n}\n\ntype MouseState =\n | { type: 'none' }\n | { type: 'resize'; fixedPoint: number }\n | { type: 'drag'; start: number; end: number };\n\nexport function Canvas(props: CanvasProps): ReactElement {\n const { options, trace, viewport, setViewport } = props;\n const muiTheme = useTheme();\n const chartsTheme = useChartsTheme();\n // the <canvas> element must have an absolute width and height to avoid rendering problems\n // the wrapper box is required to get the available dimensions for the <canvas> element\n const { width, ref: wrapperRef } = useResizeObserver();\n const height = CANVAS_HEIGHT;\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const [mouseState, setMouseState] = useState<MouseState>({ type: 'none' });\n\n const traceDuration = trace.endTimeUnixMs - trace.startTimeUnixMs;\n const relativeCutoffLeft = (viewport.startTimeUnixMs - trace.startTimeUnixMs) / traceDuration;\n const relativeCutoffRight = (trace.endTimeUnixMs - viewport.endTimeUnixMs) / traceDuration;\n\n const spanColorGenerator = useCallback(\n (span: Span) => getSpanColor(muiTheme, chartsTheme, options.visual?.palette?.mode, span),\n [muiTheme, chartsTheme, options.visual?.palette?.mode],\n );\n\n useEffect(() => {\n if (!canvasRef.current || !width || !height) return;\n\n const ctx = canvasRef.current.getContext('2d');\n if (!ctx) return;\n\n drawSpans(ctx, width, height, trace, spanColorGenerator);\n }, [width, height, trace, spanColorGenerator]);\n\n const translateCursorToTime = (e: ReactMouseEvent | MouseEvent): number => {\n if (!canvasRef.current || !width) return 0;\n // e.nativeEvent.offsetX doesn't work when sliding over a tick box\n const offsetX = e.clientX - canvasRef.current.getBoundingClientRect().left;\n return trace.startTimeUnixMs + (offsetX / width) * traceDuration;\n };\n\n const handleMouseDown = (e: ReactMouseEvent<HTMLDivElement>): void => {\n e.preventDefault();\n if (!(e.target instanceof HTMLElement)) return;\n\n const isDefaultViewport =\n viewport.startTimeUnixMs === trace.startTimeUnixMs && viewport.endTimeUnixMs === trace.endTimeUnixMs;\n const elem = e.target.dataset['elem'];\n const cursor = translateCursorToTime(e);\n\n if (elem === 'resizerLeft') {\n setMouseState({ type: 'resize', fixedPoint: viewport.endTimeUnixMs });\n } else if (elem === 'resizerRight') {\n setMouseState({ type: 'resize', fixedPoint: viewport.startTimeUnixMs });\n } else if (elem === 'cutoffBox' || isDefaultViewport) {\n setMouseState({ type: 'resize', fixedPoint: cursor });\n setViewport({ startTimeUnixMs: cursor, endTimeUnixMs: cursor });\n } else {\n setMouseState({\n type: 'drag',\n start: cursor - viewport.startTimeUnixMs,\n end: viewport.endTimeUnixMs - cursor,\n });\n }\n };\n\n // need stable reference for window.removeEventListener() in useEffect() below\n const handleMouseMove = useEvent((e: MouseEvent) => {\n e.preventDefault();\n\n switch (mouseState.type) {\n case 'none':\n return;\n\n case 'resize': {\n const pointA = mouseState.fixedPoint;\n const pointB = translateCursorToTime(e);\n\n let start, end;\n if (pointA < pointB) {\n start = pointA;\n end = pointB;\n } else {\n start = pointB;\n end = pointA;\n }\n\n setViewport({\n startTimeUnixMs: Math.max(start, trace.startTimeUnixMs),\n endTimeUnixMs: Math.min(end, trace.endTimeUnixMs),\n });\n return;\n }\n\n case 'drag': {\n // avoid using e.movementX here, as it skips events in chrome,\n // resulting in the mouse pointer moving faster than the viewport box\n const { start, end } = mouseState;\n let cursor = translateCursorToTime(e);\n\n if (cursor - start < trace.startTimeUnixMs) {\n cursor = trace.startTimeUnixMs + start;\n }\n if (cursor + end > trace.endTimeUnixMs) {\n cursor = trace.endTimeUnixMs - end;\n }\n\n setViewport({\n startTimeUnixMs: cursor - start,\n endTimeUnixMs: cursor + end,\n });\n return;\n }\n }\n });\n\n // need stable reference for window.removeEventListener() in useEffect() below\n const handleMouseUp = useEvent((e: MouseEvent) => {\n e.preventDefault();\n setMouseState({ type: 'none' });\n\n // reset viewport if start === end, i.e. a click without movement\n if (viewport.startTimeUnixMs === viewport.endTimeUnixMs) {\n setViewport({ startTimeUnixMs: trace.startTimeUnixMs, endTimeUnixMs: trace.endTimeUnixMs });\n }\n });\n\n // capture mouseMove and mouseUp outside the element by attaching them to the window object\n useEffect(() => {\n function startMouseAction(): void {\n window.addEventListener('mousemove', handleMouseMove);\n window.addEventListener('mouseup', handleMouseUp);\n document.body.style.cursor = mouseState.type === 'resize' ? 'col-resize' : 'move';\n }\n\n function stopMouseAction(): void {\n window.removeEventListener('mousemove', handleMouseMove);\n window.removeEventListener('mouseup', handleMouseUp);\n document.body.style.cursor = 'inherit';\n }\n\n if (mouseState.type === 'none') {\n stopMouseAction();\n } else {\n startMouseAction();\n }\n\n return stopMouseAction;\n }, [mouseState, handleMouseMove, handleMouseUp]);\n\n return (\n <Box ref={wrapperRef} sx={{ position: 'relative', height }} onMouseDown={handleMouseDown}>\n <canvas ref={canvasRef} width={width} height={height} style={{ position: 'absolute' }} />\n <Ticks />\n <CutoffBox data-elem=\"cutoffBox\" style={{ left: 0, width: `${relativeCutoffLeft * 100}%` }} />\n <Resizer data-elem=\"resizerLeft\" style={{ left: `${relativeCutoffLeft * 100}%` }} />\n <Resizer data-elem=\"resizerRight\" style={{ right: `${relativeCutoffRight * 100}%` }} />\n <CutoffBox data-elem=\"cutoffBox\" style={{ right: 0, width: `${relativeCutoffRight * 100}%` }} />\n </Box>\n );\n}\n\nconst CutoffBox = styled(Box)({\n position: 'absolute',\n height: '100%',\n backgroundColor: 'rgba(225, 225, 225, .5)',\n});\n\nconst Resizer = styled(Box)(({ theme }) => ({\n position: 'absolute',\n height: '100%',\n backgroundColor: theme.palette.divider,\n width: '2px',\n cursor: 'col-resize',\n\n // increase clickable area from 2px to 8px\n '&:before': {\n position: 'absolute',\n width: '8px',\n left: '-3px',\n top: 0,\n bottom: 0,\n content: '\" \"',\n zIndex: 1, // without zIndex, the cutoff boxes partially hide this element\n },\n}));\n"],"names":["Box","styled","useTheme","useChartsTheme","useEvent","useEffect","useRef","useState","useCallback","useResizeObserver","Ticks","getSpanColor","drawSpans","CANVAS_HEIGHT","Canvas","props","options","trace","viewport","setViewport","muiTheme","chartsTheme","width","ref","wrapperRef","height","canvasRef","mouseState","setMouseState","type","traceDuration","endTimeUnixMs","startTimeUnixMs","relativeCutoffLeft","relativeCutoffRight","spanColorGenerator","span","visual","palette","mode","current","ctx","getContext","translateCursorToTime","e","offsetX","clientX","getBoundingClientRect","left","handleMouseDown","preventDefault","target","HTMLElement","isDefaultViewport","elem","dataset","cursor","fixedPoint","start","end","handleMouseMove","pointA","pointB","Math","max","min","handleMouseUp","startMouseAction","window","addEventListener","document","body","style","stopMouseAction","removeEventListener","sx","position","onMouseDown","canvas","CutoffBox","data-elem","Resizer","right","backgroundColor","theme","divider","top","bottom","content","zIndex"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF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;QAC1CR,UAAU;QACVnD,QAAQ;QACR0D,iBAAiBC,MAAM9C,OAAO,CAAC+C,OAAO;QACtC/D,OAAO;QACPkC,QAAQ;QAER,0CAA0C;QAC1C,YAAY;YACVoB,UAAU;YACVtD,OAAO;YACP0B,MAAM;YACNsC,KAAK;YACLC,QAAQ;YACRC,SAAS;YACTC,QAAQ;QACV;IACF,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { TracingGanttChartOptions } from '../../gantt-chart-model';
|
|
3
|
+
import type { Trace } from '../trace';
|
|
4
|
+
import type { Viewport } from '../utils';
|
|
5
5
|
interface MiniGanttChartProps {
|
|
6
6
|
options: TracingGanttChartOptions;
|
|
7
7
|
trace: Trace;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MiniGanttChart.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/MiniGanttChart/MiniGanttChart.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MiniGanttChart.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/MiniGanttChart/MiniGanttChart.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzC,UAAU,mBAAmB;IAC3B,OAAO,EAAE,wBAAwB,CAAC;IAClC,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;CACpC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAoBvE"}
|
|
@@ -11,10 +11,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { Box, useTheme } from
|
|
15
|
-
import { TicksHeader } from
|
|
16
|
-
import { rowHeight } from
|
|
17
|
-
import { Canvas } from
|
|
14
|
+
import { Box, useTheme } from "@mui/material";
|
|
15
|
+
import { TicksHeader } from "../Ticks.js";
|
|
16
|
+
import { rowHeight } from "../utils.js";
|
|
17
|
+
import { Canvas } from "./Canvas.js";
|
|
18
18
|
export function MiniGanttChart(props) {
|
|
19
19
|
const { options, trace, viewport, setViewport } = props;
|
|
20
20
|
const theme = useTheme();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/TracingGanttChart/MiniGanttChart/MiniGanttChart.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, useTheme } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { TicksHeader } from '../Ticks';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/TracingGanttChart/MiniGanttChart/MiniGanttChart.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box, useTheme } from '@mui/material';\nimport type { ReactElement } from 'react';\n\nimport type { TracingGanttChartOptions } from '../../gantt-chart-model';\nimport { TicksHeader } from '../Ticks';\nimport type { Trace } from '../trace';\nimport type { Viewport } from '../utils';\nimport { rowHeight } from '../utils';\nimport { Canvas } from './Canvas';\n\ninterface MiniGanttChartProps {\n options: TracingGanttChartOptions;\n trace: Trace;\n viewport: Viewport;\n setViewport: (v: Viewport) => void;\n}\n\nexport function MiniGanttChart(props: MiniGanttChartProps): ReactElement {\n const { options, trace, viewport, setViewport } = props;\n const theme = useTheme();\n\n return (\n <Box\n sx={{\n border: `1px solid ${theme.palette.divider}`,\n borderRadius: `${theme.shape.borderRadius}px`,\n }}\n >\n <Box sx={{ position: 'relative', height: rowHeight, borderBottom: `1px solid ${theme.palette.divider}` }}>\n <TicksHeader\n trace={trace}\n viewport={{ startTimeUnixMs: trace.startTimeUnixMs, endTimeUnixMs: trace.endTimeUnixMs }}\n />\n </Box>\n <Canvas options={options} trace={trace} viewport={viewport} setViewport={setViewport} />\n </Box>\n );\n}\n"],"names":["Box","useTheme","TicksHeader","rowHeight","Canvas","MiniGanttChart","props","options","trace","viewport","setViewport","theme","sx","border","palette","divider","borderRadius","shape","position","height","borderBottom","startTimeUnixMs","endTimeUnixMs"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,EAAEC,QAAQ,QAAQ,gBAAgB;AAI9C,SAASC,WAAW,QAAQ,cAAW;AAGvC,SAASC,SAAS,QAAQ,cAAW;AACrC,SAASC,MAAM,QAAQ,cAAW;AASlC,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,WAAW,EAAE,GAAGJ;IAClD,MAAMK,QAAQV;IAEd,qBACE,MAACD;QACCY,IAAI;YACFC,QAAQ,CAAC,UAAU,EAAEF,MAAMG,OAAO,CAACC,OAAO,EAAE;YAC5CC,cAAc,GAAGL,MAAMM,KAAK,CAACD,YAAY,CAAC,EAAE,CAAC;QAC/C;;0BAEA,KAAChB;gBAAIY,IAAI;oBAAEM,UAAU;oBAAYC,QAAQhB;oBAAWiB,cAAc,CAAC,UAAU,EAAET,MAAMG,OAAO,CAACC,OAAO,EAAE;gBAAC;0BACrG,cAAA,KAACb;oBACCM,OAAOA;oBACPC,UAAU;wBAAEY,iBAAiBb,MAAMa,eAAe;wBAAEC,eAAed,MAAMc,aAAa;oBAAC;;;0BAG3F,KAAClB;gBAAOG,SAASA;gBAASC,OAAOA;gBAAOC,UAAUA;gBAAUC,aAAaA;;;;AAG/E"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Span, Trace } from '../trace';
|
|
1
|
+
import type { Span, Trace } from '../trace';
|
|
2
2
|
export declare function drawSpans(ctx: CanvasRenderingContext2D, width: number, height: number, trace: Trace, spanColorGenerator: (span: Span) => string): void;
|
|
3
3
|
//# sourceMappingURL=draw.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/MiniGanttChart/draw.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,IAAI,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../../../src/TracingGanttChart/MiniGanttChart/draw.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAO5C,wBAAgB,SAAS,CACvB,GAAG,EAAE,wBAAwB,EAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,GACzC,IAAI,CA2BN"}
|