@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
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { forEachSpan } from
|
|
14
|
-
import { minSpanWidthPx } from
|
|
13
|
+
import { forEachSpan } from "../trace.js";
|
|
14
|
+
import { minSpanWidthPx } from "../utils.js";
|
|
15
15
|
const MIN_BAR_HEIGHT = 1;
|
|
16
16
|
const MAX_BAR_HEIGHT = 7;
|
|
17
17
|
export function drawSpans(ctx, width, height, trace, spanColorGenerator) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/TracingGanttChart/MiniGanttChart/draw.ts"],"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 { Span, Trace
|
|
1
|
+
{"version":3,"sources":["../../../../src/TracingGanttChart/MiniGanttChart/draw.ts"],"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 type { Span, Trace } from '../trace';\nimport { forEachSpan } from '../trace';\nimport { minSpanWidthPx } from '../utils';\n\nconst MIN_BAR_HEIGHT = 1;\nconst MAX_BAR_HEIGHT = 7;\n\nexport function drawSpans(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n trace: Trace,\n spanColorGenerator: (span: Span) => string,\n): void {\n // calculate optimal height, enforce min and max bar height and finally round to an integer\n const numSpans = trace.spanById.size;\n const barHeight = Math.round(Math.min(Math.max(height / numSpans, MIN_BAR_HEIGHT), MAX_BAR_HEIGHT));\n\n const traceDuration = trace.endTimeUnixMs - trace.startTimeUnixMs;\n const yChange = height / numSpans;\n let y = 0;\n\n const drawSpan = (span: Span): void => {\n const spanDuration = span.endTimeUnixMs - span.startTimeUnixMs;\n const relativeDuration = spanDuration / traceDuration;\n const relativeStart = (span.startTimeUnixMs - trace.startTimeUnixMs) / traceDuration;\n\n ctx.fillStyle = spanColorGenerator(span);\n ctx.beginPath();\n ctx.rect(\n Math.round(relativeStart * width),\n Math.round(y),\n Math.max(minSpanWidthPx, Math.round(relativeDuration * width)),\n barHeight,\n );\n ctx.fill();\n y += yChange;\n };\n\n forEachSpan(trace.rootSpans, drawSpan);\n}\n"],"names":["forEachSpan","minSpanWidthPx","MIN_BAR_HEIGHT","MAX_BAR_HEIGHT","drawSpans","ctx","width","height","trace","spanColorGenerator","numSpans","spanById","size","barHeight","Math","round","min","max","traceDuration","endTimeUnixMs","startTimeUnixMs","yChange","y","drawSpan","span","spanDuration","relativeDuration","relativeStart","fillStyle","beginPath","rect","fill","rootSpans"],"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;AAGjC,SAASA,WAAW,QAAQ,cAAW;AACvC,SAASC,cAAc,QAAQ,cAAW;AAE1C,MAAMC,iBAAiB;AACvB,MAAMC,iBAAiB;AAEvB,OAAO,SAASC,UACdC,GAA6B,EAC7BC,KAAa,EACbC,MAAc,EACdC,KAAY,EACZC,kBAA0C;IAE1C,2FAA2F;IAC3F,MAAMC,WAAWF,MAAMG,QAAQ,CAACC,IAAI;IACpC,MAAMC,YAAYC,KAAKC,KAAK,CAACD,KAAKE,GAAG,CAACF,KAAKG,GAAG,CAACV,SAASG,UAAUR,iBAAiBC;IAEnF,MAAMe,gBAAgBV,MAAMW,aAAa,GAAGX,MAAMY,eAAe;IACjE,MAAMC,UAAUd,SAASG;IACzB,IAAIY,IAAI;IAER,MAAMC,WAAW,CAACC;QAChB,MAAMC,eAAeD,KAAKL,aAAa,GAAGK,KAAKJ,eAAe;QAC9D,MAAMM,mBAAmBD,eAAeP;QACxC,MAAMS,gBAAgB,AAACH,CAAAA,KAAKJ,eAAe,GAAGZ,MAAMY,eAAe,AAAD,IAAKF;QAEvEb,IAAIuB,SAAS,GAAGnB,mBAAmBe;QACnCnB,IAAIwB,SAAS;QACbxB,IAAIyB,IAAI,CACNhB,KAAKC,KAAK,CAACY,gBAAgBrB,QAC3BQ,KAAKC,KAAK,CAACO,IACXR,KAAKG,GAAG,CAAChB,gBAAgBa,KAAKC,KAAK,CAACW,mBAAmBpB,SACvDO;QAEFR,IAAI0B,IAAI;QACRT,KAAKD;IACP;IAEArB,YAAYQ,MAAMwB,SAAS,EAAET;AAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/Search.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/Search.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAQ,KAAK,EAAE,MAAM,SAAS,CAAC;AAG3C,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CA2D7D;AAeD,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAuBtD"}
|
|
@@ -11,13 +11,13 @@ 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 { IconButton, InputAdornment, Stack, TextField } from
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import Close from
|
|
18
|
-
import { useCallback, useMemo, useState } from
|
|
19
|
-
import { renderAttributeValue } from
|
|
20
|
-
import { forEachSpan } from
|
|
14
|
+
import { IconButton, InputAdornment, Stack, TextField } from "@mui/material";
|
|
15
|
+
import ChevronDown from "mdi-material-ui/ChevronDown";
|
|
16
|
+
import ChevronUp from "mdi-material-ui/ChevronUp";
|
|
17
|
+
import Close from "mdi-material-ui/Close";
|
|
18
|
+
import { useCallback, useMemo, useState } from "react";
|
|
19
|
+
import { renderAttributeValue } from "./DetailPane/Attributes.js";
|
|
20
|
+
import { forEachSpan } from "./trace.js";
|
|
21
21
|
export function SearchBar(props) {
|
|
22
22
|
const { search } = props;
|
|
23
23
|
const { searchQuery, setSearchQuery, matchingSpanIds, focusedMatchIndex, setFocusedMatchIndex } = search;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/TracingGanttChart/Search.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, InputAdornment, Stack, TextField } from '@mui/material';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/Search.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, InputAdornment, Stack, TextField } from '@mui/material';\nimport type * as otlpcommonv1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/common/v1/common';\nimport ChevronDown from 'mdi-material-ui/ChevronDown';\nimport ChevronUp from 'mdi-material-ui/ChevronUp';\nimport Close from 'mdi-material-ui/Close';\nimport type { ReactElement } from 'react';\nimport { useCallback, useMemo, useState } from 'react';\n\nimport { renderAttributeValue } from './DetailPane/Attributes';\nimport type { Span, Trace } from './trace';\nimport { forEachSpan } from './trace';\n\nexport interface SearchBarProps {\n search: SpanSearch;\n}\n\nexport function SearchBar(props: SearchBarProps): ReactElement {\n const { search } = props;\n const { searchQuery, setSearchQuery, matchingSpanIds, focusedMatchIndex, setFocusedMatchIndex } = search;\n\n const hasQuery = searchQuery.length > 0;\n const matchCount = matchingSpanIds.length;\n const hasMatches = matchCount > 0;\n\n function handlePrev(): void {\n if (!hasMatches) return;\n setFocusedMatchIndex((focusedMatchIndex - 1 + matchCount) % matchCount);\n }\n\n function handleNext(): void {\n if (!hasMatches) return;\n setFocusedMatchIndex((focusedMatchIndex + 1) % matchCount);\n }\n\n function handleKeyDown(e: React.KeyboardEvent): void {\n if (e.key === 'Enter') {\n e.preventDefault();\n if (e.shiftKey) {\n handlePrev();\n } else {\n handleNext();\n }\n }\n }\n\n return (\n <Stack direction=\"row\" sx={{ alignItems: 'center', gap: 0.5, minWidth: 300 }}>\n <TextField\n size=\"small\"\n placeholder=\"Search spans...\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n onKeyDown={handleKeyDown}\n slotProps={{\n input: {\n endAdornment: (\n <InputAdornment position=\"end\" sx={{ visibility: hasQuery ? 'visible' : 'hidden', whiteSpace: 'nowrap' }}>\n {hasMatches ? `${focusedMatchIndex + 1}/${matchCount}` : '0/0'}\n </InputAdornment>\n ),\n },\n }}\n sx={{ minWidth: 200 }}\n />\n <IconButton size=\"small\" disabled={!hasMatches} aria-label=\"Previous match\" onClick={handlePrev}>\n <ChevronUp />\n </IconButton>\n <IconButton size=\"small\" disabled={!hasMatches} aria-label=\"Next match\" onClick={handleNext}>\n <ChevronDown />\n </IconButton>\n <IconButton size=\"small\" disabled={!hasQuery} aria-label=\"Clear search\" onClick={() => setSearchQuery('')}>\n <Close />\n </IconButton>\n </Stack>\n );\n}\n\nfunction spanMatchesQuery(span: Span, query: string): boolean {\n const attrMatches = (attr: otlpcommonv1.KeyValue): boolean =>\n attr.key.toLowerCase().includes(query) || renderAttributeValue(attr.value).toLowerCase().includes(query);\n\n return (\n span.resource.serviceName?.toLowerCase().includes(query) ||\n span.name.toLowerCase().includes(query) ||\n span.spanId.toLowerCase().includes(query) ||\n span.attributes.some(attrMatches) ||\n span.resource.attributes.some(attrMatches)\n );\n}\n\nexport interface SpanSearch {\n searchQuery: string;\n setSearchQuery: (query: string) => void;\n matchingSpanIds: string[];\n focusedMatchIndex: number;\n setFocusedMatchIndex: (index: number) => void;\n}\n\nexport function useSpanSearch(trace: Trace): SpanSearch {\n const [searchQuery, setSearchQueryRaw] = useState('');\n const [focusedMatchIndex, setFocusedMatchIndex] = useState(0);\n\n const matchingSpanIds = useMemo(() => {\n if (searchQuery.length === 0) return [];\n\n const query = searchQuery.toLowerCase();\n const matches: string[] = [];\n forEachSpan(trace.rootSpans, (span) => {\n if (spanMatchesQuery(span, query)) {\n matches.push(span.spanId);\n }\n });\n return matches;\n }, [searchQuery, trace.rootSpans]);\n\n const setSearchQuery = useCallback((query: string) => {\n setSearchQueryRaw(query);\n setFocusedMatchIndex(0);\n }, []);\n\n return { searchQuery, setSearchQuery, matchingSpanIds, focusedMatchIndex, setFocusedMatchIndex };\n}\n"],"names":["IconButton","InputAdornment","Stack","TextField","ChevronDown","ChevronUp","Close","useCallback","useMemo","useState","renderAttributeValue","forEachSpan","SearchBar","props","search","searchQuery","setSearchQuery","matchingSpanIds","focusedMatchIndex","setFocusedMatchIndex","hasQuery","length","matchCount","hasMatches","handlePrev","handleNext","handleKeyDown","e","key","preventDefault","shiftKey","direction","sx","alignItems","gap","minWidth","size","placeholder","value","onChange","target","onKeyDown","slotProps","input","endAdornment","position","visibility","whiteSpace","disabled","aria-label","onClick","spanMatchesQuery","span","query","attrMatches","attr","toLowerCase","includes","resource","serviceName","name","spanId","attributes","some","useSpanSearch","trace","setSearchQueryRaw","matches","rootSpans","push"],"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,cAAc,EAAEC,KAAK,EAAEC,SAAS,QAAQ,gBAAgB;AAE7E,OAAOC,iBAAiB,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Cc,QAAQE,IAAI,CAACjB,KAAKS,MAAM;YAC1B;QACF;QACA,OAAOM;IACT,GAAG;QAACpD;QAAakD,MAAMG,SAAS;KAAC;IAEjC,MAAMpD,iBAAiBT,YAAY,CAAC8C;QAClCa,kBAAkBb;QAClBlC,qBAAqB;IACvB,GAAG,EAAE;IAEL,OAAO;QAAEJ;QAAaC;QAAgBC;QAAiBC;QAAmBC;IAAqB;AACjG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { Trace } from './trace';
|
|
3
|
+
import type { Viewport } from './utils';
|
|
4
4
|
export interface TicksHeaderProps {
|
|
5
5
|
trace: Trace;
|
|
6
6
|
viewport: Viewport;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ticks.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/Ticks.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Ticks.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/Ticks.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAiBjE;AAED;;GAEG;AACH,wBAAgB,KAAK,IAAI,YAAY,CAQpC"}
|
|
@@ -11,8 +11,8 @@ 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 { Box, styled } from
|
|
15
|
-
import { formatDuration } from
|
|
14
|
+
import { Box, styled } from "@mui/material";
|
|
15
|
+
import { formatDuration } from "./utils.js";
|
|
16
16
|
/**
|
|
17
17
|
* TicksHeader renders all tick labels in the header
|
|
18
18
|
*/ export function TicksHeader(props) {
|
|
@@ -26,7 +26,7 @@ import { formatDuration } from './utils';
|
|
|
26
26
|
left: '0%',
|
|
27
27
|
borderWidth: 0
|
|
28
28
|
},
|
|
29
|
-
children: formatDuration(startAt
|
|
29
|
+
children: formatDuration(startAt)
|
|
30
30
|
}),
|
|
31
31
|
/*#__PURE__*/ _jsx(TickBox, {
|
|
32
32
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/TracingGanttChart/Ticks.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 { ReactElement } from 'react';\nimport { Viewport
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/Ticks.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 type { ReactElement } from 'react';\n\nimport type { Trace } from './trace';\nimport type { Viewport } from './utils';\nimport { formatDuration } from './utils';\n\nexport interface TicksHeaderProps {\n trace: Trace;\n viewport: Viewport;\n}\n\n/**\n * TicksHeader renders all tick labels in the header\n */\nexport function TicksHeader(props: TicksHeaderProps): ReactElement {\n const { trace, viewport } = props;\n\n const duration = viewport.endTimeUnixMs - viewport.startTimeUnixMs;\n const startAt = viewport.startTimeUnixMs - trace.startTimeUnixMs;\n\n return (\n <>\n <TickBox style={{ left: '0%', borderWidth: 0 }}>{formatDuration(startAt)}</TickBox>\n <TickBox style={{ left: '25%' }}>{formatDuration(startAt + duration * 0.25)}</TickBox>\n <TickBox style={{ left: '50%' }}>{formatDuration(startAt + duration * 0.5)}</TickBox>\n <TickBox style={{ left: '75%' }}>{formatDuration(startAt + duration * 0.75)}</TickBox>\n <TickBox style={{ left: '100%' }}>\n <span style={{ position: 'absolute', right: '.75rem' }}>{formatDuration(startAt + duration * 1)}</span>\n </TickBox>\n </>\n );\n}\n\n/**\n * Ticks renders all ticks in the span duration\n */\nexport function Ticks(): ReactElement {\n return (\n <>\n <TickBox style={{ left: '25%' }} />\n <TickBox style={{ left: '50%' }} />\n <TickBox style={{ left: '75%' }} />\n </>\n );\n}\n\nconst TickBox = styled(Box)(({ theme }) => ({\n position: 'absolute',\n height: '100%',\n borderLeft: `1px solid ${theme.palette.divider}`,\n padding: '.25rem',\n}));\n"],"names":["Box","styled","formatDuration","TicksHeader","props","trace","viewport","duration","endTimeUnixMs","startTimeUnixMs","startAt","TickBox","style","left","borderWidth","span","position","right","Ticks","theme","height","borderLeft","palette","divider","padding"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;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@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { SpanSearch } from './Search';
|
|
3
|
+
import type { Trace } from './trace';
|
|
4
4
|
export interface TraceHeaderBarProps {
|
|
5
5
|
trace: Trace;
|
|
6
6
|
search: SpanSearch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TraceHeaderBar.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/TraceHeaderBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TraceHeaderBar.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/TraceHeaderBar.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAkBrC,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CA0CvE"}
|
|
@@ -11,12 +11,12 @@ 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 { IconButton, Stack, Tooltip, Typography } from
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
14
|
+
import { IconButton, Stack, Tooltip, Typography } from "@mui/material";
|
|
15
|
+
import { useTimeZone } from "@perses-dev/components";
|
|
16
|
+
import MagnifyIcon from "mdi-material-ui/Magnify";
|
|
17
|
+
import { useMemo, useState } from "react";
|
|
18
|
+
import { SearchBar } from "./Search.js";
|
|
19
|
+
import { formatDuration } from "./utils.js";
|
|
20
20
|
const DATE_FORMAT_OPTIONS = {
|
|
21
21
|
year: 'numeric',
|
|
22
22
|
month: 'long',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/TracingGanttChart/TraceHeaderBar.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, Stack, Tooltip, Typography } from '@mui/material';\nimport MagnifyIcon from 'mdi-material-ui/Magnify';\nimport { ReactElement
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/TraceHeaderBar.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, Stack, Tooltip, Typography } from '@mui/material';\nimport { useTimeZone } from '@perses-dev/components';\nimport MagnifyIcon from 'mdi-material-ui/Magnify';\nimport type { ReactElement } from 'react';\nimport { useMemo, useState } from 'react';\n\nimport type { SpanSearch } from './Search';\nimport { SearchBar } from './Search';\nimport type { Trace } from './trace';\nimport { formatDuration } from './utils';\n\nconst DATE_FORMAT_OPTIONS: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n fractionalSecondDigits: 3,\n};\nconst dateFormatterUTC = new Intl.DateTimeFormat(undefined, {\n ...DATE_FORMAT_OPTIONS,\n timeZone: 'UTC',\n timeZoneName: 'short',\n}).format;\n\nexport interface TraceHeaderBarProps {\n trace: Trace;\n search: SpanSearch;\n}\n\nexport function TraceHeaderBar(props: TraceHeaderBarProps): ReactElement {\n const { trace, search } = props;\n\n const { dateFormatOptionsWithUserTimeZone } = useTimeZone();\n const dateFormatter = useMemo(() => {\n const dateFormatOptions = dateFormatOptionsWithUserTimeZone(DATE_FORMAT_OPTIONS);\n return new Intl.DateTimeFormat(undefined, dateFormatOptions).format;\n }, [dateFormatOptionsWithUserTimeZone]);\n const [showSearch, setShowSearch] = useState(false);\n\n const rootSpan = trace.rootSpans[0];\n if (!rootSpan) {\n return <Typography>Trace contains no spans.</Typography>;\n }\n\n return (\n <Stack direction=\"column\" sx={{ gap: 1 }}>\n <Stack direction=\"row\" sx={{ gap: 1, justifyContent: 'space-between', flexWrap: 'wrap' }}>\n <Stack direction=\"row\" sx={{ gap: 1, alignItems: 'center' }}>\n <Typography variant=\"h3\">\n {rootSpan.resource.serviceName}: {rootSpan.name} (\n {formatDuration(trace.endTimeUnixMs - trace.startTimeUnixMs)})\n </Typography>\n <IconButton size=\"small\" onClick={() => setShowSearch((prev) => !prev)} aria-label=\"Toggle search\">\n <MagnifyIcon fontSize=\"small\" />\n </IconButton>\n </Stack>\n <Stack direction=\"row\" sx={{ rowGap: 1, columnGap: 2, alignItems: 'center', flexWrap: 'wrap' }}>\n <Typography variant=\"h4\" sx={{ fontWeight: 'normal' }}>\n <strong>Start:</strong>{' '}\n <Tooltip title={dateFormatterUTC(trace.startTimeUnixMs)} placement=\"top\" arrow>\n <Typography component=\"span\">{dateFormatter(trace.startTimeUnixMs)}</Typography>\n </Tooltip>\n </Typography>\n <Typography variant=\"h4\" sx={{ fontWeight: 'normal' }}>\n <strong>Trace ID:</strong> {rootSpan.traceId}\n </Typography>\n </Stack>\n </Stack>\n {showSearch && <SearchBar search={search} />}\n </Stack>\n );\n}\n"],"names":["IconButton","Stack","Tooltip","Typography","useTimeZone","MagnifyIcon","useMemo","useState","SearchBar","formatDuration","DATE_FORMAT_OPTIONS","year","month","day","hour","minute","second","fractionalSecondDigits","dateFormatterUTC","Intl","DateTimeFormat","undefined","timeZone","timeZoneName","format","TraceHeaderBar","props","trace","search","dateFormatOptionsWithUserTimeZone","dateFormatter","dateFormatOptions","showSearch","setShowSearch","rootSpan","rootSpans","direction","sx","gap","justifyContent","flexWrap","alignItems","variant","resource","serviceName","name","endTimeUnixMs","startTimeUnixMs","size","onClick","prev","aria-label","fontSize","rowGap","columnGap","fontWeight","strong","title","placement","arrow","component","traceId"],"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,KAAK,EAAEC,OAAO,EAAEC,UAAU,QAAQ,gBAAgB;AACvE,SAASC,WAAW,QAAQ,yBAAyB;AACrD,OAAOC,iBAAiB,0BAA0B;AAElD,SAASC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAG1C,SAASC,SAAS,QAAQ,cAAW;AAErC,SAASC,cAAc,QAAQ,aAAU;AAEzC,MAAMC,sBAAkD;IACtDC,MAAM;IACNC,OAAO;IACPC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,QAAQ;IACRC,wBAAwB;AAC1B;AACA,MAAMC,mBAAmB,IAAIC,KAAKC,cAAc,CAACC,WAAW;IAC1D,GAAGX,mBAAmB;IACtBY,UAAU;IACVC,cAAc;AAChB,GAAGC,MAAM;AAOT,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAM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wCAAMC,KAAK;kDAC5E,cAAA,KAACxD;4CAAWyD,WAAU;sDAAQ9B,cAAcH,MAAMoB,eAAe;;;;;0CAGrE,MAAC5C;gCAAWuC,SAAQ;gCAAKL,IAAI;oCAAEkB,YAAY;gCAAS;;kDAClD,KAACC;kDAAO;;oCAAkB;oCAAEtB,SAAS2B,OAAO;;;;;;;YAIjD7B,4BAAc,KAACxB;gBAAUoB,QAAQA;;;;AAGxC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { CustomLinks, TracingGanttChartOptions } from '../gantt-chart-model';
|
|
1
|
+
import type * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
import type { CustomLinks, TracingGanttChartOptions } from '../gantt-chart-model';
|
|
4
4
|
export interface TracingGanttChartProps {
|
|
5
5
|
options: TracingGanttChartOptions;
|
|
6
6
|
customLinks?: CustomLinks;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TracingGanttChart.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/TracingGanttChart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TracingGanttChart.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/TracingGanttChart.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,KAAK,WAAW,MAAM,gEAAgE,CAAC;AACnG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAYlF,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,wBAAwB,CAAC;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAiE7E"}
|
|
@@ -11,16 +11,16 @@ 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 {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
14
|
+
import { Box, Stack } from "@mui/material";
|
|
15
|
+
import { useMemo, useRef, useState } from "react";
|
|
16
|
+
import { DetailPane } from "./DetailPane/DetailPane.js";
|
|
17
|
+
import { GanttTable } from "./GanttTable/GanttTable.js";
|
|
18
|
+
import { GanttTableProvider } from "./GanttTable/GanttTableProvider.js";
|
|
19
|
+
import { ResizableDivider } from "./GanttTable/ResizableDivider.js";
|
|
20
|
+
import { MiniGanttChart } from "./MiniGanttChart/MiniGanttChart.js";
|
|
21
|
+
import { useSpanSearch } from "./Search.js";
|
|
22
|
+
import { getTraceModel } from "./trace.js";
|
|
23
|
+
import { TraceHeaderBar } from "./TraceHeaderBar.js";
|
|
24
24
|
/**
|
|
25
25
|
* The core GanttChart panel for Perses.
|
|
26
26
|
*
|
|
@@ -32,7 +32,9 @@ import { useSpanSearch } from './Search';
|
|
|
32
32
|
try {
|
|
33
33
|
return getTraceModel(otlpTrace);
|
|
34
34
|
} catch (e) {
|
|
35
|
-
throw new Error(`Error: unable to parse trace: ${e}
|
|
35
|
+
throw new Error(`Error: unable to parse trace: ${e}`, {
|
|
36
|
+
cause: e
|
|
37
|
+
});
|
|
36
38
|
}
|
|
37
39
|
}, [
|
|
38
40
|
otlpTrace
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/TracingGanttChart/TracingGanttChart.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/TracingGanttChart.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 type * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';\nimport type { ReactElement } from 'react';\nimport { useMemo, useRef, useState } from 'react';\n\nimport type { CustomLinks, TracingGanttChartOptions } from '../gantt-chart-model';\nimport { DetailPane } from './DetailPane/DetailPane';\nimport { GanttTable } from './GanttTable/GanttTable';\nimport { GanttTableProvider } from './GanttTable/GanttTableProvider';\nimport { ResizableDivider } from './GanttTable/ResizableDivider';\nimport { MiniGanttChart } from './MiniGanttChart/MiniGanttChart';\nimport { useSpanSearch } from './Search';\nimport type { Span } from './trace';\nimport { getTraceModel } from './trace';\nimport { TraceHeaderBar } from './TraceHeaderBar';\nimport type { Viewport } from './utils';\n\nexport interface TracingGanttChartProps {\n options: TracingGanttChartOptions;\n customLinks?: CustomLinks;\n trace: otlptracev1.TracesData;\n}\n\n/**\n * The core GanttChart panel for Perses.\n *\n * The UI/UX of this panel is based on Jaeger UI, licensed under Apache License, Version 2.0.\n * https://github.com/jaegertracing/jaeger-ui\n */\nexport function TracingGanttChart(props: TracingGanttChartProps): ReactElement {\n const { options, customLinks, trace: otlpTrace } = props;\n\n const trace = useMemo(() => {\n try {\n return getTraceModel(otlpTrace);\n } catch (e) {\n throw new Error(`Error: unable to parse trace: ${e}`, { cause: e });\n }\n }, [otlpTrace]);\n const [viewport, setViewport] = useState<Viewport>({\n startTimeUnixMs: trace.startTimeUnixMs,\n endTimeUnixMs: trace.endTimeUnixMs,\n });\n const [selectedSpan, setSelectedSpan] = useState<Span | undefined>(() =>\n options.selectedSpanId ? trace.spanById.get(options.selectedSpanId) : undefined,\n );\n const search = useSpanSearch(trace);\n\n const ganttChart = useRef<HTMLDivElement>(null);\n // tableWidth only comes to effect if the detail pane is visible.\n // setTableWidth() is only called by <ResizableDivider />\n const [tableWidth, setTableWidth] = useState<number>(0.82);\n const gap = 2;\n const spacing = ganttChart.current ? parseFloat(getComputedStyle(ganttChart.current).columnGap) || 0 : 0;\n\n return (\n <Stack ref={ganttChart} direction=\"row\" sx={{ height: '100%', minHeight: '240px', gap }}>\n <Stack sx={{ flexGrow: 1, gap }}>\n <TraceHeaderBar trace={trace} search={search} />\n <MiniGanttChart options={options} trace={trace} viewport={viewport} setViewport={setViewport} />\n <GanttTableProvider>\n <GanttTable\n options={options}\n customLinks={customLinks}\n trace={trace}\n viewport={viewport}\n selectedSpan={selectedSpan}\n onSpanClick={setSelectedSpan}\n matchingSpanIds={search.matchingSpanIds}\n focusedSpanId={search.matchingSpanIds[search.focusedMatchIndex]}\n />\n </GanttTableProvider>\n </Stack>\n {selectedSpan && (\n <>\n <ResizableDivider parentRef={ganttChart} spacing={spacing} onMove={setTableWidth} />\n <Box\n style={{\n width: `${(1 - tableWidth) * 100}%`,\n minWidth: `${(1 - tableWidth) * 100}%`,\n }}\n sx={{ overflow: 'auto' }}\n >\n <DetailPane\n customLinks={customLinks}\n trace={trace}\n span={selectedSpan}\n onCloseBtnClick={() => setSelectedSpan(undefined)}\n />\n </Box>\n </>\n )}\n </Stack>\n );\n}\n"],"names":["Box","Stack","useMemo","useRef","useState","DetailPane","GanttTable","GanttTableProvider","ResizableDivider","MiniGanttChart","useSpanSearch","getTraceModel","TraceHeaderBar","TracingGanttChart","props","options","customLinks","trace","otlpTrace","e","Error","cause","viewport","setViewport","startTimeUnixMs","endTimeUnixMs","selectedSpan","setSelectedSpan","selectedSpanId","spanById","get","undefined","search","ganttChart","tableWidth","setTableWidth","gap","spacing","current","parseFloat","getComputedStyle","columnGap","ref","direction","sx","height","minHeight","flexGrow","onSpanClick","matchingSpanIds","focusedSpanId","focusedMatchIndex","parentRef","onMove","style","width","minWidth","overflow","span","onCloseBtnClick"],"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;AAG3C,SAASC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAGlD,SAASC,UAAU,QAAQ,6BAA0B;AACrD,SAASC,UAAU,QAAQ,6BAA0B;AACrD,SAASC,kBAAkB,QAAQ,qCAAkC;AACrE,SAASC,gBAAgB,QAAQ,mCAAgC;AACjE,SAASC,cAAc,QAAQ,qCAAkC;AACjE,SAASC,aAAa,QAAQ,cAAW;AAEzC,SAASC,aAAa,QAAQ,aAAU;AACxC,SAASC,cAAc,QAAQ,sBAAmB;AASlD;;;;;CAKC,GACD,OAAO,SAASC,kBAAkBC,KAA6B;IAC7D,MAAM,EAAEC,OAAO,EAAEC,WAAW,EAAEC,OAAOC,SAAS,EAAE,GAAGJ;IAEnD,MAAMG,QAAQf,QAAQ;QACpB,IAAI;YACF,OAAOS,cAAcO;QACvB,EAAE,OAAOC,GAAG;YACV,MAAM,IA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,CAAA,IAAIrB,UAAS,IAAK,IAAI,CAAC,CAAC;4BACnCsB,UAAU,GAAG,AAAC,CAAA,IAAItB,UAAS,IAAK,IAAI,CAAC,CAAC;wBACxC;wBACAU,IAAI;4BAAEa,UAAU;wBAAO;kCAEvB,cAAA,KAACpD;4BACCW,aAAaA;4BACbC,OAAOA;4BACPyC,MAAMhC;4BACNiC,iBAAiB,IAAMhC,gBAAgBI;;;;;;;AAOrD"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import ColorHash from
|
|
13
|
+
import ColorHash from "color-hash";
|
|
14
14
|
// Valid hue values are 0 to 360 and can be adjusted to control the generated colors.
|
|
15
15
|
// More info: https://github.com/zenozeng/color-hash#custom-hue
|
|
16
16
|
// Picked min of 20 and max of 360 to exclude common threshold colors (red).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/TracingGanttChart/palette.ts"],"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 ColorHash from 'color-hash';\n\n// Valid hue values are 0 to 360 and can be adjusted to control the generated colors.\n// More info: https://github.com/zenozeng/color-hash#custom-hue\n// Picked min of 20 and max of 360 to exclude common threshold colors (red).\n// Items with \"error\" in them will always be generated as red.\nconst ERROR_HUE_CUTOFF = 20;\nconst colorGenerator = new ColorHash({ hue: { min: ERROR_HUE_CUTOFF, max: 360 } });\nconst redColorGenerator = new ColorHash({ hue: { min: 0, max: ERROR_HUE_CUTOFF } });\n\nfunction computeConsistentColor(name: string, error: boolean): string {\n const [hue, saturation, lightness] = error ? redColorGenerator.hsl(name) : colorGenerator.hsl(name);\n const saturationPercent = `${(saturation * 100).toFixed(0)}%`;\n const lightnessPercent = `${(lightness * 100).toFixed(0)}%`;\n return `hsla(${hue.toFixed(2)},${saturationPercent},${lightnessPercent},0.9)`;\n}\n\n// To check whether a color has already been generated for a given string.\n// TODO: Predefined color aliases will be defined here\nconst colorLookup: Record<string, string> = {};\n\n/**\n * Return a consistent color for (name, error) tuple\n */\nexport function getConsistentColor(name: string, error: boolean): string {\n const key = `${name}_____${error}`;\n let value = colorLookup[key];\n if (!value) {\n value = computeConsistentColor(name, error);\n colorLookup[key] = value;\n }\n return value;\n}\n\nexport function getConsistentCategoricalColor(\n name: string,\n error: boolean,\n categoricalPalette: string[],\n errorPalette: string[]
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/palette.ts"],"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 ColorHash from 'color-hash';\n\n// Valid hue values are 0 to 360 and can be adjusted to control the generated colors.\n// More info: https://github.com/zenozeng/color-hash#custom-hue\n// Picked min of 20 and max of 360 to exclude common threshold colors (red).\n// Items with \"error\" in them will always be generated as red.\nconst ERROR_HUE_CUTOFF = 20;\nconst colorGenerator = new ColorHash({ hue: { min: ERROR_HUE_CUTOFF, max: 360 } });\nconst redColorGenerator = new ColorHash({ hue: { min: 0, max: ERROR_HUE_CUTOFF } });\n\nfunction computeConsistentColor(name: string, error: boolean): string {\n const [hue, saturation, lightness] = error ? redColorGenerator.hsl(name) : colorGenerator.hsl(name);\n const saturationPercent = `${(saturation * 100).toFixed(0)}%`;\n const lightnessPercent = `${(lightness * 100).toFixed(0)}%`;\n return `hsla(${hue.toFixed(2)},${saturationPercent},${lightnessPercent},0.9)`;\n}\n\n// To check whether a color has already been generated for a given string.\n// TODO: Predefined color aliases will be defined here\nconst colorLookup: Record<string, string> = {};\n\n/**\n * Return a consistent color for (name, error) tuple\n */\nexport function getConsistentColor(name: string, error: boolean): string {\n const key = `${name}_____${error}`;\n let value = colorLookup[key];\n if (!value) {\n value = computeConsistentColor(name, error);\n colorLookup[key] = value;\n }\n return value;\n}\n\nexport function getConsistentCategoricalColor(\n name: string,\n error: boolean,\n categoricalPalette: string[],\n errorPalette: string[],\n): string {\n const palette = error ? errorPalette : categoricalPalette;\n if (palette.length === 0) {\n console.warn('getConsistentCategoricalColor() called with empty color palette, fallback to #000');\n return '#000';\n }\n\n let hash = 0;\n for (let i = 0; i < name.length; i++) {\n hash = name.charCodeAt(i) + ((hash << 5) - hash);\n }\n\n return palette[Math.abs(hash) % palette.length] ?? '#000';\n}\n"],"names":["ColorHash","ERROR_HUE_CUTOFF","colorGenerator","hue","min","max","redColorGenerator","computeConsistentColor","name","error","saturation","lightness","hsl","saturationPercent","toFixed","lightnessPercent","colorLookup","getConsistentColor","key","value","getConsistentCategoricalColor","categoricalPalette","errorPalette","palette","length","console","warn","hash","i","charCodeAt","Math","abs"],"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,OAAOA,eAAe,aAAa;AAEnC,qFAAqF;AACrF,+DAA+D;AAC/D,4EAA4E;AAC5E,8DAA8D;AAC9D,MAAMC,mBAAmB;AACzB,MAAMC,iBAAiB,IAAIF,UAAU;IAAEG,KAAK;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,CAAAA,QAAQ,CAAA,IAAKA,IAAG;IAChD;IAEA,OAAOJ,OAAO,CAACO,KAAKC,GAAG,CAACJ,QAAQJ,QAAQC,MAAM,CAAC,IAAI;AACrD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as otlpcommonv1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/common/v1/common';
|
|
2
|
-
import * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';
|
|
1
|
+
import type * as otlpcommonv1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/common/v1/common';
|
|
2
|
+
import type * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';
|
|
3
3
|
/** holds the trace and computed properties required for the Gantt chart */
|
|
4
4
|
export interface Trace {
|
|
5
5
|
trace: otlptracev1.TracesData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/trace.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/trace.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,KAAK,YAAY,MAAM,kEAAkE,CAAC;AAEtG,OAAO,KAAK,KAAK,WAAW,MAAM,gEAAgE,CAAC;AAGnG,2EAA2E;AAC3E,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,WAAW,CAAC,UAAU,CAAC;IAE9B;;;OAGG;IACH,SAAS,EAAE,IAAI,EAAE,CAAC;IAClB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,IAAI;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC,oBAAoB,CAAC;IACzC,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,uCAAuC;IACvC,UAAU,EAAE,IAAI,EAAE,CAAC;IAEnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC;IACpC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,KAAK;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,YAAY,CAAC,QAAQ,EAAE,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,CAAC,UAAU,GAAG,KAAK,CAmDlE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,GAAG,IAAI,GAAG,IAAI,CAMnF"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { sortedIndexBy } from
|
|
13
|
+
import { sortedIndexBy } from "lodash";
|
|
14
14
|
/**
|
|
15
15
|
* getTraceModel builds a tree of spans from an OTLP trace,
|
|
16
16
|
* and precomputes common fields, for example the start and end time of a trace.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/TracingGanttChart/trace.ts"],"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 * as otlpcommonv1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/common/v1/common';\nimport * as
|
|
1
|
+
{"version":3,"sources":["../../../src/TracingGanttChart/trace.ts"],"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 type * as otlpcommonv1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/common/v1/common';\nimport type * as otlpresourcev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/resource/v1/resource';\nimport type * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';\nimport { sortedIndexBy } from 'lodash';\n\n/** holds the trace and computed properties required for the Gantt chart */\nexport interface Trace {\n trace: otlptracev1.TracesData;\n\n /**\n * if a trace is incomplete (e.g. a parent span has not been received yet),\n * this branch of the span tree will be appended to the root\n */\n rootSpans: Span[];\n spanById: Map<string, Span>;\n startTimeUnixMs: number;\n endTimeUnixMs: number;\n}\n\nexport interface Span {\n resource: Resource;\n scope: otlpcommonv1.InstrumentationScope;\n parentSpan?: Span;\n /** child spans, sorted by startTime */\n childSpans: Span[];\n\n traceId: string;\n spanId: string;\n parentSpanId?: string;\n name: string;\n kind?: string;\n startTimeUnixMs: number;\n endTimeUnixMs: number;\n attributes: otlpcommonv1.KeyValue[];\n events: Event[];\n links: Link[];\n status: otlptracev1.Status;\n}\n\nexport interface Resource {\n serviceName?: string;\n attributes: otlpcommonv1.KeyValue[];\n}\n\nexport interface Event {\n timeUnixMs: number;\n name: string;\n attributes: otlpcommonv1.KeyValue[];\n}\n\nexport interface Link {\n traceId: string;\n spanId: string;\n attributes: otlpcommonv1.KeyValue[];\n}\n\n/**\n * getTraceModel builds a tree of spans from an OTLP trace,\n * and precomputes common fields, for example the start and end time of a trace.\n * Time complexity: O(2n)\n */\nexport function getTraceModel(trace: otlptracev1.TracesData): Trace {\n // first pass: build lookup table <spanId, Span> and compute min/max\n const spanById = new Map<string, Span>();\n const rootSpans: Span[] = [];\n let startTimeUnixMs: number = 0;\n let endTimeUnixMs: number = 0;\n for (const resourceSpan of trace.resourceSpans) {\n const resource = parseResource(resourceSpan.resource);\n\n for (const scopeSpan of resourceSpan.scopeSpans) {\n const scope = parseScope(scopeSpan.scope);\n\n for (const otelSpan of scopeSpan.spans) {\n const span: Span = {\n resource,\n scope,\n childSpans: [],\n ...parseSpan(otelSpan),\n };\n spanById.set(otelSpan.spanId, span);\n\n if (startTimeUnixMs === 0 || span.startTimeUnixMs < startTimeUnixMs) {\n startTimeUnixMs = span.startTimeUnixMs;\n }\n if (endTimeUnixMs === 0 || span.endTimeUnixMs > endTimeUnixMs) {\n endTimeUnixMs = span.endTimeUnixMs;\n }\n }\n }\n }\n\n // second pass: build tree based on parentSpanId property\n for (const [, span] of spanById) {\n if (!span.parentSpanId) {\n rootSpans.push(span);\n continue;\n }\n\n const parent = spanById.get(span.parentSpanId);\n if (!parent) {\n console.trace(`span ${span.spanId} has parent ${span.parentSpanId} which has not been received yet`);\n rootSpans.push(span);\n continue;\n }\n\n span.parentSpan = parent;\n const insertChildSpanAt = sortedIndexBy(parent.childSpans, span, (s) => s.startTimeUnixMs);\n parent.childSpans.splice(insertChildSpanAt, 0, span);\n }\n\n return { trace, rootSpans, spanById, startTimeUnixMs, endTimeUnixMs };\n}\n\n/**\n * Recursively iterates all spans depth-first.\n * Return false from the callback to skip a span's children.\n */\nexport function forEachSpan(spans: Span[], fn: (span: Span) => boolean | void): void {\n for (const span of spans) {\n if (fn(span) !== false) {\n forEachSpan(span.childSpans, fn);\n }\n }\n}\n\nfunction parseResource(resource?: otlpresourcev1.Resource): Resource {\n let serviceName = 'unknown';\n for (const attr of resource?.attributes ?? []) {\n if (attr.key === 'service.name' && 'stringValue' in attr.value) {\n serviceName = attr.value.stringValue;\n break;\n }\n }\n\n return {\n serviceName,\n attributes: resource?.attributes ?? [],\n };\n}\n\nfunction parseScope(scope?: otlpcommonv1.InstrumentationScope): otlpcommonv1.InstrumentationScope {\n return scope ?? {};\n}\n\n/**\n * parseSpan parses the Span API type to the internal representation\n * i.e. convert strings to numbers etc.\n */\nfunction parseSpan(span: otlptracev1.Span): Omit<Span, 'resource' | 'scope' | 'childSpans'> {\n return {\n traceId: span.traceId,\n spanId: span.spanId,\n parentSpanId: span.parentSpanId,\n name: span.name,\n kind: span.kind,\n startTimeUnixMs: parseInt(span.startTimeUnixNano) * 1e-6, // convert to milliseconds because JS cannot handle numbers larger than 9007199254740991\n endTimeUnixMs: parseInt(span.endTimeUnixNano) * 1e-6,\n attributes: span.attributes ?? [],\n events: (span.events ?? []).map(parseEvent),\n links: (span.links ?? []).map(parseLink),\n status: span.status ?? {},\n };\n}\n\nfunction parseEvent(event: otlptracev1.Event): Event {\n return {\n timeUnixMs: parseInt(event.timeUnixNano) * 1e-6, // convert to milliseconds because JS cannot handle numbers larger than 9007199254740991\n name: event.name,\n attributes: event.attributes ?? [],\n };\n}\n\nfunction parseLink(link: otlptracev1.Link): Link {\n return {\n traceId: link.traceId,\n spanId: link.spanId,\n attributes: link.attributes ?? [],\n };\n}\n"],"names":["sortedIndexBy","getTraceModel","trace","spanById","Map","rootSpans","startTimeUnixMs","endTimeUnixMs","resourceSpan","resourceSpans","resource","parseResource","scopeSpan","scopeSpans","scope","parseScope","otelSpan","spans","span","childSpans","parseSpan","set","spanId","parentSpanId","push","parent","get","console","parentSpan","insertChildSpanAt","s","splice","forEachSpan","fn","serviceName","attr","attributes","key","value","stringValue","traceId","name","kind","parseInt","startTimeUnixNano","endTimeUnixNano","events","map","parseEvent","links","parseLink","status","event","timeUnixMs","timeUnixNano","link"],"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;AAKjC,SAASA,aAAa,QAAQ,SAAS;AAqDvC;;;;CAIC,GACD,OAAO,SAASC,cAAcC,KAA6B;IACzD,oEAAoE;IACpE,MAAMC,WAAW,IAAIC;IACrB,MAAMC,YAAoB,EAAE;IAC5B,IAAIC,kBAA0B;IAC9B,IAAIC,gBAAwB;IAC5B,KAAK,MAAMC,gBAAgBN,MAAMO,aAAa,CAAE;QAC9C,MAAMC,WAAWC,cAAcH,aAAaE,QAAQ;QAEpD,KAAK,MAAME,aAAaJ,aAAaK,UAAU,CAAE;YAC/C,MAAMC,QAAQC,WAAWH,UAAUE,KAAK;YAExC,KAAK,MAAME,YAAYJ,UAAUK,KAAK,CAAE;gBACtC,MAAMC,OAAa;oBACjBR;oBACAI;oBACAK,YAAY,EAAE;oBACd,GAAGC,UAAUJ,SAAS;gBACxB;gBACAb,SAASkB,GAAG,CAACL,SAASM,MAAM,EAAEJ;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AO;QACLL;QACAE,YAAY1B,UAAU0B,cAAc,EAAE;IACxC;AACF;AAEA,SAASrB,WAAWD,KAAyC;IAC3D,OAAOA,SAAS,CAAC;AACnB;AAEA;;;CAGC,GACD,SAASM,UAAUF,IAAsB;IACvC,OAAO;QACLsB,SAAStB,KAAKsB,OAAO;QACrBlB,QAAQJ,KAAKI,MAAM;QACnBC,cAAcL,KAAKK,YAAY;QAC/BkB,MAAMvB,KAAKuB,IAAI;QACfC,MAAMxB,KAAKwB,IAAI;QACfpC,iBAAiBqC,SAASzB,KAAK0B,iBAAiB,IAAI;QACpDrC,eAAeoC,SAASzB,KAAK2B,eAAe,IAAI;QAChDT,YAAYlB,KAAKkB,UAAU,IAAI,EAAE;QACjCU,QAAQ,AAAC5B,CAAAA,KAAK4B,MAAM,IAAI,EAAE,AAAD,EAAGC,GAAG,CAACC;QAChCC,OAAO,AAAC/B,CAAAA,KAAK+B,KAAK,IAAI,EAAE,AAAD,EAAGF,GAAG,CAACG;QAC9BC,QAAQjC,KAAKiC,MAAM,IAAI,CAAC;IAC1B;AACF;AAEA,SAASH,WAAWI,KAAwB;IAC1C,OAAO;QACLC,YAAYV,SAASS,MAAME,YAAY,IAAI;QAC3Cb,MAAMW,MAAMX,IAAI;QAChBL,YAAYgB,MAAMhB,UAAU,IAAI,EAAE;IACpC;AACF;AAEA,SAASc,UAAUK,IAAsB;IACvC,OAAO;QACLf,SAASe,KAAKf,OAAO;QACrBlB,QAAQiC,KAAKjC,MAAM;QACnBc,YAAYmB,KAAKnB,UAAU,IAAI,EAAE;IACnC;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Span } from './trace';
|
|
1
|
+
import type { Theme } from '@mui/material';
|
|
2
|
+
import type { PersesChartsTheme } from '@perses-dev/components';
|
|
3
|
+
import type { Span } from './trace';
|
|
4
4
|
/**
|
|
5
5
|
* Viewport contains the current zoom, i.e. which timeframe of the trace should be visible
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/TracingGanttChart/utils.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAIhE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,iGAAiG;AACjG,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,SAAS,SAAS,CAAC;AAChC,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,KAAG,OAA4D,CAAC;AAEvG,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,KAAK,EACf,WAAW,EAAE,iBAAiB,EAC9B,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,EAC/C,WAAW,EAAE,MAAM,EACnB,KAAK,UAAQ,GACZ,MAAM,CAYR;AAED,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,KAAK,EACf,WAAW,EAAE,iBAAiB,EAC9B,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,EAC/C,IAAI,EAAE,IAAI,GACT,MAAM,CAER;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQrD"}
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import * as otlptracev1 from
|
|
14
|
-
import { getConsistentCategoricalColor, getConsistentColor } from
|
|
13
|
+
import * as otlptracev1 from "@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace";
|
|
14
|
+
import { getConsistentCategoricalColor, getConsistentColor } from "./palette.js";
|
|
15
15
|
/** minimum span width, i.e. increase width if the calculated width is too small to be visible */ export const minSpanWidthPx = 2;
|
|
16
16
|
export const rowHeight = '2rem';
|
|
17
17
|
export const spanHasError = (span)=>span.status?.code === otlptracev1.StatusCodeError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/TracingGanttChart/utils.ts"],"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/utils.ts"],"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 type { Theme } from '@mui/material';\nimport type { PersesChartsTheme } from '@perses-dev/components';\nimport * as otlptracev1 from '@perses-dev/spec/dist/dashboard/query-type/otlp/trace/v1/trace';\n\nimport { getConsistentCategoricalColor, getConsistentColor } from './palette';\nimport type { Span } from './trace';\n\n/**\n * Viewport contains the current zoom, i.e. which timeframe of the trace should be visible\n */\nexport interface Viewport {\n startTimeUnixMs: number;\n endTimeUnixMs: number;\n}\n\n/** minimum span width, i.e. increase width if the calculated width is too small to be visible */\nexport const minSpanWidthPx = 2;\nexport const rowHeight = '2rem';\nexport const spanHasError = (span: Span): boolean => span.status?.code === otlptracev1.StatusCodeError;\n\nexport function getServiceColor(\n muiTheme: Theme,\n chartsTheme: PersesChartsTheme,\n paletteMode: 'auto' | 'categorical' | undefined,\n serviceName: string,\n error = false,\n): string {\n switch (paletteMode) {\n case 'categorical': {\n // ECharts type for color is not always an array but it is always an array in ChartsProvider\n const categoricalPalette = chartsTheme.echartsTheme.color as string[];\n const errorPalette = [muiTheme.palette.error.light, muiTheme.palette.error.main, muiTheme.palette.error.dark];\n return getConsistentCategoricalColor(serviceName, error, categoricalPalette, errorPalette);\n }\n\n default:\n return getConsistentColor(serviceName, error);\n }\n}\n\nexport function getSpanColor(\n muiTheme: Theme,\n chartsTheme: PersesChartsTheme,\n paletteMode: 'auto' | 'categorical' | undefined,\n span: Span,\n): string {\n return getServiceColor(muiTheme, chartsTheme, paletteMode, span.resource.serviceName ?? '', spanHasError(span));\n}\n\nexport function formatDuration(timeMs: number): string {\n if (timeMs < 1) {\n return `${Math.round(timeMs * 1000)}μs`;\n }\n if (timeMs < 1000) {\n return `${+timeMs.toFixed(2)}ms`;\n }\n return `${+(timeMs / 1000).toFixed(2)}s`;\n}\n"],"names":["otlptracev1","getConsistentCategoricalColor","getConsistentColor","minSpanWidthPx","rowHeight","spanHasError","span","status","code","StatusCodeError","getServiceColor","muiTheme","chartsTheme","paletteMode","serviceName","error","categoricalPalette","echartsTheme","color","errorPalette","palette","light","main","dark","getSpanColor","resource","formatDuration","timeMs","Math","round","toFixed"],"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;AAIjC,YAA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Plugin } from '@perses-dev/plugin-system';
|
|
2
|
-
import { TracingGanttChartOptions } from './gantt-chart-model';
|
|
3
|
-
import { TracingGanttChartPanelProps } from './TracingGanttChartPanel';
|
|
1
|
+
import type { PanelPlugin } from '@perses-dev/plugin-system';
|
|
2
|
+
import type { TracingGanttChartOptions } from './gantt-chart-model';
|
|
3
|
+
import type { TracingGanttChartPanelProps } from './TracingGanttChartPanel';
|
|
4
4
|
export declare const TracingGanttChart: PanelPlugin<TracingGanttChartOptions, TracingGanttChartPanelProps>;
|
|
5
5
|
//# sourceMappingURL=TracingGanttChart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TracingGanttChart.d.ts","sourceRoot":"","sources":["../../src/TracingGanttChart.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"TracingGanttChart.d.ts","sourceRoot":"","sources":["../../src/TracingGanttChart.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAGpE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAG5E,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,wBAAwB,EAAE,2BAA2B,CAKhG,CAAC"}
|
package/lib/TracingGanttChart.js
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import { createInitialTracingGanttChartOptions } from
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import { createInitialTracingGanttChartOptions } from "./gantt-chart-model.js";
|
|
14
|
+
import { DownloadTraceAction } from "./PanelActions.js";
|
|
15
|
+
import { TracingGanttChartPanel } from "./TracingGanttChartPanel.js";
|
|
16
16
|
export const TracingGanttChart = {
|
|
17
17
|
PanelComponent: TracingGanttChartPanel,
|
|
18
18
|
supportedQueryTypes: [
|