Skip to content

Commit

Permalink
WIP server np move
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrhodes committed Jan 3, 2020
1 parent 38e8916 commit 67f2416
Show file tree
Hide file tree
Showing 136 changed files with 19 additions and 14,063 deletions.
61 changes: 6 additions & 55 deletions x-pack/legacy/plugins/infra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@
import { i18n } from '@kbn/i18n';
import JoiNamespace from 'joi';
import { resolve } from 'path';
import { PluginInitializerContext } from 'src/core/server';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import KbnServer from 'src/legacy/server/kbn_server';
import { getConfigSchema } from './server/kibana.index';
import { savedObjectMappings } from './server/saved_objects';
import { plugin, InfraServerPluginDeps } from './server/new_platform_index';
import { InfraSetup } from '../../../plugins/infra/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../../plugins/features/server';
import { SpacesPluginSetup } from '../../../plugins/spaces/server';
import { APMPluginContract } from '../../../plugins/apm/server';

const APP_ID = 'infra';
const logsSampleDataLinkLabel = i18n.translate('xpack.infra.sampleDataLinkLabel', {
Expand Down Expand Up @@ -72,55 +62,16 @@ export function infra(kibana: any) {
url: `/app/${APP_ID}#/logs`,
},
],
mappings: savedObjectMappings,
// mappings: savedObjectMappings,
},
config(Joi: typeof JoiNamespace) {
return getConfigSchema(Joi);
return Joi.object({
enabled: Joi.boolean().default(true),
})
.unknown()
.default();
},
init(legacyServer: any) {
const { newPlatform } = legacyServer as KbnServer;
const { core, plugins } = newPlatform.setup;

const infraSetup = (plugins.infra as unknown) as InfraSetup; // chef's kiss

const initContext = ({
config: infraSetup.__legacy.config,
} as unknown) as PluginInitializerContext;
// NP_TODO: Use real types from the other plugins as they are migrated
const pluginDeps: InfraServerPluginDeps = {
usageCollection: plugins.usageCollection as UsageCollectionSetup,
indexPatterns: {
indexPatternsServiceFactory: legacyServer.indexPatternsServiceFactory,
},
metrics: legacyServer.plugins.metrics,
spaces: plugins.spaces as SpacesPluginSetup,
features: plugins.features as FeaturesPluginSetup,
// NP_NOTE: [TSVB_GROUP] Huge hack to make TSVB (getVisData()) work with raw requests that
// originate from the New Platform router (and are very different to the old request object).
// Once TSVB has migrated over to NP, and can work with the new raw requests, or ideally just
// the requestContext, this can be removed.
___legacy: {
tsvb: {
elasticsearch: legacyServer.plugins.elasticsearch,
__internals: legacyServer.newPlatform.__internals,
},
},
apm: plugins.apm as APMPluginContract,
};

const infraPluginInstance = plugin(initContext);
infraPluginInstance.setup(core, pluginDeps);

// NP_TODO: EVERYTHING BELOW HERE IS LEGACY

const libs = infraPluginInstance.getLibs();

// NP_NOTE: Left here for now for legacy plugins to consume
legacyServer.expose(
'defineInternalSourceConfiguration',
libs.sources.defineInternalSourceConfiguration.bind(libs.sources)
);

// NP_TODO: How do we move this to new platform?
legacyServer.addAppLinksToSampleDataset('logs', [
{
Expand Down
65 changes: 0 additions & 65 deletions x-pack/legacy/plugins/infra/server/features.ts

This file was deleted.

19 changes: 0 additions & 19 deletions x-pack/legacy/plugins/infra/server/graphql/index.ts

This file was deleted.

This file was deleted.

197 changes: 0 additions & 197 deletions x-pack/legacy/plugins/infra/server/graphql/log_entries/resolvers.ts

This file was deleted.

Loading

0 comments on commit 67f2416

Please sign in to comment.