Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 7 additions & 3 deletions src/core_plugins/console/api_server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@

import _ from 'lodash';

const KNOWN_APIS = ['es_6_0'];

export function resolveApi(senseVersion, apis, reply) {
const result = {};
_.each(apis, function (name) {
{
// for now we ignore sense_version. might add it in the api name later
const api = require('./' + name);
result[name] = api.asJson();
if (KNOWN_APIS.includes(name)) {
// for now we ignore sense_version. might add it in the api name later
const api = require('./' + name);
result[name] = api.asJson();
}
}
});

Expand Down
51 changes: 51 additions & 0 deletions src/core_plugins/console/api_server/server.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { resolveApi } from './server';

describe('resolveApi', () => {
it('allows known APIs to be resolved', () => {
const mockReply = jest.fn((result) => ({ type: () => result }));
const result = resolveApi('Sense Version', ['es_6_0'], mockReply);
expect(result).toMatchObject({
es_6_0: {
endpoints: expect.any(Object),
globals: expect.any(Object),
name: expect.any(String),
}
});
});

it('does not resolve APIs that are not known', () => {
const mockReply = jest.fn((result) => ({ type: () => result }));
const result = resolveApi('Sense Version', ['unknown'], mockReply);
expect(result).toEqual({});
});

it('handles request for apis that are known and unknown', () => {
const mockReply = jest.fn((result) => ({ type: () => result }));
const result = resolveApi('Sense Version', ['es_6_0'], mockReply);
expect(result).toMatchObject({
es_6_0: {
endpoints: expect.any(Object),
globals: expect.any(Object),
name: expect.any(String),
}
});
});
});
5 changes: 2 additions & 3 deletions src/core_plugins/kibana/public/dashboard/dashboard_app.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
<query-bar
query="model.query"
app-name="'dashboard'"
on-submit="updateQueryAndFetch($query)"
on-submit="updateQueryAndFetch"
index-patterns="indexPatterns"
>
</query-bar>
></query-bar>
</div>
</div>
</kbn-top-nav>
Expand Down
1 change: 0 additions & 1 deletion src/core_plugins/kibana/public/dashboard/dashboard_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const app = uiModules.get('app/dashboard', [
'react',
'kibana/courier',
'kibana/config',
'kibana/typeahead',
]);

app.directive('dashboardViewportProvider', function (reactDirective) {
Expand Down
5 changes: 2 additions & 3 deletions src/core_plugins/kibana/public/discover/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ <h1 tabindex="0" id="kui_local_breadcrumb" class="kuiLocalBreadcrumb">
<div data-transclude-slot="bottomRow" class="fullWidth">
<query-bar
query="state.query"
on-submit="updateQueryAndFetch"
app-name="'discover'"
on-submit="updateQueryAndFetch($query)"
index-patterns="[indexPattern]"
>
</query-bar>
></query-bar>
</div>
</div>
</kbn-top-nav>
Expand Down
2 changes: 2 additions & 0 deletions src/core_plugins/kibana/public/index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@import 'ui/public/styles/styling_constants';

@import 'ui/public/query_bar/index';

// Context styles
@import './context/index';

Expand Down
5 changes: 2 additions & 3 deletions src/core_plugins/kibana/public/visualize/editor/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@
<query-bar
query="state.query"
app-name="'visualize'"
on-submit="updateQueryAndFetch($query)"
on-submit="updateQueryAndFetch"
disable-auto-focus="true"
index-patterns="[indexPattern]"
>
</query-bar>
></query-bar>
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/core_plugins/vega/public/_vega_editor.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.visEditor--vega {
.visEditorSidebar__config {
padding: 0;
// Makes sure the vega options dropdown menu is visible
overflow: inherit;
}

// The following is necessary for the Vega editor to expand to full height of the editor panel
Expand Down
6 changes: 4 additions & 2 deletions src/ui/public/agg_types/buckets/_terms_other_bucket_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ const buildOtherBucketAgg = (aggConfigs, aggWithOtherBucket, response) => {
const filterAgg = aggConfigs.createAggConfig({
type: 'filters',
id: 'other',
}, {
addToAggConfigs: false,
});

// nest all the child aggregations of aggWithOtherBucket
Expand All @@ -129,8 +131,8 @@ const buildOtherBucketAgg = (aggConfigs, aggWithOtherBucket, response) => {
if (aggIndex < index) {
_.each(agg.buckets, (bucket, bucketObjKey) => {
const bucketKey = currentAgg.getKey(bucket, Number.isInteger(bucketObjKey) ? null : bucketObjKey);
const filter = _.cloneDeep(bucket.filter) || currentAgg.createFilter(bucketKey);
const newFilters = [...filters, filter];
const filter = _.cloneDeep(bucket.filters) || currentAgg.createFilter(bucketKey);
const newFilters = _.flatten([...filters, filter]);
walkBucketTree(newAggIndex, bucket, newAgg.id, newFilters, `${key}-${bucketKey.toString()}`);
});
return;
Expand Down
11 changes: 8 additions & 3 deletions src/ui/public/autocomplete_providers/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type AutocompleteProvider = (
get(configKey: string): any;
};
indexPatterns: StaticIndexPattern[];
boolFilter: any;
boolFilter?: any;
}
) => GetSuggestions;

Expand All @@ -40,10 +40,15 @@ export type GetSuggestions = (
}
) => Promise<AutocompleteSuggestion[]>;

export type AutocompleteSuggestionType = 'field' | 'value' | 'operator' | 'conjunction';
export type AutocompleteSuggestionType =
| 'field'
| 'value'
| 'operator'
| 'conjunction'
| 'recentSearch';

export interface AutocompleteSuggestion {
description: string;
description?: string;
end: number;
start: number;
text: string;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/autoload/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ import '../style_compile';
import '../timefilter';
import '../timepicker';
import '../tooltip';
import '../typeahead';
import '../url';
import '../validate_date_interval';
import '../watch_multi';
import '../courier/saved_object/ui/saved_object_save_as_checkbox';
import '../react_components';
import '../i18n';
import '../query_bar/directive';
10 changes: 3 additions & 7 deletions src/ui/public/directives/__tests__/parse_query.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,23 @@ import ngMock from 'ng_mock';

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

let cycleIndex = 0;
const markup = '<input ng-model="mockModel" parse-query input-focus type="text">';
let fromUser;
import { toUser } from '../../parse_query/lib/to_user';
import '../../parse_query';
import { ParseQueryLibFromUserProvider } from '../../parse_query/lib/from_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_, _Private_, _config_) {
ngMock.inject(function ($injector, _$rootScope_, _$compile_, _$timeout_, _config_) {
$compile = _$compile_;
Private = _Private_;
config = _config_;

// Give us a scope
Expand Down Expand Up @@ -77,7 +74,6 @@ describe('parse-query directive', function () {
describe('user input parser', function () {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ export const documentationLinks = {
installation: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-installation.html`,
configuration: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-configuration.html`,
elasticsearchOutput: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/elasticsearch-output.html`,
elasticsearchOutputAnchorParameters:
`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/elasticsearch-output.html#_parameters`,
elasticsearchOutputAnchorParameters: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/elasticsearch-output.html#_parameters`,
startup: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-starting.html`,
exportedFields: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/exported-fields.html`
exportedFields: `${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/exported-fields.html`,
},
metricbeat: {
base: `${ELASTIC_WEBSITE_URL}guide/en/beats/metricbeat/${DOC_LINK_VERSION}`
base: `${ELASTIC_WEBSITE_URL}guide/en/beats/metricbeat/${DOC_LINK_VERSION}`,
},
logstash: {
base: `${ELASTIC_WEBSITE_URL}guide/en/logstash/${DOC_LINK_VERSION}`
base: `${ELASTIC_WEBSITE_URL}guide/en/logstash/${DOC_LINK_VERSION}`,
},
aggs: {
date_histogram: `${ELASTIC_DOCS}search-aggregations-bucket-datehistogram-aggregation.html`,
Expand Down Expand Up @@ -78,19 +77,18 @@ export const documentationLinks = {
painless: `${ELASTIC_DOCS}modules-scripting-painless.html`,
painlessApi: `${ELASTIC_DOCS}modules-scripting-painless.html#painless-api`,
painlessSyntax: `${ELASTIC_DOCS}modules-scripting-painless-syntax.html`,
luceneExpressions: `${ELASTIC_DOCS}modules-scripting-expression.html`
luceneExpressions: `${ELASTIC_DOCS}modules-scripting-expression.html`,
},
indexPatterns: {
loadingData: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/tutorial-load-dataset.html`,
introduction: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/index-patterns.html`,
},
query: {
luceneQuerySyntax:
`${ELASTIC_DOCS}query-dsl-query-string-query.html#query-string-syntax`,
luceneQuerySyntax: `${ELASTIC_DOCS}query-dsl-query-string-query.html#query-string-syntax`,
queryDsl: `${ELASTIC_DOCS}query-dsl.html`,
kueryQuerySyntax: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/kuery-query.html`,
},
date: {
dateMath: `${ELASTIC_DOCS}common-options.html#date-math`
dateMath: `${ELASTIC_DOCS}common-options.html#date-math`,
},
};
29 changes: 29 additions & 0 deletions src/ui/public/filter_bar/push_filters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import _ from 'lodash';

export function FilterBarPushFiltersProvider() {
return function ($state) {
if (!_.isObject($state)) throw new Error('pushFilters requires a state object');
return function (filters) {
$state.$newFilters = filters;
};
};
}
29 changes: 29 additions & 0 deletions src/ui/public/index_patterns/static_utils/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { StaticIndexPattern } from 'ui/index_patterns';

interface SavedObject {
attributes: {
fields: string;
title: string;
};
}

export function getFromLegacyIndexPattern(indexPatterns: any[]): StaticIndexPattern[];
4 changes: 1 addition & 3 deletions src/ui/public/index_patterns/static_utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

import { KBN_FIELD_TYPES } from '../../../../utils/kbn_field_types';

const filterableTypes = KBN_FIELD_TYPES.filter(type => type.filterable).map(
type => type.name
);
const filterableTypes = KBN_FIELD_TYPES.filter(type => type.filterable).map(type => type.name);

export function isFilterable(field) {
return filterableTypes.includes(field.type);
Expand Down
27 changes: 27 additions & 0 deletions src/ui/public/metadata.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

declare class Metadata {
public branch: string;
public version: string;
}

declare const metadata: Metadata;

export { metadata };
Loading