Skip to content

Commit

Permalink
[uiSettings]Removes Infinity from notifications lifetimes (elastic#97384
Browse files Browse the repository at this point in the history
)
  • Loading branch information
TinaHeiligers authored Apr 20, 2021
1 parent ce2fec2 commit 948aa3a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 64 deletions.
64 changes: 32 additions & 32 deletions src/core/server/ui_settings/settings/notifications.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ describe('notifications settings', () => {
expect(() => validate(42)).not.toThrow();
expect(() => validate('Infinity')).not.toThrow();
expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(`
"types that failed validation:
- [0]: Value must be equal to or greater than [0].
- [1]: expected value to equal [Infinity]"
`);
"types that failed validation:
- [0]: Value must be equal to or greater than [0].
- [1]: expected value to equal [Infinity]"
`);
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(`
"types that failed validation:
- [0]: expected value of type [number] but got [string]
- [1]: expected value to equal [Infinity]"
`);
"types that failed validation:
- [0]: expected value of type [number] but got [string]
- [1]: expected value to equal [Infinity]"
`);
});
});

Expand All @@ -55,15 +55,15 @@ describe('notifications settings', () => {
expect(() => validate(42)).not.toThrow();
expect(() => validate('Infinity')).not.toThrow();
expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(`
"types that failed validation:
- [0]: Value must be equal to or greater than [0].
- [1]: expected value to equal [Infinity]"
`);
"types that failed validation:
- [0]: Value must be equal to or greater than [0].
- [1]: expected value to equal [Infinity]"
`);
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(`
"types that failed validation:
- [0]: expected value of type [number] but got [string]
- [1]: expected value to equal [Infinity]"
`);
"types that failed validation:
- [0]: expected value of type [number] but got [string]
- [1]: expected value to equal [Infinity]"
`);
});
});

Expand All @@ -74,15 +74,15 @@ describe('notifications settings', () => {
expect(() => validate(42)).not.toThrow();
expect(() => validate('Infinity')).not.toThrow();
expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(`
"types that failed validation:
- [0]: Value must be equal to or greater than [0].
- [1]: expected value to equal [Infinity]"
`);
"types that failed validation:
- [0]: Value must be equal to or greater than [0].
- [1]: expected value to equal [Infinity]"
`);
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(`
"types that failed validation:
- [0]: expected value of type [number] but got [string]
- [1]: expected value to equal [Infinity]"
`);
"types that failed validation:
- [0]: expected value of type [number] but got [string]
- [1]: expected value to equal [Infinity]"
`);
});
});

Expand All @@ -93,15 +93,15 @@ describe('notifications settings', () => {
expect(() => validate(42)).not.toThrow();
expect(() => validate('Infinity')).not.toThrow();
expect(() => validate(-12)).toThrowErrorMatchingInlineSnapshot(`
"types that failed validation:
- [0]: Value must be equal to or greater than [0].
- [1]: expected value to equal [Infinity]"
`);
"types that failed validation:
- [0]: Value must be equal to or greater than [0].
- [1]: expected value to equal [Infinity]"
`);
expect(() => validate('foo')).toThrowErrorMatchingInlineSnapshot(`
"types that failed validation:
- [0]: expected value of type [number] but got [string]
- [1]: expected value to equal [Infinity]"
`);
"types that failed validation:
- [0]: expected value of type [number] but got [string]
- [1]: expected value to equal [Infinity]"
`);
});
});
});
32 changes: 8 additions & 24 deletions src/core/server/ui_settings/settings/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,11 @@ export const getNotificationsSettings = (): Record<string, UiSettingsParams> =>
value: 3000000,
description: i18n.translate('core.ui_settings.params.notifications.bannerLifetimeText', {
defaultMessage:
'The time in milliseconds which a banner notification will be displayed on-screen for. ' +
'Setting to {infinityValue} will disable the countdown.',
values: {
infinityValue: 'Infinity',
},
'The time in milliseconds which a banner notification will be displayed on-screen for. ',
}),
type: 'number',
category: ['notifications'],
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]),
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), // Setting to 'Infinity' will disable the countdown.
},
'notifications:lifetime:error': {
name: i18n.translate('core.ui_settings.params.notifications.errorLifetimeTitle', {
Expand All @@ -62,15 +58,11 @@ export const getNotificationsSettings = (): Record<string, UiSettingsParams> =>
value: 300000,
description: i18n.translate('core.ui_settings.params.notifications.errorLifetimeText', {
defaultMessage:
'The time in milliseconds which an error notification will be displayed on-screen for. ' +
'Setting to {infinityValue} will disable.',
values: {
infinityValue: 'Infinity',
},
'The time in milliseconds which an error notification will be displayed on-screen for. ',
}),
type: 'number',
category: ['notifications'],
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]),
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), // Setting to 'Infinity' will disable
},
'notifications:lifetime:warning': {
name: i18n.translate('core.ui_settings.params.notifications.warningLifetimeTitle', {
Expand All @@ -79,15 +71,11 @@ export const getNotificationsSettings = (): Record<string, UiSettingsParams> =>
value: 10000,
description: i18n.translate('core.ui_settings.params.notifications.warningLifetimeText', {
defaultMessage:
'The time in milliseconds which a warning notification will be displayed on-screen for. ' +
'Setting to {infinityValue} will disable.',
values: {
infinityValue: 'Infinity',
},
'The time in milliseconds which a warning notification will be displayed on-screen for. ',
}),
type: 'number',
category: ['notifications'],
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]),
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), // Setting to 'Infinity' will disable
},
'notifications:lifetime:info': {
name: i18n.translate('core.ui_settings.params.notifications.infoLifetimeTitle', {
Expand All @@ -96,15 +84,11 @@ export const getNotificationsSettings = (): Record<string, UiSettingsParams> =>
value: 5000,
description: i18n.translate('core.ui_settings.params.notifications.infoLifetimeText', {
defaultMessage:
'The time in milliseconds which an information notification will be displayed on-screen for. ' +
'Setting to {infinityValue} will disable.',
values: {
infinityValue: 'Infinity',
},
'The time in milliseconds which an information notification will be displayed on-screen for. ',
}),
type: 'number',
category: ['notifications'],
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]),
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]), // Setting to 'Infinity' will disable
},
};
};
4 changes: 0 additions & 4 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -529,15 +529,11 @@
"core.ui_settings.params.maxCellHeightText": "表のセルが使用する高さの上限です。この切り捨てを無効にするには0に設定します",
"core.ui_settings.params.maxCellHeightTitle": "表のセルの高さの上限",
"core.ui_settings.params.notifications.banner.markdownLinkText": "マークダウン対応",
"core.ui_settings.params.notifications.bannerLifetimeText": "バナー通知が画面に表示される時間 (ミリ秒単位) です。{infinityValue}に設定すると、カウントダウンが無効になります。",
"core.ui_settings.params.notifications.bannerLifetimeTitle": "バナー通知時間",
"core.ui_settings.params.notifications.bannerText": "すべてのユーザーへの一時的な通知を目的としたカスタムバナーです。{markdownLink}",
"core.ui_settings.params.notifications.bannerTitle": "カスタムバナー通知",
"core.ui_settings.params.notifications.errorLifetimeText": "エラー通知が画面に表示される時間 (ミリ秒単位) です。{infinityValue}に設定すると、無効になります。",
"core.ui_settings.params.notifications.errorLifetimeTitle": "エラー通知時間",
"core.ui_settings.params.notifications.infoLifetimeText": "情報通知が画面に表示される時間 (ミリ秒単位) です。{infinityValue}に設定すると、無効になります。",
"core.ui_settings.params.notifications.infoLifetimeTitle": "情報通知時間",
"core.ui_settings.params.notifications.warningLifetimeText": "警告通知が画面に表示される時間 (ミリ秒単位) です。{infinityValue}に設定すると、無効になります。",
"core.ui_settings.params.notifications.warningLifetimeTitle": "警告通知時間",
"core.ui_settings.params.storeUrlText": "URLが長くなりすぎるためブラウザーが対応できない場合があります。セッションストレージにURLの一部を保存することでこの問題に対処できるかどうかをテストしています。結果を教えてください!",
"core.ui_settings.params.storeUrlTitle": "セッションストレージにURLを格納",
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,15 +532,11 @@
"core.ui_settings.params.maxCellHeightText": "表单元格应占用的最大高度。设置为 0 可禁用截断",
"core.ui_settings.params.maxCellHeightTitle": "最大表单元格高度",
"core.ui_settings.params.notifications.banner.markdownLinkText": "Markdown 受支持",
"core.ui_settings.params.notifications.bannerLifetimeText": "在屏幕上显示横幅通知的时间 (毫秒) 。设置为 {infinityValue} 将禁用倒计时。",
"core.ui_settings.params.notifications.bannerLifetimeTitle": "横幅通知生存时间",
"core.ui_settings.params.notifications.bannerText": "用于向所有用户发送临时通知的定制横幅。{markdownLink}。",
"core.ui_settings.params.notifications.bannerTitle": "定制横幅通知",
"core.ui_settings.params.notifications.errorLifetimeText": "在屏幕上显示错误通知的时间 (毫秒) 。设置为 {infinityValue} 将禁用此项。",
"core.ui_settings.params.notifications.errorLifetimeTitle": "错误通知生存时间",
"core.ui_settings.params.notifications.infoLifetimeText": "在屏幕上显示信息通知的时间 (毫秒) 。设置为 {infinityValue} 将禁用此项。",
"core.ui_settings.params.notifications.infoLifetimeTitle": "信息通知生存时间",
"core.ui_settings.params.notifications.warningLifetimeText": "在屏幕上显示警告通知的时间 (毫秒) 。设置为 {infinityValue} 将禁用此项。",
"core.ui_settings.params.notifications.warningLifetimeTitle": "警告通知生存时间",
"core.ui_settings.params.storeUrlText": "有时,URL 可能会变得过长,使某些浏览器无法进行处理。为此,我们将正测试在会话存储中存储 URL 的组成部分是否会有所帮助。请向我们反馈您的体验!",
"core.ui_settings.params.storeUrlTitle": "将 URL 存储在会话存储中",
Expand Down

0 comments on commit 948aa3a

Please sign in to comment.