Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] use EuiSuperDatePicker in QueryBar instead of Angular timepicker in Top Nav #29235

Merged
merged 29 commits into from
Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ea5b6da
Embed timepicker in query bar (#29130)
nreese Jan 22, 2019
bb7cc67
fix bug with way update function called by watcher
nreese Jan 22, 2019
3f671a1
get maps application functional tests working with new timepicker
nreese Jan 22, 2019
0660067
remove some changes outside of scoped work
nreese Jan 24, 2019
b5ca764
clean up typescript lint problems
nreese Jan 23, 2019
8851074
fix query_bar I18n lint error
nreese Jan 24, 2019
9d30d71
update query_bar jest test
nreese Jan 23, 2019
d4368ad
grab some parts missing from one cherry-pick
nreese Jan 24, 2019
28ab882
pass dateRange to updateQueryAndDispatch when app state changes
nreese Jan 24, 2019
a87a478
use timefilter disable methods to hide timepicker from top naav
nreese Jan 24, 2019
fcf0521
get selected refresh unit
nreese Jan 24, 2019
68e7b6b
Merge branch 'master' of github.com:elastic/kibana into maps_time_picker
nreese Jan 25, 2019
28e3dbc
use EuiSuperUpdate button
nreese Jan 25, 2019
066a4fe
Fix responsive sizing of datepicker (#29)
cchaos Jan 25, 2019
67d30b5
merge with master
nreese Jan 25, 2019
ffcc6a8
set isDisabled on EuiSuperUpdateButton
nreese Jan 25, 2019
813ad27
Merge branch 'master' of github.com:elastic/kibana into maps_time_picker
nreese Jan 29, 2019
1c9137f
review feedback
nreese Jan 29, 2019
6ffd2de
Merge branch 'master' of github.com:elastic/kibana into maps_time_picker
nreese Jan 29, 2019
4389ac6
Merge branch 'master' of github.com:elastic/kibana into maps_time_picker
nreese Jan 30, 2019
19511a2
Merge branch 'master' of github.com:elastic/kibana into maps_time_picker
nreese Jan 30, 2019
5aebec3
remove ts-ignore comment from defaultProps, fix query_bar snapshot
nreese Jan 30, 2019
338ef57
make new props optional
nreese Jan 30, 2019
f28b1b2
fighting with ts linter
nreese Jan 30, 2019
9f1ee6e
do not include dateRangeFrom and dateRangeTo in isDirty when shoDateR…
nreese Jan 30, 2019
58056a9
merge with master
nreese Jan 30, 2019
b8f9e34
Merge branch 'master' of github.com:elastic/kibana into maps_time_picker
nreese Jan 30, 2019
6b04a79
merge with master
nreese Jan 30, 2019
0b9c432
pull initial query from UI settings
nreese Jan 30, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ app.directive('dashboardApp', function ($injector) {
dashboardStateManager.getPanels().find((panel) => panel.panelIndex === panelIndex);
};

$scope.updateQueryAndFetch = function (query) {
$scope.updateQueryAndFetch = function ({ query }) {
const oldQuery = $scope.model.query;
if (_.isEqual(oldQuery, query)) {
// The user can still request a reload in the query bar, even if the
Expand Down Expand Up @@ -270,7 +270,9 @@ app.directive('dashboardApp', function ($injector) {
$scope.indexPatterns = dashboardStateManager.getPanelIndexPatterns();
};

$scope.$watch('model.query', $scope.updateQueryAndFetch);
$scope.$watch('model.query', (query) => {
$scope.updateQueryAndFetch({ query });
});

$scope.$listenAndDigestAsync(timefilter, 'fetch', () => {
dashboardStateManager.handleTimeChange(timefilter.getTime());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,9 @@ function discoverController(
}
});

$scope.$watch('state.query', $scope.updateQueryAndFetch);
$scope.$watch('state.query', (query) => {
$scope.updateQueryAndFetch({ query });
});

$scope.$watchMulti([
'rows',
Expand Down Expand Up @@ -662,7 +664,7 @@ function discoverController(
.catch(notify.error);
};

$scope.updateQueryAndFetch = function (query) {
$scope.updateQueryAndFetch = function ({ query }) {
$state.query = migrateLegacyQuery(query);
$scope.fetch();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ function VisEditor(
$appStatus.dirty = status.dirty || !savedVis.id;
});

$scope.$watch('state.query', $scope.updateQueryAndFetch);
$scope.$watch('state.query', (query) => {
$scope.updateQueryAndFetch({ query });
});

$state.replace();

Expand Down Expand Up @@ -409,7 +411,7 @@ function VisEditor(
}
}

$scope.updateQueryAndFetch = function (query) {
$scope.updateQueryAndFetch = function ({ query }) {
$state.query = migrateLegacyQuery(query);
$scope.fetch();
};
Expand Down
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';
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
exports[`QueryBar Should disable autoFocus on EuiFieldText when disableAutoFocus prop is true 1`] = `
<EuiFlexGroup
alignItems="stretch"
className="kbnQueryBar"
component="div"
direction="row"
gutterSize="s"
Expand Down Expand Up @@ -89,28 +90,21 @@ exports[`QueryBar Should disable autoFocus on EuiFieldText when disableAutoFocus
component="div"
grow={false}
>
<EuiButton
aria-label="Search"
color="primary"
<EuiSuperUpdateButton
data-test-subj="querySubmitButton"
fill={true}
iconSide="left"
isDisabled={false}
isLoading={false}
needsUpdate={false}
onClick={[Function]}
type="button"
>
<FormattedMessage
defaultMessage="Refresh"
id="common.ui.queryBar.refreshButtonLabel"
values={Object {}}
/>
</EuiButton>
/>
</EuiFlexItem>
</EuiFlexGroup>
`;

exports[`QueryBar Should pass the query language to the language switcher 1`] = `
<EuiFlexGroup
alignItems="stretch"
className="kbnQueryBar"
component="div"
direction="row"
gutterSize="s"
Expand Down Expand Up @@ -197,28 +191,21 @@ exports[`QueryBar Should pass the query language to the language switcher 1`] =
component="div"
grow={false}
>
<EuiButton
aria-label="Search"
color="primary"
<EuiSuperUpdateButton
data-test-subj="querySubmitButton"
fill={true}
iconSide="left"
isDisabled={false}
isLoading={false}
needsUpdate={false}
onClick={[Function]}
type="button"
>
<FormattedMessage
defaultMessage="Refresh"
id="common.ui.queryBar.refreshButtonLabel"
values={Object {}}
/>
</EuiButton>
/>
</EuiFlexItem>
</EuiFlexGroup>
`;

exports[`QueryBar Should render the given query 1`] = `
<EuiFlexGroup
alignItems="stretch"
className="kbnQueryBar"
component="div"
direction="row"
gutterSize="s"
Expand Down Expand Up @@ -305,21 +292,13 @@ exports[`QueryBar Should render the given query 1`] = `
component="div"
grow={false}
>
<EuiButton
aria-label="Search"
color="primary"
<EuiSuperUpdateButton
data-test-subj="querySubmitButton"
fill={true}
iconSide="left"
isDisabled={false}
isLoading={false}
needsUpdate={false}
onClick={[Function]}
type="button"
>
<FormattedMessage
defaultMessage="Refresh"
id="common.ui.queryBar.refreshButtonLabel"
values={Object {}}
/>
</EuiButton>
/>
</EuiFlexItem>
</EuiFlexGroup>
`;
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;
}
}
20 changes: 16 additions & 4 deletions src/ui/public/query_bar/components/query_bar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,14 @@ describe('QueryBar', () => {
component.find(QueryLanguageSwitcher).simulate('selectLanguage', 'lucene');
expect(mockStorage.set).toHaveBeenCalledWith('kibana.userQueryLanguage', 'lucene');
expect(mockCallback).toHaveBeenCalledWith({
query: '',
language: 'lucene',
dateRange: {
from: 'now-15m',
to: 'now',
},
query: {
query: '',
language: 'lucene',
},
});
});

Expand All @@ -235,8 +241,14 @@ describe('QueryBar', () => {

expect(mockCallback).toHaveBeenCalledTimes(1);
expect(mockCallback).toHaveBeenCalledWith({
query: 'extension:jpg',
language: 'kuery',
dateRange: {
from: 'now-15m',
to: 'now',
},
query: {
query: 'extension:jpg',
language: 'kuery',
},
});
});

Expand Down
Loading