[Fleet] Add UI for integration namespace customization#269141
Conversation
|
Pinging @elastic/fleet (Team:Fleet) |
| @@ -42,7 +45,7 @@ export function isValidNamespace( | |||
| defaultMessage: | |||
| 'Namespace should start with one of these prefixes {allowedNamespacePrefixes}', | |||
| values: { | |||
| allowedNamespacePrefixes: allowedNamespacePrefixes?.join(', ') ?? '', | |||
| allowedNamespacePrefixes: allowedNamespacePrefixes.join(', '), | |||
There was a problem hiding this comment.
nit: could be collapse into 1 token:
i18n.translate('xpack.fleet.namespaceValidation.notAllowedPrefixError', {
defaultMessage:
'Namespace should start with {count, plural, one {{allowedNamespacePrefixes}} other {one of these prefixes: {allowedNamespacePrefixes}}}',
values: {
count: allowedNamespacePrefixes.length,
allowedNamespacePrefixes:
allowedNamespacePrefixes.length === 1
? allowedNamespacePrefixes[0]
: allowedNamespacePrefixes.join(', '),
},
})| // Case 3: toggle on + namespace not yet opted in → opting in may affect others | ||
| // Case 8: toggle off + namespace already opted in → opting out may affect others |
There was a problem hiding this comment.
what's "case 3" and "case 8"? (they are referenced in conditions further in this file too)
There was a problem hiding this comment.
Whoops, forgot to clean those up! Thanks for flagging
| @@ -204,6 +221,58 @@ export const StepDefinePackagePolicy: React.FunctionComponent<{ | |||
| // Output is also disabled when any parent agent policy is managed (e.g. Elastic Cloud Agent Policy). | |||
| const isOutputDisabled = isManaged || agentPolicies?.some((p) => p.is_managed) === true; | |||
|
|
|||
| // Namespace-level customization toggle visibility/state. | |||
| const showNamespaceCustomizationToggle = | |||
There was a problem hiding this comment.
since we are adding a good amount of state related to namespace customization (plus data fetching), i wonder if all of it could be extracted to a separate hook?
| namespaceCustomizationEnabled={namespaceCustomizationEnabled} | ||
| onNamespaceCustomizationEnabledChange={setNamespaceCustomizationEnabled} | ||
| installedNamespaceCustomizationEnabledFor={installedNamespaceCustomizationEnabledFor} | ||
| allowedNamespacePrefixes={spaceSettings?.allowedNamespacePrefixes ?? []} |
There was a problem hiding this comment.
can we avoid passing 4 new props at this level? can all these be calculated in StepDefinePackagePolicy itself? (might be related to my hook comment earlier)
| /> | ||
| </h4> | ||
| </EuiTitle> | ||
| <EuiSpacer size="s" /> |
There was a problem hiding this comment.
the spacing here could be tightened up (I think EuiTitle already enforce some bottom margin)
| <EuiText size="s" color="subdued"> | ||
| <FormattedMessage | ||
| id="xpack.fleet.integrations.settings.namespaceCustomization.description" | ||
| defaultMessage="Opt in namespaces to apply namespace-level customization for this integration. Fleet will create dedicated index templates for each opted-in namespace." |
There was a problem hiding this comment.
I find the phrasing "namespace-level customization" confusing on this page. @vishaangelova can probably help wordsmith this but here are some ideas:
title: Namespace index templates
input label: Namespaces with dedicated index templates
description: Select which namespaces get a dedicated index template for this integration. This enables independent customization of settings and mappings per namespace. Learn more.
learn more link would go to https://www.elastic.co/docs/reference/fleet/data-streams - we'll need to update the docs here (has a docs issue been filed?)
There was a problem hiding this comment.
Hmm, yes, you have a point. I remember I previously approved the "namespace-level customization” wording for the API docs, but I think this is more user-friendly. I’d go with your suggestions, with a tiny tweak for this sentence:
Select which namespaces use a dedicated index template for this integration.
| <EuiText size="xs" color="subdued"> | ||
| <FormattedMessage | ||
| id="xpack.fleet.createPackagePolicy.namespaceCustomization.helpText" | ||
| defaultMessage="Allows applying customized settings to all data streams in that namespace." |
There was a problem hiding this comment.
similar to my other copy sugggestion, maybe something like this:
Creates a dedicated index template for this namespace, enabling independent settings and mappings from other namespaces.
There was a problem hiding this comment.
Not sure I understand this part:
enabling independent settings and mappings from other namespaces.
Might need to think a bit more on the wording here.
| > | ||
| <FormattedMessage | ||
| id="xpack.fleet.createPackagePolicy.namespaceCustomization.optInImpactDescription" | ||
| defaultMessage="Namespace-level customization is shared across all {packageTitle} integration policies targeting namespace {namespace}. Enabling it here will apply to all of them." |
There was a problem hiding this comment.
related to previous copy suggestion:
The namespace index template is shared across all {packageTitle} policies targeting namespace {namespace}. Enabling it here will apply to all of them.
There was a problem hiding this comment.
To better link the toggle switch and the two sentences, perhaps:
The namespace index template is shared across all {packageTitle} integration policies targeting namespace {namespace}. Enabling the customization here will apply it to all of them.
By "apply it” I mean the namespace index template. Not sure if I’ve understood this correctly. (Do we need to explicitly say “it will apply the template”?)
| > | ||
| <FormattedMessage | ||
| id="xpack.fleet.createPackagePolicy.namespaceCustomization.optOutImpactDescription" | ||
| defaultMessage="Namespace-level customization is shared across all {packageTitle} integration policies targeting namespace {namespace}. Disabling it here will remove it from all of them." |
There was a problem hiding this comment.
related to previous copy suggestion:
The namespace index template is shared across all {packageTitle} policies targeting namespace {namespace}. Disabling it here will remove it from all of them.
There was a problem hiding this comment.
To better link the toggle switch and the two sentences, perhaps:
The namespace index template is shared across all {packageTitle} integration policies targeting namespace {namespace}. Disabling the customization here will remove it from all of them.
By “remove it” I mean the namespace index template. Not sure if I’ve understood this correctly. (Do we need to explicitly say “will remove the template”?)
| <EuiText size="s" color="subdued"> | ||
| <FormattedMessage | ||
| id="xpack.fleet.integrations.settings.namespaceCustomization.description" | ||
| defaultMessage="Opt in namespaces to apply namespace-level customization for this integration. Fleet will create dedicated index templates for each opted-in namespace." |
There was a problem hiding this comment.
Hmm, yes, you have a point. I remember I previously approved the "namespace-level customization” wording for the API docs, but I think this is more user-friendly. I’d go with your suggestions, with a tiny tweak for this sentence:
Select which namespaces use a dedicated index template for this integration.
| <EuiFlexItem grow={false}> | ||
| <FormattedMessage | ||
| id="xpack.fleet.integrations.settings.namespaceCustomization.applying" | ||
| defaultMessage="Applying namespace customization changes…" |
There was a problem hiding this comment.
If we use Jen’s wording, maybe this could be Applying namespace index template changes…?
| <EuiText size="xs" color="subdued"> | ||
| <FormattedMessage | ||
| id="xpack.fleet.createPackagePolicy.namespaceCustomization.helpText" | ||
| defaultMessage="Allows applying customized settings to all data streams in that namespace." |
There was a problem hiding this comment.
Not sure I understand this part:
enabling independent settings and mappings from other namespaces.
Might need to think a bit more on the wording here.
| > | ||
| <FormattedMessage | ||
| id="xpack.fleet.createPackagePolicy.namespaceCustomization.optOutImpactDescription" | ||
| defaultMessage="Namespace-level customization is shared across all {packageTitle} integration policies targeting namespace {namespace}. Disabling it here will remove it from all of them." |
There was a problem hiding this comment.
To better link the toggle switch and the two sentences, perhaps:
The namespace index template is shared across all {packageTitle} integration policies targeting namespace {namespace}. Disabling the customization here will remove it from all of them.
By “remove it” I mean the namespace index template. Not sure if I’ve understood this correctly. (Do we need to explicitly say “will remove the template”?)
| > | ||
| <FormattedMessage | ||
| id="xpack.fleet.createPackagePolicy.namespaceCustomization.optInImpactDescription" | ||
| defaultMessage="Namespace-level customization is shared across all {packageTitle} integration policies targeting namespace {namespace}. Enabling it here will apply to all of them." |
There was a problem hiding this comment.
To better link the toggle switch and the two sentences, perhaps:
The namespace index template is shared across all {packageTitle} integration policies targeting namespace {namespace}. Enabling the customization here will apply it to all of them.
By "apply it” I mean the namespace index template. Not sure if I’ve understood this correctly. (Do we need to explicitly say “it will apply the template”?)
|
Thank you @jen-huang and @vishaangelova for your review 🙏 Good point regarding the texts 👍 I pushed some changes, but it might need another round. Comments below to try to keep them centralized. 1. Integration settings:
2. Package policy editor:
3. "Learn more" link: I also thought that would be necessary, but I'm not sure we have a link yet? @vishaangelova maybe let's clarify this directly. |
We do not surface the concept of applying settings & mapping at different levels as "customization" anywhere in Fleet. We do already introduce users to the fact that My point is that this feature ties in with how Fleet handles templating for integration data streams: we introduce another level, and customization from that point forward is implied.
It should link to https://www.elastic.co/docs/reference/fleet/data-streams which will need to be updated. This is the same docs page that the current
We still have UX improvement to do on conveying to the user all the levels in which they can customize their data streams, but one step at a time.. 😉 |
|
@elasticmachine merge upstream |
|
@vishaangelova FYI I opened elastic/docs-content#6545 to track the documentation change |
vishaangelova
left a comment
There was a problem hiding this comment.
Thanks @jillguyonnet! Copy LGTM!
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
History
|
jen-huang
left a comment
There was a problem hiding this comment.
Thanks for the discussion & changes! LGTM 🚀









Summary
Closes #264065
This PR adds the following UI:
Note: release notes are included in #262568
Testing
staging): it should be rejectedprod1): it should be allowed and a toast notification should confirmGET /api/fleet/epm/packages/<pkg>,installationInfo.namespace_customization_enabled_for)prod2), enable the toggle: after saving the policy, this namespace should be added to the list of opted in namespaces for this packageprod2), but this time leave the toggle disabled: there should be a warning that doing this will opt out the namespace, affecting the previously created package policyprod3), leave the toggle disabledprod3) and enable the toggle: there should be a warning that doing this will opt in the namespace, affecting the previously created package policyScreenshots
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_note:*label is applied per the guidelinesbackport:*labels.Identify 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.