2021-04-01 07:15:23 -05:00
|
|
|
import { css, cx } from '@emotion/css';
|
2022-11-02 05:22:09 -05:00
|
|
|
import { get } from 'lodash';
|
2022-04-22 08:33:13 -05:00
|
|
|
import memoizeOne from 'memoize-one';
|
|
|
|
import React, { createRef } from 'react';
|
2021-06-22 04:43:13 -05:00
|
|
|
import { connect, ConnectedProps } from 'react-redux';
|
2020-01-16 04:11:33 -06:00
|
|
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { Unsubscribable } from 'rxjs';
|
|
|
|
|
2022-11-02 05:22:09 -05:00
|
|
|
import {
|
|
|
|
AbsoluteTimeRange,
|
|
|
|
GrafanaTheme2,
|
|
|
|
LoadingState,
|
|
|
|
QueryFixAction,
|
|
|
|
RawTimeRange,
|
2022-11-03 04:55:02 -05:00
|
|
|
EventBus,
|
2022-11-02 05:22:09 -05:00
|
|
|
SplitOpenOptions,
|
2023-01-24 12:10:27 -06:00
|
|
|
SupplementaryQueryType,
|
2022-11-02 05:22:09 -05:00
|
|
|
} from '@grafana/data';
|
2020-04-27 02:09:05 -05:00
|
|
|
import { selectors } from '@grafana/e2e-selectors';
|
2022-11-02 05:22:09 -05:00
|
|
|
import { config, getDataSourceSrv, reportInteraction } from '@grafana/runtime';
|
2023-01-24 15:11:00 -06:00
|
|
|
import { DataQuery } from '@grafana/schema';
|
2023-01-19 07:03:13 -06:00
|
|
|
import {
|
|
|
|
CustomScrollbar,
|
|
|
|
ErrorBoundaryAlert,
|
|
|
|
Themeable2,
|
|
|
|
withTheme2,
|
|
|
|
PanelContainer,
|
|
|
|
Alert,
|
|
|
|
AdHocFilterItem,
|
|
|
|
} from '@grafana/ui';
|
|
|
|
import { FILTER_FOR_OPERATOR, FILTER_OUT_OPERATOR } from '@grafana/ui/src/components/Table/types';
|
2022-04-22 08:33:13 -05:00
|
|
|
import appEvents from 'app/core/app_events';
|
2022-11-21 08:03:50 -06:00
|
|
|
import { FadeIn } from 'app/core/components/Animations/FadeIn';
|
2022-06-02 08:51:11 -05:00
|
|
|
import { supportedFeatures } from 'app/core/history/richHistoryStorageProvider';
|
2022-11-02 05:22:09 -05:00
|
|
|
import { MIXED_DATASOURCE_NAME } from 'app/plugins/datasource/mixed/MixedDataSource';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { getNodeGraphDataFrames } from 'app/plugins/panel/nodeGraph/utils';
|
|
|
|
import { StoreState } from 'app/types';
|
|
|
|
import { AbsoluteTimeEvent } from 'app/types/events';
|
2022-11-16 04:16:27 -06:00
|
|
|
import { ExploreId, ExploreItemState } from 'app/types/explore';
|
2018-07-13 02:09:36 -05:00
|
|
|
|
2022-04-22 08:33:13 -05:00
|
|
|
import { getTimeZone } from '../profile/state/selectors';
|
|
|
|
|
2020-08-06 10:22:54 -05:00
|
|
|
import ExploreQueryInspector from './ExploreQueryInspector';
|
2019-01-22 07:50:19 -06:00
|
|
|
import { ExploreToolbar } from './ExploreToolbar';
|
2022-10-07 05:39:14 -05:00
|
|
|
import { FlameGraphExploreContainer } from './FlameGraphExploreContainer';
|
2022-11-16 04:16:27 -06:00
|
|
|
import { GraphContainer } from './Graph/GraphContainer';
|
2022-04-22 08:33:13 -05:00
|
|
|
import LogsContainer from './LogsContainer';
|
2023-01-24 12:10:27 -06:00
|
|
|
import { LogsSamplePanel } from './LogsSamplePanel';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { NoData } from './NoData';
|
2019-03-28 11:17:01 -05:00
|
|
|
import { NoDataSourceCallToAction } from './NoDataSourceCallToAction';
|
2021-01-19 09:34:43 -06:00
|
|
|
import { NodeGraphContainer } from './NodeGraphContainer';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { QueryRows } from './QueryRows';
|
2023-01-04 10:46:03 -06:00
|
|
|
import RawPrometheusContainer from './RawPrometheusContainer';
|
2021-03-23 05:58:09 -05:00
|
|
|
import { ResponseErrorContainer } from './ResponseErrorContainer';
|
2022-04-22 08:33:13 -05:00
|
|
|
import RichHistoryContainer from './RichHistory/RichHistoryContainer';
|
|
|
|
import { SecondaryActions } from './SecondaryActions';
|
|
|
|
import TableContainer from './TableContainer';
|
2021-05-19 12:41:54 -05:00
|
|
|
import { TraceViewContainer } from './TraceView/TraceViewContainer';
|
2022-11-16 04:16:27 -06:00
|
|
|
import { changeSize } from './state/explorePane';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { splitOpen } from './state/main';
|
2023-01-24 12:10:27 -06:00
|
|
|
import {
|
|
|
|
addQueryRow,
|
|
|
|
modifyQueries,
|
|
|
|
scanStart,
|
|
|
|
scanStopAction,
|
|
|
|
setQueries,
|
|
|
|
setSupplementaryQueryEnabled,
|
|
|
|
} from './state/query';
|
2022-10-11 06:59:17 -05:00
|
|
|
import { isSplit } from './state/selectors';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { makeAbsoluteTime, updateTimeRange } from './state/time';
|
2018-12-31 12:30:32 -06:00
|
|
|
|
2021-08-13 01:02:49 -05:00
|
|
|
const getStyles = (theme: GrafanaTheme2) => {
|
2019-09-20 06:00:11 -05:00
|
|
|
return {
|
2020-12-15 08:18:12 -06:00
|
|
|
exploreMain: css`
|
|
|
|
label: exploreMain;
|
2019-09-20 06:00:11 -05:00
|
|
|
// Is needed for some transition animations to work.
|
|
|
|
position: relative;
|
2020-03-26 07:24:58 -05:00
|
|
|
margin-top: 21px;
|
2023-04-12 11:58:08 -05:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
gap: ${theme.spacing(1)};
|
2019-12-23 05:29:00 -06:00
|
|
|
`,
|
2020-04-16 07:28:46 -05:00
|
|
|
queryContainer: css`
|
|
|
|
label: queryContainer;
|
|
|
|
// Need to override normal css class and don't want to count on ordering of the classes in html.
|
|
|
|
height: auto !important;
|
2020-04-27 16:53:15 -05:00
|
|
|
flex: unset !important;
|
2021-08-03 05:32:53 -05:00
|
|
|
display: unset !important;
|
2021-08-13 01:02:49 -05:00
|
|
|
padding: ${theme.spacing(1)};
|
2020-04-16 07:28:46 -05:00
|
|
|
`,
|
2022-05-23 03:55:04 -05:00
|
|
|
exploreContainer: css`
|
|
|
|
display: flex;
|
|
|
|
flex: 1 1 auto;
|
|
|
|
flex-direction: column;
|
|
|
|
padding: ${theme.spacing(2)};
|
|
|
|
padding-top: 0;
|
|
|
|
`,
|
2019-09-20 06:00:11 -05:00
|
|
|
};
|
2021-08-13 01:02:49 -05:00
|
|
|
};
|
2019-09-20 06:00:11 -05:00
|
|
|
|
2021-08-13 01:02:49 -05:00
|
|
|
export interface ExploreProps extends Themeable2 {
|
2019-01-11 11:26:56 -06:00
|
|
|
exploreId: ExploreId;
|
2021-08-13 01:02:49 -05:00
|
|
|
theme: GrafanaTheme2;
|
2022-11-03 04:55:02 -05:00
|
|
|
eventBus: EventBus;
|
2018-04-27 11:21:20 -05:00
|
|
|
}
|
|
|
|
|
2020-08-06 10:22:54 -05:00
|
|
|
enum ExploreDrawer {
|
|
|
|
RichHistory,
|
|
|
|
QueryInspector,
|
|
|
|
}
|
|
|
|
|
Explore: Rich History (#22570)
* Explore: Refactor active buttons css
* Explore: Add query history button
* WIP: Creating drawer
* WIP: Create custom drawer (for now)
* Revert changes to Drawer.tsx
* WIP: Layout finished
* Rich History: Set up boilerplate for Settings
* WIP: Query history cards
* Refactor, split components
* Add resizability, interactivity
* Save history to local storage
* Visualise queries from queryhistory local storage
* Set up query history settings
* Refactor
* Create link, un-refactored verison
* Copyable url
* WIP: Add slider
* Commenting feature
* Slider filtration
* Add headings
* Hide Rich history behind feature toggle
* Cleaning up, refactors
* Update tests
* Implement getQueryDisplayText
* Update lockfile for new dependencies
* Update heading based on sorting
* Fix typescript strinctNullCheck errors
* Fix Forms, new forms
* Fixes based on provided feedback
* Fixes, splitting component into two
* Add tooltips, add delete history button
* Clicking on card adds queries to query rows
* Delete history, width of drawers
* UI/UX changes, updates
* Add number of queries to headings, box shadows
* Fix slider, remove feature toggle
* Fix typo in the beta announcement
* Fix how the rich history state is rendered when initialization
* Move updateFilters when activeDatasourceFilter onlyto RichHistory, remove duplicated code
* Fix typescript strictnull errors, not used variables errors
2020-03-10 09:08:15 -05:00
|
|
|
interface ExploreState {
|
2020-08-06 10:22:54 -05:00
|
|
|
openDrawer?: ExploreDrawer;
|
Explore: Rich History (#22570)
* Explore: Refactor active buttons css
* Explore: Add query history button
* WIP: Creating drawer
* WIP: Create custom drawer (for now)
* Revert changes to Drawer.tsx
* WIP: Layout finished
* Rich History: Set up boilerplate for Settings
* WIP: Query history cards
* Refactor, split components
* Add resizability, interactivity
* Save history to local storage
* Visualise queries from queryhistory local storage
* Set up query history settings
* Refactor
* Create link, un-refactored verison
* Copyable url
* WIP: Add slider
* Commenting feature
* Slider filtration
* Add headings
* Hide Rich history behind feature toggle
* Cleaning up, refactors
* Update tests
* Implement getQueryDisplayText
* Update lockfile for new dependencies
* Update heading based on sorting
* Fix typescript strinctNullCheck errors
* Fix Forms, new forms
* Fixes based on provided feedback
* Fixes, splitting component into two
* Add tooltips, add delete history button
* Clicking on card adds queries to query rows
* Delete history, width of drawers
* UI/UX changes, updates
* Add number of queries to headings, box shadows
* Fix slider, remove feature toggle
* Fix typo in the beta announcement
* Fix how the rich history state is rendered when initialization
* Move updateFilters when activeDatasourceFilter onlyto RichHistory, remove duplicated code
* Fix typescript strictnull errors, not used variables errors
2020-03-10 09:08:15 -05:00
|
|
|
}
|
|
|
|
|
2021-06-22 04:43:13 -05:00
|
|
|
export type Props = ExploreProps & ConnectedProps<typeof connector>;
|
|
|
|
|
2018-11-21 07:45:57 -06:00
|
|
|
/**
|
|
|
|
* Explore provides an area for quick query iteration for a given datasource.
|
|
|
|
* Once a datasource is selected it populates the query section at the top.
|
|
|
|
* When queries are run, their results are being displayed in the main section.
|
|
|
|
* The datasource determines what kind of query editor it brings, and what kind
|
2019-01-12 16:44:24 -06:00
|
|
|
* of results viewers it supports. The state is managed entirely in Redux.
|
2018-11-22 05:00:41 -06:00
|
|
|
*
|
2019-01-12 16:44:24 -06:00
|
|
|
* SPLIT VIEW
|
2018-11-22 05:00:41 -06:00
|
|
|
*
|
2019-01-12 16:44:24 -06:00
|
|
|
* Explore can have two Explore areas side-by-side. This is handled in `Wrapper.tsx`.
|
|
|
|
* Since there can be multiple Explores (e.g., left and right) each action needs
|
|
|
|
* the `exploreId` as first parameter so that the reducer knows which Explore state
|
|
|
|
* is affected.
|
2018-11-22 05:00:41 -06:00
|
|
|
*
|
|
|
|
* DATASOURCE REQUESTS
|
|
|
|
*
|
|
|
|
* A click on Run Query creates transactions for all DataQueries for all expanded
|
|
|
|
* result viewers. New runs are discarding previous runs. Upon completion a transaction
|
|
|
|
* saves the result. The result viewers construct their data from the currently existing
|
|
|
|
* transactions.
|
|
|
|
*
|
|
|
|
* The result viewers determine some of the query options sent to the datasource, e.g.,
|
|
|
|
* `format`, to indicate eventual transformations by the datasources' result transformers.
|
2018-11-21 07:45:57 -06:00
|
|
|
*/
|
2021-06-22 04:43:13 -05:00
|
|
|
export class Explore extends React.PureComponent<Props, ExploreState> {
|
2021-12-03 04:09:55 -06:00
|
|
|
scrollElement: HTMLDivElement | undefined;
|
2022-01-07 09:51:29 -06:00
|
|
|
absoluteTimeUnsubsciber: Unsubscribable | undefined;
|
2022-05-03 11:42:36 -05:00
|
|
|
topOfViewRef = createRef<HTMLDivElement>();
|
2022-11-03 04:55:02 -05:00
|
|
|
graphEventBus: EventBus;
|
|
|
|
logsEventBus: EventBus;
|
2021-12-03 04:09:55 -06:00
|
|
|
|
2021-06-22 04:43:13 -05:00
|
|
|
constructor(props: Props) {
|
2018-04-26 04:58:42 -05:00
|
|
|
super(props);
|
Explore: Rich History (#22570)
* Explore: Refactor active buttons css
* Explore: Add query history button
* WIP: Creating drawer
* WIP: Create custom drawer (for now)
* Revert changes to Drawer.tsx
* WIP: Layout finished
* Rich History: Set up boilerplate for Settings
* WIP: Query history cards
* Refactor, split components
* Add resizability, interactivity
* Save history to local storage
* Visualise queries from queryhistory local storage
* Set up query history settings
* Refactor
* Create link, un-refactored verison
* Copyable url
* WIP: Add slider
* Commenting feature
* Slider filtration
* Add headings
* Hide Rich history behind feature toggle
* Cleaning up, refactors
* Update tests
* Implement getQueryDisplayText
* Update lockfile for new dependencies
* Update heading based on sorting
* Fix typescript strinctNullCheck errors
* Fix Forms, new forms
* Fixes based on provided feedback
* Fixes, splitting component into two
* Add tooltips, add delete history button
* Clicking on card adds queries to query rows
* Delete history, width of drawers
* UI/UX changes, updates
* Add number of queries to headings, box shadows
* Fix slider, remove feature toggle
* Fix typo in the beta announcement
* Fix how the rich history state is rendered when initialization
* Move updateFilters when activeDatasourceFilter onlyto RichHistory, remove duplicated code
* Fix typescript strictnull errors, not used variables errors
2020-03-10 09:08:15 -05:00
|
|
|
this.state = {
|
2020-08-06 10:22:54 -05:00
|
|
|
openDrawer: undefined,
|
Explore: Rich History (#22570)
* Explore: Refactor active buttons css
* Explore: Add query history button
* WIP: Creating drawer
* WIP: Create custom drawer (for now)
* Revert changes to Drawer.tsx
* WIP: Layout finished
* Rich History: Set up boilerplate for Settings
* WIP: Query history cards
* Refactor, split components
* Add resizability, interactivity
* Save history to local storage
* Visualise queries from queryhistory local storage
* Set up query history settings
* Refactor
* Create link, un-refactored verison
* Copyable url
* WIP: Add slider
* Commenting feature
* Slider filtration
* Add headings
* Hide Rich history behind feature toggle
* Cleaning up, refactors
* Update tests
* Implement getQueryDisplayText
* Update lockfile for new dependencies
* Update heading based on sorting
* Fix typescript strinctNullCheck errors
* Fix Forms, new forms
* Fixes based on provided feedback
* Fixes, splitting component into two
* Add tooltips, add delete history button
* Clicking on card adds queries to query rows
* Delete history, width of drawers
* UI/UX changes, updates
* Add number of queries to headings, box shadows
* Fix slider, remove feature toggle
* Fix typo in the beta announcement
* Fix how the rich history state is rendered when initialization
* Move updateFilters when activeDatasourceFilter onlyto RichHistory, remove duplicated code
* Fix typescript strictnull errors, not used variables errors
2020-03-10 09:08:15 -05:00
|
|
|
};
|
2022-11-03 04:55:02 -05:00
|
|
|
this.graphEventBus = props.eventBus.newScopedBus('graph', { onlyLocal: false });
|
|
|
|
this.logsEventBus = props.eventBus.newScopedBus('logs', { onlyLocal: false });
|
2018-04-26 04:58:42 -05:00
|
|
|
}
|
|
|
|
|
2022-01-07 09:51:29 -06:00
|
|
|
componentDidMount() {
|
|
|
|
this.absoluteTimeUnsubsciber = appEvents.subscribe(AbsoluteTimeEvent, this.onMakeAbsoluteTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
this.absoluteTimeUnsubsciber?.unsubscribe();
|
|
|
|
}
|
|
|
|
|
2019-06-28 05:07:55 -05:00
|
|
|
onChangeTime = (rawRange: RawTimeRange) => {
|
|
|
|
const { updateTimeRange, exploreId } = this.props;
|
2019-06-25 07:44:19 -05:00
|
|
|
updateTimeRange({ exploreId, rawRange });
|
2018-04-30 10:25:25 -05:00
|
|
|
};
|
|
|
|
|
2018-10-09 12:46:31 -05:00
|
|
|
// Use this in help pages to set page to a single query
|
2018-11-21 09:28:30 -06:00
|
|
|
onClickExample = (query: DataQuery) => {
|
2019-01-15 12:52:53 -06:00
|
|
|
this.props.setQueries(this.props.exploreId, [query]);
|
2018-10-09 12:46:31 -05:00
|
|
|
};
|
|
|
|
|
2023-01-19 07:03:13 -06:00
|
|
|
onCellFilterAdded = (filter: AdHocFilterItem) => {
|
2020-06-10 00:09:02 -05:00
|
|
|
const { value, key, operator } = filter;
|
|
|
|
if (operator === FILTER_FOR_OPERATOR) {
|
|
|
|
this.onClickFilterLabel(key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (operator === FILTER_OUT_OPERATOR) {
|
|
|
|
this.onClickFilterOutLabel(key, value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-11-01 04:01:00 -05:00
|
|
|
onClickFilterLabel = (key: string, value: string) => {
|
2022-07-18 07:13:34 -05:00
|
|
|
this.onModifyQueries({ type: 'ADD_FILTER', options: { key, value } });
|
2018-08-08 09:50:30 -05:00
|
|
|
};
|
|
|
|
|
2019-11-01 04:01:00 -05:00
|
|
|
onClickFilterOutLabel = (key: string, value: string) => {
|
2022-07-18 07:13:34 -05:00
|
|
|
this.onModifyQueries({ type: 'ADD_FILTER_OUT', options: { key, value } });
|
2019-11-01 04:01:00 -05:00
|
|
|
};
|
|
|
|
|
2019-12-23 05:29:00 -06:00
|
|
|
onClickAddQueryRowButton = () => {
|
2022-08-31 09:24:20 -05:00
|
|
|
const { exploreId, queryKeys } = this.props;
|
|
|
|
this.props.addQueryRow(exploreId, queryKeys.length);
|
2019-12-23 05:29:00 -06:00
|
|
|
};
|
|
|
|
|
2022-01-07 09:51:29 -06:00
|
|
|
onMakeAbsoluteTime = () => {
|
|
|
|
const { makeAbsoluteTime } = this.props;
|
|
|
|
makeAbsoluteTime();
|
|
|
|
};
|
|
|
|
|
2022-10-13 03:04:51 -05:00
|
|
|
onModifyQueries = (action: QueryFixAction) => {
|
2022-10-18 02:27:17 -05:00
|
|
|
const modifier = async (query: DataQuery, modification: QueryFixAction) => {
|
|
|
|
const { datasource } = query;
|
|
|
|
if (datasource == null) {
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
const ds = await getDataSourceSrv().get(datasource);
|
|
|
|
if (ds.modifyQuery) {
|
|
|
|
return ds.modifyQuery(query, modification);
|
|
|
|
} else {
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
this.props.modifyQueries(this.props.exploreId, action, modifier);
|
2018-08-04 04:58:54 -05:00
|
|
|
};
|
|
|
|
|
2019-01-11 11:26:56 -06:00
|
|
|
onResize = (size: { height: number; width: number }) => {
|
|
|
|
this.props.changeSize(this.props.exploreId, size);
|
2018-04-26 04:58:42 -05:00
|
|
|
};
|
|
|
|
|
2018-11-27 09:35:37 -06:00
|
|
|
onStartScanning = () => {
|
2019-01-10 07:24:31 -06:00
|
|
|
// Scanner will trigger a query
|
2019-06-28 05:07:55 -05:00
|
|
|
this.props.scanStart(this.props.exploreId);
|
2018-11-23 10:53:16 -06:00
|
|
|
};
|
|
|
|
|
2018-11-27 09:35:37 -06:00
|
|
|
onStopScanning = () => {
|
2019-02-04 00:47:10 -06:00
|
|
|
this.props.scanStopAction({ exploreId: this.props.exploreId });
|
2018-11-23 10:53:16 -06:00
|
|
|
};
|
|
|
|
|
2019-08-26 01:11:07 -05:00
|
|
|
onUpdateTimeRange = (absoluteRange: AbsoluteTimeRange) => {
|
2019-10-08 11:55:53 -05:00
|
|
|
const { exploreId, updateTimeRange } = this.props;
|
2019-08-26 01:11:07 -05:00
|
|
|
updateTimeRange({ exploreId, absoluteRange });
|
|
|
|
};
|
|
|
|
|
Explore: Rich History (#22570)
* Explore: Refactor active buttons css
* Explore: Add query history button
* WIP: Creating drawer
* WIP: Create custom drawer (for now)
* Revert changes to Drawer.tsx
* WIP: Layout finished
* Rich History: Set up boilerplate for Settings
* WIP: Query history cards
* Refactor, split components
* Add resizability, interactivity
* Save history to local storage
* Visualise queries from queryhistory local storage
* Set up query history settings
* Refactor
* Create link, un-refactored verison
* Copyable url
* WIP: Add slider
* Commenting feature
* Slider filtration
* Add headings
* Hide Rich history behind feature toggle
* Cleaning up, refactors
* Update tests
* Implement getQueryDisplayText
* Update lockfile for new dependencies
* Update heading based on sorting
* Fix typescript strinctNullCheck errors
* Fix Forms, new forms
* Fixes based on provided feedback
* Fixes, splitting component into two
* Add tooltips, add delete history button
* Clicking on card adds queries to query rows
* Delete history, width of drawers
* UI/UX changes, updates
* Add number of queries to headings, box shadows
* Fix slider, remove feature toggle
* Fix typo in the beta announcement
* Fix how the rich history state is rendered when initialization
* Move updateFilters when activeDatasourceFilter onlyto RichHistory, remove duplicated code
* Fix typescript strictnull errors, not used variables errors
2020-03-10 09:08:15 -05:00
|
|
|
toggleShowRichHistory = () => {
|
2021-01-20 00:59:48 -06:00
|
|
|
this.setState((state) => {
|
Explore: Rich History (#22570)
* Explore: Refactor active buttons css
* Explore: Add query history button
* WIP: Creating drawer
* WIP: Create custom drawer (for now)
* Revert changes to Drawer.tsx
* WIP: Layout finished
* Rich History: Set up boilerplate for Settings
* WIP: Query history cards
* Refactor, split components
* Add resizability, interactivity
* Save history to local storage
* Visualise queries from queryhistory local storage
* Set up query history settings
* Refactor
* Create link, un-refactored verison
* Copyable url
* WIP: Add slider
* Commenting feature
* Slider filtration
* Add headings
* Hide Rich history behind feature toggle
* Cleaning up, refactors
* Update tests
* Implement getQueryDisplayText
* Update lockfile for new dependencies
* Update heading based on sorting
* Fix typescript strinctNullCheck errors
* Fix Forms, new forms
* Fixes based on provided feedback
* Fixes, splitting component into two
* Add tooltips, add delete history button
* Clicking on card adds queries to query rows
* Delete history, width of drawers
* UI/UX changes, updates
* Add number of queries to headings, box shadows
* Fix slider, remove feature toggle
* Fix typo in the beta announcement
* Fix how the rich history state is rendered when initialization
* Move updateFilters when activeDatasourceFilter onlyto RichHistory, remove duplicated code
* Fix typescript strictnull errors, not used variables errors
2020-03-10 09:08:15 -05:00
|
|
|
return {
|
2020-08-06 10:22:54 -05:00
|
|
|
openDrawer: state.openDrawer === ExploreDrawer.RichHistory ? undefined : ExploreDrawer.RichHistory,
|
|
|
|
};
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
toggleShowQueryInspector = () => {
|
2021-01-20 00:59:48 -06:00
|
|
|
this.setState((state) => {
|
2020-08-06 10:22:54 -05:00
|
|
|
return {
|
|
|
|
openDrawer: state.openDrawer === ExploreDrawer.QueryInspector ? undefined : ExploreDrawer.QueryInspector,
|
Explore: Rich History (#22570)
* Explore: Refactor active buttons css
* Explore: Add query history button
* WIP: Creating drawer
* WIP: Create custom drawer (for now)
* Revert changes to Drawer.tsx
* WIP: Layout finished
* Rich History: Set up boilerplate for Settings
* WIP: Query history cards
* Refactor, split components
* Add resizability, interactivity
* Save history to local storage
* Visualise queries from queryhistory local storage
* Set up query history settings
* Refactor
* Create link, un-refactored verison
* Copyable url
* WIP: Add slider
* Commenting feature
* Slider filtration
* Add headings
* Hide Rich history behind feature toggle
* Cleaning up, refactors
* Update tests
* Implement getQueryDisplayText
* Update lockfile for new dependencies
* Update heading based on sorting
* Fix typescript strinctNullCheck errors
* Fix Forms, new forms
* Fixes based on provided feedback
* Fixes, splitting component into two
* Add tooltips, add delete history button
* Clicking on card adds queries to query rows
* Delete history, width of drawers
* UI/UX changes, updates
* Add number of queries to headings, box shadows
* Fix slider, remove feature toggle
* Fix typo in the beta announcement
* Fix how the rich history state is rendered when initialization
* Move updateFilters when activeDatasourceFilter onlyto RichHistory, remove duplicated code
* Fix typescript strictnull errors, not used variables errors
2020-03-10 09:08:15 -05:00
|
|
|
};
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-11-02 05:22:09 -05:00
|
|
|
onSplitOpen = (panelType: string) => {
|
2023-05-03 10:45:11 -05:00
|
|
|
return async (options?: SplitOpenOptions) => {
|
2022-11-02 05:22:09 -05:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-05-23 03:55:04 -05:00
|
|
|
renderEmptyState(exploreContainerStyles: string) {
|
2019-03-28 11:17:01 -05:00
|
|
|
return (
|
2022-05-23 03:55:04 -05:00
|
|
|
<div className={cx(exploreContainerStyles)}>
|
2019-03-28 11:17:01 -05:00
|
|
|
<NoDataSourceCallToAction />
|
|
|
|
</div>
|
|
|
|
);
|
2021-01-19 09:34:43 -06:00
|
|
|
}
|
|
|
|
|
2022-04-13 10:17:07 -05:00
|
|
|
renderNoData() {
|
|
|
|
return <NoData />;
|
|
|
|
}
|
|
|
|
|
2022-11-21 08:03:50 -06:00
|
|
|
renderCompactUrlWarning() {
|
|
|
|
return (
|
|
|
|
<FadeIn in={true} duration={100}>
|
|
|
|
<Alert severity="warning" title="Compact URL Deprecation Notice" topSpacing={2}>
|
|
|
|
The URL that brought you here was a compact URL - this format will soon be deprecated. Please replace the URL
|
|
|
|
previously saved with the URL available now.
|
|
|
|
</Alert>
|
|
|
|
</FadeIn>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-06-18 07:21:54 -05:00
|
|
|
renderGraphPanel(width: number) {
|
2022-11-16 04:16:27 -06:00
|
|
|
const { graphResult, absoluteRange, timeZone, queryResponse, loading, showFlameGraph } = this.props;
|
2022-10-07 05:39:14 -05:00
|
|
|
|
2021-01-19 09:34:43 -06:00
|
|
|
return (
|
2022-11-16 04:16:27 -06:00
|
|
|
<GraphContainer
|
|
|
|
loading={loading}
|
|
|
|
data={graphResult!}
|
|
|
|
height={showFlameGraph ? 180 : 400}
|
|
|
|
width={width}
|
|
|
|
absoluteRange={absoluteRange}
|
|
|
|
timeZone={timeZone}
|
|
|
|
onChangeTime={this.onUpdateTimeRange}
|
|
|
|
annotations={queryResponse.annotations}
|
|
|
|
splitOpenFn={this.onSplitOpen('graph')}
|
|
|
|
loadingState={queryResponse.state}
|
|
|
|
eventBus={this.graphEventBus}
|
|
|
|
/>
|
2021-01-19 09:34:43 -06:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderTablePanel(width: number) {
|
2022-10-24 09:18:56 -05:00
|
|
|
const { exploreId, timeZone } = this.props;
|
2021-01-19 09:34:43 -06:00
|
|
|
return (
|
|
|
|
<TableContainer
|
|
|
|
ariaLabel={selectors.pages.Explore.General.table}
|
|
|
|
width={width}
|
|
|
|
exploreId={exploreId}
|
2022-10-24 09:18:56 -05:00
|
|
|
onCellFilterAdded={this.onCellFilterAdded}
|
2021-12-02 05:07:23 -06:00
|
|
|
timeZone={timeZone}
|
2022-11-02 05:22:09 -05:00
|
|
|
splitOpenFn={this.onSplitOpen('table')}
|
2021-01-19 09:34:43 -06:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-01-04 10:46:03 -06:00
|
|
|
renderRawPrometheus(width: number) {
|
|
|
|
const { exploreId, datasourceInstance, timeZone } = this.props;
|
|
|
|
return (
|
|
|
|
<RawPrometheusContainer
|
|
|
|
showRawPrometheus={true}
|
|
|
|
ariaLabel={selectors.pages.Explore.General.table}
|
|
|
|
width={width}
|
|
|
|
exploreId={exploreId}
|
|
|
|
onCellFilterAdded={datasourceInstance?.modifyQuery ? this.onCellFilterAdded : undefined}
|
|
|
|
timeZone={timeZone}
|
|
|
|
splitOpenFn={this.onSplitOpen('table')}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-06-18 07:21:54 -05:00
|
|
|
renderLogsPanel(width: number) {
|
2021-09-10 11:18:22 -05:00
|
|
|
const { exploreId, syncedTimes, theme, queryResponse } = this.props;
|
2021-08-13 01:02:49 -05:00
|
|
|
const spacing = parseInt(theme.spacing(2).slice(0, -2), 10);
|
2021-01-19 09:34:43 -06:00
|
|
|
return (
|
|
|
|
<LogsContainer
|
|
|
|
exploreId={exploreId}
|
2021-09-10 11:18:22 -05:00
|
|
|
loadingState={queryResponse.state}
|
2021-01-19 09:34:43 -06:00
|
|
|
syncedTimes={syncedTimes}
|
2021-08-13 01:02:49 -05:00
|
|
|
width={width - spacing}
|
2021-01-19 09:34:43 -06:00
|
|
|
onClickFilterLabel={this.onClickFilterLabel}
|
|
|
|
onClickFilterOutLabel={this.onClickFilterOutLabel}
|
|
|
|
onStartScanning={this.onStartScanning}
|
|
|
|
onStopScanning={this.onStopScanning}
|
2022-11-03 04:55:02 -05:00
|
|
|
eventBus={this.logsEventBus}
|
2022-11-02 05:22:09 -05:00
|
|
|
splitOpenFn={this.onSplitOpen('logs')}
|
2021-01-19 09:34:43 -06:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-01-24 12:10:27 -06:00
|
|
|
renderLogsSamplePanel() {
|
2023-01-26 09:06:10 -06:00
|
|
|
const { logsSample, timeZone, setSupplementaryQueryEnabled, exploreId, datasourceInstance, queries } = this.props;
|
2023-01-24 12:10:27 -06:00
|
|
|
|
|
|
|
return (
|
|
|
|
<LogsSamplePanel
|
|
|
|
queryResponse={logsSample.data}
|
|
|
|
timeZone={timeZone}
|
|
|
|
enabled={logsSample.enabled}
|
2023-01-26 09:06:10 -06:00
|
|
|
queries={queries}
|
2023-01-24 12:10:27 -06:00
|
|
|
datasourceInstance={datasourceInstance}
|
2023-01-26 09:06:10 -06:00
|
|
|
splitOpen={this.onSplitOpen('logsSample')}
|
|
|
|
setLogsSampleEnabled={(enabled: boolean) =>
|
2023-01-24 12:10:27 -06:00
|
|
|
setSupplementaryQueryEnabled(exploreId, enabled, SupplementaryQueryType.LogsSample)
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-01-19 09:34:43 -06:00
|
|
|
renderNodeGraphPanel() {
|
2022-07-11 04:21:24 -05:00
|
|
|
const { exploreId, showTrace, queryResponse, datasourceInstance } = this.props;
|
|
|
|
const datasourceType = datasourceInstance ? datasourceInstance?.type : 'unknown';
|
|
|
|
|
2021-01-19 09:34:43 -06:00
|
|
|
return (
|
|
|
|
<NodeGraphContainer
|
2022-01-27 11:19:54 -06:00
|
|
|
dataFrames={this.memoizedGetNodeGraphDataFrames(queryResponse.series)}
|
2021-01-19 09:34:43 -06:00
|
|
|
exploreId={exploreId}
|
2021-05-26 08:11:47 -05:00
|
|
|
withTraceView={showTrace}
|
2022-07-11 04:21:24 -05:00
|
|
|
datasourceType={datasourceType}
|
2022-11-02 05:22:09 -05:00
|
|
|
splitOpenFn={this.onSplitOpen('nodeGraph')}
|
2021-01-19 09:34:43 -06:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-01-27 11:19:54 -06:00
|
|
|
memoizedGetNodeGraphDataFrames = memoizeOne(getNodeGraphDataFrames);
|
2021-01-19 09:34:43 -06:00
|
|
|
|
2022-10-07 05:39:14 -05:00
|
|
|
renderFlameGraphPanel() {
|
|
|
|
const { queryResponse } = this.props;
|
|
|
|
return <FlameGraphExploreContainer dataFrames={queryResponse.flameGraphFrames} />;
|
|
|
|
}
|
|
|
|
|
2021-01-19 09:34:43 -06:00
|
|
|
renderTraceViewPanel() {
|
2022-11-02 05:22:09 -05:00
|
|
|
const { queryResponse, exploreId } = this.props;
|
2021-01-20 00:59:48 -06:00
|
|
|
const dataFrames = queryResponse.series.filter((series) => series.meta?.preferredVisualisationType === 'trace');
|
2021-01-19 09:34:43 -06:00
|
|
|
|
|
|
|
return (
|
|
|
|
// If there is no data (like 404) we show a separate error so no need to show anything here
|
2021-12-03 04:09:55 -06:00
|
|
|
dataFrames.length && (
|
|
|
|
<TraceViewContainer
|
|
|
|
exploreId={exploreId}
|
|
|
|
dataFrames={dataFrames}
|
2022-11-02 05:22:09 -05:00
|
|
|
splitOpenFn={this.onSplitOpen('traceView')}
|
2021-12-03 04:09:55 -06:00
|
|
|
scrollElement={this.scrollElement}
|
2022-03-14 15:22:37 -05:00
|
|
|
queryResponse={queryResponse}
|
2022-05-03 11:42:36 -05:00
|
|
|
topOfViewRef={this.topOfViewRef}
|
2021-12-03 04:09:55 -06:00
|
|
|
/>
|
|
|
|
)
|
2021-01-19 09:34:43 -06:00
|
|
|
);
|
|
|
|
}
|
2019-03-28 11:17:01 -05:00
|
|
|
|
2018-04-26 04:58:42 -05:00
|
|
|
render() {
|
|
|
|
const {
|
2019-01-10 07:24:31 -06:00
|
|
|
datasourceInstance,
|
2018-07-13 02:09:36 -05:00
|
|
|
datasourceMissing,
|
2019-01-11 11:26:56 -06:00
|
|
|
exploreId,
|
2019-08-13 00:32:43 -05:00
|
|
|
graphResult,
|
2019-09-03 02:55:20 -05:00
|
|
|
queryResponse,
|
2019-12-23 05:29:00 -06:00
|
|
|
isLive,
|
2020-04-16 07:28:46 -05:00
|
|
|
theme,
|
2020-07-09 09:14:55 -05:00
|
|
|
showMetrics,
|
|
|
|
showTable,
|
2023-01-04 10:46:03 -06:00
|
|
|
showRawPrometheus,
|
2020-07-09 09:14:55 -05:00
|
|
|
showLogs,
|
|
|
|
showTrace,
|
2021-01-19 09:34:43 -06:00
|
|
|
showNodeGraph,
|
2022-10-07 05:39:14 -05:00
|
|
|
showFlameGraph,
|
2021-12-02 05:07:23 -06:00
|
|
|
timeZone,
|
2022-11-21 08:03:50 -06:00
|
|
|
isFromCompactUrl,
|
2023-01-24 12:10:27 -06:00
|
|
|
showLogsSample,
|
2019-01-10 07:24:31 -06:00
|
|
|
} = this.props;
|
2020-08-06 10:22:54 -05:00
|
|
|
const { openDrawer } = this.state;
|
2020-04-16 07:28:46 -05:00
|
|
|
const styles = getStyles(theme);
|
2021-01-19 16:52:09 -06:00
|
|
|
const showPanels = queryResponse && queryResponse.state !== LoadingState.NotStarted;
|
2020-08-06 10:22:54 -05:00
|
|
|
const showRichHistory = openDrawer === ExploreDrawer.RichHistory;
|
2022-06-02 08:51:11 -05:00
|
|
|
const richHistoryRowButtonHidden = !supportedFeatures().queryHistoryAvailable;
|
2020-08-06 10:22:54 -05:00
|
|
|
const showQueryInspector = openDrawer === ExploreDrawer.QueryInspector;
|
2022-04-13 10:17:07 -05:00
|
|
|
const showNoData =
|
|
|
|
queryResponse.state === LoadingState.Done &&
|
|
|
|
[
|
|
|
|
queryResponse.logsFrames,
|
|
|
|
queryResponse.graphFrames,
|
|
|
|
queryResponse.nodeGraphFrames,
|
2022-10-07 05:39:14 -05:00
|
|
|
queryResponse.flameGraphFrames,
|
2022-04-13 10:17:07 -05:00
|
|
|
queryResponse.tableFrames,
|
2023-01-04 10:46:03 -06:00
|
|
|
queryResponse.rawPrometheusFrames,
|
2022-04-13 10:17:07 -05:00
|
|
|
queryResponse.traceFrames,
|
|
|
|
].every((e) => e.length === 0);
|
2020-08-06 10:22:54 -05:00
|
|
|
|
2018-04-26 04:58:42 -05:00
|
|
|
return (
|
2021-12-03 04:09:55 -06:00
|
|
|
<CustomScrollbar
|
2022-05-03 09:28:40 -05:00
|
|
|
testId={selectors.pages.Explore.General.scrollView}
|
2021-12-03 04:09:55 -06:00
|
|
|
autoHeightMin={'100%'}
|
|
|
|
scrollRefCallback={(scrollElement) => (this.scrollElement = scrollElement || undefined)}
|
|
|
|
>
|
2022-05-03 11:42:36 -05:00
|
|
|
<ExploreToolbar exploreId={exploreId} onChangeTime={this.onChangeTime} topOfViewRef={this.topOfViewRef} />
|
2022-11-21 08:03:50 -06:00
|
|
|
{isFromCompactUrl ? this.renderCompactUrlWarning() : null}
|
2022-05-23 03:55:04 -05:00
|
|
|
{datasourceMissing ? this.renderEmptyState(styles.exploreContainer) : null}
|
2019-04-01 00:38:00 -05:00
|
|
|
{datasourceInstance && (
|
2023-01-05 16:26:58 -06:00
|
|
|
<div className={styles.exploreContainer}>
|
2022-05-31 07:43:23 -05:00
|
|
|
<PanelContainer className={styles.queryContainer}>
|
2021-09-15 10:26:23 -05:00
|
|
|
<QueryRows exploreId={exploreId} />
|
2020-04-16 07:28:46 -05:00
|
|
|
<SecondaryActions
|
|
|
|
addQueryRowButtonDisabled={isLive}
|
|
|
|
// We cannot show multiple traces at the same time right now so we do not show add query button.
|
2020-07-09 09:14:55 -05:00
|
|
|
//TODO:unification
|
|
|
|
addQueryRowButtonHidden={false}
|
2022-06-02 08:51:11 -05:00
|
|
|
richHistoryRowButtonHidden={richHistoryRowButtonHidden}
|
2020-04-16 07:28:46 -05:00
|
|
|
richHistoryButtonActive={showRichHistory}
|
2020-08-06 10:22:54 -05:00
|
|
|
queryInspectorButtonActive={showQueryInspector}
|
2020-04-16 07:28:46 -05:00
|
|
|
onClickAddQueryRowButton={this.onClickAddQueryRowButton}
|
|
|
|
onClickRichHistoryButton={this.toggleShowRichHistory}
|
2020-08-06 10:22:54 -05:00
|
|
|
onClickQueryInspectorButton={this.toggleShowQueryInspector}
|
2020-04-16 07:28:46 -05:00
|
|
|
/>
|
2021-04-27 08:13:08 -05:00
|
|
|
<ResponseErrorContainer exploreId={exploreId} />
|
2022-05-31 07:43:23 -05:00
|
|
|
</PanelContainer>
|
2020-04-08 10:16:22 -05:00
|
|
|
<AutoSizer onResize={this.onResize} disableHeight>
|
2019-02-19 08:41:35 -06:00
|
|
|
{({ width }) => {
|
|
|
|
if (width === 0) {
|
|
|
|
return null;
|
|
|
|
}
|
2019-02-07 11:20:16 -06:00
|
|
|
|
2019-02-19 08:41:35 -06:00
|
|
|
return (
|
2020-12-15 08:18:12 -06:00
|
|
|
<main className={cx(styles.exploreMain)} style={{ width }}>
|
2019-09-04 06:59:30 -05:00
|
|
|
<ErrorBoundaryAlert>
|
2021-01-19 16:52:09 -06:00
|
|
|
{showPanels && (
|
2019-02-19 08:41:35 -06:00
|
|
|
<>
|
2021-05-10 13:25:30 -05:00
|
|
|
{showMetrics && graphResult && (
|
2021-06-18 07:21:54 -05:00
|
|
|
<ErrorBoundaryAlert>{this.renderGraphPanel(width)}</ErrorBoundaryAlert>
|
2021-05-10 13:25:30 -05:00
|
|
|
)}
|
2023-01-04 10:46:03 -06:00
|
|
|
{showRawPrometheus && (
|
|
|
|
<ErrorBoundaryAlert>{this.renderRawPrometheus(width)}</ErrorBoundaryAlert>
|
|
|
|
)}
|
2021-05-10 13:25:30 -05:00
|
|
|
{showTable && <ErrorBoundaryAlert>{this.renderTablePanel(width)}</ErrorBoundaryAlert>}
|
2021-06-18 07:21:54 -05:00
|
|
|
{showLogs && <ErrorBoundaryAlert>{this.renderLogsPanel(width)}</ErrorBoundaryAlert>}
|
2021-05-10 13:25:30 -05:00
|
|
|
{showNodeGraph && <ErrorBoundaryAlert>{this.renderNodeGraphPanel()}</ErrorBoundaryAlert>}
|
2023-03-01 05:32:39 -06:00
|
|
|
{showFlameGraph && <ErrorBoundaryAlert>{this.renderFlameGraphPanel()}</ErrorBoundaryAlert>}
|
2021-05-10 13:25:30 -05:00
|
|
|
{showTrace && <ErrorBoundaryAlert>{this.renderTraceViewPanel()}</ErrorBoundaryAlert>}
|
2023-01-27 10:30:25 -06:00
|
|
|
{config.featureToggles.logsSampleInExplore && showLogsSample && (
|
|
|
|
<ErrorBoundaryAlert>{this.renderLogsSamplePanel()}</ErrorBoundaryAlert>
|
|
|
|
)}
|
2022-04-13 10:17:07 -05:00
|
|
|
{showNoData && <ErrorBoundaryAlert>{this.renderNoData()}</ErrorBoundaryAlert>}
|
2019-02-19 08:41:35 -06:00
|
|
|
</>
|
|
|
|
)}
|
2020-03-17 10:06:02 -05:00
|
|
|
{showRichHistory && (
|
|
|
|
<RichHistoryContainer
|
|
|
|
width={width}
|
|
|
|
exploreId={exploreId}
|
|
|
|
onClose={this.toggleShowRichHistory}
|
|
|
|
/>
|
|
|
|
)}
|
2020-08-06 10:22:54 -05:00
|
|
|
{showQueryInspector && (
|
|
|
|
<ExploreQueryInspector
|
|
|
|
exploreId={exploreId}
|
|
|
|
width={width}
|
|
|
|
onClose={this.toggleShowQueryInspector}
|
2021-12-02 05:07:23 -06:00
|
|
|
timeZone={timeZone}
|
2020-08-06 10:22:54 -05:00
|
|
|
/>
|
|
|
|
)}
|
2019-09-04 06:59:30 -05:00
|
|
|
</ErrorBoundaryAlert>
|
2019-02-19 08:41:35 -06:00
|
|
|
</main>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
</AutoSizer>
|
|
|
|
</div>
|
|
|
|
)}
|
2021-04-15 03:44:25 -05:00
|
|
|
</CustomScrollbar>
|
2018-04-26 04:58:42 -05:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-22 04:43:13 -05:00
|
|
|
function mapStateToProps(state: StoreState, { exploreId }: ExploreProps) {
|
2019-01-11 11:26:56 -06:00
|
|
|
const explore = state.explore;
|
2021-10-18 05:22:41 -05:00
|
|
|
const { syncedTimes } = explore;
|
2023-05-03 10:45:11 -05:00
|
|
|
const item: ExploreItemState = explore.panes[exploreId]!;
|
2019-04-29 11:28:41 -05:00
|
|
|
const timeZone = getTimeZone(state.user);
|
2019-01-10 07:24:31 -06:00
|
|
|
const {
|
|
|
|
datasourceInstance,
|
|
|
|
datasourceMissing,
|
2019-02-04 06:41:29 -06:00
|
|
|
queryKeys,
|
2022-11-02 05:22:09 -05:00
|
|
|
queries,
|
2019-05-20 06:28:23 -05:00
|
|
|
isLive,
|
2019-08-13 00:32:43 -05:00
|
|
|
graphResult,
|
2023-01-24 12:10:27 -06:00
|
|
|
tableResult,
|
2020-07-09 09:14:55 -05:00
|
|
|
logsResult,
|
|
|
|
showLogs,
|
|
|
|
showMetrics,
|
|
|
|
showTable,
|
|
|
|
showTrace,
|
2019-08-26 01:11:07 -05:00
|
|
|
absoluteRange,
|
2019-09-03 02:55:20 -05:00
|
|
|
queryResponse,
|
2021-01-19 09:34:43 -06:00
|
|
|
showNodeGraph,
|
2022-10-07 05:39:14 -05:00
|
|
|
showFlameGraph,
|
2021-01-22 11:15:06 -06:00
|
|
|
loading,
|
2022-11-21 08:03:50 -06:00
|
|
|
isFromCompactUrl,
|
2023-01-04 10:46:03 -06:00
|
|
|
showRawPrometheus,
|
2023-01-24 12:10:27 -06:00
|
|
|
supplementaryQueries,
|
2019-01-11 11:26:56 -06:00
|
|
|
} = item;
|
2019-04-29 11:28:41 -05:00
|
|
|
|
2023-01-24 12:10:27 -06:00
|
|
|
const logsSample = supplementaryQueries[SupplementaryQueryType.LogsSample];
|
|
|
|
// We want to show logs sample only if there are no log results and if there is already graph or table result
|
|
|
|
const showLogsSample = !!(logsSample.dataProvider !== undefined && !logsResult && (graphResult || tableResult));
|
|
|
|
|
2019-01-10 07:24:31 -06:00
|
|
|
return {
|
|
|
|
datasourceInstance,
|
|
|
|
datasourceMissing,
|
2019-02-04 06:41:29 -06:00
|
|
|
queryKeys,
|
2022-11-02 05:22:09 -05:00
|
|
|
queries,
|
2019-05-20 06:28:23 -05:00
|
|
|
isLive,
|
2021-01-15 09:20:20 -06:00
|
|
|
graphResult,
|
2020-07-09 09:14:55 -05:00
|
|
|
logsResult: logsResult ?? undefined,
|
2019-08-26 01:11:07 -05:00
|
|
|
absoluteRange,
|
2019-09-03 02:55:20 -05:00
|
|
|
queryResponse,
|
2019-10-08 11:55:53 -05:00
|
|
|
syncedTimes,
|
2019-12-03 02:38:47 -06:00
|
|
|
timeZone,
|
2020-07-09 09:14:55 -05:00
|
|
|
showLogs,
|
|
|
|
showMetrics,
|
|
|
|
showTable,
|
|
|
|
showTrace,
|
2021-01-19 09:34:43 -06:00
|
|
|
showNodeGraph,
|
2023-01-04 10:46:03 -06:00
|
|
|
showRawPrometheus,
|
2022-10-07 05:39:14 -05:00
|
|
|
showFlameGraph,
|
2022-10-11 06:59:17 -05:00
|
|
|
splitted: isSplit(state),
|
2021-01-22 11:15:06 -06:00
|
|
|
loading,
|
2022-11-21 08:03:50 -06:00
|
|
|
isFromCompactUrl: isFromCompactUrl || false,
|
2023-01-24 12:10:27 -06:00
|
|
|
logsSample,
|
|
|
|
showLogsSample,
|
2019-01-10 07:24:31 -06:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-06-22 04:43:13 -05:00
|
|
|
const mapDispatchToProps = {
|
2019-01-11 11:26:56 -06:00
|
|
|
changeSize,
|
2019-01-10 07:24:31 -06:00
|
|
|
modifyQueries,
|
|
|
|
scanStart,
|
2019-02-04 00:47:10 -06:00
|
|
|
scanStopAction,
|
2019-01-15 12:52:53 -06:00
|
|
|
setQueries,
|
2019-06-25 07:44:19 -05:00
|
|
|
updateTimeRange,
|
2022-01-07 09:51:29 -06:00
|
|
|
makeAbsoluteTime,
|
2019-12-23 05:29:00 -06:00
|
|
|
addQueryRow,
|
2020-10-14 17:03:14 -05:00
|
|
|
splitOpen,
|
2023-01-24 12:10:27 -06:00
|
|
|
setSupplementaryQueryEnabled,
|
2019-01-10 07:24:31 -06:00
|
|
|
};
|
|
|
|
|
2021-06-22 04:43:13 -05:00
|
|
|
const connector = connect(mapStateToProps, mapDispatchToProps);
|
|
|
|
|
2022-11-03 04:55:02 -05:00
|
|
|
export default withTheme2(connector(Explore));
|