mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
* Add GraphView component * Add service map panel * Add more metadata visuals * Add context menu on click * Add context menu for services * Fix service map in dashboard * Add field proxy in explore linkSupplier * Refactor the link creation * Remove test file * Fix scale change when view is panned * Fix node centering * Don't show context menu if no links * Fix service map containers * Add collapsible around the service map * Fix stats computation * Remove debug log * Fix time stats * Allow string timestamp * Make panning bounded * Add zooming by mouse wheel * Clean up the colors * Fix stats for single trace graph * Don't show debug config * Add more complex layout * Update layout with better fixing of the root nodes * Code cleanup * Change how we pass in link creation function and some more cleanup * Refactor the panel section into separate render methods * Make the edge hover more readable * Move stats computation to data source * Put edge labels to front * Simplify layout for better multi graph layout * Update for dark theme * Move function to utils * Visual improvements * Improve context menu detail * Allow custom details * Rename to NodeGraph * Remove unused dependencies * Use named color palette and add some fallbacks for missing data * Add test data scenario * Rename plugin * Switch scroll zoom direction to align with google maps * Do some perf optimisations and rise the node limit * Update alert styling * Rename function * Add tests * Add more tests * Change data frame column mapping to use column names * Fix test * Fix type errors * Don't show context menu without links * Add beta status to panel * Fix tests * Changed function to standard methods * Fix typing * Clean up yarn.lock * Add some UI improvements - better styling of the zoom buttons - disable buttons when max reached * Fix panel references after rename * Add panel icon
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import React from 'react';
|
|
import { Badge, NodeGraph } from '@grafana/ui';
|
|
import { DataFrame, TimeRange } from '@grafana/data';
|
|
import { ExploreId, StoreState } from '../../types';
|
|
import { splitOpen } from './state/main';
|
|
import { connect, ConnectedProps } from 'react-redux';
|
|
import { Collapse } from '@grafana/ui';
|
|
import { useLinks } from './utils/links';
|
|
|
|
interface Props {
|
|
// Edges and Nodes are separate frames
|
|
dataFrames: DataFrame[];
|
|
exploreId: ExploreId;
|
|
range: TimeRange;
|
|
splitOpen: typeof splitOpen;
|
|
short?: boolean;
|
|
}
|
|
export function UnconnectedNodeGraphContainer(props: Props & ConnectedProps<typeof connector>) {
|
|
const { dataFrames, range, splitOpen, short } = props;
|
|
const getLinks = useLinks(range, splitOpen);
|
|
|
|
return (
|
|
<div style={{ height: short ? 300 : 600 }}>
|
|
<Collapse
|
|
label={
|
|
<span>
|
|
Node graph <Badge text={'Beta'} color={'blue'} icon={'rocket'} tooltip={'This visualization is in beta'} />
|
|
</span>
|
|
}
|
|
isOpen
|
|
>
|
|
<NodeGraph dataFrames={dataFrames} getLinks={getLinks} />
|
|
</Collapse>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function mapStateToProps(state: StoreState, { exploreId }: { exploreId: ExploreId }) {
|
|
return {
|
|
range: state.explore[exploreId].range,
|
|
};
|
|
}
|
|
|
|
const mapDispatchToProps = {
|
|
splitOpen,
|
|
};
|
|
|
|
const connector = connect(mapStateToProps, mapDispatchToProps);
|
|
export const NodeGraphContainer = connector(UnconnectedNodeGraphContainer);
|