kibana/x-pack/plugins/grokdebugger/public/plugin.js
Alejandro Fernández Haro 9d5aca591b
Upgrade RxJS to 7 (#129087)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-04-12 12:40:55 -07:00

45 lines
1.3 KiB
JavaScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { i18n } from '@kbn/i18n';
import { firstValueFrom } from 'rxjs';
import { PLUGIN } from '../common/constants';
import { registerFeature } from './register_feature';
export class GrokDebuggerUIPlugin {
setup(coreSetup, plugins) {
registerFeature(plugins.home);
const devTool = plugins.devTools.register({
order: 6,
title: i18n.translate('xpack.grokDebugger.displayName', {
defaultMessage: 'Grok Debugger',
}),
id: PLUGIN.ID,
enableRouting: false,
async mount({ element, theme$ }) {
const [coreStart] = await coreSetup.getStartServices();
const license = await firstValueFrom(plugins.licensing.license$);
const { renderApp } = await import('./render_app');
return renderApp(license, element, coreStart, theme$);
},
});
plugins.licensing.license$.subscribe((license) => {
if (!license.isActive && !devTool.isDisabled()) {
devTool.disable();
} else if (devTool.isDisabled()) {
devTool.enable();
}
});
}
start() {}
stop() {}
}