@perses-dev/flame-chart-plugin 0.6.0 → 0.7.0-beta.1
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/{FlameChart.8940202b.js → FlameChart.75e60eeb.js} +7 -7
- package/__mf/js/async/121.b114caf4.js +2 -0
- package/__mf/js/async/168.6611ee4e.js +1 -0
- package/__mf/js/async/183.92eba0e3.js +2 -0
- package/__mf/js/async/192.8ce3d05c.js +1 -0
- package/__mf/js/async/2.9b63234c.js +1 -0
- package/__mf/js/async/235.b209897c.js +1 -0
- package/__mf/js/async/274.e53c6dc1.js +2 -0
- package/__mf/js/async/354.12841635.js +4 -0
- package/__mf/js/async/354.12841635.js.LICENSE.txt +9 -0
- package/__mf/js/async/356.8389aa5c.js +1 -0
- package/__mf/js/async/392.800bb82c.js +2 -0
- package/__mf/js/async/40.8889cead.js +43 -0
- package/__mf/js/async/{657.9473a80f.js.LICENSE.txt → 40.8889cead.js.LICENSE.txt} +41 -1
- package/__mf/js/async/43.71599a15.js +2 -0
- package/__mf/js/async/464.b8482365.js +1 -0
- package/__mf/js/async/470.1af0a163.js +2 -0
- package/__mf/js/async/587.2887e89e.js +1 -0
- package/__mf/js/async/616.d35b2918.js +1 -0
- package/__mf/js/async/663.d6e01d16.js +1 -0
- package/__mf/js/async/787.a8f426c4.js +1 -0
- package/__mf/js/async/802.f2161316.js +110 -0
- package/__mf/js/async/867.d3758c62.js +1 -0
- package/__mf/js/async/873.fd0c9e57.js +1 -0
- package/__mf/js/async/941.e44ab19f.js +2 -0
- package/__mf/js/async/968.5e8d690f.js +1 -0
- package/__mf/js/async/__federation_expose_FlameChart.668f250d.js +17 -0
- package/__mf/js/async/lib-router.d7bf8c32.js +2 -0
- package/__mf/js/{main.08e04feb.js → main.0d13937b.js} +3 -3
- package/lib/FlameChart.d.ts +3 -3
- package/lib/FlameChart.d.ts.map +1 -1
- package/lib/FlameChart.js +2 -2
- package/lib/FlameChart.js.map +1 -1
- package/lib/bootstrap.js +2 -2
- package/lib/components/CustomBreadcrumb.d.ts +1 -1
- package/lib/components/CustomBreadcrumb.d.ts.map +1 -1
- package/lib/components/CustomBreadcrumb.js +8 -8
- package/lib/components/CustomBreadcrumb.js.map +1 -1
- package/lib/components/FlameChart.d.ts +2 -2
- package/lib/components/FlameChart.d.ts.map +1 -1
- package/lib/components/FlameChart.js +10 -10
- package/lib/components/FlameChart.js.map +1 -1
- package/lib/components/FlameChartOptionsEditorSettings.d.ts +2 -2
- package/lib/components/FlameChartOptionsEditorSettings.d.ts.map +1 -1
- package/lib/components/FlameChartOptionsEditorSettings.js +6 -6
- package/lib/components/FlameChartOptionsEditorSettings.js.map +1 -1
- package/lib/components/FlameChartPanel.d.ts +4 -4
- package/lib/components/FlameChartPanel.d.ts.map +1 -1
- package/lib/components/FlameChartPanel.js +88 -71
- package/lib/components/FlameChartPanel.js.map +1 -1
- package/lib/components/PaletteSelector.d.ts +1 -1
- package/lib/components/PaletteSelector.d.ts.map +1 -1
- package/lib/components/PaletteSelector.js +2 -2
- package/lib/components/PaletteSelector.js.map +1 -1
- package/lib/components/SearchBar.d.ts +1 -1
- package/lib/components/SearchBar.d.ts.map +1 -1
- package/lib/components/SearchBar.js +3 -3
- package/lib/components/SearchBar.js.map +1 -1
- package/lib/components/SeriesChart.d.ts +2 -2
- package/lib/components/SeriesChart.d.ts.map +1 -1
- package/lib/components/SeriesChart.js +6 -6
- package/lib/components/SeriesChart.js.map +1 -1
- package/lib/components/Settings.d.ts +2 -2
- package/lib/components/Settings.d.ts.map +1 -1
- package/lib/components/Settings.js +6 -6
- package/lib/components/Settings.js.map +1 -1
- package/lib/components/SwitchSelector.d.ts +1 -1
- package/lib/components/SwitchSelector.d.ts.map +1 -1
- package/lib/components/SwitchSelector.js +3 -3
- package/lib/components/SwitchSelector.js.map +1 -1
- package/lib/components/TableChart.d.ts +2 -2
- package/lib/components/TableChart.d.ts.map +1 -1
- package/lib/components/TableChart.js +6 -6
- package/lib/components/TableChart.js.map +1 -1
- package/lib/components/index.js +10 -10
- package/lib/components/index.js.map +1 -1
- package/lib/flame-chart-model.d.ts +2 -2
- package/lib/flame-chart-model.d.ts.map +1 -1
- package/lib/flame-chart-model.js.map +1 -1
- 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 +2 -2
- 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/utils/data-transform.d.ts +2 -2
- package/lib/utils/data-transform.d.ts.map +1 -1
- package/lib/utils/data-transform.js +2 -2
- package/lib/utils/data-transform.js.map +1 -1
- package/lib/utils/format.js +2 -2
- package/lib/utils/palette-gen.js +1 -1
- package/lib/utils/palette-gen.js.map +1 -1
- package/lib/utils/palette.js +1 -1
- package/lib/utils/series-tooltip.d.ts +1 -1
- package/lib/utils/series-tooltip.d.ts.map +1 -1
- package/lib/utils/series-tooltip.js +1 -1
- package/lib/utils/series-tooltip.js.map +1 -1
- package/lib/utils/tooltip.d.ts +1 -1
- package/lib/utils/tooltip.d.ts.map +1 -1
- package/lib/utils/tooltip.js +2 -2
- package/lib/utils/tooltip.js.map +1 -1
- package/lib/utils/utils.d.ts +2 -2
- package/lib/utils/utils.d.ts.map +1 -1
- package/lib/utils/utils.js +1 -1
- package/lib/utils/utils.js.map +1 -1
- package/mf-manifest.json +31 -53
- package/mf-stats.json +31 -57
- package/package.json +10 -10
- package/__mf/js/async/121.7241788e.js +0 -2
- package/__mf/js/async/177.d1b72566.js +0 -1
- package/__mf/js/async/187.d2c3954d.js +0 -7
- package/__mf/js/async/187.d2c3954d.js.LICENSE.txt +0 -39
- package/__mf/js/async/192.2e230dc2.js +0 -1
- package/__mf/js/async/2.3d2f3d32.js +0 -1
- package/__mf/js/async/235.f7949644.js +0 -1
- package/__mf/js/async/274.f1ae4a6c.js +0 -2
- package/__mf/js/async/356.941c6c54.js +0 -1
- package/__mf/js/async/367.8beb758e.js +0 -110
- package/__mf/js/async/392.157fda9a.js +0 -2
- package/__mf/js/async/43.2eeeac07.js +0 -2
- package/__mf/js/async/470.55030a0b.js +0 -2
- package/__mf/js/async/546.d47a49c6.js +0 -24
- package/__mf/js/async/546.d47a49c6.js.LICENSE.txt +0 -19
- package/__mf/js/async/587.8bcd9e70.js +0 -1
- package/__mf/js/async/588.0012e8ae.js +0 -1
- package/__mf/js/async/597.fee7f09c.js +0 -1
- package/__mf/js/async/616.da14f6a0.js +0 -1
- package/__mf/js/async/657.9473a80f.js +0 -39
- package/__mf/js/async/698.06b3786e.js +0 -1
- package/__mf/js/async/71.126af909.js +0 -1
- package/__mf/js/async/740.c1f5cc4b.js +0 -1
- package/__mf/js/async/873.cd4654cd.js +0 -1
- package/__mf/js/async/941.c00ae16d.js +0 -2
- package/__mf/js/async/968.f7510839.js +0 -1
- package/__mf/js/async/97.fd587361.js +0 -1
- package/__mf/js/async/978.e1b5b66e.js +0 -1
- package/__mf/js/async/__federation_expose_FlameChart.7a8d049a.js +0 -17
- package/__mf/js/async/lib-router.1a328ab9.js +0 -2
- package/lib/cjs/FlameChart.js +0 -37
- package/lib/cjs/bootstrap.js +0 -26
- package/lib/cjs/components/CustomBreadcrumb.js +0 -96
- package/lib/cjs/components/FlameChart.js +0 -341
- package/lib/cjs/components/FlameChartOptionsEditorSettings.js +0 -104
- package/lib/cjs/components/FlameChartPanel.js +0 -164
- package/lib/cjs/components/PaletteSelector.js +0 -49
- package/lib/cjs/components/SearchBar.js +0 -59
- package/lib/cjs/components/SeriesChart.js +0 -189
- package/lib/cjs/components/Settings.js +0 -202
- package/lib/cjs/components/SwitchSelector.js +0 -37
- package/lib/cjs/components/TableChart.js +0 -143
- package/lib/cjs/components/index.js +0 -39
- package/lib/cjs/env.d.js +0 -14
- package/lib/cjs/flame-chart-model.js +0 -31
- package/lib/cjs/getPluginModule.js +0 -39
- package/lib/cjs/index-federation.js +0 -55
- package/lib/cjs/index.js +0 -37
- package/lib/cjs/setup-tests.js +0 -19
- package/lib/cjs/utils/data-model.js +0 -18
- package/lib/cjs/utils/data-transform.js +0 -163
- package/lib/cjs/utils/format.js +0 -88
- package/lib/cjs/utils/palette-gen.js +0 -68
- package/lib/cjs/utils/palette.js +0 -62
- package/lib/cjs/utils/series-tooltip.js +0 -51
- package/lib/cjs/utils/tooltip.js +0 -76
- package/lib/cjs/utils/ui-text.js +0 -30
- package/lib/cjs/utils/utils.js +0 -122
- /package/__mf/css/async/{187.85c2cbf6.css → 40.85c2cbf6.css} +0 -0
- /package/__mf/js/async/{121.7241788e.js.LICENSE.txt → 121.b114caf4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{274.f1ae4a6c.js.LICENSE.txt → 274.e53c6dc1.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.157fda9a.js.LICENSE.txt → 392.800bb82c.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{43.2eeeac07.js.LICENSE.txt → 43.71599a15.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{470.55030a0b.js.LICENSE.txt → 470.1af0a163.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{367.8beb758e.js.LICENSE.txt → 802.f2161316.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.c00ae16d.js.LICENSE.txt → 941.e44ab19f.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.1a328ab9.js.LICENSE.txt → lib-router.d7bf8c32.js.LICENSE.txt} +0 -0
package/lib/FlameChart.js
CHANGED
|
@@ -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 {
|
|
14
|
-
import {
|
|
13
|
+
import { FlameChartPanel, FlameChartOptionsEditorSettings } from "./components/index.js";
|
|
14
|
+
import { createInitialFlameChartOptions } from "./flame-chart-model.js";
|
|
15
15
|
/**
|
|
16
16
|
* The core FlameChart panel plugin for Perses.
|
|
17
17
|
*/ export const FlameChart = {
|
package/lib/FlameChart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/FlameChart.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 { PanelPlugin } from '@perses-dev/plugin-system';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/FlameChart.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 { PanelPlugin } from '@perses-dev/plugin-system';\n\nimport type { FlameChartPanelProps } from './components';\nimport { FlameChartPanel, FlameChartOptionsEditorSettings } from './components';\nimport type { FlameChartOptions } from './flame-chart-model';\nimport { createInitialFlameChartOptions } from './flame-chart-model';\n\n/**\n * The core FlameChart panel plugin for Perses.\n */\nexport const FlameChart: PanelPlugin<FlameChartOptions, FlameChartPanelProps> = {\n PanelComponent: FlameChartPanel,\n supportedQueryTypes: ['ProfileQuery'],\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: FlameChartOptionsEditorSettings,\n },\n ],\n createInitialOptions: createInitialFlameChartOptions,\n};\n"],"names":["FlameChartPanel","FlameChartOptionsEditorSettings","createInitialFlameChartOptions","FlameChart","PanelComponent","supportedQueryTypes","panelOptionsEditorComponents","label","content","createInitialOptions"],"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,eAAe,EAAEC,+BAA+B,QAAQ,wBAAe;AAEhF,SAASC,8BAA8B,QAAQ,yBAAsB;AAErE;;CAEC,GACD,OAAO,MAAMC,aAAmE;IAC9EC,gBAAgBJ;IAChBK,qBAAqB;QAAC;KAAe;IACrCC,8BAA8B;QAC5B;YACEC,OAAO;YACPC,SAASP;QACX;KACD;IACDQ,sBAAsBP;AACxB,EAAE"}
|
package/lib/bootstrap.js
CHANGED
|
@@ -11,8 +11,8 @@ 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 React from
|
|
15
|
-
import ReactDOM from
|
|
14
|
+
import React from "react";
|
|
15
|
+
import ReactDOM from "react-dom/client";
|
|
16
16
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
17
17
|
root.render(/*#__PURE__*/ _jsx(React.StrictMode, {}));
|
|
18
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomBreadcrumb.d.ts","sourceRoot":"","sources":["../../../src/components/CustomBreadcrumb.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CustomBreadcrumb.d.ts","sourceRoot":"","sources":["../../../src/components/CustomBreadcrumb.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAmBD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,YAAY,CAgC3E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License | Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,14 +11,13 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import { formatValue } from '@perses-dev/components';
|
|
14
|
+
import { Stack, Breadcrumbs } from "@mui/material";
|
|
15
|
+
import Chip from "@mui/material/Chip";
|
|
16
|
+
import { emphasize, styled } from "@mui/material/styles";
|
|
17
|
+
import { formatValue } from "@perses-dev/components";
|
|
18
|
+
import ChevronRightIcon from "mdi-material-ui/ChevronRight";
|
|
19
|
+
import CloseIcon from "mdi-material-ui/Close";
|
|
20
|
+
import EyeIcon from "mdi-material-ui/EyeOutline";
|
|
21
21
|
const StyledBreadcrumb = styled(Chip)(({ theme })=>{
|
|
22
22
|
const backgroundColor = theme.palette.mode === 'light' ? theme.palette.grey[100] : theme.palette.grey[800];
|
|
23
23
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/CustomBreadcrumb.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/components/CustomBreadcrumb.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, Breadcrumbs } from '@mui/material';\nimport Chip from '@mui/material/Chip';\nimport { emphasize, styled } from '@mui/material/styles';\nimport { formatValue } from '@perses-dev/components';\nimport ChevronRightIcon from 'mdi-material-ui/ChevronRight';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport EyeIcon from 'mdi-material-ui/EyeOutline';\nimport type { ReactElement } from 'react';\n\nexport interface CustomBreadcrumbProps {\n totalValue: string;\n totalSample: number;\n otherItemSample: number | undefined;\n onSelectedIdChange: (newId: number) => void;\n}\n\nconst StyledBreadcrumb = styled(Chip)(({ theme }) => {\n const backgroundColor = theme.palette.mode === 'light' ? theme.palette.grey[100] : theme.palette.grey[800];\n return {\n backgroundColor,\n height: theme.spacing(3),\n color: theme.palette.text.primary,\n fontWeight: theme.typography.fontWeightRegular,\n '&:hover, &:focus': {\n backgroundColor: emphasize(backgroundColor, 0.06),\n },\n '&:active': {\n boxShadow: theme.shadows[1],\n backgroundColor: emphasize(backgroundColor, 0.12),\n },\n };\n});\n\nexport function CustomBreadcrumb(props: CustomBreadcrumbProps): ReactElement {\n const { totalValue, totalSample, otherItemSample, onSelectedIdChange } = props;\n\n const handleClick = (event: React.MouseEvent<Element, MouseEvent>): void => {\n event.preventDefault();\n onSelectedIdChange(0);\n };\n\n const splitedValue = totalValue.split('(');\n const totalValueText = splitedValue[splitedValue.length - 1]?.slice(0, -1);\n\n const totalLabel = formatValue(totalSample, { unit: 'decimal', decimalPlaces: 2, shortValues: true }) + ' samples';\n\n return (\n <Stack direction=\"row\" spacing={1} minHeight={40} alignItems=\"center\">\n <Breadcrumbs\n separator={<ChevronRightIcon fontSize=\"small\" />}\n aria-label=\"breadcrumb\"\n sx={{ justifyContent: 'center' }}\n >\n <StyledBreadcrumb label={totalValueText + ' | ' + totalLabel} />\n {otherItemSample !== undefined && (\n <StyledBreadcrumb\n label={((otherItemSample / totalSample) * 100).toFixed(2) + '% of total'}\n icon={<EyeIcon fontSize=\"small\" color=\"secondary\" />}\n deleteIcon={<CloseIcon fontSize=\"small\" />}\n onDelete={handleClick}\n />\n )}\n </Breadcrumbs>\n </Stack>\n );\n}\n"],"names":["Stack","Breadcrumbs","Chip","emphasize","styled","formatValue","ChevronRightIcon","CloseIcon","EyeIcon","StyledBreadcrumb","theme","backgroundColor","palette","mode","grey","height","spacing","color","text","primary","fontWeight","typography","fontWeightRegular","boxShadow","shadows","CustomBreadcrumb","props","totalValue","totalSample","otherItemSample","onSelectedIdChange","handleClick","event","preventDefault","splitedValue","split","totalValueText","length","slice","totalLabel","unit","decimalPlaces","shortValues","direction","minHeight","alignItems","separator","fontSize","aria-label","sx","justifyContent","label","undefined","toFixed","icon","deleteIcon","onDelete"],"mappings":";AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;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QAAG4B,WAAW;QAAIC,YAAW;kBAC3D,cAAA,MAAC5C;YACC6C,yBAAW,KAACxC;gBAAiByC,UAAS;;YACtCC,cAAW;YACXC,IAAI;gBAAEC,gBAAgB;YAAS;;8BAE/B,KAACzC;oBAAiB0C,OAAOf,iBAAiB,UAAUG;;gBACnDV,oBAAoBuB,2BACnB,KAAC3C;oBACC0C,OAAO,AAAC,CAAA,AAACtB,kBAAkBD,cAAe,GAAE,EAAGyB,OAAO,CAAC,KAAK;oBAC5DC,oBAAM,KAAC9C;wBAAQuC,UAAS;wBAAQ9B,OAAM;;oBACtCsC,0BAAY,KAAChD;wBAAUwC,UAAS;;oBAChCS,UAAUzB;;;;;AAMtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlameChart.d.ts","sourceRoot":"","sources":["../../../src/components/FlameChart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FlameChart.d.ts","sourceRoot":"","sources":["../../../src/components/FlameChart.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAWpD,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,OAAO,CAAC;AAetD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAqP/D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,16 +11,15 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import RefreshIcon from
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { CustomBreadcrumb } from './CustomBreadcrumb';
|
|
14
|
+
import { Stack, Box, Menu, MenuItem, Divider, useTheme } from "@mui/material";
|
|
15
|
+
import { useChartsTheme, EChart } from "@perses-dev/components";
|
|
16
|
+
import ContentCopyIcon from "mdi-material-ui/ContentCopy";
|
|
17
|
+
import EyeIcon from "mdi-material-ui/EyeOutline";
|
|
18
|
+
import RefreshIcon from "mdi-material-ui/Refresh";
|
|
19
|
+
import { useState, useMemo } from "react";
|
|
20
|
+
import { buildSamples, findTotalSampleByName } from "../utils/data-transform.js";
|
|
21
|
+
import { generateTooltip } from "../utils/tooltip.js";
|
|
22
|
+
import { CustomBreadcrumb } from "./CustomBreadcrumb.js";
|
|
23
23
|
const ITEM_GAP = 2; // vertical gap between flame chart items
|
|
24
24
|
const Y_MIN_SMALL = 6; // min value of y axis for small containers
|
|
25
25
|
const Y_MIN_LARGE = 20; // min value of y axis for large containers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/FlameChart.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 {\n CustomSeriesRenderItem,\n CustomSeriesRenderItemAPI,\n CustomSeriesRenderItemParams,\n CustomSeriesRenderItemReturn,\n} from 'echarts';\nimport { Stack, Box, Menu, MenuItem, Divider, useTheme } from '@mui/material';\nimport { ReactElement, useState, useMemo, MouseEvent } from 'react';\nimport { useChartsTheme, EChart, MouseEventsParameters } from '@perses-dev/components';\nimport RefreshIcon from 'mdi-material-ui/Refresh';\nimport EyeIcon from 'mdi-material-ui/EyeOutline';\nimport ContentCopyIcon from 'mdi-material-ui/ContentCopy';\nimport { EChartsCoreOption } from 'echarts/core';\nimport { ProfileData } from '@perses-dev/spec';\nimport { buildSamples, findTotalSampleByName } from '../utils/data-transform';\nimport { generateTooltip } from '../utils/tooltip';\nimport { FlameChartSample as Sample } from '../utils/data-model';\nimport { CustomBreadcrumb } from './CustomBreadcrumb';\n\nconst ITEM_GAP = 2; // vertical gap between flame chart items\nconst Y_MIN_SMALL = 6; // min value of y axis for small containers\nconst Y_MIN_LARGE = 20; // min value of y axis for large containers\nconst LARGE_CONTAINER_THRESHOLD = 600;\nconst CONTAINER_PADDING = 10;\nconst BREADCRUMB_SPACE = 50;\n\nexport interface FlameChartProps {\n width: number;\n height: number;\n data: ProfileData;\n palette: 'package-name' | 'value';\n selectedId: number;\n searchValue: string;\n onSelectedIdChange: (newId: number) => void;\n}\n\nexport function FlameChart(props: FlameChartProps): ReactElement {\n const { width, height, data, palette, selectedId, searchValue, onSelectedIdChange } = props;\n const theme = useTheme();\n const chartsTheme = useChartsTheme();\n const [menuPosition, setMenuPosition] = useState<{ mouseX: number; mouseY: number } | null>(null);\n const [selectedItem, setSelectedItem] = useState<{ id: number; name: string }>({ id: 0, name: '' });\n const [isCopied, setIsCopied] = useState(false);\n\n const seriesData = useMemo(\n () => buildSamples(palette, data.metadata, data.profile.stackTrace, searchValue, selectedId),\n [palette, data.metadata, data.profile.stackTrace, selectedId, searchValue]\n );\n\n const handleItemClick = (params: MouseEventsParameters<Sample>): void => {\n const data: Sample = params.data;\n const functionName = data.value[6];\n const functionId = data.name;\n setSelectedItem({ id: functionId, name: functionName });\n\n // To ensure that the cursor is positioned inside the menu when it opens,\n // we adjust the click event coordinates as follows:\n if ('event' in params) {\n const mouseEvent = params.event as { event: MouseEvent };\n setMenuPosition({\n mouseX: mouseEvent.event.clientX - 2,\n mouseY: mouseEvent.event.clientY - 4,\n });\n }\n };\n\n const handleFocusBlock = (): void => {\n onSelectedIdChange(selectedItem.id);\n handleClose();\n };\n\n const handleCopyFunctionName = (): void => {\n if ((selectedId || selectedId === 0) && selectedItem.name) {\n navigator.clipboard.writeText(selectedItem.name);\n }\n setIsCopied(true);\n };\n\n const handleResetGraph = (): void => {\n if (selectedId) {\n onSelectedIdChange(0);\n }\n handleClose();\n };\n\n const handleClose = (): void => {\n setMenuPosition(null);\n if (isCopied) setIsCopied(false);\n };\n\n const renderItem: CustomSeriesRenderItem = (params: CustomSeriesRenderItemParams, api: CustomSeriesRenderItemAPI) => {\n const level = api.value(0);\n const start = api.coord([api.value(1), level]);\n const end = api.coord([api.value(2), level]);\n const height = (((api.size && api.size([0, 1])) || [0, 20]) as number[])[1];\n const width = (end?.[0] ?? 0) - (start?.[0] ?? 0);\n\n return {\n type: 'rect',\n transition: ['shape'],\n shape: {\n x: start?.[0],\n y: (start?.[1] ?? 0) - (height ?? 0) / 2,\n width,\n height: (height ?? ITEM_GAP) - ITEM_GAP,\n r: 0,\n },\n style: {\n fill: api.visual('color'),\n },\n emphasis: {\n style: {\n stroke: '#000',\n },\n },\n textConfig: {\n position: 'insideLeft',\n },\n textContent: {\n style: {\n text: api.value(3),\n fill: '#000',\n width: width - 4,\n overflow: 'truncate',\n ellipsis: '..',\n truncateMinChar: 1,\n },\n emphasis: {\n style: {\n stroke: '#000',\n lineWidth: 0.5,\n },\n },\n },\n } as CustomSeriesRenderItemReturn;\n };\n\n const option: EChartsCoreOption = useMemo(() => {\n if (data.profile.stackTrace === undefined) return chartsTheme.noDataOption;\n\n const maxDepth = Math.max(...seriesData.map((s) => s.value[0])); // maximum depth of the stack trace\n const yAxisMax = Math.max(height > LARGE_CONTAINER_THRESHOLD ? Y_MIN_LARGE : Y_MIN_SMALL, maxDepth);\n const totalStart = seriesData[0]?.value[1]; // start value of the total function\n const totalEnd = seriesData[0]?.value[2]; // end value of the total function\n const xAxisMin = totalStart;\n const xAxisMax = totalEnd;\n\n // compute flame chart padding top and bottom\n const padding = (height / (yAxisMax - 1) - ITEM_GAP) / 2 + 1;\n\n const option = {\n tooltip: {\n appendToBody: true,\n confine: true,\n formatter: (params: Sample): string => generateTooltip(params, data.metadata?.units),\n backgroundColor: theme.palette.background.paper,\n borderColor: theme.palette.background.paper,\n textStyle: {\n color: theme.palette.text.primary,\n },\n },\n xAxis: {\n show: false,\n min: xAxisMin,\n max: xAxisMax,\n axisLabel: {\n show: false,\n },\n },\n yAxis: {\n show: false,\n max: yAxisMax,\n inverse: true, // Reverse Y axis\n axisLabel: {\n show: false,\n },\n },\n axisLabel: {\n overflow: 'truncate',\n width: width / 3,\n },\n grid: {\n left: 5,\n right: 5,\n top: padding + 5,\n bottom: padding,\n },\n series: [\n {\n type: 'custom',\n renderItem,\n encode: {\n x: [0, 1, 2],\n y: 0,\n },\n data: seriesData,\n },\n ],\n };\n\n return option;\n }, [data, chartsTheme, theme, width, seriesData, height]);\n\n // Use useMemo to memoize the flame chart component and prevent unnecessary re-renders.\n // This ensures the chart does not re-render when the onClick event updates state variables\n // like menuPosition or selectedId.\n const flameChart = useMemo(\n () => (\n <EChart\n style={{\n width: width,\n height: height - 2 * CONTAINER_PADDING - BREADCRUMB_SPACE,\n }}\n option={option} // even data is in this prop\n theme={chartsTheme.echartsTheme}\n onEvents={{\n click: handleItemClick as (params: MouseEventsParameters<unknown>) => void,\n }}\n />\n ),\n [chartsTheme.echartsTheme, height, option, width]\n );\n\n return (\n <Stack\n style={{\n width: width,\n height: height,\n }}\n alignItems=\"center\"\n >\n <CustomBreadcrumb\n totalValue={seriesData[0]?.value[3] || ''} // name of the total function\n totalSample={seriesData[0]?.value[8] || 0} // total sample of the total function\n otherItemSample={findTotalSampleByName(seriesData, selectedId)} // total sample of the selected function\n onSelectedIdChange={onSelectedIdChange}\n />\n {flameChart}\n <Menu\n sx={{\n '& .MuiPaper-root': {\n backgroundColor: theme.palette.background.paper,\n color: theme.palette.text.primary,\n padding: '5px',\n paddingBottom: '0px',\n },\n '& .MuiMenuItem-root': {\n '&:hover': {\n backgroundColor: theme.palette.action.hover,\n },\n },\n }}\n open={menuPosition !== null}\n onClose={handleClose}\n anchorReference=\"anchorPosition\"\n anchorPosition={menuPosition !== null ? { top: menuPosition.mouseY, left: menuPosition.mouseX } : undefined}\n >\n <Box\n sx={{\n paddingLeft: '16px',\n paddingBottom: '8px',\n }}\n >\n {selectedItem.name}\n </Box>\n <Divider sx={{ backgroundColor: theme.palette.divider }} />\n <MenuItem onClick={handleFocusBlock}>\n <EyeIcon fontSize=\"small\" color=\"secondary\" sx={{ marginRight: '10px' }} />\n Focus block\n </MenuItem>\n <MenuItem onClick={handleCopyFunctionName} disabled={isCopied}>\n <ContentCopyIcon fontSize=\"small\" color=\"secondary\" sx={{ marginRight: '10px' }} />\n {isCopied ? 'Copied' : 'Copy function name'}\n </MenuItem>\n <MenuItem onClick={handleResetGraph}>\n <RefreshIcon fontSize=\"small\" color=\"secondary\" sx={{ marginRight: '10px' }} />\n Reset graph\n </MenuItem>\n </Menu>\n </Stack>\n );\n}\n"],"names":["Stack","Box","Menu","MenuItem","Divider","useTheme","useState","useMemo","useChartsTheme","EChart","RefreshIcon","EyeIcon","ContentCopyIcon","buildSamples","findTotalSampleByName","generateTooltip","CustomBreadcrumb","ITEM_GAP","Y_MIN_SMALL","Y_MIN_LARGE","LARGE_CONTAINER_THRESHOLD","CONTAINER_PADDING","BREADCRUMB_SPACE","FlameChart","props","width","height","data","palette","selectedId","searchValue","onSelectedIdChange","theme","chartsTheme","menuPosition","setMenuPosition","selectedItem","setSelectedItem","id","name","isCopied","setIsCopied","seriesData","metadata","profile","stackTrace","handleItemClick","params","functionName","value","functionId","mouseEvent","event","mouseX","clientX","mouseY","clientY","handleFocusBlock","handleClose","handleCopyFunctionName","navigator","clipboard","writeText","handleResetGraph","renderItem","api","level","start","coord","end","size","type","transition","shape","x","y","r","style","fill","visual","emphasis","stroke","textConfig","position","textContent","text","overflow","ellipsis","truncateMinChar","lineWidth","option","undefined","noDataOption","maxDepth","Math","max","map","s","yAxisMax","totalStart","totalEnd","xAxisMin","xAxisMax","padding","tooltip","appendToBody","confine","formatter","units","backgroundColor","background","paper","borderColor","textStyle","color","primary","xAxis","show","min","axisLabel","yAxis","inverse","grid","left","right","top","bottom","series","encode","flameChart","echartsTheme","onEvents","click","alignItems","totalValue","totalSample","otherItemSample","sx","paddingBottom","action","hover","open","onClose","anchorReference","anchorPosition","paddingLeft","divider","onClick","fontSize","marginRight","disabled"],"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;;AAQjC,SAASA,KAAK,EAAEC,GAAG,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,gBAAgB;AAC9E,SAAuBC,QAAQ,EAAEC,OAAO,QAAoB,QAAQ;AACpE,SAASC,cAAc,EAAEC,MAAM,QAA+B,yBAAyB;AACvF,OAAOC,iBAAiB,0BAA0B;AAClD,OAAOC,aAAa,6BAA6B;AACjD,OAAOC,qBAAqB,8BAA8B;AAG1D,SAASC,YAAY,EAAEC,qBAAqB,QAAQ,0BAA0B;AAC9E,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,gBAAgB,QAAQ,qBAAqB;AAEtD,MAAMC,WAAW,GAAG,yCAAyC;AAC7D,MAAMC,cAAc,GAAG,2CA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jB;oBACA,uBAAuB;wBACrB,WAAW;4BACT7B,iBAAiB7E,MAAMJ,OAAO,CAAC+G,MAAM,CAACC,KAAK;wBAC7C;oBACF;gBACF;gBACAC,MAAM3G,iBAAiB;gBACvB4G,SAASpF;gBACTqF,iBAAgB;gBAChBC,gBAAgB9G,iBAAiB,OAAO;oBAAE2F,KAAK3F,aAAaqB,MAAM;oBAAEoE,MAAMzF,aAAamB,MAAM;gBAAC,IAAIsC;;kCAElG,KAAC1F;wBACCwI,IAAI;4BACFQ,aAAa;4BACbP,eAAe;wBACjB;kCAECtG,aAAaG,IAAI;;kCAEpB,KAACnC;wBAAQqI,IAAI;4BAAE5B,iBAAiB7E,MAAMJ,OAAO,CAACsH,OAAO;wBAAC;;kCACtD,MAAC/I;wBAASgJ,SAAS1F;;0CACjB,KAAC9C;gCAAQyI,UAAS;gCAAQlC,OAAM;gCAAYuB,IAAI;oCAAEY,aAAa;gCAAO;;4BAAK;;;kCAG7E,MAAClJ;wBAASgJ,SAASxF;wBAAwB2F,UAAU9G;;0CACnD,KAAC5B;gCAAgBwI,UAAS;gCAAQlC,OAAM;gCAAYuB,IAAI;oCAAEY,aAAa;gCAAO;;4BAC7E7G,WAAW,WAAW;;;kCAEzB,MAACrC;wBAASgJ,SAASpF;;0CACjB,KAACrD;gCAAY0I,UAAS;gCAAQlC,OAAM;gCAAYuB,IAAI;oCAAEY,aAAa;gCAAO;;4BAAK;;;;;;;AAMzF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/FlameChart.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, Box, Menu, MenuItem, Divider, useTheme } from '@mui/material';\nimport type { MouseEventsParameters } from '@perses-dev/components';\nimport { useChartsTheme, EChart } from '@perses-dev/components';\nimport type { ProfileData } from '@perses-dev/spec';\nimport type {\n CustomSeriesRenderItem,\n CustomSeriesRenderItemAPI,\n CustomSeriesRenderItemParams,\n CustomSeriesRenderItemReturn,\n} from 'echarts';\nimport type { EChartsCoreOption } from 'echarts/core';\nimport ContentCopyIcon from 'mdi-material-ui/ContentCopy';\nimport EyeIcon from 'mdi-material-ui/EyeOutline';\nimport RefreshIcon from 'mdi-material-ui/Refresh';\nimport type { ReactElement, MouseEvent } from 'react';\nimport { useState, useMemo } from 'react';\n\nimport type { FlameChartSample as Sample } from '../utils/data-model';\nimport { buildSamples, findTotalSampleByName } from '../utils/data-transform';\nimport { generateTooltip } from '../utils/tooltip';\nimport { CustomBreadcrumb } from './CustomBreadcrumb';\n\nconst ITEM_GAP = 2; // vertical gap between flame chart items\nconst Y_MIN_SMALL = 6; // min value of y axis for small containers\nconst Y_MIN_LARGE = 20; // min value of y axis for large containers\nconst LARGE_CONTAINER_THRESHOLD = 600;\nconst CONTAINER_PADDING = 10;\nconst BREADCRUMB_SPACE = 50;\n\nexport interface FlameChartProps {\n width: number;\n height: number;\n data: ProfileData;\n palette: 'package-name' | 'value';\n selectedId: number;\n searchValue: string;\n onSelectedIdChange: (newId: number) => void;\n}\n\nexport function FlameChart(props: FlameChartProps): ReactElement {\n const { width, height, data, palette, selectedId, searchValue, onSelectedIdChange } = props;\n const theme = useTheme();\n const chartsTheme = useChartsTheme();\n const [menuPosition, setMenuPosition] = useState<{ mouseX: number; mouseY: number } | null>(null);\n const [selectedItem, setSelectedItem] = useState<{ id: number; name: string }>({ id: 0, name: '' });\n const [isCopied, setIsCopied] = useState(false);\n\n const seriesData = useMemo(\n () => buildSamples(palette, data.metadata, data.profile.stackTrace, searchValue, selectedId),\n [palette, data.metadata, data.profile.stackTrace, selectedId, searchValue],\n );\n\n const handleItemClick = (params: MouseEventsParameters<Sample>): void => {\n const data: Sample = params.data;\n const functionName = data.value[6];\n const functionId = data.name;\n setSelectedItem({ id: functionId, name: functionName });\n\n // To ensure that the cursor is positioned inside the menu when it opens,\n // we adjust the click event coordinates as follows:\n if ('event' in params) {\n const mouseEvent = params.event as { event: MouseEvent };\n setMenuPosition({\n mouseX: mouseEvent.event.clientX - 2,\n mouseY: mouseEvent.event.clientY - 4,\n });\n }\n };\n\n const handleFocusBlock = (): void => {\n onSelectedIdChange(selectedItem.id);\n handleClose();\n };\n\n const handleCopyFunctionName = (): void => {\n if ((selectedId || selectedId === 0) && selectedItem.name) {\n navigator.clipboard.writeText(selectedItem.name);\n }\n setIsCopied(true);\n };\n\n const handleResetGraph = (): void => {\n if (selectedId) {\n onSelectedIdChange(0);\n }\n handleClose();\n };\n\n const handleClose = (): void => {\n setMenuPosition(null);\n if (isCopied) setIsCopied(false);\n };\n\n const renderItem: CustomSeriesRenderItem = (params: CustomSeriesRenderItemParams, api: CustomSeriesRenderItemAPI) => {\n const level = api.value(0);\n const start = api.coord([api.value(1), level]);\n const end = api.coord([api.value(2), level]);\n const height = (((api.size && api.size([0, 1])) || [0, 20]) as number[])[1];\n const width = (end?.[0] ?? 0) - (start?.[0] ?? 0);\n\n return {\n type: 'rect',\n transition: ['shape'],\n shape: {\n x: start?.[0],\n y: (start?.[1] ?? 0) - (height ?? 0) / 2,\n width,\n height: (height ?? ITEM_GAP) - ITEM_GAP,\n r: 0,\n },\n style: {\n fill: api.visual('color'),\n },\n emphasis: {\n style: {\n stroke: '#000',\n },\n },\n textConfig: {\n position: 'insideLeft',\n },\n textContent: {\n style: {\n text: api.value(3),\n fill: '#000',\n width: width - 4,\n overflow: 'truncate',\n ellipsis: '..',\n truncateMinChar: 1,\n },\n emphasis: {\n style: {\n stroke: '#000',\n lineWidth: 0.5,\n },\n },\n },\n } as CustomSeriesRenderItemReturn;\n };\n\n const option: EChartsCoreOption = useMemo(() => {\n if (data.profile.stackTrace === undefined) return chartsTheme.noDataOption;\n\n const maxDepth = Math.max(...seriesData.map((s) => s.value[0])); // maximum depth of the stack trace\n const yAxisMax = Math.max(height > LARGE_CONTAINER_THRESHOLD ? Y_MIN_LARGE : Y_MIN_SMALL, maxDepth);\n const totalStart = seriesData[0]?.value[1]; // start value of the total function\n const totalEnd = seriesData[0]?.value[2]; // end value of the total function\n const xAxisMin = totalStart;\n const xAxisMax = totalEnd;\n\n // compute flame chart padding top and bottom\n const padding = (height / (yAxisMax - 1) - ITEM_GAP) / 2 + 1;\n\n const option = {\n tooltip: {\n appendToBody: true,\n confine: true,\n formatter: (params: Sample): string => generateTooltip(params, data.metadata?.units),\n backgroundColor: theme.palette.background.paper,\n borderColor: theme.palette.background.paper,\n textStyle: {\n color: theme.palette.text.primary,\n },\n },\n xAxis: {\n show: false,\n min: xAxisMin,\n max: xAxisMax,\n axisLabel: {\n show: false,\n },\n },\n yAxis: {\n show: false,\n max: yAxisMax,\n inverse: true, // Reverse Y axis\n axisLabel: {\n show: false,\n },\n },\n axisLabel: {\n overflow: 'truncate',\n width: width / 3,\n },\n grid: {\n left: 5,\n right: 5,\n top: padding + 5,\n bottom: padding,\n },\n series: [\n {\n type: 'custom',\n renderItem,\n encode: {\n x: [0, 1, 2],\n y: 0,\n },\n data: seriesData,\n },\n ],\n };\n\n return option;\n }, [data, chartsTheme, theme, width, seriesData, height]);\n\n // Use useMemo to memoize the flame chart component and prevent unnecessary re-renders.\n // This ensures the chart does not re-render when the onClick event updates state variables\n // like menuPosition or selectedId.\n const flameChart = useMemo(\n () => (\n <EChart\n style={{\n width: width,\n height: height - 2 * CONTAINER_PADDING - BREADCRUMB_SPACE,\n }}\n option={option} // even data is in this prop\n theme={chartsTheme.echartsTheme}\n onEvents={{\n click: handleItemClick as (params: MouseEventsParameters<unknown>) => void,\n }}\n />\n ),\n [chartsTheme.echartsTheme, height, option, width],\n );\n\n return (\n <Stack\n style={{\n width: width,\n height: height,\n }}\n alignItems=\"center\"\n >\n <CustomBreadcrumb\n totalValue={seriesData[0]?.value[3] || ''} // name of the total function\n totalSample={seriesData[0]?.value[8] || 0} // total sample of the total function\n otherItemSample={findTotalSampleByName(seriesData, selectedId)} // total sample of the selected function\n onSelectedIdChange={onSelectedIdChange}\n />\n {flameChart}\n <Menu\n sx={{\n '& .MuiPaper-root': {\n backgroundColor: theme.palette.background.paper,\n color: theme.palette.text.primary,\n padding: '5px',\n paddingBottom: '0px',\n },\n '& .MuiMenuItem-root': {\n '&:hover': {\n backgroundColor: theme.palette.action.hover,\n },\n },\n }}\n open={menuPosition !== null}\n onClose={handleClose}\n anchorReference=\"anchorPosition\"\n anchorPosition={menuPosition !== null ? { top: menuPosition.mouseY, left: menuPosition.mouseX } : undefined}\n >\n <Box\n sx={{\n paddingLeft: '16px',\n paddingBottom: '8px',\n }}\n >\n {selectedItem.name}\n </Box>\n <Divider sx={{ backgroundColor: theme.palette.divider }} />\n <MenuItem onClick={handleFocusBlock}>\n <EyeIcon fontSize=\"small\" color=\"secondary\" sx={{ marginRight: '10px' }} />\n Focus block\n </MenuItem>\n <MenuItem onClick={handleCopyFunctionName} disabled={isCopied}>\n <ContentCopyIcon fontSize=\"small\" color=\"secondary\" sx={{ marginRight: '10px' }} />\n {isCopied ? 'Copied' : 'Copy function name'}\n </MenuItem>\n <MenuItem onClick={handleResetGraph}>\n <RefreshIcon fontSize=\"small\" color=\"secondary\" sx={{ marginRight: '10px' }} />\n Reset graph\n </MenuItem>\n </Menu>\n </Stack>\n );\n}\n"],"names":["Stack","Box","Menu","MenuItem","Divider","useTheme","useChartsTheme","EChart","ContentCopyIcon","EyeIcon","RefreshIcon","useState","useMemo","buildSamples","findTotalSampleByName","generateTooltip","CustomBreadcrumb","ITEM_GAP","Y_MIN_SMALL","Y_MIN_LARGE","LARGE_CONTAINER_THRESHOLD","CONTAINER_PADDING","BREADCRUMB_SPACE","FlameChart","props","width","height","data","palette","selectedId","searchValue","onSelectedIdChange","theme","chartsTheme","menuPosition","setMenuPosition","selectedItem","setSelectedItem","id","name","isCopied","setIsCopied","seriesData","metadata","profile","stackTrace","handleItemClick","params","functionName","value","functionId","mouseEvent","event","mouseX","clientX","mouseY","clientY","handleFocusBlock","handleClose","handleCopyFunctionName","navigator","clipboard","writeText","handleResetGraph","renderItem","api","level","start","coord","end","size","type","transition","shape","x","y","r","style","fill","visual","emphasis","stroke","textConfig","position","textContent","text","overflow","ellipsis","truncateMinChar","lineWidth","option","undefined","noDataOption","maxDepth","Math","max","map","s","yAxisMax","totalStart","totalEnd","xAxisMin","xAxisMax","padding","tooltip","appendToBody","confine","formatter","units","backgroundColor","background","paper","borderColor","textStyle","color","primary","xAxis","show","min","axisLabel","yAxis","inverse","grid","left","right","top","bottom","series","encode","flameChart","echartsTheme","onEvents","click","alignItems","totalValue","totalSample","otherItemSample","sx","paddingBottom","action","hover","open","onClose","anchorReference","anchorPosition","paddingLeft","divider","onClick","fontSize","marginRight","disabled"],"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,GAAG,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,gBAAgB;AAE9E,SAASC,cAAc,EAAEC,MAAM,QAAQ,yBAAyB;AAShE,OAAOC,qBAAqB,8BAA8B;AAC1D,OAAOC,aAAa,6BAA6B;AACjD,OAAOC,iBAAiB,0BAA0B;AAElD,SAASC,QAAQ,EAAEC,OAAO,QAAQ,QAAQ;AAG1C,SAASC,YAAY,EAAEC,qBAAqB,QAAQ,6BAA0B;AAC9E,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,gBAAgB,QAAQ,wBAAqB;AAEtD,MAAMC,WAAW,GAAG,yCAAyC;AAC7D,MAAMC,cAAc,GAAG,2CAA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;oBACA,uBAAuB;wBACrB,WAAW;4BACT7B,iBAAiB7E,MAAMJ,OAAO,CAAC+G,MAAM,CAACC,KAAK;wBAC7C;oBACF;gBACF;gBACAC,MAAM3G,iBAAiB;gBACvB4G,SAASpF;gBACTqF,iBAAgB;gBAChBC,gBAAgB9G,iBAAiB,OAAO;oBAAE2F,KAAK3F,aAAaqB,MAAM;oBAAEoE,MAAMzF,aAAamB,MAAM;gBAAC,IAAIsC;;kCAElG,KAAC1F;wBACCwI,IAAI;4BACFQ,aAAa;4BACbP,eAAe;wBACjB;kCAECtG,aAAaG,IAAI;;kCAEpB,KAACnC;wBAAQqI,IAAI;4BAAE5B,iBAAiB7E,MAAMJ,OAAO,CAACsH,OAAO;wBAAC;;kCACtD,MAAC/I;wBAASgJ,SAAS1F;;0CACjB,KAAChD;gCAAQ2I,UAAS;gCAAQlC,OAAM;gCAAYuB,IAAI;oCAAEY,aAAa;gCAAO;;4BAAK;;;kCAG7E,MAAClJ;wBAASgJ,SAASxF;wBAAwB2F,UAAU9G;;0CACnD,KAAChC;gCAAgB4I,UAAS;gCAAQlC,OAAM;gCAAYuB,IAAI;oCAAEY,aAAa;gCAAO;;4BAC7E7G,WAAW,WAAW;;;kCAEzB,MAACrC;wBAASgJ,SAASpF;;0CACjB,KAACrD;gCAAY0I,UAAS;gCAAQlC,OAAM;gCAAYuB,IAAI;oCAAEY,aAAa;gCAAO;;4BAAK;;;;;;;AAMzF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { FlameChartOptionsEditorProps } from '../flame-chart-model';
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { FlameChartOptionsEditorProps } from '../flame-chart-model';
|
|
3
3
|
export declare function FlameChartOptionsEditorSettings(props: FlameChartOptionsEditorProps): ReactElement;
|
|
4
4
|
//# sourceMappingURL=FlameChartOptionsEditorSettings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlameChartOptionsEditorSettings.d.ts","sourceRoot":"","sources":["../../../src/components/FlameChartOptionsEditorSettings.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FlameChartOptionsEditorSettings.d.ts","sourceRoot":"","sources":["../../../src/components/FlameChartOptionsEditorSettings.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAazE,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,4BAA4B,GAAG,YAAY,CA6CjG"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
// Copyright The Perses Authors
|
|
2
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
4
|
// you may not use this file except in compliance with the License.
|
|
@@ -10,12 +11,11 @@
|
|
|
10
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
12
|
// See the License for the specific language governing permissions and
|
|
12
13
|
// limitations under the License.
|
|
13
|
-
import {
|
|
14
|
-
import { OptionsEditorGroup, OptionsEditorGrid, OptionsEditorColumn, OptionsEditorControl } from
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { SwitchSelector } from './SwitchSelector';
|
|
14
|
+
import { Button, TextField } from "@mui/material";
|
|
15
|
+
import { OptionsEditorGroup, OptionsEditorGrid, OptionsEditorColumn, OptionsEditorControl } from "@perses-dev/components";
|
|
16
|
+
import { usePaletteState, useShowSettingsState, useShowSeriesState, useShowTableState, useShowFlameGraphState, resetSettings, useTraceHeightState } from "../utils/utils.js";
|
|
17
|
+
import { PaletteSelector } from "./PaletteSelector.js";
|
|
18
|
+
import { SwitchSelector } from "./SwitchSelector.js";
|
|
19
19
|
export function FlameChartOptionsEditorSettings(props) {
|
|
20
20
|
const { value } = props;
|
|
21
21
|
const { handlePaletteChange } = usePaletteState(props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/FlameChartOptionsEditorSettings.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/components/FlameChartOptionsEditorSettings.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 { Button, TextField } from '@mui/material';\nimport {\n OptionsEditorGroup,\n OptionsEditorGrid,\n OptionsEditorColumn,\n OptionsEditorControl,\n} from '@perses-dev/components';\nimport type { ReactElement } from 'react';\n\nimport type { FlameChartOptionsEditorProps } from '../flame-chart-model';\nimport {\n usePaletteState,\n useShowSettingsState,\n useShowSeriesState,\n useShowTableState,\n useShowFlameGraphState,\n resetSettings,\n useTraceHeightState,\n} from '../utils/utils';\nimport { PaletteSelector } from './PaletteSelector';\nimport { SwitchSelector } from './SwitchSelector';\n\nexport function FlameChartOptionsEditorSettings(props: FlameChartOptionsEditorProps): ReactElement {\n const { value } = props;\n\n const { handlePaletteChange } = usePaletteState(props);\n const { handleShowSettingsChange } = useShowSettingsState(props);\n const { handleShowSeriesChange } = useShowSeriesState(props);\n const { handleShowTableChange } = useShowTableState(props);\n const { handleShowFlameGraphChange } = useShowFlameGraphState(props);\n const { handleTraceHeightChange } = useTraceHeightState(props);\n\n return (\n <OptionsEditorGrid>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Misc\">\n <PaletteSelector value={value.palette} onChange={handlePaletteChange} />\n <OptionsEditorControl\n label=\"Trace Height\"\n control={\n <TextField\n type=\"number\"\n value={value.traceHeight ?? ''}\n slotProps={{ htmlInput: { min: 0, step: 1 } }}\n onChange={handleTraceHeightChange}\n />\n }\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Panels to display\">\n <SwitchSelector label=\"Show Options\" value={value.showSettings} onChange={handleShowSettingsChange} />\n <SwitchSelector label=\"Show Series\" value={value.showSeries} onChange={handleShowSeriesChange} />\n <SwitchSelector label=\"Show Table\" value={value.showTable} onChange={handleShowTableChange} />\n <SwitchSelector label=\"Show Flame Graph\" value={value.showFlameGraph} onChange={handleShowFlameGraphChange} />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Reset Settings\">\n <Button variant=\"outlined\" color=\"secondary\" onClick={() => resetSettings(props)}>\n Reset To Defaults\n </Button>\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n </OptionsEditorGrid>\n );\n}\n"],"names":["Button","TextField","OptionsEditorGroup","OptionsEditorGrid","OptionsEditorColumn","OptionsEditorControl","usePaletteState","useShowSettingsState","useShowSeriesState","useShowTableState","useShowFlameGraphState","resetSettings","useTraceHeightState","PaletteSelector","SwitchSelector","FlameChartOptionsEditorSettings","props","value","handlePaletteChange","handleShowSettingsChange","handleShowSeriesChange","handleShowTableChange","handleShowFlameGraphChange","handleTraceHeightChange","title","palette","onChange","label","control","type","traceHeight","slotProps","htmlInput","min","step","showSettings","showSeries","showTable","showFlameGraph","variant","color","onClick"],"mappings":";AAAA,+BAA+B;AAC/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CACxB,KAACV;4BAAea,OAAM;4BAAeV,OAAOA,MAAMkB,YAAY;4BAAET,UAAUP;;sCAC1E,KAACL;4BAAea,OAAM;4BAAcV,OAAOA,MAAMmB,UAAU;4BAAEV,UAAUN;;sCACvE,KAACN;4BAAea,OAAM;4BAAaV,OAAOA,MAAMoB,SAAS;4BAAEX,UAAUL;;sCACrE,KAACP;4BAAea,OAAM;4BAAmBV,OAAOA,MAAMqB,cAAc;4BAAEZ,UAAUJ;;;;;0BAGpF,KAAClB;0BACC,cAAA,KAACF;oBAAmBsB,OAAM;8BACxB,cAAA,KAACxB;wBAAOuC,SAAQ;wBAAWC,OAAM;wBAAYC,SAAS,IAAM9B,cAAcK;kCAAQ;;;;;;AAO5F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { FlameChartOptions } from '../flame-chart-model';
|
|
1
|
+
import type { PanelProps } from '@perses-dev/plugin-system';
|
|
2
|
+
import type { ProfileData } from '@perses-dev/spec';
|
|
3
|
+
import type { FC } from 'react';
|
|
4
|
+
import type { FlameChartOptions } from '../flame-chart-model';
|
|
5
5
|
export type FlameChartPanelProps = PanelProps<FlameChartOptions, ProfileData>;
|
|
6
6
|
export declare const FlameChartPanel: FC<FlameChartPanelProps>;
|
|
7
7
|
//# sourceMappingURL=FlameChartPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlameChartPanel.d.ts","sourceRoot":"","sources":["../../../src/components/FlameChartPanel.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"FlameChartPanel.d.ts","sourceRoot":"","sources":["../../../src/components/FlameChartPanel.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,kBAAkB,CAAC;AAEhE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAU9D,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;AAE9E,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CA2JpD,CAAC"}
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { useState, useEffect, useMemo } from
|
|
17
|
-
import { filterStackTraceById, getMaxDepth } from
|
|
18
|
-
import { FlameChart } from
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
14
|
+
import { Stack, Typography, useMediaQuery, useTheme } from "@mui/material";
|
|
15
|
+
import { useChartsTheme } from "@perses-dev/components";
|
|
16
|
+
import { useState, useEffect, useMemo } from "react";
|
|
17
|
+
import { filterStackTraceById, getMaxDepth } from "../utils/data-transform.js";
|
|
18
|
+
import { FlameChart } from "./FlameChart.js";
|
|
19
|
+
import { SeriesChart } from "./SeriesChart.js";
|
|
20
|
+
import { Settings } from "./Settings.js";
|
|
21
|
+
import { TableChart } from "./TableChart.js";
|
|
22
22
|
const LARGE_PANEL_THRESHOLD = 600;
|
|
23
23
|
const DEFAULT_SERIES_CHART_HEIGHT = 200;
|
|
24
24
|
export const FlameChartPanel = (props)=>{
|
|
@@ -81,75 +81,92 @@ export const FlameChartPanel = (props)=>{
|
|
|
81
81
|
});
|
|
82
82
|
};
|
|
83
83
|
if (!contentDimensions) return null;
|
|
84
|
-
|
|
84
|
+
let padding = 0;
|
|
85
|
+
if (liveSpec.showSeries && liveSpec.showSettings) {
|
|
86
|
+
padding = 32;
|
|
87
|
+
} else if (liveSpec.showSeries || liveSpec.showSettings) {
|
|
88
|
+
padding = 16;
|
|
89
|
+
}
|
|
85
90
|
const SETTINGS_HEIGHT = liveSpec.showSettings ? 30 : 0;
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const
|
|
91
|
+
const seriesChartHeight = liveSpec.showSeries ? Math.min(contentDimensions.height, DEFAULT_SERIES_CHART_HEIGHT) : 0;
|
|
92
|
+
const reservedHeight = contentDimensions.height > LARGE_PANEL_THRESHOLD ? seriesChartHeight + SETTINGS_HEIGHT + padding : 0;
|
|
93
|
+
const availableChartHeight = contentDimensions.height - reservedHeight;
|
|
94
|
+
const tableFlameChartHeight = liveSpec.traceHeight ? Math.max(availableChartHeight, maxDepth * liveSpec.traceHeight) : availableChartHeight;
|
|
95
|
+
let tableChartWidth = contentDimensions.width;
|
|
96
|
+
if (!isMobileSize && liveSpec.showFlameGraph) {
|
|
97
|
+
tableChartWidth = 0.4 * contentDimensions.width;
|
|
98
|
+
}
|
|
99
|
+
let flameChartWidth = contentDimensions.width;
|
|
100
|
+
if (!isMobileSize && liveSpec.showTable) {
|
|
101
|
+
flameChartWidth = 0.6 * contentDimensions.width;
|
|
102
|
+
}
|
|
90
103
|
// TODO (gladorme): allow users to override height (useful for explorer for stack traces with high depth)
|
|
91
|
-
return /*#__PURE__*/
|
|
104
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
92
105
|
height: contentDimensions.height,
|
|
93
106
|
width: contentDimensions.width,
|
|
94
107
|
justifyContent: "center",
|
|
95
108
|
alignItems: "center",
|
|
96
|
-
children:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
109
|
+
children: [
|
|
110
|
+
queryResults.length > 1 && // display a message if there is more than one query
|
|
111
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
112
|
+
sx: {
|
|
113
|
+
...noDataTextStyle
|
|
114
|
+
},
|
|
115
|
+
children: "There is more than one query. Please make sure that you provided only one query."
|
|
116
|
+
}),
|
|
117
|
+
queryResults.length <= 1 && flameChartData && /*#__PURE__*/ _jsxs(Stack, {
|
|
118
|
+
gap: 2,
|
|
119
|
+
sx: {
|
|
120
|
+
overflowY: 'auto',
|
|
121
|
+
scrollbarGutter: 'stable both-edges',
|
|
122
|
+
paddingTop: liveSpec.showSettings || liveSpec.showSeries ? 1 : 0
|
|
123
|
+
},
|
|
124
|
+
children: [
|
|
125
|
+
liveSpec.showSeries && /*#__PURE__*/ _jsx(SeriesChart, {
|
|
126
|
+
width: contentDimensions.width,
|
|
127
|
+
height: seriesChartHeight,
|
|
128
|
+
data: flameChartData.data
|
|
129
|
+
}),
|
|
130
|
+
liveSpec.showSettings && /*#__PURE__*/ _jsx(Settings, {
|
|
131
|
+
onSelectedIdChange: setSelectedId,
|
|
132
|
+
onChangePalette: onChangePalette,
|
|
133
|
+
onDisplayChange: onDisplayChange,
|
|
134
|
+
value: liveSpec,
|
|
135
|
+
selectedId: selectedId
|
|
136
|
+
}),
|
|
137
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
138
|
+
direction: isMobileSize ? 'column' : 'row',
|
|
139
|
+
justifyContent: "center",
|
|
140
|
+
alignItems: isMobileSize ? 'center' : 'top',
|
|
141
|
+
children: [
|
|
142
|
+
liveSpec.showTable && /*#__PURE__*/ _jsx(TableChart, {
|
|
143
|
+
width: tableChartWidth,
|
|
144
|
+
height: tableFlameChartHeight,
|
|
145
|
+
data: flameChartData.data,
|
|
146
|
+
searchValue: searchValue,
|
|
147
|
+
onSearchValueChange: setSearchValue,
|
|
148
|
+
onSelectedIdChange: setSelectedId
|
|
149
|
+
}),
|
|
150
|
+
liveSpec.showFlameGraph && /*#__PURE__*/ _jsx(FlameChart, {
|
|
151
|
+
width: flameChartWidth,
|
|
152
|
+
height: tableFlameChartHeight,
|
|
153
|
+
data: flameChartData.data,
|
|
154
|
+
palette: liveSpec.palette,
|
|
155
|
+
selectedId: selectedId,
|
|
156
|
+
searchValue: searchValue,
|
|
157
|
+
onSelectedIdChange: setSelectedId
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
}),
|
|
163
|
+
queryResults.length <= 1 && !flameChartData && /*#__PURE__*/ _jsx(Typography, {
|
|
164
|
+
sx: {
|
|
165
|
+
...noDataTextStyle
|
|
166
|
+
},
|
|
167
|
+
children: "No data"
|
|
168
|
+
})
|
|
169
|
+
]
|
|
153
170
|
});
|
|
154
171
|
};
|
|
155
172
|
|