Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.6] [Infrastructure UI] Improve metrics settings error handling (#1…
…46272) (#146675) # Backport This will backport the following commits from `main` to `8.6`: - [[Infrastructure UI] Improve metrics settings error handling (#146272)](#146272) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Marco Antonio Ghiani","email":"[email protected]"},"sourceCommit":{"committedDate":"2022-11-30T10:54:37Z","message":"[Infrastructure UI] Improve metrics settings error handling (#146272)\n\nCloses [#145238](https://github.com/elastic/kibana/issues/145238)\r\n\r\n## Summary\r\n\r\nThese changes add validation to the Metric Indices passed into the\r\nMetrics settings page.\r\nNew validation is added both in the UI and in the endpoint, performing\r\nthe following checks:\r\n- Index pattern is not an empty string\r\n- Index pattern does not contain empty spaces (start, middle, end) (the\r\npattern is not trimmed)\r\n- Index pattern does not contain empty entries, comma-separated values\r\nshould have an acceptable value.\r\n\r\nIn case the value is not valid, the UI will render an appropriate error\r\nmessage.\r\nIf the `PATCH /api/metrics/source/{sourceId}` request to update the\r\nvalue is manually sent with an invalid value, the server will respond\r\nwith a 400 status code and an error message.\r\n\r\nAlso, for retro compatibility and to not block the user when the\r\nconfiguration can't be successfully retrieved, in case of internal error\r\nthe `GET /api/metrics/source/{sourceId}` will return a 404 and on the\r\nUI, instead of rendering a blank page, the user will see the empty form\r\nand will be able to re-insert the right values.\r\n\r\n## Testing\r\n\r\nNavigate to `Inventory`-> Click on `Settings` on the topbar -> Start\r\nwriting different metric indices in the Metric Indices field.\r\n\r\n### Editing Metric Indices validation\r\n\r\n\r\nhttps://user-images.githubusercontent.com/34506779/203763021-0f4d8926-ffa4-448a-a038-696732158f4e.mov\r\n\r\n### Missing/Broken configuration response\r\n\r\n\r\nhttps://user-images.githubusercontent.com/34506779/203763120-ffc91cd3-9bf4-43da-a04f-5561ceabf591.mov\r\n\r\nCo-authored-by: Marco Antonio Ghiani <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ddcbf73284d48b1f1f6eb9322f6f108f312f8e02","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Metrics UI","Team:Infra Monitoring UI","release_note:skip","backport:all-open","v8.7.0"],"number":146272,"url":"https://github.com/elastic/kibana/pull/146272","mergeCommit":{"message":"[Infrastructure UI] Improve metrics settings error handling (#146272)\n\nCloses [#145238](https://github.com/elastic/kibana/issues/145238)\r\n\r\n## Summary\r\n\r\nThese changes add validation to the Metric Indices passed into the\r\nMetrics settings page.\r\nNew validation is added both in the UI and in the endpoint, performing\r\nthe following checks:\r\n- Index pattern is not an empty string\r\n- Index pattern does not contain empty spaces (start, middle, end) (the\r\npattern is not trimmed)\r\n- Index pattern does not contain empty entries, comma-separated values\r\nshould have an acceptable value.\r\n\r\nIn case the value is not valid, the UI will render an appropriate error\r\nmessage.\r\nIf the `PATCH /api/metrics/source/{sourceId}` request to update the\r\nvalue is manually sent with an invalid value, the server will respond\r\nwith a 400 status code and an error message.\r\n\r\nAlso, for retro compatibility and to not block the user when the\r\nconfiguration can't be successfully retrieved, in case of internal error\r\nthe `GET /api/metrics/source/{sourceId}` will return a 404 and on the\r\nUI, instead of rendering a blank page, the user will see the empty form\r\nand will be able to re-insert the right values.\r\n\r\n## Testing\r\n\r\nNavigate to `Inventory`-> Click on `Settings` on the topbar -> Start\r\nwriting different metric indices in the Metric Indices field.\r\n\r\n### Editing Metric Indices validation\r\n\r\n\r\nhttps://user-images.githubusercontent.com/34506779/203763021-0f4d8926-ffa4-448a-a038-696732158f4e.mov\r\n\r\n### Missing/Broken configuration response\r\n\r\n\r\nhttps://user-images.githubusercontent.com/34506779/203763120-ffc91cd3-9bf4-43da-a04f-5561ceabf591.mov\r\n\r\nCo-authored-by: Marco Antonio Ghiani <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ddcbf73284d48b1f1f6eb9322f6f108f312f8e02"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146272","number":146272,"mergeCommit":{"message":"[Infrastructure UI] Improve metrics settings error handling (#146272)\n\nCloses [#145238](https://github.com/elastic/kibana/issues/145238)\r\n\r\n## Summary\r\n\r\nThese changes add validation to the Metric Indices passed into the\r\nMetrics settings page.\r\nNew validation is added both in the UI and in the endpoint, performing\r\nthe following checks:\r\n- Index pattern is not an empty string\r\n- Index pattern does not contain empty spaces (start, middle, end) (the\r\npattern is not trimmed)\r\n- Index pattern does not contain empty entries, comma-separated values\r\nshould have an acceptable value.\r\n\r\nIn case the value is not valid, the UI will render an appropriate error\r\nmessage.\r\nIf the `PATCH /api/metrics/source/{sourceId}` request to update the\r\nvalue is manually sent with an invalid value, the server will respond\r\nwith a 400 status code and an error message.\r\n\r\nAlso, for retro compatibility and to not block the user when the\r\nconfiguration can't be successfully retrieved, in case of internal error\r\nthe `GET /api/metrics/source/{sourceId}` will return a 404 and on the\r\nUI, instead of rendering a blank page, the user will see the empty form\r\nand will be able to re-insert the right values.\r\n\r\n## Testing\r\n\r\nNavigate to `Inventory`-> Click on `Settings` on the topbar -> Start\r\nwriting different metric indices in the Metric Indices field.\r\n\r\n### Editing Metric Indices validation\r\n\r\n\r\nhttps://user-images.githubusercontent.com/34506779/203763021-0f4d8926-ffa4-448a-a038-696732158f4e.mov\r\n\r\n### Missing/Broken configuration response\r\n\r\n\r\nhttps://user-images.githubusercontent.com/34506779/203763120-ffc91cd3-9bf4-43da-a04f-5561ceabf591.mov\r\n\r\nCo-authored-by: Marco Antonio Ghiani <[email protected]>\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"ddcbf73284d48b1f1f6eb9322f6f108f312f8e02"}}]}] BACKPORT--> Co-authored-by: Marco Antonio Ghiani <[email protected]>
- Loading branch information