mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
09634b518c
* Panel * Support tempo dash variables * Support tempo explore variables * Only show span links for explore * Cleanup * Added tests * apply variables to search * Tests for search variables * Handling no data * Interpolation and tests * TracesPanel tests * More tests * Fix for backend test * Manager integration test fix * Traces doc and updated visualizations index doc * Logs for this span * Search, scrollToTop, other improvements * Refactor to extract common code * Removed TopOfViewRefType optional * Remove topOfViewRef optional * Removed another optional and fixed tests * Test * Only show search bar if trace * Support traces panel in add to dashboard * Self review * Update betterer * Linter fixes * Updated traces doc * Ahh, moved the for more info too * Updated betterer.results * Added new icon * Updated expectedListResp.json
70 lines
2.5 KiB
TypeScript
70 lines
2.5 KiB
TypeScript
import TracePageSearchBar from '@jaegertracing/jaeger-ui-components/src/TracePageHeader/TracePageSearchBar';
|
|
import { TopOfViewRefType } from '@jaegertracing/jaeger-ui-components/src/TraceTimelineViewer/VirtualizedTraceView';
|
|
import React, { RefObject, useMemo, useState } from 'react';
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import { DataFrame, SplitOpen, PanelData } from '@grafana/data';
|
|
import { Collapse } from '@grafana/ui';
|
|
import { StoreState } from 'app/types';
|
|
import { ExploreId } from 'app/types/explore';
|
|
|
|
import { TraceView } from './TraceView';
|
|
import { useSearch } from './useSearch';
|
|
import { transformDataFrames } from './utils/transform';
|
|
interface Props {
|
|
dataFrames: DataFrame[];
|
|
splitOpenFn: SplitOpen;
|
|
exploreId: ExploreId;
|
|
scrollElement?: Element;
|
|
queryResponse: PanelData;
|
|
topOfViewRef: RefObject<HTMLDivElement>;
|
|
}
|
|
export function TraceViewContainer(props: Props) {
|
|
// At this point we only show single trace
|
|
const frame = props.dataFrames[0];
|
|
const { dataFrames, splitOpenFn, exploreId, scrollElement, topOfViewRef, queryResponse } = props;
|
|
const traceProp = useMemo(() => transformDataFrames(frame), [frame]);
|
|
const { search, setSearch, spanFindMatches } = useSearch(traceProp?.spans);
|
|
const [focusedSpanIdForSearch, setFocusedSpanIdForSearch] = useState('');
|
|
const [searchBarSuffix, setSearchBarSuffix] = useState('');
|
|
const datasource = useSelector(
|
|
(state: StoreState) => state.explore[props.exploreId!]?.datasourceInstance ?? undefined
|
|
);
|
|
|
|
if (!traceProp) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<TracePageSearchBar
|
|
navigable={true}
|
|
searchValue={search}
|
|
setSearch={setSearch}
|
|
spanFindMatches={spanFindMatches}
|
|
searchBarSuffix={searchBarSuffix}
|
|
setSearchBarSuffix={setSearchBarSuffix}
|
|
focusedSpanIdForSearch={focusedSpanIdForSearch}
|
|
setFocusedSpanIdForSearch={setFocusedSpanIdForSearch}
|
|
/>
|
|
|
|
<Collapse label="Trace View" isOpen>
|
|
<TraceView
|
|
exploreId={exploreId}
|
|
dataFrames={dataFrames}
|
|
splitOpenFn={splitOpenFn}
|
|
scrollElement={scrollElement}
|
|
traceProp={traceProp}
|
|
spanFindMatches={spanFindMatches}
|
|
search={search}
|
|
focusedSpanIdForSearch={focusedSpanIdForSearch}
|
|
queryResponse={queryResponse}
|
|
datasource={datasource}
|
|
topOfViewRef={topOfViewRef}
|
|
topOfViewRefType={TopOfViewRefType.Explore}
|
|
/>
|
|
</Collapse>
|
|
</>
|
|
);
|
|
}
|