mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* Pull core service init out into separate function * Call bind function from embeddable factory constructor * Move inspector init back to start method. Remove old license check file * Add TS types
This commit is contained in:
parent
20eeea2f29
commit
7f6ce76a84
3 changed files with 14 additions and 47 deletions
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* on the license information extracted from the xPackInfo.
|
||||
* @param {XPackInfo} xPackInfo XPackInfo instance to extract license information from.
|
||||
* @returns {LicenseCheckResult}
|
||||
*/
|
||||
export function checkLicense(xPackInfo) {
|
||||
if (!xPackInfo.isAvailable()) {
|
||||
return {
|
||||
maps: false,
|
||||
};
|
||||
}
|
||||
|
||||
const isAnyXpackLicense = xPackInfo.license.isOneOf([
|
||||
'basic',
|
||||
'standard',
|
||||
'gold',
|
||||
'platinum',
|
||||
'enterprise',
|
||||
'trial',
|
||||
]);
|
||||
|
||||
if (!isAnyXpackLicense) {
|
||||
return {
|
||||
maps: false,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
maps: true,
|
||||
uid: xPackInfo.license.getUid(),
|
||||
};
|
||||
}
|
|
@ -23,6 +23,8 @@ import { getQueryableUniqueIndexPatternIds } from '../selectors/map_selectors';
|
|||
import { getInitialLayers } from '../angular/get_initial_layers';
|
||||
import { mergeInputWithSavedMap } from './merge_input_with_saved_map';
|
||||
import '../angular/services/gis_map_saved_object_loader';
|
||||
import { bindSetupCoreAndPlugins } from '../plugin';
|
||||
import { npSetup } from 'ui/new_platform';
|
||||
|
||||
export class MapEmbeddableFactory extends EmbeddableFactory {
|
||||
type = MAP_SAVED_OBJECT_TYPE;
|
||||
|
@ -37,6 +39,7 @@ export class MapEmbeddableFactory extends EmbeddableFactory {
|
|||
getIconForSavedObject: () => APP_ICON,
|
||||
},
|
||||
});
|
||||
bindSetupCoreAndPlugins(npSetup.core, npSetup.plugins);
|
||||
}
|
||||
isEditable() {
|
||||
return capabilities.get().maps.save;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { Plugin, CoreStart } from 'src/core/public';
|
||||
import { Plugin, CoreStart, CoreSetup } from 'src/core/public';
|
||||
// @ts-ignore
|
||||
import { wrapInI18nContext } from 'ui/i18n';
|
||||
// @ts-ignore
|
||||
|
@ -31,23 +31,25 @@ interface MapsPluginSetupDependencies {
|
|||
};
|
||||
}
|
||||
|
||||
export const bindSetupCoreAndPlugins = (core: CoreSetup, plugins: any) => {
|
||||
const { licensing } = plugins;
|
||||
if (licensing) {
|
||||
licensing.license$.subscribe(({ uid }: { uid: string }) => setLicenseId(uid));
|
||||
}
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export class MapsPlugin implements Plugin<MapsPluginSetup, MapsPluginStart> {
|
||||
public setup(
|
||||
core: any,
|
||||
{ __LEGACY: { uiModules }, np: { licensing, home } }: MapsPluginSetupDependencies
|
||||
) {
|
||||
public setup(core: CoreSetup, { __LEGACY: { uiModules }, np }: MapsPluginSetupDependencies) {
|
||||
uiModules
|
||||
.get('app/maps', ['ngRoute', 'react'])
|
||||
.directive('mapListing', function(reactDirective: any) {
|
||||
return reactDirective(wrapInI18nContext(MapListing));
|
||||
});
|
||||
|
||||
if (licensing) {
|
||||
licensing.license$.subscribe(({ uid }) => setLicenseId(uid));
|
||||
}
|
||||
bindSetupCoreAndPlugins(core, np);
|
||||
|
||||
home.featureCatalogue.register(featureCatalogueEntry);
|
||||
np.home.featureCatalogue.register(featureCatalogueEntry);
|
||||
}
|
||||
|
||||
public start(core: CoreStart, plugins: any) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue