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

Default to named export conversion: Courier #11165

Merged
merged 2 commits into from
Apr 13, 2017
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
3 changes: 2 additions & 1 deletion src/ui/public/agg_types/buckets/filters.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import _ from 'lodash';
import angular from 'angular';

import { AggTypesBucketsBucketAggTypeProvider } from 'ui/agg_types/buckets/_bucket_agg_type';
import { AggTypesBucketsCreateFilterFiltersProvider } from 'ui/agg_types/buckets/create_filter/filters';
import DecorateQueryProvider from 'ui/courier/data_source/_decorate_query';
import { DecorateQueryProvider } from 'ui/courier/data_source/_decorate_query';
import filtersTemplate from 'ui/agg_types/controls/filters.html';

export function AggTypesBucketsFiltersProvider(Private, Notifier) {
Expand Down
12 changes: 6 additions & 6 deletions src/ui/public/courier/__tests__/request_queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import ngMock from 'ng_mock';
import expect from 'expect.js';
import sinon from 'auto-release-sinon';

import RequestQueueProv from '../_request_queue';
import SearchStrategyProv from '../fetch/strategy/search';
import DocStrategyProv from '../fetch/strategy/doc_data';
import { RequestQueueProvider } from '../_request_queue';
import { SearchStrategyProvider } from '../fetch/strategy/search';
import { DocDataStrategyProvider } from '../fetch/strategy/doc_data';

describe('Courier Request Queue', function () {
let docStrategy;
Expand All @@ -13,9 +13,9 @@ describe('Courier Request Queue', function () {

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
docStrategy = Private(DocStrategyProv);
requestQueue = Private(RequestQueueProv);
searchStrategy = Private(SearchStrategyProv);
docStrategy = Private(DocDataStrategyProvider);
requestQueue = Private(RequestQueueProvider);
searchStrategy = Private(SearchStrategyProvider);
}));

class MockReq {
Expand Down
8 changes: 4 additions & 4 deletions src/ui/public/courier/__tests__/saved_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import expect from 'expect.js';
import sinon from 'auto-release-sinon';
import BluebirdPromise from 'bluebird';

import SavedObjectFactory from '../saved_object/saved_object';
import { SavedObjectProvider } from '../saved_object/saved_object';
import IndexPatternFactory from 'ui/index_patterns/_index_pattern';
import DocSourceProvider from '../data_source/admin_doc_source';
import { AdminDocSourceProvider } from '../data_source/admin_doc_source';

import { stubMapper } from 'test_utils/stub_mapper';

Expand Down Expand Up @@ -97,11 +97,11 @@ describe('Saved Object', function () {
);

beforeEach(ngMock.inject(function (es, esAdmin, Private, $window) {
SavedObject = Private(SavedObjectFactory);
SavedObject = Private(SavedObjectProvider);
IndexPattern = Private(IndexPatternFactory);
esAdminStub = esAdmin;
esDataStub = es;
DocSource = Private(DocSourceProvider);
DocSource = Private(AdminDocSourceProvider);
window = $window;

mockEsService();
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/courier/_error_handlers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function ErrorHandlerList() {
export function ErrorHandlersProvider() {
/**
* Queue of pending error handlers, they are removed as
* they are resolved.
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/courier/_redirect_when_missing.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SavedObjectNotFound } from 'ui/errors';

export default function RedirectWhenMissingFn($location, kbnUrl, Notifier, Promise) {
export function RedirectWhenMissingProvider($location, kbnUrl, Notifier, Promise) {
const notify = new Notifier();

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/courier/_request_queue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function PendingRequestList() {
export function RequestQueueProvider() {

/**
* Queue of pending requests, requests are removed as
Expand Down
22 changes: 11 additions & 11 deletions src/ui/public/courier/courier.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import 'ui/index_patterns';
import uiModules from 'ui/modules';
import Notifier from 'ui/notify/notifier';

import DocSourceProvider from './data_source/doc_source';
import SearchSourceProvider from './data_source/search_source';
import SearchStrategyProvider from './fetch/strategy/search';
import RequestQueueProvider from './_request_queue';
import FetchProvider from './fetch';
import DocDataLooperProvider from './looper/doc_data';
import DocAdminLooperProvider from './looper/doc_admin';
import SearchLooperProvider from './looper/search';
import RootSearchSourceProvider from './data_source/_root_search_source';
import SavedObjectProvider from './saved_object';
import RedirectWhenMissingProvider from './_redirect_when_missing';
import { DocSourceProvider } from './data_source/doc_source';
import { SearchSourceProvider } from './data_source/search_source';
import { SearchStrategyProvider } from './fetch/strategy/search';
import { RequestQueueProvider } from './_request_queue';
import { FetchProvider } from './fetch';
import { DocDataLooperProvider } from './looper/doc_data';
import { DocAdminLooperProvider } from './looper/doc_admin';
import { SearchLooperProvider } from './looper/search';
import { RootSearchSourceProvider } from './data_source/_root_search_source';
import { SavedObjectProvider } from './saved_object';
import { RedirectWhenMissingProvider } from './_redirect_when_missing';


uiModules.get('kibana/courier')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import expect from 'expect.js';
import ngMock from 'ng_mock';
import DecorateQueryProvider from 'ui/courier/data_source/_decorate_query';
import { DecorateQueryProvider } from 'ui/courier/data_source/_decorate_query';

describe('Query decorator', function () {
let config;
Expand Down
8 changes: 4 additions & 4 deletions src/ui/public/courier/data_source/__tests__/doc_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import ngMock from 'ng_mock';
import expect from 'expect.js';
import sinon from 'auto-release-sinon';

import RequestQueueProv from '../../_request_queue';
import DocSourceProv from '../doc_source';
import { RequestQueueProvider } from '../../_request_queue';
import { DocSourceProvider } from '../doc_source';

describe('DocSource', function () {
require('test_utils/no_digest_promises').activateForSuite();
Expand All @@ -13,8 +13,8 @@ describe('DocSource', function () {

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
requestQueue = Private(RequestQueueProv);
DocSource = Private(DocSourceProv);
requestQueue = Private(RequestQueueProvider);
DocSource = Private(DocSourceProvider);
}));

describe('#onUpdate()', function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'ui/private';
import ngMock from 'ng_mock';
import expect from 'expect.js';
import NormalizeSortRequestProvider from 'ui/courier/data_source/_normalize_sort_request';
import { NormalizeSortRequestProvider } from 'ui/courier/data_source/_normalize_sort_request';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import _ from 'lodash';

Expand Down
8 changes: 4 additions & 4 deletions src/ui/public/courier/data_source/__tests__/search_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import ngMock from 'ng_mock';
import expect from 'expect.js';
import sinon from 'auto-release-sinon';

import RequestQueueProv from '../../_request_queue';
import SearchSourceProv from '../search_source';
import { RequestQueueProvider } from '../../_request_queue';
import { SearchSourceProvider } from '../search_source';
import StubIndexPatternProv from 'test_utils/stub_index_pattern';

describe('SearchSource', function () {
Expand All @@ -16,8 +16,8 @@ describe('SearchSource', function () {

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
requestQueue = Private(RequestQueueProv);
SearchSource = Private(SearchSourceProv);
requestQueue = Private(RequestQueueProvider);
SearchSource = Private(SearchSourceProvider);

const IndexPattern = Private(StubIndexPatternProv);
indexPattern = new IndexPattern('test-*', null, []);
Expand Down
10 changes: 5 additions & 5 deletions src/ui/public/courier/data_source/_abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import angular from 'angular';

import 'ui/promises';

import RequestQueueProvider from '../_request_queue';
import ErrorHandlersProvider from '../_error_handlers';
import FetchProvider from '../fetch';
import DecorateQueryProvider from './_decorate_query';
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 { getHighlightRequestProvider } from '../../highlight';

export default function SourceAbstractFactory(Private, Promise, PromiseEmitter) {
export function AbstractDataSourceProvider(Private, Promise, PromiseEmitter) {
const requestQueue = Private(RequestQueueProvider);
const errorHandlers = Private(ErrorHandlersProvider);
const courierFetch = Private(FetchProvider);
Expand Down
10 changes: 5 additions & 5 deletions src/ui/public/courier/data_source/_abstract_doc_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import _ from 'lodash';
import 'ui/es';
import 'ui/storage';

import DocSendToEsProvider from './_doc_send_to_es';
import AbstractDataSourceProvider from './_abstract';
import DocRequestProvider from '../fetch/request/_abstract_doc';
import { DocSendToEsProvider } from './_doc_send_to_es';
import { AbstractDataSourceProvider } from './_abstract';
import { AbstractDocRequestProvider } from '../fetch/request/_abstract_doc';

export default function AbstractDocSourceFactory(Private, Promise, es, sessionStorage) {
export function AbstractDocSourceProvider(Private, Promise, es, sessionStorage) {
const sendToEs = Private(DocSendToEsProvider);
const SourceAbstract = Private(AbstractDataSourceProvider);
const DocRequest = Private(DocRequestProvider);
const DocRequest = Private(AbstractDocRequestProvider);

_.class(AbstractDocSource).inherits(SourceAbstract);
function AbstractDocSource(initialState, strategy) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/courier/data_source/_decorate_query.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';

export default function DecorateQuery(config) {
export function DecorateQueryProvider(config) {
/**
* Decorate queries with default parameters
* @param {query} query object
Expand Down
6 changes: 3 additions & 3 deletions src/ui/public/courier/data_source/_doc_send_to_es.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import _ from 'lodash';

import { VersionConflict, RequestFailure } from 'ui/errors';
import RequestQueueProvider from 'ui/courier/_request_queue';
import FetchProvider from 'ui/courier/fetch/fetch';
import { RequestQueueProvider } from 'ui/courier/_request_queue';
import { FetchProvider } from 'ui/courier/fetch/fetch';

export default function (Promise, Private, es, esAdmin, kbnIndex) {
export function DocSendToEsProvider(Promise, Private, es, esAdmin, kbnIndex) {
const requestQueue = Private(RequestQueueProvider);
const courierFetch = Private(FetchProvider);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';

export default function normalizeSortRequest(config) {
export function NormalizeSortRequestProvider(config) {
const defaultSortOptions = config.get('sort:options');

/**
Expand Down
4 changes: 2 additions & 2 deletions src/ui/public/courier/data_source/_root_search_source.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SearchSourceProvider from 'ui/courier/data_source/search_source';
import { SearchSourceProvider } from 'ui/courier/data_source/search_source';

export default function RootSearchSource(Private, $rootScope, timefilter) {
export function RootSearchSourceProvider(Private, $rootScope, timefilter) {
const SearchSource = Private(SearchSourceProvider);

const globalSource = new SearchSource();
Expand Down
14 changes: 7 additions & 7 deletions src/ui/public/courier/data_source/admin_doc_source.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import AbstractDocSourceProvider from './_abstract_doc_source';
import DocStrategyProvider from '../fetch/strategy/doc_admin';
import DocRequestProvider from '../fetch/request/doc_admin';
import { AbstractDocSourceProvider } from './_abstract_doc_source';
import { DocAdminStrategyProvider } from '../fetch/strategy/doc_admin';
import { AdminDocRequestProvider } from '../fetch/request/doc_admin';

export default function DocSourceFactory(Private) {
export function AdminDocSourceProvider(Private) {
const AbstractDocSource = Private(AbstractDocSourceProvider);
const docStrategy = Private(DocStrategyProvider);
const DocRequest = Private(DocRequestProvider);
const docStrategy = Private(DocAdminStrategyProvider);
const AdminDocRequest = Private(AdminDocRequestProvider);

class AdminDocSource extends AbstractDocSource {
constructor(initialState) {
super(initialState, docStrategy);
}

_createRequest(defer) {
return new DocRequest(this, defer);
return new AdminDocRequest(this, defer);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/ui/public/courier/data_source/doc_source.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import AbstractDocSourceProvider from './_abstract_doc_source';
import DocStrategyProvider from '../fetch/strategy/doc_data';
import DocRequestProvider from '../fetch/request/doc_data';
import { AbstractDocSourceProvider } from './_abstract_doc_source';
import { DocDataStrategyProvider } from '../fetch/strategy/doc_data';
import { DocDataRequestProvider } from '../fetch/request/doc_data';

export default function DocSourceFactory(Private) {
export function DocSourceProvider(Private) {
const AbstractDocSource = Private(AbstractDocSourceProvider);
const docStrategy = Private(DocStrategyProvider);
const DocRequest = Private(DocRequestProvider);
const docStrategy = Private(DocDataStrategyProvider);
const DocRequest = Private(DocDataRequestProvider);

class DocSource extends AbstractDocSource {
constructor(initialState) {
Expand Down
16 changes: 8 additions & 8 deletions src/ui/public/courier/data_source/search_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@

import _ from 'lodash';

import NormalizeSortRequestProvider from './_normalize_sort_request';
import rootSearchSource from './_root_search_source';
import AbstractDataSourceProvider from './_abstract';
import SearchRequestProvider from '../fetch/request/search';
import SegmentedRequestProvider from '../fetch/request/segmented';
import SearchStrategyProvider from '../fetch/strategy/search';
import { NormalizeSortRequestProvider } from './_normalize_sort_request';
import { RootSearchSourceProvider } from './_root_search_source';
import { AbstractDataSourceProvider } from './_abstract';
import { SearchRequestProvider } from '../fetch/request/search';
import { SegmentedRequestProvider } from '../fetch/request/segmented';
import { SearchStrategyProvider } from '../fetch/strategy/search';

export default function SearchSourceFactory(Promise, Private, config) {
export function SearchSourceProvider(Promise, Private, config) {
const SourceAbstract = Private(AbstractDataSourceProvider);
const SearchRequest = Private(SearchRequestProvider);
const SegmentedRequest = Private(SegmentedRequestProvider);
Expand Down Expand Up @@ -152,7 +152,7 @@ export default function SearchSourceFactory(Promise, Private, config) {
const self = this;
if (self._parent === false) return;
if (self._parent) return self._parent;
return onlyHardLinked ? undefined : Private(rootSearchSource).get();
return onlyHardLinked ? undefined : Private(RootSearchSourceProvider).get();
};

/**
Expand Down
6 changes: 3 additions & 3 deletions src/ui/public/courier/fetch/__tests__/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import sinon from 'auto-release-sinon';
import expect from 'expect.js';
import ngMock from 'ng_mock';

import DocSourceProvider from '../../data_source/doc_source';
import DocRequestProvider from '../request/doc_data';
import { DocSourceProvider } from '../../data_source/doc_source';
import { DocDataRequestProvider } from '../request/doc_data';

describe('Courier DocFetchRequest class', function () {
let storage;
Expand All @@ -16,7 +16,7 @@ describe('Courier DocFetchRequest class', function () {
beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private, Promise, $injector) {
const DocSource = Private(DocSourceProvider);
const DocFetchRequest = Private(DocRequestProvider);
const DocFetchRequest = Private(DocDataRequestProvider);

storage =
$injector.get('localStorage').store =
Expand Down
6 changes: 3 additions & 3 deletions src/ui/public/courier/fetch/__tests__/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import sinon from 'auto-release-sinon';
import IndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import searchResp from 'fixtures/search_response';

import FetchProvider from '../fetch';
import DocSourceProvider from '../../data_source/doc_source';
import SearchSourceProvider from '../../data_source/search_source';
import { FetchProvider } from '../fetch';
import { DocSourceProvider } from '../../data_source/doc_source';
import { SearchSourceProvider } from '../../data_source/search_source';

describe('Fetch service', function () {
require('test_utils/no_digest_promises').activateForSuite();
Expand Down
13 changes: 8 additions & 5 deletions src/ui/public/courier/fetch/__tests__/fetch_these.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import sinon from 'auto-release-sinon';
import expect from 'expect.js';
import ngMock from 'ng_mock';

import FetchTheseProvider from '../fetch_these';
import { CallClientProvider } from 'ui/courier/fetch/call_client';
import { CallResponseHandlersProvider } from 'ui/courier/fetch/call_response_handlers';
import { ContinueIncompleteProvider } from 'ui/courier/fetch/continue_incomplete';
import { FetchTheseProvider } from '../fetch_these';

describe('ui/courier/fetch/_fetch_these', () => {
describe('FetchTheseProvider', () => {

let Promise;
let $rootScope;
Expand All @@ -23,9 +26,9 @@ describe('ui/courier/fetch/_fetch_these', () => {
return fakeResponses;
}

PrivateProvider.swap(require('ui/courier/fetch/call_client'), FakeResponsesProvider);
PrivateProvider.swap(require('ui/courier/fetch/call_response_handlers'), FakeResponsesProvider);
PrivateProvider.swap(require('ui/courier/fetch/continue_incomplete'), FakeResponsesProvider);
PrivateProvider.swap(CallClientProvider, FakeResponsesProvider);
PrivateProvider.swap(CallResponseHandlersProvider, FakeResponsesProvider);
PrivateProvider.swap(ContinueIncompleteProvider, FakeResponsesProvider);
}));

beforeEach(ngMock.inject((Private, $injector) => {
Expand Down
Loading