Flame Graph: Fix Copy Function Name (#64970)

Fix getting the function name when clicking the Copy Function Name context menu item of the flame graph
pull/65028/head
Andre Pereira 2 years ago committed by GitHub
parent 4ee0be6fdf
commit 67fe282f7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      public/app/plugins/panel/flamegraph/components/FlameGraph/FlameGraph.tsx
  2. 4
      public/app/plugins/panel/flamegraph/components/FlameGraph/FlameGraphContextMenu.tsx

@ -269,6 +269,7 @@ const FlameGraph = ({
setSelectedBarIndex={setSelectedBarIndex}
setRangeMin={setRangeMin}
setRangeMax={setRangeMax}
getLabelValue={getLabelValue}
/>
)}
</div>

@ -16,6 +16,7 @@ type Props = {
setSelectedBarIndex: (bar: number) => void;
setRangeMin: (range: number) => void;
setRangeMax: (range: number) => void;
getLabelValue: (label: string | number) => string;
};
const FlameGraphContextMenu = ({
@ -28,6 +29,7 @@ const FlameGraphContextMenu = ({
setSelectedBarIndex,
setRangeMin,
setRangeMax,
getLabelValue,
}: Props) => {
const renderMenuItems = () => {
return (
@ -55,7 +57,7 @@ const FlameGraphContextMenu = ({
onClick={() => {
if (graphRef.current && contextMenuData) {
const bar = levels[contextMenuData.levelIndex][contextMenuData.barIndex];
navigator.clipboard.writeText(bar.label).then(() => {
navigator.clipboard.writeText(getLabelValue(bar.label)).then(() => {
setContextMenuData(undefined);
});
}

Loading…
Cancel
Save