[Fleet] Make spaces plugin optional (#152115)

## Summary

Closes #151897 

The spaces service will be disabled in serverless.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Mark Hopkin 2023-02-28 10:00:24 +00:00 committed by GitHub
parent 0af9176d3d
commit ee56d954da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -17,7 +17,6 @@
"navigation",
"customIntegrations",
"share",
"spaces",
"security",
"unifiedSearch",
"savedObjectsTagging",
@ -33,7 +32,8 @@
"globalSearch",
"telemetry",
"discover",
"ingestPipelines"
"ingestPipelines",
"spaces",
],
"requiredBundles": [
"kibanaReact",

View file

@ -8,7 +8,7 @@
import type { Observable } from 'rxjs';
import { BehaviorSubject } from 'rxjs';
import { take, filter } from 'rxjs/operators';
import { DEFAULT_SPACE_ID } from '@kbn/spaces-plugin/common';
import { i18n } from '@kbn/i18n';
import type {
CoreSetup,
@ -118,7 +118,7 @@ export interface FleetSetupDeps {
encryptedSavedObjects: EncryptedSavedObjectsPluginSetup;
cloud?: CloudSetup;
usageCollection?: UsageCollectionSetup;
spaces: SpacesPluginStart;
spaces?: SpacesPluginStart;
telemetry?: TelemetryPluginSetup;
taskManager: TaskManagerSetupContract;
}
@ -386,7 +386,7 @@ export class FleetPlugin
return getInternalSoClient();
},
get spaceId() {
return deps.spaces.spacesService.getSpaceId(request);
return deps.spaces?.spacesService?.getSpaceId(request) ?? DEFAULT_SPACE_ID;
},
get limitedToPackages() {