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

SOM: hide actions for hidden types #98290

Merged

Conversation

pgayvallet
Copy link
Contributor

@pgayvallet pgayvallet commented Apr 26, 2021

Summary

Fix #94351

Hide the share to space, copy to space and delete actions for hidden saved object types

Checklist

Comment on lines -458 to +460
const objects = await savedObjectsClient.bulkGet(selectedSavedObjects);
const deletes = objects.savedObjects.map((object) =>
savedObjectsClient.delete(object.type, object.id, { force: true })
);
const deletes = selectedSavedObjects
.filter((object) => !object.meta.hiddenType)
.map((object) => savedObjectsClient.delete(object.type, object.id, { force: true }));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was performing a bulkGet for no reason, as we already have all the info we need on the client side to perform the deletes.

Copy link
Member

Choose a reason for hiding this comment

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

Another use case for bulkDelete (context #30503)

@@ -15,6 +15,5 @@ export default function ({ loadTestFile }: PluginFunctionalProviderContext) {
loadTestFile(require.resolve('./resolve_import_errors'));
loadTestFile(require.resolve('./find'));
loadTestFile(require.resolve('./delete'));
loadTestFile(require.resolve('./interface/saved_objects_management'));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests moved to saved_objects_management/hidden_types.ts

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
savedObjectsManagement 79 78 -1

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 80 82 +2

Async chunks

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

id before after diff
savedObjectsManagement 139.3KB 140.6KB +1.3KB

Page load bundle

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

id before after diff
savedObjectsManagement 34.2KB 34.2KB +4.0B
spaces 41.8KB 41.9KB +90.0B
total +94.0B
Unknown metric groups

API count

id before after diff
savedObjectsManagement 91 93 +2

History

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

@pgayvallet pgayvallet added 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.14.0 labels Apr 27, 2021
@pgayvallet pgayvallet marked this pull request as ready for review April 27, 2021 09:49
@pgayvallet pgayvallet requested review from a team as code owners April 27, 2021 09:49
@elasticmachine
Copy link
Contributor

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

Copy link
Member

@Bamieh Bamieh left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines -458 to +460
const objects = await savedObjectsClient.bulkGet(selectedSavedObjects);
const deletes = objects.savedObjects.map((object) =>
savedObjectsClient.delete(object.type, object.id, { force: true })
);
const deletes = selectedSavedObjects
.filter((object) => !object.meta.hiddenType)
.map((object) => savedObjectsClient.delete(object.type, object.id, { force: true }));
Copy link
Member

Choose a reason for hiding this comment

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

Another use case for bulkDelete (context #30503)

@@ -90,8 +90,6 @@ export class SavedObjectExportTransformsPlugin implements Plugin {
},
});

/////////////
/////////////
Copy link
Member

Choose a reason for hiding this comment

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

👀

Copy link
Contributor

@jportner jportner left a comment

Choose a reason for hiding this comment

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

Spaces changes LGTM!

@pgayvallet pgayvallet merged commit 9dae1ef into elastic:master Apr 28, 2021
pgayvallet added a commit to pgayvallet/kibana that referenced this pull request Apr 28, 2021
* SOM: hide actions for hidden types

* fix FTR tests

* add and fix tests

* fix unit tests

* fix test types

* fix FTR test assertions

* add more FTR tests

* delete old file
pgayvallet added a commit that referenced this pull request Apr 28, 2021
* SOM: hide actions for hidden types (#98290)

* SOM: hide actions for hidden types

* fix FTR tests

* add and fix tests

* fix unit tests

* fix test types

* fix FTR test assertions

* add more FTR tests

* delete old file

* fix data set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Delete" and "Copy to Space" returns errors for hidden saved object types in Saved Object Management Page
5 participants