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

[uiSettings]Removes Infinity from notifications lifetimes #97384

Conversation

TinaHeiligers
Copy link
Contributor

@TinaHeiligers TinaHeiligers commented Apr 16, 2021

Resolves #30109

Summary

Follows approach 1 outlined below.
(edit) Removes support for 'Infinity' and updates text rendered in Advanced Settings for the notifications lifetimes Retains support for 'Infinity' but removes the sentence mentioning using 'Infinity' from the ui text in Advanced settings for:

  • notifications:lifetime:banner
  • notifications:lifetime:error
  • notifications:lifetime:warning
  • notifications:lifetime:info

Updates the schema for these fields to only allow number and updates the description fields, removing the line that mentions using 'Infinity'.

If the approach in this PR is approved, A PR to update the docs will follow shortly.

History

Several folks have raised issues (e.g. #30109) that there's no way one can set a value of 'Infinity' in Advanced Settings for the notifications banner, error, warning and info lifetimes even though the ui text mentions that 'Infinity' is supported.
I verified the comment that the code itself supports using 'Infinity' and the schema for these fields also allows it.
I traced the problem back through code history and I think the confusion stems from the fact that the descriptions for these fields haven't changed since the settings were first introduced in Feb 2016.

Prior to this PR, setting the value of the notifications' lifetime to 'Infinity' directly in the notifications code has the following effect:

  • The value for that setting is empty in the ui.
  • The public component itself has validation: undefined. (see screenshots attached)
  • One can still change it in the ui, but only to a positive number.
  • Resetting to default clears the field again.
  • Notifications themselves only show for the briefest moment. (see the gif below)

Note that one can only set the value for notifications:lifetime:info to Infinity if the object is moved further up in the file 🤷‍♀️ .

There are two other approaches we can take here:

  1. Keep support for 'Infinity' in the code and simply remove the text mentioning it is a valid value from the ui text and the docs since end users have no way of configuring it to anything other than a positive integer. (will also require an update to the docs)
  2. Use a custom ui component that allows the end user to choose either a positive integer value or 'Infinity'. (won't require an update to the docs)

Option 1 is less effort than this PR, and we could move the text to a code comment to let developers know it is supported.

Option 2 will require more work as we'd need to redesign the component to allow for both positive numeric fields and an absolute value of 'Infinity'.

Screen Shot 2021-04-16 at 15 37 54

Notifications lifetimes set to Infinity

Notifications_using_Infinity_as_values

Checklist

Delete any items that are not applicable to this PR.

  • Unit or functional tests were updated or added to match the most common scenarios
  • Any UI touched in this PR is usable by keyboard only (learn more about keyboard accessibility)
  • Any UI touched in this PR does not create any new axe failures (run axe in browser: FF, Chrome)

For maintainers

@TinaHeiligers TinaHeiligers added Feature:uiSettings release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.13.0 v8.0.0 labels Apr 16, 2021
@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@TinaHeiligers TinaHeiligers force-pushed the ui-settings/remove-notification-lifetime-Infinity-support branch from 91904b3 to 5aa86e3 Compare April 18, 2021 14:22
@TinaHeiligers TinaHeiligers marked this pull request as ready for review April 18, 2021 21:06
@TinaHeiligers TinaHeiligers requested a review from a team as a code owner April 18, 2021 21:06
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

Comment on lines 107 to 91
schema: schema.oneOf([schema.number({ min: 0 }), schema.literal('Infinity')]),
schema: schema.number({ min: 0 }),
Copy link
Contributor

@pgayvallet pgayvallet Apr 19, 2021

Choose a reason for hiding this comment

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

This is a breaking change for customers, as any Kibana instance currently overriding this value via the uiSettings.overrides config property will no longer start due to a validation error.

private validatesOverrides() {
for (const [key, value] of Object.entries(this.overrides)) {
const definition = this.uiSettingsDefaults.get(key);
// overrides might contain UiSettings for a disabled plugin
if (definition?.schema) {
definition.schema.validate(value, {}, `ui settings overrides [${key}]`);
}
}
}

This will also cause warnings every time the uiSettings are fetched:

try {
this.validateKey(key, userValue);
filteredValues[key] = {
userValue: userValue as T,
};
} catch (error) {
this.log.warn(`Ignore invalid UiSettings value. ${error}.`);
}

If we really want to remove this value from these settings, our only option would be to add the associated migration in src/core/server/ui_settings/saved_objects/migrations.ts to migrate the value to a new valid one.

However (and I know we already discussed it in the weekly, but), I'm not sure we should drive a model change based only on a UI limitation.

OTOH, note that

  1. Keep support for 'Infinity' in the code and simply remove the text mentioning it is a valid value from the ui text and the docs since end users have no way of configuring it to anything other than a positive integer. (will also require an update to the docs)

would be awkward for users already using this value, as Infinity simply does not appear in the UI even if already defined via overrides. However, I think this would be acceptable.

I would pragmatically use this solution for now though, as developing a custom component (and adding the associated uiSettings type) seems to much work for the gain here.

Copy link
Contributor Author

@TinaHeiligers TinaHeiligers Apr 19, 2021

Choose a reason for hiding this comment

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

I would pragmatically use this solution for now though, as developing a custom component (and adding the associated uiSettings type) seems to much work for the gain here

@pgayvallet I agree, and will take the first approach.

overriding this value via the uiSettings.overrides config property

I can't find where in the docs we mention these settings, they're not in the Configure Kibana section. Do you know where these are in the docs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure, we may just not have any documentation on it tbh. Greping uiSettings.overrides in /docs has no match... @mshustov maybe you know?

Copy link
Contributor

Choose a reason for hiding this comment

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

they are not documented in https://www.elastic.co/guide/en/kibana/current/advanced-options.html nor in https://www.elastic.co/guide/en/kibana/current/settings.html

I'd ask Docs team whether we want to announce this API to the wider audience.

Copy link
Member

Choose a reason for hiding this comment

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

we may just not have any documentation on it tbh

Yeah, AFAIK this has always been an undocumented feature since it was added in 6.5. It was in our release notes, but I don't think it was ever added to the documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, I'll follow up with a docs PR to remove the sentences mentioning 'Infinity' as an options for the notifications lifetime settings in Advanced Settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@elastic/kibana-core it would be nice to have this in for 7.13. If someone has time to have another look, that would be great 😄

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

LGTM

@TinaHeiligers TinaHeiligers added the auto-backport Deprecated - use backport:version if exact versions are needed label Apr 20, 2021
@TinaHeiligers TinaHeiligers merged commit 948aa3a into elastic:master Apr 20, 2021
@TinaHeiligers TinaHeiligers deleted the ui-settings/remove-notification-lifetime-Infinity-support branch April 20, 2021 13:52
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 20, 2021
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Apr 20, 2021
…97644)

Co-authored-by: Christiane (Tina) Heiligers <christiane.heiligers@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:uiSettings release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notifications lifetimes cannot be set to Infinity in Advanced Settings
6 participants