Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ui/public/query_bar/_index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SASSTODO: Formalize this color in Kibana's styling constants
$typeaheadConjunctionColor: #7800A6;

@import 'components/typeahead/index';
@import './components/index';
2 changes: 2 additions & 0 deletions src/ui/public/query_bar/components/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import './query_bar';
@import './typeahead/index';
14 changes: 14 additions & 0 deletions src/ui/public/query_bar/components/_query_bar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@include euiBreakpoint('xs', 's') {
.kbnQueryBar--withDatePicker {
> :last-child {
// EUI Flexbox adds too much margin between responded items, this just moves the last one up
margin-top: -$euiSize;
}
}
}

@include euiBreakpoint('m', 'l', 'xl') {
.kbnQueryBar__datePickerWrapper {
max-width: 40vw;
}
}
42 changes: 32 additions & 10 deletions src/ui/public/query_bar/components/query_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import { IndexPattern } from 'ui/index_patterns';

import classNames from 'classnames';
import { compact, debounce, get, isEqual } from 'lodash';
import React, { Component } from 'react';
import { getFromLegacyIndexPattern } from 'ui/index_patterns/static_utils';
Expand Down Expand Up @@ -527,8 +528,16 @@ export class QueryBarUI extends Component<Props, State> {
}

public render() {
const classes = classNames('kbnQueryBar', {
'kbnQueryBar--withDatePicker': this.props.showDatePicker,
});

return (
<EuiFlexGroup responsive={false} gutterSize="s">
<EuiFlexGroup
className={classes}
responsive={this.props.showDatePicker ? true : false}
gutterSize="s"
>
<EuiFlexItem>
<EuiOutsideClickDetector onOutsideClick={this.onOutsideClick}>
{/* position:relative required on container so the suggestions appear under the query bar*/}
Expand Down Expand Up @@ -598,18 +607,31 @@ export class QueryBarUI extends Component<Props, State> {
</div>
</EuiOutsideClickDetector>
</EuiFlexItem>
{this.renderDatePicker()}
<EuiFlexItem grow={false}>
<EuiSuperUpdateButton
needsUpdate={this.isDirty()}
onClick={this.onClickSubmitButton}
data-test-subj="querySubmitButton"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>{this.renderUpdateButton()}</EuiFlexItem>
</EuiFlexGroup>
);
}

private renderUpdateButton() {
const button = (
<EuiSuperUpdateButton
needsUpdate={this.isDirty()}
onClick={this.onClickSubmitButton}
data-test-subj="querySubmitButton"
/>
);
if (this.props.showDatePicker) {
return (
<EuiFlexGroup responsive={false} gutterSize="s">
{this.renderDatePicker()}
<EuiFlexItem grow={false}>{button}</EuiFlexItem>
</EuiFlexGroup>
);
} else {
return button;
}
}

private renderDatePicker() {
if (!this.props.showDatePicker) {
return null;
Expand All @@ -635,7 +657,7 @@ export class QueryBarUI extends Component<Props, State> {
});

return (
<EuiFlexItem grow={false}>
<EuiFlexItem className="kbnQueryBar__datePickerWrapper">
<EuiSuperDatePicker
start={this.state.from}
end={this.state.to}
Expand Down