Skip to content

Commit

Permalink
Move lens server to new platform (#56474)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 authored Feb 5, 2020
1 parent 950ddf8 commit 27dd6dd
Show file tree
Hide file tree
Showing 56 changed files with 187 additions and 290 deletions.
7 changes: 5 additions & 2 deletions x-pack/legacy/plugins/apm/common/projections/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ESSearchRequest, ESSearchBody } from '../../typings/elasticsearch';
import {
ESSearchRequest,
ESSearchBody
} from '../../../../../plugins/apm/typings/elasticsearch';
import {
AggregationOptionsByType,
AggregationInputMap
} from '../../typings/elasticsearch/aggregations';
} from '../../../../../plugins/apm/typings/elasticsearch/aggregations';

export type Projection = Omit<ESSearchRequest, 'body'> & {
body: Omit<ESSearchBody, 'aggs'> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*/
import { merge, isPlainObject, cloneDeep } from 'lodash';
import { DeepPartial } from 'utility-types';
import { AggregationInputMap } from '../../../../typings/elasticsearch/aggregations';
import { AggregationInputMap } from '../../../../../../../plugins/apm/typings/elasticsearch/aggregations';
import {
ESSearchRequest,
ESSearchBody
} from '../../../../typings/elasticsearch';
} from '../../../../../../../plugins/apm/typings/elasticsearch';
import { Projection } from '../../typings';

type PlainObject = Record<string | number | symbol, any>;
Expand Down
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 { ESFilter } from '../../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch';
import {
TRANSACTION_TYPE,
ERROR_GROUP_ID,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/apm/public/services/rest/ml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '../../../common/elasticsearch_fieldnames';
import { getMlJobId, getMlPrefix } from '../../../common/ml_job_constants';
import { callApi } from './callApi';
import { ESFilter } from '../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../plugins/apm/typings/elasticsearch';
import { createCallApmApi, APMClient } from './createCallApmApi';

interface MlResponseItem {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/apm/public/utils/testHelpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
ESFilter,
ESSearchResponse,
ESSearchRequest
} from '../../typings/elasticsearch';
} from '../../../../../plugins/apm/typings/elasticsearch';
import {
ApmPluginContext,
ApmPluginContextValue
Expand Down
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 { ESFilter } from '../../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch';
import {
ERROR_GROUP_ID,
PROCESSOR_EVENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '../helpers/setup_request';
import { getErrorGroupsProjection } from '../../../common/projections/errors';
import { mergeProjection } from '../../../common/projections/util/merge_projection';
import { SortOptions } from '../../../typings/elasticsearch/aggregations';
import { SortOptions } from '../../../../../../plugins/apm/typings/elasticsearch/aggregations';

export type ErrorGroupListAPIResponse = PromiseReturnType<
typeof getErrorGroups
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { getEnvironmentUiFilterES } from '../get_environment_ui_filter_es';
import { ENVIRONMENT_NOT_DEFINED } from '../../../../../common/environment_filter_values';
import { SERVICE_ENVIRONMENT } from '../../../../../common/elasticsearch_fieldnames';
import { ESFilter } from '../../../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../../../plugins/apm/typings/elasticsearch';

describe('getEnvironmentUiFilterES', () => {
it('should return undefined, when environment is undefined', () => {
Expand Down
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 { ESFilter } from '../../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch';
import { ENVIRONMENT_NOT_DEFINED } from '../../../../common/environment_filter_values';
import { SERVICE_ENVIRONMENT } from '../../../../common/elasticsearch_fieldnames';

Expand Down
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 { ESFilter } from '../../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch';
import { UIFilters } from '../../../../typings/ui-filters';
import { getEnvironmentUiFilterES } from './get_environment_ui_filter_es';
import {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/apm/server/lib/helpers/es_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { OBSERVER_VERSION_MAJOR } from '../../../common/elasticsearch_fieldnames
import {
ESSearchResponse,
ESSearchRequest
} from '../../../typings/elasticsearch';
} from '../../../../../../plugins/apm/typings/elasticsearch';
import { APMRequestHandlerContext } from '../../routes/typings';
import { pickKeys } from '../../../public/utils/pickKeys';
import { getApmIndices } from '../settings/apm_indices/get_apm_indices';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
getApmIndices,
ApmIndicesConfig
} from '../settings/apm_indices/get_apm_indices';
import { ESFilter } from '../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../plugins/apm/typings/elasticsearch';
import { ESClient } from './es_client';
import { getUiFiltersES } from './convert_ui_filters/get_ui_filters_es';
import { APMRequestHandlerContext } from '../../routes/typings';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ChartBase } from './types';
import { transformDataToMetricsChart } from './transform_metrics_chart';
import { getMetricsProjection } from '../../../common/projections/metrics';
import { mergeProjection } from '../../../common/projections/util/merge_projection';
import { AggregationOptionsByType } from '../../../typings/elasticsearch/aggregations';
import { AggregationOptionsByType } from '../../../../../../plugins/apm/typings/elasticsearch/aggregations';

interface Aggs {
[key: string]: Unionize<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { ChartBase } from './types';
import {
ESSearchResponse,
ESSearchRequest
} from '../../../typings/elasticsearch';
import { AggregationOptionsByType } from '../../../typings/elasticsearch/aggregations';
} from '../../../../../../plugins/apm/typings/elasticsearch';
import { AggregationOptionsByType } from '../../../../../../plugins/apm/typings/elasticsearch/aggregations';
import { getVizColorForIndex } from '../../../common/viz_colors';

export type GenericMetricsChart = ReturnType<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { ESFilter } from '../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../plugins/apm/typings/elasticsearch';
import { rangeFilter } from '../helpers/range_filter';
import {
PROCESSOR_EVENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
SetupTimeRange
} from '../helpers/setup_request';
import { rangeFilter } from '../helpers/range_filter';
import { ESFilter } from '../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../plugins/apm/typings/elasticsearch';
import {
PROCESSOR_EVENT,
SERVICE_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import { isNumber } from 'lodash';
import { Annotation, AnnotationType } from '../../../../common/annotations';
import { ESFilter } from '../../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch';
import {
SERVICE_NAME,
SERVICE_ENVIRONMENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { ESSearchHit } from '../../../../typings/elasticsearch';
import { ESSearchHit } from '../../../../../../../plugins/apm/typings/elasticsearch';
import {
SERVICE_NAME,
SERVICE_ENVIRONMENT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { getTransactionGroupsProjection } from '../../../common/projections/transaction_groups';
import { mergeProjection } from '../../../common/projections/util/merge_projection';
import { PromiseReturnType } from '../../../typings/common';
import { SortOptions } from '../../../typings/elasticsearch/aggregations';
import { SortOptions } from '../../../../../../plugins/apm/typings/elasticsearch/aggregations';
import { Transaction } from '../../../typings/es_schemas/ui/Transaction';
import {
Setup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import {
ESSearchResponse,
ESSearchRequest
} from '../../../../../typings/elasticsearch';
} from '../../../../../../../../plugins/apm/typings/elasticsearch';

export const response = ({
hits: {
Expand Down
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 { ESFilter } from '../../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../../plugins/apm/typings/elasticsearch';
import { PromiseReturnType } from '../../../../typings/common';
import {
PROCESSOR_EVENT,
Expand Down
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 { ESFilter } from '../../../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../../../plugins/apm/typings/elasticsearch';
import {
PROCESSOR_EVENT,
SERVICE_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { rangeFilter } from '../helpers/range_filter';
import { Setup, SetupTimeRange } from '../helpers/setup_request';
import { ENVIRONMENT_NOT_DEFINED } from '../../../common/environment_filter_values';
import { ESFilter } from '../../../typings/elasticsearch';
import { ESFilter } from '../../../../../../plugins/apm/typings/elasticsearch';

export async function getEnvironments(
setup: Setup & SetupTimeRange,
Expand Down
35 changes: 5 additions & 30 deletions x-pack/legacy/plugins/lens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
import * as Joi from 'joi';
import { resolve } from 'path';
import { LegacyPluginInitializer } from 'src/legacy/types';
import KbnServer, { Server } from 'src/legacy/server/kbn_server';
import mappings from './mappings.json';
import { PLUGIN_ID, getEditPath, NOT_INTERNATIONALIZED_PRODUCT_NAME } from './common';
import { lensServerPlugin } from './server';
import { getTaskManagerSetup, getTaskManagerStart } from '../task_manager/server';
import {
PLUGIN_ID,
getEditPath,
NOT_INTERNATIONALIZED_PRODUCT_NAME,
} from '../../../plugins/lens/common';

export const lens: LegacyPluginInitializer = kibana => {
return new kibana.Plugin({
Expand Down Expand Up @@ -51,31 +52,5 @@ export const lens: LegacyPluginInitializer = kibana => {
enabled: Joi.boolean().default(true),
}).default();
},

init(server: Server) {
const kbnServer = (server as unknown) as KbnServer;

// Set up with the new platform plugin lifecycle API.
const plugin = lensServerPlugin();
const { usageCollection } = server.newPlatform.setup.plugins;

plugin.setup(kbnServer.newPlatform.setup.core, {
usageCollection,
// Legacy APIs
savedObjects: server.savedObjects,
config: server.config(),
server,
taskManager: getTaskManagerSetup(server)!,
});

plugin.start(kbnServer.newPlatform.start.core, {
server,
taskManager: getTaskManagerStart(server)!,
});

server.events.on('stop', () => {
plugin.stop();
});
},
});
};
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/lens/public/app_plugin/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
stopReportManager,
trackUiEvent,
} from '../lens_ui_telemetry';
import { NOT_INTERNATIONALIZED_PRODUCT_NAME } from '../../common';
import { NOT_INTERNATIONALIZED_PRODUCT_NAME } from '../../../../../plugins/lens/common';
import { KibanaLegacySetup } from '../../../../../../src/plugins/kibana_legacy/public';
import { EditorFrameStart } from '../types';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public';
import { Embeddable } from './embeddable';
import { SavedObjectIndexStore, DOC_TYPE } from '../../persistence';
import { getEditPath } from '../../../common';
import { getEditPath } from '../../../../../../plugins/lens/common';

export class EmbeddableFactory extends AbstractEmbeddableFactory {
type = DOC_TYPE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ExpressionFunction,
KibanaContext,
} from '../../../../../../src/plugins/expressions/public';
import { DateRange } from '../../common';
import { DateRange } from '../../../../../plugins/lens/common';

interface LensAutoDateProps {
aggConfigs: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { changeColumn, deleteColumn } from '../state_helpers';
import { isDraggedField, hasField } from '../utils';
import { IndexPatternPrivateState, IndexPatternField } from '../types';
import { trackUiEvent } from '../../lens_ui_telemetry';
import { DateRange } from '../../../common';
import { DateRange } from '../../../../../../plugins/lens/common';

export type IndexPatternDimensionPanelProps = DatasourceDimensionPanelProps & {
state: IndexPatternPrivateState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
import { DraggedField } from './indexpattern';
import { DragDrop } from '../drag_drop';
import { DatasourceDataPanelProps, DataType } from '../types';
import { BucketedAggregation, FieldStatsResponse } from '../../common';
import { BucketedAggregation, FieldStatsResponse } from '../../../../../plugins/lens/common';
import { IndexPattern, IndexPatternField } from './types';
import { getColorForDataType, LensFieldIcon } from './lens_field_icon';
import { trackUiEvent } from '../lens_ui_telemetry';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
IndexPatternField,
} from './types';
import { updateLayerIndexPattern } from './state_helpers';
import { DateRange, ExistingFields } from '../../common/types';
import { BASE_API_URL } from '../../common';
import { DateRange, ExistingFields } from '../../../../../plugins/lens/common/types';
import { BASE_API_URL } from '../../../../../plugins/lens/common';
import { documentField } from './document_field';
import { isNestedField, IFieldType, TypeMeta } from '../../../../../../src/plugins/data/public';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { countOperation } from './count';
import { DimensionPriority, StateSetter, OperationMetadata } from '../../../types';
import { BaseIndexPatternColumn } from './column_types';
import { IndexPatternPrivateState, IndexPattern, IndexPatternField } from '../../types';
import { DateRange } from '../../../../common';
import { DateRange } from '../../../../../../../plugins/lens/common';

// List of all operation definitions registered to this data source.
// If you want to implement a new operation, add it to this array and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import moment from 'moment';
import { HttpSetup } from 'src/core/public';

import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
import { BASE_API_URL } from '../../common';
import { BASE_API_URL } from '../../../../../plugins/lens/common';

const STORAGE_KEY = 'lens-ui-telemetry';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { i18n } from '@kbn/i18n';
import { setup as visualizations } from '../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy';
import { getBasePath, getEditPath } from '../common';
import { getBasePath, getEditPath } from '../../../../plugins/lens/common';

visualizations.types.registerAlias({
aliasUrl: getBasePath(),
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/lens/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { SavedQuery } from 'src/legacy/core_plugins/data/public';
import { KibanaDatatable } from '../../../../../src/plugins/expressions/public';
import { DragContextState } from './drag_drop';
import { Document } from './persistence';
import { DateRange } from '../common';
import { DateRange } from '../../../../plugins/lens/common';
import { Query, esFilters } from '../../../../../src/plugins/data/public';

// eslint-disable-next-line
Expand Down
Loading

0 comments on commit 27dd6dd

Please sign in to comment.