mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
parent
83aa427f0b
commit
e08bcd9a5a
8 changed files with 33 additions and 12 deletions
|
@ -19,8 +19,6 @@
|
|||
|
||||
export function injectVars(server) {
|
||||
const serverConfig = server.config();
|
||||
const mapConfig = serverConfig.get('map');
|
||||
const regionmap = mapConfig.regionmap;
|
||||
|
||||
// Get types that are import and exportable, by default yes unless isImportableAndExportable is set to false
|
||||
const { types: allTypes } = server.savedObjects;
|
||||
|
@ -32,7 +30,6 @@ export function injectVars(server) {
|
|||
return {
|
||||
kbnDefaultAppId: serverConfig.get('kibana.defaultAppId'),
|
||||
disableWelcomeScreen: serverConfig.get('kibana.disableWelcomeScreen'),
|
||||
regionmapsConfig: regionmap,
|
||||
importAndExportableTypes,
|
||||
autocompleteTerminateAfter: serverConfig.get('kibana.autocompleteTerminateAfter'),
|
||||
autocompleteTimeout: serverConfig.get('kibana.autocompleteTimeout'),
|
||||
|
|
|
@ -30,7 +30,13 @@ const regionMapPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyP
|
|||
uiExports: {
|
||||
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
|
||||
hacks: [resolve(__dirname, 'public/legacy')],
|
||||
injectDefaultVars: server => ({}),
|
||||
injectDefaultVars(server) {
|
||||
const { regionmap } = server.config().get('map');
|
||||
|
||||
return {
|
||||
regionmap,
|
||||
};
|
||||
},
|
||||
},
|
||||
init: (server: Legacy.Server) => ({}),
|
||||
config(Joi: any) {
|
||||
|
|
|
@ -89,8 +89,11 @@ describe('RegionMapsVisualizationTests', function () {
|
|||
let getManifestStub;
|
||||
beforeEach(ngMock.inject((Private, $injector) => {
|
||||
const serviceSettings = $injector.get('serviceSettings');
|
||||
const regionmapsConfig = $injector.get('regionmapsConfig');
|
||||
const uiSettings = $injector.get('config');
|
||||
const regionmapsConfig = {
|
||||
includeElasticMapsService: true,
|
||||
layers: []
|
||||
};
|
||||
|
||||
dependencies = {
|
||||
serviceSettings,
|
||||
|
|
|
@ -21,17 +21,21 @@ import { PluginInitializerContext } from 'kibana/public';
|
|||
import { npSetup, npStart } from 'ui/new_platform';
|
||||
|
||||
import { visualizations } from '../../visualizations/public';
|
||||
import { RegionMapPluginSetupDependencies } from './plugin';
|
||||
import { RegionMapPluginSetupDependencies, RegionMapsConfig } from './plugin';
|
||||
import { LegacyDependenciesPlugin } from './shim';
|
||||
import { plugin } from '.';
|
||||
|
||||
const regionmapsConfig = npSetup.core.injectedMetadata.getInjectedVar(
|
||||
'regionmap'
|
||||
) as RegionMapsConfig;
|
||||
|
||||
const plugins: Readonly<RegionMapPluginSetupDependencies> = {
|
||||
visualizations,
|
||||
data: npSetup.plugins.data,
|
||||
|
||||
// Temporary solution
|
||||
// It will be removed when all dependent services are migrated to the new platform.
|
||||
__LEGACY: new LegacyDependenciesPlugin(),
|
||||
__LEGACY: new LegacyDependenciesPlugin(regionmapsConfig),
|
||||
};
|
||||
|
||||
const pluginInstance = plugin({} as PluginInitializerContext);
|
||||
|
|
|
@ -45,6 +45,12 @@ export interface RegionMapPluginSetupDependencies {
|
|||
__LEGACY: LegacyDependenciesPlugin;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export interface RegionMapsConfig {
|
||||
includeElasticMapsService: boolean;
|
||||
layers: any[];
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export class RegionMapPlugin implements Plugin<Promise<void>, void> {
|
||||
initializerContext: PluginInitializerContext;
|
||||
|
|
|
@ -29,7 +29,6 @@ export function RegionMapVisParams(serviceSettings, regionmapsConfig) {
|
|||
restrict: 'E',
|
||||
template: regionMapVisParamsTemplate,
|
||||
link: function ($scope) {
|
||||
|
||||
$scope.collections = $scope.vis.type.editorConfig.collections;
|
||||
$scope.onLayerChange = onLayerChange;
|
||||
|
||||
|
|
|
@ -20,29 +20,32 @@
|
|||
import chrome from 'ui/chrome';
|
||||
import { CoreStart, Plugin } from 'kibana/public';
|
||||
import { initTileMapLegacyModule } from './region_map_legacy_module';
|
||||
import { RegionMapsConfig } from '../plugin';
|
||||
|
||||
/** @internal */
|
||||
export interface LegacyDependenciesPluginSetup {
|
||||
$injector: any;
|
||||
serviceSettings: any;
|
||||
regionmapsConfig: any;
|
||||
regionmapsConfig: RegionMapsConfig;
|
||||
}
|
||||
|
||||
export class LegacyDependenciesPlugin
|
||||
implements Plugin<Promise<LegacyDependenciesPluginSetup>, void> {
|
||||
constructor(private readonly regionmapsConfig: RegionMapsConfig) {}
|
||||
|
||||
public async setup() {
|
||||
initTileMapLegacyModule();
|
||||
initTileMapLegacyModule(this.regionmapsConfig);
|
||||
|
||||
const $injector = await chrome.dangerouslyGetActiveInjector();
|
||||
|
||||
return {
|
||||
$injector,
|
||||
regionmapsConfig: this.regionmapsConfig,
|
||||
// Settings for EMSClient.
|
||||
// EMSClient, which currently lives in the tile_map vis,
|
||||
// will probably end up being exposed from the future vis_type_maps plugin,
|
||||
// which would register both the tile_map and the region_map vis plugins.
|
||||
serviceSettings: $injector.get('serviceSettings'),
|
||||
regionmapsConfig: $injector.get('regionmapsConfig'),
|
||||
} as LegacyDependenciesPluginSetup;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,12 +28,15 @@ import { RegionMapVisParams } from '../region_map_vis_params';
|
|||
// @ts-ignore
|
||||
import { WmsOptions } from '../wms_options';
|
||||
|
||||
import { RegionMapsConfig } from '../plugin';
|
||||
|
||||
/** @internal */
|
||||
export const initTileMapLegacyModule = once((): void => {
|
||||
export const initTileMapLegacyModule = once((regionmapsConfig: RegionMapsConfig): void => {
|
||||
uiModules
|
||||
// TODO: Region Map Plugin uses wmsOptions directive from the kibana/tile_map module.
|
||||
// in future this reference should be removed
|
||||
.get('kibana/region_map', ['kibana'])
|
||||
.constant('regionmapsConfig', regionmapsConfig)
|
||||
.directive('regionMapVisParams', RegionMapVisParams)
|
||||
.directive('wmsOptions', WmsOptions);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue