… (#153225)
# Backport
This will backport the following commits from `main` to `8.7`:
- [[Fleet] Fix EPR and custom integration categories merge
(#153221)](#153221)
<!--- Backport version: 8.9.7 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)
<!--BACKPORT [{"author":{"name":"Jen
Huang","email":"its.jenetic@gmail.com"},"sourceCommit":{"committedDate":"2023-03-15T15:54:16Z","message":"[Fleet]
Fix EPR and custom integration categories merge (#153221)\n\n##
Summary\r\n\r\nWhile testing
elastic/integrations#5123
and\r\nhttps://github.com//pull/153216, I discovered two
problems\r\nwith the list of categories on the Browse integration
page:\r\n\r\n1. The categories list doesn't respect
`showIntegrationsSubcategories`\r\nfeature flag. When it is turned off,
it will still only display\r\ntop-level parent categories. This PR fixes
that so that when\r\n`showIntegrationsSubcategories` is turned off,
_all_ categories will be\r\nlisted on the left sidebar. When it is
turned on, only the top-level\r\ncategories will be listed.\r\n2. The
merging of the categories list from EPR
(i.e.\r\n`<EPR_HOST>/categories`) with the categories hard-coded in
Kibana for\r\ncustom integration cards is flawed: there can be a
situation where a\r\ncategory or subcategory is not returned by EPR, due
to no EPR-hosted\r\nintegrations having it, but it is registered by a
custom card. In this\r\ncase, the category is missing from the list.
This PR fixes the
merging\r\nlogic.","sha":"340ee100869f13d86a12736e3e840eea806cb5cd","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:prev-minor","v8.8.0"],"number":153221,"url":"https://github.com/elastic/kibana/pull/153221","mergeCommit":{"message":"[Fleet]
Fix EPR and custom integration categories merge (#153221)\n\n##
Summary\r\n\r\nWhile testing
elastic/integrations#5123
and\r\nhttps://github.com//pull/153216, I discovered two
problems\r\nwith the list of categories on the Browse integration
page:\r\n\r\n1. The categories list doesn't respect
`showIntegrationsSubcategories`\r\nfeature flag. When it is turned off,
it will still only display\r\ntop-level parent categories. This PR fixes
that so that when\r\n`showIntegrationsSubcategories` is turned off,
_all_ categories will be\r\nlisted on the left sidebar. When it is
turned on, only the top-level\r\ncategories will be listed.\r\n2. The
merging of the categories list from EPR
(i.e.\r\n`<EPR_HOST>/categories`) with the categories hard-coded in
Kibana for\r\ncustom integration cards is flawed: there can be a
situation where a\r\ncategory or subcategory is not returned by EPR, due
to no EPR-hosted\r\nintegrations having it, but it is registered by a
custom card. In this\r\ncase, the category is missing from the list.
This PR fixes the
merging\r\nlogic.","sha":"340ee100869f13d86a12736e3e840eea806cb5cd"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/153221","number":153221,"mergeCommit":{"message":"[Fleet]
Fix EPR and custom integration categories merge (#153221)\n\n##
Summary\r\n\r\nWhile testing
elastic/integrations#5123
and\r\nhttps://github.com//pull/153216, I discovered two
problems\r\nwith the list of categories on the Browse integration
page:\r\n\r\n1. The categories list doesn't respect
`showIntegrationsSubcategories`\r\nfeature flag. When it is turned off,
it will still only display\r\ntop-level parent categories. This PR fixes
that so that when\r\n`showIntegrationsSubcategories` is turned off,
_all_ categories will be\r\nlisted on the left sidebar. When it is
turned on, only the top-level\r\ncategories will be listed.\r\n2. The
merging of the categories list from EPR
(i.e.\r\n`<EPR_HOST>/categories`) with the categories hard-coded in
Kibana for\r\ncustom integration cards is flawed: there can be a
situation where a\r\ncategory or subcategory is not returned by EPR, due
to no EPR-hosted\r\nintegrations having it, but it is registered by a
custom card. In this\r\ncase, the category is missing from the list.
This PR fixes the
merging\r\nlogic.","sha":"340ee100869f13d86a12736e3e840eea806cb5cd"}}]}]
BACKPORT-->
Co-authored-by: Jen Huang <its.jenetic@gmail.com>
Summary
While testing elastic/integrations#5123 and #153216, I discovered two problems with the list of categories on the Browse integration page:
showIntegrationsSubcategoriesfeature flag. When it is turned off, it will still only display top-level parent categories. This PR fixes that so that whenshowIntegrationsSubcategoriesis turned off, all categories will be listed on the left sidebar. When it is turned on, only the top-level categories will be listed.<EPR_HOST>/categories) with the categories hard-coded in Kibana for custom integration cards is flawed: there can be a situation where a category or subcategory is not returned by EPR, due to no EPR-hosted integrations having it, but it is registered by a custom card. In this case, the category is missing from the list. This PR fixes the merging logic.