Skip to content

Conversation

@jen-huang
Copy link
Contributor

@jen-huang jen-huang commented Mar 15, 2023

Summary

While testing elastic/integrations#5123 and #153216, I discovered two problems with the list of categories on the Browse integration page:

  1. The categories list doesn't respect showIntegrationsSubcategories feature flag. When it is turned off, it will still only display top-level parent categories. This PR fixes that so that when showIntegrationsSubcategories is turned off, all categories will be listed on the left sidebar. When it is turned on, only the top-level categories will be listed.
  2. The merging of the categories list from EPR (i.e. <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.

@jen-huang jen-huang added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor labels Mar 15, 2023
@jen-huang jen-huang requested a review from criamico March 15, 2023 14:43
@jen-huang jen-huang self-assigned this Mar 15, 2023
@jen-huang jen-huang marked this pull request as ready for review March 15, 2023 14:43
@jen-huang jen-huang requested a review from a team as a code owner March 15, 2023 14:43
export const INTEGRATION_CATEGORY_DISPLAY: {
[key: string]: { title: string; parent_id?: string };
} = {
aws: { title: 'AWS', parent_id: undefined },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Properties needed to be expanded to better handle the merge logic described in PR

The list here will be updated in #153216 for 8.8

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Mar 15, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Contributor

@criamico criamico left a comment

Choose a reason for hiding this comment

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

I don't yet see the new subcategories so I couldn't check all the edge cases.
Code LGTM 🚢

@kibana-ci
Copy link

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #26 / content management examples Todo app Todo app works
  • [job] [logs] FTR Configs #2 / security APIs - Session Idle Session POST /internal/security/session should extend the session

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
customIntegrations 88 156 +68

Async chunks

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

id before after diff
fleet 939.2KB 939.3KB +104.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
customIntegrations 7.4KB 8.2KB +850.0B
Unknown metric groups

API count

id before after diff
customIntegrations 107 175 +68

ESLint disabled line counts

id before after diff
securitySolution 433 436 +3

Total ESLint disabled count

id before after diff
securitySolution 513 516 +3

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

cc @jen-huang

@jen-huang jen-huang merged commit 340ee10 into elastic:main Mar 15, 2023
@jen-huang jen-huang deleted the fix/subcategories-flag branch March 15, 2023 15:54
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Mar 15, 2023
## Summary

While testing elastic/integrations#5123 and
elastic#153216, I discovered two problems
with the list of categories on the Browse integration page:

1. The categories list doesn't respect `showIntegrationsSubcategories`
feature flag. When it is turned off, it will still only display
top-level parent categories. This PR fixes that so that when
`showIntegrationsSubcategories` is turned off, _all_ categories will be
listed on the left sidebar. When it is turned on, only the top-level
categories will be listed.
2. The merging of the categories list from EPR (i.e.
`<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.

(cherry picked from commit 340ee10)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.7

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Mar 15, 2023
… (#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.7.0 v8.8.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants