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

[Workspace] support workspace in saved objects client #6130

Closed
SuZhou-Joe opened this issue Mar 13, 2024 · 3 comments · Fixed by #6303 or #6365
Closed

[Workspace] support workspace in saved objects client #6130

SuZhou-Joe opened this issue Mar 13, 2024 · 3 comments · Fixed by #6303 or #6365
Labels
enhancement New feature or request workspace

Comments

@SuZhou-Joe
Copy link
Member

SuZhou-Joe commented Mar 13, 2024

Is your feature request related to a problem? Please describe.

We are introducing a new concept workspace to manage saved objects, and for now in OpenSearch Dashboard, there are two saved objects clients(browser/public side and server side) that plugins can use to perform CRUD operations on saved objects. And for now there exists two flows to use the clients.

image

And as workspace will be used to separate saved objects within specific workspace, CRUD operations on saved objects need to tell the client which workspace it sits.

There are cases that plugins use server side saved object client directly, in such cases, it won't know the current workspace if we only support current workspace in public side.

Describe the solution you'd like

Support workspace in saved objects client in server side.

We can see that no matter which approach plugins use to manage their objects, eventually it goes to saved objects client in server side as this is the only entry that can send request to .kibana index to fetch the data. So changes are only required in saved objects client in server side.

Describe alternatives you've considered

Support workspace in code of plugins and saved objects client on public side

  • Requires requires numerous changes in plugins and not elegant.
    Here is a list of places that use directly the saved object client in server side.

    dashboards-maps

    • server/common/stats/stats_helper.ts
    • server/routes/stats_router.ts

    dashboards-observability

    • server/adaptors/integrations/integrations_manager.ts
    • server/plugin.ts

    OpenSearch-Dashboards/src/plugins/vis_type_timeseries

    • server/lib/get_fields.ts

    OpenSearch-Dashboards/src/plugins/share

    • server/routes/get.ts
    • server/routes/goto.ts

    OpenSearch-Dashboards/src/plugins/telemetry

    • server/fetcher.ts

    OpenSearch-Dashboards/src/plugins/vis_augmenter

    • server/routes/stats_helpers.ts
    • server/routes/stats.ts

    OpenSearch-Dashboards/src/plugins/data/

    • server/search/search_service.ts

    // may not an issue, it read/update with id
    OpenSearch-Dashboards/src/core/server/ui_settings/ui_settings_client.ts

    • src/plugins/legacy_export/server/routes/import.ts
    • src/plugins/data_source/server/client/configure_client_utils.ts
    • src/plugins/data/server/index_patterns/index_patterns_service.ts
  • Much more maintenance effort in the future.

Additional context

#4944

@SuZhou-Joe SuZhou-Joe added the enhancement New feature or request label Mar 13, 2024
@xluo-aws
Copy link
Member

xluo-aws commented Mar 13, 2024

Plugins still need to be updated to pass workspace id when calling the server side saved object client directly, right?

@SuZhou-Joe
Copy link
Member Author

SuZhou-Joe commented Mar 14, 2024

Plugins still need to be updated to pass workspace id when calling the server side saved object client directly, right?

For option 1, no because the workspace id will be passed inside request context and be consumed by saved objetcs client automatically by a saved objects client wrapper in workspace plugin.
For option 2, yes.

@xluo-aws
Copy link
Member

Plugins still need to be updated to pass workspace id when calling the server side saved object client directly, right?

For option 1, no because the workspace id will be passed inside request context and be consumed by saved objetcs client automatically. For option 2, yes.

I c, nice catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request workspace
Projects
None yet
2 participants