diff --git a/src/core_plugins/console/public/src/controllers/sense_top_nav_controller.js b/src/core_plugins/console/public/src/controllers/sense_top_nav_controller.js index 00f0092bca629..9b522660c02cc 100644 --- a/src/core_plugins/console/public/src/controllers/sense_top_nav_controller.js +++ b/src/core_plugins/console/public/src/controllers/sense_top_nav_controller.js @@ -1,4 +1,4 @@ -import KbnTopNavControllerProvider from 'ui/kbn_top_nav/kbn_top_nav_controller'; +import { KbnTopNavControllerProvider } from 'ui/kbn_top_nav/kbn_top_nav_controller'; import storage from '../storage'; export function SenseTopNavController(Private) { @@ -32,8 +32,8 @@ export function SenseTopNavController(Private) { ]); if (storage.get('version_welcome_shown') !== '@@SENSE_REVISION') { - controller.open('welcome') + controller.open('welcome'); } - return controller + return controller; } diff --git a/src/core_plugins/kibana/public/dashboard/dashboard.js b/src/core_plugins/kibana/public/dashboard/dashboard.js index df365262d97bc..c3aa98b843f1d 100644 --- a/src/core_plugins/kibana/public/dashboard/dashboard.js +++ b/src/core_plugins/kibana/public/dashboard/dashboard.js @@ -13,13 +13,13 @@ import { DashboardViewMode } from './dashboard_view_mode'; import { TopNavIds } from './top_nav/top_nav_ids'; import { ConfirmationButtonTypes } from 'ui/modals/confirm_modal'; import dashboardTemplate from 'plugins/kibana/dashboard/dashboard.html'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; -import DocTitleProvider from 'ui/doc_title'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; +import { DocTitleProvider } from 'ui/doc_title'; import { getTopNavConfig } from './top_nav/get_top_nav_config'; import { DashboardConstants, createDashboardEditUrl } from './dashboard_constants'; import { VisualizeConstants } from 'plugins/kibana/visualize/visualize_constants'; import UtilsBrushEventProvider from 'ui/utils/brush_event'; -import FilterBarFilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler'; +import { FilterBarClickHandlerProvider } from 'ui/filter_bar/filter_bar_click_handler'; import { DashboardState } from './dashboard_state'; import notify from 'ui/notify'; @@ -71,7 +71,7 @@ uiRoutes app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter, quickRanges, kbnUrl, confirmModal, Private) { const brushEvent = Private(UtilsBrushEventProvider); - const filterBarClickHandler = Private(FilterBarFilterBarClickHandlerProvider); + const filterBarClickHandler = Private(FilterBarClickHandlerProvider); return { restrict: 'E', diff --git a/src/core_plugins/kibana/public/dashboard/grid.js b/src/core_plugins/kibana/public/dashboard/grid.js index 485d38f8f118f..a788f4bd058a9 100644 --- a/src/core_plugins/kibana/public/dashboard/grid.js +++ b/src/core_plugins/kibana/public/dashboard/grid.js @@ -1,6 +1,6 @@ import _ from 'lodash'; import $ from 'jquery'; -import Binder from 'ui/binder'; +import { Binder } from 'ui/binder'; import chrome from 'ui/chrome'; import 'gridster'; import uiModules from 'ui/modules'; diff --git a/src/core_plugins/kibana/public/dashboard/panel/panel.js b/src/core_plugins/kibana/public/dashboard/panel/panel.js index 84de32a0b4cda..dd6d077ae019f 100644 --- a/src/core_plugins/kibana/public/dashboard/panel/panel.js +++ b/src/core_plugins/kibana/public/dashboard/panel/panel.js @@ -3,7 +3,7 @@ import 'ui/visualize'; import 'ui/doc_table'; import * as columnActions from 'ui/doc_table/actions/columns'; import 'plugins/kibana/dashboard/panel/get_object_loaders_for_dashboard'; -import FilterManagerProvider from 'ui/filter_manager'; +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'; 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 7752db25ce866..d8de60e7cfe35 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 @@ -7,7 +7,7 @@ import _ from 'lodash'; import $ from 'jquery'; import rison from 'rison-node'; import { fieldCalculator } from 'plugins/kibana/discover/components/field_chooser/lib/field_calculator'; -import IndexPatternsFieldListProvider from 'ui/index_patterns/_field_list'; +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'; const app = uiModules.get('apps/discover'); diff --git a/src/core_plugins/kibana/public/discover/controllers/discover.js b/src/core_plugins/kibana/public/discover/controllers/discover.js index 3ff8eb12630da..064ecc84bb032 100644 --- a/src/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/core_plugins/kibana/public/discover/controllers/discover.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import angular from 'angular'; import moment from 'moment'; -import getSort from 'ui/doc_table/lib/get_sort'; +import { getSort } from 'ui/doc_table/lib/get_sort'; import * as columnActions from 'ui/doc_table/actions/columns'; import dateMath from '@elastic/datemath'; import 'ui/doc_table'; @@ -16,11 +16,11 @@ import 'ui/state_management/app_state'; import 'ui/timefilter'; import 'ui/share'; import VisProvider from 'ui/vis'; -import DocTitleProvider from 'ui/doc_title'; +import { DocTitleProvider } from 'ui/doc_title'; import UtilsBrushEventProvider from 'ui/utils/brush_event'; import PluginsKibanaDiscoverHitSortFnProvider from 'plugins/kibana/discover/_hit_sort_fn'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; -import FilterManagerProvider from 'ui/filter_manager'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; +import { FilterManagerProvider } from 'ui/filter_manager'; import { AggTypesBucketsIntervalOptionsProvider } from 'ui/agg_types/buckets/_interval_options'; import stateMonitorFactory from 'ui/state_management/state_monitor_factory'; import uiRoutes from 'ui/routes'; diff --git a/src/core_plugins/kibana/public/management/index.js b/src/core_plugins/kibana/public/management/index.js index 37cb9f7720bef..9109dd37e2071 100644 --- a/src/core_plugins/kibana/public/management/index.js +++ b/src/core_plugins/kibana/public/management/index.js @@ -6,7 +6,7 @@ import uiRoutes from 'ui/routes'; import uiModules from 'ui/modules'; import appTemplate from 'plugins/kibana/management/app.html'; import landingTemplate from 'plugins/kibana/management/landing.html'; -import management from 'ui/management'; +import { management } from 'ui/management'; import 'ui/kbn_top_nav'; uiRoutes diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/indexed_fields_table.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/indexed_fields_table.js index 5b920a51d07e9..74dbd900405f4 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/indexed_fields_table.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/indexed_fields_table/indexed_fields_table.js @@ -4,7 +4,7 @@ import fieldNameHtml from './field_name.html'; import fieldTypeHtml from './field_type.html'; import fieldControlsHtml from '../field_controls.html'; import uiModules from 'ui/modules'; -import FieldWildcardProvider from 'ui/field_wildcard'; +import { FieldWildcardProvider } from 'ui/field_wildcard'; import template from './indexed_fields_table.html'; uiModules.get('apps/management') diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_field_editor/scripted_field_editor.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_field_editor/scripted_field_editor.js index 5db27dc9c012a..8c90e44ec36f4 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_field_editor/scripted_field_editor.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/scripted_field_editor/scripted_field_editor.js @@ -1,5 +1,5 @@ import 'ui/field_editor'; -import IndexPatternsFieldProvider from 'ui/index_patterns/_field'; +import { IndexPatternsFieldProvider } from 'ui/index_patterns/_field'; import UrlProvider from 'ui/url'; import uiRoutes from 'ui/routes'; import template from './scripted_field_editor.html'; diff --git a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/source_filters_table/source_filters_table.js b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/source_filters_table/source_filters_table.js index 45552b22306df..833a7297e9801 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/source_filters_table/source_filters_table.js +++ b/src/core_plugins/kibana/public/management/sections/indices/edit_index_pattern/source_filters_table/source_filters_table.js @@ -2,7 +2,7 @@ import { find, each, escape, invoke, size, without } from 'lodash'; import uiModules from 'ui/modules'; import Notifier from 'ui/notify/notifier'; -import FieldWildcardProvider from 'ui/field_wildcard'; +import { FieldWildcardProvider } from 'ui/field_wildcard'; import controlsHtml from './controls.html'; import filterHtml from './filter.html'; diff --git a/src/core_plugins/kibana/public/management/sections/indices/index.js b/src/core_plugins/kibana/public/management/sections/indices/index.js index a5f6955e6c0e3..51d996f11234e 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/index.js +++ b/src/core_plugins/kibana/public/management/sections/indices/index.js @@ -1,4 +1,4 @@ -import management from 'ui/management'; +import { management } from 'ui/management'; import './create_index_pattern'; import './edit_index_pattern'; import uiRoutes from 'ui/routes'; 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 3f01525d7f9ae..961535244d366 100644 --- a/src/core_plugins/kibana/public/management/sections/objects/_view.js +++ b/src/core_plugins/kibana/public/management/sections/objects/_view.js @@ -3,7 +3,7 @@ import angular from 'angular'; import rison from 'rison-node'; 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 { IndexPatternsCastMappingTypeProvider } from 'ui/index_patterns/_cast_mapping_type'; import uiRoutes from 'ui/routes'; import uiModules from 'ui/modules'; diff --git a/src/core_plugins/kibana/public/management/sections/objects/index.js b/src/core_plugins/kibana/public/management/sections/objects/index.js index c88ac73895f1e..f99047a73d3b5 100644 --- a/src/core_plugins/kibana/public/management/sections/objects/index.js +++ b/src/core_plugins/kibana/public/management/sections/objects/index.js @@ -1,4 +1,4 @@ -import management from 'ui/management'; +import { management } from 'ui/management'; import 'plugins/kibana/management/sections/objects/_view'; import 'plugins/kibana/management/sections/objects/_objects'; import 'ace'; 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 16713c38d4cc9..1da2245f85cba 100644 --- a/src/core_plugins/kibana/public/management/sections/settings/index.js +++ b/src/core_plugins/kibana/public/management/sections/settings/index.js @@ -1,7 +1,7 @@ import _ from 'lodash'; 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 { management } from 'ui/management'; import uiRoutes from 'ui/routes'; import uiModules from 'ui/modules'; import indexTemplate from 'plugins/kibana/management/sections/settings/index.html'; diff --git a/src/core_plugins/kibana/public/visualize/editor/agg_filter.js b/src/core_plugins/kibana/public/visualize/editor/agg_filter.js index 4a54313da00bd..ca2cdf36b6d0d 100644 --- a/src/core_plugins/kibana/public/visualize/editor/agg_filter.js +++ b/src/core_plugins/kibana/public/visualize/editor/agg_filter.js @@ -1,4 +1,4 @@ -import propFilter from 'ui/filters/_prop_filter'; +import { propFilter } from 'ui/filters/_prop_filter'; import uiModules from 'ui/modules'; uiModules diff --git a/src/core_plugins/kibana/public/visualize/editor/editor.js b/src/core_plugins/kibana/public/visualize/editor/editor.js index 7dc9e36957cf8..d695607f0e2aa 100644 --- a/src/core_plugins/kibana/public/visualize/editor/editor.js +++ b/src/core_plugins/kibana/public/visualize/editor/editor.js @@ -9,10 +9,10 @@ import chrome from 'ui/chrome'; import angular from 'angular'; import Notifier from 'ui/notify/notifier'; import RegistryVisTypesProvider from 'ui/registry/vis_types'; -import DocTitleProvider from 'ui/doc_title'; +import { DocTitleProvider } from 'ui/doc_title'; import UtilsBrushEventProvider from 'ui/utils/brush_event'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; -import FilterBarFilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; +import { FilterBarClickHandlerProvider } from 'ui/filter_bar/filter_bar_click_handler'; import stateMonitorFactory from 'ui/state_management/state_monitor_factory'; import uiRoutes from 'ui/routes'; import uiModules from 'ui/modules'; @@ -70,7 +70,7 @@ function VisEditor($rootScope, $scope, $route, timefilter, AppState, $window, kb const docTitle = Private(DocTitleProvider); const brushEvent = Private(UtilsBrushEventProvider); const queryFilter = Private(FilterBarQueryFilterProvider); - const filterBarClickHandler = Private(FilterBarFilterBarClickHandlerProvider); + const filterBarClickHandler = Private(FilterBarClickHandlerProvider); const notify = new Notifier({ location: 'Visualization Editor' diff --git a/src/core_plugins/metrics/public/kbn_vis_types/editor_controller.js b/src/core_plugins/metrics/public/kbn_vis_types/editor_controller.js index 0813369499545..8a71b4252f6db 100644 --- a/src/core_plugins/metrics/public/kbn_vis_types/editor_controller.js +++ b/src/core_plugins/metrics/public/kbn_vis_types/editor_controller.js @@ -4,6 +4,8 @@ import createNewPanel from '../lib/create_new_panel'; import '../directives/vis_editor'; import _ from 'lodash'; import angular from 'angular'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; + const app = modules.get('kibana/metrics_vis', ['kibana']); app.controller('MetricsEditorController', ( $location, @@ -15,7 +17,7 @@ app.controller('MetricsEditorController', ( ) => { $scope.embedded = $location.search().embed === 'true'; - const queryFilter = Private(require('ui/filter_bar/query_filter')); + const queryFilter = Private(FilterBarQueryFilterProvider); const createFetch = Private(require('../lib/fetch')); const fetch = () => { const fn = createFetch($scope); diff --git a/src/core_plugins/metrics/public/kbn_vis_types/vis_controller.js b/src/core_plugins/metrics/public/kbn_vis_types/vis_controller.js index e0cfedd29431f..4c57bb3e982d4 100644 --- a/src/core_plugins/metrics/public/kbn_vis_types/vis_controller.js +++ b/src/core_plugins/metrics/public/kbn_vis_types/vis_controller.js @@ -1,6 +1,8 @@ import modules from 'ui/modules'; import 'ui/state_management/app_state'; import '../directives/visualization'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; + const app = modules.get('kibana/metrics_vis'); app.controller('MetricsVisController', ( @@ -24,7 +26,7 @@ app.controller('MetricsVisController', ( $scope.reversed = Boolean(newValue); }); - const queryFilter = Private(require('ui/filter_bar/query_filter')); + const queryFilter = Private(FilterBarQueryFilterProvider); const createFetch = Private(require('../lib/fetch')); const fetch = () => { const fn = createFetch($scope); diff --git a/src/core_plugins/table_vis/public/__tests__/_table_vis.js b/src/core_plugins/table_vis/public/__tests__/_table_vis.js index 9b2fd30ef2473..565924742a892 100644 --- a/src/core_plugins/table_vis/public/__tests__/_table_vis.js +++ b/src/core_plugins/table_vis/public/__tests__/_table_vis.js @@ -4,6 +4,7 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; import VisProvider from 'ui/vis'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; + describe('Integration', function () { let $rootScope; let $compile; diff --git a/src/core_plugins/tagcloud/public/tag_cloud_controller.js b/src/core_plugins/tagcloud/public/tag_cloud_controller.js index cfbaa2abfb540..565b04a4f368b 100644 --- a/src/core_plugins/tagcloud/public/tag_cloud_controller.js +++ b/src/core_plugins/tagcloud/public/tag_cloud_controller.js @@ -2,13 +2,13 @@ import _ from 'lodash'; import uiModules from 'ui/modules'; import TagCloud from 'plugins/tagcloud/tag_cloud'; import AggConfigResult from 'ui/vis/agg_config_result'; -import FilterBarFilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler'; +import { FilterBarClickHandlerProvider } from 'ui/filter_bar/filter_bar_click_handler'; const module = uiModules.get('kibana/tagcloud', ['kibana']); module.controller('KbnTagCloudController', function ($scope, $element, Private, getAppState) { const containerNode = $element[0]; - const filterBarClickHandler = Private(FilterBarFilterBarClickHandlerProvider); + const filterBarClickHandler = Private(FilterBarClickHandlerProvider); const maxTagCount = 200; let truncated = false; diff --git a/src/core_plugins/timelion/public/app.js b/src/core_plugins/timelion/public/app.js index 967b07eb58855..a7f3dbfe810f8 100644 --- a/src/core_plugins/timelion/public/app.js +++ b/src/core_plugins/timelion/public/app.js @@ -1,6 +1,8 @@ import _ from 'lodash'; import moment from 'moment-timezone'; +import { DocTitleProvider } from 'ui/doc_title'; + require('plugins/timelion/directives/cells/cells'); require('plugins/timelion/directives/fullscreen/fullscreen'); require('plugins/timelion/directives/interval/interval'); @@ -57,7 +59,7 @@ app.controller('timelion', function ( }); const timezone = Private(require('plugins/timelion/services/timezone'))(); - const docTitle = Private(require('ui/doc_title')); + const docTitle = Private(DocTitleProvider); const defaultExpression = '.es(*)'; const savedSheet = $route.current.locals.savedSheet; diff --git a/src/core_plugins/timelion/public/services/dashboard_context.js b/src/core_plugins/timelion/public/services/dashboard_context.js index 010a84f6d6ad3..2dcf2d8e5b74c 100644 --- a/src/core_plugins/timelion/public/services/dashboard_context.js +++ b/src/core_plugins/timelion/public/services/dashboard_context.js @@ -1,10 +1,11 @@ import _ from 'lodash'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; require('ui/state_management/app_state'); module.exports = function dashboardContext(Private, getAppState) { return function () { - const queryFilter = Private(require('ui/filter_bar/query_filter')); + const queryFilter = Private(FilterBarQueryFilterProvider); const bool = { must: [], must_not: [] }; const filterBarFilters = queryFilter.getFilters(); const queryBarFilter = getAppState().query; diff --git a/src/core_plugins/timelion/public/vis/timelion_vis_controller.js b/src/core_plugins/timelion/public/vis/timelion_vis_controller.js index bf4a387f26228..16459e9e15c9f 100644 --- a/src/core_plugins/timelion/public/vis/timelion_vis_controller.js +++ b/src/core_plugins/timelion/public/vis/timelion_vis_controller.js @@ -1,3 +1,5 @@ +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; + define(function (require) { require('plugins/timelion/directives/chart/chart'); require('plugins/timelion/directives/interval/interval'); @@ -6,7 +8,7 @@ define(function (require) { const _ = require('lodash'); const module = require('ui/modules').get('kibana/timelion_vis', ['kibana']); module.controller('TimelionVisController', function ($scope, $element, Private, Notifier, $http, $rootScope, timefilter) { - const queryFilter = Private(require('ui/filter_bar/query_filter')); + const queryFilter = Private(FilterBarQueryFilterProvider); const timezone = Private(require('plugins/timelion/services/timezone'))(); const dashboardContext = Private(require('plugins/timelion/services/dashboard_context')); diff --git a/src/fixtures/stubbed_logstash_index_pattern.js b/src/fixtures/stubbed_logstash_index_pattern.js index e5473a14e55ab..56380707e83a4 100644 --- a/src/fixtures/stubbed_logstash_index_pattern.js +++ b/src/fixtures/stubbed_logstash_index_pattern.js @@ -1,7 +1,8 @@ import _ from 'lodash'; import TestUtilsStubIndexPatternProvider from 'test_utils/stub_index_pattern'; -import IndexPatternsFieldTypesProvider from 'ui/index_patterns/_field_types'; +import { IndexPatternsFieldTypesProvider } from 'ui/index_patterns/_field_types'; import FixturesLogstashFieldsProvider from 'fixtures/logstash_fields'; + export default function stubbedLogstashIndexPatternService(Private) { const StubIndexPattern = Private(TestUtilsStubIndexPatternProvider); const fieldTypes = Private(IndexPatternsFieldTypesProvider); diff --git a/src/test_utils/stub_index_pattern.js b/src/test_utils/stub_index_pattern.js index c14a08a30c50a..cd83aec602b5e 100644 --- a/src/test_utils/stub_index_pattern.js +++ b/src/test_utils/stub_index_pattern.js @@ -1,13 +1,13 @@ import _ from 'lodash'; import sinon from 'sinon'; import Promise from 'bluebird'; -import IndexedArray from 'ui/indexed_array'; -import IndexPattern from 'ui/index_patterns/_index_pattern'; -import formatHit from 'ui/index_patterns/_format_hit'; -import getComputedFields from 'ui/index_patterns/_get_computed_fields'; +import { IndexedArray } from 'ui/indexed_array'; +import { IndexPatternProvider } from 'ui/index_patterns/_index_pattern'; +import { formatHit } from 'ui/index_patterns/_format_hit'; +import { getComputedFields } from 'ui/index_patterns/_get_computed_fields'; import RegistryFieldFormatsProvider from 'ui/registry/field_formats'; -import IndexPatternsFlattenHitProvider from 'ui/index_patterns/_flatten_hit'; -import IndexPatternsFieldProvider from 'ui/index_patterns/_field'; +import { IndexPatternsFlattenHitProvider } from 'ui/index_patterns/_flatten_hit'; +import { IndexPatternsFieldProvider } from 'ui/index_patterns/_field'; export default function (Private) { const fieldFormats = Private(RegistryFieldFormatsProvider); @@ -24,7 +24,7 @@ export default function (Private) { this.getSourceFiltering = sinon.spy(); this.metaFields = ['_id', '_type', '_source']; this.fieldFormatMap = {}; - this.routes = IndexPattern.routes; + this.routes = IndexPatternProvider.routes; this.toIndexList = _.constant(Promise.resolve([pattern])); this.toDetailedIndexList = _.constant(Promise.resolve([ diff --git a/src/test_utils/stub_mapper.js b/src/test_utils/stub_mapper.js index b689de168094b..fe4b5ecf4cd9b 100644 --- a/src/test_utils/stub_mapper.js +++ b/src/test_utils/stub_mapper.js @@ -1,9 +1,9 @@ -import MapperService from 'ui/index_patterns/_mapper'; +import { IndexPatternsMapperProvider } from 'ui/index_patterns/_mapper'; import stubbedLogstashFields from 'fixtures/logstash_fields'; import sinon from 'auto-release-sinon'; export function stubMapper(Private, mockLogstashFields = Private(stubbedLogstashFields)) { - const stubbedMapper = Private(MapperService); + const stubbedMapper = Private(IndexPatternsMapperProvider); sinon.stub(stubbedMapper, 'getFieldsForIndexPattern', function () { return Promise.resolve(mockLogstashFields.filter(field => field.scripted === false)); diff --git a/src/ui/public/agg_types/__tests__/agg_params.js b/src/ui/public/agg_types/__tests__/agg_params.js index 2cebbd7d0b1ef..b6a478e654e9e 100644 --- a/src/ui/public/agg_types/__tests__/agg_params.js +++ b/src/ui/public/agg_types/__tests__/agg_params.js @@ -1,10 +1,11 @@ import ngMock from 'ng_mock'; import expect from 'expect.js'; import { AggTypesAggParamsProvider } from 'ui/agg_types/agg_params'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; -import AggTypesParamTypesFieldProvider from 'ui/agg_types/param_types/field'; -import AggTypesParamTypesOptionedProvider from 'ui/agg_types/param_types/optioned'; -import AggTypesParamTypesRegexProvider from 'ui/agg_types/param_types/regex'; +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; +import { AggTypesParamTypesFieldProvider } from 'ui/agg_types/param_types/field'; +import { AggTypesParamTypesOptionedProvider } from 'ui/agg_types/param_types/optioned'; +import { AggTypesParamTypesRegexProvider } from 'ui/agg_types/param_types/regex'; + describe('AggParams class', function () { let AggParams; diff --git a/src/ui/public/agg_types/__tests__/index.js b/src/ui/public/agg_types/__tests__/index.js index 0be99c7079934..af56ff2ea3667 100644 --- a/src/ui/public/agg_types/__tests__/index.js +++ b/src/ui/public/agg_types/__tests__/index.js @@ -7,7 +7,7 @@ import './buckets/_geo_hash'; import './buckets/_range'; import AggTypesIndexProvider from 'ui/agg_types/index'; import { AggTypesBucketsBucketAggTypeProvider } from 'ui/agg_types/buckets/_bucket_agg_type'; -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; describe('AggTypesComponent', function () { diff --git a/src/ui/public/agg_types/__tests__/metrics/parent_pipeline.js b/src/ui/public/agg_types/__tests__/metrics/parent_pipeline.js index 142a958f16374..9a0770fd88a29 100644 --- a/src/ui/public/agg_types/__tests__/metrics/parent_pipeline.js +++ b/src/ui/public/agg_types/__tests__/metrics/parent_pipeline.js @@ -1,17 +1,17 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import DerivativeProvider from 'ui/agg_types/metrics/derivative'; -import CumulativeSumProvider from 'ui/agg_types/metrics/cumulative_sum'; -import MovingAvgProvider from 'ui/agg_types/metrics/moving_avg'; -import SerialDiffProvider from 'ui/agg_types/metrics/serial_diff'; +import { AggTypesMetricsDerivativeProvider } from 'ui/agg_types/metrics/derivative'; +import { AggTypesMetricsCumulativeSumProvider } from 'ui/agg_types/metrics/cumulative_sum'; +import { AggTypesMetricsMovingAvgProvider } from 'ui/agg_types/metrics/moving_avg'; +import { AggTypesMetricsSerialDiffProvider } from 'ui/agg_types/metrics/serial_diff'; import VisProvider from 'ui/vis'; import StubbedIndexPattern from 'fixtures/stubbed_logstash_index_pattern'; const metrics = [ - { name: 'derivative', title: 'Derivative', provider: DerivativeProvider }, - { name: 'cumulative_sum', title: 'Cumulative Sum', provider: CumulativeSumProvider }, - { name: 'moving_avg', title: 'Moving Avg', provider: MovingAvgProvider }, - { name: 'serial_diff', title: 'Serial Diff', provider: SerialDiffProvider }, + { name: 'derivative', title: 'Derivative', provider: AggTypesMetricsDerivativeProvider }, + { name: 'cumulative_sum', title: 'Cumulative Sum', provider: AggTypesMetricsCumulativeSumProvider }, + { name: 'moving_avg', title: 'Moving Avg', provider: AggTypesMetricsMovingAvgProvider }, + { name: 'serial_diff', title: 'Serial Diff', provider: AggTypesMetricsSerialDiffProvider }, ]; describe('parent pipeline aggs', function () { diff --git a/src/ui/public/agg_types/__tests__/metrics/percentile_ranks.js b/src/ui/public/agg_types/__tests__/metrics/percentile_ranks.js index 048f064dd6ea3..e5d32263d92cd 100644 --- a/src/ui/public/agg_types/__tests__/metrics/percentile_ranks.js +++ b/src/ui/public/agg_types/__tests__/metrics/percentile_ranks.js @@ -1,10 +1,10 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import AggTypeMetricPercentileRanksProvider from 'ui/agg_types/metrics/percentile_ranks'; +import { AggTypesMetricsPercentileRanksProvider } from 'ui/agg_types/metrics/percentile_ranks'; import VisProvider from 'ui/vis'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; -describe('AggTypeMetricPercentileRanksProvider class', function () { +describe('AggTypesMetricsPercentileRanksProvider class', function () { let Vis; let indexPattern; @@ -14,7 +14,7 @@ describe('AggTypeMetricPercentileRanksProvider class', function () { beforeEach(ngMock.inject(function (Private) { Vis = Private(VisProvider); indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); - aggTypeMetricPercentileRanks = Private(AggTypeMetricPercentileRanksProvider); + aggTypeMetricPercentileRanks = Private(AggTypesMetricsPercentileRanksProvider); })); it('uses the custom label if it is set', function () { diff --git a/src/ui/public/agg_types/__tests__/metrics/percentiles.js b/src/ui/public/agg_types/__tests__/metrics/percentiles.js index 4b37316ff63e7..fa76f78cc4142 100644 --- a/src/ui/public/agg_types/__tests__/metrics/percentiles.js +++ b/src/ui/public/agg_types/__tests__/metrics/percentiles.js @@ -1,10 +1,10 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import AggTypeMetricPercentilesProvider from 'ui/agg_types/metrics/percentiles'; +import { AggTypesMetricsPercentilesProvider } from 'ui/agg_types/metrics/percentiles'; import VisProvider from 'ui/vis'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; -describe('AggTypeMetricPercentilesProvider class', function () { +describe('AggTypesMetricsPercentilesProvider class', function () { let Vis; let indexPattern; @@ -14,7 +14,7 @@ describe('AggTypeMetricPercentilesProvider class', function () { beforeEach(ngMock.inject(function (Private) { Vis = Private(VisProvider); indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); - aggTypeMetricPercentiles = Private(AggTypeMetricPercentilesProvider); + aggTypeMetricPercentiles = Private(AggTypesMetricsPercentilesProvider); })); it('uses the custom label if it is set', function () { diff --git a/src/ui/public/agg_types/__tests__/metrics/sibling_pipeline.js b/src/ui/public/agg_types/__tests__/metrics/sibling_pipeline.js index cf9bbf14b31ad..8a45e0a94790b 100644 --- a/src/ui/public/agg_types/__tests__/metrics/sibling_pipeline.js +++ b/src/ui/public/agg_types/__tests__/metrics/sibling_pipeline.js @@ -1,17 +1,17 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import BucketSum from 'ui/agg_types/metrics/bucket_sum'; -import BucketAvg from 'ui/agg_types/metrics/bucket_avg'; -import BucketMin from 'ui/agg_types/metrics/bucket_min'; -import BucketMax from 'ui/agg_types/metrics/bucket_max'; +import { AggTypesMetricsBucketSumProvider } from 'ui/agg_types/metrics/bucket_sum'; +import { AggTypesMetricsBucketAvgProvider } from 'ui/agg_types/metrics/bucket_avg'; +import { AggTypesMetricsBucketMinProvider } from 'ui/agg_types/metrics/bucket_min'; +import { AggTypesMetricsBucketMaxProvider } from 'ui/agg_types/metrics/bucket_max'; import VisProvider from 'ui/vis'; import StubbedIndexPattern from 'fixtures/stubbed_logstash_index_pattern'; const metrics = [ - { name: 'sum_bucket', title: 'Overall Sum', provider: BucketSum }, - { name: 'avg_bucket', title: 'Overall Average', provider: BucketAvg }, - { name: 'min_bucket', title: 'Overall Min', provider: BucketMin }, - { name: 'max_bucket', title: 'Overall Max', provider: BucketMax }, + { name: 'sum_bucket', title: 'Overall Sum', provider: AggTypesMetricsBucketSumProvider }, + { name: 'avg_bucket', title: 'Overall Average', provider: AggTypesMetricsBucketAvgProvider }, + { name: 'min_bucket', title: 'Overall Min', provider: AggTypesMetricsBucketMinProvider }, + { name: 'max_bucket', title: 'Overall Max', provider: AggTypesMetricsBucketMaxProvider }, ]; describe('sibling pipeline aggs', function () { diff --git a/src/ui/public/agg_types/__tests__/metrics/std_deviation.js b/src/ui/public/agg_types/__tests__/metrics/std_deviation.js index 1433ed793ccaa..77f6dcb61a831 100644 --- a/src/ui/public/agg_types/__tests__/metrics/std_deviation.js +++ b/src/ui/public/agg_types/__tests__/metrics/std_deviation.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import AggTypeMetricStandardDeviationProvider from 'ui/agg_types/metrics/std_deviation'; +import { AggTypesMetricsStdDeviationProvider } from 'ui/agg_types/metrics/std_deviation'; import VisProvider from 'ui/vis'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; @@ -14,7 +14,7 @@ describe('AggTypeMetricStandardDeviationProvider class', function () { beforeEach(ngMock.inject(function (Private) { Vis = Private(VisProvider); indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); - aggTypeMetricStandardDeviation = Private(AggTypeMetricStandardDeviationProvider); + aggTypeMetricStandardDeviation = Private(AggTypesMetricsStdDeviationProvider); })); it('uses the custom label if it is set', function () { diff --git a/src/ui/public/agg_types/__tests__/metrics/top_hit.js b/src/ui/public/agg_types/__tests__/metrics/top_hit.js index 04429a447787c..6a4de6c4b654e 100644 --- a/src/ui/public/agg_types/__tests__/metrics/top_hit.js +++ b/src/ui/public/agg_types/__tests__/metrics/top_hit.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import TopHitProvider from 'ui/agg_types/metrics/top_hit'; +import { AggTypesMetricsTopHitProvider } from 'ui/agg_types/metrics/top_hit'; import VisProvider from 'ui/vis'; import StubbedIndexPattern from 'fixtures/stubbed_logstash_index_pattern'; @@ -15,7 +15,7 @@ describe('Top hit metric', function () { ngMock.inject(function (Private) { const Vis = Private(VisProvider); const indexPattern = Private(StubbedIndexPattern); - topHitMetric = Private(TopHitProvider); + topHitMetric = Private(AggTypesMetricsTopHitProvider); const params = {}; if (field) { diff --git a/src/ui/public/agg_types/__tests__/param_types/_field.js b/src/ui/public/agg_types/__tests__/param_types/_field.js index 72550f3461f67..f3055eeb611cd 100644 --- a/src/ui/public/agg_types/__tests__/param_types/_field.js +++ b/src/ui/public/agg_types/__tests__/param_types/_field.js @@ -2,8 +2,8 @@ import expect from 'expect.js'; import { reject } from 'lodash'; import ngMock from 'ng_mock'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; -import AggTypesParamTypesFieldProvider from 'ui/agg_types/param_types/field'; +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; +import { AggTypesParamTypesFieldProvider } from 'ui/agg_types/param_types/field'; describe('Field', function () { diff --git a/src/ui/public/agg_types/__tests__/param_types/_optioned.js b/src/ui/public/agg_types/__tests__/param_types/_optioned.js index 5eaf02457529e..4339ec429056e 100644 --- a/src/ui/public/agg_types/__tests__/param_types/_optioned.js +++ b/src/ui/public/agg_types/__tests__/param_types/_optioned.js @@ -1,7 +1,8 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; -import AggTypesParamTypesOptionedProvider from 'ui/agg_types/param_types/optioned'; +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; +import { AggTypesParamTypesOptionedProvider } from 'ui/agg_types/param_types/optioned'; + describe('Optioned', function () { let BaseAggParam; diff --git a/src/ui/public/agg_types/__tests__/param_types/_raw_json.js b/src/ui/public/agg_types/__tests__/param_types/_raw_json.js index 53bfd8b8a5a8f..972c913d857bb 100644 --- a/src/ui/public/agg_types/__tests__/param_types/_raw_json.js +++ b/src/ui/public/agg_types/__tests__/param_types/_raw_json.js @@ -1,9 +1,8 @@ import _ from 'lodash'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; -import AggTypesParamTypesRawJsonProvider from 'ui/agg_types/param_types/raw_json'; - +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; +import { AggTypesParamTypesRawJsonProvider } from 'ui/agg_types/param_types/raw_json'; module.exports = describe('JSON', function () { const paramName = 'json_test'; diff --git a/src/ui/public/agg_types/__tests__/param_types/_regex.js b/src/ui/public/agg_types/__tests__/param_types/_regex.js index 900afbb83abc5..7f51d8b82188b 100644 --- a/src/ui/public/agg_types/__tests__/param_types/_regex.js +++ b/src/ui/public/agg_types/__tests__/param_types/_regex.js @@ -1,9 +1,10 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; -import AggTypesParamTypesRegexProvider from 'ui/agg_types/param_types/regex'; +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; +import { AggTypesParamTypesRegexProvider } from 'ui/agg_types/param_types/regex'; import VisProvider from 'ui/vis'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; + describe('Regex', function () { let BaseAggParam; diff --git a/src/ui/public/agg_types/__tests__/param_types/_string.js b/src/ui/public/agg_types/__tests__/param_types/_string.js index 01de3883c115c..5f4b0b48bfa00 100644 --- a/src/ui/public/agg_types/__tests__/param_types/_string.js +++ b/src/ui/public/agg_types/__tests__/param_types/_string.js @@ -1,8 +1,8 @@ import _ from 'lodash'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; -import AggTypesParamTypesStringProvider from 'ui/agg_types/param_types/string'; +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; +import { AggTypesParamTypesStringProvider } from 'ui/agg_types/param_types/string'; module.exports = describe('String', function () { const paramName = 'json_test'; diff --git a/src/ui/public/agg_types/__tests__/utils/_stub_agg_params.js b/src/ui/public/agg_types/__tests__/utils/_stub_agg_params.js index 8fdab2c7c66ad..301fa5c04c4f0 100644 --- a/src/ui/public/agg_types/__tests__/utils/_stub_agg_params.js +++ b/src/ui/public/agg_types/__tests__/utils/_stub_agg_params.js @@ -1,5 +1,8 @@ import _ from 'lodash'; import sinon from 'auto-release-sinon'; +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; +import { AggTypesParamTypesFieldProvider } from 'ui/agg_types/param_types/field'; +import { AggTypesParamTypesOptionedProvider } from 'ui/agg_types/param_types/optioned'; function ParamClassStub(parent, body) { const stub = sinon.spy(body || function () { @@ -25,19 +28,19 @@ function ParamClassStub(parent, body) { */ module.exports = function stubParamClasses(Private) { const BaseAggParam = Private.stub( - require('ui/agg_types/param_types/base'), + AggTypesParamTypesBaseProvider, new ParamClassStub(null, function (config) { _.assign(this, config); }) ); Private.stub( - require('ui/agg_types/param_types/field'), + AggTypesParamTypesFieldProvider, new ParamClassStub(BaseAggParam) ); Private.stub( - require('ui/agg_types/param_types/optioned'), + AggTypesParamTypesOptionedProvider, new ParamClassStub(BaseAggParam) ); }; diff --git a/src/ui/public/agg_types/agg_params.js b/src/ui/public/agg_types/agg_params.js index 81e9d56184b09..ea2ccd2661008 100644 --- a/src/ui/public/agg_types/agg_params.js +++ b/src/ui/public/agg_types/agg_params.js @@ -1,12 +1,12 @@ import 'ui/filters/label'; import _ from 'lodash'; -import IndexedArray from 'ui/indexed_array'; -import AggTypesParamTypesFieldProvider from 'ui/agg_types/param_types/field'; -import AggTypesParamTypesOptionedProvider from 'ui/agg_types/param_types/optioned'; -import AggTypesParamTypesRegexProvider from 'ui/agg_types/param_types/regex'; -import AggTypesParamTypesStringProvider from 'ui/agg_types/param_types/string'; -import AggTypesParamTypesRawJsonProvider from 'ui/agg_types/param_types/raw_json'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; +import { IndexedArray } from 'ui/indexed_array'; +import { AggTypesParamTypesFieldProvider } from 'ui/agg_types/param_types/field'; +import { AggTypesParamTypesOptionedProvider } from 'ui/agg_types/param_types/optioned'; +import { AggTypesParamTypesRegexProvider } from 'ui/agg_types/param_types/regex'; +import { AggTypesParamTypesStringProvider } from 'ui/agg_types/param_types/string'; +import { AggTypesParamTypesRawJsonProvider } from 'ui/agg_types/param_types/raw_json'; +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; export function AggTypesAggParamsProvider(Private) { const paramTypeMap = { diff --git a/src/ui/public/agg_types/buckets/create_filter/date_histogram.js b/src/ui/public/agg_types/buckets/create_filter/date_histogram.js index 79ea7b6e05d09..5c78de090ebdc 100644 --- a/src/ui/public/agg_types/buckets/create_filter/date_histogram.js +++ b/src/ui/public/agg_types/buckets/create_filter/date_histogram.js @@ -1,5 +1,5 @@ import moment from 'moment'; -import buildRangeFilter from 'ui/filter_manager/lib/range'; +import { buildRangeFilter } from 'ui/filter_manager/lib/range'; export function AggTypesBucketsCreateFilterDateHistogramProvider() { diff --git a/src/ui/public/agg_types/buckets/create_filter/date_range.js b/src/ui/public/agg_types/buckets/create_filter/date_range.js index d04acb9eeeb98..c8790b6095c94 100644 --- a/src/ui/public/agg_types/buckets/create_filter/date_range.js +++ b/src/ui/public/agg_types/buckets/create_filter/date_range.js @@ -1,5 +1,5 @@ import dateRange from 'ui/utils/date_range'; -import buildRangeFilter from 'ui/filter_manager/lib/range'; +import { buildRangeFilter } from 'ui/filter_manager/lib/range'; export function AggTypesBucketsCreateFilterDateRangeProvider(config) { diff --git a/src/ui/public/agg_types/buckets/create_filter/filters.js b/src/ui/public/agg_types/buckets/create_filter/filters.js index 6ea030bd6b632..1ae9ffa4e7cde 100644 --- a/src/ui/public/agg_types/buckets/create_filter/filters.js +++ b/src/ui/public/agg_types/buckets/create_filter/filters.js @@ -1,4 +1,4 @@ -import buildQueryFilter from 'ui/filter_manager/lib/query'; +import { buildQueryFilter } from 'ui/filter_manager/lib/query'; import _ from 'lodash'; export function AggTypesBucketsCreateFilterFiltersProvider() { diff --git a/src/ui/public/agg_types/buckets/create_filter/histogram.js b/src/ui/public/agg_types/buckets/create_filter/histogram.js index d9e99537a94ec..eb4e47dedee45 100644 --- a/src/ui/public/agg_types/buckets/create_filter/histogram.js +++ b/src/ui/public/agg_types/buckets/create_filter/histogram.js @@ -1,4 +1,4 @@ -import buildRangeFilter from 'ui/filter_manager/lib/range'; +import { buildRangeFilter } from 'ui/filter_manager/lib/range'; export function AggTypesBucketsCreateFilterHistogramProvider() { return function (aggConfig, key) { diff --git a/src/ui/public/agg_types/buckets/create_filter/ip_range.js b/src/ui/public/agg_types/buckets/create_filter/ip_range.js index fff6de4c84544..1d1a547faa780 100644 --- a/src/ui/public/agg_types/buckets/create_filter/ip_range.js +++ b/src/ui/public/agg_types/buckets/create_filter/ip_range.js @@ -1,5 +1,5 @@ import CidrMask from 'ui/utils/cidr_mask'; -import buildRangeFilter from 'ui/filter_manager/lib/range'; +import { buildRangeFilter } from 'ui/filter_manager/lib/range'; export function AggTypesBucketsCreateFilterIpRangeProvider() { return function (aggConfig, key) { diff --git a/src/ui/public/agg_types/buckets/create_filter/range.js b/src/ui/public/agg_types/buckets/create_filter/range.js index d1a4c6d8a9a74..b46e03cdcb0ea 100644 --- a/src/ui/public/agg_types/buckets/create_filter/range.js +++ b/src/ui/public/agg_types/buckets/create_filter/range.js @@ -1,4 +1,4 @@ -import buildRangeFilter from 'ui/filter_manager/lib/range'; +import { buildRangeFilter } from 'ui/filter_manager/lib/range'; export function AggTypesBucketsCreateFilterRangeProvider() { return function (aggConfig, key) { diff --git a/src/ui/public/agg_types/buckets/create_filter/terms.js b/src/ui/public/agg_types/buckets/create_filter/terms.js index d9c42a41ff544..2dcbc03f81c08 100644 --- a/src/ui/public/agg_types/buckets/create_filter/terms.js +++ b/src/ui/public/agg_types/buckets/create_filter/terms.js @@ -1,4 +1,4 @@ -import buildPhraseFilter from 'ui/filter_manager/lib/phrase'; +import { buildPhraseFilter } from 'ui/filter_manager/lib/phrase'; export function AggTypesBucketsCreateFilterTermsProvider() { return function (aggConfig, key) { diff --git a/src/ui/public/agg_types/buckets/range.js b/src/ui/public/agg_types/buckets/range.js index 25edb65e643dd..01369480c9b29 100644 --- a/src/ui/public/agg_types/buckets/range.js +++ b/src/ui/public/agg_types/buckets/range.js @@ -1,13 +1,13 @@ import { AggTypesBucketsBucketAggTypeProvider } from 'ui/agg_types/buckets/_bucket_agg_type'; import { AggTypesBucketsCreateFilterRangeProvider } from 'ui/agg_types/buckets/create_filter/range'; -import IndexPatternsFieldFormatFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; import { RangeKeyProvider } from './range_key'; import rangesTemplate from 'ui/agg_types/controls/ranges.html'; export function AggTypesBucketsRangeProvider(Private) { const BucketAggType = Private(AggTypesBucketsBucketAggTypeProvider); const createFilter = Private(AggTypesBucketsCreateFilterRangeProvider); - const FieldFormat = Private(IndexPatternsFieldFormatFieldFormatProvider); + const FieldFormat = Private(IndexPatternsFieldFormatProvider); const RangeKey = Private(RangeKeyProvider); const keyCaches = new WeakMap(); diff --git a/src/ui/public/agg_types/index.js b/src/ui/public/agg_types/index.js index 3a962dca7a922..7d60f74772040 100644 --- a/src/ui/public/agg_types/index.js +++ b/src/ui/public/agg_types/index.js @@ -1,21 +1,21 @@ -import IndexedArray from 'ui/indexed_array'; +import { IndexedArray } from 'ui/indexed_array'; import 'ui/agg_types/agg_params'; -import AggTypesMetricsCountProvider from 'ui/agg_types/metrics/count'; -import AggTypesMetricsAvgProvider from 'ui/agg_types/metrics/avg'; -import AggTypesMetricsSumProvider from 'ui/agg_types/metrics/sum'; -import AggTypesMetricsMedianProvider from 'ui/agg_types/metrics/median'; -import AggTypesMetricsMinProvider from 'ui/agg_types/metrics/min'; -import AggTypesMetricsMaxProvider from 'ui/agg_types/metrics/max'; -import AggTypesMetricsTopHitProvider from 'ui/agg_types/metrics/top_hit'; -import AggTypesMetricsStdDeviationProvider from 'ui/agg_types/metrics/std_deviation'; -import AggTypesMetricsCardinalityProvider from 'ui/agg_types/metrics/cardinality'; -import AggTypesMetricsPercentilesProvider from 'ui/agg_types/metrics/percentiles'; -import AggTypesMetricsGeoCentroidProvider from 'ui/agg_types/metrics/geo_centroid'; -import AggTypesMetricsPercentileRanksProvider from 'ui/agg_types/metrics/percentile_ranks'; -import AggTypesMetricsDerivativeProvider from 'ui/agg_types/metrics/derivative'; -import AggTypesMetricsCumulativeSumProvider from 'ui/agg_types/metrics/cumulative_sum'; -import AggTypesMetricsMovingAvgProvider from 'ui/agg_types/metrics/moving_avg'; -import AggTypesMetricsSerialDiffProvider from 'ui/agg_types/metrics/serial_diff'; +import { AggTypesMetricsCountProvider } from 'ui/agg_types/metrics/count'; +import { AggTypesMetricsAvgProvider } from 'ui/agg_types/metrics/avg'; +import { AggTypesMetricsSumProvider } from 'ui/agg_types/metrics/sum'; +import { AggTypesMetricsMedianProvider } from 'ui/agg_types/metrics/median'; +import { AggTypesMetricsMinProvider } from 'ui/agg_types/metrics/min'; +import { AggTypesMetricsMaxProvider } from 'ui/agg_types/metrics/max'; +import { AggTypesMetricsTopHitProvider } from 'ui/agg_types/metrics/top_hit'; +import { AggTypesMetricsStdDeviationProvider } from 'ui/agg_types/metrics/std_deviation'; +import { AggTypesMetricsCardinalityProvider } from 'ui/agg_types/metrics/cardinality'; +import { AggTypesMetricsPercentilesProvider } from 'ui/agg_types/metrics/percentiles'; +import { AggTypesMetricsGeoCentroidProvider } from 'ui/agg_types/metrics/geo_centroid'; +import { AggTypesMetricsPercentileRanksProvider } from 'ui/agg_types/metrics/percentile_ranks'; +import { AggTypesMetricsDerivativeProvider } from 'ui/agg_types/metrics/derivative'; +import { AggTypesMetricsCumulativeSumProvider } from 'ui/agg_types/metrics/cumulative_sum'; +import { AggTypesMetricsMovingAvgProvider } from 'ui/agg_types/metrics/moving_avg'; +import { AggTypesMetricsSerialDiffProvider } from 'ui/agg_types/metrics/serial_diff'; import { AggTypesBucketsDateHistogramProvider } from 'ui/agg_types/buckets/date_histogram'; import { AggTypesBucketsHistogramProvider } from 'ui/agg_types/buckets/histogram'; import { AggTypesBucketsRangeProvider } from 'ui/agg_types/buckets/range'; @@ -25,10 +25,10 @@ import { AggTypesBucketsTermsProvider } from 'ui/agg_types/buckets/terms'; import { AggTypesBucketsFiltersProvider } from 'ui/agg_types/buckets/filters'; import { AggTypesBucketsSignificantTermsProvider } from 'ui/agg_types/buckets/significant_terms'; import { AggTypesBucketsGeoHashProvider } from 'ui/agg_types/buckets/geo_hash'; -import AggTypesMetricsBucketSumProvider from 'ui/agg_types/metrics/bucket_sum'; -import AggTypesMetricsBucketAvgProvider from 'ui/agg_types/metrics/bucket_avg'; -import AggTypesMetricsBucketMinProvider from 'ui/agg_types/metrics/bucket_min'; -import AggTypesMetricsBucketMaxProvider from 'ui/agg_types/metrics/bucket_max'; +import { AggTypesMetricsBucketSumProvider } from 'ui/agg_types/metrics/bucket_sum'; +import { AggTypesMetricsBucketAvgProvider } from 'ui/agg_types/metrics/bucket_avg'; +import { AggTypesMetricsBucketMinProvider } from 'ui/agg_types/metrics/bucket_min'; +import { AggTypesMetricsBucketMaxProvider } from 'ui/agg_types/metrics/bucket_max'; export function AggTypesIndexProvider(Private) { diff --git a/src/ui/public/agg_types/metrics/avg.js b/src/ui/public/agg_types/metrics/avg.js index b0e7b8ac12a03..6fe5ea7352199 100644 --- a/src/ui/public/agg_types/metrics/avg.js +++ b/src/ui/public/agg_types/metrics/avg.js @@ -1,6 +1,6 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; -export default function AggTypeMetricAvgProvider(Private) { +export function AggTypesMetricsAvgProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); return new MetricAggType({ diff --git a/src/ui/public/agg_types/metrics/bucket_avg.js b/src/ui/public/agg_types/metrics/bucket_avg.js index dcfc7282248e8..4124e0d1667a3 100644 --- a/src/ui/public/agg_types/metrics/bucket_avg.js +++ b/src/ui/public/agg_types/metrics/bucket_avg.js @@ -1,8 +1,8 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; import { makeNestedLabel } from './lib/make_nested_label'; -import SiblingPipelineAggHelperProvider from './lib/sibling_pipeline_agg_helper'; +import { SiblingPipelineAggHelperProvider } from './lib/sibling_pipeline_agg_helper'; -export default function AggTypesMetricsBucketAvgProvider(Private) { +export function AggTypesMetricsBucketAvgProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const siblingPipelineHelper = Private(SiblingPipelineAggHelperProvider); diff --git a/src/ui/public/agg_types/metrics/bucket_max.js b/src/ui/public/agg_types/metrics/bucket_max.js index 82a6b834de719..0d37be22b2b00 100644 --- a/src/ui/public/agg_types/metrics/bucket_max.js +++ b/src/ui/public/agg_types/metrics/bucket_max.js @@ -1,8 +1,8 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; import { makeNestedLabel } from './lib/make_nested_label'; -import SiblingPipelineAggHelperProvider from './lib/sibling_pipeline_agg_helper'; +import { SiblingPipelineAggHelperProvider } from './lib/sibling_pipeline_agg_helper'; -export default function AggTypesMetricsBucketMaxProvider(Private) { +export function AggTypesMetricsBucketMaxProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const siblingPipelineHelper = Private(SiblingPipelineAggHelperProvider); diff --git a/src/ui/public/agg_types/metrics/bucket_min.js b/src/ui/public/agg_types/metrics/bucket_min.js index 588c308b100a7..3ed3cd6d2e88c 100644 --- a/src/ui/public/agg_types/metrics/bucket_min.js +++ b/src/ui/public/agg_types/metrics/bucket_min.js @@ -1,8 +1,8 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; import { makeNestedLabel } from './lib/make_nested_label'; -import SiblingPipelineAggHelperProvider from './lib/sibling_pipeline_agg_helper'; +import { SiblingPipelineAggHelperProvider } from './lib/sibling_pipeline_agg_helper'; -export default function AggTypesMetricsBucketMinProvider(Private) { +export function AggTypesMetricsBucketMinProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const siblingPipelineHelper = Private(SiblingPipelineAggHelperProvider); diff --git a/src/ui/public/agg_types/metrics/bucket_sum.js b/src/ui/public/agg_types/metrics/bucket_sum.js index a4c3c5f265228..f10dca7fb848a 100644 --- a/src/ui/public/agg_types/metrics/bucket_sum.js +++ b/src/ui/public/agg_types/metrics/bucket_sum.js @@ -1,8 +1,8 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; import { makeNestedLabel } from './lib/make_nested_label'; -import SiblingPipelineAggHelperProvider from './lib/sibling_pipeline_agg_helper'; +import { SiblingPipelineAggHelperProvider } from './lib/sibling_pipeline_agg_helper'; -export default function AggTypesMetricsBucketSumProvider(Private) { +export function AggTypesMetricsBucketSumProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const siblingPipelineHelper = Private(SiblingPipelineAggHelperProvider); diff --git a/src/ui/public/agg_types/metrics/cardinality.js b/src/ui/public/agg_types/metrics/cardinality.js index 9a20c808e21ab..958cd8e9bec86 100644 --- a/src/ui/public/agg_types/metrics/cardinality.js +++ b/src/ui/public/agg_types/metrics/cardinality.js @@ -1,7 +1,7 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; import RegistryFieldFormatsProvider from 'ui/registry/field_formats'; -export default function AggTypeMetricCardinalityProvider(Private) { +export function AggTypesMetricsCardinalityProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const fieldFormats = Private(RegistryFieldFormatsProvider); diff --git a/src/ui/public/agg_types/metrics/count.js b/src/ui/public/agg_types/metrics/count.js index 4956116761157..3fa18387c43d5 100644 --- a/src/ui/public/agg_types/metrics/count.js +++ b/src/ui/public/agg_types/metrics/count.js @@ -1,7 +1,7 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; import RegistryFieldFormatsProvider from 'ui/registry/field_formats'; -export default function AggTypeMetricCountProvider(Private) { +export function AggTypesMetricsCountProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const fieldFormats = Private(RegistryFieldFormatsProvider); diff --git a/src/ui/public/agg_types/metrics/cumulative_sum.js b/src/ui/public/agg_types/metrics/cumulative_sum.js index d9856704acffc..4a4024ce65edc 100644 --- a/src/ui/public/agg_types/metrics/cumulative_sum.js +++ b/src/ui/public/agg_types/metrics/cumulative_sum.js @@ -1,8 +1,8 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; -import ParentPipelineAggHelperProvider from './lib/parent_pipeline_agg_helper'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; +import { ParentPipelineAggHelperProvider } from './lib/parent_pipeline_agg_helper'; import { makeNestedLabel } from './lib/make_nested_label'; -export default function AggTypeMetricComulativeSumProvider(Private) { +export function AggTypesMetricsCumulativeSumProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const parentPipelineAggHelper = Private(ParentPipelineAggHelperProvider); diff --git a/src/ui/public/agg_types/metrics/derivative.js b/src/ui/public/agg_types/metrics/derivative.js index cc17b871a9030..9fbbd82918582 100644 --- a/src/ui/public/agg_types/metrics/derivative.js +++ b/src/ui/public/agg_types/metrics/derivative.js @@ -1,8 +1,8 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; -import ParentPipelineAggHelperProvider from './lib/parent_pipeline_agg_helper'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; +import { ParentPipelineAggHelperProvider } from './lib/parent_pipeline_agg_helper'; import { makeNestedLabel } from './lib/make_nested_label'; -export default function AggTypeMetricDerivativeProvider(Private) { +export function AggTypesMetricsDerivativeProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const parentPipelineAggHelper = Private(ParentPipelineAggHelperProvider); diff --git a/src/ui/public/agg_types/metrics/geo_centroid.js b/src/ui/public/agg_types/metrics/geo_centroid.js index 8a6d5dae38803..6f1262b1254a3 100644 --- a/src/ui/public/agg_types/metrics/geo_centroid.js +++ b/src/ui/public/agg_types/metrics/geo_centroid.js @@ -1,6 +1,6 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; -export default function AggTypeMetricGeoCentroidProvider(Private) { +export function AggTypesMetricsGeoCentroidProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); return new MetricAggType({ diff --git a/src/ui/public/agg_types/metrics/get_response_agg_config_class.js b/src/ui/public/agg_types/metrics/get_response_agg_config_class.js index 8dad245681800..ff1b98475d38c 100644 --- a/src/ui/public/agg_types/metrics/get_response_agg_config_class.js +++ b/src/ui/public/agg_types/metrics/get_response_agg_config_class.js @@ -1,5 +1,6 @@ import _ from 'lodash'; -export default function ResponseAggConfigProvider() { + +export function AggTypesMetricsGetResponseAggConfigClassProvider() { /** * Get the ResponseAggConfig class for an aggConfig, diff --git a/src/ui/public/agg_types/metrics/lib/parent_pipeline_agg_controller.js b/src/ui/public/agg_types/metrics/lib/parent_pipeline_agg_controller.js index 8a2ef041a2902..da8f836abfc34 100644 --- a/src/ui/public/agg_types/metrics/lib/parent_pipeline_agg_controller.js +++ b/src/ui/public/agg_types/metrics/lib/parent_pipeline_agg_controller.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import safeMakeLabel from './safe_make_label'; +import { safeMakeLabel } from './safe_make_label'; const parentPipelineAggController = function ($scope) { diff --git a/src/ui/public/agg_types/metrics/lib/parent_pipeline_agg_helper.js b/src/ui/public/agg_types/metrics/lib/parent_pipeline_agg_helper.js index 6e1b2ce62df4c..02f42a6fff732 100644 --- a/src/ui/public/agg_types/metrics/lib/parent_pipeline_agg_helper.js +++ b/src/ui/public/agg_types/metrics/lib/parent_pipeline_agg_helper.js @@ -5,7 +5,7 @@ import VisSchemasProvider from 'ui/vis/schemas'; import { parentPipelineAggController } from './parent_pipeline_agg_controller'; import { parentPipelineAggWritter } from './parent_pipeline_agg_writter'; -const ParentPipelineAggHelperProvider = function (Private) { +export const ParentPipelineAggHelperProvider = function (Private) { const AggConfig = Private(VisAggConfigProvider); const Schemas = Private(VisSchemasProvider); @@ -59,5 +59,3 @@ const ParentPipelineAggHelperProvider = function (Private) { } }; }; - -export default ParentPipelineAggHelperProvider; diff --git a/src/ui/public/agg_types/metrics/lib/safe_make_label.js b/src/ui/public/agg_types/metrics/lib/safe_make_label.js index 8534de06916a7..b7f346ed5ae93 100644 --- a/src/ui/public/agg_types/metrics/lib/safe_make_label.js +++ b/src/ui/public/agg_types/metrics/lib/safe_make_label.js @@ -1,9 +1,7 @@ -const safeMakeLabel = function (agg) { +export const safeMakeLabel = function (agg) { try { return agg.makeLabel(); } catch (e) { return '- agg not valid -'; } }; - -export default safeMakeLabel; diff --git a/src/ui/public/agg_types/metrics/lib/sibling_pipeline_agg_controller.js b/src/ui/public/agg_types/metrics/lib/sibling_pipeline_agg_controller.js index 2a16b232c3a47..b3160c70ebfb5 100644 --- a/src/ui/public/agg_types/metrics/lib/sibling_pipeline_agg_controller.js +++ b/src/ui/public/agg_types/metrics/lib/sibling_pipeline_agg_controller.js @@ -1,4 +1,4 @@ -import safeMakeLabel from './safe_make_label'; +import { safeMakeLabel } from './safe_make_label'; const siblingPipelineAggController = function (type) { return function ($scope) { diff --git a/src/ui/public/agg_types/metrics/lib/sibling_pipeline_agg_helper.js b/src/ui/public/agg_types/metrics/lib/sibling_pipeline_agg_helper.js index 372d95feae499..f191f9e885842 100644 --- a/src/ui/public/agg_types/metrics/lib/sibling_pipeline_agg_helper.js +++ b/src/ui/public/agg_types/metrics/lib/sibling_pipeline_agg_helper.js @@ -6,7 +6,7 @@ import { siblingPipelineAggController } from './sibling_pipeline_agg_controller' import { siblingPipelineAggWritter } from './sibling_pipeline_agg_writter'; import metricAggTemplate from 'ui/agg_types/controls/sub_metric.html'; -const SiblingPipelineAggHelperProvider = function (Private) { +export const SiblingPipelineAggHelperProvider = function (Private) { const AggConfig = Private(VisAggConfigProvider); const Schemas = Private(VisSchemasProvider); @@ -89,4 +89,3 @@ const SiblingPipelineAggHelperProvider = function (Private) { }; -export default SiblingPipelineAggHelperProvider; diff --git a/src/ui/public/agg_types/metrics/max.js b/src/ui/public/agg_types/metrics/max.js index 3790c8ad92264..56e4658c742e7 100644 --- a/src/ui/public/agg_types/metrics/max.js +++ b/src/ui/public/agg_types/metrics/max.js @@ -1,6 +1,6 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; -export default function AggTypeMetricMaxProvider(Private) { +export function AggTypesMetricsMaxProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); return new MetricAggType({ diff --git a/src/ui/public/agg_types/metrics/median.js b/src/ui/public/agg_types/metrics/median.js index f78ef93a8c814..ac9130435f58d 100644 --- a/src/ui/public/agg_types/metrics/median.js +++ b/src/ui/public/agg_types/metrics/median.js @@ -1,6 +1,7 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; -import AggTypesMetricsPercentilesProvider from 'ui/agg_types/metrics/percentiles'; -export default function AggTypeMetricMedianProvider(Private) { +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsPercentilesProvider } from 'ui/agg_types/metrics/percentiles'; + +export function AggTypesMetricsMedianProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const percentiles = Private(AggTypesMetricsPercentilesProvider); diff --git a/src/ui/public/agg_types/metrics/metric_agg_type.js b/src/ui/public/agg_types/metrics/metric_agg_type.js index 53ec7b1398592..d2fb003f4d6a7 100644 --- a/src/ui/public/agg_types/metrics/metric_agg_type.js +++ b/src/ui/public/agg_types/metrics/metric_agg_type.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import { AggTypesAggTypeProvider } from 'ui/agg_types/agg_type'; import RegistryFieldFormatsProvider from 'ui/registry/field_formats'; -export default function MetricAggTypeProvider(Private) { +export function AggTypesMetricsMetricAggTypeProvider(Private) { const AggType = Private(AggTypesAggTypeProvider); const fieldFormats = Private(RegistryFieldFormatsProvider); diff --git a/src/ui/public/agg_types/metrics/min.js b/src/ui/public/agg_types/metrics/min.js index 42e54c37eeca2..fedc7fb2e8fa9 100644 --- a/src/ui/public/agg_types/metrics/min.js +++ b/src/ui/public/agg_types/metrics/min.js @@ -1,6 +1,6 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; -export default function AggTypeMetricMinProvider(Private) { +export function AggTypesMetricsMinProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); return new MetricAggType({ diff --git a/src/ui/public/agg_types/metrics/moving_avg.js b/src/ui/public/agg_types/metrics/moving_avg.js index a9ea5e6d8e020..32bb389d5f809 100644 --- a/src/ui/public/agg_types/metrics/moving_avg.js +++ b/src/ui/public/agg_types/metrics/moving_avg.js @@ -1,8 +1,8 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; -import ParentPipelineAggHelperProvider from './lib/parent_pipeline_agg_helper'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; +import { ParentPipelineAggHelperProvider } from './lib/parent_pipeline_agg_helper'; import { makeNestedLabel } from './lib/make_nested_label'; -export default function AggTypeMetricMovingAvgProvider(Private) { +export function AggTypesMetricsMovingAvgProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const parentPipelineAggHelper = Private(ParentPipelineAggHelperProvider); diff --git a/src/ui/public/agg_types/metrics/percentile_ranks.js b/src/ui/public/agg_types/metrics/percentile_ranks.js index 9fb15e8580664..72a73d0e9f699 100644 --- a/src/ui/public/agg_types/metrics/percentile_ranks.js +++ b/src/ui/public/agg_types/metrics/percentile_ranks.js @@ -1,11 +1,11 @@ import valuesEditor from 'ui/agg_types/controls/percentile_ranks.html'; import 'ui/number_list'; -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; -import AggTypesMetricsGetResponseAggConfigClassProvider from 'ui/agg_types/metrics/get_response_agg_config_class'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsGetResponseAggConfigClassProvider } from 'ui/agg_types/metrics/get_response_agg_config_class'; import RegistryFieldFormatsProvider from 'ui/registry/field_formats'; -import getPercentileValue from './percentiles_get_value'; +import { getPercentileValue } from './percentiles_get_value'; -export default function AggTypeMetricPercentileRanksProvider(Private) { +export function AggTypesMetricsPercentileRanksProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const getResponseAggConfigClass = Private(AggTypesMetricsGetResponseAggConfigClassProvider); const fieldFormats = Private(RegistryFieldFormatsProvider); diff --git a/src/ui/public/agg_types/metrics/percentiles.js b/src/ui/public/agg_types/metrics/percentiles.js index 980d44e5a763c..6bedaedb4f2a3 100644 --- a/src/ui/public/agg_types/metrics/percentiles.js +++ b/src/ui/public/agg_types/metrics/percentiles.js @@ -1,11 +1,11 @@ import ordinalSuffix from 'ui/utils/ordinal_suffix'; import percentsEditor from 'ui/agg_types/controls/percentiles.html'; import 'ui/number_list'; -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; -import AggTypesMetricsGetResponseAggConfigClassProvider from 'ui/agg_types/metrics/get_response_agg_config_class'; -import getPercentileValue from './percentiles_get_value'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsGetResponseAggConfigClassProvider } from 'ui/agg_types/metrics/get_response_agg_config_class'; +import { getPercentileValue } from './percentiles_get_value'; -export default function AggTypeMetricPercentilesProvider(Private) { +export function AggTypesMetricsPercentilesProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const getResponseAggConfigClass = Private(AggTypesMetricsGetResponseAggConfigClassProvider); diff --git a/src/ui/public/agg_types/metrics/percentiles_get_value.js b/src/ui/public/agg_types/metrics/percentiles_get_value.js index 900f5bfd0d64a..bcf086bf81a68 100644 --- a/src/ui/public/agg_types/metrics/percentiles_get_value.js +++ b/src/ui/public/agg_types/metrics/percentiles_get_value.js @@ -1,6 +1,6 @@ import { find } from 'lodash'; -export default function getPercentileValue(agg, bucket) { +export function getPercentileValue(agg, bucket) { const values = bucket[agg.parentId] && bucket[agg.parentId].values; const percentile = find(values, value => agg.key === value.key); return percentile ? percentile.value : NaN; diff --git a/src/ui/public/agg_types/metrics/serial_diff.js b/src/ui/public/agg_types/metrics/serial_diff.js index c67363b6e5807..36caa7c281f99 100644 --- a/src/ui/public/agg_types/metrics/serial_diff.js +++ b/src/ui/public/agg_types/metrics/serial_diff.js @@ -1,8 +1,8 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; -import ParentPipelineAggHelperProvider from './lib/parent_pipeline_agg_helper'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; +import { ParentPipelineAggHelperProvider } from './lib/parent_pipeline_agg_helper'; import { makeNestedLabel } from './lib/make_nested_label'; -export default function AggTypeMetricSerialDiffProvider(Private) { +export function AggTypesMetricsSerialDiffProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const parentPipelineAggHelper = Private(ParentPipelineAggHelperProvider); diff --git a/src/ui/public/agg_types/metrics/std_deviation.js b/src/ui/public/agg_types/metrics/std_deviation.js index da1236fce508e..57c94c59e3dce 100644 --- a/src/ui/public/agg_types/metrics/std_deviation.js +++ b/src/ui/public/agg_types/metrics/std_deviation.js @@ -1,7 +1,8 @@ import _ from 'lodash'; -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; -import AggTypesMetricsGetResponseAggConfigClassProvider from 'ui/agg_types/metrics/get_response_agg_config_class'; -export default function AggTypeMetricStandardDeviationProvider(Private) { +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsGetResponseAggConfigClassProvider } from 'ui/agg_types/metrics/get_response_agg_config_class'; + +export function AggTypesMetricsStdDeviationProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const getResponseAggConfigClass = Private(AggTypesMetricsGetResponseAggConfigClassProvider); diff --git a/src/ui/public/agg_types/metrics/sum.js b/src/ui/public/agg_types/metrics/sum.js index 901fee3e28d2b..c80b9b80bcd38 100644 --- a/src/ui/public/agg_types/metrics/sum.js +++ b/src/ui/public/agg_types/metrics/sum.js @@ -1,6 +1,6 @@ -import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; -export default function AggTypeMetricSumProvider(Private) { +export function AggTypesMetricsSumProvider(Private) { const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); return new MetricAggType({ diff --git a/src/ui/public/agg_types/metrics/top_hit.js b/src/ui/public/agg_types/metrics/top_hit.js index 3575f955cb6c5..7b96db86ab6bf 100644 --- a/src/ui/public/agg_types/metrics/top_hit.js +++ b/src/ui/public/agg_types/metrics/top_hit.js @@ -1,10 +1,10 @@ import _ from 'lodash'; -import MetricAggTypeProvider from 'ui/agg_types/metrics/metric_agg_type'; +import { AggTypesMetricsMetricAggTypeProvider } from 'ui/agg_types/metrics/metric_agg_type'; import topSortEditor from 'ui/agg_types/controls/top_sort.html'; import aggregateAndSizeEditor from 'ui/agg_types/controls/top_aggregate_and_size.html'; -export default function AggTypeMetricTopProvider(Private) { - const MetricAggType = Private(MetricAggTypeProvider); +export function AggTypesMetricsTopHitProvider(Private) { + const MetricAggType = Private(AggTypesMetricsMetricAggTypeProvider); const isNumber = function (type) { return type === 'number'; diff --git a/src/ui/public/agg_types/param_types/base.js b/src/ui/public/agg_types/param_types/base.js index 1b2d1f71128a4..157e87f10c545 100644 --- a/src/ui/public/agg_types/param_types/base.js +++ b/src/ui/public/agg_types/param_types/base.js @@ -1,5 +1,6 @@ import _ from 'lodash'; -export default function BaseAggParamFactory() { + +export function AggTypesParamTypesBaseProvider() { function BaseAggParam(config) { _.assign(this, config); diff --git a/src/ui/public/agg_types/param_types/field.js b/src/ui/public/agg_types/param_types/field.js index 798b857a7ceee..66e05455f9890 100644 --- a/src/ui/public/agg_types/param_types/field.js +++ b/src/ui/public/agg_types/param_types/field.js @@ -1,12 +1,12 @@ import { SavedObjectNotFound } from 'ui/errors'; import _ from 'lodash'; import editorHtml from 'ui/agg_types/controls/field.html'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; import 'ui/filters/field_type'; -import IndexedArray from 'ui/indexed_array'; +import { IndexedArray } from 'ui/indexed_array'; import Notifier from 'ui/notify/notifier'; -export default function FieldAggParamFactory(Private, $filter) { +export function AggTypesParamTypesFieldProvider(Private, $filter) { const BaseAggParam = Private(AggTypesParamTypesBaseProvider); const notifier = new Notifier(); diff --git a/src/ui/public/agg_types/param_types/optioned.js b/src/ui/public/agg_types/param_types/optioned.js index 03ea1532cb2a8..bc5236645cf03 100644 --- a/src/ui/public/agg_types/param_types/optioned.js +++ b/src/ui/public/agg_types/param_types/optioned.js @@ -1,7 +1,8 @@ import _ from 'lodash'; -import IndexedArray from 'ui/indexed_array'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; -export default function OptionedAggParamFactory(Private) { +import { IndexedArray } from 'ui/indexed_array'; +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; + +export function AggTypesParamTypesOptionedProvider(Private) { const BaseAggParam = Private(AggTypesParamTypesBaseProvider); diff --git a/src/ui/public/agg_types/param_types/raw_json.js b/src/ui/public/agg_types/param_types/raw_json.js index b32f48443a6db..64a87429e53c0 100644 --- a/src/ui/public/agg_types/param_types/raw_json.js +++ b/src/ui/public/agg_types/param_types/raw_json.js @@ -1,7 +1,8 @@ import _ from 'lodash'; import editorHtml from 'ui/agg_types/controls/raw_json.html'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; -export default function RawJSONAggParamFactory(Private) { +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; + +export function AggTypesParamTypesRawJsonProvider(Private) { const BaseAggParam = Private(AggTypesParamTypesBaseProvider); diff --git a/src/ui/public/agg_types/param_types/regex.js b/src/ui/public/agg_types/param_types/regex.js index 5628cf719146d..cc5b17a6039c0 100644 --- a/src/ui/public/agg_types/param_types/regex.js +++ b/src/ui/public/agg_types/param_types/regex.js @@ -1,7 +1,8 @@ import _ from 'lodash'; import editorHtml from 'ui/agg_types/controls/regular_expression.html'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; -export default function RegexAggParamFactory(Private) { +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; + +export function AggTypesParamTypesRegexProvider(Private) { const BaseAggParam = Private(AggTypesParamTypesBaseProvider); diff --git a/src/ui/public/agg_types/param_types/string.js b/src/ui/public/agg_types/param_types/string.js index 151e8218ab757..7d82114701692 100644 --- a/src/ui/public/agg_types/param_types/string.js +++ b/src/ui/public/agg_types/param_types/string.js @@ -1,7 +1,8 @@ import _ from 'lodash'; import editorHtml from 'ui/agg_types/controls/string.html'; -import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base'; -export default function FieldAggParamFactory(Private) { +import { AggTypesParamTypesBaseProvider } from 'ui/agg_types/param_types/base'; + +export function AggTypesParamTypesStringProvider(Private) { const BaseAggParam = Private(AggTypesParamTypesBaseProvider); diff --git a/src/ui/public/binder/__tests__/binder.js b/src/ui/public/binder/__tests__/binder.js index 2a42501935d87..6b2353a28aa86 100644 --- a/src/ui/public/binder/__tests__/binder.js +++ b/src/ui/public/binder/__tests__/binder.js @@ -2,7 +2,7 @@ import sinon from 'auto-release-sinon'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import Binder from 'ui/binder'; +import { Binder } from 'ui/binder'; import $ from 'jquery'; describe('Binder class', function () { diff --git a/src/ui/public/binder/binder.js b/src/ui/public/binder/binder.js index 90f27515959f7..fe9930388b344 100644 --- a/src/ui/public/binder/binder.js +++ b/src/ui/public/binder/binder.js @@ -1,9 +1,9 @@ import d3 from 'd3'; import $ from 'jquery'; -import Binder from '../../../utils/binder'; +import { BinderBase } from '../../../utils/binder'; -export default class UiBinder extends Binder { +export class Binder extends BinderBase { constructor($scope) { super(); diff --git a/src/ui/public/chrome/api/__tests__/angular.js b/src/ui/public/chrome/api/__tests__/angular.js index 0bf46a7ced0f3..c9ad957135fbc 100644 --- a/src/ui/public/chrome/api/__tests__/angular.js +++ b/src/ui/public/chrome/api/__tests__/angular.js @@ -1,4 +1,4 @@ -import kbnAngular from '../angular'; +import { initAngularApi } from '../angular'; import { noop } from 'lodash'; describe('Chrome API :: Angular', () => { @@ -8,7 +8,7 @@ describe('Chrome API :: Angular', () => { getInjected: noop, addBasePath: noop }; - kbnAngular(chrome, { + initAngularApi(chrome, { devMode: true }); }); diff --git a/src/ui/public/chrome/api/__tests__/nav.js b/src/ui/public/chrome/api/__tests__/nav.js index e6a7a0a1e5a77..30d85e1e569d9 100644 --- a/src/ui/public/chrome/api/__tests__/nav.js +++ b/src/ui/public/chrome/api/__tests__/nav.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; -import initChromeNavApi from 'ui/chrome/api/nav'; +import { initChromeNavApi } from 'ui/chrome/api/nav'; import StubBrowserStorage from 'test_utils/stub_browser_storage'; const basePath = '/someBasePath'; diff --git a/src/ui/public/chrome/api/__tests__/xsrf.js b/src/ui/public/chrome/api/__tests__/xsrf.js index ce00bd6225687..569ef596c4799 100644 --- a/src/ui/public/chrome/api/__tests__/xsrf.js +++ b/src/ui/public/chrome/api/__tests__/xsrf.js @@ -3,7 +3,7 @@ import expect from 'expect.js'; import { stub } from 'auto-release-sinon'; import ngMock from 'ng_mock'; -import xsrfChromeApi from '../xsrf'; +import { initChromeXsrfApi } from '../xsrf'; import { version } from '../../../../../../package.json'; const xsrfHeader = 'kbn-version'; @@ -12,7 +12,7 @@ describe('chrome xsrf apis', function () { describe('#getXsrfToken()', function () { it('exposes the token', function () { const chrome = {}; - xsrfChromeApi(chrome, { version }); + initChromeXsrfApi(chrome, { version }); expect(chrome.getXsrfToken()).to.be(version); }); }); @@ -20,7 +20,7 @@ describe('chrome xsrf apis', function () { describe('jQuery support', function () { it('adds a global jQuery prefilter', function () { stub($, 'ajaxPrefilter'); - xsrfChromeApi({}, { version }); + initChromeXsrfApi({}, { version }); expect($.ajaxPrefilter.callCount).to.be(1); }); @@ -29,7 +29,7 @@ describe('chrome xsrf apis', function () { beforeEach(function () { stub($, 'ajaxPrefilter'); - xsrfChromeApi({}, { version }); + initChromeXsrfApi({}, { version }); prefilter = $.ajaxPrefilter.args[0][0]; }); @@ -59,7 +59,7 @@ describe('chrome xsrf apis', function () { beforeEach(function () { stub($, 'ajaxPrefilter'); const chrome = {}; - xsrfChromeApi(chrome, { version }); + initChromeXsrfApi(chrome, { version }); ngMock.module(chrome.$setupXsrfRequestInterceptor); }); diff --git a/src/ui/public/chrome/api/angular.js b/src/ui/public/chrome/api/angular.js index 4bbb7e54286cd..22c553789e814 100644 --- a/src/ui/public/chrome/api/angular.js +++ b/src/ui/public/chrome/api/angular.js @@ -5,11 +5,11 @@ import modules from 'ui/modules'; import Notifier from 'ui/notify/notifier'; import { UrlOverflowServiceProvider } from '../../error_url_overflow'; -import directivesProvider from '../directives'; +import { directivesProvider } from '../directives'; const URL_LIMIT_WARN_WITHIN = 1000; -export default function (chrome, internals) { +export function initAngularApi(chrome, internals) { chrome.getFirstPathSegment = _.noop; chrome.getBreadcrumbs = _.noop; diff --git a/src/ui/public/chrome/api/nav.js b/src/ui/public/chrome/api/nav.js index 314c1a7656016..30da5a5c3b73d 100644 --- a/src/ui/public/chrome/api/nav.js +++ b/src/ui/public/chrome/api/nav.js @@ -1,7 +1,7 @@ import { parse, format } from 'url'; import { isString } from 'lodash'; -export default function (chrome, internals) { +export function initChromeNavApi(chrome, internals) { chrome.getNavLinks = function () { return internals.nav; }; diff --git a/src/ui/public/chrome/api/xsrf.js b/src/ui/public/chrome/api/xsrf.js index 4d04f9954231d..db55043dd4dde 100644 --- a/src/ui/public/chrome/api/xsrf.js +++ b/src/ui/public/chrome/api/xsrf.js @@ -1,7 +1,7 @@ import $ from 'jquery'; import { set } from 'lodash'; -export default function (chrome, internals) { +export function initChromeXsrfApi(chrome, internals) { chrome.getXsrfToken = function () { return internals.version; diff --git a/src/ui/public/chrome/chrome.js b/src/ui/public/chrome/chrome.js index 2543a66f5459b..4ccd21702103b 100644 --- a/src/ui/public/chrome/chrome.js +++ b/src/ui/public/chrome/chrome.js @@ -12,14 +12,14 @@ import 'ui/directives/kbn_src'; import 'ui/watch_multi'; import './services'; -import angularApi from './api/angular'; +import { initAngularApi } from './api/angular'; import appsApi from './api/apps'; import controlsApi from './api/controls'; -import navApi from './api/nav'; +import { initChromeNavApi } from './api/nav'; import templateApi from './api/template'; import themeApi from './api/theme'; import translationsApi from './api/translations'; -import xsrfApi from './api/xsrf'; +import { initChromeXsrfApi } from './api/xsrf'; const chrome = {}; const internals = _.defaults( @@ -38,9 +38,9 @@ const internals = _.defaults( ); appsApi(chrome, internals); -xsrfApi(chrome, internals); -navApi(chrome, internals); -angularApi(chrome, internals); +initChromeXsrfApi(chrome, internals); +initChromeNavApi(chrome, internals); +initAngularApi(chrome, internals); controlsApi(chrome, internals); templateApi(chrome, internals); themeApi(chrome, internals); diff --git a/src/ui/public/chrome/directives/append_nav_controls.js b/src/ui/public/chrome/directives/append_nav_controls.js index 92414364a16f6..4d437caa72816 100644 --- a/src/ui/public/chrome/directives/append_nav_controls.js +++ b/src/ui/public/chrome/directives/append_nav_controls.js @@ -1,7 +1,7 @@ import chromeNavControlsRegistry from 'ui/registry/chrome_nav_controls'; import UiModules from 'ui/modules'; -export default function () { +export function kbnAppendChromeNavControls() { UiModules .get('kibana') diff --git a/src/ui/public/chrome/directives/index.js b/src/ui/public/chrome/directives/index.js index 64ae0230f9546..d4c4cd1956c59 100644 --- a/src/ui/public/chrome/directives/index.js +++ b/src/ui/public/chrome/directives/index.js @@ -1,11 +1,11 @@ import './global_nav'; -import kbnChromeProv from './kbn_chrome'; -import kbnChromeNavControlsProv from './append_nav_controls'; +import { kbnChromeProvider } from './kbn_chrome'; +import { kbnAppendChromeNavControls } from './append_nav_controls'; import './loading_indicator/loading_indicator'; -export default function (chrome, internals) { - kbnChromeProv(chrome, internals); - kbnChromeNavControlsProv(chrome, internals); +export function directivesProvider(chrome, internals) { + kbnChromeProvider(chrome, internals); + kbnAppendChromeNavControls(chrome, internals); } diff --git a/src/ui/public/chrome/directives/kbn_chrome.js b/src/ui/public/chrome/directives/kbn_chrome.js index 93bd9dc95c38d..e267df8068536 100644 --- a/src/ui/public/chrome/directives/kbn_chrome.js +++ b/src/ui/public/chrome/directives/kbn_chrome.js @@ -10,7 +10,7 @@ import { } from 'ui/state_management/state_hashing'; import Notifier from 'ui/notify'; -export default function (chrome, internals) { +export function kbnChromeProvider(chrome, internals) { UiModules .get('kibana') diff --git a/src/ui/public/config/_delayed_updater.js b/src/ui/public/config/_delayed_updater.js index bba170fa1804d..00784c805ec8a 100644 --- a/src/ui/public/config/_delayed_updater.js +++ b/src/ui/public/config/_delayed_updater.js @@ -1,4 +1,4 @@ -export default function DelayedUpdaterFactory($http, chrome, Promise) { +export function ConfigDelayedUpdaterProvider($http, chrome, Promise) { let unsavedChanges = {}; let unresolvedPromises = []; let saveTimeout = null; diff --git a/src/ui/public/config/config.js b/src/ui/public/config/config.js index aaa9dfc626fd3..a254796f4d91b 100644 --- a/src/ui/public/config/config.js +++ b/src/ui/public/config/config.js @@ -2,7 +2,7 @@ import angular from 'angular'; import { cloneDeep, defaultsDeep, isPlainObject } from 'lodash'; import uiModules from 'ui/modules'; import Notifier from 'ui/notify/notifier'; -import ConfigDelayedUpdaterProvider from 'ui/config/_delayed_updater'; +import { ConfigDelayedUpdaterProvider } from 'ui/config/_delayed_updater'; const module = uiModules.get('kibana/config'); // service for delivering config variables to everywhere else diff --git a/src/ui/public/courier/__tests__/saved_object.js b/src/ui/public/courier/__tests__/saved_object.js index c9c36ab545a12..eeffbe519101b 100644 --- a/src/ui/public/courier/__tests__/saved_object.js +++ b/src/ui/public/courier/__tests__/saved_object.js @@ -4,9 +4,8 @@ import sinon from 'auto-release-sinon'; import BluebirdPromise from 'bluebird'; import { SavedObjectProvider } from '../saved_object/saved_object'; -import IndexPatternFactory from 'ui/index_patterns/_index_pattern'; +import { IndexPatternProvider } from 'ui/index_patterns/_index_pattern'; import { AdminDocSourceProvider } from '../data_source/admin_doc_source'; - import { stubMapper } from 'test_utils/stub_mapper'; @@ -98,7 +97,7 @@ describe('Saved Object', function () { beforeEach(ngMock.inject(function (es, esAdmin, Private, $window) { SavedObject = Private(SavedObjectProvider); - IndexPattern = Private(IndexPatternFactory); + IndexPattern = Private(IndexPatternProvider); esAdminStub = esAdmin; esDataStub = es; DocSource = Private(AdminDocSourceProvider); diff --git a/src/ui/public/courier/data_source/_abstract.js b/src/ui/public/courier/data_source/_abstract.js index 67d5c6a1d44ba..65c2c347877d8 100644 --- a/src/ui/public/courier/data_source/_abstract.js +++ b/src/ui/public/courier/data_source/_abstract.js @@ -7,7 +7,7 @@ import { RequestQueueProvider } from '../_request_queue'; import { ErrorHandlersProvider } from '../_error_handlers'; import { FetchProvider } from '../fetch'; import { DecorateQueryProvider } from './_decorate_query'; -import FieldWildcardProvider from '../../field_wildcard'; +import { FieldWildcardProvider } from '../../field_wildcard'; import { getHighlightRequestProvider } from '../../highlight'; export function AbstractDataSourceProvider(Private, Promise, PromiseEmitter) { diff --git a/src/ui/public/directives/rows.js b/src/ui/public/directives/rows.js index 83ecdf42d3fab..933e95e011698 100644 --- a/src/ui/public/directives/rows.js +++ b/src/ui/public/directives/rows.js @@ -1,13 +1,13 @@ import $ from 'jquery'; import _ from 'lodash'; import AggConfigResult from 'ui/vis/agg_config_result'; -import FilterBarFilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler'; +import { FilterBarClickHandlerProvider } from 'ui/filter_bar/filter_bar_click_handler'; import uiModules from 'ui/modules'; import tableCellFilterHtml from './partials/table_cell_filter.html'; const module = uiModules.get('kibana'); module.directive('kbnRows', function ($compile, $rootScope, getAppState, Private) { - const filterBarClickHandler = Private(FilterBarFilterBarClickHandlerProvider); + const filterBarClickHandler = Private(FilterBarClickHandlerProvider); return { restrict: 'A', link: function ($scope, $el, attr) { diff --git a/src/ui/public/doc_table/__tests__/lib/get_sort.js b/src/ui/public/doc_table/__tests__/lib/get_sort.js index 3b64391496277..b3a0c1d5f5d57 100644 --- a/src/ui/public/doc_table/__tests__/lib/get_sort.js +++ b/src/ui/public/doc_table/__tests__/lib/get_sort.js @@ -1,8 +1,10 @@ -import getSort from 'ui/doc_table/lib/get_sort'; -const defaultSort = { time: 'desc' }; import expect from 'expect.js'; import ngMock from 'ng_mock'; + +import { getSort } from 'ui/doc_table/lib/get_sort'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; + +const defaultSort = { time: 'desc' }; let indexPattern; describe('docTable', function () { diff --git a/src/ui/public/doc_table/doc_table.js b/src/ui/public/doc_table/doc_table.js index 53d5e3f3012e5..3475f7a9bb58b 100644 --- a/src/ui/public/doc_table/doc_table.js +++ b/src/ui/public/doc_table/doc_table.js @@ -1,6 +1,6 @@ import _ from 'lodash'; import html from 'ui/doc_table/doc_table.html'; -import getSort from 'ui/doc_table/lib/get_sort'; +import { getSort } from 'ui/doc_table/lib/get_sort'; import 'ui/doc_table/doc_table.less'; import 'ui/directives/truncated'; import 'ui/directives/infinite_scroll'; diff --git a/src/ui/public/doc_table/lib/get_sort.js b/src/ui/public/doc_table/lib/get_sort.js index c0124132083c7..9d881abeba195 100644 --- a/src/ui/public/doc_table/lib/get_sort.js +++ b/src/ui/public/doc_table/lib/get_sort.js @@ -6,7 +6,7 @@ import _ from 'lodash'; * @param {object} indexPattern used for determining default sort * @returns {object} a sort object suitable for returning to elasticsearch */ -function getSort(sort, indexPattern) { +export function getSort(sort, indexPattern) { const sortObj = {}; let field; let direction; @@ -39,4 +39,3 @@ getSort.array = function (sort, indexPattern) { return _(getSort(sort, indexPattern)).pairs().pop(); }; -export default getSort; diff --git a/src/ui/public/doc_title/__tests__/doc_title.js b/src/ui/public/doc_title/__tests__/doc_title.js index 104b3032dcadf..eb7e87756ca20 100644 --- a/src/ui/public/doc_title/__tests__/doc_title.js +++ b/src/ui/public/doc_title/__tests__/doc_title.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import sinon from 'auto-release-sinon'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import DocTitleProvider from 'ui/doc_title'; +import { DocTitleProvider } from 'ui/doc_title'; describe('docTitle Service', function () { let initialDocTitle; diff --git a/src/ui/public/doc_title/doc_title.js b/src/ui/public/doc_title/doc_title.js index d03b523dc141d..d82788a8875f5 100644 --- a/src/ui/public/doc_title/doc_title.js +++ b/src/ui/public/doc_title/doc_title.js @@ -39,6 +39,9 @@ uiModules.get('kibana') }); // return a "private module" so that it can be used both ways -export default function DoctitleProvider(docTitle) { +export function DocTitleProvider(docTitle) { return docTitle; } + +// Default export used in x-pack. TODO: cleanup. +export default DocTitleProvider; diff --git a/src/ui/public/documentation_links/__tests__/documentation_links.js b/src/ui/public/documentation_links/__tests__/documentation_links.js index 00970f55b4e68..666be8c746c9d 100644 --- a/src/ui/public/documentation_links/__tests__/documentation_links.js +++ b/src/ui/public/documentation_links/__tests__/documentation_links.js @@ -1,5 +1,5 @@ import expect from 'expect.js'; -import docLinks from '../documentation_links'; +import { documentationLinks } from '../documentation_links'; import semver from 'semver'; import { metadata } from '../../metadata'; @@ -10,7 +10,7 @@ const urlVersion = `${major}.${minor}`; describe('documentation link service', function () { it('should inject Kibana\'s major.minjor version into doc links', function () { - expect(docLinks.filebeat.configuration).to.contain(urlVersion); + expect(documentationLinks.filebeat.configuration).to.contain(urlVersion); }); }); diff --git a/src/ui/public/documentation_links/documentation_links.js b/src/ui/public/documentation_links/documentation_links.js index 4b0c5ebf33642..c27d4167bd5ad 100644 --- a/src/ui/public/documentation_links/documentation_links.js +++ b/src/ui/public/documentation_links/documentation_links.js @@ -6,7 +6,7 @@ const minor = semver.minor(metadata.version); const urlVersion = `${major}.${minor}`; const baseUrl = 'https://www.elastic.co/'; -export default { +export const documentationLinks = { filebeat: { installation: `${baseUrl}guide/en/beats/filebeat/${urlVersion}/filebeat-installation.html`, configuration: `${baseUrl}guide/en/beats/filebeat/${urlVersion}/filebeat-configuration.html`, diff --git a/src/ui/public/elasticsearch_errors/__tests__/elasticsearch_error.js b/src/ui/public/elasticsearch_errors/__tests__/elasticsearch_error.js index d511b67e0347f..e372c8dc3dc96 100644 --- a/src/ui/public/elasticsearch_errors/__tests__/elasticsearch_error.js +++ b/src/ui/public/elasticsearch_errors/__tests__/elasticsearch_error.js @@ -1,5 +1,5 @@ import expect from 'expect.js'; -import ElasticsearchError from '../elasticsearch_error'; +import { ElasticsearchError } from '../elasticsearch_error'; describe('ElasticsearchError', () => { function createError(rootCauses = []) { diff --git a/src/ui/public/elasticsearch_errors/__tests__/is_term_size_zero_error.js b/src/ui/public/elasticsearch_errors/__tests__/is_term_size_zero_error.js index c0a22f667c23d..c849c7a59d08a 100644 --- a/src/ui/public/elasticsearch_errors/__tests__/is_term_size_zero_error.js +++ b/src/ui/public/elasticsearch_errors/__tests__/is_term_size_zero_error.js @@ -1,5 +1,5 @@ import expect from 'expect.js'; -import isTermSizeZeroError from '../is_term_size_zero_error'; +import { isTermSizeZeroError } from '../is_term_size_zero_error'; describe('isTermSizeZeroError', () => { const identifyingString = 'size must be positive, got 0'; diff --git a/src/ui/public/elasticsearch_errors/elasticsearch_error.js b/src/ui/public/elasticsearch_errors/elasticsearch_error.js index d860104912623..a20e4e267ff7b 100644 --- a/src/ui/public/elasticsearch_errors/elasticsearch_error.js +++ b/src/ui/public/elasticsearch_errors/elasticsearch_error.js @@ -1,6 +1,6 @@ import _ from 'lodash'; -export default class ElasticsearchError { +export class ElasticsearchError { constructor(error) { this.error = error; diff --git a/src/ui/public/elasticsearch_errors/index.js b/src/ui/public/elasticsearch_errors/index.js index bb608cb12ed6e..b5fe4727d77ff 100644 --- a/src/ui/public/elasticsearch_errors/index.js +++ b/src/ui/public/elasticsearch_errors/index.js @@ -1,7 +1,2 @@ -export { - default as ElasticsearchError, -} from './elasticsearch_error'; - -export { - default as isTermSizeZeroError, -} from './is_term_size_zero_error'; +export { ElasticsearchError } from './elasticsearch_error'; +export { isTermSizeZeroError } from './is_term_size_zero_error'; diff --git a/src/ui/public/elasticsearch_errors/is_term_size_zero_error.js b/src/ui/public/elasticsearch_errors/is_term_size_zero_error.js index ea2049a68fbb1..a5afc5f6f583d 100644 --- a/src/ui/public/elasticsearch_errors/is_term_size_zero_error.js +++ b/src/ui/public/elasticsearch_errors/is_term_size_zero_error.js @@ -1,5 +1,5 @@ -import { hasRootCause } from './elasticsearch_error'; +import { ElasticsearchError } from './elasticsearch_error'; -export default function isTermSizeZeroError(error) { - return hasRootCause(error, 'size must be positive, got 0'); +export function isTermSizeZeroError(error) { + return ElasticsearchError.hasRootCause(error, 'size must be positive, got 0'); } diff --git a/src/ui/public/fancy_forms/fancy_forms.js b/src/ui/public/fancy_forms/fancy_forms.js index c89fe5ac97719..72c598fabbb7a 100644 --- a/src/ui/public/fancy_forms/fancy_forms.js +++ b/src/ui/public/fancy_forms/fancy_forms.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import KbnFormController from 'ui/fancy_forms/kbn_form_controller'; +import { KbnFormController } from 'ui/fancy_forms/kbn_form_controller'; import uiModules from 'ui/modules'; diff --git a/src/ui/public/fancy_forms/kbn_form_controller.js b/src/ui/public/fancy_forms/kbn_form_controller.js index 3d0c08bae111c..6c06f5766a3e8 100644 --- a/src/ui/public/fancy_forms/kbn_form_controller.js +++ b/src/ui/public/fancy_forms/kbn_form_controller.js @@ -6,7 +6,7 @@ import _ from 'lodash'; * * @param {$scope} $scope */ -function KbnFormController($scope, $element) { +export function KbnFormController($scope, $element) { const self = this; self.errorCount = function () { @@ -72,5 +72,3 @@ function KbnFormController($scope, $element) { $element.off('submit', filterSubmits); }); } - -export default KbnFormController; diff --git a/src/ui/public/field_editor/__tests__/field_editor.js b/src/ui/public/field_editor/__tests__/field_editor.js index 328245e4564ac..1184c768d6831 100644 --- a/src/ui/public/field_editor/__tests__/field_editor.js +++ b/src/ui/public/field_editor/__tests__/field_editor.js @@ -1,7 +1,7 @@ import $ from 'jquery'; import ngMock from 'ng_mock'; import expect from 'expect.js'; -import IndexPatternsFieldProvider from 'ui/index_patterns/_field'; +import { IndexPatternsFieldProvider } from 'ui/index_patterns/_field'; import RegistryFieldFormatsProvider from 'ui/registry/field_formats'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; import _ from 'lodash'; diff --git a/src/ui/public/field_editor/field_editor.js b/src/ui/public/field_editor/field_editor.js index 24c55e93d363e..4dc5a98697173 100644 --- a/src/ui/public/field_editor/field_editor.js +++ b/src/ui/public/field_editor/field_editor.js @@ -3,10 +3,10 @@ import 'angular-bootstrap-colorpicker'; import 'angular-bootstrap-colorpicker/css/colorpicker.css'; import _ from 'lodash'; import RegistryFieldFormatsProvider from 'ui/registry/field_formats'; -import IndexPatternsFieldProvider from 'ui/index_patterns/_field'; +import { IndexPatternsFieldProvider } from 'ui/index_patterns/_field'; import uiModules from 'ui/modules'; import fieldEditorTemplate from 'ui/field_editor/field_editor.html'; -import IndexPatternsCastMappingTypeProvider from 'ui/index_patterns/_cast_mapping_type'; +import { IndexPatternsCastMappingTypeProvider } from 'ui/index_patterns/_cast_mapping_type'; import { scriptedFields as docLinks } from '../documentation_links/documentation_links'; import './field_editor.less'; import { GetEnabledScriptingLanguagesProvider, getSupportedScriptingLanguages } from '../scripting_languages'; diff --git a/src/ui/public/field_wildcard/__tests__/field_wildcard.js b/src/ui/public/field_wildcard/__tests__/field_wildcard.js index 9a3af53077d93..b290df4a4d5b7 100644 --- a/src/ui/public/field_wildcard/__tests__/field_wildcard.js +++ b/src/ui/public/field_wildcard/__tests__/field_wildcard.js @@ -1,7 +1,7 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FieldWildcardProvider from '../../field_wildcard'; +import { FieldWildcardProvider } from '../../field_wildcard'; describe('fieldWildcard', function () { let fieldWildcardFilter; diff --git a/src/ui/public/field_wildcard/field_wildcard.js b/src/ui/public/field_wildcard/field_wildcard.js index 615269fe68bf2..dcb387fe0b89f 100644 --- a/src/ui/public/field_wildcard/field_wildcard.js +++ b/src/ui/public/field_wildcard/field_wildcard.js @@ -1,6 +1,6 @@ import { escapeRegExp, memoize } from 'lodash'; -export default function fieldWildcard(config) { +export function FieldWildcardProvider(config) { const metaFields = config.get('metaFields'); const makeRegEx = memoize(function makeRegEx(glob) { diff --git a/src/ui/public/filter_bar/__tests__/_add_filters.js b/src/ui/public/filter_bar/__tests__/_add_filters.js index d6c6ead1a5bcf..b90fc56429fca 100644 --- a/src/ui/public/filter_bar/__tests__/_add_filters.js +++ b/src/ui/public/filter_bar/__tests__/_add_filters.js @@ -3,7 +3,8 @@ import sinon from 'auto-release-sinon'; import expect from 'expect.js'; import ngMock from 'ng_mock'; import MockState from 'fixtures/mock_state'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; + describe('add filters', function () { let filters; let queryFilter; diff --git a/src/ui/public/filter_bar/__tests__/_get_filters.js b/src/ui/public/filter_bar/__tests__/_get_filters.js index 064ce987020bd..8de096aefd61d 100644 --- a/src/ui/public/filter_bar/__tests__/_get_filters.js +++ b/src/ui/public/filter_bar/__tests__/_get_filters.js @@ -2,7 +2,8 @@ import _ from 'lodash'; import ngMock from 'ng_mock'; import expect from 'expect.js'; import MockState from 'fixtures/mock_state'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; + describe('get filters', function () { const storeNames = { app: 'appState', diff --git a/src/ui/public/filter_bar/__tests__/_invert_filters.js b/src/ui/public/filter_bar/__tests__/_invert_filters.js index 3765885e45e72..79f629d5f9767 100644 --- a/src/ui/public/filter_bar/__tests__/_invert_filters.js +++ b/src/ui/public/filter_bar/__tests__/_invert_filters.js @@ -3,7 +3,8 @@ import sinon from 'auto-release-sinon'; import expect from 'expect.js'; import ngMock from 'ng_mock'; import MockState from 'fixtures/mock_state'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; + describe('invert filters', function () { let filters; let queryFilter; diff --git a/src/ui/public/filter_bar/__tests__/_pin_filters.js b/src/ui/public/filter_bar/__tests__/_pin_filters.js index 3eb5d9b6ec1f5..c5f488817bbb0 100644 --- a/src/ui/public/filter_bar/__tests__/_pin_filters.js +++ b/src/ui/public/filter_bar/__tests__/_pin_filters.js @@ -3,7 +3,8 @@ import sinon from 'auto-release-sinon'; import expect from 'expect.js'; import ngMock from 'ng_mock'; import MockState from 'fixtures/mock_state'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; + describe('pin filters', function () { let filters; let queryFilter; diff --git a/src/ui/public/filter_bar/__tests__/_remove_filters.js b/src/ui/public/filter_bar/__tests__/_remove_filters.js index 097a82f40aae6..48aba34130640 100644 --- a/src/ui/public/filter_bar/__tests__/_remove_filters.js +++ b/src/ui/public/filter_bar/__tests__/_remove_filters.js @@ -3,7 +3,8 @@ import sinon from 'auto-release-sinon'; import expect from 'expect.js'; import ngMock from 'ng_mock'; import MockState from 'fixtures/mock_state'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; + describe('remove filters', function () { let filters; let queryFilter; diff --git a/src/ui/public/filter_bar/__tests__/_toggle_filters.js b/src/ui/public/filter_bar/__tests__/_toggle_filters.js index 0dd910c2b13f2..33b6d04ec223a 100644 --- a/src/ui/public/filter_bar/__tests__/_toggle_filters.js +++ b/src/ui/public/filter_bar/__tests__/_toggle_filters.js @@ -3,7 +3,8 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; import sinon from 'auto-release-sinon'; import MockState from 'fixtures/mock_state'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; + describe('toggle filters', function () { let filters; let queryFilter; diff --git a/src/ui/public/filter_bar/__tests__/_update_filters.js b/src/ui/public/filter_bar/__tests__/_update_filters.js index 7a0e9dedbe76b..6634d2f8ff8a6 100644 --- a/src/ui/public/filter_bar/__tests__/_update_filters.js +++ b/src/ui/public/filter_bar/__tests__/_update_filters.js @@ -2,7 +2,8 @@ import _ from 'lodash'; import expect from 'expect.js'; import ngMock from 'ng_mock'; import MockState from 'fixtures/mock_state'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; + describe('update filters', function () { let queryFilter; let appState; diff --git a/src/ui/public/filter_bar/__tests__/filter_bar.js b/src/ui/public/filter_bar/__tests__/filter_bar.js index 712be0d16c6e5..f90c533d73927 100644 --- a/src/ui/public/filter_bar/__tests__/filter_bar.js +++ b/src/ui/public/filter_bar/__tests__/filter_bar.js @@ -6,8 +6,8 @@ import sinon from 'sinon'; import MockState from 'fixtures/mock_state'; import $ from 'jquery'; import 'ui/filter_bar'; -import FilterBarLibMapFilterProvider from 'ui/filter_bar/lib/map_filter'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; +import { FilterBarLibMapFilterProvider } from 'ui/filter_bar/lib/map_filter'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; describe('Filter Bar Directive', function () { let $rootScope; diff --git a/src/ui/public/filter_bar/__tests__/filter_bar_click_handler.js b/src/ui/public/filter_bar/__tests__/filter_bar_click_handler.js index b14c9da83b491..fc8df780699e2 100644 --- a/src/ui/public/filter_bar/__tests__/filter_bar_click_handler.js +++ b/src/ui/public/filter_bar/__tests__/filter_bar_click_handler.js @@ -7,7 +7,7 @@ import AggConfigResult from 'ui/vis/agg_config_result'; import VisProvider from 'ui/vis'; import StubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; -import FilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler'; +import { FilterBarClickHandlerProvider } from 'ui/filter_bar/filter_bar_click_handler'; describe('filterBarClickHandler', function () { let setup = null; diff --git a/src/ui/public/filter_bar/__tests__/push_filter.js b/src/ui/public/filter_bar/__tests__/push_filter.js index 34b60760ddc06..49a5afeec968d 100644 --- a/src/ui/public/filter_bar/__tests__/push_filter.js +++ b/src/ui/public/filter_bar/__tests__/push_filter.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarPushFilterProvider from 'ui/filter_bar/push_filter'; +import { FilterBarPushFilterProvider } from 'ui/filter_bar/push_filter'; describe('Filter Bar pushFilter()', function () { let pushFilterFn; diff --git a/src/ui/public/filter_bar/__tests__/query_filter.js b/src/ui/public/filter_bar/__tests__/query_filter.js index 16302975223b2..4b7bf78fec153 100644 --- a/src/ui/public/filter_bar/__tests__/query_filter.js +++ b/src/ui/public/filter_bar/__tests__/query_filter.js @@ -7,7 +7,7 @@ import './_update_filters'; import './_toggle_filters'; import './_invert_filters'; import './_pin_filters'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; import { EventsProvider } from 'ui/events'; let queryFilter; let EventEmitter; diff --git a/src/ui/public/filter_bar/filter_bar.js b/src/ui/public/filter_bar/filter_bar.js index 5d4a52776eafa..11528edf94ad4 100644 --- a/src/ui/public/filter_bar/filter_bar.js +++ b/src/ui/public/filter_bar/filter_bar.js @@ -1,14 +1,14 @@ import _ from 'lodash'; import template from 'ui/filter_bar/filter_bar.html'; import 'ui/directives/json_input'; -import filterAppliedAndUnwrap from 'ui/filter_bar/lib/filter_applied_and_unwrap'; -import FilterBarLibMapAndFlattenFiltersProvider from 'ui/filter_bar/lib/map_and_flatten_filters'; -import FilterBarLibMapFlattenAndWrapFiltersProvider from 'ui/filter_bar/lib/map_flatten_and_wrap_filters'; -import FilterBarLibExtractTimeFilterProvider from 'ui/filter_bar/lib/extract_time_filter'; -import FilterBarLibFilterOutTimeBasedFilterProvider from 'ui/filter_bar/lib/filter_out_time_based_filter'; -import FilterBarLibChangeTimeFilterProvider from 'ui/filter_bar/lib/change_time_filter'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; -import compareFilters from './lib/compare_filters'; +import { filterAppliedAndUnwrap } from 'ui/filter_bar/lib/filter_applied_and_unwrap'; +import { FilterBarLibMapAndFlattenFiltersProvider } from 'ui/filter_bar/lib/map_and_flatten_filters'; +import { FilterBarLibMapFlattenAndWrapFiltersProvider } from 'ui/filter_bar/lib/map_flatten_and_wrap_filters'; +import { FilterBarLibExtractTimeFilterProvider } from 'ui/filter_bar/lib/extract_time_filter'; +import { FilterBarLibFilterOutTimeBasedFilterProvider } from 'ui/filter_bar/lib/filter_out_time_based_filter'; +import { FilterBarLibChangeTimeFilterProvider } from 'ui/filter_bar/lib/change_time_filter'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; +import { compareFilters } from './lib/compare_filters'; import uiModules from 'ui/modules'; const module = uiModules.get('kibana'); diff --git a/src/ui/public/filter_bar/filter_bar_click_handler.js b/src/ui/public/filter_bar/filter_bar_click_handler.js index db634bbf89365..20559fb365840 100644 --- a/src/ui/public/filter_bar/filter_bar_click_handler.js +++ b/src/ui/public/filter_bar/filter_bar_click_handler.js @@ -1,9 +1,9 @@ import _ from 'lodash'; -import dedupFilters from './lib/dedup_filters'; -import uniqFilters from './lib/uniq_filters'; +import { dedupFilters } from './lib/dedup_filters'; +import { uniqFilters } from './lib/uniq_filters'; import findByParam from 'ui/utils/find_by_param'; -export default function (Notifier) { +export function FilterBarClickHandlerProvider(Notifier) { return function ($state) { return function (event, simulate) { const notify = new Notifier({ @@ -67,3 +67,6 @@ export default function (Notifier) { }; }; } + +// Used in xpack. TODO: remove and cleanup. +export default FilterBarClickHandlerProvider; diff --git a/src/ui/public/filter_bar/lib/__tests__/change_time_filter.js b/src/ui/public/filter_bar/lib/__tests__/change_time_filter.js index a33a92f0a4bf9..fdfb06f8f659f 100644 --- a/src/ui/public/filter_bar/lib/__tests__/change_time_filter.js +++ b/src/ui/public/filter_bar/lib/__tests__/change_time_filter.js @@ -2,7 +2,8 @@ import moment from 'moment'; import ngMock from 'ng_mock'; import expect from 'expect.js'; -import FilterBarLibChangeTimeFilterProvider from 'ui/filter_bar/lib/change_time_filter'; +import { FilterBarLibChangeTimeFilterProvider } from 'ui/filter_bar/lib/change_time_filter'; + describe('Filter Bar Directive', function () { describe('changeTimeFilter()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/dedup_filters.js b/src/ui/public/filter_bar/lib/__tests__/dedup_filters.js index e09308fa0f402..8b8695b01914f 100644 --- a/src/ui/public/filter_bar/lib/__tests__/dedup_filters.js +++ b/src/ui/public/filter_bar/lib/__tests__/dedup_filters.js @@ -1,5 +1,6 @@ -import dedupFilters from 'ui/filter_bar/lib/dedup_filters'; +import { dedupFilters } from 'ui/filter_bar/lib/dedup_filters'; import expect from 'expect.js'; + describe('Filter Bar Directive', function () { describe('dedupFilters(existing, filters)', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/extract_time_filter.js b/src/ui/public/filter_bar/lib/__tests__/extract_time_filter.js index 41fedfc49db4f..a5f91b0b9fca7 100644 --- a/src/ui/public/filter_bar/lib/__tests__/extract_time_filter.js +++ b/src/ui/public/filter_bar/lib/__tests__/extract_time_filter.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibExtractTimeFilterProvider from 'ui/filter_bar/lib/extract_time_filter'; +import { FilterBarLibExtractTimeFilterProvider } from 'ui/filter_bar/lib/extract_time_filter'; describe('Filter Bar Directive', function () { describe('extractTimeFilter()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/filter_applied_and_unwrap.js b/src/ui/public/filter_bar/lib/__tests__/filter_applied_and_unwrap.js index 356ff3c06d1b9..b65a33b91533d 100644 --- a/src/ui/public/filter_bar/lib/__tests__/filter_applied_and_unwrap.js +++ b/src/ui/public/filter_bar/lib/__tests__/filter_applied_and_unwrap.js @@ -1,5 +1,6 @@ import expect from 'expect.js'; -import filterAppliedAndUnwrap from 'ui/filter_bar/lib/filter_applied_and_unwrap'; +import { filterAppliedAndUnwrap } from 'ui/filter_bar/lib/filter_applied_and_unwrap'; + describe('Filter Bar Directive', function () { describe('filterAppliedAndUnwrap()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/filter_out_time_based_filter.js b/src/ui/public/filter_bar/lib/__tests__/filter_out_time_based_filter.js index 51f24301c050c..5832b5a537f40 100644 --- a/src/ui/public/filter_bar/lib/__tests__/filter_out_time_based_filter.js +++ b/src/ui/public/filter_bar/lib/__tests__/filter_out_time_based_filter.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibFilterOutTimeBasedFilterProvider from 'ui/filter_bar/lib/filter_out_time_based_filter'; +import { FilterBarLibFilterOutTimeBasedFilterProvider } from 'ui/filter_bar/lib/filter_out_time_based_filter'; describe('Filter Bar Directive', function () { describe('filterOutTimeBasedFilter()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/generate_mapping_chain.js b/src/ui/public/filter_bar/lib/__tests__/generate_mapping_chain.js index 43fb21bf7c7a0..4efc4aa3555c0 100644 --- a/src/ui/public/filter_bar/lib/__tests__/generate_mapping_chain.js +++ b/src/ui/public/filter_bar/lib/__tests__/generate_mapping_chain.js @@ -1,7 +1,7 @@ import sinon from 'auto-release-sinon'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibGenerateMappingChainProvider from 'ui/filter_bar/lib/generate_mapping_chain'; +import { FilterBarLibGenerateMappingChainProvider } from 'ui/filter_bar/lib/generate_mapping_chain'; describe('Filter Bar Directive', function () { describe('generateMappingChain()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/map_and_flatten_filters.js b/src/ui/public/filter_bar/lib/__tests__/map_and_flatten_filters.js index 77488bca33c53..b50404e9a06c2 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_and_flatten_filters.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_and_flatten_filters.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibMapAndFlattenFiltersProvider from 'ui/filter_bar/lib/map_and_flatten_filters'; +import { FilterBarLibMapAndFlattenFiltersProvider } from 'ui/filter_bar/lib/map_and_flatten_filters'; describe('Filter Bar Directive', function () { describe('mapAndFlattenFilters()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/map_default.js b/src/ui/public/filter_bar/lib/__tests__/map_default.js index 721283f51a109..4cc5db760e7ba 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_default.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_default.js @@ -1,6 +1,7 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibMapDefaultProvider from 'ui/filter_bar/lib/map_default'; +import { FilterBarLibMapDefaultProvider } from 'ui/filter_bar/lib/map_default'; + describe('Filter Bar Directive', function () { describe('mapDefault()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/map_exists.js b/src/ui/public/filter_bar/lib/__tests__/map_exists.js index 5fea9cea76b54..e67752d5e28f0 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_exists.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_exists.js @@ -1,6 +1,7 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibMapExistsProvider from 'ui/filter_bar/lib/map_exists'; +import { FilterBarLibMapExistsProvider } from 'ui/filter_bar/lib/map_exists'; + describe('Filter Bar Directive', function () { describe('mapExists()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/map_filter.js b/src/ui/public/filter_bar/lib/__tests__/map_filter.js index 338a3981c7c98..7f46c9446a262 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_filter.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_filter.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibMapFilterProvider from 'ui/filter_bar/lib/map_filter'; +import { FilterBarLibMapFilterProvider } from 'ui/filter_bar/lib/map_filter'; describe('Filter Bar Directive', function () { let mapFilter; diff --git a/src/ui/public/filter_bar/lib/__tests__/map_flatten_and_wrap_filters.js b/src/ui/public/filter_bar/lib/__tests__/map_flatten_and_wrap_filters.js index a307123308d00..5a5683dc0783a 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_flatten_and_wrap_filters.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_flatten_and_wrap_filters.js @@ -2,7 +2,8 @@ import _ from 'lodash'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibMapFlattenAndWrapFiltersProvider from 'ui/filter_bar/lib/map_flatten_and_wrap_filters'; +import { FilterBarLibMapFlattenAndWrapFiltersProvider } from 'ui/filter_bar/lib/map_flatten_and_wrap_filters'; + describe('Filter Bar Directive', function () { describe('mapFlattenAndWrapFilters()', function () { let mapFlattenAndWrapFilters; diff --git a/src/ui/public/filter_bar/lib/__tests__/map_geo_bounding_box.js b/src/ui/public/filter_bar/lib/__tests__/map_geo_bounding_box.js index 9b1c7607e8d66..4c8dc3d86a07c 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_geo_bounding_box.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_geo_bounding_box.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibMapGeoBoundingBoxProvider from 'ui/filter_bar/lib/map_geo_bounding_box'; +import { FilterBarLibMapGeoBoundingBoxProvider } from 'ui/filter_bar/lib/map_geo_bounding_box'; describe('Filter Bar Directive', function () { describe('mapGeoBoundingBox()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/map_match_all.js b/src/ui/public/filter_bar/lib/__tests__/map_match_all.js index 3f8ce53a02f6f..55e3e109b3187 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_match_all.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_match_all.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibMapMatchAllProvider from 'ui/filter_bar/lib/map_match_all'; +import { FilterBarLibMapMatchAllProvider } from 'ui/filter_bar/lib/map_match_all'; describe('ui/filter_bar/lib', function () { describe('mapMatchAll()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/map_missing.js b/src/ui/public/filter_bar/lib/__tests__/map_missing.js index f3cecf7dec34e..61f604e422735 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_missing.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_missing.js @@ -1,6 +1,7 @@ import ngMock from 'ng_mock'; import expect from 'expect.js'; -import FilterBarLibMapMissingProvider from 'ui/filter_bar/lib/map_missing'; +import { FilterBarLibMapMissingProvider } from 'ui/filter_bar/lib/map_missing'; + describe('Filter Bar Directive', function () { describe('mapMissing()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/map_query_string.js b/src/ui/public/filter_bar/lib/__tests__/map_query_string.js index 41995d99608d6..3ec3b867fee6e 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_query_string.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_query_string.js @@ -1,6 +1,7 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibMapQueryStringProvider from 'ui/filter_bar/lib/map_query_string'; +import { FilterBarLibMapQueryStringProvider } from 'ui/filter_bar/lib/map_query_string'; + describe('Filter Bar Directive', function () { describe('mapQueryString()', function () { let mapQueryString; diff --git a/src/ui/public/filter_bar/lib/__tests__/map_range.js b/src/ui/public/filter_bar/lib/__tests__/map_range.js index 9bab9ba74dd37..a1ba68d6f54a6 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_range.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_range.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibMapRangeProvider from 'ui/filter_bar/lib/map_range'; +import { FilterBarLibMapRangeProvider } from 'ui/filter_bar/lib/map_range'; describe('Filter Bar Directive', function () { describe('mapRange()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/map_script.js b/src/ui/public/filter_bar/lib/__tests__/map_script.js index 4cdd6c40c6328..a64e88a2d04f7 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_script.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_script.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibMapScriptProvider from 'ui/filter_bar/lib/map_script'; +import { FilterBarLibMapScriptProvider } from 'ui/filter_bar/lib/map_script'; describe('Filter Bar Directive', function () { describe('mapScript()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/map_terms.js b/src/ui/public/filter_bar/lib/__tests__/map_terms.js index 20c219e9cf002..2ff9f17848215 100644 --- a/src/ui/public/filter_bar/lib/__tests__/map_terms.js +++ b/src/ui/public/filter_bar/lib/__tests__/map_terms.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterBarLibMapTermsProvider from 'ui/filter_bar/lib/map_terms'; +import { FilterBarLibMapTermsProvider } from 'ui/filter_bar/lib/map_terms'; describe('Filter Bar Directive', function () { describe('mapTerms()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/only_disabled.js b/src/ui/public/filter_bar/lib/__tests__/only_disabled.js index f9e170b9afd1d..950c092baaac7 100644 --- a/src/ui/public/filter_bar/lib/__tests__/only_disabled.js +++ b/src/ui/public/filter_bar/lib/__tests__/only_disabled.js @@ -1,5 +1,6 @@ -import onlyDisabled from 'ui/filter_bar/lib/only_disabled'; +import { onlyDisabled } from 'ui/filter_bar/lib/only_disabled'; import expect from 'expect.js'; + describe('Filter Bar Directive', function () { describe('onlyDisabled()', function () { diff --git a/src/ui/public/filter_bar/lib/__tests__/uniq_filters.js b/src/ui/public/filter_bar/lib/__tests__/uniq_filters.js index dffe89f96f3c1..6654fe8c20b89 100644 --- a/src/ui/public/filter_bar/lib/__tests__/uniq_filters.js +++ b/src/ui/public/filter_bar/lib/__tests__/uniq_filters.js @@ -1,5 +1,6 @@ -import uniqFilters from 'ui/filter_bar/lib/uniq_filters'; +import { uniqFilters } from 'ui/filter_bar/lib/uniq_filters'; import expect from 'expect.js'; + describe('Filter Bar Directive', function () { describe('uniqFilter', function () { diff --git a/src/ui/public/filter_bar/lib/change_time_filter.js b/src/ui/public/filter_bar/lib/change_time_filter.js index 8fa3ced67b24f..b8c91c44f20e4 100644 --- a/src/ui/public/filter_bar/lib/change_time_filter.js +++ b/src/ui/public/filter_bar/lib/change_time_filter.js @@ -1,6 +1,7 @@ import moment from 'moment'; import _ from 'lodash'; -export default function changeTimeFilterProvider(timefilter) { + +export function FilterBarLibChangeTimeFilterProvider(timefilter) { return function (filter) { const key = _.keys(filter.range)[0]; const values = filter.range[key]; diff --git a/src/ui/public/filter_bar/lib/compare_filters.js b/src/ui/public/filter_bar/lib/compare_filters.js index 2345845fea582..4f8727d152adf 100644 --- a/src/ui/public/filter_bar/lib/compare_filters.js +++ b/src/ui/public/filter_bar/lib/compare_filters.js @@ -9,7 +9,7 @@ let comparators; * @param {object} comparatorOptions Parameters to use for comparison * @returns {bool} Filters are the same */ -export default function (first, second, comparatorOptions) { +export function compareFilters(first, second, comparatorOptions) { excludedAttributes = ['$$hashKey', 'meta']; comparators = _.defaults(comparatorOptions || {}, { state: false, diff --git a/src/ui/public/filter_bar/lib/dedup_filters.js b/src/ui/public/filter_bar/lib/dedup_filters.js index 9d3823b2caebe..b16fa2f0c1628 100644 --- a/src/ui/public/filter_bar/lib/dedup_filters.js +++ b/src/ui/public/filter_bar/lib/dedup_filters.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import compareFilters from 'ui/filter_bar/lib/compare_filters'; +import { compareFilters } from 'ui/filter_bar/lib/compare_filters'; /** * Combine 2 filter collections, removing duplicates @@ -8,7 +8,7 @@ import compareFilters from 'ui/filter_bar/lib/compare_filters'; * @param {object} comparatorOptions Parameters to use for comparison * @returns {object} An array of filters that were not in existing */ -export default function (existingFilters, filters, comparatorOptions) { +export function dedupFilters(existingFilters, filters, comparatorOptions) { if (!_.isArray(filters)) filters = [filters]; return _.filter(filters, function (filter) { diff --git a/src/ui/public/filter_bar/lib/extract_time_filter.js b/src/ui/public/filter_bar/lib/extract_time_filter.js index e6f3dd5dd3485..8a615ac7bb93c 100644 --- a/src/ui/public/filter_bar/lib/extract_time_filter.js +++ b/src/ui/public/filter_bar/lib/extract_time_filter.js @@ -1,5 +1,6 @@ import _ from 'lodash'; -export default function extractTimeFilterProvider(courier, Promise) { + +export function FilterBarLibExtractTimeFilterProvider(courier, Promise) { return Promise.method(function (filters) { // Assume all the index patterns are the same since they will be added // from the same visualization. diff --git a/src/ui/public/filter_bar/lib/filter_applied_and_unwrap.js b/src/ui/public/filter_bar/lib/filter_applied_and_unwrap.js index 9164d379ff86d..a6dcd0a855162 100644 --- a/src/ui/public/filter_bar/lib/filter_applied_and_unwrap.js +++ b/src/ui/public/filter_bar/lib/filter_applied_and_unwrap.js @@ -1,5 +1,6 @@ import _ from 'lodash'; -export default function (filters) { + +export function filterAppliedAndUnwrap(filters) { return _.filter(filters, 'meta.apply'); } diff --git a/src/ui/public/filter_bar/lib/filter_out_time_based_filter.js b/src/ui/public/filter_bar/lib/filter_out_time_based_filter.js index 4d58775f97aaa..542792d20e829 100644 --- a/src/ui/public/filter_bar/lib/filter_out_time_based_filter.js +++ b/src/ui/public/filter_bar/lib/filter_out_time_based_filter.js @@ -1,5 +1,6 @@ import _ from 'lodash'; -export default function filterOutTimeBaseFilter(courier, Promise) { + +export function FilterBarLibFilterOutTimeBasedFilterProvider(courier, Promise) { return Promise.method(function (filters) { const id = _.get(filters, '[0].meta.index'); if (id == null) return; diff --git a/src/ui/public/filter_bar/lib/generate_mapping_chain.js b/src/ui/public/filter_bar/lib/generate_mapping_chain.js index d6bdad219f980..09668a29cc3db 100644 --- a/src/ui/public/filter_bar/lib/generate_mapping_chain.js +++ b/src/ui/public/filter_bar/lib/generate_mapping_chain.js @@ -1,4 +1,4 @@ -export default function generateMappingChainProvider(Promise) { +export function FilterBarLibGenerateMappingChainProvider(Promise) { const noop = function () { return Promise.reject(new Error('No mappings have been found for filter.')); diff --git a/src/ui/public/filter_bar/lib/map_and_flatten_filters.js b/src/ui/public/filter_bar/lib/map_and_flatten_filters.js index fc17d3dadc646..796406f29a283 100644 --- a/src/ui/public/filter_bar/lib/map_and_flatten_filters.js +++ b/src/ui/public/filter_bar/lib/map_and_flatten_filters.js @@ -1,6 +1,7 @@ import _ from 'lodash'; -import FilterBarLibMapFilterProvider from 'ui/filter_bar/lib/map_filter'; -export default function mapAndFlattenFiltersProvider(Private, Promise) { +import { FilterBarLibMapFilterProvider } from 'ui/filter_bar/lib/map_filter'; + +export function FilterBarLibMapAndFlattenFiltersProvider(Private, Promise) { const mapFilter = Private(FilterBarLibMapFilterProvider); return function (filters) { return _(filters) diff --git a/src/ui/public/filter_bar/lib/map_default.js b/src/ui/public/filter_bar/lib/map_default.js index 68b9fad97e979..1b238c8c96444 100644 --- a/src/ui/public/filter_bar/lib/map_default.js +++ b/src/ui/public/filter_bar/lib/map_default.js @@ -1,6 +1,7 @@ import angular from 'angular'; import _ from 'lodash'; -export default function mapDefaultProvider(Promise) { + +export function FilterBarLibMapDefaultProvider(Promise) { const metaProperty = /(^\$|meta)/; diff --git a/src/ui/public/filter_bar/lib/map_exists.js b/src/ui/public/filter_bar/lib/map_exists.js index ae34f385c72cd..4054d415e0467 100644 --- a/src/ui/public/filter_bar/lib/map_exists.js +++ b/src/ui/public/filter_bar/lib/map_exists.js @@ -1,4 +1,4 @@ -export default function mapExistsProvider(Promise) { +export function FilterBarLibMapExistsProvider(Promise) { return function (filter) { let key; let value; diff --git a/src/ui/public/filter_bar/lib/map_filter.js b/src/ui/public/filter_bar/lib/map_filter.js index fbe8834eecbda..9b81a1ff90538 100644 --- a/src/ui/public/filter_bar/lib/map_filter.js +++ b/src/ui/public/filter_bar/lib/map_filter.js @@ -1,17 +1,18 @@ import _ from 'lodash'; -import GenerateMappingChainProvider from './generate_mapping_chain'; -import MapMatchAllProvider from './map_match_all'; -import MapTermsProvider from './map_terms'; -import MapRangeProvider from './map_range'; -import MapExistsProvider from './map_exists'; -import MapMissingProvider from './map_missing'; -import MapQueryStringProvider from './map_query_string'; -import MapGeoBoundingBoxProvider from './map_geo_bounding_box'; -import MapScriptProvider from './map_script'; -import MapDefaultProvider from './map_default'; -export default function mapFilterProvider(Promise, Private) { +import { FilterBarLibGenerateMappingChainProvider } from './generate_mapping_chain'; +import { FilterBarLibMapMatchAllProvider } from './map_match_all'; +import { FilterBarLibMapTermsProvider } from './map_terms'; +import { FilterBarLibMapRangeProvider } from './map_range'; +import { FilterBarLibMapExistsProvider } from './map_exists'; +import { FilterBarLibMapMissingProvider } from './map_missing'; +import { FilterBarLibMapQueryStringProvider } from './map_query_string'; +import { FilterBarLibMapGeoBoundingBoxProvider } from './map_geo_bounding_box'; +import { FilterBarLibMapScriptProvider } from './map_script'; +import { FilterBarLibMapDefaultProvider } from './map_default'; - const generateMappingChain = Private(GenerateMappingChainProvider); +export function FilterBarLibMapFilterProvider(Promise, Private) { + + const generateMappingChain = Private(FilterBarLibGenerateMappingChainProvider); /** Mappers **/ @@ -30,15 +31,15 @@ export default function mapFilterProvider(Promise, Private) { // that either handles the mapping operation or not // and add it here. ProTip: These are executed in order listed const mappers = [ - Private(MapMatchAllProvider), - Private(MapTermsProvider), - Private(MapRangeProvider), - Private(MapExistsProvider), - Private(MapMissingProvider), - Private(MapQueryStringProvider), - Private(MapGeoBoundingBoxProvider), - Private(MapScriptProvider), - Private(MapDefaultProvider) + Private(FilterBarLibMapMatchAllProvider), + Private(FilterBarLibMapTermsProvider), + Private(FilterBarLibMapRangeProvider), + Private(FilterBarLibMapExistsProvider), + Private(FilterBarLibMapMissingProvider), + Private(FilterBarLibMapQueryStringProvider), + Private(FilterBarLibMapGeoBoundingBoxProvider), + Private(FilterBarLibMapScriptProvider), + Private(FilterBarLibMapDefaultProvider) ]; const noop = function () { diff --git a/src/ui/public/filter_bar/lib/map_flatten_and_wrap_filters.js b/src/ui/public/filter_bar/lib/map_flatten_and_wrap_filters.js index 7b449468f44ea..4cf3ae92613d2 100644 --- a/src/ui/public/filter_bar/lib/map_flatten_and_wrap_filters.js +++ b/src/ui/public/filter_bar/lib/map_flatten_and_wrap_filters.js @@ -1,6 +1,7 @@ import _ from 'lodash'; -import FilterBarLibMapAndFlattenFiltersProvider from 'ui/filter_bar/lib/map_and_flatten_filters'; -export default function mapFlattenAndWrapFilters(Private) { +import { FilterBarLibMapAndFlattenFiltersProvider } from 'ui/filter_bar/lib/map_and_flatten_filters'; + +export function FilterBarLibMapFlattenAndWrapFiltersProvider(Private) { const mapAndFlattenFilters = Private(FilterBarLibMapAndFlattenFiltersProvider); return function (filters) { return mapAndFlattenFilters(filters).then(function (filters) { diff --git a/src/ui/public/filter_bar/lib/map_geo_bounding_box.js b/src/ui/public/filter_bar/lib/map_geo_bounding_box.js index acfcf47fd6353..37644356f48e6 100644 --- a/src/ui/public/filter_bar/lib/map_geo_bounding_box.js +++ b/src/ui/public/filter_bar/lib/map_geo_bounding_box.js @@ -1,5 +1,6 @@ import _ from 'lodash'; -export default function mapGeoBoundBoxProvider(Promise, courier) { + +export function FilterBarLibMapGeoBoundingBoxProvider(Promise, courier) { return function (filter) { let key; let value; diff --git a/src/ui/public/filter_bar/lib/map_match_all.js b/src/ui/public/filter_bar/lib/map_match_all.js index 925a6ce172279..546f949cb3087 100644 --- a/src/ui/public/filter_bar/lib/map_match_all.js +++ b/src/ui/public/filter_bar/lib/map_match_all.js @@ -1,4 +1,4 @@ -export default function mapMatchAllProvider(Promise) { +export function FilterBarLibMapMatchAllProvider(Promise) { return function (filter) { if (filter.match_all) { const key = filter.meta.field; diff --git a/src/ui/public/filter_bar/lib/map_missing.js b/src/ui/public/filter_bar/lib/map_missing.js index cb60c43f72e5e..6dc98abab3b14 100644 --- a/src/ui/public/filter_bar/lib/map_missing.js +++ b/src/ui/public/filter_bar/lib/map_missing.js @@ -1,4 +1,4 @@ -export default function mapMissingProvider(Promise) { +export function FilterBarLibMapMissingProvider(Promise) { return function (filter) { let key; let value; diff --git a/src/ui/public/filter_bar/lib/map_query_string.js b/src/ui/public/filter_bar/lib/map_query_string.js index 5adf8139378a5..cf9ff0eeabefe 100644 --- a/src/ui/public/filter_bar/lib/map_query_string.js +++ b/src/ui/public/filter_bar/lib/map_query_string.js @@ -1,4 +1,4 @@ -export default function mapQueryStringProvider(Promise) { +export function FilterBarLibMapQueryStringProvider(Promise) { return function (filter) { let key; let value; diff --git a/src/ui/public/filter_bar/lib/map_range.js b/src/ui/public/filter_bar/lib/map_range.js index ce2d19f4237c5..3e44373db69b0 100644 --- a/src/ui/public/filter_bar/lib/map_range.js +++ b/src/ui/public/filter_bar/lib/map_range.js @@ -1,5 +1,6 @@ import { has } from 'lodash'; -export default function mapRangeProvider(Promise, courier) { + +export function FilterBarLibMapRangeProvider(Promise, courier) { return function (filter) { if (!filter.range) return Promise.reject(filter); diff --git a/src/ui/public/filter_bar/lib/map_script.js b/src/ui/public/filter_bar/lib/map_script.js index 0cbe74a6b1b35..ba5fd490c1b55 100644 --- a/src/ui/public/filter_bar/lib/map_script.js +++ b/src/ui/public/filter_bar/lib/map_script.js @@ -1,27 +1,25 @@ -define(function () { - return function mapScriptProvider(Promise, courier) { - return function (filter) { - let key; - let value; - let field; - if (filter.script) { - return courier - .indexPatterns - .get(filter.meta.index).then(function (indexPattern) { - key = filter.meta.field; - field = indexPattern.fields.byName[key]; +export function FilterBarLibMapScriptProvider(Promise, courier) { + return function (filter) { + let key; + let value; + let field; + if (filter.script) { + return courier + .indexPatterns + .get(filter.meta.index).then(function (indexPattern) { + key = filter.meta.field; + field = indexPattern.fields.byName[key]; - if (filter.meta.formattedValue) { - value = filter.meta.formattedValue; - } else { - value = filter.script.script.params.value; - value = field.format.convert(value); - } + if (filter.meta.formattedValue) { + value = filter.meta.formattedValue; + } else { + value = filter.script.script.params.value; + value = field.format.convert(value); + } - return { key: key, value: value }; - }); - } - return Promise.reject(filter); - }; + return { key: key, value: value }; + }); + } + return Promise.reject(filter); }; -}); +} diff --git a/src/ui/public/filter_bar/lib/map_terms.js b/src/ui/public/filter_bar/lib/map_terms.js index b7584b55eeefb..ab837c48bd8d2 100644 --- a/src/ui/public/filter_bar/lib/map_terms.js +++ b/src/ui/public/filter_bar/lib/map_terms.js @@ -1,5 +1,6 @@ import _ from 'lodash'; -export default function mapTermsProvider(Promise, courier) { + +export function FilterBarLibMapTermsProvider(Promise, courier) { return function (filter) { let key; let value; diff --git a/src/ui/public/filter_bar/lib/only_disabled.js b/src/ui/public/filter_bar/lib/only_disabled.js index 4938e2240a9c1..3f8fad8be8b30 100644 --- a/src/ui/public/filter_bar/lib/only_disabled.js +++ b/src/ui/public/filter_bar/lib/only_disabled.js @@ -8,7 +8,7 @@ const pluckDisabled = function (filter) { * Checks to see if only disabled filters have been changed * @returns {bool} Only disabled filters */ -export default function (newFilters, oldFilters) { +export function onlyDisabled(newFilters, oldFilters) { return _.every(newFilters.concat(oldFilters), function (newFilter) { return pluckDisabled(newFilter); }); diff --git a/src/ui/public/filter_bar/lib/only_state_changed.js b/src/ui/public/filter_bar/lib/only_state_changed.js index 55560cf6f600a..baaf1c613844e 100644 --- a/src/ui/public/filter_bar/lib/only_state_changed.js +++ b/src/ui/public/filter_bar/lib/only_state_changed.js @@ -1,12 +1,12 @@ import _ from 'lodash'; -import compareFilters from 'ui/filter_bar/lib/compare_filters'; +import { compareFilters } from 'ui/filter_bar/lib/compare_filters'; const compareOptions = { disabled: true, negate: true }; /** * Checks to see if only disabled filters have been changed * @returns {bool} Only disabled filters */ -export default function (newFilters, oldFilters) { +export function onlyStateChanged(newFilters, oldFilters) { return _.every(newFilters, function (newFilter) { const match = _.find(oldFilters, function (oldFilter) { return compareFilters(newFilter, oldFilter, compareOptions); diff --git a/src/ui/public/filter_bar/lib/uniq_filters.js b/src/ui/public/filter_bar/lib/uniq_filters.js index 312b42259c5c1..89dd40e469fda 100644 --- a/src/ui/public/filter_bar/lib/uniq_filters.js +++ b/src/ui/public/filter_bar/lib/uniq_filters.js @@ -1,12 +1,12 @@ import _ from 'lodash'; -import dedupFilters from 'ui/filter_bar/lib/dedup_filters'; +import { dedupFilters } from 'ui/filter_bar/lib/dedup_filters'; /** * Remove duplicate filters from an array of filters * @param {array} filters The filters to remove duplicates from * @returns {object} The original filters array with duplicates removed */ -export default function (filters, comparatorOptions) { +export function uniqFilters(filters, comparatorOptions) { let results = []; _.each(filters, function (filter) { results = _.union(results, dedupFilters(results, [filter], comparatorOptions)); diff --git a/src/ui/public/filter_bar/push_filter.js b/src/ui/public/filter_bar/push_filter.js index 6f1cccbc84cdc..8cb8c45f4e179 100644 --- a/src/ui/public/filter_bar/push_filter.js +++ b/src/ui/public/filter_bar/push_filter.js @@ -1,6 +1,6 @@ import _ from 'lodash'; -export default function () { +export function FilterBarPushFilterProvider() { return function ($state) { if (!_.isObject($state)) throw new Error('pushFilters requires a state object'); return function (filter, negate, index) { diff --git a/src/ui/public/filter_bar/query_filter.js b/src/ui/public/filter_bar/query_filter.js index 1c1aa14974851..251cf72c95e26 100644 --- a/src/ui/public/filter_bar/query_filter.js +++ b/src/ui/public/filter_bar/query_filter.js @@ -1,13 +1,13 @@ import _ from 'lodash'; -import onlyDisabled from 'ui/filter_bar/lib/only_disabled'; -import onlyStateChanged from 'ui/filter_bar/lib/only_state_changed'; -import uniqFilters from 'ui/filter_bar/lib/uniq_filters'; -import compareFilters from 'ui/filter_bar/lib/compare_filters'; +import { onlyDisabled } from 'ui/filter_bar/lib/only_disabled'; +import { onlyStateChanged } from 'ui/filter_bar/lib/only_state_changed'; +import { uniqFilters } from 'ui/filter_bar/lib/uniq_filters'; +import { compareFilters } from 'ui/filter_bar/lib/compare_filters'; import angular from 'angular'; import { EventsProvider } from 'ui/events'; -import FilterBarLibMapAndFlattenFiltersProvider from 'ui/filter_bar/lib/map_and_flatten_filters'; +import { FilterBarLibMapAndFlattenFiltersProvider } from 'ui/filter_bar/lib/map_and_flatten_filters'; -export default function (Private, $rootScope, getAppState, globalState, config) { +export function FilterBarQueryFilterProvider(Private, $rootScope, getAppState, globalState, config) { const EventEmitter = Private(EventsProvider); const mapAndFlattenFilters = Private(FilterBarLibMapAndFlattenFiltersProvider); @@ -383,3 +383,6 @@ export default function (Private, $rootScope, getAppState, globalState, config) } } } + +// used by x-pack. TODO: remove and clean up. +export default FilterBarQueryFilterProvider; diff --git a/src/ui/public/filter_manager/__tests__/filter_manager.js b/src/ui/public/filter_manager/__tests__/filter_manager.js index 3659172cdf1d8..add3f74b02f7e 100644 --- a/src/ui/public/filter_manager/__tests__/filter_manager.js +++ b/src/ui/public/filter_manager/__tests__/filter_manager.js @@ -3,8 +3,8 @@ import sinon from 'auto-release-sinon'; import MockState from 'fixtures/mock_state'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import FilterManagerProvider from 'ui/filter_manager'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; +import { FilterManagerProvider } from 'ui/filter_manager'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; import { buildInlineScriptForPhraseFilter } from '../lib/phrase'; let queryFilter; let filterManager; diff --git a/src/ui/public/filter_manager/filter_manager.js b/src/ui/public/filter_manager/filter_manager.js index 5930629c15f40..642dabc989c45 100644 --- a/src/ui/public/filter_manager/filter_manager.js +++ b/src/ui/public/filter_manager/filter_manager.js @@ -1,9 +1,9 @@ import _ from 'lodash'; -import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter'; import { buildInlineScriptForPhraseFilter } from './lib/phrase'; // Adds a filter to a passed state -export default function (Private) { +export function FilterManagerProvider(Private) { const queryFilter = Private(FilterBarQueryFilterProvider); const filterManager = {}; @@ -85,3 +85,6 @@ export default function (Private) { return filterManager; } +// Used in x-pack. TODO: switch references to named and remove. +export default FilterManagerProvider; + diff --git a/src/ui/public/filter_manager/lib/__tests__/phrase.js b/src/ui/public/filter_manager/lib/__tests__/phrase.js index 62650e322883b..9c14834a9aec3 100644 --- a/src/ui/public/filter_manager/lib/__tests__/phrase.js +++ b/src/ui/public/filter_manager/lib/__tests__/phrase.js @@ -1,5 +1,5 @@ -import { buildInlineScriptForPhraseFilter, default as fn } from 'ui/filter_manager/lib/phrase'; +import { buildInlineScriptForPhraseFilter, buildPhraseFilter } from 'ui/filter_manager/lib/phrase'; import expect from 'expect.js'; import _ from 'lodash'; import ngMock from 'ng_mock'; @@ -17,7 +17,7 @@ describe('Filter Manager', function () { })); it('should be a function', function () { - expect(fn).to.be.a(Function); + expect(buildPhraseFilter).to.be.a(Function); }); it('should return a match query filter when passed a standard field', function () { @@ -29,7 +29,7 @@ describe('Filter Manager', function () { } } }; - expect(fn(indexPattern.fields.byName.bytes, 5, indexPattern)).to.eql(expected); + expect(buildPhraseFilter(indexPattern.fields.byName.bytes, 5, indexPattern)).to.eql(expected); }); it('should return a script filter when passed a scripted field', function () { @@ -41,7 +41,7 @@ describe('Filter Manager', function () { value: 5, } }); - expect(fn(indexPattern.fields.byName['script number'], 5, indexPattern)).to.eql(expected); + expect(buildPhraseFilter(indexPattern.fields.byName['script number'], 5, indexPattern)).to.eql(expected); }); }); diff --git a/src/ui/public/filter_manager/lib/__tests__/query.js b/src/ui/public/filter_manager/lib/__tests__/query.js index 8c8a215e03c34..a832a616de251 100644 --- a/src/ui/public/filter_manager/lib/__tests__/query.js +++ b/src/ui/public/filter_manager/lib/__tests__/query.js @@ -1,11 +1,12 @@ - -import fn from 'ui/filter_manager/lib/query'; +import { buildQueryFilter } from 'ui/filter_manager/lib/query'; import expect from 'expect.js'; import _ from 'lodash'; import ngMock from 'ng_mock'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; + let indexPattern; let expected; + describe('Filter Manager', function () { describe('Phrase filter builder', function () { beforeEach(ngMock.module('kibana')); @@ -15,14 +16,14 @@ describe('Filter Manager', function () { })); it('should be a function', function () { - expect(fn).to.be.a(Function); + expect(buildQueryFilter).to.be.a(Function); }); it('should return a query filter when passed a standard field', function () { expected.query = { foo: 'bar' }; - expect(fn({ foo: 'bar' }, indexPattern.id)).to.eql(expected); + expect(buildQueryFilter({ foo: 'bar' }, indexPattern.id)).to.eql(expected); }); }); diff --git a/src/ui/public/filter_manager/lib/__tests__/range.js b/src/ui/public/filter_manager/lib/__tests__/range.js index e238483c6d77a..e052da479ef34 100644 --- a/src/ui/public/filter_manager/lib/__tests__/range.js +++ b/src/ui/public/filter_manager/lib/__tests__/range.js @@ -1,11 +1,12 @@ - -import fn from 'ui/filter_manager/lib/range'; +import { buildRangeFilter } from 'ui/filter_manager/lib/range'; import expect from 'expect.js'; import _ from 'lodash'; import ngMock from 'ng_mock'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; + let indexPattern; let expected; + describe('Filter Manager', function () { describe('Range filter builder', function () { beforeEach(ngMock.module('kibana')); @@ -15,7 +16,7 @@ describe('Filter Manager', function () { })); it('should be a function', function () { - expect(fn).to.be.a(Function); + expect(buildRangeFilter).to.be.a(Function); }); it('should return a range filter when passed a standard field', function () { @@ -25,7 +26,7 @@ describe('Filter Manager', function () { lte: 3 } }; - expect(fn(indexPattern.fields.byName.bytes, { gte: 1, lte: 3 }, indexPattern)).to.eql(expected); + expect(buildRangeFilter(indexPattern.fields.byName.bytes, { gte: 1, lte: 3 }, indexPattern)).to.eql(expected); }); it('should return a script filter when passed a scripted field', function () { @@ -40,7 +41,8 @@ describe('Filter Manager', function () { lte: 3 } }); - expect(fn(indexPattern.fields.byName['script number'], { gte: 1, lte: 3 }, indexPattern)).to.eql(expected); + expect(buildRangeFilter( + indexPattern.fields.byName['script number'], { gte: 1, lte: 3 }, indexPattern)).to.eql(expected); }); it('should wrap painless scripts in comparator lambdas', function () { @@ -49,16 +51,17 @@ describe('Filter Manager', function () { `gte(() -> { ${indexPattern.fields.byName['script date'].script} }, params.gte) && ` + `lte(() -> { ${indexPattern.fields.byName['script date'].script} }, params.lte)`; - const inlineScript = fn(indexPattern.fields.byName['script date'], { gte: 1, lte: 3 }, indexPattern).script.script.inline; + const inlineScript = buildRangeFilter( + indexPattern.fields.byName['script date'], { gte: 1, lte: 3 }, indexPattern).script.script.inline; expect(inlineScript).to.be(expected); }); it('should throw an error when gte and gt, or lte and lt are both passed', function () { expect(function () { - fn(indexPattern.fields.byName['script number'], { gte: 1, gt: 3 }, indexPattern); + buildRangeFilter(indexPattern.fields.byName['script number'], { gte: 1, gt: 3 }, indexPattern); }).to.throwError(); expect(function () { - fn(indexPattern.fields.byName['script number'], { lte: 1, lt: 3 }, indexPattern); + buildRangeFilter(indexPattern.fields.byName['script number'], { lte: 1, lt: 3 }, indexPattern); }).to.throwError(); }); @@ -66,9 +69,10 @@ describe('Filter Manager', function () { _.each({ gte: '>=', gt: '>', lte: '<=', lt: '<' }, function (operator, key) { const params = {}; params[key] = 5; - const filter = fn(indexPattern.fields.byName['script number'], params, indexPattern); + const filter = buildRangeFilter(indexPattern.fields.byName['script number'], params, indexPattern); - expect(filter.script.script.inline).to.be('(' + indexPattern.fields.byName['script number'].script + ')' + operator + key); + expect(filter.script.script.inline).to.be( + '(' + indexPattern.fields.byName['script number'].script + ')' + operator + key); expect(filter.script.script.params[key]).to.be(5); expect(filter.script.script.params.value).to.be(operator + 5); @@ -78,7 +82,7 @@ describe('Filter Manager', function () { describe('when given params where one side is infinite', function () { let filter; beforeEach(function () { - filter = fn(indexPattern.fields.byName['script number'], { gte: 0, lt: Infinity }, indexPattern); + filter = buildRangeFilter(indexPattern.fields.byName['script number'], { gte: 0, lt: Infinity }, indexPattern); }); describe('returned filter', function () { @@ -104,7 +108,8 @@ describe('Filter Manager', function () { describe('when given params where both sides are infinite', function () { let filter; beforeEach(function () { - filter = fn(indexPattern.fields.byName['script number'], { gte: -Infinity, lt: Infinity }, indexPattern); + filter = buildRangeFilter( + indexPattern.fields.byName['script number'], { gte: -Infinity, lt: Infinity }, indexPattern); }); describe('returned filter', function () { diff --git a/src/ui/public/filter_manager/lib/phrase.js b/src/ui/public/filter_manager/lib/phrase.js index 748e2ce976814..78de46be28855 100644 --- a/src/ui/public/filter_manager/lib/phrase.js +++ b/src/ui/public/filter_manager/lib/phrase.js @@ -1,5 +1,6 @@ import _ from 'lodash'; -export default function buildPhraseFilter(field, value, indexPattern) { + +export function buildPhraseFilter(field, value, indexPattern) { const filter = { meta: { index: indexPattern.id } }; if (field.scripted) { diff --git a/src/ui/public/filter_manager/lib/query.js b/src/ui/public/filter_manager/lib/query.js index e176c5a9d67fa..c364cb8783114 100644 --- a/src/ui/public/filter_manager/lib/query.js +++ b/src/ui/public/filter_manager/lib/query.js @@ -1,4 +1,4 @@ -export default function buildQueryFilter(query, index) { +export function buildQueryFilter(query, index) { return { query: query, meta: { diff --git a/src/ui/public/filter_manager/lib/range.js b/src/ui/public/filter_manager/lib/range.js index 8da3afaf07eac..53bf0fd735bdc 100644 --- a/src/ui/public/filter_manager/lib/range.js +++ b/src/ui/public/filter_manager/lib/range.js @@ -1,7 +1,7 @@ import _ from 'lodash'; const OPERANDS_IN_RANGE = 2; -export default function buildRangeFilter(field, params, indexPattern, formattedValue) { +export function buildRangeFilter(field, params, indexPattern, formattedValue) { const filter = { meta: { index: indexPattern.id } }; if (formattedValue) filter.meta.formattedValue = formattedValue; diff --git a/src/ui/public/filters/__tests__/prop_filter.js b/src/ui/public/filters/__tests__/prop_filter.js index a9c6cdc57123d..88f626212cb9a 100644 --- a/src/ui/public/filters/__tests__/prop_filter.js +++ b/src/ui/public/filters/__tests__/prop_filter.js @@ -1,5 +1,5 @@ import expect from 'expect.js'; -import propFilter from 'ui/filters/_prop_filter'; +import { propFilter } from 'ui/filters/_prop_filter'; describe('prop filter', function () { let nameFilter; diff --git a/src/ui/public/filters/_prop_filter.js b/src/ui/public/filters/_prop_filter.js index cd007e8ad20b4..e9194b93345b2 100644 --- a/src/ui/public/filters/_prop_filter.js +++ b/src/ui/public/filters/_prop_filter.js @@ -7,7 +7,7 @@ import _ from 'lodash'; * * @returns {function} - the filter function which can be registered with angular */ -function propFilter(prop) { +export function propFilter(prop) { /** * List filtering function which accepts an array or list of values that a property * must contain @@ -55,5 +55,3 @@ function propFilter(prop) { }); }; } - -export default propFilter; diff --git a/src/ui/public/filters/field_type.js b/src/ui/public/filters/field_type.js index 8bf26934b0f41..f35462a2183b6 100644 --- a/src/ui/public/filters/field_type.js +++ b/src/ui/public/filters/field_type.js @@ -1,4 +1,4 @@ -import propFilter from 'ui/filters/_prop_filter'; +import { propFilter } from 'ui/filters/_prop_filter'; import uiModules from 'ui/modules'; // Gets all fields of a given type. // You may also pass "*" to get all types diff --git a/src/ui/public/filters/short_dots.js b/src/ui/public/filters/short_dots.js index cb560d6ced058..be6e667ebd797 100644 --- a/src/ui/public/filters/short_dots.js +++ b/src/ui/public/filters/short_dots.js @@ -24,5 +24,3 @@ function shortDotsFilterProvider(config) { return filter(str); } } - -export default shortDotsFilterProvider; diff --git a/src/ui/public/highlight/__tests__/highlight_html.js b/src/ui/public/highlight/__tests__/highlight_html.js index db562e7fa93b1..30c3caaf109a7 100644 --- a/src/ui/public/highlight/__tests__/highlight_html.js +++ b/src/ui/public/highlight/__tests__/highlight_html.js @@ -1,7 +1,7 @@ import expect from 'expect.js'; -import highlightTags from '../highlight_tags'; -import htmlTags from '../html_tags'; -import getHighlightHtml from '../highlight_html'; +import { highlightTags } from '../highlight_tags'; +import { htmlTags } from '../html_tags'; +import { getHighlightHtml } from '../highlight_html'; describe('getHighlightHtml', function () { const text = '' + diff --git a/src/ui/public/highlight/__tests__/highlight_request.js b/src/ui/public/highlight/__tests__/highlight_request.js index ddb7a0cc994c3..ab7094dc9309f 100644 --- a/src/ui/public/highlight/__tests__/highlight_request.js +++ b/src/ui/public/highlight/__tests__/highlight_request.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import getHighlightRequestProvider from '../highlight_request'; +import { getHighlightRequestProvider } from '../highlight_request'; describe('getHighlightRequest', () => { const queryStringQuery = { query_string: { query: 'foo' } }; diff --git a/src/ui/public/highlight/highlight.js b/src/ui/public/highlight/highlight.js index 30d5e89d9113a..95dd2c4f2dabe 100644 --- a/src/ui/public/highlight/highlight.js +++ b/src/ui/public/highlight/highlight.js @@ -1,7 +1,2 @@ -import getHighlightHtml from './highlight_html'; -import getHighlightRequestProvider from './highlight_request'; - -export default { - getHighlightHtml, - getHighlightRequestProvider -}; +export { getHighlightHtml } from './highlight_html'; +export { getHighlightRequestProvider } from './highlight_request'; diff --git a/src/ui/public/highlight/highlight_html.js b/src/ui/public/highlight/highlight_html.js index 413c290872cce..022eff7b8cf11 100644 --- a/src/ui/public/highlight/highlight_html.js +++ b/src/ui/public/highlight/highlight_html.js @@ -1,9 +1,9 @@ import _ from 'lodash'; import angular from 'angular'; -import highlightTags from './highlight_tags'; -import htmlTags from './html_tags'; +import { highlightTags } from './highlight_tags'; +import { htmlTags } from './html_tags'; -export default function getHighlightHtml(fieldValue, highlights) { +export function getHighlightHtml(fieldValue, highlights) { let highlightHtml = (typeof fieldValue === 'object') ? angular.toJson(fieldValue) : fieldValue; diff --git a/src/ui/public/highlight/highlight_request.js b/src/ui/public/highlight/highlight_request.js index ac559d8232c39..9069d99c45e42 100644 --- a/src/ui/public/highlight/highlight_request.js +++ b/src/ui/public/highlight/highlight_request.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import highlightTags from './highlight_tags'; +import { highlightTags } from './highlight_tags'; const FRAGMENT_SIZE = Math.pow(2, 31) - 1; // Max allowed value for fragment_size (limit of a java int) @@ -26,7 +26,7 @@ function getHighlightQuery(query) { return clone; } -export default function getHighlightRequestProvider(config) { +export function getHighlightRequestProvider(config) { return function getHighlightRequest(query) { if (!config.get('doc_table:highlight')) return; diff --git a/src/ui/public/highlight/highlight_tags.js b/src/ui/public/highlight/highlight_tags.js index edf473391e303..416f331f8cde6 100644 --- a/src/ui/public/highlight/highlight_tags.js +++ b/src/ui/public/highlight/highlight_tags.js @@ -1,7 +1,7 @@ // By default, ElasticSearch surrounds matched values in . This is not ideal because it is possible that // the value could contain in the value. We define these custom tags that we would never expect to see // inside a field value. -export default { +export const highlightTags = { pre: '@kibana-highlighted-field@', post: '@/kibana-highlighted-field@' }; diff --git a/src/ui/public/highlight/html_tags.js b/src/ui/public/highlight/html_tags.js index 7cf2ac89540eb..f2da6081037a8 100644 --- a/src/ui/public/highlight/html_tags.js +++ b/src/ui/public/highlight/html_tags.js @@ -1,5 +1,5 @@ // These are the html tags that will replace the highlight tags. -export default { +export const htmlTags = { pre: '', post: '' }; diff --git a/src/ui/public/index_patterns/__tests__/_cast_mapping_type.js b/src/ui/public/index_patterns/__tests__/_cast_mapping_type.js index 99c7d63b44f94..3f55389f92e8b 100644 --- a/src/ui/public/index_patterns/__tests__/_cast_mapping_type.js +++ b/src/ui/public/index_patterns/__tests__/_cast_mapping_type.js @@ -1,7 +1,8 @@ import _ from 'lodash'; import ngMock from 'ng_mock'; import expect from 'expect.js'; -import IndexPatternsCastMappingTypeProvider from 'ui/index_patterns/_cast_mapping_type'; +import { IndexPatternsCastMappingTypeProvider } from 'ui/index_patterns/_cast_mapping_type'; + describe('type normalizer (castMappingType)', function () { let fn; beforeEach(ngMock.module('kibana')); diff --git a/src/ui/public/index_patterns/__tests__/_field_format.js b/src/ui/public/index_patterns/__tests__/_field_format.js index ca8fb8d90fcdf..0c3f16d249fd9 100644 --- a/src/ui/public/index_patterns/__tests__/_field_format.js +++ b/src/ui/public/index_patterns/__tests__/_field_format.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import IndexPatternsFieldFormatFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; describe('FieldFormat class', function () { let FieldFormat; @@ -9,7 +9,7 @@ describe('FieldFormat class', function () { beforeEach(ngMock.module('kibana')); beforeEach(ngMock.inject(function (Private) { - FieldFormat = Private(IndexPatternsFieldFormatFieldFormatProvider); + FieldFormat = Private(IndexPatternsFieldFormatProvider); TestFormat = function (params) { TestFormat.Super.call(this, params); diff --git a/src/ui/public/index_patterns/__tests__/_get_computed_fields.js b/src/ui/public/index_patterns/__tests__/_get_computed_fields.js index d4fae2bb1b65b..97fa716a9828a 100644 --- a/src/ui/public/index_patterns/__tests__/_get_computed_fields.js +++ b/src/ui/public/index_patterns/__tests__/_get_computed_fields.js @@ -1,20 +1,18 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; +import { getComputedFields } from 'ui/index_patterns/_get_computed_fields'; + describe('get computed fields', function () { let indexPattern; - - let getComputedFields; - let fn; + beforeEach(ngMock.module('kibana')); beforeEach(ngMock.inject(function (Private) { indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); - getComputedFields = require('ui/index_patterns/_get_computed_fields'); indexPattern.getComputedFields = getComputedFields.bind(indexPattern); fn = indexPattern.getComputedFields; - })); it('should be a function', function () { diff --git a/src/ui/public/index_patterns/__tests__/_index_pattern.js b/src/ui/public/index_patterns/__tests__/_index_pattern.js index e03562354ca78..a4a565d4d42c0 100644 --- a/src/ui/public/index_patterns/__tests__/_index_pattern.js +++ b/src/ui/public/index_patterns/__tests__/_index_pattern.js @@ -4,15 +4,16 @@ import ngMock from 'ng_mock'; import expect from 'expect.js'; import Promise from 'bluebird'; import { DuplicateField } from 'ui/errors'; -import IndexedArray from 'ui/indexed_array'; +import { IndexedArray } from 'ui/indexed_array'; import FixturesLogstashFieldsProvider from 'fixtures/logstash_fields'; import FixturesStubbedDocSourceResponseProvider from 'fixtures/stubbed_doc_source_response'; import { AdminDocSourceProvider } from 'ui/courier/data_source/admin_doc_source'; import UtilsMappingSetupProvider from 'ui/utils/mapping_setup'; -import IndexPatternsIntervalsProvider from 'ui/index_patterns/_intervals'; -import IndexPatternsIndexPatternProvider from 'ui/index_patterns/_index_pattern'; +import { IndexPatternsIntervalsProvider } from 'ui/index_patterns/_intervals'; +import { IndexPatternProvider } from 'ui/index_patterns/_index_pattern'; import NoDigestPromises from 'test_utils/no_digest_promises'; import { stubMapper } from 'test_utils/stub_mapper'; +import { IndexPatternsCalculateIndicesProvider } from 'ui/index_patterns/_calculate_indices'; describe('index pattern', function () { NoDigestPromises.activateForSuite(); @@ -51,7 +52,7 @@ describe('index pattern', function () { { index: 'bar', max: Infinity, min: -Infinity } ]); }); - Private.stub(require('ui/index_patterns/_calculate_indices'), calculateIndices); + Private.stub(IndexPatternsCalculateIndicesProvider, calculateIndices); // spy on intervals intervals = Private(IndexPatternsIntervalsProvider); @@ -60,7 +61,7 @@ describe('index pattern', function () { { index: 'bar', max: Infinity, min: -Infinity } ]); - IndexPattern = Private(IndexPatternsIndexPatternProvider); + IndexPattern = Private(IndexPatternProvider); })); // create an indexPattern instance for each test diff --git a/src/ui/public/index_patterns/__tests__/_map_field.js b/src/ui/public/index_patterns/__tests__/_map_field.js index 4832d85a354d6..841c5b495af7c 100644 --- a/src/ui/public/index_patterns/__tests__/_map_field.js +++ b/src/ui/public/index_patterns/__tests__/_map_field.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import IndexPatternsMapFieldProvider from 'ui/index_patterns/_map_field'; +import { IndexPatternsMapFieldProvider } from 'ui/index_patterns/_map_field'; describe('field mapping normalizer (mapField)', function () { let fn; diff --git a/src/ui/public/index_patterns/__tests__/_pattern_to_wildcard.js b/src/ui/public/index_patterns/__tests__/_pattern_to_wildcard.js index 39f688a74fa7a..e6acafcb10404 100644 --- a/src/ui/public/index_patterns/__tests__/_pattern_to_wildcard.js +++ b/src/ui/public/index_patterns/__tests__/_pattern_to_wildcard.js @@ -1,36 +1,42 @@ import expect from 'expect.js'; -describe('Index pattern to wildcard', function () { +import { IndexPatternsPatternToWildcardProvider } from 'ui/index_patterns/_pattern_to_wildcard'; +import ngMock from 'ng_mock'; - const fn = require('ui/index_patterns/_pattern_to_wildcard')(); +describe('Index pattern to wildcard', function () { + let indexPatternToWildcard; + beforeEach(ngMock.module('kibana')); + beforeEach(ngMock.inject(function (Private) { + indexPatternToWildcard = Private(IndexPatternsPatternToWildcardProvider); + })); it('should be a function', function () { - expect(fn).to.be.a(Function); + expect(indexPatternToWildcard).to.be.a(Function); }); it('should parse patterns with a single escaped sequence', function () { - expect(fn('[foo-]YYYY')).to.equal('foo-*'); + expect(indexPatternToWildcard('[foo-]YYYY')).to.equal('foo-*'); }); it('should parse patterns with a multiple escaped sequences', function () { - expect(fn('[foo-]YYYY[-bar]')).to.equal('foo-*-bar'); - expect(fn('[foo-]YYYY[-bar-]MM')).to.equal('foo-*-bar-*'); + expect(indexPatternToWildcard('[foo-]YYYY[-bar]')).to.equal('foo-*-bar'); + expect(indexPatternToWildcard('[foo-]YYYY[-bar-]MM')).to.equal('foo-*-bar-*'); }); it('should handle leading patterns', function () { - expect(fn('YYYY[-foo]')).to.equal('*-foo'); + expect(indexPatternToWildcard('YYYY[-foo]')).to.equal('*-foo'); }); it('should ignore [ when inside an escape', function () { - expect(fn('[f[oo-]YYYY')).to.equal('f[oo-*'); + expect(indexPatternToWildcard('[f[oo-]YYYY')).to.equal('f[oo-*'); }); // Not sure if this behavior is useful, but this is how the code works it('should add ] to the string when outside the pattern', function () { - expect(fn('[foo-]]YYYY')).to.equal('foo-]*'); + expect(indexPatternToWildcard('[foo-]]YYYY')).to.equal('foo-]*'); }); it('should ignore ] when outside an escape', function () { - expect(fn('[f]oo-]YYYY')).to.equal('f*'); + expect(indexPatternToWildcard('[f]oo-]YYYY')).to.equal('f*'); }); }); diff --git a/src/ui/public/index_patterns/__tests__/calculate_indices.js b/src/ui/public/index_patterns/__tests__/calculate_indices.js index bf8093f2e8c9b..2d5451f1d813f 100644 --- a/src/ui/public/index_patterns/__tests__/calculate_indices.js +++ b/src/ui/public/index_patterns/__tests__/calculate_indices.js @@ -4,8 +4,9 @@ import sinon from 'auto-release-sinon'; import expect from 'expect.js'; import ngMock from 'ng_mock'; import moment from 'moment'; -import IndexPatternsCalculateIndicesProvider from 'ui/index_patterns/_calculate_indices'; -describe('ui/index_patterns/_calculate_indices', () => { +import { IndexPatternsCalculateIndicesProvider } from 'ui/index_patterns/_calculate_indices'; + +describe('IndexPatternsCalculateIndicesProvider', () => { let $rootScope; let calculateIndices; let es; diff --git a/src/ui/public/index_patterns/__tests__/flatten_hit.js b/src/ui/public/index_patterns/__tests__/flatten_hit.js index 2ef777cf6c778..99942ee13cc79 100644 --- a/src/ui/public/index_patterns/__tests__/flatten_hit.js +++ b/src/ui/public/index_patterns/__tests__/flatten_hit.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import ngMock from 'ng_mock'; -import IndexPatternsFlattenHitProvider from 'ui/index_patterns/_flatten_hit'; +import { IndexPatternsFlattenHitProvider } from 'ui/index_patterns/_flatten_hit'; describe('IndexPattern#flattenHit()', function () { let flattenHit; diff --git a/src/ui/public/index_patterns/__tests__/index_patterns.js b/src/ui/public/index_patterns/__tests__/index_patterns.js index 6ef012dfc135b..b22804263f880 100644 --- a/src/ui/public/index_patterns/__tests__/index_patterns.js +++ b/src/ui/public/index_patterns/__tests__/index_patterns.js @@ -1,8 +1,8 @@ import ngMock from 'ng_mock'; import expect from 'expect.js'; import sinon from 'auto-release-sinon'; -import IndexPatternProvider from '../_index_pattern'; -import IndexPatternsProvider from '../index_patterns'; +import { IndexPatternProvider } from '../_index_pattern'; +import { IndexPatternsProvider } from '../index_patterns'; describe('IndexPatterns service', function () { let indexPatterns; @@ -14,7 +14,7 @@ describe('IndexPatterns service', function () { // prevent IndexPattern initialization from doing anything Private.stub( - require('../_index_pattern'), + IndexPatternProvider, function (...args) { const indexPattern = new IndexPattern(...args); sinon.stub(indexPattern, 'init', function () { diff --git a/src/ui/public/index_patterns/__tests__/intervals.js b/src/ui/public/index_patterns/__tests__/intervals.js index 2cfe690a6af5a..ec9bc22ce9a82 100644 --- a/src/ui/public/index_patterns/__tests__/intervals.js +++ b/src/ui/public/index_patterns/__tests__/intervals.js @@ -1,7 +1,7 @@ import moment from 'moment'; import expect from 'expect.js'; import ngMock from 'ng_mock'; -import IndexPatternsIntervalsProvider from 'ui/index_patterns/_intervals'; +import { IndexPatternsIntervalsProvider } from 'ui/index_patterns/_intervals'; describe('Index Patterns', function () { describe('interval.toIndexList()', function () { diff --git a/src/ui/public/index_patterns/_calculate_indices.js b/src/ui/public/index_patterns/_calculate_indices.js index 60778ce4f3d79..da5e65e9ee917 100644 --- a/src/ui/public/index_patterns/_calculate_indices.js +++ b/src/ui/public/index_patterns/_calculate_indices.js @@ -23,7 +23,7 @@ function omitIndicesWithoutTimeField(indices, timeFieldName) { return _.pick(indices, index => index.fields[timeFieldName]); } -export default function CalculateIndicesFactory(Promise, es) { +export function IndexPatternsCalculateIndicesProvider(es) { // Uses the field stats api to determine the names of indices that need to // be queried against that match the given pattern and fall within the diff --git a/src/ui/public/index_patterns/_cast_mapping_type.js b/src/ui/public/index_patterns/_cast_mapping_type.js index ffe53f258915a..9ae7c8fa60e08 100644 --- a/src/ui/public/index_patterns/_cast_mapping_type.js +++ b/src/ui/public/index_patterns/_cast_mapping_type.js @@ -1,5 +1,6 @@ -import IndexedArray from 'ui/indexed_array'; -export default function CastMappingTypeFn() { +import { IndexedArray } from 'ui/indexed_array'; + +export function IndexPatternsCastMappingTypeProvider() { castMappingType.types = new IndexedArray({ index: ['name'], diff --git a/src/ui/public/index_patterns/_enhance_fields_with_capabilities.js b/src/ui/public/index_patterns/_enhance_fields_with_capabilities.js index e15a065e9caed..8f8b404ccce99 100644 --- a/src/ui/public/index_patterns/_enhance_fields_with_capabilities.js +++ b/src/ui/public/index_patterns/_enhance_fields_with_capabilities.js @@ -1,7 +1,7 @@ import chrome from 'ui/chrome'; import _ from 'lodash'; -export default function ($http) { +export function EnhanceFieldsWithCapabilitiesProvider($http) { return function (fields, indices) { return $http.get(chrome.addBasePath(`/api/kibana/${indices}/field_capabilities`)) diff --git a/src/ui/public/index_patterns/_ensure_some.js b/src/ui/public/index_patterns/_ensure_some.js deleted file mode 100644 index c867224c128aa..0000000000000 --- a/src/ui/public/index_patterns/_ensure_some.js +++ /dev/null @@ -1,12 +0,0 @@ -export default function EnsureSomeIndexPatternsFn(Private, Notifier, $location, kbnUrl) { - return function ensureSomeIndexPatterns() { - return function promiseHandler(patterns) { - if (!patterns || patterns.length === 0) { - // notify.warning(new errors.NoDefinedIndexPatterns()); - kbnUrl.redirectPath('/management/kibana/index'); - } - - return patterns; - }; - }; -} diff --git a/src/ui/public/index_patterns/_field.js b/src/ui/public/index_patterns/_field.js index 1415008d0c882..f5fd3e434ffd5 100644 --- a/src/ui/public/index_patterns/_field.js +++ b/src/ui/public/index_patterns/_field.js @@ -1,10 +1,11 @@ import ObjDefine from 'ui/utils/obj_define'; -import IndexPatternsFieldFormatFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; -import IndexPatternsFieldTypesProvider from 'ui/index_patterns/_field_types'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldTypesProvider } from 'ui/index_patterns/_field_types'; import RegistryFieldFormatsProvider from 'ui/registry/field_formats'; -export default function FieldObjectProvider(Private, shortDotsFilter, $rootScope, Notifier) { + +export function IndexPatternsFieldProvider(Private, shortDotsFilter, $rootScope, Notifier) { const notify = new Notifier({ location: 'IndexPattern Field' }); - const FieldFormat = Private(IndexPatternsFieldFormatFieldFormatProvider); + const FieldFormat = Private(IndexPatternsFieldFormatProvider); const fieldTypes = Private(IndexPatternsFieldTypesProvider); const fieldFormats = Private(RegistryFieldFormatsProvider); diff --git a/src/ui/public/index_patterns/_field_format/content_types.js b/src/ui/public/index_patterns/_field_format/content_types.js index 4da552e024a1a..3a6840f337224 100644 --- a/src/ui/public/index_patterns/_field_format/content_types.js +++ b/src/ui/public/index_patterns/_field_format/content_types.js @@ -1,7 +1,8 @@ import _ from 'lodash'; import angular from 'angular'; import { getHighlightHtml } from 'ui/highlight'; -export default function contentTypesProvider() { + +export function IndexPatternsFieldFormatContentTypesProvider() { const types = { html: function (format, convert) { diff --git a/src/ui/public/index_patterns/_field_format/field_format.js b/src/ui/public/index_patterns/_field_format/field_format.js index 8a6bf156e59e8..cdec1c334ee69 100644 --- a/src/ui/public/index_patterns/_field_format/field_format.js +++ b/src/ui/public/index_patterns/_field_format/field_format.js @@ -1,6 +1,7 @@ import _ from 'lodash'; -import IndexPatternsFieldFormatContentTypesProvider from 'ui/index_patterns/_field_format/content_types'; -export default function FieldFormatClassProvider(config, $rootScope, Private) { +import { IndexPatternsFieldFormatContentTypesProvider } from 'ui/index_patterns/_field_format/content_types'; + +export function IndexPatternsFieldFormatProvider(config, $rootScope, Private) { const contentTypes = Private(IndexPatternsFieldFormatContentTypesProvider); function FieldFormat(params) { diff --git a/src/ui/public/index_patterns/_field_list.js b/src/ui/public/index_patterns/_field_list.js index 1e1149ef8e770..4db5ab63b2684 100644 --- a/src/ui/public/index_patterns/_field_list.js +++ b/src/ui/public/index_patterns/_field_list.js @@ -1,7 +1,8 @@ -import IndexedArray from 'ui/indexed_array'; +import { IndexedArray } from 'ui/indexed_array'; import _ from 'lodash'; -import IndexPatternsFieldProvider from 'ui/index_patterns/_field'; -export default function FieldListProvider(Private) { +import { IndexPatternsFieldProvider } from 'ui/index_patterns/_field'; + +export function IndexPatternsFieldListProvider(Private) { const Field = Private(IndexPatternsFieldProvider); _.class(FieldList).inherits(IndexedArray); diff --git a/src/ui/public/index_patterns/_field_types.js b/src/ui/public/index_patterns/_field_types.js index 8f47c05083996..f4264c3976028 100644 --- a/src/ui/public/index_patterns/_field_types.js +++ b/src/ui/public/index_patterns/_field_types.js @@ -1,5 +1,6 @@ -import IndexedArray from 'ui/indexed_array'; -export default function IndexPatternFieldTypes() { +import { IndexedArray } from 'ui/indexed_array'; + +export function IndexPatternsFieldTypesProvider() { return new IndexedArray({ index: ['name'], diff --git a/src/ui/public/index_patterns/_flatten_hit.js b/src/ui/public/index_patterns/_flatten_hit.js index 87eff457547f9..d2041cf81d2fb 100644 --- a/src/ui/public/index_patterns/_flatten_hit.js +++ b/src/ui/public/index_patterns/_flatten_hit.js @@ -2,7 +2,7 @@ import _ from 'lodash'; // Takes a hit, merges it with any stored/scripted fields, and with the metaFields // returns a flattened version -export default function FlattenHitProvider(config) { +export function IndexPatternsFlattenHitProvider(config) { let metaFields = config.get('metaFields'); config.watch('metaFields', value => { diff --git a/src/ui/public/index_patterns/_format_hit.js b/src/ui/public/index_patterns/_format_hit.js index 010492d760eac..c77c9803a6a3e 100644 --- a/src/ui/public/index_patterns/_format_hit.js +++ b/src/ui/public/index_patterns/_format_hit.js @@ -1,8 +1,8 @@ import _ from 'lodash'; // Takes a hit, merges it with any stored/scripted fields, and with the metaFields -// returns a formated version +// returns a formatted version -export default function (indexPattern, defaultFormat) { +export function formatHit(indexPattern, defaultFormat) { function convert(hit, val, fieldName) { const field = indexPattern.fields.byName[fieldName]; diff --git a/src/ui/public/index_patterns/_get_computed_fields.js b/src/ui/public/index_patterns/_get_computed_fields.js index 988597437e236..c1a9c89978429 100644 --- a/src/ui/public/index_patterns/_get_computed_fields.js +++ b/src/ui/public/index_patterns/_get_computed_fields.js @@ -1,7 +1,7 @@ import _ from 'lodash'; // Takes a hit, merges it with any stored/scripted fields, and with the metaFields // returns a flattened version -export default function () { +export function getComputedFields() { const self = this; const scriptFields = {}; let docvalueFields = []; diff --git a/src/ui/public/index_patterns/_get_ids.js b/src/ui/public/index_patterns/_get_ids.js index 1c4b3e78957b7..f5dd526a8ba26 100644 --- a/src/ui/public/index_patterns/_get_ids.js +++ b/src/ui/public/index_patterns/_get_ids.js @@ -1,13 +1,14 @@ import _ from 'lodash'; -export default function GetIndexPatternIdsFn(esAdmin, kbnIndex) { - // many places may require the id list, so we will cache it seperately - // didn't incorportate with the indexPattern cache to prevent id collisions. +export function IndexPatternsGetIdsProvider(esAdmin, kbnIndex) { + + // many places may require the id list, so we will cache it separately + // didn't incorporate with the indexPattern cache to prevent id collisions. let cachedPromise; const getIds = function () { if (cachedPromise) { - // retrun a clone of the cached response + // return a clone of the cached response return cachedPromise.then(function (cachedResp) { return _.clone(cachedResp); }); diff --git a/src/ui/public/index_patterns/_index_pattern.js b/src/ui/public/index_patterns/_index_pattern.js index a2ca581578f82..0f69002c40a79 100644 --- a/src/ui/public/index_patterns/_index_pattern.js +++ b/src/ui/public/index_patterns/_index_pattern.js @@ -1,20 +1,20 @@ import _ from 'lodash'; import { SavedObjectNotFound, DuplicateField } from 'ui/errors'; import angular from 'angular'; -import getComputedFields from 'ui/index_patterns/_get_computed_fields'; -import formatHit from 'ui/index_patterns/_format_hit'; +import { getComputedFields } from 'ui/index_patterns/_get_computed_fields'; +import { formatHit } from 'ui/index_patterns/_format_hit'; import RegistryFieldFormatsProvider from 'ui/registry/field_formats'; -import IndexPatternsGetIdsProvider from 'ui/index_patterns/_get_ids'; -import IndexPatternsMapperProvider from 'ui/index_patterns/_mapper'; -import IndexPatternsIntervalsProvider from 'ui/index_patterns/_intervals'; +import { IndexPatternsGetIdsProvider } from 'ui/index_patterns/_get_ids'; +import { IndexPatternsMapperProvider } from 'ui/index_patterns/_mapper'; +import { IndexPatternsIntervalsProvider } from 'ui/index_patterns/_intervals'; import { AdminDocSourceProvider } from 'ui/courier/data_source/admin_doc_source'; import UtilsMappingSetupProvider from 'ui/utils/mapping_setup'; -import IndexPatternsFieldListProvider from 'ui/index_patterns/_field_list'; -import IndexPatternsFlattenHitProvider from 'ui/index_patterns/_flatten_hit'; -import IndexPatternsCalculateIndicesProvider from 'ui/index_patterns/_calculate_indices'; -import IndexPatternsPatternCacheProvider from 'ui/index_patterns/_pattern_cache'; +import { IndexPatternsFieldListProvider } from 'ui/index_patterns/_field_list'; +import { IndexPatternsFlattenHitProvider } from 'ui/index_patterns/_flatten_hit'; +import { IndexPatternsCalculateIndicesProvider } from 'ui/index_patterns/_calculate_indices'; +import { IndexPatternsPatternCacheProvider } from 'ui/index_patterns/_pattern_cache'; -export default function IndexPatternFactory(Private, Notifier, config, kbnIndex, Promise, confirmModalPromise) { +export function IndexPatternProvider(Private, Notifier, config, kbnIndex, Promise, confirmModalPromise) { const fieldformats = Private(RegistryFieldFormatsProvider); const getIds = Private(IndexPatternsGetIdsProvider); const mapper = Private(IndexPatternsMapperProvider); diff --git a/src/ui/public/index_patterns/_intervals.js b/src/ui/public/index_patterns/_intervals.js index 9a1d850ad02b8..10ea40fa8268b 100644 --- a/src/ui/public/index_patterns/_intervals.js +++ b/src/ui/public/index_patterns/_intervals.js @@ -1,7 +1,8 @@ import _ from 'lodash'; import moment from 'moment'; -import IndexedArray from 'ui/indexed_array'; -export default function IndexNameIntervalsService(timefilter) { +import { IndexedArray } from 'ui/indexed_array'; + +export function IndexPatternsIntervalsProvider(timefilter) { const intervals = new IndexedArray({ index: ['name'], diff --git a/src/ui/public/index_patterns/_local_cache.js b/src/ui/public/index_patterns/_local_cache.js index 921d6031cb4cb..6356efe28f561 100644 --- a/src/ui/public/index_patterns/_local_cache.js +++ b/src/ui/public/index_patterns/_local_cache.js @@ -1,6 +1,6 @@ import angular from 'angular'; -export default function LocalCacheFactory() { +export function IndexPatternsLocalCacheProvider() { function LocalCache(opts) { opts = opts || {}; const _id = opts.id || function (o) { return '' + o; }; diff --git a/src/ui/public/index_patterns/_map_field.js b/src/ui/public/index_patterns/_map_field.js index 7b77db62654f1..6f847b7a49d84 100644 --- a/src/ui/public/index_patterns/_map_field.js +++ b/src/ui/public/index_patterns/_map_field.js @@ -1,6 +1,7 @@ import _ from 'lodash'; -import IndexPatternsCastMappingTypeProvider from 'ui/index_patterns/_cast_mapping_type'; -export default function MapFieldFn(Private, config) { +import { IndexPatternsCastMappingTypeProvider } from 'ui/index_patterns/_cast_mapping_type'; + +export function IndexPatternsMapFieldProvider(Private, config) { const castMappingType = Private(IndexPatternsCastMappingTypeProvider); /** diff --git a/src/ui/public/index_patterns/_mapper.js b/src/ui/public/index_patterns/_mapper.js index 781afd1bc83e7..6805eae5c0586 100644 --- a/src/ui/public/index_patterns/_mapper.js +++ b/src/ui/public/index_patterns/_mapper.js @@ -1,11 +1,12 @@ import { IndexPatternMissingIndices } from 'ui/errors'; import _ from 'lodash'; import moment from 'moment'; -import EnhanceFieldsWithCapabilitiesProvider from 'ui/index_patterns/_enhance_fields_with_capabilities'; -import IndexPatternsTransformMappingIntoFieldsProvider from 'ui/index_patterns/_transform_mapping_into_fields'; -import IndexPatternsPatternToWildcardProvider from 'ui/index_patterns/_pattern_to_wildcard'; -import IndexPatternsLocalCacheProvider from 'ui/index_patterns/_local_cache'; -export default function MapperService(Private, Promise, es, esAdmin, config, kbnIndex) { +import { EnhanceFieldsWithCapabilitiesProvider } from 'ui/index_patterns/_enhance_fields_with_capabilities'; +import { IndexPatternsTransformMappingIntoFieldsProvider } from 'ui/index_patterns/_transform_mapping_into_fields'; +import { IndexPatternsPatternToWildcardProvider } from 'ui/index_patterns/_pattern_to_wildcard'; +import { IndexPatternsLocalCacheProvider } from 'ui/index_patterns/_local_cache'; + +export function IndexPatternsMapperProvider(Private, Promise, es, esAdmin, config, kbnIndex) { const enhanceFieldsWithCapabilities = Private(EnhanceFieldsWithCapabilitiesProvider); const transformMappingIntoFields = Private(IndexPatternsTransformMappingIntoFieldsProvider); const patternToWildcard = Private(IndexPatternsPatternToWildcardProvider); diff --git a/src/ui/public/index_patterns/_pattern_cache.js b/src/ui/public/index_patterns/_pattern_cache.js index a2e5ead0338bf..89dda350c2f49 100644 --- a/src/ui/public/index_patterns/_pattern_cache.js +++ b/src/ui/public/index_patterns/_pattern_cache.js @@ -1,4 +1,4 @@ -export default function PatternCache() { +export function IndexPatternsPatternCacheProvider() { const vals = {}; diff --git a/src/ui/public/index_patterns/_pattern_to_wildcard.js b/src/ui/public/index_patterns/_pattern_to_wildcard.js index 81e0fa5adfa68..00b7ad2a96a07 100644 --- a/src/ui/public/index_patterns/_pattern_to_wildcard.js +++ b/src/ui/public/index_patterns/_pattern_to_wildcard.js @@ -1,4 +1,4 @@ -export default function PatternToWildcardFn() { +export function IndexPatternsPatternToWildcardProvider() { return function (format) { let wildcard = ''; let inEscape = false; diff --git a/src/ui/public/index_patterns/_transform_mapping_into_fields.js b/src/ui/public/index_patterns/_transform_mapping_into_fields.js index 48d6db416f4af..ae3ea77f36b89 100644 --- a/src/ui/public/index_patterns/_transform_mapping_into_fields.js +++ b/src/ui/public/index_patterns/_transform_mapping_into_fields.js @@ -1,8 +1,8 @@ import _ from 'lodash'; -import IndexPatternsMapFieldProvider from 'ui/index_patterns/_map_field'; +import { IndexPatternsMapFieldProvider } from 'ui/index_patterns/_map_field'; import { ConflictTracker } from 'ui/index_patterns/_conflict_tracker'; -export default function transformMappingIntoFields(Private, kbnIndex, config) { +export function IndexPatternsTransformMappingIntoFieldsProvider(Private, kbnIndex, config) { const mapField = Private(IndexPatternsMapFieldProvider); /** diff --git a/src/ui/public/index_patterns/index_patterns.js b/src/ui/public/index_patterns/index_patterns.js index 4ce7047674eff..be98df7d6a009 100644 --- a/src/ui/public/index_patterns/index_patterns.js +++ b/src/ui/public/index_patterns/index_patterns.js @@ -1,19 +1,19 @@ import 'ui/filters/short_dots'; import { IndexPatternMissingIndices } from 'ui/errors'; -import IndexPatternsIndexPatternProvider from 'ui/index_patterns/_index_pattern'; -import IndexPatternsPatternCacheProvider from 'ui/index_patterns/_pattern_cache'; -import IndexPatternsGetIdsProvider from 'ui/index_patterns/_get_ids'; -import IndexPatternsIntervalsProvider from 'ui/index_patterns/_intervals'; -import IndexPatternsMapperProvider from 'ui/index_patterns/_mapper'; -import IndexPatternsPatternToWildcardProvider from 'ui/index_patterns/_pattern_to_wildcard'; +import { IndexPatternProvider } from 'ui/index_patterns/_index_pattern'; +import { IndexPatternsPatternCacheProvider } from 'ui/index_patterns/_pattern_cache'; +import { IndexPatternsGetIdsProvider } from 'ui/index_patterns/_get_ids'; +import { IndexPatternsIntervalsProvider } from 'ui/index_patterns/_intervals'; +import { IndexPatternsMapperProvider } from 'ui/index_patterns/_mapper'; +import { IndexPatternsPatternToWildcardProvider } from 'ui/index_patterns/_pattern_to_wildcard'; import RegistryFieldFormatsProvider from 'ui/registry/field_formats'; import uiModules from 'ui/modules'; const module = uiModules.get('kibana/index_patterns'); -function IndexPatternsProvider(esAdmin, Notifier, Private, Promise, kbnIndex) { +export function IndexPatternsProvider(esAdmin, Notifier, Private, Promise, kbnIndex) { const self = this; - const IndexPattern = Private(IndexPatternsIndexPatternProvider); + const IndexPattern = Private(IndexPatternProvider); const patternCache = Private(IndexPatternsPatternCacheProvider); self.get = function (id) { @@ -52,4 +52,6 @@ function IndexPatternsProvider(esAdmin, Notifier, Private, Promise, kbnIndex) { } module.service('indexPatterns', Private => Private(IndexPatternsProvider)); + +// Used by x-pack. TODO: cleanup and remove. export default IndexPatternsProvider; diff --git a/src/ui/public/index_patterns/route_setup/load_default.js b/src/ui/public/index_patterns/route_setup/load_default.js index 7ee6f88c237cf..b45245a2563f9 100644 --- a/src/ui/public/index_patterns/route_setup/load_default.js +++ b/src/ui/public/index_patterns/route_setup/load_default.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import Notifier from 'ui/notify/notifier'; import { NoDefaultIndexPattern } from 'ui/errors'; -import GetIdsProvider from '../_get_ids'; +import { IndexPatternsGetIdsProvider } from '../_get_ids'; import uiRoutes from 'ui/routes'; const notify = new Notifier({ location: 'Index Patterns' @@ -14,7 +14,7 @@ module.exports = function (opts) { uiRoutes .addSetupWork(function loadDefaultIndexPattern(Private, Promise, $route, config) { - const getIds = Private(GetIdsProvider); + const getIds = Private(IndexPatternsGetIdsProvider); const route = _.get($route, 'current.$$route'); return getIds() diff --git a/src/ui/public/indexed_array/__tests__/indexed_array.js b/src/ui/public/indexed_array/__tests__/indexed_array.js index e31c0b9d29fc5..407967c9fc395 100644 --- a/src/ui/public/indexed_array/__tests__/indexed_array.js +++ b/src/ui/public/indexed_array/__tests__/indexed_array.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import expect from 'expect.js'; -import IndexedArray from 'ui/indexed_array'; +import { IndexedArray } from 'ui/indexed_array'; // this is generally a data-structure that IndexedArray is good for managing const users = [ diff --git a/src/ui/public/indexed_array/__tests__/inflector.js b/src/ui/public/indexed_array/__tests__/inflector.js index e7628ecf159fc..f5a91387c8bdf 100644 --- a/src/ui/public/indexed_array/__tests__/inflector.js +++ b/src/ui/public/indexed_array/__tests__/inflector.js @@ -1,4 +1,4 @@ -import inflector from 'ui/indexed_array/inflector'; +import { inflector } from 'ui/indexed_array/inflector'; import expect from 'expect.js'; describe('IndexedArray Inflector', function () { diff --git a/src/ui/public/indexed_array/indexed_array.js b/src/ui/public/indexed_array/indexed_array.js index 3f3325e2d3f7b..db7e083bab914 100644 --- a/src/ui/public/indexed_array/indexed_array.js +++ b/src/ui/public/indexed_array/indexed_array.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import inflector from 'ui/indexed_array/inflector'; +import { inflector } from 'ui/indexed_array/inflector'; const pathGetter = _(_.get).rearg(1, 0).ary(2); @@ -26,7 +26,7 @@ const OPT_NAMES = IndexedArray.OPT_NAMES = ['index', 'group', 'order', 'initialS * methods are also removed */ _.class(IndexedArray).inherits(Array); -function IndexedArray(config) { +export function IndexedArray(config) { IndexedArray.Super.call(this); // just to remind future us that this list is important @@ -154,5 +154,3 @@ IndexedArray.prototype.remove = function (predicate, context) { IndexedArray.prototype.toJSON = function () { return this.raw; }; - -export default IndexedArray; diff --git a/src/ui/public/indexed_array/inflector.js b/src/ui/public/indexed_array/inflector.js index e2ef5eca31cda..ad253749e966b 100644 --- a/src/ui/public/indexed_array/inflector.js +++ b/src/ui/public/indexed_array/inflector.js @@ -14,7 +14,7 @@ function endsWith(str, test) { return str.substr(str.length - test.length).toLowerCase() === test.toLowerCase(); } -function inflector(prefix, postfix) { +export function inflector(prefix, postfix) { return function inflect(key) { let inflected; @@ -40,5 +40,3 @@ function inflector(prefix, postfix) { return inflected; }; } - -export default inflector; diff --git a/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav.js b/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav.js index da2acc76510e4..372a0728594de 100644 --- a/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav.js +++ b/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav.js @@ -4,7 +4,7 @@ import { assign, pluck } from 'lodash'; import $ from 'jquery'; import '../kbn_top_nav'; -import KbnTopNavControllerProvider from '../kbn_top_nav_controller'; +import { KbnTopNavControllerProvider } from '../kbn_top_nav_controller'; describe('kbnTopNav directive', function () { let build; diff --git a/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav_controller.js b/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav_controller.js index 30467a6ac5292..6b0b24256daa5 100644 --- a/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav_controller.js +++ b/src/ui/public/kbn_top_nav/__tests__/kbn_top_nav_controller.js @@ -2,7 +2,7 @@ import ngMock from 'ng_mock'; import expect from 'expect.js'; import { pluck } from 'lodash'; import sinon from 'sinon'; -import KbnTopNavControllerProvider from '../kbn_top_nav_controller'; +import { KbnTopNavControllerProvider } from '../kbn_top_nav_controller'; describe('KbnTopNavController', function () { let KbnTopNavController; diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav.js b/src/ui/public/kbn_top_nav/kbn_top_nav.js index 04ce2641b23b0..cbefc0c12b1c4 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav.js +++ b/src/ui/public/kbn_top_nav/kbn_top_nav.js @@ -39,7 +39,7 @@ import 'ui/watch_multi'; import 'ui/directives/input_focus'; import uiModules from 'ui/modules'; import template from './kbn_top_nav.html'; -import KbnTopNavControllerProvider from './kbn_top_nav_controller'; +import { KbnTopNavControllerProvider } from './kbn_top_nav_controller'; import RegistryNavbarExtensionsProvider from 'ui/registry/navbar_extensions'; import './bread_crumbs/bread_crumbs'; diff --git a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js index 5e0fce1976960..7f2f3616273ef 100644 --- a/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js +++ b/src/ui/public/kbn_top_nav/kbn_top_nav_controller.js @@ -4,7 +4,7 @@ import chrome from 'ui/chrome'; import filterTemplate from 'ui/chrome/config/filter.html'; import intervalTemplate from 'ui/chrome/config/interval.html'; -export default function ($compile) { +export function KbnTopNavControllerProvider($compile) { return class KbnTopNavController { constructor(opts = []) { if (opts instanceof KbnTopNavController) { diff --git a/src/ui/public/management/__tests__/index.js b/src/ui/public/management/__tests__/index.js index d0316ca48472d..50a473ce6365a 100644 --- a/src/ui/public/management/__tests__/index.js +++ b/src/ui/public/management/__tests__/index.js @@ -1,7 +1,7 @@ import expect from 'expect.js'; -import management from 'ui/management'; -import ManagementSection from 'ui/management/section'; +import { management } from 'ui/management'; +import { ManagementSection } from 'ui/management/section'; describe('Management', () => { it('provides ManagementSection', () => { diff --git a/src/ui/public/management/__tests__/section.js b/src/ui/public/management/__tests__/section.js index ba1c84cade365..5853b1141cbe0 100644 --- a/src/ui/public/management/__tests__/section.js +++ b/src/ui/public/management/__tests__/section.js @@ -1,7 +1,7 @@ import expect from 'expect.js'; -import ManagementSection from 'ui/management/section'; -import IndexedArray from 'ui/indexed_array'; +import { ManagementSection } from 'ui/management/section'; +import { IndexedArray } from 'ui/indexed_array'; describe('ManagementSection', () => { describe('constructor', () => { diff --git a/src/ui/public/management/index.js b/src/ui/public/management/index.js index 55939d00a1b09..e039403a6d8a0 100644 --- a/src/ui/public/management/index.js +++ b/src/ui/public/management/index.js @@ -1,23 +1,24 @@ -import ManagementSection from './section'; +import { ManagementSection } from './section'; -const sections = new ManagementSection('management', { +export const management = new ManagementSection('management', { display: 'Management' }); // TODO: where should this live? -sections.register('data', { +management.register('data', { display: 'Connect Data', order: 0 }); -sections.register('elasticsearch', { +management.register('elasticsearch', { display: 'Elasticsearch', order: 10 }); -sections.register('kibana', { +management.register('kibana', { display: 'Kibana', order: 20, }); -export default sections; +// Default export style used in x-pack. TODO: convert to named and remove. +export default management; diff --git a/src/ui/public/management/section.js b/src/ui/public/management/section.js index 5df8558a7a735..fb1a57ec875ce 100644 --- a/src/ui/public/management/section.js +++ b/src/ui/public/management/section.js @@ -1,7 +1,7 @@ import { assign } from 'lodash'; -import IndexedArray from 'ui/indexed_array'; +import { IndexedArray } from 'ui/indexed_array'; -export default class ManagementSection { +export class ManagementSection { /** * @param {string} id diff --git a/src/ui/public/registry/_registry.js b/src/ui/public/registry/_registry.js index 6c0fe4c451739..9f0167bf0ffa1 100644 --- a/src/ui/public/registry/_registry.js +++ b/src/ui/public/registry/_registry.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import IndexedArray from 'ui/indexed_array'; +import { IndexedArray } from 'ui/indexed_array'; const notPropsOptNames = IndexedArray.OPT_NAMES.concat('constructor'); /** diff --git a/src/ui/public/stringify/__tests__/_conformance.js b/src/ui/public/stringify/__tests__/_conformance.js index 84c7561708828..f13d7c8351c56 100644 --- a/src/ui/public/stringify/__tests__/_conformance.js +++ b/src/ui/public/stringify/__tests__/_conformance.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import expect from 'expect.js'; import ngMock from 'ng_mock'; import RegistryFieldFormatsProvider from 'ui/registry/field_formats'; -import IndexPatternsFieldFormatFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; let fieldFormats; let FieldFormat; @@ -28,7 +28,7 @@ module.exports = describe('conformance', function () { beforeEach(ngMock.module('kibana')); beforeEach(ngMock.inject(function (Private, $injector) { fieldFormats = Private(RegistryFieldFormatsProvider); - FieldFormat = Private(IndexPatternsFieldFormatFieldFormatProvider); + FieldFormat = Private(IndexPatternsFieldFormatProvider); config = $injector.get('config'); })); diff --git a/src/ui/public/stringify/types/_numeral.js b/src/ui/public/stringify/types/_numeral.js index e4fb226cfac4c..1efddbb2afa61 100644 --- a/src/ui/public/stringify/types/_numeral.js +++ b/src/ui/public/stringify/types/_numeral.js @@ -1,6 +1,6 @@ import _ from 'lodash'; import 'ui/field_format_editor/numeral/numeral'; -import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; import { BoundToConfigObjProvider } from 'ui/bound_to_config_obj'; export default function AbstractNumeralFormatProvider(Private) { diff --git a/src/ui/public/stringify/types/boolean.js b/src/ui/public/stringify/types/boolean.js index 8c58300c503c7..8fc87cc9d5812 100644 --- a/src/ui/public/stringify/types/boolean.js +++ b/src/ui/public/stringify/types/boolean.js @@ -1,4 +1,4 @@ -import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; import _ from 'lodash'; export default function TruncateFormatProvider(Private) { diff --git a/src/ui/public/stringify/types/color.js b/src/ui/public/stringify/types/color.js index 8c1ea96de5cf6..79df72342f2ea 100644 --- a/src/ui/public/stringify/types/color.js +++ b/src/ui/public/stringify/types/color.js @@ -1,6 +1,6 @@ import 'ui/stringify/editors/color.less'; import _ from 'lodash'; -import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; import colorTemplate from 'ui/stringify/editors/color.html'; export default function ColorFormatProvider(Private) { diff --git a/src/ui/public/stringify/types/date.js b/src/ui/public/stringify/types/date.js index 2eeea95ee71f3..4928baca0fc80 100644 --- a/src/ui/public/stringify/types/date.js +++ b/src/ui/public/stringify/types/date.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import moment from 'moment'; import 'ui/field_format_editor/pattern/pattern'; -import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; import { BoundToConfigObjProvider } from 'ui/bound_to_config_obj'; import dateTemplate from 'ui/stringify/editors/date.html'; diff --git a/src/ui/public/stringify/types/duration.js b/src/ui/public/stringify/types/duration.js index 5e21ee239d381..237b2ca822ee2 100644 --- a/src/ui/public/stringify/types/duration.js +++ b/src/ui/public/stringify/types/duration.js @@ -1,6 +1,6 @@ import 'ui/stringify/editors/duration.less'; import moment from 'moment'; -import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; import durationTemplate from 'ui/stringify/editors/duration.html'; export default function DurationFormatProvider(Private) { diff --git a/src/ui/public/stringify/types/ip.js b/src/ui/public/stringify/types/ip.js index 97001c68a975a..509f44dd14e56 100644 --- a/src/ui/public/stringify/types/ip.js +++ b/src/ui/public/stringify/types/ip.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; export default function IpFormatProvider(Private) { const FieldFormat = Private(IndexPatternsFieldFormatProvider); diff --git a/src/ui/public/stringify/types/source.js b/src/ui/public/stringify/types/source.js index b3a722b485bff..931f0893f6f7b 100644 --- a/src/ui/public/stringify/types/source.js +++ b/src/ui/public/stringify/types/source.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import noWhiteSpace from 'ui/utils/no_white_space'; import angular from 'angular'; -import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; export default function _SourceFormatProvider(Private, shortDotsFilter) { const FieldFormat = Private(IndexPatternsFieldFormatProvider); const template = _.template(noWhiteSpace(require('ui/stringify/types/_source.html'))); diff --git a/src/ui/public/stringify/types/string.js b/src/ui/public/stringify/types/string.js index 3a60a898a847e..e5ec939ee107c 100644 --- a/src/ui/public/stringify/types/string.js +++ b/src/ui/public/stringify/types/string.js @@ -1,6 +1,6 @@ import _ from 'lodash'; import 'ui/field_format_editor/samples/samples'; -import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; export default function StringFormatProvider(Private) { const FieldFormat = Private(IndexPatternsFieldFormatProvider); diff --git a/src/ui/public/stringify/types/truncate.js b/src/ui/public/stringify/types/truncate.js index f93f5884cde55..3156b409751c6 100644 --- a/src/ui/public/stringify/types/truncate.js +++ b/src/ui/public/stringify/types/truncate.js @@ -1,6 +1,6 @@ import _ from 'lodash'; -import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; export default function TruncateFormatProvider(Private) { const FieldFormat = Private(IndexPatternsFieldFormatProvider); const omission = '...'; diff --git a/src/ui/public/stringify/types/url.js b/src/ui/public/stringify/types/url.js index 6a27d49a43332..3777445000d20 100644 --- a/src/ui/public/stringify/types/url.js +++ b/src/ui/public/stringify/types/url.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import 'ui/field_format_editor/pattern/pattern'; import 'ui/stringify/icons'; -import IndexPatternsFieldFormatProvider from 'ui/index_patterns/_field_format/field_format'; +import { IndexPatternsFieldFormatProvider } from 'ui/index_patterns/_field_format/field_format'; import urlTemplate from 'ui/stringify/editors/url.html'; import { getHighlightHtml } from 'ui/highlight'; diff --git a/src/ui/public/utils/brush_event.js b/src/ui/public/utils/brush_event.js index 7853fd32e0733..af37a3b8709b3 100644 --- a/src/ui/public/utils/brush_event.js +++ b/src/ui/public/utils/brush_event.js @@ -1,6 +1,7 @@ import _ from 'lodash'; import moment from 'moment'; -import buildRangeFilter from 'ui/filter_manager/lib/range'; +import { buildRangeFilter } from 'ui/filter_manager/lib/range'; + export default function brushEventProvider(timefilter) { return $state => { return event => { diff --git a/src/ui/public/vis/__tests__/_agg_configs.js b/src/ui/public/vis/__tests__/_agg_configs.js index 9b79cd6375344..b7da73b6f4673 100644 --- a/src/ui/public/vis/__tests__/_agg_configs.js +++ b/src/ui/public/vis/__tests__/_agg_configs.js @@ -8,10 +8,11 @@ import VisAggConfigProvider from 'ui/vis/agg_config'; import VisAggConfigsProvider from 'ui/vis/agg_configs'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; import VisSchemasProvider from 'ui/vis/schemas'; +import { IndexedArray } from 'ui/indexed_array'; + describe('AggConfigs', function () { let Vis; - let IndexedArray; let AggConfig; let AggConfigs; let SpiedAggConfig; @@ -34,7 +35,6 @@ describe('AggConfigs', function () { Vis = Private(VisProvider); SpiedAggConfig = Private(VisAggConfigProvider); AggConfigs = Private(VisAggConfigsProvider); - IndexedArray = require('ui/indexed_array'); indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); Schemas = Private(VisSchemasProvider); })); diff --git a/src/ui/public/vis/agg_configs.js b/src/ui/public/vis/agg_configs.js index 0797ceb8f4810..43ca7ac137476 100644 --- a/src/ui/public/vis/agg_configs.js +++ b/src/ui/public/vis/agg_configs.js @@ -8,7 +8,7 @@ */ import _ from 'lodash'; -import IndexedArray from 'ui/indexed_array'; +import { IndexedArray } from 'ui/indexed_array'; import VisAggConfigProvider from 'ui/vis/agg_config'; import AggTypesIndexProvider from 'ui/agg_types/index'; export default function AggConfigsFactory(Private) { diff --git a/src/ui/public/vis/components/tooltip/tooltip.js b/src/ui/public/vis/components/tooltip/tooltip.js index 51903c9d2c6b7..57bfaad87eaa7 100644 --- a/src/ui/public/vis/components/tooltip/tooltip.js +++ b/src/ui/public/vis/components/tooltip/tooltip.js @@ -1,6 +1,6 @@ import d3 from 'd3'; import _ from 'lodash'; -import Binder from 'ui/binder'; +import { Binder } from 'ui/binder'; import positionTooltip from './position_tooltip'; import $ from 'jquery'; diff --git a/src/ui/public/vis/schemas.js b/src/ui/public/vis/schemas.js index dcd7a5585b943..519a502b588ae 100644 --- a/src/ui/public/vis/schemas.js +++ b/src/ui/public/vis/schemas.js @@ -1,5 +1,5 @@ import _ from 'lodash'; -import IndexedArray from 'ui/indexed_array'; +import { IndexedArray } from 'ui/indexed_array'; import { AggTypesAggParamsProvider } from 'ui/agg_types/agg_params'; export default function VisTypeSchemasFactory(Private) { diff --git a/src/ui/public/vis_maps/maps_renderbot.js b/src/ui/public/vis_maps/maps_renderbot.js index 1a939392c35ff..2e935b736f746 100644 --- a/src/ui/public/vis_maps/maps_renderbot.js +++ b/src/ui/public/vis_maps/maps_renderbot.js @@ -2,7 +2,7 @@ import $ from 'jquery'; import _ from 'lodash'; import VisRenderbotProvider from 'ui/vis/renderbot'; import MapsVisTypeBuildChartDataProvider from 'ui/vislib_vis_type/build_chart_data'; -import FilterBarPushFilterProvider from 'ui/filter_bar/push_filter'; +import { FilterBarPushFilterProvider } from 'ui/filter_bar/push_filter'; import KibanaMap from './kibana_map'; import GeohashLayer from './geohash_layer'; import './lib/tilemap_settings'; diff --git a/src/ui/public/vislib/lib/handler.js b/src/ui/public/vislib/lib/handler.js index eadcae31ceb30..305fc4a3df6d7 100644 --- a/src/ui/public/vislib/lib/handler.js +++ b/src/ui/public/vislib/lib/handler.js @@ -2,7 +2,7 @@ import d3 from 'd3'; import _ from 'lodash'; import $ from 'jquery'; import { NoResults } from 'ui/errors'; -import Binder from 'ui/binder'; +import { Binder } from 'ui/binder'; import VislibLibLayoutLayoutProvider from './layout/layout'; import VislibLibChartTitleProvider from './chart_title'; import VislibLibAlertsProvider from './alerts'; diff --git a/src/ui/public/vislib/vis.js b/src/ui/public/vislib/vis.js index 702ca7c9ab688..0a56c90aba09e 100644 --- a/src/ui/public/vislib/vis.js +++ b/src/ui/public/vislib/vis.js @@ -1,6 +1,6 @@ import _ from 'lodash'; import d3 from 'd3'; -import Binder from 'ui/binder'; +import { Binder } from 'ui/binder'; import { KbnError } from 'ui/errors'; import { EventsProvider } from 'ui/events'; import { ResizeCheckerProvider } from 'ui/resize_checker'; diff --git a/src/ui/public/visualize/visualize_legend.js b/src/ui/public/visualize/visualize_legend.js index 7cc108816c2f4..bc733c6b6dc21 100644 --- a/src/ui/public/visualize/visualize_legend.js +++ b/src/ui/public/visualize/visualize_legend.js @@ -1,14 +1,14 @@ import _ from 'lodash'; import html from 'ui/visualize/visualize_legend.html'; import VislibLibDataProvider from 'ui/vislib/lib/data'; -import FilterBarFilterBarClickHandlerProvider from 'ui/filter_bar/filter_bar_click_handler'; +import { FilterBarClickHandlerProvider } from 'ui/filter_bar/filter_bar_click_handler'; import uiModules from 'ui/modules'; uiModules.get('kibana') .directive('visualizeLegend', function (Private, getAppState) { const Data = Private(VislibLibDataProvider); - const filterBarClickHandler = Private(FilterBarFilterBarClickHandlerProvider); + const filterBarClickHandler = Private(FilterBarClickHandlerProvider); return { restrict: 'E', diff --git a/src/utils/binder.js b/src/utils/binder.js index 92d132bf17b98..e82d6b7ecdf88 100644 --- a/src/utils/binder.js +++ b/src/utils/binder.js @@ -1,4 +1,4 @@ -export default class Binder { +export class BinderBase { constructor() { this.disposal = []; } diff --git a/src/utils/binder_for.js b/src/utils/binder_for.js index ac7adc465d8f4..cb0a3f42dd57b 100644 --- a/src/utils/binder_for.js +++ b/src/utils/binder_for.js @@ -1,6 +1,6 @@ -import Binder from './binder'; +import { BinderBase } from './binder'; -export default class BinderFor extends Binder { +export default class BinderFor extends BinderBase { constructor(emitter) { super(); this.emitter = emitter; @@ -10,3 +10,4 @@ export default class BinderFor extends Binder { super.on(this.emitter, ...args); } } + diff --git a/src/utils/index.js b/src/utils/index.js index 1bf0a82264199..2a6bc33298ed8 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,4 +1,4 @@ -export Binder from './binder'; +export { BinderBase } from './binder'; export BinderFor from './binder_for'; export deepCloneWithBuffers from './deep_clone_with_buffers'; export fromRoot from './from_root';