Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck committed Jan 11, 2021
1 parent 0ff6965 commit fb23b20
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
24 changes: 15 additions & 9 deletions x-pack/plugins/maps/public/licensed_features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,23 @@ export function registerLicensedFeatures(licensingPlugin: LicensingPluginSetup)
}

let licensingPluginStart: LicensingPluginStart;
export function setLicensingPluginStart(licensingPlugin: LicensingPluginStart) {
licensingPluginStart = licensingPlugin;
licensingPluginStart.license$.subscribe((license: ILicense) => {
const gold = license.check(APP_ID, 'gold');
isGoldPlus = gold.state === 'valid';

const enterprise = license.check(APP_ID, 'enterprise');
isEnterprisePlus = enterprise.state === 'valid';
function updateLicenseState(license: ILicense) {
const gold = license.check(APP_ID, 'gold');
isGoldPlus = gold.state === 'valid';

const enterprise = license.check(APP_ID, 'enterprise');
isEnterprisePlus = enterprise.state === 'valid';

licenseId = license.uid;
}

export async function setLicensingPluginStart(licensingPlugin: LicensingPluginStart) {
const license = await licensingPlugin.refresh();
updateLicenseState(license);

licenseId = license.uid;
});
licensingPluginStart = licensingPlugin;
licensingPluginStart.license$.subscribe(updateLicenseState);
}

export function notifyLicensedFeatureUsage(licensedFeature: LICENSED_FEATURES) {
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/maps/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ export class MapsPlugin
});
}

public start(core: CoreStart, plugins: MapsPluginStartDependencies): MapsStartApi {
setLicensingPluginStart(plugins.licensing);
public async start(core: CoreStart, plugins: MapsPluginStartDependencies): Promise<MapsStartApi> {
await setLicensingPluginStart(plugins.licensing);
plugins.uiActions.addTriggerAction(VISUALIZE_GEO_FIELD_TRIGGER, visualizeGeoFieldAction);
setStartServices(core, plugins);
// unregisters the OSS alias
Expand Down

0 comments on commit fb23b20

Please sign in to comment.