|
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
import { css, cx } from '@emotion/css'; |
|
|
|
|
import { get } from 'lodash'; |
|
|
|
|
import memoizeOne from 'memoize-one'; |
|
|
|
|
import React, { createRef } from 'react'; |
|
|
|
|
import { connect, ConnectedProps } from 'react-redux'; |
|
|
|
|
@ -6,13 +7,22 @@ import AutoSizer from 'react-virtualized-auto-sizer'; |
|
|
|
|
import { compose } from 'redux'; |
|
|
|
|
import { Unsubscribable } from 'rxjs'; |
|
|
|
|
|
|
|
|
|
import { AbsoluteTimeRange, DataQuery, GrafanaTheme2, LoadingState, QueryFixAction, RawTimeRange } from '@grafana/data'; |
|
|
|
|
import { |
|
|
|
|
AbsoluteTimeRange, |
|
|
|
|
DataQuery, |
|
|
|
|
GrafanaTheme2, |
|
|
|
|
LoadingState, |
|
|
|
|
QueryFixAction, |
|
|
|
|
RawTimeRange, |
|
|
|
|
SplitOpenOptions, |
|
|
|
|
} from '@grafana/data'; |
|
|
|
|
import { selectors } from '@grafana/e2e-selectors'; |
|
|
|
|
import { config, getDataSourceSrv } from '@grafana/runtime'; |
|
|
|
|
import { config, getDataSourceSrv, reportInteraction } from '@grafana/runtime'; |
|
|
|
|
import { Collapse, CustomScrollbar, ErrorBoundaryAlert, Themeable2, withTheme2, PanelContainer } from '@grafana/ui'; |
|
|
|
|
import { FILTER_FOR_OPERATOR, FILTER_OUT_OPERATOR, FilterItem } from '@grafana/ui/src/components/Table/types'; |
|
|
|
|
import appEvents from 'app/core/app_events'; |
|
|
|
|
import { supportedFeatures } from 'app/core/history/richHistoryStorageProvider'; |
|
|
|
|
import { MIXED_DATASOURCE_NAME } from 'app/plugins/datasource/mixed/MixedDataSource'; |
|
|
|
|
import { getNodeGraphDataFrames } from 'app/plugins/panel/nodeGraph/utils'; |
|
|
|
|
import { StoreState } from 'app/types'; |
|
|
|
|
import { AbsoluteTimeEvent } from 'app/types/events'; |
|
|
|
|
@ -228,6 +238,27 @@ export class Explore extends React.PureComponent<Props, ExploreState> { |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
onSplitOpen = (panelType: string) => { |
|
|
|
|
return async (options?: SplitOpenOptions<DataQuery>) => { |
|
|
|
|
this.props.splitOpen(options); |
|
|
|
|
if (options && this.props.datasourceInstance) { |
|
|
|
|
const target = (await getDataSourceSrv().get(options.datasourceUid)).type; |
|
|
|
|
const source = |
|
|
|
|
this.props.datasourceInstance.uid === MIXED_DATASOURCE_NAME |
|
|
|
|
? get(this.props.queries, '0.datasource.type') |
|
|
|
|
: this.props.datasourceInstance.type; |
|
|
|
|
const tracking = { |
|
|
|
|
origin: 'panel', |
|
|
|
|
panelType, |
|
|
|
|
source, |
|
|
|
|
target, |
|
|
|
|
exploreId: this.props.exploreId, |
|
|
|
|
}; |
|
|
|
|
reportInteraction('grafana_explore_split_view_opened', tracking); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
renderEmptyState(exploreContainerStyles: string) { |
|
|
|
|
return ( |
|
|
|
|
<div className={cx(exploreContainerStyles)}> |
|
|
|
|
@ -241,17 +272,8 @@ export class Explore extends React.PureComponent<Props, ExploreState> { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
renderGraphPanel(width: number) { |
|
|
|
|
const { |
|
|
|
|
graphResult, |
|
|
|
|
absoluteRange, |
|
|
|
|
timeZone, |
|
|
|
|
splitOpen, |
|
|
|
|
queryResponse, |
|
|
|
|
loading, |
|
|
|
|
theme, |
|
|
|
|
graphStyle, |
|
|
|
|
showFlameGraph, |
|
|
|
|
} = this.props; |
|
|
|
|
const { graphResult, absoluteRange, timeZone, queryResponse, loading, theme, graphStyle, showFlameGraph } = |
|
|
|
|
this.props; |
|
|
|
|
const spacing = parseInt(theme.spacing(2).slice(0, -2), 10); |
|
|
|
|
const label = <ExploreGraphLabel graphStyle={graphStyle} onChangeGraphStyle={this.onChangeGraphStyle} />; |
|
|
|
|
|
|
|
|
|
@ -266,7 +288,7 @@ export class Explore extends React.PureComponent<Props, ExploreState> { |
|
|
|
|
onChangeTime={this.onUpdateTimeRange} |
|
|
|
|
timeZone={timeZone} |
|
|
|
|
annotations={queryResponse.annotations} |
|
|
|
|
splitOpenFn={splitOpen} |
|
|
|
|
splitOpenFn={this.onSplitOpen('graph')} |
|
|
|
|
loadingState={queryResponse.state} |
|
|
|
|
anchorToZero={false} |
|
|
|
|
/> |
|
|
|
|
@ -283,6 +305,7 @@ export class Explore extends React.PureComponent<Props, ExploreState> { |
|
|
|
|
exploreId={exploreId} |
|
|
|
|
onCellFilterAdded={this.onCellFilterAdded} |
|
|
|
|
timeZone={timeZone} |
|
|
|
|
splitOpenFn={this.onSplitOpen('table')} |
|
|
|
|
/> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
@ -301,6 +324,7 @@ export class Explore extends React.PureComponent<Props, ExploreState> { |
|
|
|
|
onStartScanning={this.onStartScanning} |
|
|
|
|
onStopScanning={this.onStopScanning} |
|
|
|
|
scrollElement={this.scrollElement} |
|
|
|
|
splitOpenFn={this.onSplitOpen('logs')} |
|
|
|
|
/> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
@ -315,6 +339,7 @@ export class Explore extends React.PureComponent<Props, ExploreState> { |
|
|
|
|
exploreId={exploreId} |
|
|
|
|
withTraceView={showTrace} |
|
|
|
|
datasourceType={datasourceType} |
|
|
|
|
splitOpenFn={this.onSplitOpen('nodeGraph')} |
|
|
|
|
/> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
@ -327,7 +352,7 @@ export class Explore extends React.PureComponent<Props, ExploreState> { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
renderTraceViewPanel() { |
|
|
|
|
const { queryResponse, splitOpen, exploreId } = this.props; |
|
|
|
|
const { queryResponse, exploreId } = this.props; |
|
|
|
|
const dataFrames = queryResponse.series.filter((series) => series.meta?.preferredVisualisationType === 'trace'); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
@ -336,7 +361,7 @@ export class Explore extends React.PureComponent<Props, ExploreState> { |
|
|
|
|
<TraceViewContainer |
|
|
|
|
exploreId={exploreId} |
|
|
|
|
dataFrames={dataFrames} |
|
|
|
|
splitOpenFn={splitOpen} |
|
|
|
|
splitOpenFn={this.onSplitOpen('traceView')} |
|
|
|
|
scrollElement={this.scrollElement} |
|
|
|
|
queryResponse={queryResponse} |
|
|
|
|
topOfViewRef={this.topOfViewRef} |
|
|
|
|
@ -470,6 +495,7 @@ function mapStateToProps(state: StoreState, { exploreId }: ExploreProps) { |
|
|
|
|
datasourceInstance, |
|
|
|
|
datasourceMissing, |
|
|
|
|
queryKeys, |
|
|
|
|
queries, |
|
|
|
|
isLive, |
|
|
|
|
graphResult, |
|
|
|
|
logsResult, |
|
|
|
|
@ -489,6 +515,7 @@ function mapStateToProps(state: StoreState, { exploreId }: ExploreProps) { |
|
|
|
|
datasourceInstance, |
|
|
|
|
datasourceMissing, |
|
|
|
|
queryKeys, |
|
|
|
|
queries, |
|
|
|
|
isLive, |
|
|
|
|
graphResult, |
|
|
|
|
logsResult: logsResult ?? undefined, |
|
|
|
|
|