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

[7.x] Remove parse_query from public/ui (#34232) #34520

Merged
merged 1 commit into from
Apr 4, 2019
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
1 change: 1 addition & 0 deletions src/legacy/ui/public/agg_types/buckets/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { BucketAggType } from './_bucket_agg_type';
import { createFilterFilters } from './create_filter/filters';
import { decorateQuery, luceneStringToDsl } from '@kbn/es-query';
import '../directives/click_focus';
import '../directives/parse_query';
import filtersTemplate from '../controls/filters.html';
import { i18n } from '@kbn/i18n';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
* under the License.
*/

import { toUser } from './lib/to_user';
import { fromUser } from './lib/from_user';
import { toUser, fromUser } from '../../query_bar/lib';
import { uiModules } from '../../modules';

import { uiModules } from '../modules';
uiModules
.get('kibana')
.directive('parseQuery', function () {
Expand Down
3 changes: 1 addition & 2 deletions src/legacy/ui/public/query_bar/components/query_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ import {
getAutocompleteProvider,
} from '../../autocomplete_providers';
import chrome from '../../chrome';
import { fromUser, toUser } from '../../parse_query';
import { matchPairs } from '../lib/match_pairs';
import { fromUser, matchPairs, toUser } from '../lib';
import { QueryLanguageSwitcher } from './language_switcher';
import { SuggestionsComponent } from './typeahead/suggestions_component';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,66 +17,14 @@
* under the License.
*/

import angular from 'angular';
import expect from '@kbn/expect';
import ngMock from 'ng_mock';

// Load the kibana app dependencies.
import { toUser, fromUser } from '../';

let $rootScope;
let $compile;
let config;
let $elemScope;
let $elem;

let cycleIndex = 0;
const markup = '<input ng-model="mockModel" parse-query input-focus type="text">';
import { toUser } from '../../parse_query/lib/to_user';
import '../../parse_query/index';
import { fromUser } from '../../parse_query/lib/from_user';

const init = function () {
// Load the application
ngMock.module('kibana');

// Create the scope
ngMock.inject(function ($injector, _$rootScope_, _$compile_, _$timeout_, _config_) {
$compile = _$compile_;
config = _config_;

// Give us a scope
$rootScope = _$rootScope_;
});
};

const compile = function () {
$rootScope.mockModel = 'cycle' + cycleIndex++;
$rootScope.mockQueryInput = undefined;

$elem = angular.element(markup);
$compile($elem)($rootScope);
$elemScope = $elem.isolateScope();
$rootScope.$digest();
};

describe('parse-query directive', function () {
describe('initialization', function () {
beforeEach(function () {
init();
compile();
});

it('should use the model', function () {
expect($elemScope).to.have.property('ngModel');
});
});
describe('user input helpers', function () {

describe('user input parser', function () {

beforeEach(function () {
config.set('query:queryString:options', {});
});

it('should return the input if passed an object', function () {
expect(fromUser({ foo: 'bar' })).to.eql({ foo: 'bar' });
});
Expand Down Expand Up @@ -129,5 +77,4 @@ describe('parse-query directive', function () {
expect(toUser(400)).to.be('400');
});
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* under the License.
*/

import './parse_query';

export * from './lib/from_user';
export * from './lib/to_user';
export * from './match_pairs';
export * from './from_user';
export * from './to_user';