Skip to content

Comments

[Discover] Add hideAnnouncements advanced setting#135030

Merged
dimaanj merged 5 commits intoelastic:mainfrom
dimaanj:add-hide-announcements-advanced-setting
Jun 28, 2022
Merged

[Discover] Add hideAnnouncements advanced setting#135030
dimaanj merged 5 commits intoelastic:mainfrom
dimaanj:add-hide-announcements-advanced-setting

Conversation

@dimaanj
Copy link
Contributor

@dimaanj dimaanj commented Jun 23, 2022

Summary

Closes #133275

This PR adds new hideAnnouncements Advanced setting. By default it's false for most users, but disabling it can be helpful for:

  • Developers working on Kibana
  • CI, a source of flakiness
  • Advanced users

8556E375-2CA8-4434-84C4-7A40D0B06758_4_5005_c

Checklist

@dimaanj dimaanj added Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v8.4.0 labels Jun 23, 2022
@dimaanj dimaanj self-assigned this Jun 23, 2022
Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

Discover code already LGTM, looking forward to the time this PR will save in a year 👍

@kertal
Copy link
Member

kertal commented Jun 24, 2022

@elasticmachine merge upstream -- failure seems to be unrelated

@kertal
Copy link
Member

kertal commented Jun 27, 2022

@dimaanj this should be ready for review, right?

@dimaanj dimaanj marked this pull request as ready for review June 27, 2022 09:30
@dimaanj dimaanj requested review from a team as code owners June 27, 2022 09:30
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@dimaanj
Copy link
Contributor Author

dimaanj commented Jun 27, 2022

@elasticmachine merge upstream

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

LGTM 👍 , tested a-la-carte and works as expected

@kibana-ci
Copy link

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
discover 62 63 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 490.2KB 490.3KB +112.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
discover 40.6KB 40.7KB +73.0B
Unknown metric groups

API count

id before after diff
discover 78 79 +1

History

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

cc @dimaanj

@dimaanj dimaanj merged commit f89efc7 into elastic:main Jun 28, 2022
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label Jun 28, 2022
Copy link
Contributor

@gsoldevila gsoldevila left a comment

Choose a reason for hiding this comment

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

LGTM

@matschaffer
Copy link
Contributor

Nice! How can we set this from kibana.dev.yml?

@kertal
Copy link
Member

kertal commented Jun 28, 2022

think it should work with overrides in kibana.yml?

https://www.elastic.co/guide/en/kibana/master/ui-settings-service.html#uisettings-overrides

@matschaffer
Copy link
Contributor

matschaffer commented Jun 29, 2022

@kertal I ended up searching company slack for this syntax:

uiSettings:
  overrides:
    hideAnnouncements: true

Thinking maybe we should have an example config in that doc. Or maybe it exists in another page already?

Update: I tried the "edit" button to open #135385

jen-huang added a commit that referenced this pull request May 10, 2024
## Summary

Resolves #180659.

The original bug reported an error being throw when trying to dismiss
the agent activity tour while logged in as a user with limited access.

This was happening because the tour was backed by a `uiSetting` and
attempted to write a new value to `/internal/kibana/settings` after
dismissing the tour. `uiSettings` backs the global Kibana advanced
settings used by all users in an instance. Therefore only users with
access to Management > Advanced settings are allowed to write to it.

The tours that we use in Fleet and Integrations is not the right use
case for `uiSettings`. This PR changes the logic for the two tours
(agent activity and add agent) so that:

- If `uiSetting`'s `hideAnnouncements` is true, never show these tours -
this is a global setting intended to surpress these kind of tours and
messages, see #135030
- Otherwise read from and write to local storage (using Kibana's
`storage` service) to determine whether to show these tours or not
- Never attempt to write to `uiSettings`
- Normalize the code pattern used by hooks related to the inactive
agents tour (they were already using local storage but not from
`useStartServices`)

You can test this by:

1. Opening actions menu in an agent list row, add a new tag to the
agent, and dismiss the Agent activity tour. Refresh the page, perform
the action again, and tour should not show
2. From Integrations, add an integration to a new policy without adding
an agent, after returning to the integration policies list, dismiss the
Add agent activity tour. Refresh the page, perform the action again, and
tour should not show

You can clear these `fleet.*` local settings to trigger the tours again,
or use another browser / incognito mode:

<img width="694" alt="image"
src="https://github.com/elastic/kibana/assets/1965714/817f48fc-2a6a-411d-8242-f855f862c622">
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 10, 2024
…183102)

## Summary

Resolves elastic#180659.

The original bug reported an error being throw when trying to dismiss
the agent activity tour while logged in as a user with limited access.

This was happening because the tour was backed by a `uiSetting` and
attempted to write a new value to `/internal/kibana/settings` after
dismissing the tour. `uiSettings` backs the global Kibana advanced
settings used by all users in an instance. Therefore only users with
access to Management > Advanced settings are allowed to write to it.

The tours that we use in Fleet and Integrations is not the right use
case for `uiSettings`. This PR changes the logic for the two tours
(agent activity and add agent) so that:

- If `uiSetting`'s `hideAnnouncements` is true, never show these tours -
this is a global setting intended to surpress these kind of tours and
messages, see elastic#135030
- Otherwise read from and write to local storage (using Kibana's
`storage` service) to determine whether to show these tours or not
- Never attempt to write to `uiSettings`
- Normalize the code pattern used by hooks related to the inactive
agents tour (they were already using local storage but not from
`useStartServices`)

You can test this by:

1. Opening actions menu in an agent list row, add a new tag to the
agent, and dismiss the Agent activity tour. Refresh the page, perform
the action again, and tour should not show
2. From Integrations, add an integration to a new policy without adding
an agent, after returning to the integration policies list, dismiss the
Add agent activity tour. Refresh the page, perform the action again, and
tour should not show

You can clear these `fleet.*` local settings to trigger the tours again,
or use another browser / incognito mode:

<img width="694" alt="image"
src="https://github.com/elastic/kibana/assets/1965714/817f48fc-2a6a-411d-8242-f855f862c622">

(cherry picked from commit 8cf79b7)
kibanamachine referenced this pull request May 10, 2024
…183102) (#183159)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[UII] Use local storage for tours in Fleet and Integrations
(#183102)](#183102)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Jen
Huang","email":"its.jenetic@gmail.com"},"sourceCommit":{"committedDate":"2024-05-10T14:20:43Z","message":"[UII]
Use local storage for tours in Fleet and Integrations (#183102)\n\n##
Summary\r\n\r\nResolves
https://github.com/elastic/kibana/issues/180659.\r\n\r\nThe original bug
reported an error being throw when trying to dismiss\r\nthe agent
activity tour while logged in as a user with limited access.\r\n\r\nThis
was happening because the tour was backed by a `uiSetting`
and\r\nattempted to write a new value to `/internal/kibana/settings`
after\r\ndismissing the tour. `uiSettings` backs the global Kibana
advanced\r\nsettings used by all users in an instance. Therefore only
users with\r\naccess to Management > Advanced settings are allowed to
write to it.\r\n\r\nThe tours that we use in Fleet and Integrations is
not the right use\r\ncase for `uiSettings`. This PR changes the logic
for the two tours\r\n(agent activity and add agent) so that:\r\n\r\n- If
`uiSetting`'s `hideAnnouncements` is true, never show these tours
-\r\nthis is a global setting intended to surpress these kind of tours
and\r\nmessages, see https://github.com/elastic/kibana/pull/135030\r\n-
Otherwise read from and write to local storage (using
Kibana's\r\n`storage` service) to determine whether to show these tours
or not\r\n- Never attempt to write to `uiSettings`\r\n- Normalize the
code pattern used by hooks related to the inactive\r\nagents tour (they
were already using local storage but not
from\r\n`useStartServices`)\r\n\r\nYou can test this by:\r\n\r\n1.
Opening actions menu in an agent list row, add a new tag to
the\r\nagent, and dismiss the Agent activity tour. Refresh the page,
perform\r\nthe action again, and tour should not show\r\n2. From
Integrations, add an integration to a new policy without adding\r\nan
agent, after returning to the integration policies list, dismiss
the\r\nAdd agent activity tour. Refresh the page, perform the action
again, and\r\ntour should not show\r\n\r\nYou can clear these `fleet.*`
local settings to trigger the tours again,\r\nor use another browser /
incognito mode:\r\n\r\n<img width=\"694\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/1965714/817f48fc-2a6a-411d-8242-f855f862c622\">","sha":"8cf79b71f26b324a27a45e6a3729cbcfb64643bb","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v8.14.0","v8.15.0"],"title":"[UII]
Use local storage for tours in Fleet and
Integrations","number":183102,"url":"https://github.com/elastic/kibana/pull/183102","mergeCommit":{"message":"[UII]
Use local storage for tours in Fleet and Integrations (#183102)\n\n##
Summary\r\n\r\nResolves
https://github.com/elastic/kibana/issues/180659.\r\n\r\nThe original bug
reported an error being throw when trying to dismiss\r\nthe agent
activity tour while logged in as a user with limited access.\r\n\r\nThis
was happening because the tour was backed by a `uiSetting`
and\r\nattempted to write a new value to `/internal/kibana/settings`
after\r\ndismissing the tour. `uiSettings` backs the global Kibana
advanced\r\nsettings used by all users in an instance. Therefore only
users with\r\naccess to Management > Advanced settings are allowed to
write to it.\r\n\r\nThe tours that we use in Fleet and Integrations is
not the right use\r\ncase for `uiSettings`. This PR changes the logic
for the two tours\r\n(agent activity and add agent) so that:\r\n\r\n- If
`uiSetting`'s `hideAnnouncements` is true, never show these tours
-\r\nthis is a global setting intended to surpress these kind of tours
and\r\nmessages, see https://github.com/elastic/kibana/pull/135030\r\n-
Otherwise read from and write to local storage (using
Kibana's\r\n`storage` service) to determine whether to show these tours
or not\r\n- Never attempt to write to `uiSettings`\r\n- Normalize the
code pattern used by hooks related to the inactive\r\nagents tour (they
were already using local storage but not
from\r\n`useStartServices`)\r\n\r\nYou can test this by:\r\n\r\n1.
Opening actions menu in an agent list row, add a new tag to
the\r\nagent, and dismiss the Agent activity tour. Refresh the page,
perform\r\nthe action again, and tour should not show\r\n2. From
Integrations, add an integration to a new policy without adding\r\nan
agent, after returning to the integration policies list, dismiss
the\r\nAdd agent activity tour. Refresh the page, perform the action
again, and\r\ntour should not show\r\n\r\nYou can clear these `fleet.*`
local settings to trigger the tours again,\r\nor use another browser /
incognito mode:\r\n\r\n<img width=\"694\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/1965714/817f48fc-2a6a-411d-8242-f855f862c622\">","sha":"8cf79b71f26b324a27a45e6a3729cbcfb64643bb"}},"sourceBranch":"main","suggestedTargetBranches":["8.14"],"targetPullRequestStates":[{"branch":"8.14","label":"v8.14.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/183102","number":183102,"mergeCommit":{"message":"[UII]
Use local storage for tours in Fleet and Integrations (#183102)\n\n##
Summary\r\n\r\nResolves
https://github.com/elastic/kibana/issues/180659.\r\n\r\nThe original bug
reported an error being throw when trying to dismiss\r\nthe agent
activity tour while logged in as a user with limited access.\r\n\r\nThis
was happening because the tour was backed by a `uiSetting`
and\r\nattempted to write a new value to `/internal/kibana/settings`
after\r\ndismissing the tour. `uiSettings` backs the global Kibana
advanced\r\nsettings used by all users in an instance. Therefore only
users with\r\naccess to Management > Advanced settings are allowed to
write to it.\r\n\r\nThe tours that we use in Fleet and Integrations is
not the right use\r\ncase for `uiSettings`. This PR changes the logic
for the two tours\r\n(agent activity and add agent) so that:\r\n\r\n- If
`uiSetting`'s `hideAnnouncements` is true, never show these tours
-\r\nthis is a global setting intended to surpress these kind of tours
and\r\nmessages, see https://github.com/elastic/kibana/pull/135030\r\n-
Otherwise read from and write to local storage (using
Kibana's\r\n`storage` service) to determine whether to show these tours
or not\r\n- Never attempt to write to `uiSettings`\r\n- Normalize the
code pattern used by hooks related to the inactive\r\nagents tour (they
were already using local storage but not
from\r\n`useStartServices`)\r\n\r\nYou can test this by:\r\n\r\n1.
Opening actions menu in an agent list row, add a new tag to
the\r\nagent, and dismiss the Agent activity tour. Refresh the page,
perform\r\nthe action again, and tour should not show\r\n2. From
Integrations, add an integration to a new policy without adding\r\nan
agent, after returning to the integration policies list, dismiss
the\r\nAdd agent activity tour. Refresh the page, perform the action
again, and\r\ntour should not show\r\n\r\nYou can clear these `fleet.*`
local settings to trigger the tours again,\r\nor use another browser /
incognito mode:\r\n\r\n<img width=\"694\"
alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/1965714/817f48fc-2a6a-411d-8242-f855f862c622\">","sha":"8cf79b71f26b324a27a45e6a3729cbcfb64643bb"}}]}]
BACKPORT-->

Co-authored-by: Jen Huang <its.jenetic@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v8.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add uiSettings to disable tours in Kibana

8 participants