Skip to content

Commit

Permalink
Merge branch 'master' into eventLog/kibana-index-name
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Feb 16, 2020
2 parents 2757f9a + 36599fd commit 87c892e
Show file tree
Hide file tree
Showing 157 changed files with 764 additions and 783 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
/x-pack/legacy/plugins/index_lifecycle_management/ @elastic/es-ui
/x-pack/legacy/plugins/index_management/ @elastic/es-ui
/x-pack/legacy/plugins/license_management/ @elastic/es-ui
/x-pack/legacy/plugins/remote_clusters/ @elastic/es-ui
/x-pack/plugins/remote_clusters/ @elastic/es-ui
/x-pack/legacy/plugins/rollup/ @elastic/es-ui
/x-pack/plugins/searchprofiler/ @elastic/es-ui
/x-pack/legacy/plugins/snapshot_restore/ @elastic/es-ui
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "Apache-2.0",
"private": true,
"scripts": {
"build": "babel src --out-dir target --delete-dir-on-start --extensions .ts,.js,.tsx --ignore *.test.js,**/__tests__/**",
"build": "babel src --out-dir target --delete-dir-on-start --extensions .ts,.js,.tsx --ignore *.test.js,**/__tests__/** --source-maps=inline",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-test/src/failed_tests_reporter/test_report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface TestSuite {
/* number of skipped tests as a string */
skipped: string;
};
testcase: TestCase[];
testcase?: TestCase[];
}

export interface TestCase {
Expand Down Expand Up @@ -89,7 +89,7 @@ export function* makeTestCaseIter(report: TestReport) {
const testSuites = 'testsuites' in report ? report.testsuites.testsuite : [report.testsuite];

for (const testSuite of testSuites) {
for (const testCase of testSuite.testcase) {
for (const testCase of testSuite.testcase || []) {
yield testCase;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
mergeOtherBucketAggResponse,
updateMissingBucket,
} from '../../buckets/_terms_other_bucket_helper';
import { Vis } from '../../../../../../../core_plugins/visualizations/public';
import { start as visualizationsStart } from '../../../../../../../core_plugins/visualizations/public/np_ready/public/legacy';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';

const visConfigSingleTerm = {
Expand Down Expand Up @@ -191,7 +191,7 @@ describe('Terms Agg Other bucket helper', () => {
ngMock.inject(Private => {
const indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);

vis = new Vis(indexPattern, aggConfig);
vis = new visualizationsStart.Vis(indexPattern, aggConfig);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { SharePluginStart } from '../../../../../plugins/share/public';
import { SavedSearch } from './np_ready/types';
import { DocViewsRegistry } from './np_ready/doc_views/doc_views_registry';
import { ChartsPluginStart } from '../../../../../plugins/charts/public';
import { VisualizationsStart } from '../../../visualizations/public';

export interface DiscoverServices {
addBasePath: (path: string) => string;
Expand All @@ -56,6 +57,7 @@ export interface DiscoverServices {
getSavedSearchById: (id: string) => Promise<SavedSearch>;
getSavedSearchUrlById: (id: string) => Promise<string>;
uiSettings: IUiSettingsClient;
visualizations: VisualizationsStart;
}
export async function buildServices(
core: CoreStart,
Expand Down Expand Up @@ -89,5 +91,6 @@ export async function buildServices(
timefilter: plugins.data.query.timefilter.timefilter,
toastNotifications: core.notifications.toasts,
uiSettings: core.uiSettings,
visualizations: plugins.visualizations,
};
}
10 changes: 9 additions & 1 deletion src/legacy/core_plugins/kibana/public/discover/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,18 @@
import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';
import { plugin } from './index';
import {
setup as visualizationsSetup,
start as visualizationsStart,
} from '../../../../core_plugins/visualizations/public/np_ready/public/legacy';

// Legacy compatibility part - to be removed at cutover, replaced by a kibana.json file
export const pluginInstance = plugin({} as PluginInitializerContext);
export const setup = pluginInstance.setup(npSetup.core, {
...npSetup.plugins,
visualizations: visualizationsSetup,
});
export const start = pluginInstance.start(npStart.core, {
...npStart.plugins,
visualizations: visualizationsStart,
});
export const start = pluginInstance.start(npStart.core, npStart.plugins);
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import {
ensureDefaultIndexPattern,
registerTimefilterWithGlobalStateFactory,
} from '../../kibana_services';
import { Vis } from '../../../../../visualizations/public';

const {
core,
Expand All @@ -71,6 +70,7 @@ const {
timefilter,
toastNotifications,
uiSettings,
visualizations,
} = getServices();

import { getRootBreadcrumbs, getSavedSearchBreadcrumbs } from '../helpers/breadcrumbs';
Expand Down Expand Up @@ -990,7 +990,10 @@ function discoverController(
},
};

$scope.vis = new Vis($scope.searchSource.getField('index'), visSavedObject.visState);
$scope.vis = new visualizations.Vis(
$scope.searchSource.getField('index'),
visSavedObject.visState
);
visSavedObject.vis = $scope.vis;

$scope.searchSource.onRequestStart((searchSource, options) => {
Expand Down
6 changes: 6 additions & 0 deletions src/legacy/core_plugins/kibana/public/discover/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ import { DocViewInput, DocViewInputFn } from './np_ready/doc_views/doc_views_typ
import { DocViewTable } from './np_ready/components/table/table';
import { JsonCodeBlock } from './np_ready/components/json_code_block/json_code_block';
import { HomePublicPluginSetup } from '../../../../../plugins/home/public';
import {
VisualizationsStart,
VisualizationsSetup,
} from '../../../visualizations/public/np_ready/public';

/**
* These are the interfaces with your public contracts. You should export these
Expand All @@ -51,6 +55,7 @@ export interface DiscoverSetupPlugins {
embeddable: IEmbeddableSetup;
kibanaLegacy: KibanaLegacySetup;
home: HomePublicPluginSetup;
visualizations: VisualizationsSetup;
}
export interface DiscoverStartPlugins {
uiActions: UiActionsStart;
Expand All @@ -60,6 +65,7 @@ export interface DiscoverStartPlugins {
data: DataPublicPluginStart;
share: SharePluginStart;
inspector: any;
visualizations: VisualizationsStart;
}
const innerAngularName = 'app/discover';
const embeddableAngularName = 'app/discoverEmbeddable';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ import afterdatachangePng from './afterdatachange.png';
import afterdatachangeandresizePng from './afterdatachangeandresize.png';
import aftercolorchangePng from './aftercolorchange.png';
import changestartupPng from './changestartup.png';
import { setup as visualizationsSetup } from '../../../visualizations/public/np_ready/public/legacy';
import { Vis } from '../../../visualizations/public/np_ready/public/vis';
import {
setup as visualizationsSetup,
start as visualizationsStart,
} from '../../../visualizations/public/np_ready/public/legacy';

import { createRegionMapVisualization } from '../region_map_visualization';
import { createRegionMapTypeDefinition } from '../region_map_type';
Expand Down Expand Up @@ -158,7 +160,7 @@ describe('RegionMapsVisualizationTests', function() {

imageComparator = new ImageComparator();

vis = new Vis(indexPattern, {
vis = new visualizationsStart.Vis(indexPattern, {
type: 'region_map',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ import EMS_TILES from '../../../../ui/public/vis/__tests__/map/ems_mocks/sample_
import EMS_STYLE_ROAD_MAP_BRIGHT from '../../../../ui/public/vis/__tests__/map/ems_mocks/sample_style_bright';
import EMS_STYLE_ROAD_MAP_DESATURATED from '../../../../ui/public/vis/__tests__/map/ems_mocks/sample_style_desaturated';
import EMS_STYLE_DARK_MAP from '../../../../ui/public/vis/__tests__/map/ems_mocks/sample_style_dark';
import { setup as visualizationsSetup } from '../../../visualizations/public/np_ready/public/legacy';
import { Vis } from '../../../visualizations/public/np_ready/public/vis';
import {
setup as visualizationsSetup,
start as visualizationsStart,
} from '../../../visualizations/public/np_ready/public/legacy';

import { createTileMapVisualization } from '../tile_map_visualization';
import { createTileMapTypeDefinition } from '../tile_map_type';
Expand Down Expand Up @@ -124,7 +126,7 @@ describe('CoordinateMapsVisualizationTest', function() {
setupDOM('512px', '512px');

imageComparator = new ImageComparator();
vis = new Vis(indexPattern, {
vis = new visualizationsStart.Vis(indexPattern, {
type: 'tile_map',
});
vis.params = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('metric_vis - createMetricVisTypeDefinition', () => {

// TODO: remove when Vis is converted to typescript. Only importing Vis as type
// @ts-ignore
vis = new Vis(stubIndexPattern, {
vis = new visualizationsStart.Vis(stubIndexPattern, {
type: 'metric',
aggs: [{ id: '1', type: 'top_hits', schema: 'metric', params: { field: 'ip' } }],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ import sinon from 'sinon';
import { tabifyAggResponse, npStart } from '../../legacy_imports';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { round } from 'lodash';

import { Vis } from '../../../../visualizations/public';
import { tableVisTypeDefinition } from '../../table_vis_type';
import { setup as visualizationsSetup } from '../../../../visualizations/public/np_ready/public/legacy';
import {
setup as visualizationsSetup,
start as visualizationsStart,
} from '../../../../visualizations/public/np_ready/public/legacy';
import { getAngularModule } from '../../get_inner_angular';
import { initTableVisLegacyModule } from '../../table_vis_legacy_module';
import { tableVisResponseHandler } from '../../table_vis_response_handler';
Expand All @@ -42,10 +43,10 @@ describe('Table Vis - AggTable Directive', function() {
const tabifiedData = {};

const init = () => {
const vis1 = new Vis(indexPattern, 'table');
const vis1 = new visualizationsStart.Vis(indexPattern, 'table');
tabifiedData.metricOnly = tabifyAggResponse(vis1.aggs, fixtures.metricOnly);

const vis2 = new Vis(indexPattern, {
const vis2 = new visualizationsStart.Vis(indexPattern, {
type: 'table',
params: {
showMetricsAtAllLevels: true,
Expand All @@ -64,7 +65,7 @@ describe('Table Vis - AggTable Directive', function() {
metricsAtAllLevels: true,
});

const vis3 = new Vis(indexPattern, {
const vis3 = new visualizationsStart.Vis(indexPattern, {
type: 'table',
aggs: [
{ type: 'avg', schema: 'metric', params: { field: 'bytes' } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import expect from '@kbn/expect';
import fixtures from 'fixtures/fake_hierarchical_data';
import { tabifyAggResponse, npStart } from '../../legacy_imports';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { Vis } from '../../../../visualizations/public';
import { getAngularModule } from '../../get_inner_angular';
import { initTableVisLegacyModule } from '../../table_vis_legacy_module';
import { tableVisResponseHandler } from '../../table_vis_response_handler';
import { start as visualizationsStart } from '../../../../visualizations/public/np_ready/public/legacy';

describe('Table Vis - AggTableGroup Directive', function() {
let $rootScope;
Expand All @@ -35,10 +35,10 @@ describe('Table Vis - AggTableGroup Directive', function() {
const tabifiedData = {};

const init = () => {
const vis1 = new Vis(indexPattern, 'table');
const vis1 = new visualizationsStart.Vis(indexPattern, 'table');
tabifiedData.metricOnly = tabifyAggResponse(vis1.aggs, fixtures.metricOnly);

const vis2 = new Vis(indexPattern, {
const vis2 = new visualizationsStart.Vis(indexPattern, {
type: 'pie',
aggs: [
{ type: 'avg', schema: 'metric', params: { field: 'bytes' } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import LogstashIndexPatternStubProvider from 'fixtures/stubbed_logstash_index_pattern';
import { Vis } from '../../../../visualizations/public/np_ready/public/vis';
import { start as visualizationsStart } from '../../../../../core_plugins/visualizations/public/np_ready/public/legacy';
import { ImageComparator } from 'test_utils/image_comparator';
import { createTagCloudVisualization } from '../tag_cloud_visualization';
import basicdrawPng from './basicdraw.png';
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('TagCloudVisualizationTest', function() {
beforeEach(async function() {
setupDOM('512px', '512px');
imageComparator = new ImageComparator();
vis = new Vis(indexPattern, {
vis = new visualizationsStart.Vis(indexPattern, {
type: 'tagcloud',
params: {
bucket: { accessor: 0, format: {} },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import ngMock from 'ng_mock';
import $ from 'jquery';
import { createVegaVisualization } from '../vega_visualization';
import LogstashIndexPatternStubProvider from 'fixtures/stubbed_logstash_index_pattern';
import { Vis } from '../../../visualizations/public/np_ready/public/vis';
import { ImageComparator } from 'test_utils/image_comparator';

import vegaliteGraph from '!!raw-loader!./vegalite_graph.hjson';
Expand All @@ -41,7 +40,10 @@ import vegaMapImage256 from './vega_map_image_256.png';
import { VegaParser } from '../data_model/vega_parser';
import { SearchCache } from '../data_model/search_cache';

import { setup as visualizationsSetup } from '../../../visualizations/public/np_ready/public/legacy';
import {
setup as visualizationsSetup,
start as visualizationsStart,
} from '../../../visualizations/public/np_ready/public/legacy';
import { createVegaTypeDefinition } from '../vega_type';
// TODO This is an integration test and thus requires a running platform. When moving to the new platform,
// this test has to be migrated to the newly created integration test environment.
Expand Down Expand Up @@ -106,7 +108,7 @@ describe('VegaVisualizations', () => {
setupDOM('512px', '512px');
imageComparator = new ImageComparator();

vis = new Vis(indexPattern, { type: 'vega' });
vis = new visualizationsStart.Vis(indexPattern, { type: 'vega' });
});

afterEach(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import expect from '@kbn/expect';
import fixtures from 'fixtures/fake_hierarchical_data';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';

import { Vis } from '../../../../../visualizations/public';
import { start as visualizationsStart } from '../../../../../visualizations/public/np_ready/public/legacy';
import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture';
import { tabifyAggResponse } from '../../../legacy_imports';
import { vislibSlicesResponseHandler } from '../../response_handler';
Expand Down Expand Up @@ -133,7 +133,7 @@ describe('No global chart settings', function() {
responseHandler = vislibSlicesResponseHandler;

let id1 = 1;
stubVis1 = new Vis(indexPattern, {
stubVis1 = new visualizationsStart.Vis(indexPattern, {
type: 'pie',
aggs: rowAgg,
});
Expand Down Expand Up @@ -222,7 +222,7 @@ describe('Vislib PieChart Class Test Suite', function() {
responseHandler = vislibSlicesResponseHandler;

let id = 1;
stubVis = new Vis(indexPattern, {
stubVis = new visualizationsStart.Vis(indexPattern, {
type: 'pie',
aggs: dataAgg,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import _ from 'lodash';
import ngMock from 'ng_mock';
import expect from '@kbn/expect';
import { Vis } from '../..';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { start as visualizations } from '../../legacy';

Expand Down Expand Up @@ -49,7 +48,7 @@ describe('Vis Class', function() {
);

beforeEach(function() {
vis = new Vis(indexPattern, stateFixture);
vis = new visualizations.Vis(indexPattern, stateFixture);
});

const verifyVis = function(vis) {
Expand Down Expand Up @@ -85,7 +84,7 @@ describe('Vis Class', function() {

describe('setState()', function() {
it('should set the state to defaults', function() {
const vis = new Vis(indexPattern);
const vis = new visualizations.Vis(indexPattern);
expect(vis).to.have.property('type');
expect(vis.type).to.eql(visTypes.get('histogram'));
expect(vis).to.have.property('aggs');
Expand All @@ -101,7 +100,7 @@ describe('Vis Class', function() {
expect(vis.isHierarchical()).to.be(true);
});
it('should return false for non-hierarchical vis (like histogram)', function() {
const vis = new Vis(indexPattern);
const vis = new visualizations.Vis(indexPattern);
expect(vis.isHierarchical()).to.be(false);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const createStartContract = (): VisualizationsStart => ({
},
getSavedVisualizationsLoader: jest.fn(),
showNewVisModal: jest.fn(),
Vis: jest.fn(),
});

const createInstance = async () => {
Expand Down
Loading

0 comments on commit 87c892e

Please sign in to comment.