Skip to content

Commit

Permalink
Merge branch '7.x' into backport/7.x/pr-57473
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Feb 27, 2020
2 parents a740d06 + a30e6d9 commit 2098818
Show file tree
Hide file tree
Showing 155 changed files with 1,611 additions and 1,641 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ import {
IndexPatternsContract,
DataPublicPluginStart,
} from 'src/plugins/data/public';
import { createSavedSearchesLoader } from './saved_searches';

import { DiscoverStartPlugins } from './plugin';
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';
import { createSavedSearchesLoader } from '../../../../../plugins/discover/public';

export interface DiscoverServices {
addBasePath: (path: string) => string;
Expand Down
2 changes: 0 additions & 2 deletions src/legacy/core_plugins/kibana/public/discover/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import { PluginInitializerContext } from 'kibana/public';
import { DiscoverPlugin } from './plugin';

export { createSavedSearchesLoader } from './saved_searches/saved_searches';

// Core will be looking for this when loading our plugin in the new platform
export const plugin = (context: PluginInitializerContext) => {
return new DiscoverPlugin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { i18n } from '@kbn/i18n';
import { npStart } from 'ui/new_platform';
import { SavedObjectLoader } from '../../../../../plugins/saved_objects/public';
import { createSavedDashboardLoader } from '../dashboard';
import { createSavedSearchesLoader } from '../discover';
import { TypesService, createSavedVisLoader } from '../../../visualizations/public';
import { createSavedSearchesLoader } from '../../../../../plugins/discover/public';

/**
* This registry is used for the editing mode of Saved Searches, Visualizations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ export {
isDateHistogramBucketAggConfig,
setBounds,
} from '../../data/public';
export { createSavedSearchesLoader } from '../../kibana/public/discover/saved_searches/';
export { createSavedSearchesLoader } from '../../../../plugins/discover/public';
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { extractReferences, injectReferences } from './saved_visualization_refer
import { IIndexPattern } from '../../../../../../../plugins/data/public';
import { VisSavedObject } from '../types';
import { VisImpl } from '../vis_impl';
import { createSavedSearchesLoader } from '../../../legacy_imports';
import { createSavedSearchesLoader } from '../../../../../../../plugins/discover/public';

async function _afterEsResp(savedVis: VisSavedObject, services: any) {
await _getLinkedSavedSearch(savedVis, services);
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/apm_oss/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/

import { schema, TypeOf } from '@kbn/config-schema';
import { PluginInitializerContext } from '../../../core/server';
import { APMOSSPlugin } from './plugin';
import { APMOSSPlugin, APMOSSPluginSetup } from './plugin';

export const config = {
schema: schema.object({
Expand All @@ -38,4 +39,4 @@ export function plugin(initializerContext: PluginInitializerContext) {

export type APMOSSConfig = TypeOf<typeof config.schema>;

export { APMOSSPlugin as Plugin };
export { APMOSSPlugin as Plugin, APMOSSPluginSetup };
42 changes: 42 additions & 0 deletions src/plugins/apm_oss/server/mocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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 { of } from 'rxjs';
import { APMOSSConfig } from '.';
import { APMOSSPluginSetup } from './plugin';

const apmStar = 'apm-*';

const defaultConfig = {
errorIndices: apmStar,
indexPattern: apmStar,
metricsIndices: apmStar,
onboardingIndices: apmStar,
sourcemapIndices: apmStar,
spanIndices: apmStar,
transactionIndices: apmStar,
};

export const apmOSSPluginSetupMock = {
create(config: Partial<APMOSSConfig> = {}): APMOSSPluginSetup {
return {
config$: of({ ...defaultConfig, ...config }),
};
},
};
6 changes: 5 additions & 1 deletion src/plugins/apm_oss/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import { Plugin, CoreSetup, PluginInitializerContext } from 'src/core/server';
import { Observable } from 'rxjs';
import { APMOSSConfig } from './';

export class APMOSSPlugin implements Plugin<{ config$: Observable<APMOSSConfig> }> {
export interface APMOSSPluginSetup {
config$: Observable<APMOSSConfig>;
}

export class APMOSSPlugin implements Plugin<APMOSSPluginSetup> {
constructor(private readonly initContext: PluginInitializerContext) {
this.initContext = initContext;
}
Expand Down
20 changes: 20 additions & 0 deletions src/plugins/discover/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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.
*/

export { createSavedSearchesLoader } from './saved_searches/saved_searches';
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import {
createSavedObjectClass,
SavedObjectKibanaServices,
} from '../../../../../../plugins/saved_objects/public';
import { createSavedObjectClass, SavedObjectKibanaServices } from '../../../saved_objects/public';

export function createSavedSearchClass(services: SavedObjectKibanaServices) {
const SavedObjectClass = createSavedObjectClass(services);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
* under the License.
*/

import {
SavedObjectLoader,
SavedObjectKibanaServices,
} from '../../../../../../plugins/saved_objects/public';
import { SavedObjectLoader, SavedObjectKibanaServices } from '../../../saved_objects/public';
import { createSavedSearchClass } from './_saved_search';

export function createSavedSearchesLoader(services: SavedObjectKibanaServices) {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"xpack.taskManager": "legacy/plugins/task_manager",
"xpack.transform": "legacy/plugins/transform",
"xpack.triggersActionsUI": "plugins/triggers_actions_ui",
"xpack.upgradeAssistant": "legacy/plugins/upgrade_assistant",
"xpack.upgradeAssistant": "plugins/upgrade_assistant",
"xpack.uptime": "legacy/plugins/uptime",
"xpack.watcher": "plugins/watcher"
},
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/transform/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { documentationLinksService } from './app/services/documentation';
import { httpService } from './app/services/http';
import { textService } from './app/services/text';
import { uiMetricService } from './app/services/ui_metric';
import { createSavedSearchesLoader } from '../../../../../src/legacy/core_plugins/kibana/public/discover/saved_searches';
import { createSavedSearchesLoader } from '../../../../../src/plugins/discover/public';

const REACT_ROOT_ID = 'transformReactRoot';
const KBN_MANAGEMENT_SECTION = 'elasticsearch/transform';
Expand Down
46 changes: 1 addition & 45 deletions x-pack/legacy/plugins/upgrade_assistant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,14 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import _ from 'lodash';
import Joi from 'joi';
import { Legacy } from 'kibana';
import { resolve } from 'path';
import mappings from './mappings.json';
import { plugin } from './server/np_ready';
import { CloudSetup } from '../../../plugins/cloud/server';

export function upgradeAssistant(kibana: any) {
const publicSrc = resolve(__dirname, 'public');
const npSrc = resolve(publicSrc, 'np_ready');

const config: Legacy.PluginSpecOptions = {
id: 'upgrade_assistant',
configPrefix: 'xpack.upgrade_assistant',
require: ['elasticsearch', 'xpack_main'],
uiExports: {
// @ts-ignore
managementSections: ['plugins/upgrade_assistant/legacy'],
savedObjectSchemas: {
'upgrade-assistant-reindex-operation': {
isNamespaceAgnostic: true,
Expand All @@ -30,43 +19,10 @@ export function upgradeAssistant(kibana: any) {
isNamespaceAgnostic: true,
},
},
styleSheetPaths: resolve(npSrc, 'application/index.scss'),
mappings,
},
publicDir: publicSrc,

config() {
return Joi.object({
enabled: Joi.boolean().default(true),
}).default();
},

init(server: Legacy.Server) {
// Add server routes and initialize the plugin here
const instance = plugin({} as any);

const { usageCollection, cloud } = server.newPlatform.setup.plugins;
instance.setup(server.newPlatform.setup.core, {
usageCollection,
cloud: cloud as CloudSetup,
__LEGACY: {
// Legacy objects
events: server.events,
savedObjects: server.savedObjects,

// Legacy functions
log: server.log.bind(server),
route: server.route.bind(server),

// Legacy plugins
plugins: {
apm_oss: server.plugins.apm_oss,
elasticsearch: server.plugins.elasticsearch,
xpack_main: server.plugins.xpack_main,
},
} as any,
});
},
init() {},
};
return new kibana.Plugin(config);
}
7 changes: 0 additions & 7 deletions x-pack/legacy/plugins/upgrade_assistant/public/index.ts

This file was deleted.

106 changes: 0 additions & 106 deletions x-pack/legacy/plugins/upgrade_assistant/public/legacy.ts

This file was deleted.

Loading

0 comments on commit 2098818

Please sign in to comment.