Skip to content

Commit

Permalink
[Alerting] [8.0] Prepare for making alerting saved objects sharecapable
Browse files Browse the repository at this point in the history
  • Loading branch information
YulNaumenko committed Aug 25, 2021
1 parent a466382 commit d9e08c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion x-pack/plugins/alerting/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ export class AlertingPlugin {
core.savedObjects,
plugins.encryptedSavedObjects,
this.ruleTypeRegistry,
this.logger
this.logger,
this.kibanaVersion
);

initializeApiKeyInvalidator(
Expand Down
7 changes: 5 additions & 2 deletions x-pack/plugins/alerting/server/saved_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
SavedObjectsServiceSetup,
SavedObjectsTypeMappingDefinition,
} from 'kibana/server';
import Semver from 'semver';
import mappings from './mappings.json';
import { getMigrations } from './migrations';
import { EncryptedSavedObjectsPluginSetup } from '../../../encrypted_saved_objects/server';
Expand Down Expand Up @@ -48,12 +49,14 @@ export function setupSavedObjects(
savedObjects: SavedObjectsServiceSetup,
encryptedSavedObjects: EncryptedSavedObjectsPluginSetup,
ruleTypeRegistry: RuleTypeRegistry,
logger: Logger
logger: Logger,
kibanaVersion: string
) {
savedObjects.registerType({
name: 'alert',
hidden: true,
namespaceType: 'single',
namespaceType: Semver.lt(kibanaVersion, '8.0.0') ? 'single' : 'multiple-isolated',
convertToMultiNamespaceTypeVersion: Semver.lt(kibanaVersion, '8.0.0') ? undefined : '8.0.0',
migrations: getMigrations(encryptedSavedObjects),
mappings: mappings.alert as SavedObjectsTypeMappingDefinition,
management: {
Expand Down

0 comments on commit d9e08c5

Please sign in to comment.