forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor saved object management registry usage (elastic#54155)
* Migrate registry to TypeScript * Migrate management code * Migrate SavedObjectLoader services registration to management section * Replace Angular SavedSearchLoader in transform plugin * Migrate saved_visualizations from visualize to visualizations plugin
- Loading branch information
Showing
33 changed files
with
164 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
src/legacy/core_plugins/kibana/public/dashboard/__tests__/saved_dashboards.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 0 additions & 46 deletions
46
src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard_register.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,3 @@ | |
*/ | ||
|
||
export * from './saved_searches'; | ||
import './saved_searches_register'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 0 additions & 43 deletions
43
src/legacy/core_plugins/kibana/public/discover/saved_searches/saved_searches_register.ts
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
src/legacy/core_plugins/kibana/public/management/saved_object_registry.js
This file was deleted.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
src/legacy/core_plugins/kibana/public/management/saved_object_registry.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import _ from 'lodash'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { npStart } from 'ui/new_platform'; | ||
import { SavedObjectLoader } from 'ui/saved_objects'; | ||
import { createSavedDashboardLoader } from '../dashboard'; | ||
import { createSavedSearchesLoader } from '../discover'; | ||
import { TypesService, createSavedVisLoader } from '../../../visualizations/public'; | ||
|
||
/** | ||
* This registry is used for the editing mode of Saved Searches, Visualizations, | ||
* Dashboard and Time Lion saved objects. | ||
*/ | ||
interface SavedObjectRegistryEntry { | ||
id: string; | ||
service: SavedObjectLoader; | ||
title: string; | ||
} | ||
|
||
const registry: SavedObjectRegistryEntry[] = []; | ||
|
||
export const savedObjectManagementRegistry = { | ||
register: (service: SavedObjectRegistryEntry) => { | ||
registry.push(service); | ||
}, | ||
all: () => { | ||
return registry; | ||
}, | ||
get: (id: string) => { | ||
return _.find(registry, { id }); | ||
}, | ||
}; | ||
|
||
const services = { | ||
savedObjectsClient: npStart.core.savedObjects.client, | ||
indexPatterns: npStart.plugins.data.indexPatterns, | ||
chrome: npStart.core.chrome, | ||
overlays: npStart.core.overlays, | ||
}; | ||
|
||
savedObjectManagementRegistry.register({ | ||
id: 'savedVisualizations', | ||
service: createSavedVisLoader({ | ||
...services, | ||
...{ visualizationTypes: new TypesService().start() }, | ||
}), | ||
title: 'visualizations', | ||
}); | ||
|
||
savedObjectManagementRegistry.register({ | ||
id: 'savedDashboards', | ||
service: createSavedDashboardLoader(services), | ||
title: i18n.translate('kbn.dashboard.savedDashboardsTitle', { | ||
defaultMessage: 'dashboards', | ||
}), | ||
}); | ||
|
||
savedObjectManagementRegistry.register({ | ||
id: 'savedSearches', | ||
service: createSavedSearchesLoader(services), | ||
title: 'searches', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.