-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature-integrations-manager' into 47742-make-api-consi…
…stent-take-2
- Loading branch information
Showing
4 changed files
with
101 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
x-pack/legacy/plugins/integrations_manager/server/feature.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { PLUGIN } from '../common/constants'; | ||
import { Feature } from '../../../../plugins/features/server'; | ||
|
||
export const feature: Feature = { | ||
id: PLUGIN.ID, | ||
name: PLUGIN.TITLE, | ||
icon: PLUGIN.ICON, | ||
navLinkId: PLUGIN.ID, | ||
app: [PLUGIN.ID, 'kibana'], | ||
catalogue: [PLUGIN.ID], | ||
privileges: { | ||
all: { | ||
api: [PLUGIN.ID], | ||
catalogue: [PLUGIN.ID], | ||
savedObject: { | ||
all: [], | ||
read: [], | ||
}, | ||
ui: ['show', 'save'], | ||
}, | ||
read: { | ||
api: [PLUGIN.ID], | ||
catalogue: [PLUGIN.ID], | ||
savedObject: { | ||
all: [], | ||
read: [], | ||
}, | ||
ui: ['show'], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { Legacy } from 'kibana'; | ||
import { BehaviorSubject } from 'rxjs'; | ||
import { PLUGIN } from '../common/constants'; | ||
import { EPMCoreSetup, EPMPluginInitializerContext, PluginsSetup } from './plugin'; | ||
|
||
// yes, any. See https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/infra/server/lib/adapters/configuration/kibana_configuration_adapter.ts#L49-L58 | ||
// for a way around it, but this is Legacy Platform and I'm not sure these hoops are worth jumping through. | ||
export const createSetupShim = (server: any) => { | ||
const newPlatform: Legacy.Server['newPlatform'] = server.newPlatform; | ||
const npSetup = newPlatform.setup; | ||
const getConfig$ = () => | ||
new BehaviorSubject(server.config().get(PLUGIN.CONFIG_PREFIX)).asObservable(); | ||
|
||
const initializerContext: EPMPluginInitializerContext = { | ||
config: { | ||
create: getConfig$, | ||
createIfExists: getConfig$, | ||
}, | ||
}; | ||
|
||
const coreSetup: EPMCoreSetup = { | ||
elasticsearch: npSetup.core.elasticsearch, | ||
hapiServer: newPlatform.__internals.hapiServer, | ||
}; | ||
|
||
const pluginsSetup = { | ||
// @ts-ignore: New Platform not typed | ||
features: npSetup.plugins.features as PluginsSetup['features'], | ||
}; | ||
|
||
return { | ||
initializerContext, | ||
coreSetup, | ||
pluginsSetup, | ||
}; | ||
}; |