…e `policy_templates_behavior` field (#200605) (#200749)
# Backport
This will backport the following commits from `main` to `8.x`:
- [[Fleet] Filter integrations/packages list shown depending on the
`policy_templates_behavior` field
(#200605)](#200605)
<!--- Backport version: 9.4.3 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)
<!--BACKPORT [{"author":{"name":"Mario Rodriguez
Molins","email":"mario.rodriguez@elastic.co"},"sourceCommit":{"committedDate":"2024-11-19T14:27:19Z","message":"[Fleet]
Filter integrations/packages list shown depending on the
`policy_templates_behavior` field (#200605)\n\n## Summary\r\nCloses
https://github.com/elastic/kibana/issues/198145\r\n\r\nAdd support to
filter the tiles shown in the integrations UI as well as\r\nthe packages
shown in the global search provider depending on
the\r\n`policy_templates_behaviour` field introduced
in\r\nhttps://github.com/elastic/package-spec/issues/802.\r\n\r\nIf this
new field is not present in the package manifest, the same\r\nbehavior
is kept. Therefore, it is shown a tile for the package itself\r\nplus a
tile for each policy template defined in the manifest.\r\n\r\n\r\nTested
using a custom Elastic Package Registry with some packages\r\ndefining
this new `policy_templates_behavior` via the
key:\r\n```yaml\r\nxpack.fleet.registryUrl:
http://localhost:8080\r\n```\r\n\r\n### Screenshots\r\n\r\nChecked
option \"Elastic Agent only\" in the integrations UI to
avoid\r\ntutorials based on Beats.\r\n\r\nExample with `azure_metrics`
package in the Integrations UI:\r\n- `policy_templates_behavior:
all`\r\n\r\n\r\n-
`policy_templates_behavior: combined_policy`\r\n\r\n\r\n-
`policy_templates_behavior: individual_policies`\r\n\r\n\r\n\r\nExample
in the Global Search with `azure_metrics` package and
`combined\r\npolicy` behavior:\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_node:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [
]","sha":"8352b86f59522319f6d20ae2165d11b621f1f22b","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:Fleet","v9.0.0","backport:prev-minor"],"title":"[Fleet]
Filter integrations/packages list shown depending on the
`policy_templates_behavior`
field","number":200605,"url":"https://github.com/elastic/kibana/pull/200605","mergeCommit":{"message":"[Fleet]
Filter integrations/packages list shown depending on the
`policy_templates_behavior` field (#200605)\n\n## Summary\r\nCloses
https://github.com/elastic/kibana/issues/198145\r\n\r\nAdd support to
filter the tiles shown in the integrations UI as well as\r\nthe packages
shown in the global search provider depending on
the\r\n`policy_templates_behaviour` field introduced
in\r\nhttps://github.com/elastic/package-spec/issues/802.\r\n\r\nIf this
new field is not present in the package manifest, the same\r\nbehavior
is kept. Therefore, it is shown a tile for the package itself\r\nplus a
tile for each policy template defined in the manifest.\r\n\r\n\r\nTested
using a custom Elastic Package Registry with some packages\r\ndefining
this new `policy_templates_behavior` via the
key:\r\n```yaml\r\nxpack.fleet.registryUrl:
http://localhost:8080\r\n```\r\n\r\n### Screenshots\r\n\r\nChecked
option \"Elastic Agent only\" in the integrations UI to
avoid\r\ntutorials based on Beats.\r\n\r\nExample with `azure_metrics`
package in the Integrations UI:\r\n- `policy_templates_behavior:
all`\r\n\r\n\r\n-
`policy_templates_behavior: combined_policy`\r\n\r\n\r\n-
`policy_templates_behavior: individual_policies`\r\n\r\n\r\n\r\nExample
in the Global Search with `azure_metrics` package and
`combined\r\npolicy` behavior:\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_node:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [
]","sha":"8352b86f59522319f6d20ae2165d11b621f1f22b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200605","number":200605,"mergeCommit":{"message":"[Fleet]
Filter integrations/packages list shown depending on the
`policy_templates_behavior` field (#200605)\n\n## Summary\r\nCloses
https://github.com/elastic/kibana/issues/198145\r\n\r\nAdd support to
filter the tiles shown in the integrations UI as well as\r\nthe packages
shown in the global search provider depending on
the\r\n`policy_templates_behaviour` field introduced
in\r\nhttps://github.com/elastic/package-spec/issues/802.\r\n\r\nIf this
new field is not present in the package manifest, the same\r\nbehavior
is kept. Therefore, it is shown a tile for the package itself\r\nplus a
tile for each policy template defined in the manifest.\r\n\r\n\r\nTested
using a custom Elastic Package Registry with some packages\r\ndefining
this new `policy_templates_behavior` via the
key:\r\n```yaml\r\nxpack.fleet.registryUrl:
http://localhost:8080\r\n```\r\n\r\n### Screenshots\r\n\r\nChecked
option \"Elastic Agent only\" in the integrations UI to
avoid\r\ntutorials based on Beats.\r\n\r\nExample with `azure_metrics`
package in the Integrations UI:\r\n- `policy_templates_behavior:
all`\r\n\r\n\r\n-
`policy_templates_behavior: combined_policy`\r\n\r\n\r\n-
`policy_templates_behavior: individual_policies`\r\n\r\n\r\n\r\nExample
in the Global Search with `azure_metrics` package and
`combined\r\npolicy` behavior:\r\n\r\n\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_node:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [
]","sha":"8352b86f59522319f6d20ae2165d11b621f1f22b"}}]}] BACKPORT-->
---------
Co-authored-by: Mario Rodriguez Molins <mario.rodriguez@elastic.co>
Summary
Closes #198145
Add support to filter the tiles shown in the integrations UI as well as the packages shown in the global search provider depending on the
policy_templates_behaviourfield introduced in elastic/package-spec#802.If this new field is not present in the package manifest, the same behavior is kept. Therefore, it is shown a tile for the package itself plus a tile for each policy template defined in the manifest.
Tested using a custom Elastic Package Registry with some packages defining this new
policy_templates_behaviorvia the key:Screenshots
Checked option "Elastic Agent only" in the integrations UI to avoid tutorials based on Beats.
Example with
azure_metricspackage in the Integrations UI:policy_templates_behavior: allpolicy_templates_behavior: combined_policypolicy_templates_behavior: individual_policiesExample in the Global Search with

azure_metricspackage andcombined policybehavior:Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breakinglabel should be applied in these situations.release_node:*label is applied per the guidelinesIdentify risks
Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.