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

[Spaces] Share to spaces flyout swallows errors #171145

Open
Tracked by #167901
nickpeihl opened this issue Nov 13, 2023 · 1 comment
Open
Tracked by #167901

[Spaces] Share to spaces flyout swallows errors #171145

nickpeihl opened this issue Nov 13, 2023 · 1 comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Security/Spaces Platform Security - Spaces feature Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!

Comments

@nickpeihl
Copy link
Member

Describe the bug:

The Share to Space flyout calls1 the Update Objects Spaces API when adding or removing a shared object from Spaces. If the Promise rejects we catch the error and display appropriate toasts2.

However, the Update Objects Spaces API may return a successful response, but the objects array3 may have an errors key if the object was not able to be shared for some reason. The flyout does not verify the API response so even when there are errors the flyout will close and display a toast4 which erroneously reports the object(s) were successfully shared or unshared. Ideally we would check the API response to determine the appropriate toast messages.

IMO, this is not a critical bug, but it could become more prevalent as we start to make more saved objects shareable.

Steps to reproduce:

It does not seem likely that users could run into this bug in the main or release branches. But we have noticed it while adding the Spaces column to the other listing pages in the shareable-dashboards feature branch.

But with a slight change we can trigger this bug in `main.

  1. Change the namespaceType on data views to multiple-isolated.
  2. Create one or more additional Spaces.
  3. Install sample data logs into the Default Space.
  4. Go to Stack Management - Data Views
  5. Click on the SpacesList component in the table and share the Kibana Sample Data Logs data view to another Space.
  6. Note that the _update_objects_spaces API response reports errors on the object level. However, the toast says the object was shared successfully.

Any additional context:

When we added the SpacesList component to the Visualize library listing page in the shareable-dashboards feature branch we noticed that we could easily trigger this bug if any of the saved objects that could be listed there are not updated to namespaceType: 'multiple'.

Footnotes

  1. https://github.com/elastic/kibana/blob/49b488270e8b4395cf8a571280e3fc85fc2cb1cb/x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.tsx#L121

  2. https://github.com/elastic/kibana/blob/main/x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.tsx#L347-L363

  3. https://www.elastic.co/guide/en/kibana/current/spaces-api-update-objects-spaces.html#spaces-api-update-objects-spaces-response-body

  4. https://github.com/elastic/kibana/blob/main/x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.tsx#L127-L160

@nickpeihl nickpeihl added bug Fixes for quality problems that affect the customer experience Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! Feature:Security/Spaces Platform Security - Spaces feature labels Nov 13, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Security/Spaces Platform Security - Spaces feature Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!
Projects
None yet
Development

No branches or pull requests

2 participants