-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Refactor saved object management registry usage #54155
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
Merged
kertal
merged 22 commits into
elastic:master
from
kertal:kertal-pr-2020-01-07-refactor-saved-object-management-registry
Jan 28, 2020
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
feef34c
Migrate registry to TypeScript
kertal eb45ab0
Adapt plugins
kertal 139fcfc
Migrate management code
kertal f1f635f
Adapt VisualizeEmbeddableFactory to use createSavedVisLoader
kertal 49bdf27
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-01…
kertal aa6ff7c
Improve VisualizeEmbeddableFactory code
kertal ebadc49
Migrate SavedObjectLoader services registration to management section
kertal f721047
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-01…
kertal a12e7aa
Replace Angular SavedSearchLoader in transform plugin
kertal efa7a1d
Add data plugin to transform plugin
kertal 9f693c5
Merge remote-tracking branch 'upstream/master' into kertal-pr-2020-01…
kertal d45ad30
Fix types in transform plugin
kertal b2208cc
Merge branch 'master' into kertal-pr-2020-01-07-refactor-saved-object…
elasticmachine 691351d
Address review comments
kertal 22f586e
Merge branch 'kertal-pr-2020-01-07-refactor-saved-object-management-r…
kertal 0bdf4df
Centralize getSavedVisualizations function
kertal f76aeea
Merge master/fix conflicts
kertal 522c197
Migrate saved_visualizations from visualize to visualizations plugin
kertal 2040176
Fix timelion
kertal 0c7b1ac
Fix management objects _view.js angular rendering
kertal 4eed031
Refactor savedVisualizations to getSavedVisualizationsLoader
kertal c0067da
Merge upstream/master, fix merge problems
kertal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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'; | ||
kertal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.