diff --git a/package.json b/package.json index 629889d9b9818..0ef5b6fc8b7ad 100644 --- a/package.json +++ b/package.json @@ -217,6 +217,7 @@ "eslint": "3.11.1", "eslint-plugin-babel": "4.0.0", "eslint-plugin-jest": "19.0.1", + "eslint-plugin-kibana-custom": "file:packages/custom-eslint-rules", "eslint-plugin-mocha": "4.7.0", "eslint-plugin-react": "6.10.3", "event-stream": "3.3.2", diff --git a/packages/custom-eslint-rules/index.js b/packages/custom-eslint-rules/index.js new file mode 100644 index 0000000000000..d76cec67a4bd2 --- /dev/null +++ b/packages/custom-eslint-rules/index.js @@ -0,0 +1,7 @@ +module.exports.rules = { + 'no-default-export': context => ({ + ExportDefaultDeclaration: (node) => { + context.report(node, 'Default exports not allowed.'); + } + }) +}; diff --git a/packages/custom-eslint-rules/package.json b/packages/custom-eslint-rules/package.json new file mode 100644 index 0000000000000..61e3ed6a371b3 --- /dev/null +++ b/packages/custom-eslint-rules/package.json @@ -0,0 +1,5 @@ +{ + "name": "eslint-plugin-kibana-custom", + "version": "1.0.0", + "description": "Custom ESLint rules for Kibana" +} diff --git a/src/core_plugins/kibana/public/.eslintrc b/src/core_plugins/kibana/public/.eslintrc index b7d7d2a31c13d..3f6fcde6465e6 100644 --- a/src/core_plugins/kibana/public/.eslintrc +++ b/src/core_plugins/kibana/public/.eslintrc @@ -1,2 +1,7 @@ + +plugins: [ + 'kibana-custom' +] rules: no-console: 2 + kibana-custom/no-default-export: error diff --git a/src/core_plugins/kibana/public/dashboard/panel/panel.js b/src/core_plugins/kibana/public/dashboard/panel/panel.js index deef67a7a358c..84de32a0b4cda 100644 --- a/src/core_plugins/kibana/public/dashboard/panel/panel.js +++ b/src/core_plugins/kibana/public/dashboard/panel/panel.js @@ -6,6 +6,7 @@ import 'plugins/kibana/dashboard/panel/get_object_loaders_for_dashboard'; import FilterManagerProvider from 'ui/filter_manager'; import uiModules from 'ui/modules'; import panelTemplate from 'plugins/kibana/dashboard/panel/panel.html'; +import { savedObjectManagementRegistry } from 'plugins/kibana/management/saved_object_registry'; import { getPersistedStateId } from 'plugins/kibana/dashboard/panel/panel_state'; import { loadSavedObject } from 'plugins/kibana/dashboard/panel/load_saved_object'; import { DashboardViewMode } from '../dashboard_view_mode'; @@ -15,7 +16,7 @@ uiModules .directive('dashboardPanel', function (savedVisualizations, savedSearches, Notifier, Private, $injector, getObjectLoadersForDashboard) { const filterManager = Private(FilterManagerProvider); - const services = require('plugins/kibana/management/saved_object_registry').all().map(function (serviceObj) { + const services = savedObjectManagementRegistry.all().map(function (serviceObj) { const service = $injector.get(serviceObj.service); return { type: service.type, diff --git a/src/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboards.js b/src/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboards.js index 91d9472a4e2e7..31f6f417f9819 100644 --- a/src/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboards.js +++ b/src/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboards.js @@ -1,15 +1,13 @@ import 'plugins/kibana/dashboard/saved_dashboard/saved_dashboard'; import uiModules from 'ui/modules'; import { SavedObjectLoader } from 'ui/courier/saved_object/saved_object_loader'; +import { savedObjectManagementRegistry } from 'plugins/kibana/management/saved_object_registry'; const module = uiModules.get('app/dashboard'); -// bring in the factory - - // Register this service with the saved object registry so it can be // edited by the object editor. -require('plugins/kibana/management/saved_object_registry').register({ +savedObjectManagementRegistry.register({ service: 'savedDashboards', title: 'dashboards' }); diff --git a/src/core_plugins/kibana/public/discover/__tests__/directives/field_calculator.js b/src/core_plugins/kibana/public/discover/__tests__/directives/field_calculator.js index aedd64d2d8250..2e185ddb70811 100644 --- a/src/core_plugins/kibana/public/discover/__tests__/directives/field_calculator.js +++ b/src/core_plugins/kibana/public/discover/__tests__/directives/field_calculator.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import ngMock from 'ng_mock'; -import fieldCalculator from 'plugins/kibana/discover/components/field_chooser/lib/field_calculator'; +import { fieldCalculator } from 'plugins/kibana/discover/components/field_chooser/lib/field_calculator'; import expect from 'expect.js'; import 'ui/private'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; diff --git a/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.js b/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.js index 6869a3257808b..7752db25ce866 100644 --- a/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.js +++ b/src/core_plugins/kibana/public/discover/components/field_chooser/field_chooser.js @@ -6,7 +6,7 @@ import 'angular-ui-select'; import _ from 'lodash'; import $ from 'jquery'; import rison from 'rison-node'; -import fieldCalculator from 'plugins/kibana/discover/components/field_chooser/lib/field_calculator'; +import { fieldCalculator } from 'plugins/kibana/discover/components/field_chooser/lib/field_calculator'; import IndexPatternsFieldListProvider from 'ui/index_patterns/_field_list'; import uiModules from 'ui/modules'; import fieldChooserTemplate from 'plugins/kibana/discover/components/field_chooser/field_chooser.html'; diff --git a/src/core_plugins/kibana/public/discover/components/field_chooser/lib/field_calculator.js b/src/core_plugins/kibana/public/discover/components/field_chooser/lib/field_calculator.js index 1f78b3610eae5..45220ba534c45 100644 --- a/src/core_plugins/kibana/public/discover/components/field_chooser/lib/field_calculator.js +++ b/src/core_plugins/kibana/public/discover/components/field_chooser/lib/field_calculator.js @@ -94,7 +94,7 @@ function _groupValues(allValues, params) { return groups; } -export default { +export const fieldCalculator = { _groupValues: _groupValues, _countMissing: _countMissing, getFieldValues: getFieldValues, diff --git a/src/core_plugins/kibana/public/discover/index.js b/src/core_plugins/kibana/public/discover/index.js index 07c3f035f19ab..bd1aa78ec3e49 100644 --- a/src/core_plugins/kibana/public/discover/index.js +++ b/src/core_plugins/kibana/public/discover/index.js @@ -7,6 +7,6 @@ import 'plugins/kibana/discover/controllers/discover'; import 'plugins/kibana/discover/styles/main.less'; import 'ui/doc_table/components/table_row'; import savedObjectRegistry from 'ui/saved_objects/saved_object_registry'; -import savedSearchProvider from 'plugins/kibana/discover/saved_searches/saved_search_register'; +import { savedSearchProvider } from 'plugins/kibana/discover/saved_searches/saved_search_register'; savedObjectRegistry.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 4b9c3de26a06e..64ca933cbe2cf 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,3 @@ -export default function savedSearchObjectFn(savedSearches) { +export function savedSearchProvider(savedSearches) { return savedSearches; } diff --git a/src/core_plugins/kibana/public/discover/saved_searches/saved_searches.js b/src/core_plugins/kibana/public/discover/saved_searches/saved_searches.js index 59e6b65d1888c..65fee5fc95c3a 100644 --- a/src/core_plugins/kibana/public/discover/saved_searches/saved_searches.js +++ b/src/core_plugins/kibana/public/discover/saved_searches/saved_searches.js @@ -2,13 +2,14 @@ import 'plugins/kibana/discover/saved_searches/_saved_search'; import 'ui/notify'; import uiModules from 'ui/modules'; import { SavedObjectLoader } from 'ui/courier/saved_object/saved_object_loader'; +import { savedObjectManagementRegistry } from 'plugins/kibana/management/saved_object_registry'; const module = uiModules.get('discover/saved_searches', [ 'kibana/notify' ]); // Register this service with the saved object registry so it can be // edited by the object editor. -require('plugins/kibana/management/saved_object_registry').register({ +savedObjectManagementRegistry.register({ service: 'savedSearches', title: 'searches' }); diff --git a/src/core_plugins/kibana/public/management/saved_object_registry.js b/src/core_plugins/kibana/public/management/saved_object_registry.js index 35ee02449246f..8e004088f9e17 100644 --- a/src/core_plugins/kibana/public/management/saved_object_registry.js +++ b/src/core_plugins/kibana/public/management/saved_object_registry.js @@ -1,6 +1,6 @@ import _ from 'lodash'; const registry = []; -export default { +export const savedObjectManagementRegistry = { register: function (service) { registry.push(service); }, diff --git a/src/core_plugins/kibana/public/management/sections/indices/_create.js b/src/core_plugins/kibana/public/management/sections/indices/_create.js index 6d9045b31da67..e0f1aa36d0ddc 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/_create.js +++ b/src/core_plugins/kibana/public/management/sections/indices/_create.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import { IndexPatternMissingIndices } from 'ui/errors'; import 'ui/directives/validate_index_name'; import 'ui/directives/auto_select_if_only_one'; -import RefreshKibanaIndex from 'plugins/kibana/management/sections/indices/_refresh_kibana_index'; +import { RefreshKibanaIndex } from 'plugins/kibana/management/sections/indices/_refresh_kibana_index'; import uiRoutes from 'ui/routes'; import uiModules from 'ui/modules'; import createTemplate from 'plugins/kibana/management/sections/indices/_create.html'; diff --git a/src/core_plugins/kibana/public/management/sections/indices/_date_scripts.js b/src/core_plugins/kibana/public/management/sections/indices/_date_scripts.js index a557b2ce0bb5d..fcf2a7ddf83dd 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/_date_scripts.js +++ b/src/core_plugins/kibana/public/management/sections/indices/_date_scripts.js @@ -1,6 +1,6 @@ import _ from 'lodash'; -export default function (indexPattern) { +export function dateScripts(indexPattern) { const dateScripts = {}; const scripts = { __dayOfMonth: 'dayOfMonth', diff --git a/src/core_plugins/kibana/public/management/sections/indices/_edit.js b/src/core_plugins/kibana/public/management/sections/indices/_edit.js index d6dd3c932b62b..50dd00f074df6 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/_edit.js +++ b/src/core_plugins/kibana/public/management/sections/indices/_edit.js @@ -3,9 +3,9 @@ import 'plugins/kibana/management/sections/indices/_indexed_fields'; import 'plugins/kibana/management/sections/indices/_scripted_fields'; import 'plugins/kibana/management/sections/indices/source_filters/source_filters'; import 'plugins/kibana/management/sections/indices/_index_header'; -import RefreshKibanaIndex from 'plugins/kibana/management/sections/indices/_refresh_kibana_index'; +import { RefreshKibanaIndex } from 'plugins/kibana/management/sections/indices/_refresh_kibana_index'; import UrlProvider from 'ui/url'; -import IndicesEditSectionsProvider from 'plugins/kibana/management/sections/indices/_edit_sections'; +import { IndicesEditSectionsProvider } from 'plugins/kibana/management/sections/indices/_edit_sections'; import uiRoutes from 'ui/routes'; import uiModules from 'ui/modules'; import editTemplate from 'plugins/kibana/management/sections/indices/_edit.html'; diff --git a/src/core_plugins/kibana/public/management/sections/indices/_edit_sections.js b/src/core_plugins/kibana/public/management/sections/indices/_edit_sections.js index 2717817dbc241..c83b7bbe2d4c2 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/_edit_sections.js +++ b/src/core_plugins/kibana/public/management/sections/indices/_edit_sections.js @@ -1,5 +1,6 @@ import _ from 'lodash'; -export default function GetFieldTypes() { + +export function IndicesEditSectionsProvider() { return function (indexPattern) { const fieldCount = _.countBy(indexPattern.fields, function (field) { diff --git a/src/core_plugins/kibana/public/management/sections/indices/_refresh_kibana_index.js b/src/core_plugins/kibana/public/management/sections/indices/_refresh_kibana_index.js index 37ab15eb6c0e6..d185d9a049a5b 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/_refresh_kibana_index.js +++ b/src/core_plugins/kibana/public/management/sections/indices/_refresh_kibana_index.js @@ -1,4 +1,4 @@ -export default function RefreshKibanaIndexFn(esAdmin, kbnIndex) { +export function RefreshKibanaIndex(esAdmin, kbnIndex) { return function () { return esAdmin.indices.refresh({ index: kbnIndex diff --git a/src/core_plugins/kibana/public/management/sections/indices/_scripted_fields.js b/src/core_plugins/kibana/public/management/sections/indices/_scripted_fields.js index 7ac7b90357b1f..f3ecd39a9436c 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/_scripted_fields.js +++ b/src/core_plugins/kibana/public/management/sections/indices/_scripted_fields.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import 'ui/paginated_table'; import controlsHtml from 'plugins/kibana/management/sections/indices/_field_controls.html'; -import dateScripts from 'plugins/kibana/management/sections/indices/_date_scripts'; +import { dateScripts } from 'plugins/kibana/management/sections/indices/_date_scripts'; import uiModules from 'ui/modules'; import scriptedFieldsTemplate from 'plugins/kibana/management/sections/indices/_scripted_fields.html'; diff --git a/src/core_plugins/kibana/public/management/sections/objects/_objects.js b/src/core_plugins/kibana/public/management/sections/objects/_objects.js index 2e678bb817f4a..987add407d1c4 100644 --- a/src/core_plugins/kibana/public/management/sections/objects/_objects.js +++ b/src/core_plugins/kibana/public/management/sections/objects/_objects.js @@ -1,7 +1,7 @@ import { saveAs } from '@spalger/filesaver'; import { extend, find, flattenDeep, partialRight, pick, pluck, sortBy } from 'lodash'; import angular from 'angular'; -import registry from 'plugins/kibana/management/saved_object_registry'; +import { savedObjectManagementRegistry } from 'plugins/kibana/management/saved_object_registry'; import objectIndexHTML from 'plugins/kibana/management/sections/objects/_objects.html'; import 'ui/directives/file_upload'; import uiRoutes from 'ui/routes'; @@ -38,7 +38,7 @@ uiModules.get('apps/management') }; const getData = function (filter) { - const services = registry.all().map(function (obj) { + const services = savedObjectManagementRegistry.all().map(function (obj) { const service = $injector.get(obj.service); return service.find(filter).then(function (data) { return { diff --git a/src/core_plugins/kibana/public/management/sections/objects/_view.js b/src/core_plugins/kibana/public/management/sections/objects/_view.js index 551486d258b34..3f01525d7f9ae 100644 --- a/src/core_plugins/kibana/public/management/sections/objects/_view.js +++ b/src/core_plugins/kibana/public/management/sections/objects/_view.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import angular from 'angular'; import rison from 'rison-node'; -import registry from 'plugins/kibana/management/saved_object_registry'; +import { savedObjectManagementRegistry } from 'plugins/kibana/management/saved_object_registry'; import objectViewHTML from 'plugins/kibana/management/sections/objects/_view.html'; import IndexPatternsCastMappingTypeProvider from 'ui/index_patterns/_cast_mapping_type'; import uiRoutes from 'ui/routes'; @@ -19,7 +19,7 @@ uiModules.get('apps/management') controller: function ($scope, $injector, $routeParams, $location, $window, $rootScope, esAdmin, Private) { const notify = new Notifier({ location: 'SavedObject view' }); const castMappingType = Private(IndexPatternsCastMappingTypeProvider); - const serviceObj = registry.get($routeParams.service); + const serviceObj = savedObjectManagementRegistry.get($routeParams.service); const service = $injector.get(serviceObj.service); /** diff --git a/src/core_plugins/kibana/public/management/sections/settings/index.js b/src/core_plugins/kibana/public/management/sections/settings/index.js index 78a9460331a78..16713c38d4cc9 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/index.js +++ b/src/core_plugins/kibana/public/management/sections/settings/index.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import toEditableConfig from 'plugins/kibana/management/sections/settings/lib/to_editable_config'; +import { toEditableConfig } from 'plugins/kibana/management/sections/settings/lib/to_editable_config'; import 'plugins/kibana/management/sections/settings/advanced_row'; import management from 'ui/management'; import uiRoutes from 'ui/routes'; diff --git a/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/get_editor_type.js b/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/get_editor_type.js index 3eff7a0ae5259..2009693639d6b 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/get_editor_type.js +++ b/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/get_editor_type.js @@ -1,5 +1,5 @@ -import getEditorType from 'plugins/kibana/management/sections/settings/lib/get_editor_type'; +import { getEditorType } from 'plugins/kibana/management/sections/settings/lib/get_editor_type'; import expect from 'expect.js'; describe('Settings', function () { diff --git a/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/get_val_type.js b/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/get_val_type.js index f6743a194805f..b49f0f5a4c932 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/get_val_type.js +++ b/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/get_val_type.js @@ -1,5 +1,5 @@ -import getValType from 'plugins/kibana/management/sections/settings/lib/get_val_type'; +import { getValType } from 'plugins/kibana/management/sections/settings/lib/get_val_type'; import expect from 'expect.js'; describe('Settings', function () { diff --git a/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/to_editable_config.js b/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/to_editable_config.js index c84b9c6a51911..1b0f3317dce9b 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/to_editable_config.js +++ b/src/core_plugins/kibana/public/management/sections/settings/lib/__tests__/to_editable_config.js @@ -1,5 +1,5 @@ -import toEditableConfig from 'plugins/kibana/management/sections/settings/lib/to_editable_config'; +import { toEditableConfig } from 'plugins/kibana/management/sections/settings/lib/to_editable_config'; import expect from 'expect.js'; describe('Settings', function () { diff --git a/src/core_plugins/kibana/public/management/sections/settings/lib/get_editor_type.js b/src/core_plugins/kibana/public/management/sections/settings/lib/get_editor_type.js index f6e0768308034..5a22486faa419 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/lib/get_editor_type.js +++ b/src/core_plugins/kibana/public/management/sections/settings/lib/get_editor_type.js @@ -7,9 +7,7 @@ const NORMAL_EDITOR = ['number', 'string', 'null', 'undefined']; * @param {object} advanced setting configuration object * @returns {string} the editor type to use when editing value */ -function getEditorType(conf) { +export function getEditorType(conf) { if (_.contains(NAMED_EDITORS, conf.type)) return conf.type; if (_.contains(NORMAL_EDITOR, conf.type)) return 'normal'; } - -export default getEditorType; diff --git a/src/core_plugins/kibana/public/management/sections/settings/lib/get_val_type.js b/src/core_plugins/kibana/public/management/sections/settings/lib/get_val_type.js index 7b9f65c9a4925..e85a4e01e387b 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/lib/get_val_type.js +++ b/src/core_plugins/kibana/public/management/sections/settings/lib/get_val_type.js @@ -5,7 +5,7 @@ import _ from 'lodash'; * @param {?} current value of the setting * @returns {string} the type to use for determining the display and editor */ -function getValType(def, value) { +export function getValType(def, value) { if (def.type) { return def.type; } @@ -16,5 +16,3 @@ function getValType(def, value) { return (def.value != null ? typeof def.value : typeof value); } - -export default getValType; diff --git a/src/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js b/src/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js index eda3248923f36..fd837bc9630d3 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js +++ b/src/core_plugins/kibana/public/management/sections/settings/lib/to_editable_config.js @@ -1,5 +1,5 @@ -import getValType from './get_val_type'; -import getEditorType from './get_editor_type'; +import { getValType } from './get_val_type'; +import { getEditorType } from './get_editor_type'; /** * @param {object} advanced setting definition object @@ -7,7 +7,7 @@ import getEditorType from './get_editor_type'; * @param {object} current value of setting * @returns {object} the editable config object */ -function toEditableConfig({ def, name, value, isCustom }) { +export function toEditableConfig({ def, name, value, isCustom }) { if (!def) { def = {}; } @@ -33,5 +33,3 @@ function toEditableConfig({ def, name, value, isCustom }) { return conf; } - -export default toEditableConfig; diff --git a/src/core_plugins/kibana/public/visualize/index.js b/src/core_plugins/kibana/public/visualize/index.js index a58afa9be2678..bb17959396c95 100644 --- a/src/core_plugins/kibana/public/visualize/index.js +++ b/src/core_plugins/kibana/public/visualize/index.js @@ -21,7 +21,7 @@ import visualizeListingTemplate from './listing/visualize_listing.html'; import { VisualizeListingController } from './listing/visualize_listing'; import { VisualizeConstants } from './visualize_constants'; import savedObjectRegistry from 'ui/saved_objects/saved_object_registry'; -import savedVisusalizationProvider from 'plugins/kibana/visualize/saved_visualizations/saved_visualization_register'; +import { savedVisualizationProvider } from 'plugins/kibana/visualize/saved_visualizations/saved_visualization_register'; uiRoutes .defaults(/visualize/, { @@ -35,4 +35,4 @@ uiRoutes // preloading -savedObjectRegistry.register(savedVisusalizationProvider); +savedObjectRegistry.register(savedVisualizationProvider); 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 2a8a9fd4c9308..5d6f3f35a852f 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,3 @@ -export default function savedVisualizationFn(savedVisualizations) { +export function savedVisualizationProvider(savedVisualizations) { return savedVisualizations; } diff --git a/src/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.js b/src/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.js index 714b1850ccfc5..888798974fb70 100644 --- a/src/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.js +++ b/src/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.js @@ -2,13 +2,13 @@ import 'plugins/kibana/visualize/saved_visualizations/_saved_vis'; import RegistryVisTypesProvider from 'ui/registry/vis_types'; import uiModules from 'ui/modules'; import { SavedObjectLoader } from 'ui/courier/saved_object/saved_object_loader'; +import { savedObjectManagementRegistry } from 'plugins/kibana/management/saved_object_registry'; const app = uiModules.get('app/visualize'); - // Register this service with the saved object registry so it can be // edited by the object editor. -require('plugins/kibana/management/saved_object_registry').register({ +savedObjectManagementRegistry.register({ service: 'savedVisualizations', title: 'visualizations' }); diff --git a/src/core_plugins/timelion/public/services/saved_sheets.js b/src/core_plugins/timelion/public/services/saved_sheets.js index 3c4f3415916a2..9e9441e233ad8 100644 --- a/src/core_plugins/timelion/public/services/saved_sheets.js +++ b/src/core_plugins/timelion/public/services/saved_sheets.js @@ -1,4 +1,5 @@ import { SavedObjectLoader } from 'ui/courier/saved_object/saved_object_loader'; +import { savedObjectManagementRegistry } from 'plugins/kibana/management/saved_object_registry'; define(function (require) { const module = require('ui/modules').get('app/sheet'); @@ -8,7 +9,7 @@ define(function (require) { // Register this service with the saved object registry so it can be // edited by the object editor. - require('plugins/kibana/management/saved_object_registry').register({ + savedObjectManagementRegistry.register({ service: 'savedSheets', title: 'sheets' });