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

[Alerting] discrepancy in typing of index threshold "index" parameter - server vs ui #68575

Closed
pmuellr opened this issue Jun 8, 2020 · 2 comments · Fixed by #88540
Closed
Assignees
Labels
Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@pmuellr
Copy link
Member

pmuellr commented Jun 8, 2020

I just noticed that I got an error thrown in the UI when I tried to display an alert I created with kbn-alert.

The error occurred here:

At this point, the value of index was a string, but the code assumed it was an array. That's what's specified in it's type:

export interface IndexThresholdAlertParams {
index: string[];

However, the alert type itself has index spec'd as string || string[]:

export const CoreQueryParamsSchemaProperties = {
// name of the indices to search
index: schema.oneOf([
schema.string({ minLength: 1 }),
schema.arrayOf(schema.string({ minLength: 1 }), { minSize: 1 }),
]),

So, that all makes sense, the alert was created at the API level, not the UI, and passed it's validation, but that shape is not valid within the UI.

I'm a little surprised at seeing this, it seems to indicate that I haven't edited in the UI and alerts I've created at the command-line, but ... I'd swear I have. Ah well ...

We'll need to fix this up so they are compatible.

@pmuellr pmuellr added Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) labels Jun 8, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

@pmuellr
Copy link
Member Author

pmuellr commented Jun 8, 2020

I'm tempted to change the alert type to make the index a string array, matching the ui, however it is possible someone has already created alerts with a string value instead of a string array.

So it seems like we'll need to change the UI to be more flexible and support string | string[]

@pmuellr pmuellr self-assigned this Jan 12, 2021
pmuellr added a commit to pmuellr/kibana that referenced this issue Jan 15, 2021
resolves elastic#68575

The index threshold alert defines an `index` parameter which is
typed as `string | string[]`.  However the UI for this alert has
been typing it as only `string[]`.

This PR changes the UI to work with an incoming string value for
this parameter.  If the parameter is edited in the UI, it will always
be set as an array, even if there is only one element.
pmuellr added a commit that referenced this issue Jan 25, 2021
…8540)

resolves #68575

The index threshold alert defines an `index` parameter which is
typed as `string | string[]`.  However the UI for this alert has
been typing it as only `string[]`.

This PR changes the UI to work with an incoming string value for
this parameter.  If the parameter is edited in the UI, it will always
be set as an array, even if there is only one element.
pmuellr added a commit to pmuellr/kibana that referenced this issue Jan 25, 2021
…astic#88540)

resolves elastic#68575

The index threshold alert defines an `index` parameter which is
typed as `string | string[]`.  However the UI for this alert has
been typing it as only `string[]`.

This PR changes the UI to work with an incoming string value for
this parameter.  If the parameter is edited in the UI, it will always
be set as an array, even if there is only one element.
pmuellr added a commit that referenced this issue Jan 26, 2021
…8540) (#89236)

resolves #68575

The index threshold alert defines an `index` parameter which is
typed as `string | string[]`.  However the UI for this alert has
been typing it as only `string[]`.

This PR changes the UI to work with an incoming string value for
this parameter.  If the parameter is edited in the UI, it will always
be set as an array, even if there is only one element.
@kobelb kobelb added the needs-team Issues missing a team label label Jan 31, 2022
@botelastic botelastic bot removed the needs-team Issues missing a team label label Jan 31, 2022
@kobelb kobelb added the needs-team Issues missing a team label label Jan 31, 2022
@botelastic botelastic bot removed the needs-team Issues missing a team label label Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants