Upgrade EUI to v53.0.1 (#128825) (#129150)

* Upgrade EUI to v53.0.1

* Update i18n EUI mappings with new super date picker tokens

* Update deprecated prettyDuration usage

* Fix misc tests/type updates caused by EuiSuperDatePicker i18n release

- Fix mock typeof: this changed because the exported EuiSuperDatePicker is no longer a class, but a functional component wrapper around a class

- CI test: update now-capitalized datepicker select copy

- Jest tests: update snapshots, find()s (`Memo()` selector change is due to the exported EuiSuperDatePicker change)

* [kibana-app-services feedback] use renderToString

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 6a44f1f725)

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2022-03-31 21:35:27 -04:00 committed by GitHub
parent 611c5238d9
commit 5bdb075673
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 443 additions and 90 deletions

View file

@ -108,7 +108,7 @@
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.2.0-canary.1",
"@elastic/ems-client": "8.2.0",
"@elastic/eui": "52.2.0",
"@elastic/eui": "53.0.1",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",

View file

@ -6,6 +6,7 @@ exports[`#start() returns \`Context\` component 1`] = `
i18n={
Object {
"mapping": Object {
"euiAbsoluteTab.dateFormatError": [Function],
"euiAccordion.isLoading": "Loading",
"euiAutoRefresh.autoRefreshLabel": "Auto refresh",
"euiAutoRefresh.buttonLabelOff": "Auto refresh is off",
@ -100,6 +101,14 @@ exports[`#start() returns \`Context\` component 1`] = `
"euiDataGridSchema.numberSortTextDesc": "High-Low",
"euiDatePopoverButton.invalidTitle": [Function],
"euiDatePopoverButton.outdatedTitle": [Function],
"euiDatePopoverContent.absoluteTabLabel": "Absolute",
"euiDatePopoverContent.endDateLabel": "End date",
"euiDatePopoverContent.nowTabButtonEnd": "Set end date and time to now",
"euiDatePopoverContent.nowTabButtonStart": "Set start date and time to now",
"euiDatePopoverContent.nowTabContent": "Setting the time to \\"now\\" means that on every refresh this time will be set to the time of the refresh.",
"euiDatePopoverContent.nowTabLabel": "Now",
"euiDatePopoverContent.relativeTabLabel": "Relative",
"euiDatePopoverContent.startDateLabel": "Start date",
"euiDisplaySelector.buttonText": "Display options",
"euiDisplaySelector.densityLabel": "Density",
"euiDisplaySelector.labelAuto": "Auto fit",
@ -177,6 +186,39 @@ exports[`#start() returns \`Context\` component 1`] = `
"euiPinnableListGroup.pinExtraActionLabel": "Pin item",
"euiPinnableListGroup.pinnedExtraActionLabel": "Unpin item",
"euiPopover.screenReaderAnnouncement": "You are in a dialog. To close this dialog, hit escape.",
"euiPrettyDuration.durationRoundedToDay": [Function],
"euiPrettyDuration.durationRoundedToHour": [Function],
"euiPrettyDuration.durationRoundedToMinute": [Function],
"euiPrettyDuration.durationRoundedToMonth": [Function],
"euiPrettyDuration.durationRoundedToSecond": [Function],
"euiPrettyDuration.durationRoundedToWeek": [Function],
"euiPrettyDuration.durationRoundedToYear": [Function],
"euiPrettyDuration.fallbackDuration": [Function],
"euiPrettyDuration.invalid": "Invalid date",
"euiPrettyDuration.lastDurationDays": [Function],
"euiPrettyDuration.lastDurationHours": [Function],
"euiPrettyDuration.lastDurationMinutes": [Function],
"euiPrettyDuration.lastDurationMonths": [Function],
"euiPrettyDuration.lastDurationSeconds": [Function],
"euiPrettyDuration.lastDurationWeeks": [Function],
"euiPrettyDuration.lastDurationYears": [Function],
"euiPrettyDuration.nextDurationHours": [Function],
"euiPrettyDuration.nextDurationMinutes": [Function],
"euiPrettyDuration.nextDurationMonths": [Function],
"euiPrettyDuration.nextDurationSeconds": [Function],
"euiPrettyDuration.nextDurationWeeks": [Function],
"euiPrettyDuration.nextDurationYears": [Function],
"euiPrettyDuration.nexttDurationDays": [Function],
"euiPrettyDuration.now": "now",
"euiPrettyInterval.days": [Function],
"euiPrettyInterval.daysShorthand": [Function],
"euiPrettyInterval.hours": [Function],
"euiPrettyInterval.hoursShorthand": [Function],
"euiPrettyInterval.minutes": [Function],
"euiPrettyInterval.minutesShorthand": [Function],
"euiPrettyInterval.off": "Off",
"euiPrettyInterval.seconds": [Function],
"euiPrettyInterval.secondsShorthand": [Function],
"euiProgress.valueText": [Function],
"euiQuickSelect.applyButton": "Apply",
"euiQuickSelect.fullDescription": [Function],
@ -195,8 +237,6 @@ exports[`#start() returns \`Context\` component 1`] = `
"euiRelativeTab.fullDescription": [Function],
"euiRelativeTab.numberInputError": "Must be >= 0",
"euiRelativeTab.numberInputLabel": "Time span amount",
"euiRelativeTab.relativeDate": [Function],
"euiRelativeTab.roundingLabel": [Function],
"euiRelativeTab.unitInputLabel": "Relative time span",
"euiResizableButton.horizontalResizerAriaLabel": "Press left or right to adjust panels size",
"euiResizableButton.verticalResizerAriaLabel": "Press up or down to adjust panels size",
@ -256,6 +296,44 @@ exports[`#start() returns \`Context\` component 1`] = `
"euiTablePagination.rowsPerPageOption": [Function],
"euiTablePagination.rowsPerPageOptionShowAllRows": "Show all rows",
"euiTableSortMobile.sorting": "Sorting",
"euiTimeOptions.days": "Days",
"euiTimeOptions.daysAgo": "Days ago",
"euiTimeOptions.daysFromNow": "Days from now",
"euiTimeOptions.hours": "Hours",
"euiTimeOptions.hoursAgo": "Hours ago",
"euiTimeOptions.hoursFromNow": "Hours from now",
"euiTimeOptions.last": "Last",
"euiTimeOptions.minutes": "Minutes",
"euiTimeOptions.minutesAgo": "Minutes ago",
"euiTimeOptions.minutesFromNow": "Minutes from now",
"euiTimeOptions.monthToDate": "Month to date",
"euiTimeOptions.months": "Months",
"euiTimeOptions.monthsAgo": "Months ago",
"euiTimeOptions.monthsFromNow": "Months from now",
"euiTimeOptions.next": "Next",
"euiTimeOptions.roundToDay": "Round to the day",
"euiTimeOptions.roundToHour": "Round to the hour",
"euiTimeOptions.roundToMinute": "Round to the minute",
"euiTimeOptions.roundToMonth": "Round to the month",
"euiTimeOptions.roundToSecond": "Round to the second",
"euiTimeOptions.roundToWeek": "Round to the week",
"euiTimeOptions.roundToYear": "Round to the year",
"euiTimeOptions.seconds": "Seconds",
"euiTimeOptions.secondsAgo": "Seconds ago",
"euiTimeOptions.secondsFromNow": "Seconds from now",
"euiTimeOptions.thisMonth": "This month",
"euiTimeOptions.thisWeek": "This week",
"euiTimeOptions.thisYear": "This year",
"euiTimeOptions.today": "Today",
"euiTimeOptions.weekToDate": "Week to date",
"euiTimeOptions.weeks": "Weeks",
"euiTimeOptions.weeksAgo": "Weeks ago",
"euiTimeOptions.weeksFromNow": "Weeks from now",
"euiTimeOptions.yearToDate": "Year to date",
"euiTimeOptions.years": "Years",
"euiTimeOptions.yearsAgo": "Years ago",
"euiTimeOptions.yearsFromNow": "Years from now",
"euiTimeOptions.yesterday": "Yesterday",
"euiToast.dismissToast": "Dismiss toast",
"euiToast.newNotification": "A new notification appears",
"euiToast.notification": "Notification",

View file

@ -76,7 +76,31 @@ describe('@elastic/eui i18n tokens', () => {
test('defaultMessage is in sync with defString', () => {
// Certain complex tokens (e.g. ones that have a function as a defaultMessage)
// need custom i18n handling, and can't be checked for basic defString equality
const tokensToSkip = ['euiColumnSorting.buttonActive', 'euiSelectable.searchResults'];
const tokensToSkip = [
'euiColumnSorting.buttonActive',
'euiSelectable.searchResults',
'euiPrettyDuration.lastDurationSeconds',
'euiPrettyDuration.nextDurationSeconds',
'euiPrettyDuration.lastDurationMinutes',
'euiPrettyDuration.nextDurationMinutes',
'euiPrettyDuration.lastDurationHours',
'euiPrettyDuration.nextDurationHours',
'euiPrettyDuration.lastDurationDays',
'euiPrettyDuration.nexttDurationDays',
'euiPrettyDuration.lastDurationWeeks',
'euiPrettyDuration.nextDurationWeeks',
'euiPrettyDuration.lastDurationMonths',
'euiPrettyDuration.nextDurationMonths',
'euiPrettyDuration.lastDurationYears',
'euiPrettyDuration.nextDurationYears',
'euiPrettyInterval.seconds',
'euiPrettyInterval.minutes',
'euiPrettyInterval.hours',
'euiPrettyInterval.days',
'euiPrettyInterval.weeks',
'euiPrettyInterval.months',
'euiPrettyInterval.years',
];
if (tokensToSkip.includes(token)) return;
// Clean up typical errors from the `@elastic/eui` extraction token tool

View file

@ -843,6 +843,279 @@ export const getEuiContextMapping = (): EuiTokensObject => {
defaultMessage: '{value}%',
values: { value },
}),
'euiPrettyDuration.lastDurationSeconds': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.lastDurationSeconds', {
defaultMessage: 'Last {duration, plural, one {# second} other {# seconds}}',
values: { duration },
}),
'euiPrettyDuration.nextDurationSeconds': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.nextDurationSeconds', {
defaultMessage: 'Next {duration, plural, one {# second} other {# seconds}}',
values: { duration },
}),
'euiPrettyDuration.lastDurationMinutes': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.lastDurationMinutes', {
defaultMessage: 'Last {duration, plural, one {# minute} other {# minutes}}',
values: { duration },
}),
'euiPrettyDuration.nextDurationMinutes': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.nextDurationMinutes', {
defaultMessage: 'Next {duration, plural, one {# minute} other {# minutes}}',
values: { duration },
}),
'euiPrettyDuration.lastDurationHours': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.lastDurationHours', {
defaultMessage: 'Last {duration, plural, one {# hour} other {# hours}}',
values: { duration },
}),
'euiPrettyDuration.nextDurationHours': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.nextDurationHours', {
defaultMessage: 'Next {duration, plural, one {# hour} other {# hours}}',
values: { duration },
}),
'euiPrettyDuration.lastDurationDays': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.lastDurationDays', {
defaultMessage: 'Last {duration, plural, one {# day} other {# days}}',
values: { duration },
}),
'euiPrettyDuration.nexttDurationDays': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.nexttDurationDays', {
defaultMessage: 'Next {duration, plural, one {# day} other {# days}}',
values: { duration },
}),
'euiPrettyDuration.lastDurationWeeks': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.lastDurationWeeks', {
defaultMessage: 'Last {duration, plural, one {# week} other {# weeks}}',
values: { duration },
}),
'euiPrettyDuration.nextDurationWeeks': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.nextDurationWeeks', {
defaultMessage: 'Next {duration, plural, one {# week} other {# weeks}}',
values: { duration },
}),
'euiPrettyDuration.lastDurationMonths': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.lastDurationMonths', {
defaultMessage: 'Last {duration, plural, one {# month} other {# months}}',
values: { duration },
}),
'euiPrettyDuration.nextDurationMonths': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.nextDurationMonths', {
defaultMessage: 'Next {duration, plural, one {# month} other {# months}}',
values: { duration },
}),
'euiPrettyDuration.lastDurationYears': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.lastDurationYears', {
defaultMessage: 'Last {duration, plural, one {# year} other {# years}}',
values: { duration },
}),
'euiPrettyDuration.nextDurationYears': ({ duration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.nextDurationYears', {
defaultMessage: 'Next {duration, plural, one {# year} other {# years}}',
values: { duration },
}),
'euiPrettyDuration.durationRoundedToSecond': ({ prettyDuration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.durationRoundedToSecond', {
defaultMessage: '{prettyDuration} rounded to the second',
values: { prettyDuration },
}),
'euiPrettyDuration.durationRoundedToMinute': ({ prettyDuration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.durationRoundedToMinute', {
defaultMessage: '{prettyDuration} rounded to the minute',
values: { prettyDuration },
}),
'euiPrettyDuration.durationRoundedToHour': ({ prettyDuration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.durationRoundedToHour', {
defaultMessage: '{prettyDuration} rounded to the hour',
values: { prettyDuration },
}),
'euiPrettyDuration.durationRoundedToDay': ({ prettyDuration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.durationRoundedToDay', {
defaultMessage: '{prettyDuration} rounded to the day',
values: { prettyDuration },
}),
'euiPrettyDuration.durationRoundedToWeek': ({ prettyDuration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.durationRoundedToWeek', {
defaultMessage: '{prettyDuration} rounded to the week',
values: { prettyDuration },
}),
'euiPrettyDuration.durationRoundedToMonth': ({ prettyDuration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.durationRoundedToMonth', {
defaultMessage: '{prettyDuration} rounded to the month',
values: { prettyDuration },
}),
'euiPrettyDuration.durationRoundedToYear': ({ prettyDuration }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.durationRoundedToYear', {
defaultMessage: '{prettyDuration} rounded to the year',
values: { prettyDuration },
}),
'euiPrettyDuration.now': i18n.translate('core.euiPrettyDuration.now', {
defaultMessage: 'now',
}),
'euiPrettyDuration.invalid': i18n.translate('core.euiPrettyDuration.invalid', {
defaultMessage: 'Invalid date',
}),
'euiPrettyDuration.fallbackDuration': ({ displayFrom, displayTo }: EuiValues) =>
i18n.translate('core.euiPrettyDuration.fallbackDuration', {
defaultMessage: '{displayFrom} to {displayTo}',
values: { displayFrom, displayTo },
}),
'euiPrettyInterval.seconds': ({ interval }: EuiValues) =>
i18n.translate('core.euiPrettyInterval.seconds', {
defaultMessage: '{interval, plural, one {# second} other {# seconds}}',
values: { interval },
}),
'euiPrettyInterval.minutes': ({ interval }: EuiValues) =>
i18n.translate('core.euiPrettyInterval.minutes', {
defaultMessage: '{interval, plural, one {# minute} other {# minutes}}',
values: { interval },
}),
'euiPrettyInterval.hours': ({ interval }: EuiValues) =>
i18n.translate('core.euiPrettyInterval.hours', {
defaultMessage: '{interval, plural, one {# hour} other {# hours}}',
values: { interval },
}),
'euiPrettyInterval.days': ({ interval }: EuiValues) =>
i18n.translate('core.euiPrettyInterval.days', {
defaultMessage: '{interval, plural, one {# day} other {# days}}',
values: { interval },
}),
'euiPrettyInterval.secondsShorthand': ({ interval }: EuiValues) =>
i18n.translate('core.euiPrettyInterval.secondsShorthand', {
defaultMessage: '{interval} s',
values: { interval },
}),
'euiPrettyInterval.minutesShorthand': ({ interval }: EuiValues) =>
i18n.translate('core.euiPrettyInterval.minutesShorthand', {
defaultMessage: '{interval} m',
values: { interval },
}),
'euiPrettyInterval.hoursShorthand': ({ interval }: EuiValues) =>
i18n.translate('core.euiPrettyInterval.hoursShorthand', {
defaultMessage: '{interval} h',
values: { interval },
}),
'euiPrettyInterval.daysShorthand': ({ interval }: EuiValues) =>
i18n.translate('core.euiPrettyInterval.daysShorthand', {
defaultMessage: '{interval} d',
values: { interval },
}),
'euiPrettyInterval.off': i18n.translate('core.euiPrettyInterval.off', {
defaultMessage: 'Off',
}),
'euiTimeOptions.last': i18n.translate('core.euiTimeOptions.last', {
defaultMessage: 'Last',
}),
'euiTimeOptions.next': i18n.translate('core.euiTimeOptions.next', {
defaultMessage: 'Next',
}),
'euiTimeOptions.seconds': i18n.translate('core.euiTimeOptions.seconds', {
defaultMessage: 'Seconds',
}),
'euiTimeOptions.minutes': i18n.translate('core.euiTimeOptions.minutes', {
defaultMessage: 'Minutes',
}),
'euiTimeOptions.hours': i18n.translate('core.euiTimeOptions.hours', {
defaultMessage: 'Hours',
}),
'euiTimeOptions.days': i18n.translate('core.euiTimeOptions.days', {
defaultMessage: 'Days',
}),
'euiTimeOptions.weeks': i18n.translate('core.euiTimeOptions.weeks', {
defaultMessage: 'Weeks',
}),
'euiTimeOptions.months': i18n.translate('core.euiTimeOptions.months', {
defaultMessage: 'Months',
}),
'euiTimeOptions.years': i18n.translate('core.euiTimeOptions.years', {
defaultMessage: 'Years',
}),
'euiTimeOptions.secondsAgo': i18n.translate('core.euiTimeOptions.secondsAgo', {
defaultMessage: 'Seconds ago',
}),
'euiTimeOptions.minutesAgo': i18n.translate('core.euiTimeOptions.minutesAgo', {
defaultMessage: 'Minutes ago',
}),
'euiTimeOptions.hoursAgo': i18n.translate('core.euiTimeOptions.hoursAgo', {
defaultMessage: 'Hours ago',
}),
'euiTimeOptions.daysAgo': i18n.translate('core.euiTimeOptions.daysAgo', {
defaultMessage: 'Days ago',
}),
'euiTimeOptions.weeksAgo': i18n.translate('core.euiTimeOptions.weeksAgo', {
defaultMessage: 'Weeks ago',
}),
'euiTimeOptions.monthsAgo': i18n.translate('core.euiTimeOptions.monthsAgo', {
defaultMessage: 'Months ago',
}),
'euiTimeOptions.yearsAgo': i18n.translate('core.euiTimeOptions.yearsAgo', {
defaultMessage: 'Years ago',
}),
'euiTimeOptions.secondsFromNow': i18n.translate('core.euiTimeOptions.secondsFromNow', {
defaultMessage: 'Seconds from now',
}),
'euiTimeOptions.minutesFromNow': i18n.translate('core.euiTimeOptions.minutesFromNow', {
defaultMessage: 'Minutes from now',
}),
'euiTimeOptions.hoursFromNow': i18n.translate('core.euiTimeOptions.hoursFromNow', {
defaultMessage: 'Hours from now',
}),
'euiTimeOptions.daysFromNow': i18n.translate('core.euiTimeOptions.daysFromNow', {
defaultMessage: 'Days from now',
}),
'euiTimeOptions.weeksFromNow': i18n.translate('core.euiTimeOptions.weeksFromNow', {
defaultMessage: 'Weeks from now',
}),
'euiTimeOptions.monthsFromNow': i18n.translate('core.euiTimeOptions.monthsFromNow', {
defaultMessage: 'Months from now',
}),
'euiTimeOptions.yearsFromNow': i18n.translate('core.euiTimeOptions.yearsFromNow', {
defaultMessage: 'Years from now',
}),
'euiTimeOptions.roundToSecond': i18n.translate('core.euiTimeOptions.roundToSecond', {
defaultMessage: 'Round to the second',
}),
'euiTimeOptions.roundToMinute': i18n.translate('core.euiTimeOptions.roundToMinute', {
defaultMessage: 'Round to the minute',
}),
'euiTimeOptions.roundToHour': i18n.translate('core.euiTimeOptions.roundToHour', {
defaultMessage: 'Round to the hour',
}),
'euiTimeOptions.roundToDay': i18n.translate('core.euiTimeOptions.roundToDay', {
defaultMessage: 'Round to the day',
}),
'euiTimeOptions.roundToWeek': i18n.translate('core.euiTimeOptions.roundToWeek', {
defaultMessage: 'Round to the week',
}),
'euiTimeOptions.roundToMonth': i18n.translate('core.euiTimeOptions.roundToMonth', {
defaultMessage: 'Round to the month',
}),
'euiTimeOptions.roundToYear': i18n.translate('core.euiTimeOptions.roundToYear', {
defaultMessage: 'Round to the year',
}),
'euiTimeOptions.today': i18n.translate('core.euiTimeOptions.today', {
defaultMessage: 'Today',
}),
'euiTimeOptions.thisWeek': i18n.translate('core.euiTimeOptions.thisWeek', {
defaultMessage: 'This week',
}),
'euiTimeOptions.thisMonth': i18n.translate('core.euiTimeOptions.thisMonth', {
defaultMessage: 'This month',
}),
'euiTimeOptions.thisYear': i18n.translate('core.euiTimeOptions.thisYear', {
defaultMessage: 'This year',
}),
'euiTimeOptions.yesterday': i18n.translate('core.euiTimeOptions.yesterday', {
defaultMessage: 'Yesterday',
}),
'euiTimeOptions.weekToDate': i18n.translate('core.euiTimeOptions.weekToDate', {
defaultMessage: 'Week to date',
}),
'euiTimeOptions.monthToDate': i18n.translate('core.euiTimeOptions.monthToDate', {
defaultMessage: 'Month to date',
}),
'euiTimeOptions.yearToDate': i18n.translate('core.euiTimeOptions.yearToDate', {
defaultMessage: 'Year to date',
}),
'euiQuickSelect.applyButton': i18n.translate('core.euiQuickSelect.applyButton', {
defaultMessage: 'Apply',
}),
@ -888,21 +1161,50 @@ export const getEuiContextMapping = (): EuiTokensObject => {
defaultMessage: 'Refresh is on, interval set to {optionValue} {optionText}.',
values: { optionValue, optionText },
}),
'euiDatePopoverContent.startDateLabel': i18n.translate(
'core.euiDatePopoverContent.startDateLabel',
{ defaultMessage: 'Start date' }
),
'euiDatePopoverContent.endDateLabel': i18n.translate(
'core.euiDatePopoverContent.endDateLabel',
{ defaultMessage: 'End date' }
),
'euiDatePopoverContent.absoluteTabLabel': i18n.translate(
'core.euiDatePopoverContent.absoluteTabLabel',
{ defaultMessage: 'Absolute' }
),
'euiDatePopoverContent.relativeTabLabel': i18n.translate(
'core.euiDatePopoverContent.relativeTabLabel',
{ defaultMessage: 'Relative' }
),
'euiDatePopoverContent.nowTabLabel': i18n.translate('core.euiDatePopoverContent.nowTabLabel', {
defaultMessage: 'Now',
}),
'euiDatePopoverContent.nowTabContent': i18n.translate(
'core.euiDatePopoverContent.nowTabContent',
{
defaultMessage:
'Setting the time to "now" means that on every refresh this time will be set to the time of the refresh.',
}
),
'euiDatePopoverContent.nowTabButtonStart': i18n.translate(
'core.euiDatePopoverContent.nowTabButtonStart',
{ defaultMessage: 'Set start date and time to now' }
),
'euiDatePopoverContent.nowTabButtonEnd': i18n.translate(
'core.euiDatePopoverContent.nowTabButtonEnd',
{ defaultMessage: 'Set end date and time to now' }
),
'euiAbsoluteTab.dateFormatError': ({ dateFormat }: EuiValues) =>
i18n.translate('core.euiAbsoluteTab.dateFormatError', {
defaultMessage: 'Expected format: {dateFormat}',
values: { dateFormat },
}),
'euiRelativeTab.fullDescription': ({ unit }: EuiValues) =>
i18n.translate('core.euiRelativeTab.fullDescription', {
defaultMessage: 'The unit is changeable. Currently set to {unit}.',
values: { unit },
}),
'euiRelativeTab.relativeDate': ({ position }: EuiValues) =>
i18n.translate('core.euiRelativeTab.relativeDate', {
defaultMessage: '{position} date',
values: { position },
}),
'euiRelativeTab.roundingLabel': ({ unit }: EuiValues) =>
i18n.translate('core.euiRelativeTab.roundingLabel', {
defaultMessage: 'Round to the {unit}',
values: { unit },
}),
'euiRelativeTab.unitInputLabel': i18n.translate('core.euiRelativeTab.unitInputLabel', {
defaultMessage: 'Relative time span',
}),

View file

@ -77,6 +77,6 @@ export const LICENSE_OVERRIDES = {
'jsts@1.6.2': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts
'@mapbox/jsonlint-lines-primitives@2.0.2': ['MIT'], // license in readme https://github.com/tmcw/jsonlint
'@elastic/ems-client@8.2.0': ['Elastic License 2.0'],
'@elastic/eui@52.2.0': ['SSPL-1.0 OR Elastic License 2.0'],
'@elastic/eui@53.0.1': ['SSPL-1.0 OR Elastic License 2.0'],
'language-subtag-registry@0.3.21': ['CC-BY-4.0'], // retired ODCBy license https://github.com/mattcg/language-subtag-registry
};

View file

@ -105,7 +105,7 @@ function wrapQueryBarTopRowInContext(testProps: any) {
describe('QueryBarTopRowTopRow', () => {
const QUERY_INPUT_SELECTOR = 'QueryStringInputUI';
const TIMEPICKER_SELECTOR = 'EuiSuperDatePicker';
const TIMEPICKER_SELECTOR = 'Memo(EuiSuperDatePicker)';
const TIMEPICKER_DURATION = '[data-shared-timefilter-duration]';
beforeEach(() => {

View file

@ -19,7 +19,7 @@ import {
EuiFlexItem,
EuiSuperDatePicker,
EuiFieldText,
prettyDuration,
usePrettyDuration,
EuiIconProps,
EuiSuperUpdateButton,
OnRefreshProps,
@ -92,12 +92,12 @@ const SharingMetaFields = React.memo(function SharingMetaFields({
return valueAsMoment.toISOString();
}
const dateRangePretty = prettyDuration(
toAbsoluteString(from),
toAbsoluteString(to),
[],
dateFormat
);
const dateRangePretty = usePrettyDuration({
timeFrom: toAbsoluteString(from),
timeTo: toAbsoluteString(to),
quickRanges: [],
dateFormat,
});
return (
<div

View file

@ -98,7 +98,9 @@ jest.mock('../../../contexts/kibana', () => ({
},
}));
const MockedEuiSuperDatePicker = EuiSuperDatePicker as jest.MockedClass<typeof EuiSuperDatePicker>;
const MockedEuiSuperDatePicker = EuiSuperDatePicker as jest.MockedFunction<
typeof EuiSuperDatePicker
>;
describe('Navigation Menu: <DatePickerWrapper />', () => {
beforeEach(() => {

View file

@ -22,63 +22,14 @@ exports[`ExecutionLogTable snapshots renders correctly against snapshot 1`] = `
}
>
<EuiSuperDatePicker
commonlyUsedRanges={
Array [
Object {
"end": "now/d",
"label": "Today",
"start": "now/d",
},
Object {
"end": "now/w",
"label": "This week",
"start": "now/w",
},
Object {
"end": "now/M",
"label": "This month",
"start": "now/M",
},
Object {
"end": "now/y",
"label": "This year",
"start": "now/y",
},
Object {
"end": "now-1d/d",
"label": "Yesterday",
"start": "now-1d/d",
},
Object {
"end": "now",
"label": "Week to date",
"start": "now/w",
},
Object {
"end": "now",
"label": "Month to date",
"start": "now/M",
},
Object {
"end": "now",
"label": "Year to date",
"start": "now/y",
},
]
}
dateFormat="MMM D, YYYY @ HH:mm:ss.SSS"
end="now"
isAutoRefreshOnly={false}
isDisabled={false}
isPaused={true}
onRefresh={[Function]}
onRefreshChange={[Function]}
onTimeChange={[Function]}
recentlyUsedRanges={Array []}
refreshInterval={1000}
showUpdateButton={true}
start="now-24h"
timeFormat="HH:mm"
width="full"
/>
</EuiFlexItem>

View file

@ -1161,8 +1161,6 @@
"core.euiRelativeTab.fullDescription": "L'unité peut être modifiée. Elle est actuellement définie sur {unit}.",
"core.euiRelativeTab.numberInputError": "Doit être >= 0.",
"core.euiRelativeTab.numberInputLabel": "Nombre d'intervalles",
"core.euiRelativeTab.relativeDate": "Date de {position}",
"core.euiRelativeTab.roundingLabel": "Arrondir à {unit}",
"core.euiRelativeTab.unitInputLabel": "Intervalle relatif",
"core.euiResizableButton.horizontalResizerAriaLabel": "Utilisez les flèches gauche et droite pour ajuster la taille des panneaux.",
"core.euiResizableButton.verticalResizerAriaLabel": "Utilisez les flèches vers le haut et vers le bas pour ajuster la taille des panneaux.",

View file

@ -1445,8 +1445,6 @@
"core.euiRelativeTab.fullDescription": "単位は変更可能です。現在 {unit} に設定されています。",
"core.euiRelativeTab.numberInputError": "0以上でなければなりません",
"core.euiRelativeTab.numberInputLabel": "時間スパンの量",
"core.euiRelativeTab.relativeDate": "{position} 日付",
"core.euiRelativeTab.roundingLabel": "{unit} に四捨五入する",
"core.euiRelativeTab.unitInputLabel": "相対的時間スパン",
"core.euiResizableButton.horizontalResizerAriaLabel": "左右矢印キーを押してパネルサイズを調整します",
"core.euiResizableButton.verticalResizerAriaLabel": "上下矢印キーを押してパネルサイズを調整します",

View file

@ -1450,8 +1450,6 @@
"core.euiRelativeTab.fullDescription": "单位可更改。当前设置为 {unit}。",
"core.euiRelativeTab.numberInputError": "必须 >= 0",
"core.euiRelativeTab.numberInputLabel": "时间跨度量",
"core.euiRelativeTab.relativeDate": "{position} 日期",
"core.euiRelativeTab.roundingLabel": "舍入为 {unit}",
"core.euiRelativeTab.unitInputLabel": "相对时间跨度",
"core.euiResizableButton.horizontalResizerAriaLabel": "按左或右箭头键调整面板大小",
"core.euiResizableButton.verticalResizerAriaLabel": "按上或下箭头键调整面板大小",

View file

@ -6,7 +6,8 @@
*/
import React from 'react';
import { prettyDuration, commonDurationRanges } from '@elastic/eui';
import { renderToString } from 'react-dom/server';
import { PrettyDuration } from '@elastic/eui';
import { IEmbeddable, Embeddable, EmbeddableInput } from 'src/plugins/embeddable/public';
import { Action, IncompatibleActionError } from '../../../../src/plugins/ui_actions/public';
import { TimeRange } from '../../../../src/plugins/data/public';
@ -52,11 +53,12 @@ export class CustomTimeRangeBadge implements Action<TimeBadgeActionContext> {
}
public getDisplayName({ embeddable }: TimeBadgeActionContext) {
return prettyDuration(
embeddable.getInput().timeRange.from,
embeddable.getInput().timeRange.to,
commonDurationRanges,
this.dateFormat
return renderToString(
<PrettyDuration
timeFrom={embeddable.getInput().timeRange.from}
timeTo={embeddable.getInput().timeRange.to}
dateFormat={this.dateFormat}
/>
);
}

View file

@ -42,7 +42,7 @@ export default function ({ getPageObjects, getService }) {
it('should update global Kibana refresh config to value stored with map', async () => {
const kibanaRefreshConfig = await PageObjects.timePicker.getRefreshConfig();
expect(kibanaRefreshConfig.interval).to.equal('1');
expect(kibanaRefreshConfig.units).to.equal('seconds');
expect(kibanaRefreshConfig.units).to.equal('Seconds');
expect(kibanaRefreshConfig.isPaused).to.equal(true);
});

View file

@ -1516,10 +1516,10 @@
resolved "https://registry.yarnpkg.com/@elastic/eslint-plugin-eui/-/eslint-plugin-eui-0.0.2.tgz#56b9ef03984a05cc213772ae3713ea8ef47b0314"
integrity sha512-IoxURM5zraoQ7C8f+mJb9HYSENiZGgRVcG4tLQxE61yHNNRDXtGDWTZh8N1KIHcsqN1CEPETjuzBXkJYF/fDiQ==
"@elastic/eui@52.2.0":
version "52.2.0"
resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-52.2.0.tgz#761101a29b96a4b5270ef93541dab7bb27f5ca50"
integrity sha512-XboYerntCOTHWHYMWJGzJtu5JYO6pk5IWh0ZHJEQ4SEjmLbTV2bFrVBTO/8uaU7GhV9/RNIo7BU5wHRyYP7z1g==
"@elastic/eui@53.0.1":
version "53.0.1"
resolved "https://registry.yarnpkg.com/@elastic/eui/-/eui-53.0.1.tgz#82359460ae4edab3a538846b6915518cb1214848"
integrity sha512-fPOuDyc7adjHBp+UHOtIJTHdZVKi8MGzyuYxTRN8ZYLHbzcNTaCsogdk+0eb6u4ISRqhk3tudG8Q0znksVHt1w==
dependencies:
"@types/chroma-js" "^2.0.0"
"@types/lodash" "^4.14.160"