Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support modifying agent policies when editing an integration #184394

Closed
3 tasks done
Tracked by #75867
juliaElastic opened this issue May 29, 2024 · 0 comments · Fixed by #186084
Closed
3 tasks done
Tracked by #75867

Support modifying agent policies when editing an integration #184394

juliaElastic opened this issue May 29, 2024 · 0 comments · Fixed by #186084
Assignees
Labels
QA:Needs Validation Issue needs to be validated by QA Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@juliaElastic
Copy link
Contributor

juliaElastic commented May 29, 2024

Similarly to the create integration policy page, support modifying agent policies on the Edit integration policy page.

image image
@botelastic botelastic bot added the needs-team Issues missing a team label label May 29, 2024
@juliaElastic juliaElastic added the Team:Fleet Team label for Observability Data Collection Fleet team label May 29, 2024
@botelastic botelastic bot removed the needs-team Issues missing a team label label May 29, 2024
@kpollich kpollich added the QA:Needs Validation Issue needs to be validated by QA label Jun 6, 2024
criamico added a commit that referenced this issue Jun 20, 2024
## Summary

Closes #184394

Added agent policy selection to Edit integration policy page.


There is a lot of duplication between Create and Edit integration policy
pages, I'll see if I can refactor to extract the common logic: steps
components and managing its state.
I extracted the steps to a hook, it would be a bigger refactor to use
this in Create package policy page, so I might create a follow up issue
for that.

## To verify
- enable the `enableReusableIntegrationPolicies` experimental feature in
`kibana.dev.yml`
- Create a few agent policies
- Add an integration 
- Go to Edit integration, and modify the linked agent policies
- Verify that the existing agent policies are populated correctly in the
Existing hosts combo box
- Verify that the modified agent policy list is reflected in the
`Preview API Request`, `policy_ids` list.
- Verify that when submitting the form, the package policy linkages are
updated to the selected ones (add/remove agent policies)
- The agent count should update below the combo / in the submit modal
window
- It's not allowed to submit the form after removing all agent policies
- If a new agent policy is selected, it will be created first and then
assigned to the integration policy

<img width="995" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/0a7163c6-154e-49b1-b73c-19ed024f6dc3">
<img width="993" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/ad470a27-90fa-40f5-b394-a93a08c95e06">
<img width="535" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/3b0ddc29-abf8-4e0d-8beb-300634c245b3">
<img width="1758" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/e8b976fe-3e53-439c-9b23-803deaf3e0aa">

### Create agent policy
<img width="1737" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/6f2a7f65-981a-487d-87c4-2dbb7ecd1835">
Preview API request contains the POST agent policy request
<img width="896" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/109140ab-13f2-42c9-9bbc-fb64859c4f62">
After submit, the updated integration policy is assigned to the new
agent policy too
<img width="2552" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/4027b47b-8d20-4153-b7ec-ed3500f08c9a">


## Open questions

- Currently the namespace placeholder of the package policy is set to
show the namespace of the first selected agent policy (if not set by the
package policy). I have to check what happens on the backend, if the
inherited namespace is changed if the agent policies change. The
behaviour should be consistent in the backend and UI.
Currently on the Agent policy details UI, the same integration policy
might show different inherited namespace if its shared by multiple agent
policies with different namespace.

<img width="1498" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/567800a8-2dcb-4b18-af89-f6e902889092">
<img width="1326" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/b59d131e-314c-4d5a-81e3-ab8fe0fa6e1f">
<img width="1318" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/69b54a63-f7c1-4f0f-8041-74b1774f1e9e">

- When the Edit integration was started from the Agent policy details
UI, the navigation goes back to the same agent policy after submitting
the page. Is this okay? Might be somewhat unexpected if creating a new
agent policy, though it is getting complex to decide where to navigate
in case of multiple agent policies.


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <[email protected]>
Co-authored-by: criamico <[email protected]>
bhapas pushed a commit to bhapas/kibana that referenced this issue Jun 24, 2024
…6084)

## Summary

Closes elastic#184394

Added agent policy selection to Edit integration policy page.


There is a lot of duplication between Create and Edit integration policy
pages, I'll see if I can refactor to extract the common logic: steps
components and managing its state.
I extracted the steps to a hook, it would be a bigger refactor to use
this in Create package policy page, so I might create a follow up issue
for that.

## To verify
- enable the `enableReusableIntegrationPolicies` experimental feature in
`kibana.dev.yml`
- Create a few agent policies
- Add an integration 
- Go to Edit integration, and modify the linked agent policies
- Verify that the existing agent policies are populated correctly in the
Existing hosts combo box
- Verify that the modified agent policy list is reflected in the
`Preview API Request`, `policy_ids` list.
- Verify that when submitting the form, the package policy linkages are
updated to the selected ones (add/remove agent policies)
- The agent count should update below the combo / in the submit modal
window
- It's not allowed to submit the form after removing all agent policies
- If a new agent policy is selected, it will be created first and then
assigned to the integration policy

<img width="995" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/0a7163c6-154e-49b1-b73c-19ed024f6dc3">
<img width="993" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/ad470a27-90fa-40f5-b394-a93a08c95e06">
<img width="535" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/3b0ddc29-abf8-4e0d-8beb-300634c245b3">
<img width="1758" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/e8b976fe-3e53-439c-9b23-803deaf3e0aa">

### Create agent policy
<img width="1737" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/6f2a7f65-981a-487d-87c4-2dbb7ecd1835">
Preview API request contains the POST agent policy request
<img width="896" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/109140ab-13f2-42c9-9bbc-fb64859c4f62">
After submit, the updated integration policy is assigned to the new
agent policy too
<img width="2552" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/4027b47b-8d20-4153-b7ec-ed3500f08c9a">


## Open questions

- Currently the namespace placeholder of the package policy is set to
show the namespace of the first selected agent policy (if not set by the
package policy). I have to check what happens on the backend, if the
inherited namespace is changed if the agent policies change. The
behaviour should be consistent in the backend and UI.
Currently on the Agent policy details UI, the same integration policy
might show different inherited namespace if its shared by multiple agent
policies with different namespace.

<img width="1498" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/567800a8-2dcb-4b18-af89-f6e902889092">
<img width="1326" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/b59d131e-314c-4d5a-81e3-ab8fe0fa6e1f">
<img width="1318" alt="image"
src="https://github.com/elastic/kibana/assets/90178898/69b54a63-f7c1-4f0f-8041-74b1774f1e9e">

- When the Edit integration was started from the Agent policy details
UI, the navigation goes back to the same agent policy after submitting
the page. Is this okay? Might be somewhat unexpected if creating a new
agent policy, though it is getting complex to decide where to navigate
in case of multiple agent policies.


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Kibana Machine <[email protected]>
Co-authored-by: criamico <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA:Needs Validation Issue needs to be validated by QA Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants