Skip to content

Conversation

@pmuellr
Copy link
Member

@pmuellr pmuellr commented Jan 15, 2021

resolves #68575

Summary

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.

Checklist

Delete any items that are not applicable to this PR.

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
Copy link
Member Author

pmuellr commented Jan 20, 2021

@elasticmachine merge upstream

@pmuellr pmuellr added Feature:Alerting Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// release_note:skip Skip the PR/issue when compiling release notes v7.12.0 v8.0.0 labels Jan 20, 2021
@pmuellr pmuellr marked this pull request as ready for review January 20, 2021 17:26
@elasticmachine
Copy link
Contributor

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

test('if aggField property is invalid should return proper error message', () => {
const initialParams: IndexThresholdAlertParams = {
index: ['test'],
index: 'test',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this test so that we have a jest test that will test a string index param (instead of the usual string[] type). It would be good to add a function test, I think, would need to create an alert using the API (passing a string typed index field), and then edit the alert and make sure the single index appears as expected in the UI. Do we have similar tests like this? Thoughts on where to add such a test?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use the esArchiver to load an archived alert with a string index param and then try to edit it in your functional test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be able to create one via the API - I suspect that will be easier to figuring out esArchiver :-)

Let me see if I can add a quick one ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one - I ended up changing the test in x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts, below, from using an array of indices to a single index string.

Copy link
Contributor

@gmmorris gmmorris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

It would be worth adding an e2e test for it, but not a blocker, as I know we'er trying to be more economical with UI tests :/

@pmuellr pmuellr requested a review from a team as a code owner January 21, 2021 22:54
groupBy: 'all',
threshold: [1000, 5000],
index: ['.kibana_1'],
index: '.kibana_1',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already an example of testing the array version of the index param in the alert_create_flyout tests, so it seemed like changing this other usage of the index threshold alert to use the string version would be appropriate.

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pmuellr
Copy link
Member Author

pmuellr commented Jan 25, 2021

@elasticmachine merge upstream

@pmuellr
Copy link
Member Author

pmuellr commented Jan 25, 2021

Looks like a flaky test failure in the last build
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks.
Summary of all failing tests
 FAIL  src/dev/build/lib/version_info.test.ts (24.116 s)
  ● isRelease = true › returns unchanged package.version, build sha, and build number

    thrown: "Exceeded timeout of 5000 ms for a test.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."

      13 | 
      14 | describe('isRelease = true', () => {
    > 15 |   it('returns unchanged package.version, build sha, and build number', async () => {
         |   ^
      16 |     const versionInfo = await getVersionInfo({
      17 |       isRelease: true,
      18 |       pkg,

      at src/dev/build/lib/version_info.test.ts:15:3
      at Object.<anonymous> (src/dev/build/lib/version_info.test.ts:14:1)

so merging master again ...

@pmuellr
Copy link
Member Author

pmuellr commented Jan 25, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
stackAlerts 114.5KB 114.6KB +139.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@pmuellr pmuellr merged commit 14fa82d into elastic:master Jan 25, 2021
pmuellr added a commit to pmuellr/kibana that referenced this pull request 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 pull request 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v7.12.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

5 participants