Skip to content

Commit

Permalink
Merge branch 'master' into move-core-provider-to-NP
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Apr 30, 2020
2 parents 1db6a76 + 6e3791e commit eb5d2fb
Show file tree
Hide file tree
Showing 168 changed files with 6,707 additions and 1,099 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
/x-pack/plugins/snapshot_restore/ @elastic/es-ui
/x-pack/plugins/upgrade_assistant/ @elastic/es-ui
/x-pack/plugins/watcher/ @elastic/es-ui
/x-pack/plugins/ingest_pipelines/ @elastic/es-ui

# Endpoint
/x-pack/plugins/endpoint/ @elastic/endpoint-app-team @elastic/siem
Expand Down
4 changes: 3 additions & 1 deletion src/cli/cluster/cluster_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ export class ClusterManager {

const ignorePaths = [
/[\\\/](\..*|node_modules|bower_components|target|public|__[a-z0-9_]+__|coverage)([\\\/]|$)/,
/\.test\.(js|ts)$/,
/\.test\.(js|tsx?)$/,
/\.md$/,
/debug\.log$/,
...pluginInternalDirsIgnore,
fromRoot('src/legacy/server/sass/__tmp__'),
fromRoot('x-pack/legacy/plugins/reporting/.chromium'),
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/vis_type_markdown/public/markdown_vis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n';

import { MarkdownVisWrapper } from './markdown_vis_controller';
import { MarkdownOptions } from './markdown_options';
import { SettingsOptions } from './settings_options';
import { SettingsOptions } from './settings_options_lazy';
import { DefaultEditorSize } from '../../vis_default_editor/public';

export const markdownVisDefinition = {
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/vis_type_markdown/public/settings_options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ function SettingsOptions({ stateParams, setValue }: VisOptionsProps<MarkdownVisP
);
}

export { SettingsOptions };
// default export required for React.Lazy
// eslint-disable-next-line import/no-default-export
export { SettingsOptions as default };
30 changes: 30 additions & 0 deletions src/plugins/vis_type_markdown/public/settings_options_lazy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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 React, { lazy, Suspense } from 'react';
import { EuiLoadingSpinner } from '@elastic/eui';

// @ts-ignore
const SettingsOptionsComponent = lazy(() => import('./settings_options'));

export const SettingsOptions = (props: any) => (
<Suspense fallback={<EuiLoadingSpinner />}>
<SettingsOptionsComponent {...props} />
</Suspense>
);
13 changes: 9 additions & 4 deletions src/plugins/vis_type_vega/public/vega_request_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

import { Filter, esQuery, TimeRange, Query } from '../../data/public';

// @ts-ignore
import { VegaParser } from './data_model/vega_parser';
// @ts-ignore
import { SearchCache } from './data_model/search_cache';
// @ts-ignore
Expand All @@ -46,7 +44,12 @@ export function createVegaRequestHandler({
const { timefilter } = data.query.timefilter;
const timeCache = new TimeCache(timefilter, 3 * 1000);

return ({ timeRange, filters, query, visParams }: VegaRequestHandlerParams) => {
return async function vegaRequestHandler({
timeRange,
filters,
query,
visParams,
}: VegaRequestHandlerParams) {
if (!searchCache) {
searchCache = new SearchCache(getData().search.__LEGACY.esClient, {
max: 10,
Expand All @@ -58,8 +61,10 @@ export function createVegaRequestHandler({

const esQueryConfigs = esQuery.getEsQueryConfig(uiSettings);
const filtersDsl = esQuery.buildEsQuery(undefined, query, filters, esQueryConfigs);
// @ts-ignore
const { VegaParser } = await import('./data_model/vega_parser');
const vp = new VegaParser(visParams.spec, searchCache, timeCache, filtersDsl, serviceSettings);

return vp.parseAsync();
return await vp.parseAsync();
};
}
4 changes: 2 additions & 2 deletions src/plugins/vis_type_vega/public/vega_visualization.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* under the License.
*/
import { i18n } from '@kbn/i18n';
import { VegaView } from './vega_view/vega_view';
import { VegaMapView } from './vega_view/vega_map_view';
import { getNotifications, getData, getSavedObjects } from './services';

export const createVegaVisualization = ({ serviceSettings }) =>
Expand Down Expand Up @@ -117,8 +115,10 @@ export const createVegaVisualization = ({ serviceSettings }) =>

if (vegaParser.useMap) {
const services = { toastService: getNotifications().toasts };
const { VegaMapView } = await import('./vega_view/vega_map_view');
this._vegaView = new VegaMapView(vegaViewParams, services);
} else {
const { VegaView } = await import('./vega_view/vega_view');
this._vegaView = new VegaView(vegaViewParams);
}
await this._vegaView.init();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/discover/_discover_histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function({ getService, getPageObjects }) {

log.debug('create long_window_logstash index pattern');
// NOTE: long_window_logstash load does NOT create index pattern
await PageObjects.settings.createIndexPattern('long-window-logstash-');
await PageObjects.settings.createIndexPattern('long-window-logstash-*');
await kibanaServer.uiSettings.replace(defaultSettings);
await browser.refresh();

Expand Down
6 changes: 3 additions & 3 deletions test/functional/apps/getting_started/_shakespeare.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export default function({ getService, getPageObjects }) {

it('should create shakespeare index pattern', async function() {
log.debug('Create shakespeare index pattern');
await PageObjects.settings.createIndexPattern('shakes', null);
await PageObjects.settings.createIndexPattern('shakespeare', null);
const patternName = await PageObjects.settings.getIndexPageHeading();
expect(patternName).to.be('shakes*');
expect(patternName).to.be('shakespeare');
});

// https://www.elastic.co/guide/en/kibana/current/tutorial-visualizing.html
Expand All @@ -74,7 +74,7 @@ export default function({ getService, getPageObjects }) {
log.debug('create shakespeare vertical bar chart');
await PageObjects.visualize.navigateToNewVisualization();
await PageObjects.visualize.clickVerticalBarChart();
await PageObjects.visualize.clickNewSearch('shakes*');
await PageObjects.visualize.clickNewSearch('shakespeare');
await PageObjects.visChart.waitForVisualization();

const expectedChartValues = [111396];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ export default function({ getService, getPageObjects }) {
it('should handle special charaters in template input', async () => {
await PageObjects.settings.clickAddNewIndexPatternButton();
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.settings.setIndexPatternField({
indexPatternName: '❤️',
expectWildcard: false,
});
await PageObjects.settings.setIndexPatternField('❤️');
await PageObjects.header.waitUntilLoadingHasFinished();

await retry.try(async () => {
Expand Down
26 changes: 22 additions & 4 deletions test/functional/page_objects/settings_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider
}
await PageObjects.header.waitUntilLoadingHasFinished();
await retry.try(async () => {
await this.setIndexPatternField({ indexPatternName });
await this.setIndexPatternField(indexPatternName);
});
await PageObjects.common.sleep(2000);
await (await this.getCreateIndexPatternGoToStep2Button()).click();
Expand Down Expand Up @@ -375,14 +375,32 @@ export function SettingsPageProvider({ getService, getPageObjects }: FtrProvider
return indexPatternId;
}

async setIndexPatternField({ indexPatternName = 'logstash-', expectWildcard = true } = {}) {
async setIndexPatternField(indexPatternName = 'logstash-*') {
log.debug(`setIndexPatternField(${indexPatternName})`);
const field = await this.getIndexPatternField();
await field.clearValue();
await field.type(indexPatternName, { charByChar: true });
if (
indexPatternName.charAt(0) === '*' &&
indexPatternName.charAt(indexPatternName.length - 1) === '*'
) {
// this is a special case when the index pattern name starts with '*'
// like '*:makelogs-*' where the UI will not append *
await field.type(indexPatternName, { charByChar: true });
} else if (indexPatternName.charAt(indexPatternName.length - 1) === '*') {
// the common case where the UI will append '*' automatically so we won't type it
const tempName = indexPatternName.slice(0, -1);
await field.type(tempName, { charByChar: true });
} else {
// case where we don't want the * appended so we'll remove it if it was added
await field.type(indexPatternName, { charByChar: true });
const tempName = await field.getAttribute('value');
if (tempName.length > indexPatternName.length) {
await field.type(browser.keys.DELETE, { charByChar: true });
}
}
const currentName = await field.getAttribute('value');
log.debug(`setIndexPatternField set to ${currentName}`);
expect(currentName).to.eql(`${indexPatternName}${expectWildcard ? '*' : ''}`);
expect(currentName).to.eql(indexPatternName);
}

async getCreateIndexPatternGoToStep2Button() {
Expand Down
1 change: 1 addition & 0 deletions x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"xpack.indexLifecycleMgmt": "plugins/index_lifecycle_management",
"xpack.infra": "plugins/infra",
"xpack.ingestManager": "plugins/ingest_manager",
"xpack.ingestPipelines": "plugins/ingest_pipelines",
"xpack.lens": "plugins/lens",
"xpack.licenseMgmt": "plugins/license_management",
"xpack.licensing": "plugins/licensing",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const METRIC_EXPLORER_AGGREGATIONS = [
'cardinality',
'rate',
'count',
'sum',
] as const;

type MetricExplorerAggregations = typeof METRIC_EXPLORER_AGGREGATIONS[number];
Expand Down Expand Up @@ -54,6 +55,7 @@ export const metricsExplorerRequestBodyOptionalFieldsRT = rt.partial({
afterKey: rt.union([rt.string, rt.null, rt.undefined]),
limit: rt.union([rt.number, rt.null, rt.undefined]),
filterQuery: rt.union([rt.string, rt.null, rt.undefined]),
forceInterval: rt.boolean,
});

export const metricsExplorerRequestBodyRT = rt.intersection([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export const metricsExplorerViewSavedObjectMappings: {
},
options: {
properties: {
forceInterval: {
type: 'boolean',
},
metrics: {
type: 'nested',
properties: {
Expand Down
Loading

0 comments on commit eb5d2fb

Please sign in to comment.