Skip to content

Commit

Permalink
Merge branch 'master' into update-ts-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Aug 5, 2020
2 parents 0005b9f + f9fc83f commit cb6ef65
Show file tree
Hide file tree
Showing 61 changed files with 280 additions and 236 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/x-pack/plugins/discover_enhanced/ @elastic/kibana-app
/x-pack/plugins/lens/ @elastic/kibana-app
/x-pack/plugins/graph/ @elastic/kibana-app
/src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app
/src/plugins/dashboard/ @elastic/kibana-app
/src/plugins/discover/ @elastic/kibana-app
/src/plugins/input_control_vis/ @elastic/kibana-app
Expand Down
37 changes: 0 additions & 37 deletions src/legacy/core_plugins/kibana/common/utils/no_white_space.js

This file was deleted.

1 change: 1 addition & 0 deletions src/plugins/dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Contains the dashboard application.
1 change: 1 addition & 0 deletions src/plugins/discover/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Contains the Discover application and the saved search embeddable.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@
* under the License.
*/

import _ from 'lodash';
import { find, template } from 'lodash';
import $ from 'jquery';
// @ts-ignore
import rison from 'rison-node';
import '../../doc_viewer';
// @ts-ignore
import { noWhiteSpace } from '../../../../../../../legacy/core_plugins/kibana/common/utils/no_white_space';

import openRowHtml from './table_row/open.html';
import detailsHtml from './table_row/details.html';
Expand All @@ -35,6 +32,16 @@ import truncateByHeightTemplateHtml from '../components/table_row/truncate_by_he
import { esFilters } from '../../../../../../data/public';
import { getServices } from '../../../../kibana_services';

const TAGS_WITH_WS = />\s+</g;

/**
* Remove all of the whitespace between html tags
* so that inline elements don't have extra spaces.
*/
export function noWhiteSpace(html: string): string {
return html.replace(TAGS_WITH_WS, '><');
}

// guesstimate at the minimum number of chars wide cells in the table should be
const MIN_LINE_LENGTH = 20;

Expand All @@ -43,8 +50,8 @@ interface LazyScope extends ng.IScope {
}

export function createTableRowDirective($compile: ng.ICompileService, $httpParamSerializer: any) {
const cellTemplate = _.template(noWhiteSpace(cellTemplateHtml));
const truncateByHeightTemplate = _.template(noWhiteSpace(truncateByHeightTemplateHtml));
const cellTemplate = template(noWhiteSpace(cellTemplateHtml));
const truncateByHeightTemplate = template(noWhiteSpace(truncateByHeightTemplateHtml));

return {
restrict: 'A',
Expand Down Expand Up @@ -169,7 +176,7 @@ export function createTableRowDirective($compile: ng.ICompileService, $httpParam
const $cell = $cells.eq(i);
if ($cell.data('discover:html') === html) return;

const reuse = _.find($cells.slice(i + 1), function (cell: any) {
const reuse = find($cells.slice(i + 1), function (cell: any) {
return $.data(cell, 'discover:html') === html;
});

Expand Down
1 change: 1 addition & 0 deletions src/plugins/input_control_vis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Contains the input control visualization allowing to place custom filter controls on a dashboard.
2 changes: 2 additions & 0 deletions src/plugins/timelion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Contains the deprecated timelion application. For the timelion visualization,
which also contains the timelion APIs and backend, look at the vis_type_timelion plugin.
1 change: 1 addition & 0 deletions src/plugins/vis_type_markdown/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The markdown visualization that can be used to place text panels on dashboards.
1 change: 1 addition & 0 deletions src/plugins/vis_type_metric/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Contains the metric visualization.
1 change: 1 addition & 0 deletions src/plugins/vis_type_table/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Contains the data table visualization, that allows presenting data in a simple table format.
1 change: 1 addition & 0 deletions src/plugins/vis_type_tagcloud/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Contains the tagcloud visualization.
2 changes: 2 additions & 0 deletions src/plugins/vis_type_timelion/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Vis type Timelion

Contains the timelion visualization and the timelion backend.

# Generate a parser
If your grammar was changed in `public/chain.peg` you need to re-generate the static parser. You could use a grunt task:

Expand Down
1 change: 1 addition & 0 deletions src/plugins/vis_type_timeseries/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Contains everything around TSVB (the editor, visualizatin implementations and backends).
1 change: 1 addition & 0 deletions src/plugins/vis_type_vega/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Contains the Vega visualization.
2 changes: 2 additions & 0 deletions src/plugins/vis_type_vislib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Contains the vislib visualizations. These are the classical area/line/bar, pie, gauge/goal and
heatmap charts.
2 changes: 2 additions & 0 deletions src/plugins/vis_type_xy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Contains the new xy-axis chart using the elastic-charts library, which will eventually
replace the vislib xy-axis (bar, area, line) charts.
2 changes: 2 additions & 0 deletions src/plugins/visualizations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Contains most of the visualization infrastructure, e.g. the visualization type registry or the
visualization embeddable.
2 changes: 2 additions & 0 deletions src/plugins/visualize/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Contains the visualize application which includes the listing page and the app frame,
which will load the visualization's editor.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import { EuiTitle } from '@elastic/eui';
import theme from '@elastic/eui/dist/eui_theme_light.json';
import { i18n } from '@kbn/i18n';
import { mean } from 'lodash';
import React, { useCallback } from 'react';
import { EuiPanel } from '@elastic/eui';
import { useChartsSync } from '../../../../hooks/useChartsSync';
Expand Down Expand Up @@ -79,7 +78,7 @@ export function ErroneousTransactionsRateChart() {
{
color: theme.euiColorVis7,
data: [],
legendValue: tickFormatY(mean(errorRates.map((rate) => rate.y))),
legendValue: tickFormatY(data?.average),
legendClickDisabled: true,
title: i18n.translate('xpack.apm.errorRateChart.avgLabel', {
defaultMessage: 'Avg.',
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/dashboard_enhanced/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# X-Pack part of Dashboard app
Contains the enhancements to the OSS dashboard app.
1 change: 1 addition & 0 deletions x-pack/plugins/dashboard_mode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The deprecated dashboard only mode.
1 change: 1 addition & 0 deletions x-pack/plugins/discover_enhanced/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Contains the enhancements to the OSS discover app.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const SubscriptionSplashContent: React.FC = () => {
description = (
<FormattedMessage
id="xpack.infra.logs.logAnalysis.splash.startTrialDescription"
defaultMessage="Our free, 14-day trial includes machine learning features, which enable you to detect anomalies in your logs."
defaultMessage="Our free trial includes machine learning features, which enable you to detect anomalies in your logs."
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export const getListHandler: RequestHandler = async (context, request, response)
must: [
{
exists: {
field: 'dataset.namespace',
field: 'data_stream.namespace',
},
},
{
exists: {
field: 'dataset.name',
field: 'data_stream.dataset',
},
},
],
Expand All @@ -54,19 +54,19 @@ export const getListHandler: RequestHandler = async (context, request, response)
aggs: {
dataset: {
terms: {
field: 'dataset.name',
field: 'data_stream.dataset',
size: 1,
},
},
namespace: {
terms: {
field: 'dataset.namespace',
field: 'data_stream.namespace',
size: 1,
},
},
type: {
terms: {
field: 'dataset.type',
field: 'data_stream.type',
size: 1,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,14 @@ const updateExistingIndex = async ({
// are added in https://github.com/elastic/kibana/issues/66551. namespace value we will continue
// to skip updating and assume the value in the index mapping is correct
delete mappings.properties.stream;
delete mappings.properties.dataset;
delete mappings.properties.data_stream;

// get the dataset values from the index template to compose data stream name
// get the data_stream values from the index template to compose data stream name
const indexMappings = await getIndexMappings(indexName, callCluster);
const dataset = indexMappings[indexName].mappings.properties.dataset.properties;
if (!dataset.type.value || !dataset.name.value || !dataset.namespace.value)
throw new Error(`dataset values are missing from the index template ${indexName}`);
const dataStreamName = `${dataset.type.value}-${dataset.name.value}-${dataset.namespace.value}`;
const dataStream = indexMappings[indexName].mappings.properties.data_stream.properties;
if (!dataStream.type.value || !dataStream.dataset.value || !dataStream.namespace.value)
throw new Error(`data_stream values are missing from the index template ${indexName}`);
const dataStreamName = `${dataStream.type.value}-${dataStream.dataset.value}-${dataStream.namespace.value}`;

// try to update the mappings first
try {
Expand Down
44 changes: 44 additions & 0 deletions x-pack/plugins/ingest_manager/server/services/setup.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { setupIngestManager } from './setup';
import { savedObjectsClientMock } from 'src/core/server/mocks';

describe('setupIngestManager', () => {
it('returned promise should reject if errors thrown', async () => {
const { savedObjectsClient, callClusterMock } = makeErrorMocks();
const setupPromise = setupIngestManager(savedObjectsClient, callClusterMock);
await expect(setupPromise).rejects.toThrow('mocked');
});
});

function makeErrorMocks() {
jest.mock('./app_context'); // else fails w/"Logger not set."
jest.mock('./epm/registry/registry_url', () => {
return {
fetchUrl: () => {
throw new Error('mocked registry#fetchUrl');
},
};
});

const callClusterMock = jest.fn();
const savedObjectsClient = savedObjectsClientMock.create();
savedObjectsClient.find = jest.fn().mockImplementation(() => {
throw new Error('mocked SO#find');
});
savedObjectsClient.get = jest.fn().mockImplementation(() => {
throw new Error('mocked SO#get');
});
savedObjectsClient.update = jest.fn().mockImplementation(() => {
throw new Error('mocked SO#update');
});

return {
savedObjectsClient,
callClusterMock,
};
}
5 changes: 5 additions & 0 deletions x-pack/plugins/ingest_manager/server/services/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ export async function setupIngestManager(
// if anything errors, reject/fail
onSetupReject(error);
}

// be sure to return the promise because it has the resolved/rejected status attached to it
// otherwise, we effectively return success every time even if there are errors
// because `return undefined` -> `Promise.resolve(undefined)` in an `async` function
return setupIngestStatus;
}

export async function setupFleet(
Expand Down
6 changes: 0 additions & 6 deletions x-pack/plugins/ml/public/application/_index.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// ML has it's own variables for coloring
@import 'variables';

// Kibana management page ML section
#kibanaManagementMLSection {
@import 'management/index';
}

// Protect the rest of Kibana from ML generic namespacing
// SASSTODO: Prefix ml selectors instead
.ml-app {
Expand All @@ -24,7 +19,6 @@
// Components
@import 'components/annotations/annotation_description_list/index'; // SASSTODO: This file overwrites EUI directly
@import 'components/anomalies_table/index'; // SASSTODO: This file overwrites EUI directly
@import 'components/chart_tooltip/index';
@import 'components/color_range_legend/index';
@import 'components/controls/index';
@import 'components/entity_cell/index';
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/ml/public/application/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import React, { FC } from 'react';
import './_index.scss';
import ReactDOM from 'react-dom';

import { AppMountParameters, CoreStart, HttpStart } from 'kibana/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import moment from 'moment';
import { BehaviorSubject } from 'rxjs';
import React from 'react';

import { useObservable } from 'react-use';
import useObservable from 'react-use/lib/useObservable';

import { euiPaletteColorBlind, EuiDataGridColumn } from '@elastic/eui';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ import { EuiInMemoryTable } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { useMlKibana } from '../contexts/kibana';
import { SavedObjectDashboard } from '../../../../../../src/plugins/dashboard/public';
import {
ANOMALY_SWIMLANE_EMBEDDABLE_TYPE,
getDefaultPanelTitle,
} from '../../embeddables/anomaly_swimlane/anomaly_swimlane_embeddable';
import { getDefaultPanelTitle } from '../../embeddables/anomaly_swimlane/anomaly_swimlane_embeddable';
import { useDashboardService } from '../services/dashboard_service';
import { SWIMLANE_TYPE, SwimlaneType } from './explorer_constants';
import { JobId } from '../../../common/types/anomaly_detection_jobs';
import { ANOMALY_SWIMLANE_EMBEDDABLE_TYPE } from '../../embeddables';

export interface DashboardItem {
id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ import {
} from '@elastic/eui';

import { throttle } from 'lodash';
import {
ExplorerSwimlane,
ExplorerSwimlaneProps,
} from '../../application/explorer/explorer_swimlane';
import { ExplorerSwimlane, ExplorerSwimlaneProps } from './explorer_swimlane';

import { MlTooltipComponent } from '../../application/components/chart_tooltip';
import { MlTooltipComponent } from '../components/chart_tooltip';
import { SwimLanePagination } from './swimlane_pagination';
import { SWIMLANE_TYPE } from './explorer_constants';
import { ViewBySwimLaneData } from './explorer_utils';
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
@import 'components/index';
// Kibana management page ML section
#kibanaManagementMLSection {
@import 'components/index';
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { MlStartDependencies } from '../../../plugin';
import { JobsListPage } from './components';
import { getJobsListBreadcrumbs } from '../breadcrumbs';
import { setDependencyCache, clearCache } from '../../util/dependency_cache';
import './_index.scss';

const renderApp = (element: HTMLElement, coreStart: CoreStart) => {
ReactDOM.render(React.createElement(JobsListPage, { coreStart }), element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React, { useEffect, FC } from 'react';
import { useObservable } from 'react-use';
import useObservable from 'react-use/lib/useObservable';
import { i18n } from '@kbn/i18n';

import { NavigateToPath } from '../../contexts/kibana';
Expand Down

0 comments on commit cb6ef65

Please sign in to comment.