diff --git a/src/core_plugins/kibana/index.js b/src/core_plugins/kibana/index.js index d9f6205b1b901c..d2a15195e29b24 100644 --- a/src/core_plugins/kibana/index.js +++ b/src/core_plugins/kibana/index.js @@ -35,6 +35,11 @@ export default function (kibana) { uiExports: { hacks: ['plugins/kibana/dev_tools/hacks/hide_empty_tools'], fieldFormats: ['plugins/kibana/field_formats/register'], + savedObjectTypes: [ + 'plugins/kibana/visualize/saved_visualizations/saved_visualization_register', + 'plugins/kibana/discover/saved_searches/saved_search_register', + 'plugins/kibana/dashboard/saved_dashboard/saved_dashboard_register', + ], app: { id: 'kibana', title: 'Kibana', @@ -43,6 +48,10 @@ export default function (kibana) { main: 'plugins/kibana/kibana', uses: [ 'visTypes', + 'visResponseHandlers', + 'visRequestHandlers', + 'visEditorTypes', + 'savedObjectTypes', 'spyModes', 'fieldFormats', 'fieldFormatEditors', diff --git a/src/core_plugins/kibana/public/dashboard/index.js b/src/core_plugins/kibana/public/dashboard/index.js index 069c32ff022368..d4359db84c00d7 100644 --- a/src/core_plugins/kibana/public/dashboard/index.js +++ b/src/core_plugins/kibana/public/dashboard/index.js @@ -4,15 +4,11 @@ import 'plugins/kibana/dashboard/styles/index.less'; import 'plugins/kibana/dashboard/dashboard_config'; import uiRoutes from 'ui/routes'; import 'ui/accessibility/kbn_accessible_click'; -import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry'; -import { savedDashboardRegister } from 'plugins/kibana/dashboard/saved_dashboard/saved_dashboard_register'; import dashboardListingTemplate from './listing/dashboard_listing.html'; import { DashboardListingController } from './listing/dashboard_listing'; import { DashboardConstants } from './dashboard_constants'; -SavedObjectRegistryProvider.register(savedDashboardRegister); - uiRoutes .defaults(/dashboard/, { requireDefaultIndex: true diff --git a/src/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard_register.js b/src/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard_register.js index 0c1b26f1e46052..86d3bda223f992 100644 --- a/src/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard_register.js +++ b/src/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard_register.js @@ -1,3 +1,5 @@ -export function savedDashboardRegister(savedDashboards) { +import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry'; + +SavedObjectRegistryProvider.register((savedDashboards) => { return savedDashboards; -} +}); diff --git a/src/core_plugins/kibana/public/discover/index.js b/src/core_plugins/kibana/public/discover/index.js index 68a83fc5ae97aa..29d7bbd5c311f7 100644 --- a/src/core_plugins/kibana/public/discover/index.js +++ b/src/core_plugins/kibana/public/discover/index.js @@ -6,7 +6,3 @@ import 'plugins/kibana/discover/components/field_chooser/field_chooser'; import 'plugins/kibana/discover/controllers/discover'; import 'plugins/kibana/discover/styles/main.less'; import 'ui/doc_table/components/table_row'; -import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry'; -import { savedSearchProvider } from 'plugins/kibana/discover/saved_searches/saved_search_register'; - -SavedObjectRegistryProvider.register(savedSearchProvider); diff --git a/src/core_plugins/kibana/public/discover/saved_searches/saved_search_register.js b/src/core_plugins/kibana/public/discover/saved_searches/saved_search_register.js index 64ca933cbe2cfd..59461fe98a7a61 100644 --- a/src/core_plugins/kibana/public/discover/saved_searches/saved_search_register.js +++ b/src/core_plugins/kibana/public/discover/saved_searches/saved_search_register.js @@ -1,3 +1,5 @@ -export function savedSearchProvider(savedSearches) { +import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry'; + +SavedObjectRegistryProvider.register((savedSearches) => { return savedSearches; -} +}); diff --git a/src/core_plugins/kibana/public/visualize/index.js b/src/core_plugins/kibana/public/visualize/index.js index c0bf9caab21458..f28886094d36ae 100644 --- a/src/core_plugins/kibana/public/visualize/index.js +++ b/src/core_plugins/kibana/public/visualize/index.js @@ -13,19 +13,6 @@ import uiRoutes from 'ui/routes'; import visualizeListingTemplate from './listing/visualize_listing.html'; import { VisualizeListingController } from './listing/visualize_listing'; import { VisualizeConstants } from './visualize_constants'; -import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry'; -import { savedVisualizationProvider } from 'plugins/kibana/visualize/saved_visualizations/saved_visualization_register'; -import { noneRequestHandlerProvider } from 'ui/vis/request_handlers/none'; -import { CourierRequestHandlerProvider } from 'ui/vis/request_handlers/courier'; -import { noneResponseHandler } from 'ui/vis/response_handlers/none'; -import { BasicResponseHandlerProvider } from 'ui/vis/response_handlers/basic'; - -import { defaultEditor } from 'ui/vis/editors/default/default'; - - -import { VisRequestHandlersRegistryProvider } from 'ui/registry/vis_request_handlers'; -import { VisResponseHandlersRegistryProvider } from 'ui/registry/vis_response_handlers'; -import { VisEditorTypesRegistryProvider } from 'ui/registry/vis_editor_types'; uiRoutes .defaults(/visualize/, { @@ -37,11 +24,3 @@ uiRoutes controllerAs: 'listingController', }); -// preloading -SavedObjectRegistryProvider.register(savedVisualizationProvider); -VisRequestHandlersRegistryProvider.register(CourierRequestHandlerProvider); -VisRequestHandlersRegistryProvider.register(noneRequestHandlerProvider); -VisResponseHandlersRegistryProvider.register(noneResponseHandler); -VisResponseHandlersRegistryProvider.register(BasicResponseHandlerProvider); -VisEditorTypesRegistryProvider.register(defaultEditor); - diff --git a/src/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualization_register.js b/src/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualization_register.js index 5d6f3f35a852fa..2c7bc8ed10b66d 100644 --- a/src/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualization_register.js +++ b/src/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualization_register.js @@ -1,3 +1,5 @@ -export function savedVisualizationProvider(savedVisualizations) { +import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry'; + +SavedObjectRegistryProvider.register((savedVisualizations) => { return savedVisualizations; -} +}); diff --git a/src/ui/public/vis/editors/default/default.js b/src/ui/public/vis/editors/default/default.js index b44aa9c8967579..47e95489e1fc13 100644 --- a/src/ui/public/vis/editors/default/default.js +++ b/src/ui/public/vis/editors/default/default.js @@ -2,11 +2,12 @@ import './sidebar'; import './vis_options'; import $ from 'jquery'; - import _ from 'lodash'; import angular from 'angular'; import defaultEditorTemplate from './default.html'; +import { VisEditorTypesRegistryProvider } from 'ui/registry/vis_editor_types'; + const defaultEditor = function ($rootScope, $compile) { return class DefaultEditor { static key = 'default'; @@ -99,4 +100,6 @@ const defaultEditor = function ($rootScope, $compile) { }; }; +VisEditorTypesRegistryProvider.register(defaultEditor); + export { defaultEditor }; diff --git a/src/ui/public/vis/request_handlers/courier.js b/src/ui/public/vis/request_handlers/courier.js index 17ceb6c2524d7e..65581bba939fba 100644 --- a/src/ui/public/vis/request_handlers/courier.js +++ b/src/ui/public/vis/request_handlers/courier.js @@ -1,5 +1,7 @@ import _ from 'lodash'; +import { VisRequestHandlersRegistryProvider } from 'ui/registry/vis_request_handlers'; + const CourierRequestHandlerProvider = function (Private, courier, timefilter) { return { name: 'courier', @@ -48,4 +50,6 @@ const CourierRequestHandlerProvider = function (Private, courier, timefilter) { }; }; +VisRequestHandlersRegistryProvider.register(CourierRequestHandlerProvider); + export { CourierRequestHandlerProvider }; diff --git a/src/ui/public/vis/request_handlers/none.js b/src/ui/public/vis/request_handlers/none.js index 5bb0444bddb774..a3dac6e07ed5e8 100644 --- a/src/ui/public/vis/request_handlers/none.js +++ b/src/ui/public/vis/request_handlers/none.js @@ -1,3 +1,5 @@ +import { VisRequestHandlersRegistryProvider } from 'ui/registry/vis_request_handlers'; + const noneRequestHandlerProvider = function () { return { name: 'none', @@ -9,4 +11,6 @@ const noneRequestHandlerProvider = function () { }; }; +VisRequestHandlersRegistryProvider.register(noneRequestHandlerProvider); + export { noneRequestHandlerProvider }; diff --git a/src/ui/public/vis/response_handlers/basic.js b/src/ui/public/vis/response_handlers/basic.js index 886ebabe336ab3..f9f6643ce1a71c 100644 --- a/src/ui/public/vis/response_handlers/basic.js +++ b/src/ui/public/vis/response_handlers/basic.js @@ -1,6 +1,7 @@ import { AggResponseIndexProvider } from 'ui/agg_response/index'; import { AggResponseTabifyTableProvider } from 'ui/agg_response/tabify/_table'; +import { VisResponseHandlersRegistryProvider } from 'ui/registry/vis_response_handlers'; const BasicResponseHandlerProvider = function (Private) { const aggResponse = Private(AggResponseIndexProvider); @@ -72,4 +73,6 @@ const BasicResponseHandlerProvider = function (Private) { }; }; +VisResponseHandlersRegistryProvider.register(BasicResponseHandlerProvider); + export { BasicResponseHandlerProvider }; diff --git a/src/ui/public/vis/response_handlers/none.js b/src/ui/public/vis/response_handlers/none.js index ce9874a378f16f..2db8eccaec2360 100644 --- a/src/ui/public/vis/response_handlers/none.js +++ b/src/ui/public/vis/response_handlers/none.js @@ -3,6 +3,8 @@ // returns a promise // promise returns response data when resolved +import { VisResponseHandlersRegistryProvider } from 'ui/registry/vis_response_handlers'; + const noneResponseHandler = function () { return { name: 'none', @@ -14,4 +16,6 @@ const noneResponseHandler = function () { }; }; +VisResponseHandlersRegistryProvider.register(noneResponseHandler); + export { noneResponseHandler }; diff --git a/src/ui/public/vis/response_handlers/tabify.js b/src/ui/public/vis/response_handlers/tabify.js deleted file mode 100644 index 843ee4684616d3..00000000000000 --- a/src/ui/public/vis/response_handlers/tabify.js +++ /dev/null @@ -1,22 +0,0 @@ -import { AggResponseIndexProvider } from 'ui/agg_response/index'; - -const TabifyResponseHandlerProvider = function (Private) { - const aggResponse = Private(AggResponseIndexProvider); - - return { - name: 'tabify', - handler: function (vis, response) { - return new Promise((resolve) => { - - const tableGroup = aggResponse.tabify(vis, response, { - canSplit: true, - asAggConfigResults: true - }); - - resolve(tableGroup); - }); - } - }; -}; - -export { TabifyResponseHandlerProvider }; diff --git a/src/ui/ui_exports.js b/src/ui/ui_exports.js index c67eeed86a9a66..02007b74d0b8d5 100644 --- a/src/ui/ui_exports.js +++ b/src/ui/ui_exports.js @@ -10,7 +10,18 @@ export default class UiExports { this.navLinks = new UiNavLinkCollection(this); this.apps = new UiAppCollection(this); this.aliases = { - fieldFormatEditors: ['ui/field_format_editor/register'] + fieldFormatEditors: ['ui/field_format_editor/register'], + visRequestHandlers: [ + 'ui/vis/request_handlers/courier', + 'ui/vis/request_handlers/none' + ], + visResponseHandlers: [ + 'ui/vis/response_handlers/basic', + 'ui/vis/response_handlers/none' + ], + visEditorTypes: [ + 'ui/vis/editors/default/default', + ], }; this.urlBasePath = urlBasePath; this.exportConsumer = _.memoize(this.exportConsumer); @@ -91,6 +102,10 @@ export default class UiExports { }; case 'visTypes': + case 'visResponseHandlers': + case 'visRequestHandlers': + case 'visEditorTypes': + case 'savedObjectTypes': case 'fieldFormats': case 'fieldFormatEditors': case 'spyModes':