Skip to content

Commit

Permalink
Remove unused doc source code (#13756) (#14034)
Browse files Browse the repository at this point in the history
* Remove unused doc source code

Ever since the saved object api was introduced, we’ve been using that,
or querying es directly, for mget data.

* Remove commented out code
  • Loading branch information
stacey-gammon authored Sep 19, 2017
1 parent c3fe4fd commit 83f6483
Show file tree
Hide file tree
Showing 14 changed files with 7 additions and 612 deletions.
20 changes: 6 additions & 14 deletions src/ui/public/courier/__tests__/request_queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import sinon from 'sinon';

import { requestQueue } from '../_request_queue';
import { SearchStrategyProvider } from '../fetch/strategy/search';
import { DocDataStrategyProvider } from '../fetch/strategy/doc_data';

describe('Courier Request Queue', function () {
let docStrategy;
let searchStrategy;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private) {
docStrategy = Private(DocDataStrategyProvider);

searchStrategy = Private(SearchStrategyProvider);
}));
beforeEach(requestQueue.clear);
Expand All @@ -29,29 +27,26 @@ describe('Courier Request Queue', function () {
describe('#getStartable(strategy)', function () {
it('only returns requests that match one of the passed strategies', function () {
requestQueue.push(
new MockReq(docStrategy),
new MockReq(searchStrategy),
new MockReq(searchStrategy),
new MockReq(searchStrategy)
);

expect(requestQueue.getStartable(docStrategy)).to.have.length(1);
expect(requestQueue.getStartable(searchStrategy)).to.have.length(3);
});

it('returns all requests when no strategy passed', function () {
requestQueue.push(
new MockReq(docStrategy),
new MockReq(searchStrategy)
);

expect(requestQueue.getStartable()).to.have.length(2);
expect(requestQueue.getStartable()).to.have.length(1);
});

it('returns only startable requests', function () {
requestQueue.push(
new MockReq(docStrategy, true),
new MockReq(searchStrategy, false)
new MockReq(searchStrategy, false),
new MockReq(searchStrategy, true)
);

expect(requestQueue.getStartable()).to.have.length(1);
Expand All @@ -61,28 +56,25 @@ describe('Courier Request Queue', function () {
describe('#get(strategy)', function () {
it('only returns requests that match one of the passed strategies', function () {
requestQueue.push(
new MockReq(docStrategy),
new MockReq(searchStrategy),
new MockReq(searchStrategy),
new MockReq(searchStrategy)
);

expect(requestQueue.get(docStrategy)).to.have.length(1);
expect(requestQueue.get(searchStrategy)).to.have.length(3);
});

it('returns all requests when no strategy passed', function () {
requestQueue.push(
new MockReq(docStrategy),
new MockReq(searchStrategy)
);

expect(requestQueue.get()).to.have.length(2);
expect(requestQueue.get()).to.have.length(1);
});

it('returns startable and not-startable requests', function () {
requestQueue.push(
new MockReq(docStrategy, true),
new MockReq(searchStrategy, true),
new MockReq(searchStrategy, false)
);

Expand Down
23 changes: 0 additions & 23 deletions src/ui/public/courier/courier.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ 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 { requestQueue } from './_request_queue';
import { FetchProvider } from './fetch';
import { DocDataLooperProvider } from './looper/doc_data';
import { SearchLooperProvider } from './looper/search';
import { RootSearchSourceProvider } from './data_source/_root_search_source';
import { SavedObjectProvider } from './saved_object';
Expand All @@ -22,13 +20,10 @@ uiModules.get('kibana/courier')
.service('courier', function ($rootScope, Private, Promise, indexPatterns) {
function Courier() {
const self = this;

const DocSource = Private(DocSourceProvider);
const SearchSource = Private(SearchSourceProvider);
const searchStrategy = Private(SearchStrategyProvider);

const fetch = Private(FetchProvider);
const docDataLooper = self.docLooper = Private(DocDataLooperProvider);
const searchLooper = self.searchLooper = Private(SearchLooperProvider);

// expose some internal modules
Expand All @@ -38,7 +33,6 @@ uiModules.get('kibana/courier')
self.indexPatterns = indexPatterns;
self.redirectWhenMissing = Private(RedirectWhenMissingProvider);

self.DocSource = DocSource;
self.SearchSource = SearchSource;

/**
Expand All @@ -57,7 +51,6 @@ uiModules.get('kibana/courier')
*/
self.start = function () {
searchLooper.start();
docDataLooper.start();
return this;
};

Expand Down Expand Up @@ -95,28 +88,12 @@ uiModules.get('kibana/courier')
return this;
};


/**
* create a source object that is a child of this courier
*
* @param {string} type - the type of Source to create
*/
self.createSource = function (type) {
switch (type) {
case 'doc':
return new DocSource();
case 'search':
return new SearchSource();
}
};

/**
* Abort all pending requests
* @return {[type]} [description]
*/
self.close = function () {
searchLooper.stop();
docDataLooper.stop();

_.invoke(requestQueue, 'abort');

Expand Down
59 changes: 0 additions & 59 deletions src/ui/public/courier/data_source/__tests__/doc_source.js

This file was deleted.

168 changes: 0 additions & 168 deletions src/ui/public/courier/data_source/_abstract_doc_source.js

This file was deleted.

Loading

0 comments on commit 83f6483

Please sign in to comment.