From 9c765d23aeae8bb76ab35a897e4abef9cc9da860 Mon Sep 17 00:00:00 2001 From: SuZhoue-Joe Date: Mon, 19 Jun 2023 11:09:20 +0800 Subject: [PATCH] feat: extract management code Signed-off-by: SuZhoue-Joe --- .../objects_table/saved_objects_table.tsx | 7 +------ .../management_section/saved_objects_table_page.tsx | 1 - .../saved_objects_management/server/routes/find.ts | 10 ---------- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx index 22ed212dea3a..2f78f307d165 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.tsx @@ -65,7 +65,6 @@ import { OverlayStart, NotificationsStart, ApplicationStart, - WorkspacesStart, } from 'src/core/public'; import { RedirectAppLinks } from '../../../../opensearch_dashboards_react/public'; import { IndexPatternsContract } from '../../../../data/public'; @@ -115,7 +114,6 @@ export interface SavedObjectsTableProps { goInspectObject: (obj: SavedObjectWithMetadata) => void; canGoInApp: (obj: SavedObjectWithMetadata) => boolean; dateFormat: string; - workspaces: WorkspacesStart; } export interface SavedObjectsTableState { @@ -252,11 +250,9 @@ export class SavedObjectsTable extends Component { const { activeQuery: query, page, perPage } = this.state; - const { notifications, http, allowedTypes, namespaceRegistry, workspaces } = this.props; + const { notifications, http, allowedTypes, namespaceRegistry } = this.props; const { queryText, visibleTypes, visibleNamespaces } = parseQuery(query); const filteredTypes = filterQuery(allowedTypes, visibleTypes); - const currentWorkspaceIdResp = await workspaces.client.getCurrentWorkspaceId(); - const currentWorkspaceId = currentWorkspaceIdResp.success ? currentWorkspaceIdResp.result : ''; // "searchFields" is missing from the "findOptions" but gets injected via the API. // The API extracts the fields from each uiExports.savedObjectsManagement "defaultSearchField" attribute const findOptions: SavedObjectsFindOptions = { @@ -265,7 +261,6 @@ export class SavedObjectsTable extends Component ns.id) || []; diff --git a/src/plugins/saved_objects_management/public/management_section/saved_objects_table_page.tsx b/src/plugins/saved_objects_management/public/management_section/saved_objects_table_page.tsx index bd1842c9945f..09937388ba57 100644 --- a/src/plugins/saved_objects_management/public/management_section/saved_objects_table_page.tsx +++ b/src/plugins/saved_objects_management/public/management_section/saved_objects_table_page.tsx @@ -88,7 +88,6 @@ const SavedObjectsTablePage = ({ overlays={coreStart.overlays} notifications={coreStart.notifications} applications={coreStart.application} - workspaces={coreStart.workspaces} perPageConfig={itemsPerPage} goInspectObject={(savedObject) => { const { editUrl } = savedObject.meta; diff --git a/src/plugins/saved_objects_management/server/routes/find.ts b/src/plugins/saved_objects_management/server/routes/find.ts index eb5a30a015de..6b7673896f34 100644 --- a/src/plugins/saved_objects_management/server/routes/find.ts +++ b/src/plugins/saved_objects_management/server/routes/find.ts @@ -97,16 +97,6 @@ export const registerFindRoute = ( ...req.query, fields: undefined, searchFields: [...searchFields], - namespaces: req.query.namespaces - ? Array.isArray(req.query.namespaces) - ? req.query.namespaces - : [req.query.namespaces] - : undefined, - workspaces: req.query.workspaces - ? Array.isArray(req.query.workspaces) - ? req.query.workspaces - : [req.query.workspaces] - : undefined, }); const savedObjects = await Promise.all(