Skip to content

Commit

Permalink
[Discover] Step 4- Removing SavedObject usage for savedSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwizp committed Oct 13, 2021
1 parent 38f949a commit b6371a1
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 178 deletions.
3 changes: 0 additions & 3 deletions src/plugins/discover/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ export {
getSavedSearchUrlConflictMessage,
throwErrorOnSavedSearchUrlConflict,
SavedSearch,
LegacySavedSearch,
SavedSearchLoader,
__LEGACY,
} from './saved_searches';

export { DiscoverSetup, DiscoverStart } from './plugin';
Expand Down
3 changes: 0 additions & 3 deletions src/plugins/discover/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ const createSetupContract = (): Setup => {

const createStartContract = (): Start => {
const startContract: Start = {
__LEGACY: {
savedSearchLoader: {} as DiscoverStart['__LEGACY']['savedSearchLoader'],
},
urlGenerator: {
createUrl: jest.fn(),
} as unknown as DiscoverStart['urlGenerator'],
Expand Down
13 changes: 1 addition & 12 deletions src/plugins/discover/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { HomePublicPluginSetup } from 'src/plugins/home/public';
import { Start as InspectorPublicPluginStart } from 'src/plugins/inspector/public';
import { EuiLoadingContent } from '@elastic/eui';
import { DataPublicPluginStart, DataPublicPluginSetup, esFilters } from '../../data/public';
import { SavedObjectLoader, SavedObjectsStart } from '../../saved_objects/public';
import { SavedObjectsStart } from '../../saved_objects/public';
import { createKbnUrlTracker } from '../../kibana_utils/public';
import { DEFAULT_APP_CATEGORIES } from '../../../core/public';
import { UrlGeneratorState } from '../../share/public';
Expand All @@ -45,7 +45,6 @@ import {
getScopedHistory,
syncHistoryLocations,
} from './kibana_services';
import { __LEGACY } from './saved_searches';
import { registerFeature } from './register_feature';
import { buildServices } from './build_services';
import {
Expand Down Expand Up @@ -121,10 +120,6 @@ export interface DiscoverSetup {
}

export interface DiscoverStart {
__LEGACY: {
savedSearchLoader: SavedObjectLoader;
};

/**
* @deprecated Use URL locator instead. URL generator will be removed.
*/
Expand Down Expand Up @@ -414,12 +409,6 @@ export class DiscoverPlugin
return {
urlGenerator: this.urlGenerator,
locator: this.locator,
__LEGACY: {
savedSearchLoader: __LEGACY.createSavedSearchesLoader({
savedObjectsClient: core.savedObjects.client,
savedObjects: plugins.savedObjects,
}),
},
};
}

Expand Down
10 changes: 0 additions & 10 deletions src/plugins/discover/public/saved_searches/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* Side Public License, v 1.
*/

import { createSavedSearchesLoader } from './legacy/saved_searches';

export { getSavedSearch } from './get_saved_searches';
export {
getSavedSearchUrl,
Expand All @@ -18,13 +16,5 @@ export {
export { useSavedSearchAliasMatchRedirect } from './saved_search_alias_match_redirect';
export { SavedSearchURLConflictCallout } from './saved_search_url_conflict_callout';
export { saveSavedSearch, SaveSavedSearchOptions } from './save_saved_searches';

export { SAVED_SEARCH_TYPE } from './constants';

export type { SavedSearch } from './types';
export type { LegacySavedSearch, SavedSearchLoader, SortOrder } from './legacy/types';

/** @deprecated __LEGACY object will be removed in v8**/
export const __LEGACY = {
createSavedSearchesLoader,
};
65 changes: 0 additions & 65 deletions src/plugins/discover/public/saved_searches/legacy/_saved_search.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/plugins/discover/public/saved_searches/legacy/index.ts

This file was deleted.

This file was deleted.

34 changes: 0 additions & 34 deletions src/plugins/discover/public/saved_searches/legacy/types.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/plugins/discover/server/saved_objects/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { searchMigrations } from './search_migrations';
export const searchSavedObjectType: SavedObjectsType = {
name: 'search',
hidden: false,
namespaceType: 'single',
namespaceType: 'multiple-isolated',
convertToMultiNamespaceTypeVersion: '8.0.0',
management: {
icon: 'discoverApp',
defaultSearchField: 'title',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import type { SavedObjectsStart, SavedObject } from '../../../../plugins/saved_objects/public';
// @ts-ignore
import { updateOldState } from '../legacy/vis_update_state';
import { __LEGACY } from '../../../discover/public';
import { extractReferences, injectReferences } from '../utils/saved_visualization_references';
import type { SavedObjectsClientContract } from '../../../../core/public';
import type { IndexPatternsContract } from '../../../../plugins/data/public';
Expand All @@ -30,8 +29,6 @@ export interface SavedVisServices {

/** @deprecated **/
export function createSavedVisClass(services: SavedVisServices) {
const savedSearch = __LEGACY.createSavedSearchesLoader(services);

class SavedVis extends services.savedObjects.SavedObjectClass {
public static type: string = 'visualization';
public static mapping: Record<string, string> = {
Expand Down Expand Up @@ -72,9 +69,6 @@ export function createSavedVisClass(services: SavedVisServices) {
if (savedVis.searchSourceFields?.index) {
await services.indexPatterns.get(savedVis.searchSourceFields.index as any);
}
if (savedVis.savedSearchId) {
await savedSearch.get(savedVis.savedSearchId);
}
return savedVis as any as SavedObject;
},
});
Expand Down
2 changes: 1 addition & 1 deletion test/api_integration/apis/saved_objects_management/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default function ({ getService }: FtrProviderContext) {
path: '/app/discover#/view/960372e0-3224-11e8-a572-ffca06da1357',
uiCapabilitiesPath: 'discover.show',
},
namespaceType: 'single',
namespaceType: 'multiple-isolated',
});
}));

Expand Down

0 comments on commit b6371a1

Please sign in to comment.