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

Copy several Saved Objects to spaces at the same time. Currently I need to select one by one #163431

Open
ninoslavmiskovic opened this issue Aug 8, 2023 · 17 comments
Labels
enhancement New value added to drive a business result Feature:Saved Objects Management Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@ninoslavmiskovic
Copy link
Contributor

ninoslavmiskovic commented Aug 8, 2023

As a user, I want to copy more than one saved object to spaces, and currently, the "action" menu gets deactivated when I start selecting Saved Objects.

See video:

Skaermoptagelse.2023-08-08.kl.18.25.42.mov

The request: Be able to select several Saved Objects and "copy to spaces".


Edit by @legrego:
I want to highlight this comment for anyone that finds this issue:

This issue is a duplicate of #52098.

We support bulk copy today via the API: https://www.elastic.co/guide/en/kibana/current/spaces-api-copy-saved-objects.html

We don't have this exposed via the UI because it adds complexity to an already confusing UX, and we haven't yet planned or prioritized design improvements.

@ninoslavmiskovic ninoslavmiskovic added the Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) label Aug 8, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@ninoslavmiskovic ninoslavmiskovic added the Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) label Aug 8, 2023
@elasticmachine
Copy link
Contributor

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

@ninoslavmiskovic ninoslavmiskovic added the enhancement New value added to drive a business result label Aug 9, 2023
@kertal
Copy link
Member

kertal commented Aug 9, 2023

it seems this part of the code (saved_objects_management) is owned by @elastic/kibana-core ? Rem

@kertal kertal removed the Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) label Aug 9, 2023
@petrklapka
Copy link
Member

Hey Mr. @sebelga, It smells to me that the copy functionality is not ours, but a glitch that deactivates the action menu on multi select may very well be. Can you please investigate and see where the plumbing has gone wrong so we can triage?

@sebelga
Copy link
Contributor

sebelga commented Aug 10, 2023

it seems this part of the code (saved_objects_management) is owned by https://github.com/orgs/elastic/teams/kibana-core

Yes saved object management is owned by the core team.

The fact that the action menu gets deactivated when selecting a row is an expected behaviour that we have across Kibana tables. It comes from EUi. Once we select one or multiple row we enter "bulk" mode. A single row actions menu does not make sense as some row could have different actions based on their properties.

Handling bulk action is then done on the table header. In Saved object management, once we start selecting rows, the "Delete" and "Export" bulk action buttons get active.

This is similar for example to Index templates:

Screenshot 2023-08-10 at 09 24 29

@sebelga
Copy link
Contributor

sebelga commented Aug 10, 2023

The enhancement for this issue would be to add a new bulk action: "Copy to space".

For the UX, instead of adding another button, we might start considering something similar to what we plan to do with the TableListView: #140185

@petrklapka petrklapka added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Aug 10, 2023
@petrklapka
Copy link
Member

Adding core team just for visibility.

@sebelga sebelga removed their assignment Aug 16, 2023
@sebelga sebelga removed the Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) label Aug 16, 2023
@rayafratkina
Copy link
Contributor

Should be considered as part of the sharing/coping SOs across spaces initiative

@TinaHeiligers
Copy link
Contributor

TinaHeiligers commented Feb 13, 2024

Copying a saved object to a space is not as simple as it might seem and could cause some serious performance issues.

Risks

Kibana has to deal with generating new ID's, ensuring the references and related objects get handled and possibly also deal with legacy url aliases.

Doing all of this in a bulk action could also cause cyclic dependencies. We'd also have to think about how to handle sharable objects such as data views.

Workaround:

At the moment, there is a work-around using export/import.

Exporting several objects is already supported, as is importing them into another space and the decision of how to handle related objects and duplicates then falls on the consumer.

Possible implementation

We could explore implementing an API that uses export/import under the hood. We would then need to figure out a way to handle duplicates.

@elastic/kibana-security What are your thoughts about exploring export/import for supporting a bulk copy-to-space action under the hood?

@legrego
Copy link
Member

legrego commented Feb 13, 2024

This issue is a duplicate of #52098.

We support bulk copy today via the API: https://www.elastic.co/guide/en/kibana/current/spaces-api-copy-saved-objects.html

We don't have this exposed via the UI because it adds complexity to an already confusing UX, and we haven't yet planned or prioritized design improvements.

@legrego
Copy link
Member

legrego commented Feb 13, 2024

@elastic/kibana-security What are your thoughts about exploring export/import for supporting a bulk copy-to-space action under the hood?

image

const copySavedObjectsToSpaces = async (
sourceSpaceId: string,
destinationSpaceIds: string[],
options: CopyOptions
): Promise<CopyResponse> => {
const response: CopyResponse = {};
const exportedSavedObjects = await exportRequestedObjects(sourceSpaceId, options);
const ineligibleTypes = getIneligibleTypes(getTypeRegistry());
const filteredObjects = exportedSavedObjects.filter(
({ type, namespaces }) =>
// Don't attempt to copy ineligible types or objects that already exist in all spaces
!ineligibleTypes.includes(type) && !namespaces?.includes(ALL_SPACES_ID)
);
for (const spaceId of destinationSpaceIds) {
const objectsToImport: SavedObject[] = [];
for (const { namespaces, ...object } of filteredObjects) {
if (!namespaces?.includes(spaceId)) {
// We check to ensure that each object doesn't already exist in the destination. If we don't do this, the consumer will see a
// conflict and have the option to skip or overwrite the object, both of which are effectively a no-op.
objectsToImport.push(object);
}
}
response[spaceId] = await importObjectsToSpace(
spaceId,
createReadableStreamFromArray(objectsToImport),
options
);
}
return response;
};

@legrego
Copy link
Member

legrego commented Feb 14, 2024

Can we close either this issue or #52098, in order to consolidate the conversation?

@ninoslavmiskovic
Copy link
Contributor Author

@legrego perhaps close the 4y issue since this one have more comments and context . I am good either way.

@pgayvallet
Copy link
Contributor

Do we have a consensus on which team should own this? Is it more @elastic/kibana-security or @elastic/kibana-core ?

@legrego
Copy link
Member

legrego commented Feb 19, 2024

@pgayvallet, the platform security team has historically owned this, but I'm open to discussing alternatives. A secret third option would be the shared ux team. This should "only" require front-end changes, since the API already supports this functionality. Those quotes are doing a lot of heavy lifting, though.

@pgayvallet
Copy link
Contributor

@sebelga

For the UX, instead of adding another button, we might start considering something similar to what we plan to do with the TableListView: #140185

Did we make any progress on some shareable UI components that we could use for that?

I was just looking at the issue and the code, and as @legrego said, he modal and API would already support selecting multiple objects, so it's all about how to correctly implement the UI for that new action.

@sebelga
Copy link
Contributor

sebelga commented Apr 17, 2024

Did we make any progress on some shareable UI components that we could use for that?

@pgayvallet No we didn't move forward with the linked issue I mentionned. Not sure it would have served you as the bulk action header were meant for the TableListView component and I don't think the SO management table is using it. But there are places in Kibana (e.g. the Index management table) that do have the bulk drop down for multiple actions that you could easily copy over in your table here. It's not too complex to do.
Doing it reusable (the issue linked) through TableListView is much more complex.

A secret third option would be the shared ux team. This should "only" require front-end changes, since the API already supports this functionality.

@legrego We build the shared components but can't really maintain all their implementations and their respective tests accross Kibana 😊 (dashboard, vis library, maps...).

cc @petrklapka for visibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Saved Objects Management Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

9 participants