Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwizp committed Jan 31, 2020
1 parent 74bb4d0 commit 5aa5ab5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/reporting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const reporting = (kibana: any) => {
},

async init(server: Legacy.Server) {
return legacyInit(server);
return legacyInit(server, this);
},

deprecations({ unused }: any) {
Expand Down
14 changes: 11 additions & 3 deletions x-pack/legacy/plugins/reporting/server/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,35 @@ import { plugin } from './index';
import { LegacySetup, ReportingSetupDeps, ReportingStartDeps } from './plugin';
import { PluginSetupContract as SecurityPluginSetup } from '../../../../plugins/security/server';
import { PluginStart as DataPluginStart } from '../../../../../src/plugins/data/server';
import { ReportingPluginSpecOptions } from '../types';

const buildLegacyDependencies = (server: Legacy.Server): LegacySetup => ({
const buildLegacyDependencies = (
server: Legacy.Server,
reportingPlugin: ReportingPluginSpecOptions
): LegacySetup => ({
config: server.config,
info: server.info,
route: server.route.bind(server),
plugins: {
elasticsearch: server.plugins.elasticsearch,
xpack_main: server.plugins.xpack_main,
reporting: reportingPlugin,
},
savedObjects: server.savedObjects,
uiSettingsServiceFactory: server.uiSettingsServiceFactory,
});

export const legacyInit = async (server: Legacy.Server) => {
export const legacyInit = async (
server: Legacy.Server,
reportingPlugin: ReportingPluginSpecOptions
) => {
const coreSetup = server.newPlatform.setup.core;
const pluginInstance = plugin(server.newPlatform.coreContext as PluginInitializerContext);

await pluginInstance.setup(coreSetup, {
security: server.newPlatform.setup.plugins.security as SecurityPluginSetup,
usageCollection: server.newPlatform.setup.plugins.usageCollection,
__LEGACY: buildLegacyDependencies(server),
__LEGACY: buildLegacyDependencies(server, reportingPlugin),
} as ReportingSetupDeps);

// Schedule to call the "start" hook only after start dependencies are ready
Expand Down
6 changes: 4 additions & 2 deletions x-pack/legacy/plugins/reporting/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { logConfiguration } from '../log_configuration';
import { PluginStart as DataPluginStart } from '../../../../../src/plugins/data/server';

import { setFieldFormats } from './services';
import { ReportingPluginSpecOptions } from '../types';

export interface ReportingSetupDeps {
usageCollection: UsageCollectionSetup;
Expand All @@ -39,6 +40,7 @@ export interface LegacySetup {
xpack_main: XPackMainPlugin & {
status?: any;
};
reporting: ReportingPluginSpecOptions;
};
route: Legacy.Server['route'];
savedObjects: Legacy.Server['savedObjects'];
Expand Down Expand Up @@ -68,8 +70,8 @@ export class ReportingPlugin implements Plugin<void, void, ReportingSetupDeps, R
logConfiguration(__LEGACY, logger);
runValidations(__LEGACY, logger, browserDriverFactory);

const { xpack_main: xpackMainPlugin } = __LEGACY.plugins;
mirrorPluginStatus(xpackMainPlugin, plugins);
const { xpack_main: xpackMainPlugin, reporting } = __LEGACY.plugins;
mirrorPluginStatus(xpackMainPlugin, reporting);

const checkLicense = checkLicenseFactory(exportTypesRegistry);

Expand Down

0 comments on commit 5aa5ab5

Please sign in to comment.