The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/explore/NodeGraphContainer.tsx

48 lines
1.4 KiB

import React from 'react';
import { Badge, NodeGraph, Collapse } 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 { 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);