-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Maps] Use SO-references for geo-containment alerts #114559
[Maps] Use SO-references for geo-containment alerts #114559
Conversation
…caldwell/kibana into maps/geo_alerts_so
Pinging @elastic/kibana-gis (Team:Geo) |
x-pack/plugins/alerting/server/saved_objects/geo_containment/migrations.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/alerting/server/saved_objects/geo_containment/migrations.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only nit comments about naming
code review
x-pack/plugins/alerting/server/saved_objects/geo_containment/migrations.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/alerting/server/saved_objects/geo_containment/migrations.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a geo rule in 7.15 and then migrated using this branch. I get this error:
Error injecting reference into rule params for rule id def0ee00-2c9a-11ec-9ddf-634f16c3e5be - Index "null" not found in references array
const { indexId, boundaryIndexId, ...otherParams } = params; | ||
const references = [ | ||
{ | ||
name: `tracked_index_${indexId}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rules client prefixes rule type specific references with param:
(to avoid possible collisions with other reference names), so this should be:
name: `tracked_index_${indexId}`, | |
name: `param:tracked_index_${indexId}`, |
id: indexId as string, | ||
}, | ||
{ | ||
name: `boundary_index_${boundaryIndexId}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: `boundary_index_${boundaryIndexId}`, | |
name: `param:boundary_index_${boundaryIndexId}`, |
x-pack/plugins/alerting/server/saved_objects/geo_containment/migrations.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Verified that:
- creating a geo rule in 7.15 (in both default and custom space) and migrating with this branch works and the rules are loaded correctly, runs after migration, and the index patterns are populated correctly when editing the rule
- creating a geo rule in this branch works and the index pattern ids are stored in the references array.
@@ -43,4 +43,54 @@ describe('alertType', () => { | |||
|
|||
expect(alertType.validate?.params?.validate(params)).toBeTruthy(); | |||
}); | |||
|
|||
test('injectEntityAndBoundaryIds', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a test for extract
here?
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
Co-authored-by: Thomas Neirynck <[email protected]>
Closes #107066