2019-01-22 07:50:19 -06:00
|
|
|
import React, { PureComponent } from 'react';
|
2021-06-22 01:24:19 -05:00
|
|
|
import { connect, ConnectedProps } from 'react-redux';
|
2019-09-05 07:44:37 -05:00
|
|
|
import classNames from 'classnames';
|
2021-04-01 07:15:23 -05:00
|
|
|
import { css } from '@emotion/css';
|
2019-01-24 06:19:33 -06:00
|
|
|
|
2020-02-06 06:34:52 -06:00
|
|
|
import { ExploreId, ExploreItemState } from 'app/types/explore';
|
2021-01-25 07:01:54 -06:00
|
|
|
import { Icon, IconButton, SetInterval, ToolbarButton, ToolbarButtonRow, Tooltip } from '@grafana/ui';
|
2021-06-22 01:24:19 -05:00
|
|
|
import { DataSourceInstanceSettings, RawTimeRange } from '@grafana/data';
|
2021-03-18 04:44:26 -05:00
|
|
|
import { DataSourcePicker } from '@grafana/runtime';
|
2019-01-24 06:19:33 -06:00
|
|
|
import { StoreState } from 'app/types/store';
|
2020-10-22 03:31:58 -05:00
|
|
|
import { createAndCopyShortLink } from 'app/core/utils/shortLinks';
|
2020-11-09 07:48:24 -06:00
|
|
|
import { changeDatasource } from './state/datasource';
|
|
|
|
import { splitClose, splitOpen } from './state/main';
|
|
|
|
import { syncTimes, changeRefreshInterval } from './state/time';
|
2019-04-29 11:28:41 -05:00
|
|
|
import { getTimeZone } from '../profile/state/selectors';
|
2020-06-26 02:08:15 -05:00
|
|
|
import { updateTimeZoneForSession } from '../profile/state/reducers';
|
2019-06-28 05:07:55 -05:00
|
|
|
import { ExploreTimeControls } from './ExploreTimeControls';
|
2019-09-17 04:25:12 -05:00
|
|
|
import { LiveTailButton } from './LiveTailButton';
|
|
|
|
import { RunButton } from './RunButton';
|
2019-09-24 03:18:34 -05:00
|
|
|
import { LiveTailControls } from './useLiveTailControls';
|
2021-07-12 10:54:17 -05:00
|
|
|
import { cancelQueries, clearQueries, runQueries } from './state/query';
|
2020-12-15 03:12:53 -06:00
|
|
|
import ReturnToDashboardButton from './ReturnToDashboardButton';
|
2021-02-12 14:33:26 -06:00
|
|
|
import { isSplit } from './state/selectors';
|
2020-06-11 07:54:02 -05:00
|
|
|
|
2019-01-24 06:19:33 -06:00
|
|
|
interface OwnProps {
|
|
|
|
exploreId: ExploreId;
|
2019-04-29 11:28:41 -05:00
|
|
|
onChangeTime: (range: RawTimeRange, changedByScanner?: boolean) => void;
|
2019-01-24 06:19:33 -06:00
|
|
|
}
|
|
|
|
|
2021-06-22 01:24:19 -05:00
|
|
|
type Props = OwnProps & ConnectedProps<typeof connector>;
|
2019-01-24 06:19:33 -06:00
|
|
|
|
2019-11-06 13:19:50 -06:00
|
|
|
export class UnConnectedExploreToolbar extends PureComponent<Props> {
|
2020-12-04 07:24:55 -06:00
|
|
|
onChangeDatasource = async (dsSettings: DataSourceInstanceSettings) => {
|
|
|
|
this.props.changeDatasource(this.props.exploreId, dsSettings.name, { importQueries: true });
|
2019-01-24 06:19:33 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
onClearAll = () => {
|
|
|
|
this.props.clearAll(this.props.exploreId);
|
|
|
|
};
|
|
|
|
|
2020-03-25 05:38:14 -05:00
|
|
|
onRunQuery = (loading = false) => {
|
2021-07-12 10:54:17 -05:00
|
|
|
const { runQueries, cancelQueries, exploreId } = this.props;
|
2020-03-25 05:38:14 -05:00
|
|
|
if (loading) {
|
2021-05-24 06:56:48 -05:00
|
|
|
return cancelQueries(exploreId);
|
2020-03-25 05:38:14 -05:00
|
|
|
} else {
|
2021-05-24 06:56:48 -05:00
|
|
|
return runQueries(exploreId);
|
2020-03-25 05:38:14 -05:00
|
|
|
}
|
2019-01-24 06:19:33 -06:00
|
|
|
};
|
|
|
|
|
2019-04-16 02:15:23 -05:00
|
|
|
onChangeRefreshInterval = (item: string) => {
|
|
|
|
const { changeRefreshInterval, exploreId } = this.props;
|
|
|
|
changeRefreshInterval(exploreId, item);
|
|
|
|
};
|
|
|
|
|
2019-10-08 11:55:53 -05:00
|
|
|
onChangeTimeSync = () => {
|
|
|
|
const { syncTimes, exploreId } = this.props;
|
|
|
|
syncTimes(exploreId);
|
|
|
|
};
|
|
|
|
|
2019-01-22 07:50:19 -06:00
|
|
|
render() {
|
2019-01-24 05:00:10 -06:00
|
|
|
const {
|
|
|
|
datasourceMissing,
|
2019-04-16 02:15:23 -05:00
|
|
|
closeSplit,
|
2019-01-24 05:00:10 -06:00
|
|
|
exploreId,
|
|
|
|
loading,
|
2019-01-24 06:19:33 -06:00
|
|
|
range,
|
2019-04-29 11:28:41 -05:00
|
|
|
timeZone,
|
2019-01-24 05:00:10 -06:00
|
|
|
splitted,
|
2019-10-08 11:55:53 -05:00
|
|
|
syncedTimes,
|
2019-04-16 02:15:23 -05:00
|
|
|
refreshInterval,
|
|
|
|
onChangeTime,
|
|
|
|
split,
|
2019-05-20 06:28:23 -05:00
|
|
|
hasLiveOption,
|
|
|
|
isLive,
|
2019-09-17 04:25:12 -05:00
|
|
|
isPaused,
|
2019-11-06 13:19:50 -06:00
|
|
|
containerWidth,
|
2020-06-26 02:08:15 -05:00
|
|
|
onChangeTimeZone,
|
2019-01-24 05:00:10 -06:00
|
|
|
} = this.props;
|
2019-01-22 07:50:19 -06:00
|
|
|
|
2019-11-12 18:01:32 -06:00
|
|
|
const showSmallDataSourcePicker = (splitted ? containerWidth < 700 : containerWidth < 800) || false;
|
2019-11-06 13:19:50 -06:00
|
|
|
const showSmallTimePicker = splitted || containerWidth < 1210;
|
|
|
|
|
2019-01-22 07:50:19 -06:00
|
|
|
return (
|
2019-01-28 05:21:04 -06:00
|
|
|
<div className={splitted ? 'explore-toolbar splitted' : 'explore-toolbar'}>
|
|
|
|
<div className="explore-toolbar-item">
|
|
|
|
<div className="explore-toolbar-header">
|
|
|
|
<div className="explore-toolbar-header-title">
|
2019-01-23 08:57:24 -06:00
|
|
|
{exploreId === 'left' && (
|
2019-02-04 04:19:45 -06:00
|
|
|
<span className="navbar-page-btn">
|
@grafana/ui: Create Icon component and replace part of the icons (#23402)
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Resolve type errors resulted from merge
* Part2: Unicons implementation (#23266)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Icons update
* Add optional chaining to for isFontAwesome variable
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Part3: Unicons implementation (#23356)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Update icons in Explore
* Update icons in alerting
* Update + and x buttons
* Update icons in configurations and settings
* Update close icons
* Update icons in rich history
* Update alert messages
* Add optional chaining to for isFontAwesome variable
* Remove icon mock, set up jest.config
* Fix navbar plus icon
* Fir enable-bacground to enableBackgournd
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Merge remote branch origin master to icons-unicons
* Revert "Merge remote branch origin master to icons-unicons"
This reverts commit 3f25d50a39a940883fefe73ce51219139c1ed37f.
* Size-up dashnav icons
* Fix alerting icons, panel headers, update tests
* Fix typecheck error
* Adjustments - add panel icon, spacing
* Set TerserPlugin sourceMap to false to prevent running out of memory when publishing storybook
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-04-08 07:33:31 -05:00
|
|
|
<Icon
|
|
|
|
name="compass"
|
|
|
|
size="lg"
|
|
|
|
className={css`
|
|
|
|
margin-right: 6px;
|
|
|
|
margin-bottom: 3px;
|
|
|
|
`}
|
|
|
|
/>
|
2019-01-23 08:57:24 -06:00
|
|
|
Explore
|
2019-02-04 04:19:45 -06:00
|
|
|
</span>
|
2019-01-23 08:57:24 -06:00
|
|
|
)}
|
|
|
|
</div>
|
2019-03-25 10:44:09 -05:00
|
|
|
{splitted && (
|
2021-02-12 14:33:26 -06:00
|
|
|
<IconButton
|
|
|
|
title="Close split pane"
|
|
|
|
className="explore-toolbar-header-close"
|
|
|
|
onClick={() => closeSplit(exploreId)}
|
|
|
|
name="times"
|
|
|
|
/>
|
2019-03-25 10:44:09 -05:00
|
|
|
)}
|
2019-01-22 07:50:19 -06:00
|
|
|
</div>
|
2019-01-23 08:57:24 -06:00
|
|
|
</div>
|
2019-01-28 05:21:04 -06:00
|
|
|
<div className="explore-toolbar-item">
|
|
|
|
<div className="explore-toolbar-content">
|
2019-01-24 04:27:48 -06:00
|
|
|
{!datasourceMissing ? (
|
2019-01-28 05:21:04 -06:00
|
|
|
<div className="explore-toolbar-content-item">
|
2019-11-06 13:19:50 -06:00
|
|
|
<div
|
|
|
|
className={classNames(
|
|
|
|
'explore-ds-picker',
|
|
|
|
showSmallDataSourcePicker ? 'explore-ds-picker--small' : ''
|
|
|
|
)}
|
|
|
|
>
|
2019-01-24 05:00:10 -06:00
|
|
|
<DataSourcePicker
|
2019-01-24 06:19:33 -06:00
|
|
|
onChange={this.onChangeDatasource}
|
2020-12-04 07:24:55 -06:00
|
|
|
current={this.props.datasourceName}
|
2019-11-06 13:19:50 -06:00
|
|
|
hideTextValue={showSmallDataSourcePicker}
|
2019-01-24 05:00:10 -06:00
|
|
|
/>
|
|
|
|
</div>
|
2019-01-23 08:57:24 -06:00
|
|
|
</div>
|
|
|
|
) : null}
|
2021-01-25 07:01:54 -06:00
|
|
|
<ToolbarButtonRow>
|
|
|
|
<ReturnToDashboardButton exploreId={exploreId} />
|
|
|
|
|
|
|
|
{exploreId === 'left' && !splitted ? (
|
|
|
|
<ToolbarButton
|
|
|
|
iconOnly={splitted}
|
2019-09-17 04:25:12 -05:00
|
|
|
title="Split"
|
2021-01-25 07:01:54 -06:00
|
|
|
/* This way ToolbarButton doesn't add event as a parameter when invoking split function
|
2020-04-23 04:20:07 -05:00
|
|
|
* which breaks splitting functionality
|
|
|
|
*/
|
|
|
|
onClick={() => split()}
|
@grafana/ui: Create Icon component and replace part of the icons (#23402)
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Resolve type errors resulted from merge
* Part2: Unicons implementation (#23266)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Icons update
* Add optional chaining to for isFontAwesome variable
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Part3: Unicons implementation (#23356)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Update icons in Explore
* Update icons in alerting
* Update + and x buttons
* Update icons in configurations and settings
* Update close icons
* Update icons in rich history
* Update alert messages
* Add optional chaining to for isFontAwesome variable
* Remove icon mock, set up jest.config
* Fix navbar plus icon
* Fir enable-bacground to enableBackgournd
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Merge remote branch origin master to icons-unicons
* Revert "Merge remote branch origin master to icons-unicons"
This reverts commit 3f25d50a39a940883fefe73ce51219139c1ed37f.
* Size-up dashnav icons
* Fix alerting icons, panel headers, update tests
* Fix typecheck error
* Adjustments - add panel icon, spacing
* Set TerserPlugin sourceMap to false to prevent running out of memory when publishing storybook
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-04-08 07:33:31 -05:00
|
|
|
icon="columns"
|
2019-09-17 04:25:12 -05:00
|
|
|
disabled={isLive}
|
2021-01-25 07:01:54 -06:00
|
|
|
>
|
|
|
|
Split
|
|
|
|
</ToolbarButton>
|
|
|
|
) : null}
|
|
|
|
|
2021-07-02 09:14:55 -05:00
|
|
|
<Tooltip content={'Copy shortened link to the executed query'} placement="bottom">
|
2021-01-25 07:01:54 -06:00
|
|
|
<ToolbarButton icon="share-alt" onClick={() => createAndCopyShortLink(window.location.href)} />
|
2020-10-14 10:08:27 -05:00
|
|
|
</Tooltip>
|
2021-01-25 07:01:54 -06:00
|
|
|
|
|
|
|
{!isLive && (
|
2019-09-17 04:25:12 -05:00
|
|
|
<ExploreTimeControls
|
|
|
|
exploreId={exploreId}
|
|
|
|
range={range}
|
|
|
|
timeZone={timeZone}
|
|
|
|
onChangeTime={onChangeTime}
|
2019-10-08 11:55:53 -05:00
|
|
|
splitted={splitted}
|
|
|
|
syncedTimes={syncedTimes}
|
|
|
|
onChangeTimeSync={this.onChangeTimeSync}
|
2019-11-06 13:19:50 -06:00
|
|
|
hideText={showSmallTimePicker}
|
2020-06-26 02:08:15 -05:00
|
|
|
onChangeTimeZone={onChangeTimeZone}
|
2019-09-17 04:25:12 -05:00
|
|
|
/>
|
2021-01-25 07:01:54 -06:00
|
|
|
)}
|
|
|
|
|
|
|
|
{!isLive && (
|
|
|
|
<ToolbarButton title="Clear all" onClick={this.onClearAll} icon="trash-alt" iconOnly={splitted}>
|
|
|
|
Clear all
|
|
|
|
</ToolbarButton>
|
|
|
|
)}
|
2019-04-16 02:15:23 -05:00
|
|
|
|
2019-09-17 04:25:12 -05:00
|
|
|
<RunButton
|
|
|
|
refreshInterval={refreshInterval}
|
|
|
|
onChangeRefreshInterval={this.onChangeRefreshInterval}
|
2021-01-23 01:17:50 -06:00
|
|
|
isSmall={splitted || showSmallTimePicker}
|
2020-05-05 03:40:47 -05:00
|
|
|
isLive={isLive}
|
2019-09-17 04:25:12 -05:00
|
|
|
loading={loading || (isLive && !isPaused)}
|
|
|
|
onRun={this.onRunQuery}
|
|
|
|
showDropdown={!isLive}
|
|
|
|
/>
|
2021-01-25 07:01:54 -06:00
|
|
|
|
2019-09-17 04:25:12 -05:00
|
|
|
{refreshInterval && <SetInterval func={this.onRunQuery} interval={refreshInterval} loading={loading} />}
|
|
|
|
|
2021-01-25 07:01:54 -06:00
|
|
|
{hasLiveOption && (
|
2019-09-24 03:18:34 -05:00
|
|
|
<LiveTailControls exploreId={exploreId}>
|
2021-01-20 00:59:48 -06:00
|
|
|
{(controls) => (
|
2019-09-24 03:18:34 -05:00
|
|
|
<LiveTailButton
|
2019-10-10 15:16:04 -05:00
|
|
|
splitted={splitted}
|
2019-09-24 03:18:34 -05:00
|
|
|
isLive={isLive}
|
|
|
|
isPaused={isPaused}
|
|
|
|
start={controls.start}
|
|
|
|
pause={controls.pause}
|
|
|
|
resume={controls.resume}
|
|
|
|
stop={controls.stop}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</LiveTailControls>
|
2021-01-25 07:01:54 -06:00
|
|
|
)}
|
|
|
|
</ToolbarButtonRow>
|
2019-01-22 07:50:19 -06:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-01-24 06:19:33 -06:00
|
|
|
|
2021-06-22 01:24:19 -05:00
|
|
|
const mapStateToProps = (state: StoreState, { exploreId }: OwnProps) => {
|
2019-10-08 11:55:53 -05:00
|
|
|
const syncedTimes = state.explore.syncedTimes;
|
2021-02-12 14:33:26 -06:00
|
|
|
const exploreItem: ExploreItemState = state.explore[exploreId]!;
|
2019-04-16 02:15:23 -05:00
|
|
|
const {
|
|
|
|
datasourceInstance,
|
|
|
|
datasourceMissing,
|
|
|
|
range,
|
|
|
|
refreshInterval,
|
2019-09-03 02:55:20 -05:00
|
|
|
loading,
|
2019-05-20 06:28:23 -05:00
|
|
|
isLive,
|
2019-09-17 04:25:12 -05:00
|
|
|
isPaused,
|
2019-11-06 13:19:50 -06:00
|
|
|
containerWidth,
|
2019-04-16 02:15:23 -05:00
|
|
|
} = exploreItem;
|
2019-12-05 04:22:46 -06:00
|
|
|
|
2020-07-09 09:14:55 -05:00
|
|
|
const hasLiveOption = !!datasourceInstance?.meta?.streaming;
|
2019-01-24 06:19:33 -06:00
|
|
|
|
|
|
|
return {
|
|
|
|
datasourceMissing,
|
2019-12-05 04:22:46 -06:00
|
|
|
datasourceName: datasourceInstance?.name,
|
2019-01-24 06:19:33 -06:00
|
|
|
loading,
|
|
|
|
range,
|
2019-04-29 11:28:41 -05:00
|
|
|
timeZone: getTimeZone(state.user),
|
2021-02-12 14:33:26 -06:00
|
|
|
splitted: isSplit(state),
|
2019-04-16 02:15:23 -05:00
|
|
|
refreshInterval,
|
2019-05-20 06:28:23 -05:00
|
|
|
hasLiveOption,
|
|
|
|
isLive,
|
2019-09-17 04:25:12 -05:00
|
|
|
isPaused,
|
2019-10-08 11:55:53 -05:00
|
|
|
syncedTimes,
|
2019-11-06 13:19:50 -06:00
|
|
|
containerWidth,
|
2019-01-24 06:19:33 -06:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-06-22 01:24:19 -05:00
|
|
|
const mapDispatchToProps = {
|
2019-01-24 06:19:33 -06:00
|
|
|
changeDatasource,
|
2019-04-16 02:15:23 -05:00
|
|
|
changeRefreshInterval,
|
2019-01-24 06:19:33 -06:00
|
|
|
clearAll: clearQueries,
|
2020-03-25 05:38:14 -05:00
|
|
|
cancelQueries,
|
2019-04-16 02:15:23 -05:00
|
|
|
runQueries,
|
2019-01-24 06:19:33 -06:00
|
|
|
closeSplit: splitClose,
|
|
|
|
split: splitOpen,
|
2019-10-08 11:55:53 -05:00
|
|
|
syncTimes,
|
2020-06-26 02:08:15 -05:00
|
|
|
onChangeTimeZone: updateTimeZoneForSession,
|
2019-01-24 06:19:33 -06:00
|
|
|
};
|
|
|
|
|
2021-06-22 01:24:19 -05:00
|
|
|
const connector = connect(mapStateToProps, mapDispatchToProps);
|
|
|
|
|
2021-08-31 05:55:05 -05:00
|
|
|
export const ExploreToolbar = connector(UnConnectedExploreToolbar);
|