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

Replace angular timepicker with EuiSuperDatePicker #29204

Merged
merged 41 commits into from
Feb 6, 2019
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ecb2593
replace kbnTimepicker directive with EuiSuperDatePicker
nreese Dec 27, 2018
8a2c1ed
remove kbnTimepicker directive
nreese Dec 27, 2018
090f2d0
remove bootstrap datepicker
nreese Dec 27, 2018
781e801
Embed timepicker in query bar (#29130)
nreese Jan 22, 2019
c48cabd
fix bug with way update function called by watcher
nreese Jan 22, 2019
11ec6df
get maps application functional tests working with new timepicker
nreese Jan 22, 2019
d320ca1
update setAbsoluteRange for EuiSuperDatePicker
nreese Jan 23, 2019
bf3324a
replace setQuickTime with calls to setAbsoluteTime
nreese Jan 23, 2019
ed55361
remove open time picker button in discover empty results view
nreese Jan 23, 2019
57302ae
pass config values to super-date-picker directive
nreese Jan 23, 2019
4e295c3
remove getPrettyDuration
nreese Jan 23, 2019
7407fdd
merge with master
nreese Jan 23, 2019
74cccb1
clean up typescript lint problems
nreese Jan 23, 2019
8f2f82e
some functional test fixes
nreese Jan 23, 2019
d9a6aa1
try something else to fix I18n problems
nreese Jan 23, 2019
2e3a143
fix some more functional tests
nreese Jan 23, 2019
d9969a9
update query_bar jest test
nreese Jan 23, 2019
a2d875a
remove unused method in kbn_global_timepicker
nreese Jan 23, 2019
b623d7a
merge with master
nreese Jan 31, 2019
7f2f504
do not import removed timepicker styles
nreese Jan 31, 2019
6e6be23
merge with master
nreese Jan 31, 2019
c832caa
remove mode from time state
nreese Jan 31, 2019
7bcf565
remove mode from time_history interface
nreese Jan 31, 2019
76e8c1c
fix problem with ui_settings_defaults
nreese Jan 31, 2019
5d9976f
fix failing TSVB functional test
nreese Jan 31, 2019
c021045
another round to test fixes
nreese Jan 31, 2019
8030ea5
merge with master
nreese Feb 1, 2019
e4bf0b8
merge with master
nreese Feb 1, 2019
c7be764
more functional test changes
nreese Feb 1, 2019
5dab392
fixes for failing tests
nreese Feb 1, 2019
73e8c7e
add retry block to flaky tsvb test
nreese Feb 1, 2019
ecae897
merge with master
nreese Feb 5, 2019
6b373f4
styles/bootstrap_dark.less
nreese Feb 5, 2019
368cccc
fix functional tests
nreese Feb 5, 2019
1838d74
call fetch event even when times are the same
nreese Feb 5, 2019
02c4f62
add retry around flaky tsvb test
nreese Feb 5, 2019
e0afeae
fix timefilter jest test, attempt to fix another flaky functional test
nreese Feb 5, 2019
56a1473
Merge branch 'master' of github.com:elastic/kibana into feature/globa…
nreese Feb 6, 2019
7bd5c56
revert emitting fetch outside of areTimePickerValsDifferent check
nreese Feb 6, 2019
5962430
clean up time mode code that is no longer needed in dashboard
nreese Feb 6, 2019
d94975a
fix timefilter tests changed by timefilter emit revert
nreese Feb 6, 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 @@ -425,20 +425,13 @@ Array [
<div
class="euiText euiText--medium"
>
<h3>
<h3
data-test-subj="discoverNoResultsTimefilter"
>
Expand your time range
</h3>
<p>
One or more of the indices you’re looking at contains a date field. Your query may not match anything in the current time range, or there may not be any data at all in the currently selected time range. You can try
<button
aria-expanded="false"
class="euiLink euiLink--primary"
data-test-subj="discoverNoResultsTimefilter"
type="button"
>
opening the time picker
</button>
and changing the time range to one which contains data.
One or more of the indices you’re looking at contains a date field. Your query may not match anything in the current time range, or there may not be any data at all in the currently selected time range. You can try changing the time range to one which contains data.
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,13 @@ import {
EuiText,
} from '@elastic/eui';

// eslint-disable-next-line react/prefer-stateless-function
export class DiscoverNoResults extends Component {
static propTypes = {
shardFailures: PropTypes.array,
timeFieldName: PropTypes.string,
queryLanguage: PropTypes.string,
isTimePickerOpen: PropTypes.bool.isRequired,
getDocLink: PropTypes.func.isRequired,
topNavToggle: PropTypes.func.isRequired,
};

onClickTimePickerButton = () => {
this.props.topNavToggle('filter');
};

render() {
Expand All @@ -53,7 +48,6 @@ export class DiscoverNoResults extends Component {
timeFieldName,
queryLanguage,
getDocLink,
isTimePickerOpen,
} = this.props;

let shardFailuresMessage;
Expand Down Expand Up @@ -125,7 +119,7 @@ export class DiscoverNoResults extends Component {
<EuiSpacer size="xl" />

<EuiText>
<h3>
<h3 data-test-subj="discoverNoResultsTimefilter">
<FormattedMessage
id="kbn.discover.noResults.expandYourTimeRangeTitle"
defaultMessage="Expand your time range"
Expand All @@ -137,21 +131,7 @@ export class DiscoverNoResults extends Component {
id="kbn.discover.noResults.queryMayNotMatchTitle"
defaultMessage="One or more of the indices you&rsquo;re looking at contains a date field. Your query may
not match anything in the current time range, or there may not be any data at all in
the currently selected time range. You can try {timepickerLink} and changing the time range to one which contains data."
values={{
timepickerLink: (
<EuiLink
data-test-subj="discoverNoResultsTimefilter"
onClick={this.onClickTimePickerButton}
aria-expanded={isTimePickerOpen}
>
<FormattedMessage
id="kbn.discover.noResults.openingTimepickerLinkText"
defaultMessage="opening the time picker"
/>
</EuiLink>
)
}}
the currently selected time range. You can try changing the time range to one which contains data."
/>
</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
*/

import React from 'react';
import { renderWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers';
import sinon from 'sinon';
import { findTestSubject } from '@elastic/eui/lib/test';
import { renderWithIntl } from 'test_utils/enzyme_helpers';

import {
DiscoverNoResults,
Expand All @@ -43,8 +41,6 @@ describe('DiscoverNoResults', () => {
const component = renderWithIntl(
<DiscoverNoResults
shardFailures={shardFailures}
isTimePickerOpen={false}
topNavToggle={() => {}}
getDocLink={() => ''}
/>
);
Expand All @@ -58,8 +54,6 @@ describe('DiscoverNoResults', () => {
const component = renderWithIntl(
<DiscoverNoResults
shardFailures={shardFailures}
isTimePickerOpen={false}
topNavToggle={() => {}}
getDocLink={() => ''}
/>
);
Expand All @@ -68,45 +62,11 @@ describe('DiscoverNoResults', () => {
});
});

describe('isTimePickerOpen', () => {
test('false is reflected in the aria-expanded state of the button', () => {
const component = renderWithIntl(
<DiscoverNoResults
timeFieldName="awesome_time_field"
isTimePickerOpen={false}
topNavToggle={() => {}}
getDocLink={() => ''}
/>
);

expect(
component.find('[data-test-subj="discoverNoResultsTimefilter"]')[0].attribs['aria-expanded']
).toBe('false');
});

test('true is reflected in the aria-expanded state of the button', () => {
const component = renderWithIntl(
<DiscoverNoResults
timeFieldName="awesome_time_field"
isTimePickerOpen={true}
topNavToggle={() => {}}
getDocLink={() => ''}
/>
);

expect(
component.find('[data-test-subj="discoverNoResultsTimefilter"]')[0].attribs['aria-expanded']
).toBe('true');
});
});

describe('timeFieldName', () => {
test('renders time range feedback', () => {
const component = renderWithIntl(
<DiscoverNoResults
timeFieldName="awesome_time_field"
isTimePickerOpen={false}
topNavToggle={() => {}}
getDocLink={() => ''}
/>
);
Expand All @@ -120,31 +80,12 @@ describe('DiscoverNoResults', () => {
const component = renderWithIntl(
<DiscoverNoResults
queryLanguage="lucene"
isTimePickerOpen={false}
topNavToggle={() => {}}
getDocLink={() => 'documentation-link'}
/>
);

expect(component).toMatchSnapshot();
});
});

describe('topNavToggle', () => {
test('is called whe time picker button is clicked', () => {
const topNavToggleSpy = sinon.stub();
const component = mountWithIntl(
<DiscoverNoResults
timeFieldName="awesome_time_field"
isTimePickerOpen={false}
topNavToggle={topNavToggleSpy}
getDocLink={() => ''}
/>
);

findTestSubject(component, 'discoverNoResultsTimefilter').simulate('click');
sinon.assert.calledOnce(topNavToggleSpy);
});
});
});
});
2 changes: 0 additions & 2 deletions src/legacy/core_plugins/kibana/public/discover/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ <h1 tabindex="0" id="kui_local_breadcrumb" class="kuiLocalBreadcrumb" ng-if="opt

<discover-no-results
ng-show="resultState === 'none'"
top-nav-toggle="kbnTopNav.toggle"
is-time-picker-open="kbnTopNav.isCurrent('filter')"
shard-failures="failures"
time-field-name="opts.timefield"
query-language="state.query.language"
Expand Down
92 changes: 42 additions & 50 deletions src/legacy/core_plugins/kibana/ui_setting_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function getUiSettingDefaults() {
name: i18n.translate('kbn.advancedSettings.dateFormatTitle', {
defaultMessage: 'Date format',
}),
value: 'MMMM Do YYYY, HH:mm:ss.SSS',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this have to change for some reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the format that design recommended so it fits in the UI better. Spelling out the month wastes a lot of space

value: 'MMM D, YYYY @ HH:mm:ss.SSS',
description: i18n.translate('kbn.advancedSettings.dateFormatText', {
defaultMessage: 'When displaying a pretty formatted date, use this {formatLink}',
description: 'Part of composite text: kbn.advancedSettings.dateFormatText + ' +
Expand Down Expand Up @@ -750,8 +750,7 @@ export function getUiSettingDefaults() {
value:
`{
"from": "now-15m",
"to": "now",
"mode": "quick"
"to": "now"
}`,
type: 'json',
description: i18n.translate('kbn.advancedSettings.timepicker.timeDefaultsText', {
Expand All @@ -777,53 +776,46 @@ export function getUiSettingDefaults() {
defaultMessage: 'Time picker quick ranges',
}),
value: JSON.stringify([
{ from: 'now/d', to: 'now/d',
display: i18n.translate('kbn.advancedSettings.timepicker.today', { defaultMessage: 'Today' }), section: 0 },
{ from: 'now/w', to: 'now/w',
display: i18n.translate('kbn.advancedSettings.timepicker.thisWeek', { defaultMessage: 'This week' }), section: 0 },
{ from: 'now/M', to: 'now/M',
display: i18n.translate('kbn.advancedSettings.timepicker.thisMonth', { defaultMessage: 'This month' }), section: 0 },
{ from: 'now/y', to: 'now/y',
display: i18n.translate('kbn.advancedSettings.timepicker.thisYear', { defaultMessage: 'This year' }), section: 0 },
{ from: 'now/d', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.todaySoFar', { defaultMessage: 'Today so far' }), section: 0 },
{ from: 'now/w', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.weekToDate', { defaultMessage: 'Week to date' }), section: 0 },
{ from: 'now/M', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.monthToDate', { defaultMessage: 'Month to date' }), section: 0 },
{ from: 'now/y', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.yearToDate', { defaultMessage: 'Year to date' }), section: 0 },

{ from: 'now-15m', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last15Minutes', { defaultMessage: 'Last 15 minutes' }), section: 1 },
{ from: 'now-30m', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last30Minutes', { defaultMessage: 'Last 30 minutes' }), section: 1 },
{ from: 'now-1h', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last1Hour', { defaultMessage: 'Last 1 hour' }), section: 1 },
{ from: 'now-4h', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last4Hours', { defaultMessage: 'Last 4 hours' }), section: 1 },
{ from: 'now-12h', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last12Hours', { defaultMessage: 'Last 12 hours' }), section: 1 },
{ from: 'now-24h', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last24Hours', { defaultMessage: 'Last 24 hours' }), section: 1 },
{ from: 'now-7d', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last7Days', { defaultMessage: 'Last 7 days' }), section: 1 },

{ from: 'now-30d', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last30Days', { defaultMessage: 'Last 30 days' }), section: 2 },
{ from: 'now-60d', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last60Days', { defaultMessage: 'Last 60 days' }), section: 2 },
{ from: 'now-90d', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last90Days', { defaultMessage: 'Last 90 days' }), section: 2 },
{ from: 'now-6M', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last6Months', { defaultMessage: 'Last 6 months' }), section: 2 },
{ from: 'now-1y', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last1Year', { defaultMessage: 'Last 1 year' }), section: 2 },
{ from: 'now-2y', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last2Years', { defaultMessage: 'Last 2 years' }), section: 2 },
{ from: 'now-5y', to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.last5Years', { defaultMessage: 'Last 5 years' }), section: 2 },

{
from: 'now/d',
to: 'now/d',
display: i18n.translate('kbn.advancedSettings.timepicker.today', { defaultMessage: 'Today' })
},
{
from: 'now/w',
to: 'now/w',
display: i18n.translate('kbn.advancedSettings.timepicker.thisWeek', { defaultMessage: 'This week' })
},
{
from: 'now/M',
to: 'now/M',
display: i18n.translate('kbn.advancedSettings.timepicker.thisMonth', { defaultMessage: 'This month' })
},
{
from: 'now/y',
to: 'now/y',
display: i18n.translate('kbn.advancedSettings.timepicker.thisYear', { defaultMessage: 'This year' })
},
{
from: 'now/d',
to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.todaySoFar', { defaultMessage: 'Today so far' })
},
{
from: 'now/w',
to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.weekToDate', { defaultMessage: 'Week to date' })
},
{
from: 'now/M',
to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.monthToDate', { defaultMessage: 'Month to date' })
},
{
from: 'now/y',
to: 'now',
display: i18n.translate('kbn.advancedSettings.timepicker.yearToDate', { defaultMessage: 'Year to date' })
},
], null, 2),
type: 'json',
description: i18n.translate('kbn.advancedSettings.timepicker.quickRangesText', {
Expand Down
12 changes: 6 additions & 6 deletions src/ui/public/agg_table/__tests__/_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ describe('AggTable Directive', function () {
$scope.table = response.tables[0];
$scope.showTotal = true;
$scope.totalFunc = totalFunc;
const $el = $(`<kbn-agg-table
table="table"
show-total="showTotal"
total-func="totalFunc"
const $el = $(`<kbn-agg-table
table="table"
show-total="showTotal"
total-func="totalFunc"
dimensions="dimensions"></kbn-agg-table>`);
$compile($el)($scope);
$scope.$digest();
Expand All @@ -224,7 +224,7 @@ describe('AggTable Directive', function () {
'',
'2014-09-28',
'9,283',
'September 28th 2014, 00:00:00.000',
'Sep 28, 2014 @ 00:00:00.000',
'1',
'11'
]);
Expand All @@ -234,7 +234,7 @@ describe('AggTable Directive', function () {
'',
'2014-10-03',
'220,943',
'October 3rd 2014, 00:00:00.000',
'Oct 3, 2014 @ 00:00:00.000',
'239',
'837'
]);
Expand Down
5 changes: 0 additions & 5 deletions src/ui/public/angular-bootstrap/datepicker/datepicker.html

This file was deleted.

Loading