-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Remove SavedObjectRegistryProvider from codebase #53455
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
Changes from 29 commits
a1c86ec
70d7cf8
9b337a8
9374470
f94e5d3
ca96123
ae596fe
03b8efb
a568b28
e2515bf
59004ff
e3b108c
c09e7ca
e392307
3372685
78d4822
1ecab13
9cc80c2
17b3737
e7cd3b8
105748f
c3a8cab
2dcbe20
032900d
d8b384e
7987d95
4cf7a3b
013e5f4
e8764c3
a36d340
0f12cfe
c539e7a
f21b8d9
6f9e2d5
a6eade5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,13 +17,7 @@ | |
| * under the License. | ||
| */ | ||
|
|
||
| import { | ||
| npSetup, | ||
| npStart, | ||
| SavedObjectRegistryProvider, | ||
| legacyChrome, | ||
| IPrivate, | ||
| } from './legacy_imports'; | ||
| import { npSetup, npStart, legacyChrome } from './legacy_imports'; | ||
| import { DashboardPlugin, LegacyAngularInjectedDependencies } from './plugin'; | ||
| import { start as data } from '../../../data/public/legacy'; | ||
| import { start as embeddables } from '../../../embeddable_api/public/np_ready/public/legacy'; | ||
|
|
@@ -37,13 +31,8 @@ import './dashboard_config'; | |
| async function getAngularDependencies(): Promise<LegacyAngularInjectedDependencies> { | ||
| const injector = await legacyChrome.dangerouslyGetActiveInjector(); | ||
|
|
||
| const Private = injector.get<IPrivate>('Private'); | ||
|
|
||
| const savedObjectRegistry = Private(SavedObjectRegistryProvider); | ||
|
|
||
| return { | ||
| dashboardConfig: injector.get('dashboardConfig'), | ||
| savedObjectRegistry, | ||
| savedDashboards: injector.get('savedDashboards'), | ||
|
||
| }; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ import { DashboardListing, EMPTY_FILTER } from './listing/dashboard_listing'; | |
| import { addHelpMenuToAppChrome } from './help_menu/help_menu_util'; | ||
| import { registerTimefilterWithGlobalStateFactory } from '../../../../ui/public/timefilter/setup_router'; | ||
| import { syncOnMount } from './global_state_sync'; | ||
| import { savedObjectLoaderDashboard } from './saved_dashboard/saved_dashboards'; | ||
|
||
|
|
||
| export function initDashboardApp(app, deps) { | ||
| initDashboardAppDirective(app, deps); | ||
|
|
@@ -86,7 +87,8 @@ export function initDashboardApp(app, deps) { | |
| ...defaults, | ||
| template: dashboardListingTemplate, | ||
| controller($injector, $location, $scope) { | ||
| const services = deps.savedObjectRegistry.byLoaderPropertiesName; | ||
| const service = savedObjectLoaderDashboard; | ||
|
|
||
| const kbnUrl = $injector.get('kbnUrl'); | ||
| const dashboardConfig = deps.dashboardConfig; | ||
|
|
||
|
|
@@ -95,7 +97,7 @@ export function initDashboardApp(app, deps) { | |
| kbnUrl.redirect(DashboardConstants.CREATE_NEW_DASHBOARD_URL); | ||
| }; | ||
| $scope.find = search => { | ||
| return services.dashboards.find(search, $scope.listingLimit); | ||
| return service.find(search, $scope.listingLimit); | ||
| }; | ||
| $scope.editItem = ({ id }) => { | ||
| kbnUrl.redirect(`${createDashboardEditUrl(id)}?_a=(viewMode:edit)`); | ||
|
|
@@ -104,7 +106,7 @@ export function initDashboardApp(app, deps) { | |
| return deps.addBasePath(`#${createDashboardEditUrl(id)}`); | ||
| }; | ||
| $scope.delete = dashboards => { | ||
| return services.dashboards.delete(dashboards.map(d => d.id)); | ||
| return service.delete(dashboards.map(d => d.id)); | ||
| }; | ||
| $scope.hideWriteControls = dashboardConfig.getHideWriteControls(); | ||
| $scope.initialFilter = $location.search().filter || EMPTY_FILTER; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,13 +31,13 @@ savedObjectManagementRegistry.register({ | |
| service: 'savedSearches', | ||
| title: 'searches', | ||
| }); | ||
| const services = { | ||
| savedObjectsClient: npStart.core.savedObjects.client, | ||
| indexPatterns: npStart.plugins.data.indexPatterns, | ||
| chrome: npStart.core.chrome, | ||
| overlays: npStart.core.overlays, | ||
| }; | ||
| const savedSearches = createSavedSearchesService(services); | ||
|
|
||
| const module = uiModules.get('discover/saved_searches'); | ||
| module.service('savedSearches', () => { | ||
| const services = { | ||
| savedObjectsClient: npStart.core.savedObjects.client, | ||
| indexPatterns: npStart.plugins.data.indexPatterns, | ||
| chrome: npStart.core.chrome, | ||
| overlays: npStart.core.overlays, | ||
| }; | ||
| return createSavedSearchesService(services); | ||
| }); | ||
| module.service('savedSearches', () => savedSearches); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could use the same pattern as suggested above for dashboard here (only creating the service once and exposing through the contract, but that way is also fine because it's just created twice, once for "inside" the app and once for the global registry. That approach would also be OK for me for dashboard.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ♩ ♪ ♫ ♬ ♭ ♮ ♯ 🎼 🎵 🎶 I did it discover way ♩ ♪ ♫ ♬ ♭ ♮ ♯ 🎼 🎵 🎶 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ import { i18n } from '@kbn/i18n'; | |
|
|
||
| import { getServices } from '../kibana_services'; | ||
| import { wrapInI18nContext } from '../legacy_imports'; | ||
| import { savedObjectLoaderVisualize } from '../saved_visualizations/saved_visualization_register'; | ||
|
||
|
|
||
| export function initListingDirective(app) { | ||
| app.directive('visualizeListingTable', reactDirective => | ||
|
|
@@ -47,7 +48,6 @@ export function VisualizeListingController($injector, createNewVis) { | |
| addBasePath, | ||
| chrome, | ||
| legacyChrome, | ||
| savedObjectRegistry, | ||
| savedObjectsClient, | ||
| data: { | ||
| query: { | ||
|
|
@@ -94,10 +94,7 @@ export function VisualizeListingController($injector, createNewVis) { | |
| // In case the user navigated to the page via the /visualize/new URL we start the dialog immediately | ||
| this.createNewVis(); | ||
| } | ||
|
|
||
| // TODO: Extract this into an external service. | ||
| const services = savedObjectRegistry.byLoaderPropertiesName; | ||
| const visualizationService = services.visualizations; | ||
| const visualizationService = savedObjectLoaderVisualize; | ||
| this.visTypeRegistry = visualizations.types; | ||
|
|
||
| this.fetchItems = filter => { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉Down to one, nice! We should probably just move that flag into
kibana_legacy, then dashboard is almost ready to go (not in this PR though)