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

[Saved object] prevent deleting managed content from UI #176443

Conversation

drewdaemon
Copy link
Contributor

@drewdaemon drewdaemon commented Feb 7, 2024

Summary

Closes #172391

This change stops users from deleting managed content from the SO management page by

  • keeping the delete action disabled when the selection contains only managed content
  • excluding managed content from the list in the delete modal
Screen.Recording.2024-02-07.at.12.53.56.PM.mov
Screenshot 2024-02-07 at 12 53 29 PM

Checklist

Delete any items that are not applicable to this PR.

@drewdaemon
Copy link
Contributor Author

/ci

@drewdaemon
Copy link
Contributor Author

/ci

@drewdaemon
Copy link
Contributor Author

/ci

@drewdaemon drewdaemon marked this pull request as ready for review February 8, 2024 04:19
@drewdaemon drewdaemon requested a review from a team as a code owner February 8, 2024 04:19
Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Overall looking good @drewdaemon ! Thanks for making this improvement. I left a few comments that I'd like to get your thoughts on before approving.

@drewdaemon drewdaemon requested a review from jloleysens February 8, 2024 20:07
@drewdaemon
Copy link
Contributor Author

@jloleysens I have unified the behavior of hidden and managed saved objects. Could you take another look?

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #52 / aiops log rate analysis with 'kibana_sample_data_logstsdb' kibana sample data logs displays index details

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
savedObjectsManagement 147 150 +3

Async chunks

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

id before after diff
savedObjectsManagement 82.3KB 82.7KB +449.0B
Unknown metric groups

API count

id before after diff
savedObjectsManagement 161 164 +3

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, just a couple remarks

Comment on lines +105 to +109
<p
css={css`
margin-block-end: 0 !important;
`}
>
Copy link
Contributor

Choose a reason for hiding this comment

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

🙈 In theory we should be able to do this without inline css just with EUI components, don't we?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the concern is around inline CSS (?) this uses emotion so it generates a class for this element.

Comment on lines +405 to +407
selectedSavedObjects.filter(
({ managed, meta: { hiddenType } }) => !managed && !hiddenType
).length === 0 || !capabilities.savedObjectsManagement.delete
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: I would memo this now that we're doing a full array lookup via filter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I missed these comments. This is a good idea. Will open a follow-up

Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Thanks for making those enhancements @drewdaemon ! LGTM.

@drewdaemon drewdaemon merged commit c5819dc into elastic:main Feb 9, 2024
17 checks passed
@kibanamachine kibanamachine added v8.13.0 backport:skip This commit does not require backporting labels Feb 9, 2024
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Summary

Closes elastic#172391

This change stops users from deleting managed content from the SO
management page by
- keeping the delete action disabled when the selection contains only
managed content
- excluding managed content from the list in the delete modal


https://github.com/elastic/kibana/assets/315764/5bfa974e-823e-4c35-b6b9-71fcd08bf5e8

<img width="1673" alt="Screenshot 2024-02-07 at 12 53 29 PM"
src="https://github.com/elastic/kibana/assets/315764/645238ec-dfe7-4f10-b468-df40e4fcb698">


### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials — will be
done in elastic#175150
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
## Summary

Closes elastic#172391

This change stops users from deleting managed content from the SO
management page by
- keeping the delete action disabled when the selection contains only
managed content
- excluding managed content from the list in the delete modal


https://github.com/elastic/kibana/assets/315764/5bfa974e-823e-4c35-b6b9-71fcd08bf5e8

<img width="1673" alt="Screenshot 2024-02-07 at 12 53 29 PM"
src="https://github.com/elastic/kibana/assets/315764/645238ec-dfe7-4f10-b468-df40e4fcb698">


### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials — will be
done in elastic#175150
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:breaking v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Saved objects] Prevent deleting managed content from UI
5 participants