Commit d2a54776 by Hugo Häggmark

Fixed small issue with TimePicker dropdown position

parent 032a82fe
...@@ -231,6 +231,8 @@ export class Explore extends React.PureComponent<ExploreProps> { ...@@ -231,6 +231,8 @@ export class Explore extends React.PureComponent<ExploreProps> {
? exploreDatasources.find(d => d.name === datasourceInstance.name) ? exploreDatasources.find(d => d.name === datasourceInstance.name)
: undefined; : undefined;
const timepicker = <TimePicker ref={this.timepickerRef} range={range} onChangeTime={this.onChangeTime} />;
return ( return (
<div className={exploreClass} ref={this.getRef}> <div className={exploreClass} ref={this.getRef}>
<ExploreToolbar <ExploreToolbar
...@@ -241,6 +243,7 @@ export class Explore extends React.PureComponent<ExploreProps> { ...@@ -241,6 +243,7 @@ export class Explore extends React.PureComponent<ExploreProps> {
range={range} range={range}
selectedDatasource={selectedDatasource} selectedDatasource={selectedDatasource}
splitted={split} splitted={split}
timepicker={timepicker}
onChangeDatasource={this.onChangeDatasource} onChangeDatasource={this.onChangeDatasource}
onClearAll={this.onClickClear} onClearAll={this.onClickClear}
onCloseSplit={this.onClickCloseSplit} onCloseSplit={this.onClickCloseSplit}
......
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { ExploreId } from 'app/types/explore'; import { ExploreId } from 'app/types/explore';
import { DataSourceSelectItem, RawTimeRange, TimeRange } from '@grafana/ui'; import { DataSourceSelectItem, RawTimeRange, TimeRange } from '@grafana/ui';
import TimePicker from './TimePicker';
import { DataSourcePicker } from 'app/core/components/Select/DataSourcePicker'; import { DataSourcePicker } from 'app/core/components/Select/DataSourcePicker';
interface Props { interface Props {
...@@ -12,6 +11,7 @@ interface Props { ...@@ -12,6 +11,7 @@ interface Props {
range: RawTimeRange; range: RawTimeRange;
selectedDatasource: DataSourceSelectItem; selectedDatasource: DataSourceSelectItem;
splitted: boolean; splitted: boolean;
timepicker: JSX.Element;
onChangeDatasource: (option) => void; onChangeDatasource: (option) => void;
onClearAll: () => void; onClearAll: () => void;
onCloseSplit: () => void; onCloseSplit: () => void;
...@@ -56,22 +56,16 @@ const createSplittedClassName = (options: { splitted: boolean; className: string ...@@ -56,22 +56,16 @@ const createSplittedClassName = (options: { splitted: boolean; className: string
}; };
export class ExploreToolbar extends PureComponent<Props, {}> { export class ExploreToolbar extends PureComponent<Props, {}> {
/**
* Timepicker to control scanning
*/
timepickerRef: React.RefObject<TimePicker>;
constructor(props) { constructor(props) {
super(props); super(props);
this.timepickerRef = React.createRef();
} }
render() { render() {
const { datasourceMissing, exploreId, loading, range, splitted } = this.props; const { datasourceMissing, exploreId, loading, splitted, timepicker } = this.props;
const toolbar = createSplittedClassName({ splitted, className: 'toolbar' }); const toolbar = createSplittedClassName({ splitted, className: 'toolbar' });
const toolbarItem = createSplittedClassName({ splitted, className: 'toolbar-item' }); const toolbarItem = createSplittedClassName({ splitted, className: 'toolbar-item' });
const toolbarHeader = createSplittedClassName({ splitted, className: 'toolbar-header' }); const toolbarHeader = createSplittedClassName({ splitted, className: 'toolbar-header' });
const timepicker = createSplittedClassName({ splitted, className: 'toolbar-content-item timepicker' }); const timepickerClasses = createSplittedClassName({ splitted, className: 'toolbar-content-item timepicker' });
return ( return (
<div className={toolbar}> <div className={toolbar}>
...@@ -121,9 +115,7 @@ export class ExploreToolbar extends PureComponent<Props, {}> { ...@@ -121,9 +115,7 @@ export class ExploreToolbar extends PureComponent<Props, {}> {
})} })}
</div> </div>
) : null} ) : null}
<div className={timepicker}> <div className={timepickerClasses}>{timepicker}</div>
<TimePicker ref={this.timepickerRef} range={range} onChangeTime={this.props.onChangeTime} />
</div>
<div className="toolbar-content-item"> <div className="toolbar-content-item">
<button className="btn navbar-button navbar-button--no-icon" onClick={this.props.onClearAll}> <button className="btn navbar-button navbar-button--no-icon" onClick={this.props.onClearAll}>
Clear All Clear All
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
display: none; display: none;
} }
.timepicker-splitted,
.timepicker { .timepicker {
display: flex; display: flex;
} }
...@@ -32,6 +33,10 @@ ...@@ -32,6 +33,10 @@
justify-content: space-between; justify-content: space-between;
height: auto; height: auto;
padding: 0px $dashboard-padding; padding: 0px $dashboard-padding;
border-bottom: 1px solid #0000;
transition-duration: 0.35s;
transition-timing-function: ease-in-out;
transition-property: box-shadow, border-bottom;
} }
.toolbar { .toolbar {
...@@ -44,6 +49,7 @@ ...@@ -44,6 +49,7 @@
.toolbar-item-splitted, .toolbar-item-splitted,
.toolbar-item { .toolbar-item {
position: relative;
align-self: center; align-self: center;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment