Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Fixing optional plugin dependency types #64450

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ import { LicenseManagementUIPluginSetup } from '../../../../../license_managemen

interface StartPlugins {
data: DataPublicPluginStart;
security: SecurityPluginSetup;
security?: SecurityPluginSetup;
licenseManagement?: LicenseManagementUIPluginSetup;
}
export type StartServices = CoreStart & StartPlugins;
Original file line number Diff line number Diff line change
@@ -55,9 +55,11 @@ export const FilebeatConfigFlyout: FC<Props> = ({
} = useMlKibana();

useEffect(() => {
security.authc.getCurrentUser().then(user => {
setUsername(user.username === undefined ? null : user.username);
});
if (security !== undefined) {
security.authc.getCurrentUser().then(user => {
setUsername(user.username === undefined ? null : user.username);
});
}
}, []);

useEffect(() => {
7 changes: 5 additions & 2 deletions x-pack/plugins/ml/public/application/management/index.ts
Original file line number Diff line number Diff line change
@@ -25,8 +25,11 @@ export function initManagementSection(
) {
const licensing = pluginsSetup.licensing.license$.pipe(take(1));
licensing.subscribe(license => {
if (license.check(PLUGIN_ID, MINIMUM_FULL_LICENSE).state === 'valid') {
const management = pluginsSetup.management;
const management = pluginsSetup.management;
if (
management !== undefined &&
license.check(PLUGIN_ID, MINIMUM_FULL_LICENSE).state === 'valid'
) {
const mlSection = management.sections.register({
id: PLUGIN_ID,
title: i18n.translate('xpack.ml.management.mlTitle', {
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ export interface DependencyCache {
savedObjectsClient: SavedObjectsClientContract | null;
application: ApplicationStart | null;
http: HttpStart | null;
security: SecurityPluginSetup | null;
security: SecurityPluginSetup | undefined | null;
i18n: I18nStart | null;
urlGenerators: SharePluginStart['urlGenerators'] | null;
mlConfig: MlConfigType | null;
4 changes: 2 additions & 2 deletions x-pack/plugins/ml/public/plugin.ts
Original file line number Diff line number Diff line change
@@ -32,9 +32,9 @@ export interface MlStartDependencies {
share: SharePluginStart;
}
export interface MlSetupDependencies {
security: SecurityPluginSetup;
security?: SecurityPluginSetup;
licensing: LicensingPluginSetup;
management: ManagementSetup;
management?: ManagementSetup;
usageCollection: UsageCollectionSetup;
licenseManagement?: LicenseManagementUIPluginSetup;
home: HomePublicPluginSetup;