diff --git a/src/ui/public/filter_bar/lib/__tests__/map_script.js b/src/ui/public/filter_bar/lib/__tests__/map_script.js deleted file mode 100644 index 1a4b05860a00b..0000000000000 --- a/src/ui/public/filter_bar/lib/__tests__/map_script.js +++ /dev/null @@ -1,69 +0,0 @@ -import expect from 'expect.js'; -import ngMock from 'ng_mock'; -import { FilterBarLibMapScriptProvider } from 'ui/filter_bar/lib/map_script'; - -describe('Filter Bar Directive', function () { - describe('mapScript()', function () { - let mapScript; - let $rootScope; - - beforeEach(ngMock.module( - 'kibana', - 'kibana/courier', - function ($provide) { - $provide.service('courier', require('fixtures/mock_courier')); - } - )); - - beforeEach(ngMock.inject(function (Private, _$rootScope_) { - $rootScope = _$rootScope_; - mapScript = Private(FilterBarLibMapScriptProvider); - })); - - it('should return the key and value for matching filters', function (done) { - const filter = { - meta: { index: 'logstash-*', field: 'script number', formattedValue: '35' }, - script: { script: { inline: 'doc["script number"].value * 5', params: { value: 35 } } } - }; - mapScript(filter).then(function (result) { - expect(result).to.have.property('key', 'script number'); - expect(result).to.have.property('value', '35'); - done(); - }); - $rootScope.$apply(); - }); - - it('should return undefined for none matching', function (done) { - const filter = { meta: { index: 'logstash-*' }, query: { query_string: { query: 'foo:bar' } } }; - mapScript(filter).catch(function (result) { - expect(result).to.be(filter); - done(); - }); - $rootScope.$apply(); - }); - - it('should return a value for a range/histogram filter from a scripted field', (done) => { - const filter = { - meta: { - index: 'logstash-*', - formattedValue: '1,000.00 to 2,000.00', - field: 'script number' - }, - script: { - script: { - params: { - gte: 1000, - lt: 2000, - value: '>=1,000.00 <2,000.00' - } - } - } - }; - mapScript(filter).then((result) => { - expect(result).to.have.property('value', filter.meta.formattedValue); - done(); - }); - $rootScope.$apply(); - }); - }); -}); diff --git a/src/ui/public/filter_bar/lib/map_filter.js b/src/ui/public/filter_bar/lib/map_filter.js index a186258c047bc..50c080098ae6f 100644 --- a/src/ui/public/filter_bar/lib/map_filter.js +++ b/src/ui/public/filter_bar/lib/map_filter.js @@ -9,7 +9,6 @@ import { FilterBarLibMapMissingProvider } from './map_missing'; import { FilterBarLibMapQueryStringProvider } from './map_query_string'; import { FilterBarLibMapGeoBoundingBoxProvider } from './map_geo_bounding_box'; import { FilterBarLibMapGeoPolygonProvider } from './map_geo_polygon'; -import { FilterBarLibMapScriptProvider } from './map_script'; import { FilterBarLibMapDefaultProvider } from './map_default'; export function FilterBarLibMapFilterProvider(Promise, Private) { @@ -42,7 +41,6 @@ export function FilterBarLibMapFilterProvider(Promise, Private) { Private(FilterBarLibMapQueryStringProvider), Private(FilterBarLibMapGeoBoundingBoxProvider), Private(FilterBarLibMapGeoPolygonProvider), - Private(FilterBarLibMapScriptProvider), Private(FilterBarLibMapDefaultProvider), ]; diff --git a/src/ui/public/filter_bar/lib/map_script.js b/src/ui/public/filter_bar/lib/map_script.js deleted file mode 100644 index 828c6da9fa20e..0000000000000 --- a/src/ui/public/filter_bar/lib/map_script.js +++ /dev/null @@ -1,16 +0,0 @@ -export function FilterBarLibMapScriptProvider(Promise) { - return function (filter) { - if (filter.script) { - const type = 'scripted'; - const key = filter.meta.field; - - let value = ''; - if (filter.meta.formattedValue) { - value = filter.meta.formattedValue; - } - - return Promise.resolve({ type, key, value }); - } - return Promise.reject(filter); - }; -}