@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/FlameChartPanel.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 { TitleComponentOption } from 'echarts';\nimport { useChartsTheme } from '@perses-dev/components';\nimport { Stack, Typography, SxProps, useMediaQuery, useTheme } from '@mui/material';\nimport { FC, useState, useEffect, useMemo } from 'react';\nimport { PanelProps } from '@perses-dev/plugin-system';\nimport { ProfileData, StackTrace } from '@perses-dev/spec';\nimport { FlameChartOptions } from '../flame-chart-model';\nimport { filterStackTraceById, getMaxDepth } from '../utils/data-transform';\nimport { FlameChart } from './FlameChart';\nimport { Settings } from './Settings';\nimport { TableChart } from './TableChart';\nimport { SeriesChart } from './SeriesChart';\n\nconst LARGE_PANEL_THRESHOLD = 600;\nconst DEFAULT_SERIES_CHART_HEIGHT = 200;\n\nexport type FlameChartPanelProps = PanelProps<FlameChartOptions, ProfileData>;\n\nexport const FlameChartPanel: FC<FlameChartPanelProps> = (props) => {\n const { contentDimensions, queryResults, spec } = props;\n\n const isMobileSize = useMediaQuery(useTheme().breakpoints.down('sm'));\n\n // selectedId equals 0 => Flame Graph is not zoomed in\n // selectedId different from 0 => Flame Graph is zoomed in\n const [selectedId, setSelectedId] = useState(0);\n const [searchValue, setSearchValue] = useState('');\n\n // This spec is used to manage settings temporarily\n const [liveSpec, setLiveSpec] = useState<FlameChartOptions>(spec);\n\n // keep liveSpec up to date\n useEffect(() => {\n setLiveSpec(spec);\n setSelectedId(0);\n setSearchValue('');\n }, [spec]);\n\n const chartsTheme = useChartsTheme();\n const flameChartData = useMemo(() => {\n return queryResults[0];\n }, [queryResults]);\n\n const selectedStackTrace: StackTrace | undefined = useMemo(() => {\n if (!flameChartData) return undefined;\n if (!selectedId) return flameChartData.data.profile.stackTrace;\n\n return filterStackTraceById(flameChartData.data.profile.stackTrace, selectedId);\n }, [flameChartData, selectedId]);\n\n const maxDepth: number = useMemo(\n () => (selectedStackTrace ? getMaxDepth(selectedStackTrace) : 0),\n [selectedStackTrace]\n );\n\n const noDataTextStyle = (chartsTheme.noDataOption.title as TitleComponentOption).textStyle as SxProps;\n\n const onChangePalette = (newPalette: 'package-name' | 'value'): void => {\n setLiveSpec((prev) => {\n return { ...prev, palette: newPalette };\n });\n };\n\n const onDisplayChange = (value: 'table' | 'flame-graph' | 'both' | 'none'): void => {\n let showTable = true;\n let showFlameGraph = true;\n if (value === 'table') {\n showFlameGraph = false;\n } else if (value === 'flame-graph') {\n showTable = false;\n }\n setLiveSpec((prev) => {\n return { ...prev, showTable: showTable, showFlameGraph: showFlameGraph };\n });\n };\n\n if (!contentDimensions) return null;\n\n const PADDING =\n liveSpec.showSeries && liveSpec.showSettings ? 32 : liveSpec.showSeries || liveSpec.showSettings ? 16 : 0;\n\n const SETTINGS_HEIGHT = liveSpec.showSettings ? 30 : 0;\n\n const SERIES_CHART_HEIGHT = liveSpec.showSeries\n ? contentDimensions.height < DEFAULT_SERIES_CHART_HEIGHT\n ? contentDimensions.height\n : DEFAULT_SERIES_CHART_HEIGHT\n : 0;\n\n const TABLE_FLAME_CHART_HEIGHT = liveSpec.traceHeight\n ? Math.max(\n contentDimensions.height -\n (contentDimensions.height > LARGE_PANEL_THRESHOLD ? SERIES_CHART_HEIGHT + SETTINGS_HEIGHT + PADDING : 0),\n maxDepth * liveSpec.traceHeight\n )\n : contentDimensions.height -\n (contentDimensions.height > LARGE_PANEL_THRESHOLD ? SERIES_CHART_HEIGHT + SETTINGS_HEIGHT + PADDING : 0);\n\n const TABLE_CHART_WIDTH = isMobileSize\n ? contentDimensions.width\n : liveSpec.showFlameGraph\n ? 0.4 * contentDimensions.width\n : contentDimensions.width;\n\n const FLAME_CHART_WIDTH = isMobileSize\n ? contentDimensions.width\n : liveSpec.showTable\n ? 0.6 * contentDimensions.width\n : contentDimensions.width;\n\n // TODO (gladorme): allow users to override height (useful for explorer for stack traces with high depth)\n return (\n <Stack\n height={contentDimensions.height}\n width={contentDimensions.width}\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n {queryResults.length > 1 ? (\n // display a message if there is more than one query\n <Typography sx={{ ...noDataTextStyle }}>\n There is more than one query. Please make sure that you provided only one query.\n </Typography>\n ) : flameChartData ? (\n <Stack\n gap={2}\n sx={{\n overflowY: 'auto',\n scrollbarGutter: 'stable both-edges',\n paddingTop: liveSpec.showSettings || liveSpec.showSeries ? 1 : 0,\n }}\n >\n {liveSpec.showSeries && (\n <SeriesChart width={contentDimensions.width} height={SERIES_CHART_HEIGHT} data={flameChartData.data} />\n )}\n {liveSpec.showSettings && (\n <Settings\n onSelectedIdChange={setSelectedId}\n onChangePalette={onChangePalette}\n onDisplayChange={onDisplayChange}\n value={liveSpec}\n selectedId={selectedId}\n />\n )}\n <Stack\n direction={isMobileSize ? 'column' : 'row'}\n justifyContent=\"center\"\n alignItems={isMobileSize ? 'center' : 'top'}\n >\n {liveSpec.showTable && (\n <TableChart\n width={TABLE_CHART_WIDTH}\n height={TABLE_FLAME_CHART_HEIGHT}\n data={flameChartData.data}\n searchValue={searchValue}\n onSearchValueChange={setSearchValue}\n onSelectedIdChange={setSelectedId}\n />\n )}\n {liveSpec.showFlameGraph && (\n <FlameChart\n width={FLAME_CHART_WIDTH}\n height={TABLE_FLAME_CHART_HEIGHT}\n data={flameChartData.data}\n palette={liveSpec.palette}\n selectedId={selectedId}\n searchValue={searchValue}\n onSelectedIdChange={setSelectedId}\n />\n )}\n </Stack>\n </Stack>\n ) : (\n <Typography sx={{ ...noDataTextStyle }}>No data</Typography>\n )}\n </Stack>\n );\n};\n"],"names":["useChartsTheme","Stack","Typography","useMediaQuery","useTheme","useState","useEffect","useMemo","filterStackTraceById","getMaxDepth","FlameChart","Settings","TableChart","SeriesChart","LARGE_PANEL_THRESHOLD","DEFAULT_SERIES_CHART_HEIGHT","FlameChartPanel","props","contentDimensions","queryResults","spec","isMobileSize","breakpoints","down","selectedId","setSelectedId","searchValue","setSearchValue","liveSpec","setLiveSpec","chartsTheme","flameChartData","selectedStackTrace","undefined","data","profile","stackTrace","maxDepth","noDataTextStyle","noDataOption","title","textStyle","onChangePalette","newPalette","prev","palette","onDisplayChange","value","showTable","showFlameGraph","PADDING","showSeries","showSettings","SETTINGS_HEIGHT","SERIES_CHART_HEIGHT","height","TABLE_FLAME_CHART_HEIGHT","traceHeight","Math","max","TABLE_CHART_WIDTH","width","FLAME_CHART_WIDTH","justifyContent","alignItems","length","sx","gap","overflowY","scrollbarGutter","paddingTop","onSelectedIdChange","direction","onSearchValueChange"],"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,cAAc,QAAQ,yBAAyB;AACxD,SAASC,KAAK,EAAEC,UAAU,EAAWC,aAAa,EAAEC,QAAQ,QAAQ,gBAAgB;AACpF,SAAaC,QAAQ,EAAEC,SAAS,EAAEC,OAAO,QAAQ,QAAQ;AAIzD,SAASC,oBAAoB,EAAEC,WAAW,QAAQ,0BAA0B;AAC5E,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,WAAW,QAAQ,gBAAgB;AAE5C,MAAMC,wBAAwB;AAC9B,MAAMC,8BAA8B;AAIpC,OAAO,MAAMC,kBAA4C,CAACC;IACxD,MAAM,EAAEC,iBAAiB,EAAEC,YAAY,EAAEC,IAAI,EAAE,GAAGH;IAElD,MAAMI,eAAelB,cAAcC,WAAWkB,WAAW,CAACC,IAAI,CAAC;IAE/D,sDAAsD;IACtD,0DAA0D;IAC1D,MAAM,CAACC,YAAYC,cAAc,GAAGpB,SAAS;IAC7C,MAAM,CAACqB,aAAaC,eAAe,GAAGtB,SAAS;IAE/C,mDAA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;oBACpBiB,iBAAiBA;oBACjBI,iBAAiBA;oBACjBC,OAAOnB;oBACPJ,YAAYA;;8BAGhB,MAACvB;oBACCuE,WAAWnD,eAAe,WAAW;oBACrC0C,gBAAe;oBACfC,YAAY3C,eAAe,WAAW;;wBAErCO,SAASoB,SAAS,kBACjB,KAACpC;4BACCiD,OAAOD;4BACPL,QAAQC;4BACRtB,MAAMH,eAAeG,IAAI;4BACzBR,aAAaA;4BACb+C,qBAAqB9C;4BACrB4C,oBAAoB9C;;wBAGvBG,SAASqB,cAAc,kBACtB,KAACvC;4BACCmD,OAAOC;4BACPP,QAAQC;4BACRtB,MAAMH,eAAeG,IAAI;4BACzBW,SAASjB,SAASiB,OAAO;4BACzBrB,YAAYA;4BACZE,aAAaA;4BACb6C,oBAAoB9C;;;;;2BAM5B,KAACvB;YAAWgE,IAAI;gBAAE,GAAG5B,eAAe;YAAC;sBAAG;;;AAIhD,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/FlameChartPanel.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 type { SxProps } from '@mui/material';\nimport { Stack, Typography, useMediaQuery, useTheme } from '@mui/material';\nimport { useChartsTheme } from '@perses-dev/components';\nimport type { PanelProps } from '@perses-dev/plugin-system';\nimport type { ProfileData, StackTrace } from '@perses-dev/spec';\nimport type { TitleComponentOption } from 'echarts';\nimport type { FC } from 'react';\nimport { useState, useEffect, useMemo } from 'react';\n\nimport type { FlameChartOptions } from '../flame-chart-model';\nimport { filterStackTraceById, getMaxDepth } from '../utils/data-transform';\nimport { FlameChart } from './FlameChart';\nimport { SeriesChart } from './SeriesChart';\nimport { Settings } from './Settings';\nimport { TableChart } from './TableChart';\n\nconst LARGE_PANEL_THRESHOLD = 600;\nconst DEFAULT_SERIES_CHART_HEIGHT = 200;\n\nexport type FlameChartPanelProps = PanelProps<FlameChartOptions, ProfileData>;\n\nexport const FlameChartPanel: FC<FlameChartPanelProps> = (props) => {\n const { contentDimensions, queryResults, spec } = props;\n\n const isMobileSize = useMediaQuery(useTheme().breakpoints.down('sm'));\n\n // selectedId equals 0 => Flame Graph is not zoomed in\n // selectedId different from 0 => Flame Graph is zoomed in\n const [selectedId, setSelectedId] = useState(0);\n const [searchValue, setSearchValue] = useState('');\n\n // This spec is used to manage settings temporarily\n const [liveSpec, setLiveSpec] = useState<FlameChartOptions>(spec);\n\n // keep liveSpec up to date\n useEffect(() => {\n setLiveSpec(spec);\n setSelectedId(0);\n setSearchValue('');\n }, [spec]);\n\n const chartsTheme = useChartsTheme();\n const flameChartData = useMemo(() => {\n return queryResults[0];\n }, [queryResults]);\n\n const selectedStackTrace: StackTrace | undefined = useMemo(() => {\n if (!flameChartData) return undefined;\n if (!selectedId) return flameChartData.data.profile.stackTrace;\n\n return filterStackTraceById(flameChartData.data.profile.stackTrace, selectedId);\n }, [flameChartData, selectedId]);\n\n const maxDepth: number = useMemo(\n () => (selectedStackTrace ? getMaxDepth(selectedStackTrace) : 0),\n [selectedStackTrace],\n );\n\n const noDataTextStyle = (chartsTheme.noDataOption.title as TitleComponentOption).textStyle as SxProps;\n\n const onChangePalette = (newPalette: 'package-name' | 'value'): void => {\n setLiveSpec((prev) => {\n return { ...prev, palette: newPalette };\n });\n };\n\n const onDisplayChange = (value: 'table' | 'flame-graph' | 'both' | 'none'): void => {\n let showTable = true;\n let showFlameGraph = true;\n if (value === 'table') {\n showFlameGraph = false;\n } else if (value === 'flame-graph') {\n showTable = false;\n }\n setLiveSpec((prev) => {\n return { ...prev, showTable: showTable, showFlameGraph: showFlameGraph };\n });\n };\n\n if (!contentDimensions) return null;\n\n let padding = 0;\n if (liveSpec.showSeries && liveSpec.showSettings) {\n padding = 32;\n } else if (liveSpec.showSeries || liveSpec.showSettings) {\n padding = 16;\n }\n\n const SETTINGS_HEIGHT = liveSpec.showSettings ? 30 : 0;\n\n const seriesChartHeight = liveSpec.showSeries ? Math.min(contentDimensions.height, DEFAULT_SERIES_CHART_HEIGHT) : 0;\n\n const reservedHeight =\n contentDimensions.height > LARGE_PANEL_THRESHOLD ? seriesChartHeight + SETTINGS_HEIGHT + padding : 0;\n const availableChartHeight = contentDimensions.height - reservedHeight;\n const tableFlameChartHeight = liveSpec.traceHeight\n ? Math.max(availableChartHeight, maxDepth * liveSpec.traceHeight)\n : availableChartHeight;\n\n let tableChartWidth = contentDimensions.width;\n if (!isMobileSize && liveSpec.showFlameGraph) {\n tableChartWidth = 0.4 * contentDimensions.width;\n }\n\n let flameChartWidth = contentDimensions.width;\n if (!isMobileSize && liveSpec.showTable) {\n flameChartWidth = 0.6 * contentDimensions.width;\n }\n\n // TODO (gladorme): allow users to override height (useful for explorer for stack traces with high depth)\n return (\n <Stack\n height={contentDimensions.height}\n width={contentDimensions.width}\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n {queryResults.length > 1 && (\n // display a message if there is more than one query\n <Typography sx={{ ...noDataTextStyle }}>\n There is more than one query. Please make sure that you provided only one query.\n </Typography>\n )}\n {queryResults.length <= 1 && flameChartData && (\n <Stack\n gap={2}\n sx={{\n overflowY: 'auto',\n scrollbarGutter: 'stable both-edges',\n paddingTop: liveSpec.showSettings || liveSpec.showSeries ? 1 : 0,\n }}\n >\n {liveSpec.showSeries && (\n <SeriesChart width={contentDimensions.width} height={seriesChartHeight} data={flameChartData.data} />\n )}\n {liveSpec.showSettings && (\n <Settings\n onSelectedIdChange={setSelectedId}\n onChangePalette={onChangePalette}\n onDisplayChange={onDisplayChange}\n value={liveSpec}\n selectedId={selectedId}\n />\n )}\n <Stack\n direction={isMobileSize ? 'column' : 'row'}\n justifyContent=\"center\"\n alignItems={isMobileSize ? 'center' : 'top'}\n >\n {liveSpec.showTable && (\n <TableChart\n width={tableChartWidth}\n height={tableFlameChartHeight}\n data={flameChartData.data}\n searchValue={searchValue}\n onSearchValueChange={setSearchValue}\n onSelectedIdChange={setSelectedId}\n />\n )}\n {liveSpec.showFlameGraph && (\n <FlameChart\n width={flameChartWidth}\n height={tableFlameChartHeight}\n data={flameChartData.data}\n palette={liveSpec.palette}\n selectedId={selectedId}\n searchValue={searchValue}\n onSelectedIdChange={setSelectedId}\n />\n )}\n </Stack>\n </Stack>\n )}\n {queryResults.length <= 1 && !flameChartData && <Typography sx={{ ...noDataTextStyle }}>No data</Typography>}\n </Stack>\n );\n};\n"],"names":["Stack","Typography","useMediaQuery","useTheme","useChartsTheme","useState","useEffect","useMemo","filterStackTraceById","getMaxDepth","FlameChart","SeriesChart","Settings","TableChart","LARGE_PANEL_THRESHOLD","DEFAULT_SERIES_CHART_HEIGHT","FlameChartPanel","props","contentDimensions","queryResults","spec","isMobileSize","breakpoints","down","selectedId","setSelectedId","searchValue","setSearchValue","liveSpec","setLiveSpec","chartsTheme","flameChartData","selectedStackTrace","undefined","data","profile","stackTrace","maxDepth","noDataTextStyle","noDataOption","title","textStyle","onChangePalette","newPalette","prev","palette","onDisplayChange","value","showTable","showFlameGraph","padding","showSeries","showSettings","SETTINGS_HEIGHT","seriesChartHeight","Math","min","height","reservedHeight","availableChartHeight","tableFlameChartHeight","traceHeight","max","tableChartWidth","width","flameChartWidth","justifyContent","alignItems","length","sx","gap","overflowY","scrollbarGutter","paddingTop","onSelectedIdChange","direction","onSearchValueChange"],"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,KAAK,EAAEC,UAAU,EAAEC,aAAa,EAAEC,QAA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IAAI;oBAAE,GAAG/B,eAAe;gBAAC;0BAAG;;;;AAG9F,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaletteSelector.d.ts","sourceRoot":"","sources":["../../../src/components/PaletteSelector.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PaletteSelector.d.ts","sourceRoot":"","sources":["../../../src/components/PaletteSelector.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1C,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,OAAO,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,KAAsB,EAAE,EAAE,oBAAoB,GAAG,YAAY,CAmBxG"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } 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,8 +11,7 @@
|
|
|
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 { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';
|
|
14
|
+
import { OptionsEditorControl, SettingsAutocomplete } from "@perses-dev/components";
|
|
15
15
|
const PALETTE_OPTIONS = [
|
|
16
16
|
{
|
|
17
17
|
id: 'package-name',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PaletteSelector.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/PaletteSelector.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 { OptionsEditorControl, SettingsAutocomplete } from '@perses-dev/components';\nimport type { ReactElement } from 'react';\n\nconst PALETTE_OPTIONS: Array<{ id: PaletteOption; label: string }> = [\n { id: 'package-name', label: 'By Package Name' },\n { id: 'value', label: 'By Value' },\n];\n\nexport type PaletteOption = 'package-name' | 'value';\n\nexport interface PaletteSelectorProps {\n onChange: (palette: PaletteOption) => void;\n value?: PaletteOption;\n}\n\nexport function PaletteSelector({ onChange, value = 'package-name' }: PaletteSelectorProps): ReactElement {\n const handlePaletteChange = (_: unknown, { id }: { id: PaletteOption }): void => {\n onChange(id);\n };\n\n return (\n <OptionsEditorControl\n label=\"Palette\"\n control={\n <SettingsAutocomplete\n value={PALETTE_OPTIONS.find((o) => o.id === value)}\n options={PALETTE_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handlePaletteChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","PALETTE_OPTIONS","id","label","PaletteSelector","onChange","value","handlePaletteChange","_","control","find","o","options","getOptionLabel","disableClearable"],"mappings":";AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,oBAAoB,EAAEC,oBAAoB,QAAQ,yBAAyB;AAGpF,MAAMC,kBAA+D;IACnE;QAAEC,IAAI;QAAgBC,OAAO;IAAkB;IAC/C;QAAED,IAAI;QAASC,OAAO;IAAW;CAClC;AASD,OAAO,SAASC,gBAAgB,EAAEC,QAAQ,EAAEC,QAAQ,cAAc,EAAwB;IACxF,MAAMC,sBAAsB,CAACC,GAAY,EAAEN,EAAE,EAAyB;QACpEG,SAASH;IACX;IAEA,qBACE,KAACH;QACCI,OAAM;QACNM,uBACE,KAACT;YACCM,OAAOL,gBAAgBS,IAAI,CAAC,CAACC,IAAMA,EAAET,EAAE,KAAKI;YAC5CM,SAASX;YACTY,gBAAgB,CAACF,IAAMA,EAAER,KAAK;YAC9BE,UAAUE;YACVO,gBAAgB;;;AAK1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../../src/components/SearchBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../../src/components/SearchBar.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,CA2B7D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } 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,9 +11,8 @@
|
|
|
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 Magnify from 'mdi-material-ui/Magnify';
|
|
14
|
+
import { TextField, InputAdornment, Chip } from "@mui/material";
|
|
15
|
+
import Magnify from "mdi-material-ui/Magnify";
|
|
16
16
|
export function SearchBar(props) {
|
|
17
17
|
const { searchValue, onSearchValueChange } = props;
|
|
18
18
|
return /*#__PURE__*/ _jsx(TextField, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/SearchBar.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/SearchBar.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 { TextField, InputAdornment, Chip } from '@mui/material';\nimport Magnify from 'mdi-material-ui/Magnify';\nimport type { ReactElement } from 'react';\n\nexport interface SearchBarProps {\n searchValue: string;\n onSearchValueChange: (value: string) => void;\n}\n\nexport function SearchBar(props: SearchBarProps): ReactElement {\n const { searchValue, onSearchValueChange } = props;\n\n return (\n <TextField\n size=\"small\"\n variant=\"outlined\"\n placeholder=\"Search...\"\n fullWidth\n value={searchValue}\n onChange={(event) => onSearchValueChange(event.target.value)}\n slotProps={{\n input: {\n startAdornment: (\n <InputAdornment position=\"start\">\n <Magnify fontSize=\"small\" />\n </InputAdornment>\n ),\n endAdornment: searchValue !== '' && (\n <InputAdornment position=\"end\">\n <Chip label=\"Clear\" size=\"small\" onClick={() => onSearchValueChange('')} />\n </InputAdornment>\n ),\n },\n }}\n />\n );\n}\n"],"names":["TextField","InputAdornment","Chip","Magnify","SearchBar","props","searchValue","onSearchValueChange","size","variant","placeholder","fullWidth","value","onChange","event","target","slotProps","input","startAdornment","position","fontSize","endAdornment","label","onClick"],"mappings":";AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,SAAS,EAAEC,cAAc,EAAEC,IAAI,QAAQ,gBAAgB;AAChE,OAAOC,aAAa,0BAA0B;AAQ9C,OAAO,SAASC,UAAUC,KAAqB;IAC7C,MAAM,EAAEC,WAAW,EAAEC,mBAAmB,EAAE,GAAGF;IAE7C,qBACE,KAACL;QACCQ,MAAK;QACLC,SAAQ;QACRC,aAAY;QACZC,SAAS;QACTC,OAAON;QACPO,UAAU,CAACC,QAAUP,oBAAoBO,MAAMC,MAAM,CAACH,KAAK;QAC3DI,WAAW;YACTC,OAAO;gBACLC,8BACE,KAACjB;oBAAekB,UAAS;8BACvB,cAAA,KAAChB;wBAAQiB,UAAS;;;gBAGtBC,cAAcf,gBAAgB,oBAC5B,KAACL;oBAAekB,UAAS;8BACvB,cAAA,KAACjB;wBAAKoB,OAAM;wBAAQd,MAAK;wBAAQe,SAAS,IAAMhB,oBAAoB;;;YAG1E;QACF;;AAGN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SeriesChart.d.ts","sourceRoot":"","sources":["../../../src/components/SeriesChart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SeriesChart.d.ts","sourceRoot":"","sources":["../../../src/components/SeriesChart.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,kBAAkB,CAAC;AAO9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAU1C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,CAgKjE"}
|
|
@@ -11,12 +11,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND | either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { formatItemValue } from
|
|
19
|
-
import { getSeriesTooltip } from
|
|
14
|
+
import { Stack, useTheme } from "@mui/material";
|
|
15
|
+
import { useChartsTheme, EChart, enableDataZoom } from "@perses-dev/components";
|
|
16
|
+
import { useTimeRange } from "@perses-dev/plugin-system";
|
|
17
|
+
import { useMemo, useRef } from "react";
|
|
18
|
+
import { formatItemValue } from "../utils/format.js";
|
|
19
|
+
import { getSeriesTooltip } from "../utils/series-tooltip.js";
|
|
20
20
|
const LINE_WIDTH = 1.25;
|
|
21
21
|
const POINT_SIZE_OFFSET = 2;
|
|
22
22
|
export function SeriesChart(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/SeriesChart.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 { ReactElement, useMemo, useRef } from 'react';\nimport { Stack, useTheme } from '@mui/material';\nimport { useChartsTheme, EChart, ZoomEventData, OnEventsType, enableDataZoom } from '@perses-dev/components';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport type { EChartsCoreOption, LineSeriesOption } from 'echarts';\nimport { ECharts as EChartsInstance } from 'echarts/core';\nimport { CallbackDataParams } from 'echarts/types/dist/shared';\nimport { ProfileData, Timeline } from '@perses-dev/spec';\nimport { formatItemValue } from '../utils/format';\nimport { getSeriesTooltip } from '../utils/series-tooltip';\nimport { SeriesSample } from '../utils/data-model';\n\nconst LINE_WIDTH = 1.25;\nconst POINT_SIZE_OFFSET = 2;\n\nexport interface SeriesChartProps {\n width: number;\n height: number;\n data: ProfileData;\n}\n\nexport function SeriesChart(props: SeriesChartProps): ReactElement {\n const { width, height, data } = props;\n\n const chartsTheme = useChartsTheme();\n const theme = useTheme();\n const { setTimeRange } = useTimeRange();\n const chartRef = useRef<EChartsInstance>();\n\n const handleEvents: OnEventsType<LineSeriesOption['data'] | unknown> = useMemo(() => {\n return {\n datazoom: (params): void => {\n if (params.batch[0] === undefined) return;\n const xAxisStartValue = params.batch?.[0]?.startValue;\n const xAxisEndValue = params.batch?.[0]?.endValue;\n if (xAxisStartValue !== undefined && xAxisEndValue !== undefined) {\n const zoomEvent: ZoomEventData = {\n start: xAxisStartValue,\n end: xAxisEndValue,\n };\n setTimeRange({ start: new Date(zoomEvent.start), end: new Date(zoomEvent.end) });\n }\n },\n finished: (): void => {\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n },\n };\n }, [setTimeRange]);\n\n const seriesData: SeriesSample[] = useMemo(() => {\n const timeLine: Timeline = data.timeline || ({} as Timeline);\n const startTime = timeLine.startTime;\n const durationDelta = timeLine.durationDelta;\n return timeLine.samples.map((sample, index) => ({\n id: index,\n value: [(startTime + index * durationDelta) * 1000, Number(sample)],\n }));\n }, [data.timeline]);\n\n const option: EChartsCoreOption = useMemo(() => {\n const seriesMapping = {\n type: 'line',\n color: theme.palette.primary.main,\n sampling: 'lttb',\n showSymbol: true,\n showAllSymbol: true,\n symbolSize: LINE_WIDTH + POINT_SIZE_OFFSET,\n lineStyle: {\n width: LINE_WIDTH,\n opacity: 0.95,\n },\n areaStyle: {\n opacity: 0,\n },\n data: seriesData,\n };\n\n const timeLine: Timeline = data.timeline || ({} as Timeline);\n\n const option: EChartsCoreOption = {\n series: seriesMapping,\n xAxis: {\n type: 'time',\n min: timeLine.startTime * 1000,\n max: (timeLine.startTime + timeLine.samples.length * timeLine.durationDelta) * 1000,\n axisLabel: {\n hideOverlap: true,\n },\n axisPointer: {\n snap: false, // important so shared crosshair does not lag\n },\n },\n yAxis: {\n type: 'value',\n axisLabel: {\n formatter: (value: number) => {\n return formatItemValue(data.metadata?.units, value);\n },\n },\n },\n animation: false,\n tooltip: {\n show: true,\n showContent: true,\n trigger: 'axis',\n appendToBody: true,\n confine: true,\n backgroundColor: theme.palette.background.paper,\n borderColor: theme.palette.background.paper,\n textStyle: {\n color: theme.palette.text.primary,\n },\n formatter: (params: CallbackDataParams[]) =>\n getSeriesTooltip(\n (params[0]?.data as SeriesSample) || {},\n data.metadata?.units || '',\n data.metadata?.name || '',\n theme.palette.primary.main,\n theme.palette.divider\n ),\n },\n axisPointer: {\n type: 'line',\n z: 0, // ensure point symbol shows on top of dashed line\n triggerEmphasis: true,\n triggerTooltip: false,\n snap: false,\n },\n toolbox: {\n feature: {\n dataZoom: {\n icon: null,\n yAxisIndex: 'none',\n },\n },\n },\n grid: {\n left: 10,\n right: 10,\n top: 10,\n bottom: 10,\n },\n };\n\n return option;\n }, [data.timeline, data.metadata, seriesData, theme]);\n\n const seriesChart = useMemo(\n () => (\n <EChart\n style={{\n width: width,\n height: height,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n onEvents={handleEvents}\n _instance={chartRef}\n />\n ),\n [chartsTheme.echartsTheme, height, option, width, handleEvents]\n );\n\n return (\n <Stack\n width={width}\n height={height}\n alignItems=\"center\"\n justifyContent=\"center\"\n onMouseEnter={() => {\n // This is necessary to ensure that the data zoom feature is enabled after the theme is changed.\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n }}\n >\n {seriesChart}\n </Stack>\n );\n}\n"],"names":["useMemo","useRef","Stack","useTheme","useChartsTheme","EChart","enableDataZoom","useTimeRange","formatItemValue","getSeriesTooltip","LINE_WIDTH","POINT_SIZE_OFFSET","SeriesChart","props","width","height","data","chartsTheme","theme","setTimeRange","chartRef","handleEvents","datazoom","params","batch","undefined","xAxisStartValue","startValue","xAxisEndValue","endValue","zoomEvent","start","end","Date","finished","current","seriesData","timeLine","timeline","startTime","durationDelta","samples","map","sample","index","id","value","Number","option","seriesMapping","type","color","palette","primary","main","sampling","showSymbol","showAllSymbol","symbolSize","lineStyle","opacity","areaStyle","series","xAxis","min","max","length","axisLabel","hideOverlap","axisPointer","snap","yAxis","formatter","metadata","units","animation","tooltip","show","showContent","trigger","appendToBody","confine","backgroundColor","background","paper","borderColor","textStyle","text","name","divider","z","triggerEmphasis","triggerTooltip","toolbox","feature","dataZoom","icon","yAxisIndex","grid","left","right","top","bottom","seriesChart","style","echartsTheme","onEvents","_instance","alignItems","justifyContent","onMouseEnter"],"mappings":";AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AAC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,CAACC,KAAK;gBAC3CE,WAAW;oBACTnC,OAAOjC,MAAMkC,OAAO,CAACmC,IAAI,CAAClC,OAAO;gBACnC;gBACAmB,WAAW,CAACjD,SACVd,iBACE,AAACc,MAAM,CAAC,EAAE,EAAEP,QAAyB,CAAC,GACtCA,KAAKyD,QAAQ,EAAEC,SAAS,IACxB1D,KAAKyD,QAAQ,EAAEe,QAAQ,IACvBtE,MAAMkC,OAAO,CAACC,OAAO,CAACC,IAAI,EAC1BpC,MAAMkC,OAAO,CAACqC,OAAO;YAE3B;YACApB,aAAa;gBACXnB,MAAM;gBACNwC,GAAG;gBACHC,iBAAiB;gBACjBC,gBAAgB;gBAChBtB,MAAM;YACR;YACAuB,SAAS;gBACPC,SAAS;oBACPC,UAAU;wBACRC,MAAM;wBACNC,YAAY;oBACd;gBACF;YACF;YACAC,MAAM;gBACJC,MAAM;gBACNC,OAAO;gBACPC,KAAK;gBACLC,QAAQ;YACV;QACF;QAEA,OAAOtD;IACT,GAAG;QAAChC,KAAKsB,QAAQ;QAAEtB,KAAKyD,QAAQ;QAAErC;QAAYlB;KAAM;IAEpD,MAAMqF,cAAcvG,QAClB,kBACE,KAACK;YACCmG,OAAO;gBACL1F,OAAOA;gBACPC,QAAQA;YACV;YACAiC,QAAQA;YACR9B,OAAOD,YAAYwF,YAAY;YAC/BC,UAAUrF;YACVsF,WAAWvF;YAGf;QAACH,YAAYwF,YAAY;QAAE1F;QAAQiC;QAAQlC;QAAOO;KAAa;IAGjE,qBACE,KAACnB;QACCY,OAAOA;QACPC,QAAQA;QACR6F,YAAW;QACXC,gBAAe;QACfC,cAAc;YACZ,gGAAgG;YAChG,IAAI1F,SAASe,OAAO,KAAKV,WAAW;gBAClCnB,eAAec,SAASe,OAAO;YACjC;QACF;kBAECoE;;AAGP"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SeriesChart.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, useTheme } from '@mui/material';\nimport type { ZoomEventData, OnEventsType } from '@perses-dev/components';\nimport { useChartsTheme, EChart, enableDataZoom } from '@perses-dev/components';\nimport { useTimeRange } from '@perses-dev/plugin-system';\nimport type { ProfileData, Timeline } from '@perses-dev/spec';\nimport type {\n DefaultLabelFormatterCallbackParams as CallbackDataParams,\n EChartsCoreOption,\n LineSeriesOption,\n} from 'echarts';\nimport type { ECharts as EChartsInstance } from 'echarts/core';\nimport type { ReactElement } from 'react';\nimport { useMemo, useRef } from 'react';\n\nimport type { SeriesSample } from '../utils/data-model';\nimport { formatItemValue } from '../utils/format';\nimport { getSeriesTooltip } from '../utils/series-tooltip';\n\nconst LINE_WIDTH = 1.25;\nconst POINT_SIZE_OFFSET = 2;\n\nexport interface SeriesChartProps {\n width: number;\n height: number;\n data: ProfileData;\n}\n\nexport function SeriesChart(props: SeriesChartProps): ReactElement {\n const { width, height, data } = props;\n\n const chartsTheme = useChartsTheme();\n const theme = useTheme();\n const { setTimeRange } = useTimeRange();\n const chartRef = useRef<EChartsInstance>();\n\n const handleEvents: OnEventsType<LineSeriesOption['data'] | unknown> = useMemo(() => {\n return {\n datazoom: (params): void => {\n if (params.batch[0] === undefined) return;\n const xAxisStartValue = params.batch?.[0]?.startValue;\n const xAxisEndValue = params.batch?.[0]?.endValue;\n if (xAxisStartValue !== undefined && xAxisEndValue !== undefined) {\n const zoomEvent: ZoomEventData = {\n start: xAxisStartValue,\n end: xAxisEndValue,\n };\n setTimeRange({ start: new Date(zoomEvent.start), end: new Date(zoomEvent.end) });\n }\n },\n finished: (): void => {\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n },\n };\n }, [setTimeRange]);\n\n const seriesData: SeriesSample[] = useMemo(() => {\n const timeLine: Timeline = data.timeline || ({} as Timeline);\n const startTime = timeLine.startTime;\n const durationDelta = timeLine.durationDelta;\n return timeLine.samples.map((sample, index) => ({\n id: index,\n value: [(startTime + index * durationDelta) * 1000, Number(sample)],\n }));\n }, [data.timeline]);\n\n const option: EChartsCoreOption = useMemo(() => {\n const seriesMapping = {\n type: 'line',\n color: theme.palette.primary.main,\n sampling: 'lttb',\n showSymbol: true,\n showAllSymbol: true,\n symbolSize: LINE_WIDTH + POINT_SIZE_OFFSET,\n lineStyle: {\n width: LINE_WIDTH,\n opacity: 0.95,\n },\n areaStyle: {\n opacity: 0,\n },\n data: seriesData,\n };\n\n const timeLine: Timeline = data.timeline || ({} as Timeline);\n\n const option: EChartsCoreOption = {\n series: seriesMapping,\n xAxis: {\n type: 'time',\n min: timeLine.startTime * 1000,\n max: (timeLine.startTime + timeLine.samples.length * timeLine.durationDelta) * 1000,\n axisLabel: {\n hideOverlap: true,\n },\n axisPointer: {\n snap: false, // important so shared crosshair does not lag\n },\n },\n yAxis: {\n type: 'value',\n axisLabel: {\n formatter: (value: number) => {\n return formatItemValue(data.metadata?.units, value);\n },\n },\n },\n animation: false,\n tooltip: {\n show: true,\n showContent: true,\n trigger: 'axis',\n appendToBody: true,\n confine: true,\n backgroundColor: theme.palette.background.paper,\n borderColor: theme.palette.background.paper,\n textStyle: {\n color: theme.palette.text.primary,\n },\n formatter: (params: CallbackDataParams[]) =>\n getSeriesTooltip(\n (params[0]?.data as SeriesSample) || {},\n data.metadata?.units || '',\n data.metadata?.name || '',\n theme.palette.primary.main,\n theme.palette.divider,\n ),\n },\n axisPointer: {\n type: 'line',\n z: 0, // ensure point symbol shows on top of dashed line\n triggerEmphasis: true,\n triggerTooltip: false,\n snap: false,\n },\n toolbox: {\n feature: {\n dataZoom: {\n icon: null,\n yAxisIndex: 'none',\n },\n },\n },\n grid: {\n left: 10,\n right: 10,\n top: 10,\n bottom: 10,\n },\n };\n\n return option;\n }, [data.timeline, data.metadata, seriesData, theme]);\n\n const seriesChart = useMemo(\n () => (\n <EChart\n style={{\n width: width,\n height: height,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n onEvents={handleEvents}\n _instance={chartRef}\n />\n ),\n [chartsTheme.echartsTheme, height, option, width, handleEvents],\n );\n\n return (\n <Stack\n width={width}\n height={height}\n alignItems=\"center\"\n justifyContent=\"center\"\n onMouseEnter={() => {\n // This is necessary to ensure that the data zoom feature is enabled after the theme is changed.\n if (chartRef.current !== undefined) {\n enableDataZoom(chartRef.current);\n }\n }}\n >\n {seriesChart}\n </Stack>\n );\n}\n"],"names":["Stack","useTheme","useChartsTheme","EChart","enableDataZoom","useTimeRange","useMemo","useRef","formatItemValue","getSeriesTooltip","LINE_WIDTH","POINT_SIZE_OFFSET","SeriesChart","props","width","height","data","chartsTheme","theme","setTimeRange","chartRef","handleEvents","datazoom","params","batch","undefined","xAxisStartValue","startValue","xAxisEndValue","endValue","zoomEvent","start","end","Date","finished","current","seriesData","timeLine","timeline","startTime","durationDelta","samples","map","sample","index","id","value","Number","option","seriesMapping","type","color","palette","primary","main","sampling","showSymbol","showAllSymbol","symbolSize","lineStyle","opacity","areaStyle","series","xAxis","min","max","length","axisLabel","hideOverlap","axisPointer","snap","yAxis","formatter","metadata","units","animation","tooltip","show","showContent","trigger","appendToBody","confine","backgroundColor","background","paper","borderColor","textStyle","text","name","divider","z","triggerEmphasis","triggerTooltip","toolbox","feature","dataZoom","icon","yAxisIndex","grid","left","right","top","bottom","seriesChart","style","echartsTheme","onEvents","_instance","alignItems","justifyContent","onMouseEnter"],"mappings":";AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,E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OAAO;gBACnC;gBACAmB,WAAW,CAACjD,SACVd,iBACE,AAACc,MAAM,CAAC,EAAE,EAAEP,QAAyB,CAAC,GACtCA,KAAKyD,QAAQ,EAAEC,SAAS,IACxB1D,KAAKyD,QAAQ,EAAEe,QAAQ,IACvBtE,MAAMkC,OAAO,CAACC,OAAO,CAACC,IAAI,EAC1BpC,MAAMkC,OAAO,CAACqC,OAAO;YAE3B;YACApB,aAAa;gBACXnB,MAAM;gBACNwC,GAAG;gBACHC,iBAAiB;gBACjBC,gBAAgB;gBAChBtB,MAAM;YACR;YACAuB,SAAS;gBACPC,SAAS;oBACPC,UAAU;wBACRC,MAAM;wBACNC,YAAY;oBACd;gBACF;YACF;YACAC,MAAM;gBACJC,MAAM;gBACNC,OAAO;gBACPC,KAAK;gBACLC,QAAQ;YACV;QACF;QAEA,OAAOtD;IACT,GAAG;QAAChC,KAAKsB,QAAQ;QAAEtB,KAAKyD,QAAQ;QAAErC;QAAYlB;KAAM;IAEpD,MAAMqF,cAAcjG,QAClB,kBACE,KAACH;YACCqG,OAAO;gBACL1F,OAAOA;gBACPC,QAAQA;YACV;YACAiC,QAAQA;YACR9B,OAAOD,YAAYwF,YAAY;YAC/BC,UAAUrF;YACVsF,WAAWvF;YAGf;QAACH,YAAYwF,YAAY;QAAE1F;QAAQiC;QAAQlC;QAAOO;KAAa;IAGjE,qBACE,KAACrB;QACCc,OAAOA;QACPC,QAAQA;QACR6F,YAAW;QACXC,gBAAe;QACfC,cAAc;YACZ,gGAAgG;YAChG,IAAI1F,SAASe,OAAO,KAAKV,WAAW;gBAClCrB,eAAegB,SAASe,OAAO;YACjC;QACF;kBAECoE;;AAGP"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { FlameChartOptions } from '../flame-chart-model';
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { FlameChartOptions } from '../flame-chart-model';
|
|
3
3
|
export interface SettingsProps {
|
|
4
4
|
value: FlameChartOptions;
|
|
5
5
|
selectedId: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../../src/components/Settings.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../../src/components/Settings.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,iBAAiB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,KAAK,IAAI,CAAC;IAC7D,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,MAAM,KAAK,IAAI,CAAC;CACpE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CA0J3D"}
|
|
@@ -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 {
|
|
15
|
-
import
|
|
16
|
-
import PaletteIcon from
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import { TOOLTIP_TEXT } from
|
|
14
|
+
import { Stack, Button, useTheme, MenuItem, Menu, Fade } from "@mui/material";
|
|
15
|
+
import { ToolbarIconButton, InfoTooltip } from "@perses-dev/components";
|
|
16
|
+
import PaletteIcon from "mdi-material-ui/Palette";
|
|
17
|
+
import RefreshIcon from "mdi-material-ui/Refresh";
|
|
18
|
+
import { useState, useMemo } from "react";
|
|
19
|
+
import { TOOLTIP_TEXT } from "../utils/ui-text.js";
|
|
20
20
|
export function Settings(props) {
|
|
21
21
|
const { value, selectedId, onSelectedIdChange, onChangePalette, onDisplayChange } = props;
|
|
22
22
|
const theme = useTheme();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Settings.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 { ReactElement, useState, useMemo } from 'react';\nimport RefreshIcon from 'mdi-material-ui/Refresh';\nimport PaletteIcon from 'mdi-material-ui/Palette';\nimport { Stack, Button, useTheme, MenuItem, Menu, Fade } from '@mui/material';\nimport { ToolbarIconButton, InfoTooltip } from '@perses-dev/components';\nimport { TOOLTIP_TEXT } from '../utils/ui-text';\nimport { FlameChartOptions } from '../flame-chart-model';\n\nexport interface SettingsProps {\n value: FlameChartOptions;\n selectedId: number;\n onChangePalette: (palette: 'package-name' | 'value') => void;\n onSelectedIdChange: (newId: number) => void;\n onDisplayChange: (value: 'table' | 'flame-graph' | 'both') => void;\n}\n\nexport function Settings(props: SettingsProps): ReactElement {\n const { value, selectedId, onSelectedIdChange, onChangePalette, onDisplayChange } = props;\n const theme = useTheme();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n const open = Boolean(anchorEl);\n\n const customButtonStyle = {\n fontSize: '12px',\n padding: '2px 6px',\n minWidth: 'auto',\n };\n\n const handleChangeColorShemeClick = (event: React.MouseEvent<HTMLElement>): void => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleByPackageNameClick = (): void => {\n onChangePalette('package-name');\n handleClose();\n };\n\n const handleByValueClick = (): void => {\n onChangePalette('value');\n handleClose();\n };\n\n const handleClose = (): void => {\n setAnchorEl(null);\n };\n\n const isTableSelected = (): boolean => selectedView === 'table';\n const isFlameGraphSelected = (): boolean => selectedView === 'flame-graph';\n const isBothSelected = (): boolean => selectedView === 'both';\n\n // Update selected view based on the value of showTable and showFlameGraph\n const selectedView: 'table' | 'flame-graph' | 'both' | 'none' = useMemo(() => {\n if (!value.showTable && !value.showFlameGraph) {\n return 'none';\n } else if (value.showTable && value.showFlameGraph) {\n return 'both';\n } else if (value.showTable) {\n return 'table';\n } else {\n return 'flame-graph';\n }\n }, [value.showTable, value.showFlameGraph]);\n\n return (\n <Stack spacing=\"10px\" direction=\"row\" justifyContent=\"center\" alignItems=\"center\">\n {selectedId !== 0 && (\n <InfoTooltip description={TOOLTIP_TEXT.resetFlameGraph}>\n <ToolbarIconButton\n aria-label={TOOLTIP_TEXT.resetFlameGraph}\n onClick={() => onSelectedIdChange(0)}\n color=\"primary\"\n >\n <RefreshIcon fontSize=\"small\" />\n </ToolbarIconButton>\n </InfoTooltip>\n )}\n <Stack>\n <InfoTooltip description={TOOLTIP_TEXT.changeColorSheme}>\n <ToolbarIconButton\n id=\"change-color-sheme-button\"\n aria-label={TOOLTIP_TEXT.changeColorSheme}\n aria-controls={open ? 'change-color-sheme-menu' : undefined}\n aria-haspopup=\"true\"\n aria-expanded={open ? 'true' : undefined}\n onClick={handleChangeColorShemeClick}\n color=\"primary\"\n >\n <PaletteIcon fontSize=\"small\" />\n </ToolbarIconButton>\n </InfoTooltip>\n <Menu\n id=\"change-color-sheme-menu\"\n slotProps={{\n list: { 'aria-labelledby': 'change-color-sheme-button' },\n }}\n anchorEl={anchorEl}\n open={open}\n onClose={handleClose}\n slots={{ transition: Fade }}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'center',\n }}\n sx={{\n mt: 1,\n '& .MuiPaper-root': {\n backgroundColor: theme.palette.background.paper,\n padding: '0 5px',\n },\n '& .MuiMenuItem-root:hover': {\n backgroundColor: theme.palette.action.hover,\n },\n }}\n >\n <MenuItem onClick={handleByPackageNameClick} selected={value.palette === 'package-name'}>\n By package name\n </MenuItem>\n <MenuItem onClick={handleByValueClick} selected={value.palette === 'value'}>\n By value\n </MenuItem>\n </Menu>\n </Stack>\n <Stack\n direction=\"row\"\n sx={{\n border: `1px solid ${theme.palette.primary.main}`,\n borderRadius: `${theme.shape.borderRadius}px`,\n padding: '2px',\n }}\n >\n <InfoTooltip description={TOOLTIP_TEXT.showTable}>\n <Button\n variant={isTableSelected() ? 'contained' : 'text'}\n color=\"primary\"\n size=\"small\"\n onClick={() => onDisplayChange('table')}\n sx={customButtonStyle}\n >\n Table\n </Button>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.showFlameGraph}>\n <Button\n variant={isFlameGraphSelected() ? 'contained' : 'text'}\n color=\"primary\"\n size=\"small\"\n onClick={() => onDisplayChange('flame-graph')}\n sx={customButtonStyle}\n >\n Flame Graph\n </Button>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.showBoth}>\n <Button\n variant={isBothSelected() ? 'contained' : 'text'}\n color=\"primary\"\n size=\"small\"\n onClick={() => onDisplayChange('both')}\n sx={customButtonStyle}\n >\n Both\n </Button>\n </InfoTooltip>\n </Stack>\n </Stack>\n );\n}\n"],"names":["useState","useMemo","RefreshIcon","PaletteIcon","Stack","Button","useTheme","MenuItem","Menu","Fade","ToolbarIconButton","InfoTooltip","TOOLTIP_TEXT","Settings","props","value","selectedId","onSelectedIdChange","onChangePalette","onDisplayChange","theme","anchorEl","setAnchorEl","open","Boolean","customButtonStyle","fontSize","padding","minWidth","handleChangeColorShemeClick","event","currentTarget","handleByPackageNameClick","handleClose","handleByValueClick","isTableSelected","selectedView","isFlameGraphSelected","isBothSelected","showTable","showFlameGraph","spacing","direction","justifyContent","alignItems","description","resetFlameGraph","aria-label","onClick","color","changeColorSheme","id","aria-controls","undefined","aria-haspopup","aria-expanded","slotProps","list","onClose","slots","transition","anchorOrigin","vertical","horizontal","transformOrigin","sx","mt","backgroundColor","palette","background","paper","action","hover","selected","border","primary","main","borderRadius","shape","variant","size","showBoth"],"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,SAAuBA,QAAQ,EAAEC,OAAO,QAAQ,QAAQ;AACxD,OAAOC,iBAAiB,0BAA0B;AAClD,OAAOC,iBAAiB,0BAA0B;AAClD,SAASC,KAAK,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,IAAI,QAAQ,gBAAgB;AAC9E,SAASC,iBAAiB,EAAEC,WAAW,QAAQ,yBAAyB;AACxE,SAASC,YAAY,QAAQ,mBAAmB;AAWhD,OAAO,SAASC,SAASC,KAAoB;IAC3C,MAAM,EAAEC,KAAK,EAAEC,UAAU,EAAEC,kBAAkB,EAAEC,eAAe,EAAEC,eAAe,EAAE,GAAGL;IACpF,MAAMM,QAAQd;IACd,MAAM,CAACe,UAAUC,YAAY,GAAGtB,SAA6B;IAC7D,MAAMuB,OAAOC,QAAQH;IAErB,MAAMI,oBAAoB;QACxBC,UAAU;QACVC,SAAS;QACTC,UAAU;IACZ;IAEA,MAAMC,8BAA8B,CAACC;QACnCR,YAAYQ,MAAMC,aAAa;IACjC;IAEA,MAAMC,2BAA2B;QAC/Bd,gBAAgB;QAChBe;IACF;IAEA,MAAMC,qBAAqB;QACzBhB,gBAAgB;QAChBe;IACF;IAEA,MAAMA,cAAc;QAClBX,YAAY;IACd;IAEA,MAAMa,kBAAkB,IAAeC,iBAAiB;IACxD,MAAMC,uBAAuB,IAAeD,iBAAiB;IAC7D,MAAME,iBAAiB,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iB/C,MAAMgD,OAAO,CAACC,UAAU,CAACC,KAAK;gCAC/C3C,SAAS;4BACX;4BACA,6BAA6B;gCAC3BwC,iBAAiB/C,MAAMgD,OAAO,CAACG,MAAM,CAACC,KAAK;4BAC7C;wBACF;;0CAEA,KAACjE;gCAASyC,SAAShB;gCAA0ByC,UAAU1D,MAAMqD,OAAO,KAAK;0CAAgB;;0CAGzF,KAAC7D;gCAASyC,SAASd;gCAAoBuC,UAAU1D,MAAMqD,OAAO,KAAK;0CAAS;;;;;;0BAKhF,MAAChE;gBACCsC,WAAU;gBACVuB,IAAI;oBACFS,QAAQ,CAAC,UAAU,EAAEtD,MAAMgD,OAAO,CAACO,OAAO,CAACC,IAAI,EAAE;oBACjDC,cAAc,GAAGzD,MAAM0D,KAAK,CAACD,YAAY,CAAC,EAAE,CAAC;oBAC7ClD,SAAS;gBACX;;kCAEA,KAAChB;wBAAYkC,aAAajC,aAAa2B,SAAS;kCAC9C,cAAA,KAAClC;4BACC0E,SAAS5C,oBAAoB,cAAc;4BAC3Cc,OAAM;4BACN+B,MAAK;4BACLhC,SAAS,IAAM7B,gBAAgB;4BAC/B8C,IAAIxC;sCACL;;;kCAIH,KAACd;wBAAYkC,aAAajC,aAAa4B,cAAc;kCACnD,cAAA,KAACnC;4BACC0E,SAAS1C,yBAAyB,cAAc;4BAChDY,OAAM;4BACN+B,MAAK;4BACLhC,SAAS,IAAM7B,gBAAgB;4BAC/B8C,IAAIxC;sCACL;;;kCAIH,KAACd;wBAAYkC,aAAajC,aAAaqE,QAAQ;kCAC7C,cAAA,KAAC5E;4BACC0E,SAASzC,mBAAmB,cAAc;4BAC1CW,OAAM;4BACN+B,MAAK;4BACLhC,SAAS,IAAM7B,gBAAgB;4BAC/B8C,IAAIxC;sCACL;;;;;;;AAOX"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Settings.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, Button, useTheme, MenuItem, Menu, Fade } from '@mui/material';\nimport { ToolbarIconButton, InfoTooltip } from '@perses-dev/components';\nimport PaletteIcon from 'mdi-material-ui/Palette';\nimport RefreshIcon from 'mdi-material-ui/Refresh';\nimport type { ReactElement } from 'react';\nimport { useState, useMemo } from 'react';\n\nimport type { FlameChartOptions } from '../flame-chart-model';\nimport { TOOLTIP_TEXT } from '../utils/ui-text';\n\nexport interface SettingsProps {\n value: FlameChartOptions;\n selectedId: number;\n onChangePalette: (palette: 'package-name' | 'value') => void;\n onSelectedIdChange: (newId: number) => void;\n onDisplayChange: (value: 'table' | 'flame-graph' | 'both') => void;\n}\n\nexport function Settings(props: SettingsProps): ReactElement {\n const { value, selectedId, onSelectedIdChange, onChangePalette, onDisplayChange } = props;\n const theme = useTheme();\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n const open = Boolean(anchorEl);\n\n const customButtonStyle = {\n fontSize: '12px',\n padding: '2px 6px',\n minWidth: 'auto',\n };\n\n const handleChangeColorShemeClick = (event: React.MouseEvent<HTMLElement>): void => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleByPackageNameClick = (): void => {\n onChangePalette('package-name');\n handleClose();\n };\n\n const handleByValueClick = (): void => {\n onChangePalette('value');\n handleClose();\n };\n\n const handleClose = (): void => {\n setAnchorEl(null);\n };\n\n const isTableSelected = (): boolean => selectedView === 'table';\n const isFlameGraphSelected = (): boolean => selectedView === 'flame-graph';\n const isBothSelected = (): boolean => selectedView === 'both';\n\n // Update selected view based on the value of showTable and showFlameGraph\n const selectedView: 'table' | 'flame-graph' | 'both' | 'none' = useMemo(() => {\n if (!value.showTable && !value.showFlameGraph) {\n return 'none';\n } else if (value.showTable && value.showFlameGraph) {\n return 'both';\n } else if (value.showTable) {\n return 'table';\n } else {\n return 'flame-graph';\n }\n }, [value.showTable, value.showFlameGraph]);\n\n return (\n <Stack spacing=\"10px\" direction=\"row\" justifyContent=\"center\" alignItems=\"center\">\n {selectedId !== 0 && (\n <InfoTooltip description={TOOLTIP_TEXT.resetFlameGraph}>\n <ToolbarIconButton\n aria-label={TOOLTIP_TEXT.resetFlameGraph}\n onClick={() => onSelectedIdChange(0)}\n color=\"primary\"\n >\n <RefreshIcon fontSize=\"small\" />\n </ToolbarIconButton>\n </InfoTooltip>\n )}\n <Stack>\n <InfoTooltip description={TOOLTIP_TEXT.changeColorSheme}>\n <ToolbarIconButton\n id=\"change-color-sheme-button\"\n aria-label={TOOLTIP_TEXT.changeColorSheme}\n aria-controls={open ? 'change-color-sheme-menu' : undefined}\n aria-haspopup=\"true\"\n aria-expanded={open ? 'true' : undefined}\n onClick={handleChangeColorShemeClick}\n color=\"primary\"\n >\n <PaletteIcon fontSize=\"small\" />\n </ToolbarIconButton>\n </InfoTooltip>\n <Menu\n id=\"change-color-sheme-menu\"\n slotProps={{\n list: { 'aria-labelledby': 'change-color-sheme-button' },\n }}\n anchorEl={anchorEl}\n open={open}\n onClose={handleClose}\n slots={{ transition: Fade }}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'center',\n }}\n sx={{\n mt: 1,\n '& .MuiPaper-root': {\n backgroundColor: theme.palette.background.paper,\n padding: '0 5px',\n },\n '& .MuiMenuItem-root:hover': {\n backgroundColor: theme.palette.action.hover,\n },\n }}\n >\n <MenuItem onClick={handleByPackageNameClick} selected={value.palette === 'package-name'}>\n By package name\n </MenuItem>\n <MenuItem onClick={handleByValueClick} selected={value.palette === 'value'}>\n By value\n </MenuItem>\n </Menu>\n </Stack>\n <Stack\n direction=\"row\"\n sx={{\n border: `1px solid ${theme.palette.primary.main}`,\n borderRadius: `${theme.shape.borderRadius}px`,\n padding: '2px',\n }}\n >\n <InfoTooltip description={TOOLTIP_TEXT.showTable}>\n <Button\n variant={isTableSelected() ? 'contained' : 'text'}\n color=\"primary\"\n size=\"small\"\n onClick={() => onDisplayChange('table')}\n sx={customButtonStyle}\n >\n Table\n </Button>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.showFlameGraph}>\n <Button\n variant={isFlameGraphSelected() ? 'contained' : 'text'}\n color=\"primary\"\n size=\"small\"\n onClick={() => onDisplayChange('flame-graph')}\n sx={customButtonStyle}\n >\n Flame Graph\n </Button>\n </InfoTooltip>\n <InfoTooltip description={TOOLTIP_TEXT.showBoth}>\n <Button\n variant={isBothSelected() ? 'contained' : 'text'}\n color=\"primary\"\n size=\"small\"\n onClick={() => onDisplayChange('both')}\n sx={customButtonStyle}\n >\n Both\n </Button>\n </InfoTooltip>\n </Stack>\n </Stack>\n );\n}\n"],"names":["Stack","Button","useTheme","MenuItem","Menu","Fade","ToolbarIconButton","InfoTooltip","PaletteIcon","RefreshIcon","useState","useMemo","TOOLTIP_TEXT","Settings","props","value","selectedId","onSelectedIdChange","onChangePalette","onDisplayChange","theme","anchorEl","setAnchorEl","open","Boolean","customButtonStyle","fontSize","padding","minWidth","handleChangeColorShemeClick","event","currentTarget","handleByPackageNameClick","handleClose","handleByValueClick","isTableSelected","selectedView","isFlameGraphSelected","isBothSelected","showTable","showFlameGraph","spacing","direction","justifyContent","alignItems","description","resetFlameGraph","aria-label","onClick","color","changeColorSheme","id","aria-controls","undefined","aria-haspopup","aria-expanded","slotProps","list","onClose","slots","transition","anchorOrigin","vertical","horizontal","transformOrigin","sx","mt","backgroundColor","palette","background","paper","action","hover","selected","border","primary","main","borderRadius","shape","variant","size","showBoth"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE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qD,OAAO,KAAK;0CAAS;;;;;;0BAKhF,MAACpE;gBACC0C,WAAU;gBACVuB,IAAI;oBACFS,QAAQ,CAAC,UAAU,EAAEtD,MAAMgD,OAAO,CAACO,OAAO,CAACC,IAAI,EAAE;oBACjDC,cAAc,GAAGzD,MAAM0D,KAAK,CAACD,YAAY,CAAC,EAAE,CAAC;oBAC7ClD,SAAS;gBACX;;kCAEA,KAACpB;wBAAYsC,aAAajC,aAAa2B,SAAS;kCAC9C,cAAA,KAACtC;4BACC8E,SAAS5C,oBAAoB,cAAc;4BAC3Cc,OAAM;4BACN+B,MAAK;4BACLhC,SAAS,IAAM7B,gBAAgB;4BAC/B8C,IAAIxC;sCACL;;;kCAIH,KAAClB;wBAAYsC,aAAajC,aAAa4B,cAAc;kCACnD,cAAA,KAACvC;4BACC8E,SAAS1C,yBAAyB,cAAc;4BAChDY,OAAM;4BACN+B,MAAK;4BACLhC,SAAS,IAAM7B,gBAAgB;4BAC/B8C,IAAIxC;sCACL;;;kCAIH,KAAClB;wBAAYsC,aAAajC,aAAaqE,QAAQ;kCAC7C,cAAA,KAAChF;4BACC8E,SAASzC,mBAAmB,cAAc;4BAC1CW,OAAM;4BACN+B,MAAK;4BACLhC,SAAS,IAAM7B,gBAAgB;4BAC/B8C,IAAIxC;sCACL;;;;;;;AAOX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchSelector.d.ts","sourceRoot":"","sources":["../../../src/components/SwitchSelector.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SwitchSelector.d.ts","sourceRoot":"","sources":["../../../src/components/SwitchSelector.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,mBAAmB,GAAG,YAAY,CAM5F"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } 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,9 +11,8 @@
|
|
|
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 { OptionsEditorControl } from
|
|
15
|
-
import { Switch } from '@mui/material';
|
|
14
|
+
import { Switch } from "@mui/material";
|
|
15
|
+
import { OptionsEditorControl } from "@perses-dev/components";
|
|
16
16
|
export function SwitchSelector({ onChange, value, label }) {
|
|
17
17
|
const handleValuesChange = (_, checked)=>{
|
|
18
18
|
onChange(checked);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/SwitchSelector.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/SwitchSelector.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 { Switch } from '@mui/material';\nimport { OptionsEditorControl } from '@perses-dev/components';\nimport type { ReactElement } from 'react';\n\nexport interface SwitchSelectorProps {\n onChange: (newValue: boolean) => void;\n value?: boolean;\n label: string;\n}\n\nexport function SwitchSelector({ onChange, value, label }: SwitchSelectorProps): ReactElement {\n const handleValuesChange = (_: unknown, checked: boolean): void => {\n onChange(checked);\n };\n\n return <OptionsEditorControl label={label} control={<Switch checked={value} onChange={handleValuesChange} />} />;\n}\n"],"names":["Switch","OptionsEditorControl","SwitchSelector","onChange","value","label","handleValuesChange","_","checked","control"],"mappings":";AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAQ,gBAAgB;AACvC,SAASC,oBAAoB,QAAQ,yBAAyB;AAS9D,OAAO,SAASC,eAAe,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,EAAuB;IAC5E,MAAMC,qBAAqB,CAACC,GAAYC;QACtCL,SAASK;IACX;IAEA,qBAAO,KAACP;QAAqBI,OAAOA;QAAOI,uBAAS,KAACT;YAAOQ,SAASJ;YAAOD,UAAUG;;;AACxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableChart.d.ts","sourceRoot":"","sources":["../../../src/components/TableChart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableChart.d.ts","sourceRoot":"","sources":["../../../src/components/TableChart.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAa1C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,kBAAkB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAyG/D"}
|
|
@@ -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 {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { tableRecursionJson } from
|
|
18
|
-
import { formatItemValue } from
|
|
19
|
-
import { SearchBar } from
|
|
14
|
+
import { Stack, useTheme, Link } from "@mui/material";
|
|
15
|
+
import { Table } from "@perses-dev/components";
|
|
16
|
+
import { useMemo, useState } from "react";
|
|
17
|
+
import { tableRecursionJson } from "../utils/data-transform.js";
|
|
18
|
+
import { formatItemValue } from "../utils/format.js";
|
|
19
|
+
import { SearchBar } from "./SearchBar.js";
|
|
20
20
|
const LARGE_PANEL_TRESHOLD = 600; // heigth treshold to switch to large panel mode
|
|
21
21
|
const PADDING_TOP = 8;
|
|
22
22
|
const SCROLL_BAR_WIDTH = 15;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/TableChart.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/TableChart.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, useTheme, Link } from '@mui/material';\nimport type { TableColumnConfig } from '@perses-dev/components';\nimport { Table } from '@perses-dev/components';\nimport type { ProfileData } from '@perses-dev/spec';\nimport type { SortingState } from '@tanstack/react-table';\nimport type { ReactElement } from 'react';\nimport { useMemo, useState } from 'react';\n\nimport type { TableChartSample } from '../utils/data-model';\nimport { tableRecursionJson } from '../utils/data-transform';\nimport { formatItemValue } from '../utils/format';\nimport { SearchBar } from './SearchBar';\n\nconst LARGE_PANEL_TRESHOLD = 600; // heigth treshold to switch to large panel mode\nconst PADDING_TOP = 8;\nconst SCROLL_BAR_WIDTH = 15;\nconst SEARCH_BAR_HEIGHT = 50;\n\nexport interface TableChartProps {\n width: number;\n height: number;\n data: ProfileData;\n searchValue: string;\n onSearchValueChange: (value: string) => void;\n onSelectedIdChange: (id: number) => void;\n}\n\nexport function TableChart(props: TableChartProps): ReactElement {\n const { width, height, data, searchValue, onSearchValueChange, onSelectedIdChange } = props;\n\n const theme = useTheme();\n\n const availableHeight = height;\n const availableWidth = width - 10;\n\n const tableData: TableChartSample[] = useMemo(() => {\n return tableRecursionJson(data.profile.stackTrace, searchValue);\n }, [data, searchValue]);\n\n const columns: Array<TableColumnConfig<unknown>> = useMemo(() => {\n const unit = data.metadata?.units || '';\n\n const columnSettings: Array<TableColumnConfig<unknown>> = [\n {\n accessorKey: 'name',\n header: 'Name',\n headerDescription: 'Function name',\n align: 'left',\n enableSorting: true,\n width: 0.5 * availableWidth,\n cell: (ctx): ReactElement => {\n const cellValue = ctx.getValue();\n return (\n <Link\n href=\"#\"\n underline=\"hover\"\n onClick={(e) => {\n e.preventDefault();\n const currentSample = ctx.row.original as TableChartSample;\n onSelectedIdChange(currentSample.id); // focus on this item in the flame graph\n onSearchValueChange(currentSample.name);\n }}\n >\n {cellValue}\n </Link>\n );\n },\n cellDescription: () => '',\n },\n {\n accessorKey: 'self',\n header: 'Self',\n headerDescription: 'Function self samples',\n align: 'right',\n enableSorting: true,\n width: 0.25 * availableWidth - SCROLL_BAR_WIDTH,\n cell: (ctx): string => {\n const cellValue = ctx.getValue();\n return formatItemValue(unit, cellValue);\n },\n },\n {\n accessorKey: 'total',\n header: 'Total',\n headerDescription: 'Function total samples',\n align: 'right',\n enableSorting: true,\n width: 0.25 * availableWidth,\n cell: (ctx): string => {\n const cellValue = ctx.getValue();\n return formatItemValue(unit, cellValue);\n },\n },\n ];\n\n return columnSettings;\n }, [data.metadata?.units, availableWidth, onSearchValueChange, onSelectedIdChange]);\n\n const [sorting, setSorting] = useState<SortingState>([{ id: 'total', desc: true }]);\n\n return (\n <Stack\n width={availableWidth}\n height={availableHeight}\n gap={1}\n sx={{\n '& .MuiTable-root': {\n borderCollapse: 'collapse',\n },\n '& .MuiTableCell-root': {\n borderBottom: `1px solid ${theme.palette.divider}`,\n borderRight: `1px solid ${theme.palette.divider}`,\n '&:last-child': {\n borderRight: 'none',\n },\n },\n }}\n >\n <SearchBar searchValue={searchValue} onSearchValueChange={onSearchValueChange} />\n <Table\n data={tableData}\n columns={columns}\n height={availableHeight - PADDING_TOP - SEARCH_BAR_HEIGHT}\n width={availableWidth}\n density={availableHeight < LARGE_PANEL_TRESHOLD ? 'compact' : 'standard'}\n defaultColumnWidth=\"auto\"\n defaultColumnHeight=\"auto\"\n sorting={sorting}\n onSortingChange={setSorting}\n />\n </Stack>\n );\n}\n"],"names":["Stack","useTheme","Link","Table","useMemo","useState","tableRecursionJson","formatItemValue","SearchBar","LARGE_PANEL_TRESHOLD","PADDING_TOP","SCROLL_BAR_WIDTH","SEARCH_BAR_HEIGHT","TableChart","props","width","height","data","searchValue","onSearchValueChange","onSelectedIdChange","theme","availableHeight","availableWidth","tableData","profile","stackTrace","columns","unit","metadata","units","columnSettings","accessorKey","header","headerDescription","align","enableSorting","cell","ctx","cellValue","getValue","href","underline","onClick","e","preventDefault","currentSample","row","original","id","name","cellDescription","sorting","setSorting","desc","gap","sx","borderCollapse","borderBottom","palette","divider","borderRight","density","defaultColumnWidth","defaultColumnHeight","onSortingChange"],"mappings":";AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,KAAK,EAAEC,QAAQ,EAAEC,IAAI,QAAQ,gBAAgB;AAEtD,SAASC,KAAK,QAAQ,yBAAyB;AAI/C,SAASC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAG1C,SAASC,kBAAkB,QAAQ,6BAA0B;AAC7D,SAASC,eAAe,QAAQ,qBAAkB;AAClD,SAASC,SAAS,QAAQ,iBAAc;AAExC,MAAMC,uBAAuB,KAAK,gDAAgD;AAClF,MAAMC,cAAc;AACpB,MAAMC,mBAAmB;AACzB,MAAMC,oBAAoB;AAW1B,OAAO,SAASC,WAAWC,KAAsB;IAC/C,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,IAAI,EAAEC,WAAW,EAAEC,mBAAmB,EAAEC,kBAAkB,EAAE,GAAGN;IAEtF,MAAMO,QAAQpB;IAEd,MAAMqB,kBAAkBN;IACxB,MAAMO,iBAAiBR,QAAQ;I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QAAK;KAAE;IAElF,qBACE,MAACtD;QACCe,OAAOQ;QACPP,QAAQM;QACRiC,KAAK;QACLC,IAAI;YACF,oBAAoB;gBAClBC,gBAAgB;YAClB;YACA,wBAAwB;gBACtBC,cAAc,CAAC,UAAU,EAAErC,MAAMsC,OAAO,CAACC,OAAO,EAAE;gBAClDC,aAAa,CAAC,UAAU,EAAExC,MAAMsC,OAAO,CAACC,OAAO,EAAE;gBACjD,gBAAgB;oBACdC,aAAa;gBACf;YACF;QACF;;0BAEA,KAACrD;gBAAUU,aAAaA;gBAAaC,qBAAqBA;;0BAC1D,KAAChB;gBACCc,MAAMO;gBACNG,SAASA;gBACTX,QAAQM,kBAAkBZ,cAAcE;gBACxCG,OAAOQ;gBACPuC,SAASxC,kBAAkBb,uBAAuB,YAAY;gBAC9DsD,oBAAmB;gBACnBC,qBAAoB;gBACpBZ,SAASA;gBACTa,iBAAiBZ;;;;AAIzB"}
|
package/lib/components/index.js
CHANGED
|
@@ -10,15 +10,15 @@
|
|
|
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
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
13
|
+
export * from "./CustomBreadcrumb.js";
|
|
14
|
+
export * from "./FlameChart.js";
|
|
15
|
+
export * from "./FlameChartOptionsEditorSettings.js";
|
|
16
|
+
export * from "./FlameChartPanel.js";
|
|
17
|
+
export * from "./PaletteSelector.js";
|
|
18
|
+
export * from "./SearchBar.js";
|
|
19
|
+
export * from "./SeriesChart.js";
|
|
20
|
+
export * from "./Settings.js";
|
|
21
|
+
export * from "./SwitchSelector.js";
|
|
22
|
+
export * from "./TableChart.js";
|
|
23
23
|
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/index.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\nexport * from './CustomBreadcrumb';\nexport * from './FlameChart';\nexport * from './FlameChartOptionsEditorSettings';\nexport * from './FlameChartPanel';\nexport * from './PaletteSelector';\nexport * from './SearchBar';\nexport * from './SeriesChart';\nexport * from './Settings';\nexport * from './SwitchSelector';\nexport * from './TableChart';\n"],"names":[],"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,cAAc,
|
|
1
|
+
{"version":3,"sources":["../../../src/components/index.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\nexport * from './CustomBreadcrumb';\nexport * from './FlameChart';\nexport * from './FlameChartOptionsEditorSettings';\nexport * from './FlameChartPanel';\nexport * from './PaletteSelector';\nexport * from './SearchBar';\nexport * from './SeriesChart';\nexport * from './Settings';\nexport * from './SwitchSelector';\nexport * from './TableChart';\n"],"names":[],"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,cAAc,wBAAqB;AACnC,cAAc,kBAAe;AAC7B,cAAc,uCAAoC;AAClD,cAAc,uBAAoB;AAClC,cAAc,uBAAoB;AAClC,cAAc,iBAAc;AAC5B,cAAc,mBAAgB;AAC9B,cAAc,gBAAa;AAC3B,cAAc,sBAAmB;AACjC,cAAc,kBAAe"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OptionsEditorProps } from '@perses-dev/plugin-system';
|
|
2
|
-
import { Definition } from '@perses-dev/spec';
|
|
1
|
+
import type { OptionsEditorProps } from '@perses-dev/plugin-system';
|
|
2
|
+
import type { Definition } from '@perses-dev/spec';
|
|
3
3
|
/**
|
|
4
4
|
* The schema for a FlameChart panel.
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flame-chart-model.d.ts","sourceRoot":"","sources":["../../src/flame-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"flame-chart-model.d.ts","sourceRoot":"","sources":["../../src/flame-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,UAAU,CAAC,iBAAiB,CAAC;IACzE,IAAI,EAAE,YAAY,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC;IAClC,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,4BAA4B,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AAEjF,wBAAgB,8BAA8B,IAAI,iBAAiB,CAQlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/flame-chart-model.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 { OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { Definition } from '@perses-dev/spec';\n\n/**\n * The schema for a FlameChart panel.\n */\nexport interface FlameChartDefinition extends Definition<FlameChartOptions> {\n kind: 'FlameChart';\n}\n\nexport interface FlameChartOptions {\n palette: 'package-name' | 'value';\n showSettings: boolean;\n showSeries: boolean;\n showTable: boolean;\n showFlameGraph: boolean;\n traceHeight?: number;\n}\n\nexport type FlameChartOptionsEditorProps = OptionsEditorProps<FlameChartOptions>;\n\nexport function createInitialFlameChartOptions(): FlameChartOptions {\n return {\n palette: 'package-name',\n showSettings: true,\n showSeries: false,\n showTable: true,\n showFlameGraph: true,\n };\n}\n"],"names":["createInitialFlameChartOptions","palette","showSettings","showSeries","showTable","showFlameGraph"],"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;AAuBjC,OAAO,SAASA;IACd,OAAO;QACLC,SAAS;QACTC,cAAc;QACdC,YAAY;QACZC,WAAW;QACXC,gBAAgB;IAClB;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/flame-chart-model.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 { OptionsEditorProps } from '@perses-dev/plugin-system';\nimport type { Definition } from '@perses-dev/spec';\n\n/**\n * The schema for a FlameChart panel.\n */\nexport interface FlameChartDefinition extends Definition<FlameChartOptions> {\n kind: 'FlameChart';\n}\n\nexport interface FlameChartOptions {\n palette: 'package-name' | 'value';\n showSettings: boolean;\n showSeries: boolean;\n showTable: boolean;\n showFlameGraph: boolean;\n traceHeight?: number;\n}\n\nexport type FlameChartOptionsEditorProps = OptionsEditorProps<FlameChartOptions>;\n\nexport function createInitialFlameChartOptions(): FlameChartOptions {\n return {\n palette: 'package-name',\n showSettings: true,\n showSeries: false,\n showTable: true,\n showFlameGraph: true,\n };\n}\n"],"names":["createInitialFlameChartOptions","palette","showSettings","showSeries","showTable","showFlameGraph"],"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;AAuBjC,OAAO,SAASA;IACd,OAAO;QACLC,SAAS;QACTC,cAAc;QACdC,YAAY;QACZC,WAAW;QACXC,gBAAgB;IAClB;AACF"}
|
package/lib/getPluginModule.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"getPluginModule.d.ts","sourceRoot":"","sources":["../../src/getPluginModule.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AAIxF;;GAEG;AACH,wBAAgB,eAAe,IAAI,oBAAoB,CAUtD"}
|
package/lib/getPluginModule.js
CHANGED
|
@@ -10,7 +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 packageJson from
|
|
13
|
+
import packageJson from "../package.json" with {
|
|
14
|
+
type: 'json'
|
|
15
|
+
};
|
|
14
16
|
/**
|
|
15
17
|
* Returns the plugin module information from package.json
|
|
16
18
|
*/ export function getPluginModule() {
|