import React, { FC, useMemo } from 'react'; import { IconButton } from '@grafana/ui'; import { NetworkGraphModal } from './NetworkGraphModal'; import { UsagesToNetwork } from './utils'; interface Props { id: string; usages: UsagesToNetwork[]; } export const VariablesUnknownButton: FC = ({ id, usages }) => { const network = useMemo(() => usages.find((n) => n.variable.id === id), [id, usages]); if (!network) { return null; } const nodes = network.nodes.map((n) => { if (n.label.includes(`$${id}`)) { return { ...n, color: '#FB7E81' }; } return n; }); return ( {({ showModal }) => { return ( showModal()} name="code-branch" title="Show usages" data-testid="VariablesUnknownButton" /> ); }} ); };