Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert default to named exports: ui/public/agg_response/* #10987

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core_plugins/kbn_vislib_vis_types/public/tile_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import supports from 'ui/utils/supports';
import VisVisTypeProvider from 'ui/vis/vis_type';
import MapsVisTypeVislibVisTypeProvider from 'ui/vis_maps/maps_vis_type';
import VisSchemasProvider from 'ui/vis/schemas';
import AggResponseGeoJsonGeoJsonProvider from 'ui/agg_response/geo_json/geo_json';
import { AggResponseGeoJsonProvider } from 'ui/agg_response/geo_json/geo_json';
import tileMapTemplate from 'plugins/kbn_vislib_vis_types/editors/tile_map.html';
import image from './images/icon-tilemap.svg';

export default function TileMapVisType(Private, getAppState, courier, config) {
const VisType = Private(VisVisTypeProvider);
const MapsVisType = Private(MapsVisTypeVislibVisTypeProvider);
const Schemas = Private(VisSchemasProvider);
const geoJsonConverter = Private(AggResponseGeoJsonGeoJsonProvider);
const geoJsonConverter = Private(AggResponseGeoJsonProvider);

return new MapsVisType({
name: 'tile_map',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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 AggTypesBucketsIntervalOptionsProvider from 'ui/agg_types/buckets/_interval_options';
import { AggTypesBucketsIntervalOptionsProvider } from 'ui/agg_types/buckets/_interval_options';
import stateMonitorFactory from 'ui/state_management/state_monitor_factory';
import uiRoutes from 'ui/routes';
import uiModules from 'ui/modules';
Expand Down
4 changes: 2 additions & 2 deletions src/core_plugins/metric_vis/public/metric_vis_controller.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import AggResponseTabifyTabifyProvider from 'ui/agg_response/tabify/tabify';
import { AggResponseTabifyProvider } from 'ui/agg_response/tabify/tabify';
import uiModules from 'ui/modules';
// get the kibana/metric_vis module, and make sure that it requires the "kibana" module if it
// didn't already
const module = uiModules.get('kibana/metric_vis', ['kibana']);

module.controller('KbnMetricVisController', function ($scope, $element, Private) {
const tabifyAggResponse = Private(AggResponseTabifyTabifyProvider);
const tabifyAggResponse = Private(AggResponseTabifyProvider);

const metrics = $scope.metrics = [];

Expand Down
4 changes: 2 additions & 2 deletions src/core_plugins/spy_modes/public/table_spy_mode.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'ui/agg_table';
import AggResponseTabifyTabifyProvider from 'ui/agg_response/tabify/tabify';
import { AggResponseTabifyProvider } from 'ui/agg_response/tabify/tabify';
import tableSpyModeTemplate from 'plugins/spy_modes/table_spy_mode.html';
import spyModesRegistry from 'ui/registry/spy_modes';

function VisSpyTableProvider(Notifier, $filter, $rootScope, config, Private) {
const tabifyAggResponse = Private(AggResponseTabifyTabifyProvider);
const tabifyAggResponse = Private(AggResponseTabifyProvider);
const PER_PAGE_DEFAULT = 10;

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import _ from 'lodash';
import expect from 'expect.js';
import ngMock from 'ng_mock';
import sinon from 'auto-release-sinon';
import tabifyPm from 'ui/agg_response/tabify/tabify';
import { AggResponseTabifyProvider } from 'ui/agg_response/tabify/tabify';
import VisProvider from 'ui/vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import StateManagementAppStateProvider from 'ui/state_management/app_state';
Expand Down Expand Up @@ -135,8 +135,8 @@ describe('Controller', function () {

it('passes partialRows:true to tabify based on the vis params', function () {
// spy on the tabify private module
const spiedTabify = sinon.spy(Private(tabifyPm));
Private.stub(tabifyPm, spiedTabify);
const spiedTabify = sinon.spy(Private(AggResponseTabifyProvider));
Private.stub(AggResponseTabifyProvider, spiedTabify);

const vis = new OneRangeVis({ showPartialRows: true });
initController(vis);
Expand All @@ -148,8 +148,8 @@ describe('Controller', function () {

it('passes partialRows:false to tabify based on the vis params', function () {
// spy on the tabify private module
const spiedTabify = sinon.spy(Private(tabifyPm));
Private.stub(tabifyPm, spiedTabify);
const spiedTabify = sinon.spy(Private(AggResponseTabifyProvider));
Private.stub(AggResponseTabifyProvider, spiedTabify);

const vis = new OneRangeVis({ showPartialRows: false });
initController(vis);
Expand All @@ -161,8 +161,8 @@ describe('Controller', function () {

it('passes partialRows:true to tabify based on the vis params', function () {
// spy on the tabify private module
const spiedTabify = sinon.spy(Private(tabifyPm));
Private.stub(tabifyPm, spiedTabify);
const spiedTabify = sinon.spy(Private(AggResponseTabifyProvider));
Private.stub(AggResponseTabifyProvider, spiedTabify);

const vis = new OneRangeVis({ showPartialRows: true });
initController(vis);
Expand All @@ -174,8 +174,8 @@ describe('Controller', function () {

it('passes partialRows:false to tabify based on the vis params', function () {
// spy on the tabify private module
const spiedTabify = sinon.spy(Private(tabifyPm));
Private.stub(tabifyPm, spiedTabify);
const spiedTabify = sinon.spy(Private(AggResponseTabifyProvider));
Private.stub(AggResponseTabifyProvider, spiedTabify);

const vis = new OneRangeVis({ showPartialRows: false });
initController(vis);
Expand Down
4 changes: 2 additions & 2 deletions src/core_plugins/table_vis/public/table_vis_controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AggResponseTabifyTabifyProvider from 'ui/agg_response/tabify/tabify';
import { AggResponseTabifyProvider } from 'ui/agg_response/tabify/tabify';
import uiModules from 'ui/modules';
import { assign } from 'lodash';

Expand All @@ -9,7 +9,7 @@ const module = uiModules.get('kibana/table_vis', ['kibana']);
// add a controller to tha module, which will transform the esResponse into a
// tabular format that we can pass to the table directive
module.controller('KbnTableVisController', function ($scope, $element, Private) {
const tabifyAggResponse = Private(AggResponseTabifyTabifyProvider);
const tabifyAggResponse = Private(AggResponseTabifyProvider);

const uiStateSort = ($scope.uiState) ? $scope.uiState.get('vis.params.sort') : {};
assign($scope.vis.params.sort, uiStateSort);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/__tests__/metadata.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import expect from 'expect.js';
import metadata from 'ui/metadata';
import { metadata } from 'ui/metadata';
describe('ui/metadata', () => {


Expand Down
8 changes: 4 additions & 4 deletions src/ui/public/agg_response/geo_json/__tests__/geo_json.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import ngMock from 'ng_mock';
import VisProvider from 'ui/vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import FixturesAggRespGeohashGridProvider from 'fixtures/agg_resp/geohash_grid';
import AggResponseTabifyTabifyProvider from 'ui/agg_response/tabify/tabify';
import AggResponseGeoJsonGeoJsonProvider from 'ui/agg_response/geo_json/geo_json';
import { AggResponseTabifyProvider } from 'ui/agg_response/tabify/tabify';
import { AggResponseGeoJsonProvider } from 'ui/agg_response/geo_json/geo_json';

describe('GeoJson Agg Response Converter', function () {
let vis;
Expand All @@ -21,8 +21,8 @@ describe('GeoJson Agg Response Converter', function () {
const indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);

esResponse = Private(FixturesAggRespGeohashGridProvider);
tabify = Private(AggResponseTabifyTabifyProvider);
convert = Private(AggResponseGeoJsonGeoJsonProvider);
tabify = Private(AggResponseTabifyProvider);
convert = Private(AggResponseGeoJsonProvider);

vis = new Vis(indexPattern, {
type: 'tile_map',
Expand Down
3 changes: 2 additions & 1 deletion src/ui/public/agg_response/geo_json/_tooltip_formatter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import $ from 'jquery';
import _ from 'lodash';
import RegistryFieldFormatsProvider from 'ui/registry/field_formats';
export default function TileMapTooltipFormatter($compile, $rootScope, Private) {

export function TileMapTooltipFormatterProvider($compile, $rootScope, Private) {

const fieldFormats = Private(RegistryFieldFormatsProvider);
const $tooltipScope = $rootScope.$new();
Expand Down
11 changes: 6 additions & 5 deletions src/ui/public/agg_response/geo_json/geo_json.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import _ from 'lodash';
import rowsToFeatures from 'ui/agg_response/geo_json/rows_to_features';
import AggResponseGeoJsonTooltipFormatterProvider from 'ui/agg_response/geo_json/_tooltip_formatter';
export default function TileMapConverterFn(Private) {
import { convertRowsToFeatures } from 'ui/agg_response/geo_json/rows_to_features';
import { TileMapTooltipFormatterProvider } from 'ui/agg_response/geo_json/_tooltip_formatter';

const tooltipFormatter = Private(AggResponseGeoJsonTooltipFormatterProvider);
export function AggResponseGeoJsonProvider(Private) {

const tooltipFormatter = Private(TileMapTooltipFormatterProvider);

return function (vis, table) {

Expand All @@ -20,7 +21,7 @@ export default function TileMapConverterFn(Private) {
const geoAgg = _.get(table.columns, [geoI, 'aggConfig']);
const metricAgg = _.get(table.columns, [metricI, 'aggConfig']);

const features = rowsToFeatures(table, geoI, metricI, centroidI);
const features = convertRowsToFeatures(table, geoI, metricI, centroidI);
const values = features.map(function (feature) {
return feature.properties.value;
});
Expand Down
4 changes: 1 addition & 3 deletions src/ui/public/agg_response/geo_json/rows_to_features.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function unwrap(val) {
return getAcr(val) ? val.value : val;
}

function convertRowsToFeatures(table, geoI, metricI, centroidI) {
export function convertRowsToFeatures(table, geoI, metricI, centroidI) {

return _.transform(table.rows, function (features, row) {
const geohash = unwrap(row[geoI]);
Expand Down Expand Up @@ -60,5 +60,3 @@ function convertRowsToFeatures(table, geoI, metricI, centroidI) {
});
}, []);
}

export default convertRowsToFeatures;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import arrayToLinkedList from 'ui/agg_response/hierarchical/_array_to_linked_list';
import { arrayToLinkedList } from 'ui/agg_response/hierarchical/_array_to_linked_list';
import expect from 'expect.js';
describe('buildHierarchicalData()', function () {
describe('arrayToLinkedList', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import expect from 'expect.js';
import ngMock from 'ng_mock';
import VisProvider from 'ui/vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import AggResponseHierarchicalBuildHierarchicalDataProvider from 'ui/agg_response/hierarchical/build_hierarchical_data';
import { BuildHierarchicalDataProvider } from 'ui/agg_response/hierarchical/build_hierarchical_data';

let Vis;
let Notifier;
Expand All @@ -23,7 +23,7 @@ describe('buildHierarchicalData', function () {

Vis = Private(VisProvider);
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
buildHierarchicalData = Private(AggResponseHierarchicalBuildHierarchicalDataProvider);
buildHierarchicalData = Private(BuildHierarchicalDataProvider);
}));


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import _ from 'lodash';
import fixtures from 'fixtures/fake_hierarchical_data';
import createRawData from 'ui/agg_response/hierarchical/_create_raw_data';
import arrayToLinkedList from 'ui/agg_response/hierarchical/_array_to_linked_list';
import { createRawData } from 'ui/agg_response/hierarchical/_create_raw_data';
import { arrayToLinkedList } from 'ui/agg_response/hierarchical/_array_to_linked_list';
import expect from 'expect.js';
import ngMock from 'ng_mock';
import VisProvider from 'ui/vis';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import extractBuckets from 'ui/agg_response/hierarchical/_extract_buckets';
import { extractBuckets } from 'ui/agg_response/hierarchical/_extract_buckets';
import expect from 'expect.js';

describe('buildHierarchicalData()', function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'lodash';
import expect from 'expect.js';
import ngMock from 'ng_mock';
import AggResponseHierarchicalTransformAggregationProvider from 'ui/agg_response/hierarchical/_transform_aggregation';
import { HierarchicalTransformAggregationProvider } from 'ui/agg_response/hierarchical/_transform_aggregation';

describe('buildHierarchicalData()', function () {
describe('transformAggregation()', function () {
Expand All @@ -10,7 +10,7 @@ describe('buildHierarchicalData()', function () {

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
transform = Private(AggResponseHierarchicalTransformAggregationProvider);
transform = Private(HierarchicalTransformAggregationProvider);
}));

beforeEach(function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
export default function (buckets) {
export function arrayToLinkedList(buckets) {
let previous;
_.each(buckets, function (bucket) {
if (previous) {
Expand Down
9 changes: 5 additions & 4 deletions src/ui/public/agg_response/hierarchical/_build_split.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import collectKeys from 'ui/agg_response/hierarchical/_collect_keys';
import AggResponseHierarchicalTransformAggregationProvider from 'ui/agg_response/hierarchical/_transform_aggregation';
export default function biuldSplitProvider(Private) {
const transformer = Private(AggResponseHierarchicalTransformAggregationProvider);
import { collectKeys } from 'ui/agg_response/hierarchical/_collect_keys';
import { HierarchicalTransformAggregationProvider } from 'ui/agg_response/hierarchical/_transform_aggregation';

export function AggResponseHierarchicalBuildSplitProvider(Private) {
const transformer = Private(HierarchicalTransformAggregationProvider);
return function (agg, metric, aggData) {
// Ceate the split structure
const split = { label: '', slices: { children: [] } };
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/agg_response/hierarchical/_collect_keys.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
export default function collectKeys(children) {
export function collectKeys(children) {
const nextChildren = _.pluck(children, 'children');
const keys = _.pluck(children, 'name');
return _(nextChildren)
Expand Down
5 changes: 3 additions & 2 deletions src/ui/public/agg_response/hierarchical/_create_raw_data.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import _ from 'lodash';
import extractBuckets from 'ui/agg_response/hierarchical/_extract_buckets';
export default function (vis, resp) {
import { extractBuckets } from 'ui/agg_response/hierarchical/_extract_buckets';

export function createRawData(vis, resp) {

// Create the initial results structure
const results = { rows: [] };
Expand Down
3 changes: 2 additions & 1 deletion src/ui/public/agg_response/hierarchical/_extract_buckets.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import _ from 'lodash';
export default function (bucket, agg) {

export function extractBuckets(bucket, agg) {
if (bucket && _.isPlainObject(bucket.buckets)) {
return _.map(bucket.buckets, function (value, key) {
const item = _.cloneDeep(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import _ from 'lodash';
import $ from 'jquery';
import collectBranch from 'ui/agg_response/hierarchical/_collect_branch';
import numeral from 'numeral';
export default function HierarchicalTooltipFormaterProvider($rootScope, $compile, $sce) {

export function HierarchicalTooltipFormatterProvider($rootScope, $compile, $sce) {
const $tooltip = $(require('ui/agg_response/hierarchical/_tooltip.html'));
const $tooltipScope = $rootScope.$new();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import _ from 'lodash';
import extractBuckets from 'ui/agg_response/hierarchical/_extract_buckets';
import { extractBuckets } from 'ui/agg_response/hierarchical/_extract_buckets';
import AggConfigResult from 'ui/vis/agg_config_result';
export default function transformAggregationProvider() {

export function HierarchicalTransformAggregationProvider() {
return function transformAggregation(agg, metric, aggData, parent) {
return _.map(extractBuckets(aggData, agg), function (bucket) {
const aggConfigResult = new AggConfigResult(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import _ from 'lodash';
import extractBuckets from 'ui/agg_response/hierarchical/_extract_buckets';
import createRawData from 'ui/agg_response/hierarchical/_create_raw_data';
import arrayToLinkedList from 'ui/agg_response/hierarchical/_array_to_linked_list';
import { extractBuckets } from 'ui/agg_response/hierarchical/_extract_buckets';
import { createRawData } from 'ui/agg_response/hierarchical/_create_raw_data';
import { arrayToLinkedList } from 'ui/agg_response/hierarchical/_array_to_linked_list';
import AggConfigResult from 'ui/vis/agg_config_result';
import AggResponseHierarchicalBuildSplitProvider from 'ui/agg_response/hierarchical/_build_split';
import AggResponseHierarchicalHierarchicalTooltipFormatterProvider from 'ui/agg_response/hierarchical/_hierarchical_tooltip_formatter';
export default function buildHierarchicalDataProvider(Private, Notifier) {
import { AggResponseHierarchicalBuildSplitProvider } from 'ui/agg_response/hierarchical/_build_split';
import { HierarchicalTooltipFormatterProvider } from 'ui/agg_response/hierarchical/_hierarchical_tooltip_formatter';

export function BuildHierarchicalDataProvider(Private, Notifier) {
const buildSplit = Private(AggResponseHierarchicalBuildSplitProvider);
const tooltipFormatter = Private(AggResponseHierarchicalHierarchicalTooltipFormatterProvider);
const tooltipFormatter = Private(HierarchicalTooltipFormatterProvider);


const notify = new Notifier({
Expand Down
18 changes: 9 additions & 9 deletions src/ui/public/agg_response/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import AggResponseHierarchicalBuildHierarchicalDataProvider from 'ui/agg_response/hierarchical/build_hierarchical_data';
import AggResponsePointSeriesPointSeriesProvider from 'ui/agg_response/point_series/point_series';
import AggResponseTabifyTabifyProvider from 'ui/agg_response/tabify/tabify';
import AggResponseGeoJsonGeoJsonProvider from 'ui/agg_response/geo_json/geo_json';
import { BuildHierarchicalDataProvider } from 'ui/agg_response/hierarchical/build_hierarchical_data';
import { AggResponsePointSeriesProvider } from 'ui/agg_response/point_series/point_series';
import { AggResponseTabifyProvider } from 'ui/agg_response/tabify/tabify';
import { AggResponseGeoJsonProvider } from 'ui/agg_response/geo_json/geo_json';

export default function NormalizeChartDataFactory(Private) {
export function AggResponseIndexProvider(Private) {
return {
hierarchical: Private(AggResponseHierarchicalBuildHierarchicalDataProvider),
pointSeries: Private(AggResponsePointSeriesPointSeriesProvider),
tabify: Private(AggResponseTabifyTabifyProvider),
geoJson: Private(AggResponseGeoJsonGeoJsonProvider)
hierarchical: Private(BuildHierarchicalDataProvider),
pointSeries: Private(AggResponsePointSeriesProvider),
tabify: Private(AggResponseTabifyProvider),
geoJson: Private(AggResponseGeoJsonProvider)
};
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import expect from 'expect.js';
import ngMock from 'ng_mock';
import AggResponsePointSeriesAddToSiriProvider from 'ui/agg_response/point_series/_add_to_siri';
import { PointSeriesAddToSiriProvider } from 'ui/agg_response/point_series/_add_to_siri';

describe('addToSiri', function () {
let addToSiri;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
addToSiri = Private(AggResponsePointSeriesAddToSiriProvider);
addToSiri = Private(PointSeriesAddToSiriProvider);
}));

it('creates a new series the first time it sees an id', function () {
Expand Down
Loading