Skip to content

Commit

Permalink
feat: extract management code
Browse files Browse the repository at this point in the history
Signed-off-by: SuZhoue-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe committed Jun 19, 2023
1 parent d62f9b7 commit 9c765d2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -115,7 +114,6 @@ export interface SavedObjectsTableProps {
goInspectObject: (obj: SavedObjectWithMetadata) => void;
canGoInApp: (obj: SavedObjectWithMetadata) => boolean;
dateFormat: string;
workspaces: WorkspacesStart;
}

export interface SavedObjectsTableState {
Expand Down Expand Up @@ -252,11 +250,9 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb

debouncedFetchObjects = debounce(async () => {
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 = {
Expand All @@ -265,7 +261,6 @@ export class SavedObjectsTable extends Component<SavedObjectsTableProps, SavedOb
page: page + 1,
fields: ['id'],
type: filteredTypes,
workspaces: ['public', ...(currentWorkspaceId ? [currentWorkspaceId] : [])],
};

const availableNamespaces = namespaceRegistry.getAll()?.map((ns) => ns.id) || [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 0 additions & 10 deletions src/plugins/saved_objects_management/server/routes/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9c765d2

Please sign in to comment.