Skip to content

[Streams] Add suggested name#253652

Merged
SoniaSanzV merged 7 commits intoelastic:mainfrom
SoniaSanzV:downsampling/create_new_policy_modal_suggested_name
Feb 18, 2026
Merged

[Streams] Add suggested name#253652
SoniaSanzV merged 7 commits intoelastic:mainfrom
SoniaSanzV:downsampling/create_new_policy_modal_suggested_name

Conversation

@SoniaSanzV
Copy link
Copy Markdown
Contributor

@SoniaSanzV SoniaSanzV commented Feb 18, 2026

Summary

Small change in the CreatePolicyModal. The modal now needs a new prop with the name of the original policy from which is being copied, in order of pre-populate a name that would help the user. It tries to suggest a name by adding a small number to the end of the original name: first {original-policy-name}-2, if that already exists then {original-policy-name}-3, then {original-policy-name}-4, up to {original-policy-name}-9; if all of those already exist, it leaves the field empty so the user can choose a name.

How to test

View and test the component in Storybook:

yarn storybook streams_app

It can also be tested in the Streams UI:

  • Create a policy with some downsampling steps
  • Assign it to a couple of streams, remove a downsampling step from one of them.
  • Click save as new
  • Verify the text field is filled with a suggested name
Screen.Recording.2026-02-18.at.11.57.18.mov

@SoniaSanzV SoniaSanzV self-assigned this Feb 18, 2026
@SoniaSanzV SoniaSanzV requested a review from a team as a code owner February 18, 2026 08:52
@SoniaSanzV SoniaSanzV added Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Feature:Streams This is the label for the Streams Project labels Feb 18, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@SoniaSanzV SoniaSanzV changed the title Add suggested name [Streams] Add suggested name Feb 18, 2026
@SoniaSanzV SoniaSanzV requested a review from a team as a code owner February 18, 2026 10:55
await waitFor(() => expect(onSave).toHaveBeenCalledWith('new-policy'));
});

it('pre-populates the policy name field with the original policy name', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: It's not really the original policy name but original + "-2" so we can change it for clarity.

Suggested change
it('pre-populates the policy name field with the original policy name', () => {
it('pre-populates with the default copy name', () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed with a7fd1ab

Copy link
Copy Markdown
Contributor

@gbamparop gbamparop left a comment

Choose a reason for hiding this comment

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

Code only review for x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_lifecycle/hooks/use_ilm_lifecycle_summary.tsx LGTM

Copy link
Copy Markdown
Contributor

@damian-polewski damian-polewski left a comment

Choose a reason for hiding this comment

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

LGTM! Added one small non-blocking nit.

Comment on lines +46 to +56
// If the shortest candidate is already too long, any other single-digit suffix will be too.
if (getPolicyNameIsBeyondMaxBytes(`${originalPolicyName}-2`)) {
return '';
}

for (let i = 2; i <= 9; i++) {
const candidate = `${originalPolicyName}-${i}`;
if (!existing.has(candidate) && !getPolicyNameIsBeyondMaxBytes(candidate)) {
return candidate;
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to check both before and inside the loop?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think that's needed. {name}-2 and {name}-9 (max number) would have the same UTF‑8 byte length, so checking inside the loop is redundan

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Feb 18, 2026

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #5 / Condition entry input selecting Hash md5, sha1, or sha256 should call onChange with process.hash.*
  • [job] [logs] Scout: [ observability / apm ] plugin / local-serverless-observability_complete - Service Dependencies Tab - Has no detectable a11y violations on load

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [0543444]

History

cc @SoniaSanzV

@SoniaSanzV SoniaSanzV enabled auto-merge (squash) February 18, 2026 17:10
@SoniaSanzV SoniaSanzV merged commit 98650ab into elastic:main Feb 18, 2026
17 checks passed
@SoniaSanzV SoniaSanzV deleted the downsampling/create_new_policy_modal_suggested_name branch February 19, 2026 07:17
chrisbmar pushed a commit to chrisbmar/kibana that referenced this pull request Feb 19, 2026
## Summary

Small change in the `CreatePolicyModal`. The modal now needs a new prop
with the name of the original policy from which is being copied, in
order of pre-populate a name that would help the user. It tries to
suggest a name by adding a small number to the end of the original name:
first `{original-policy-name}-2`, if that already exists then
`{original-policy-name}-3`, then `{original-policy-name}-4`, up to
`{original-policy-name}-9`; if all of those already exist, it leaves the
field empty so the user can choose a name.

### How to test

View and test the component in Storybook:

```bash
yarn storybook streams_app
```

It can also be tested in the Streams UI:
* Create a policy with some downsampling steps
* Assign it to a couple of streams, remove a downsampling step from one
of them.
* Click save as new
* Verify the text field is filled with a suggested name



https://github.com/user-attachments/assets/aa1bb08d-b311-48c7-bd49-6bdfcefb676b
ersin-erdal pushed a commit to ersin-erdal/kibana that referenced this pull request Feb 19, 2026
## Summary

Small change in the `CreatePolicyModal`. The modal now needs a new prop
with the name of the original policy from which is being copied, in
order of pre-populate a name that would help the user. It tries to
suggest a name by adding a small number to the end of the original name:
first `{original-policy-name}-2`, if that already exists then
`{original-policy-name}-3`, then `{original-policy-name}-4`, up to
`{original-policy-name}-9`; if all of those already exist, it leaves the
field empty so the user can choose a name.

### How to test

View and test the component in Storybook:

```bash
yarn storybook streams_app
```

It can also be tested in the Streams UI:
* Create a policy with some downsampling steps
* Assign it to a couple of streams, remove a downsampling step from one
of them.
* Click save as new
* Verify the text field is filled with a suggested name



https://github.com/user-attachments/assets/aa1bb08d-b311-48c7-bd49-6bdfcefb676b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Streams This is the label for the Streams Project release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants