Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into np/vis_type_vislib
Browse files Browse the repository at this point in the history
# Conflicts:
#	.i18nrc.json
  • Loading branch information
sulemanof committed Apr 23, 2020
2 parents 05a5e9e + d37bee9 commit ebbb1be
Show file tree
Hide file tree
Showing 45 changed files with 281 additions and 154 deletions.
3 changes: 3 additions & 0 deletions .github/paths-labeller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
- "Feature:ExpressionLanguage":
- "src/plugins/expressions/**/*.*"
- "src/plugins/bfetch/**/*.*"
- "Team:apm"
- "x-pack/plugins/apm/**/*.*"
- "x-pack/legacy/plugins/apm/**/*.*"
- "Team:uptime":
- "x-pack/plugins/uptime/**/*.*"
- "x-pack/legacy/plugins/uptime/**/*.*"
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"visTypeMarkdown": "src/plugins/vis_type_markdown",
"visTypeMetric": "src/plugins/vis_type_metric",
"visTypeTable": "src/plugins/vis_type_table",
"visTypeTagCloud": "src/legacy/core_plugins/vis_type_tagcloud",
"visTypeTagCloud": "src/plugins/vis_type_tagcloud",
"visTypeTimeseries": "src/plugins/vis_type_timeseries",
"visTypeVega": "src/legacy/core_plugins/vis_type_vega",
"visTypeVislib": "src/plugins/vis_type_vislib",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ import expect from '@kbn/expect';
import _ from 'lodash';
import d3 from 'd3';

import { TagCloud } from '../tag_cloud';
import { fromNode, delay } from 'bluebird';
import { ImageComparator } from 'test_utils/image_comparator';
import simpleloadPng from './simpleload.png';

// Replace with mock when converting to jest tests
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { seedColors } from '../../../../../../plugins/charts/public/services/colors/seed_colors';
// Will be replaced with new path when tests are moved
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { TagCloud } from '../../../../../../plugins/vis_type_tagcloud/public/components/tag_cloud';

describe('tag cloud tests', function() {
const minValue = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { ImageComparator } from 'test_utils/image_comparator';
import { createTagCloudVisualization } from '../tag_cloud_visualization';
import basicdrawPng from './basicdraw.png';
import afterresizePng from './afterresize.png';
import afterparamChange from './afterparamchange.png';
Expand All @@ -32,7 +31,14 @@ import { ExprVis } from '../../../../../../plugins/visualizations/public/express
import { seedColors } from '../../../../../../plugins/charts/public/services/colors/seed_colors';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { BaseVisType } from '../../../../../../plugins/visualizations/public/vis_types/base_vis_type';
import { createTagCloudVisTypeDefinition } from '../../tag_cloud_type';
// Will be replaced with new path when tests are moved
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { createTagCloudVisTypeDefinition } from '../../../../../../plugins/vis_type_tagcloud/public/tag_cloud_type';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { createTagCloudVisualization } from '../../../../../../plugins/vis_type_tagcloud/public/components/tag_cloud_visualization';
import { npStart } from 'ui/new_platform';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { setFormatService } from '../../../../../../plugins/vis_type_tagcloud/public/services';

const THRESHOLD = 0.65;
const PIXEL_DIFF = 64;
Expand Down Expand Up @@ -66,6 +72,8 @@ describe('TagCloudVisualizationTest', function() {
},
});

before(() => setFormatService(npStart.plugins.data.fieldFormats));

beforeEach(ngMock.module('kibana'));

describe('TagCloudVisualization - basics', function() {
Expand Down
44 changes: 0 additions & 44 deletions src/legacy/core_plugins/vis_type_tagcloud/index.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/legacy/core_plugins/vis_type_tagcloud/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion src/plugins/home/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"server": true,
"ui": true,
"requiredPlugins": ["data", "kibanaLegacy"],
"optionalPlugins": ["usage_collection", "telemetry"]
"optionalPlugins": ["usageCollection", "telemetry"]
}
4 changes: 2 additions & 2 deletions src/plugins/home/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { UsageCollectionSetup } from '../../usage_collection/server';
import { sampleDataTelemetry } from './saved_objects';

interface HomeServerPluginSetupDependencies {
usage_collection?: UsageCollectionSetup;
usageCollection?: UsageCollectionSetup;
}

export class HomeServerPlugin implements Plugin<HomeServerPluginSetup, HomeServerPluginStart> {
Expand All @@ -41,7 +41,7 @@ export class HomeServerPlugin implements Plugin<HomeServerPluginSetup, HomeServe
core.savedObjects.registerType(sampleDataTelemetry);
return {
tutorials: { ...this.tutorialsRegistry.setup(core) },
sampleData: { ...this.sampleDataRegistry.setup(core, plugins.usage_collection) },
sampleData: { ...this.sampleDataRegistry.setup(core, plugins.usageCollection) },
};
}

Expand Down
26 changes: 26 additions & 0 deletions src/plugins/vis_type_tagcloud/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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 { schema, TypeOf } from '@kbn/config-schema';

export const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: true }),
});

export type ConfigSchema = TypeOf<typeof configSchema>;
7 changes: 7 additions & 0 deletions src/plugins/vis_type_tagcloud/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "visTypeTagcloud",
"version": "kibana",
"ui": true,
"server": true,
"requiredPlugins": ["data", "expressions", "visualizations", "charts"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import React from 'react';
import { EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import { ValidatedDualRange } from '../../../../../../src/plugins/kibana_react/public';
import { SelectOption, SwitchOption } from '../../../../../plugins/charts/public';
import { VisOptionsProps } from '../../../vis_default_editor/public';
import { ValidatedDualRange } from '../../../kibana_react/public';
import { SelectOption, SwitchOption } from '../../../charts/public';
import { TagCloudVisParams } from '../types';

function TagCloudOptions({ stateParams, setValue, vis }: VisOptionsProps<TagCloudVisParams>) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import 'src/legacy/ui/public/styles/styling_constants';

// Prefix all styles with "tgc" to avoid conflicts.
// Examples
// tgcChart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { PluginInitializerContext } from '../../../../core/public';
import { PluginInitializerContext } from 'kibana/public';
import { TagCloudPlugin as Plugin } from './plugin';

export function plugin(initializerContext: PluginInitializerContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@
* under the License.
*/

import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../../core/public';
import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public';
import { VisualizationsSetup } from '../../../../plugins/visualizations/public';
import { ChartsPluginSetup } from '../../../../plugins/charts/public';
import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'kibana/public';
import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public';
import { VisualizationsSetup } from '../../visualizations/public';
import { ChartsPluginSetup } from '../../charts/public';

import { createTagCloudFn } from './tag_cloud_fn';
import { createTagCloudVisTypeDefinition } from './tag_cloud_type';
import { DataPublicPluginStart } from '../../../../plugins/data/public';
import { DataPublicPluginStart } from '../../data/public';
import { setFormatService } from './services';
import { ConfigSchema } from '../config';

import './index.scss';

/** @internal */
export interface TagCloudPluginSetupDependencies {
Expand All @@ -46,9 +49,9 @@ export interface TagCloudVisPluginStartDependencies {

/** @internal */
export class TagCloudPlugin implements Plugin<void, void> {
initializerContext: PluginInitializerContext;
initializerContext: PluginInitializerContext<ConfigSchema>;

constructor(initializerContext: PluginInitializerContext) {
constructor(initializerContext: PluginInitializerContext<ConfigSchema>) {
this.initializerContext = initializerContext;
}

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

import { createGetterSetter } from '../../../../plugins/kibana_utils/public';
import { DataPublicPluginStart } from '../../../../plugins/data/public';
import { createGetterSetter } from '../../kibana_utils/public';
import { DataPublicPluginStart } from '../../data/public';

export const [getFormatService, setFormatService] = createGetterSetter<
DataPublicPluginStart['fieldFormats']
>('data.fieldFormats');

export { npStart } from 'ui/new_platform';
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

import { createTagCloudFn } from './tag_cloud_fn';

// eslint-disable-next-line
import { functionWrapper } from '../../../../plugins/expressions/common/expression_functions/specs/tests/utils';
import { functionWrapper } from '../../expressions/common/expression_functions/specs/tests/utils';

describe('interpreter/functions#tagcloud', () => {
const fn = functionWrapper(createTagCloudFn());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@

import { i18n } from '@kbn/i18n';

import {
ExpressionFunctionDefinition,
KibanaDatatable,
Render,
} from '../../../../plugins/expressions/public';
import { ExpressionFunctionDefinition, KibanaDatatable, Render } from '../../expressions/public';
import { TagCloudVisParams } from './types';

const name = 'tagcloud';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { i18n } from '@kbn/i18n';

import { Schemas } from '../../../../plugins/vis_default_editor/public';
import { Schemas } from '../../vis_default_editor/public';

import { TagCloudOptions } from './components/tag_cloud_options';

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

import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';
import { TagCloudPluginSetupDependencies } from './plugin';
import { plugin } from '.';
import { PluginConfigDescriptor } from 'kibana/server';

const plugins: Readonly<TagCloudPluginSetupDependencies> = {
expressions: npSetup.plugins.expressions,
visualizations: npSetup.plugins.visualizations,
charts: npSetup.plugins.charts,
};
import { configSchema, ConfigSchema } from '../config';

const pluginInstance = plugin({} as PluginInitializerContext);
export const config: PluginConfigDescriptor<ConfigSchema> = {
schema: configSchema,
deprecations: ({ renameFromRoot }) => [
renameFromRoot('tagcloud.enabled', 'vis_type_tagcloud.enabled'),
],
};

export const setup = pluginInstance.setup(npSetup.core, plugins);
export const start = pluginInstance.start(npStart.core, { data: npStart.plugins.data });
export const plugin = () => ({
setup() {},
start() {},
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { IndexPatternRetriever } from './index_pattern';
import { AgentService } from '../../ingest_manager/common/types';
import { AgentService } from '../../ingest_manager/server';

/**
* A singleton that holds shared services that are initialized during the start up phase
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/endpoint/server/index_pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import { Logger, LoggerFactory, RequestHandlerContext } from 'kibana/server';
import { EndpointAppConstants } from '../common/types';
import { ESIndexPatternService } from '../../ingest_manager/common/types';
import { ESIndexPatternService } from '../../ingest_manager/server';

export interface IndexPatternRetriever {
getIndexPattern(ctx: RequestHandlerContext, datasetPath: string): Promise<string>;
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/endpoint/server/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { AgentService, IngestManagerStartupContract } from '../../ingest_manager/common/types';
import { AgentService, IngestManagerStartContract } from '../../ingest_manager/server';

/**
* Creates a mock IndexPatternRetriever for use in tests.
Expand Down Expand Up @@ -46,9 +46,9 @@ export const createMockAgentService = (): jest.Mocked<AgentService> => {
* @param indexPattern a string index pattern to return when called by a test
* @returns the same value as `indexPattern` parameter
*/
export const createMockIngestManagerStartupContract = (
export const createMockIngestManagerStartContract = (
indexPattern: string
): IngestManagerStartupContract => {
): IngestManagerStartContract => {
return {
esIndexPatternService: {
getESIndexPattern: jest.fn().mockResolvedValue(indexPattern),
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/endpoint/server/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from './plugin';
import { coreMock } from '../../../../src/core/server/mocks';
import { PluginSetupContract } from '../../features/server';
import { createMockIngestManagerStartupContract } from './mocks';
import { createMockIngestManagerStartContract } from './mocks';

describe('test endpoint plugin', () => {
let plugin: EndpointPlugin;
Expand Down Expand Up @@ -51,7 +51,7 @@ describe('test endpoint plugin', () => {

it('test properly start plugin', async () => {
mockedEndpointPluginStartDependencies = {
ingestManager: createMockIngestManagerStartupContract(''),
ingestManager: createMockIngestManagerStartContract(''),
};
await plugin.start(mockCoreStart, mockedEndpointPluginStartDependencies);
expect(plugin.getEndpointAppContextService().getAgentService()).toBeTruthy();
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/endpoint/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import { registerResolverRoutes } from './routes/resolver';
import { registerIndexPatternRoute } from './routes/index_pattern';
import { registerEndpointRoutes } from './routes/metadata';
import { IngestIndexPatternRetriever } from './index_pattern';
import { IngestManagerStartupContract } from '../../ingest_manager/common/types';
import { IngestManagerStartContract } from '../../ingest_manager/server';
import { EndpointAppContextService } from './endpoint_app_context_services';

export type EndpointPluginStart = void;
export type EndpointPluginSetup = void;
export interface EndpointPluginStartDependencies {
ingestManager: IngestManagerStartupContract;
ingestManager: IngestManagerStartContract;
}

export interface EndpointPluginSetupDependencies {
Expand Down
Loading

0 comments on commit ebbb1be

Please sign in to comment.