2019-01-22 07:50:19 -06:00
|
|
|
import React, { PureComponent } from 'react';
|
2019-01-24 06:19:33 -06:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { hot } from 'react-hot-loader';
|
2019-08-29 06:41:45 -05:00
|
|
|
import memoizeOne from 'memoize-one';
|
2019-09-05 07:44:37 -05:00
|
|
|
import classNames from 'classnames';
|
2019-09-20 06:00:11 -05:00
|
|
|
import { css } from 'emotion';
|
2019-01-24 06:19:33 -06:00
|
|
|
|
2020-02-06 06:34:52 -06:00
|
|
|
import { ExploreId, ExploreItemState } from 'app/types/explore';
|
2020-12-15 03:12:53 -06:00
|
|
|
import { Icon, IconButton, SetInterval, Tooltip } from '@grafana/ui';
|
|
|
|
import { DataSourceInstanceSettings, RawTimeRange, TimeRange, TimeZone } from '@grafana/data';
|
2019-01-23 08:57:24 -06:00
|
|
|
import { DataSourcePicker } from 'app/core/components/Select/DataSourcePicker';
|
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 { ResponsiveButton } from './ResponsiveButton';
|
|
|
|
import { RunButton } from './RunButton';
|
2019-09-24 03:18:34 -05:00
|
|
|
import { LiveTailControls } from './useLiveTailControls';
|
2020-11-09 07:48:24 -06:00
|
|
|
import { cancelQueries, clearQueries, runQueries } from './state/query';
|
2020-12-15 03:12:53 -06:00
|
|
|
import ReturnToDashboardButton from './ReturnToDashboardButton';
|
2020-06-11 07:54:02 -05:00
|
|
|
|
2019-09-20 06:00:11 -05:00
|
|
|
const getStyles = memoizeOne(() => {
|
|
|
|
return {
|
|
|
|
liveTailButtons: css`
|
|
|
|
margin-left: 10px;
|
2019-10-07 16:28:16 -05:00
|
|
|
@media (max-width: 1110px) {
|
|
|
|
margin-left: 4px;
|
|
|
|
}
|
2019-09-20 06:00:11 -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
|
|
|
}
|
|
|
|
|
|
|
|
interface StateProps {
|
2019-01-24 02:26:48 -06:00
|
|
|
datasourceMissing: boolean;
|
|
|
|
loading: boolean;
|
2019-04-29 11:28:41 -05:00
|
|
|
range: TimeRange;
|
|
|
|
timeZone: TimeZone;
|
2019-01-24 02:26:48 -06:00
|
|
|
splitted: boolean;
|
2019-10-08 11:55:53 -05:00
|
|
|
syncedTimes: boolean;
|
2019-11-26 03:01:32 -06:00
|
|
|
refreshInterval?: string;
|
2019-05-20 06:28:23 -05:00
|
|
|
hasLiveOption: boolean;
|
|
|
|
isLive: boolean;
|
2019-09-17 04:25:12 -05:00
|
|
|
isPaused: boolean;
|
2020-07-09 08:16:35 -05:00
|
|
|
datasourceLoading?: boolean | null;
|
2019-11-06 13:19:50 -06:00
|
|
|
containerWidth: number;
|
2019-12-05 04:22:46 -06:00
|
|
|
datasourceName?: string;
|
2019-01-24 02:26:48 -06:00
|
|
|
}
|
|
|
|
|
2019-01-24 06:19:33 -06:00
|
|
|
interface DispatchProps {
|
|
|
|
changeDatasource: typeof changeDatasource;
|
|
|
|
clearAll: typeof clearQueries;
|
2020-03-25 05:38:14 -05:00
|
|
|
cancelQueries: typeof cancelQueries;
|
2019-04-16 02:15:23 -05:00
|
|
|
runQueries: typeof runQueries;
|
2019-01-24 06:19:33 -06:00
|
|
|
closeSplit: typeof splitClose;
|
|
|
|
split: typeof splitOpen;
|
2019-10-08 11:55:53 -05:00
|
|
|
syncTimes: typeof syncTimes;
|
2019-04-16 02:15:23 -05:00
|
|
|
changeRefreshInterval: typeof changeRefreshInterval;
|
2020-06-26 02:08:15 -05:00
|
|
|
onChangeTimeZone: typeof updateTimeZoneForSession;
|
2019-01-24 06:19:33 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type Props = StateProps & DispatchProps & OwnProps;
|
|
|
|
|
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) => {
|
|
|
|
if (loading) {
|
|
|
|
return this.props.cancelQueries(this.props.exploreId);
|
|
|
|
} else {
|
|
|
|
return this.props.runQueries(this.props.exploreId);
|
|
|
|
}
|
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-09-20 06:00:11 -05:00
|
|
|
const styles = getStyles();
|
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 && (
|
2020-04-14 08:15:36 -05:00
|
|
|
<IconButton 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}
|
2020-12-15 03:12:53 -06:00
|
|
|
<ReturnToDashboardButton exploreId={exploreId} />
|
2019-01-23 08:57:24 -06:00
|
|
|
{exploreId === 'left' && !splitted ? (
|
2019-10-10 14:53:02 -05:00
|
|
|
<div className="explore-toolbar-content-item explore-icon-align">
|
2019-09-17 04:25:12 -05:00
|
|
|
<ResponsiveButton
|
|
|
|
splitted={splitted}
|
|
|
|
title="Split"
|
2020-04-23 04:20:07 -05:00
|
|
|
/* This way ResponsiveButton doesn't add event as a parameter when invoking split function
|
|
|
|
* 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"
|
|
|
|
iconClassName="icon-margin-right"
|
2019-09-17 04:25:12 -05:00
|
|
|
disabled={isLive}
|
|
|
|
/>
|
2019-01-23 08:57:24 -06:00
|
|
|
</div>
|
|
|
|
) : null}
|
2020-10-14 10:08:27 -05:00
|
|
|
<div className={'explore-toolbar-content-item'}>
|
|
|
|
<Tooltip content={'Copy shortened link'} placement="bottom">
|
2020-10-22 03:31:58 -05:00
|
|
|
<button className={'btn navbar-button'} onClick={() => createAndCopyShortLink(window.location.href)}>
|
2020-10-14 10:08:27 -05:00
|
|
|
<Icon name="share-alt" />
|
|
|
|
</button>
|
|
|
|
</Tooltip>
|
|
|
|
</div>
|
2019-09-17 04:25:12 -05:00
|
|
|
{!isLive && (
|
|
|
|
<div className="explore-toolbar-content-item">
|
|
|
|
<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
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)}
|
2019-04-16 02:15:23 -05:00
|
|
|
|
2019-11-22 05:26:14 -06:00
|
|
|
{!isLive && (
|
|
|
|
<div className="explore-toolbar-content-item explore-icon-align">
|
|
|
|
<ResponsiveButton
|
|
|
|
splitted={splitted}
|
|
|
|
title="Clear All"
|
|
|
|
onClick={this.onClearAll}
|
@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="trash-alt"
|
|
|
|
iconClassName="icon-margin-right"
|
2019-11-22 05:26:14 -06:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)}
|
2019-01-28 05:21:04 -06:00
|
|
|
<div className="explore-toolbar-content-item">
|
2019-09-17 04:25:12 -05:00
|
|
|
<RunButton
|
|
|
|
refreshInterval={refreshInterval}
|
|
|
|
onChangeRefreshInterval={this.onChangeRefreshInterval}
|
|
|
|
splitted={splitted}
|
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}
|
|
|
|
/>
|
|
|
|
{refreshInterval && <SetInterval func={this.onRunQuery} interval={refreshInterval} loading={loading} />}
|
2019-01-23 08:57:24 -06:00
|
|
|
</div>
|
2019-09-17 04:25:12 -05:00
|
|
|
|
|
|
|
{hasLiveOption && (
|
2019-09-20 06:00:11 -05:00
|
|
|
<div className={`explore-toolbar-content-item ${styles.liveTailButtons}`}>
|
2019-09-24 03:18:34 -05:00
|
|
|
<LiveTailControls exploreId={exploreId}>
|
|
|
|
{controls => (
|
|
|
|
<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>
|
2019-09-20 06:00:11 -05:00
|
|
|
</div>
|
2019-09-17 04:25:12 -05:00
|
|
|
)}
|
2019-01-22 07:50:19 -06:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-01-24 06:19:33 -06:00
|
|
|
|
|
|
|
const mapStateToProps = (state: StoreState, { exploreId }: OwnProps): StateProps => {
|
|
|
|
const splitted = state.explore.split;
|
2019-10-08 11:55:53 -05:00
|
|
|
const syncedTimes = state.explore.syncedTimes;
|
2019-09-17 04:25:12 -05: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),
|
2019-01-24 06:19:33 -06:00
|
|
|
splitted,
|
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
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const mapDispatchToProps: DispatchProps = {
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2019-11-19 07:59:39 -06:00
|
|
|
export const ExploreToolbar = hot(module)(connect(mapStateToProps, mapDispatchToProps)(UnConnectedExploreToolbar));
|