wazuh-dashboard-plugins
wazuh-dashboard-plugins copied to clipboard
Unpinning the agent from the menu is not removing the url param
Wazuh | Elastic |
---|---|
4.x | 7.x |
Description Unpinning the agent from the menu tool is not removing the agent param from the URL, this is causing that the agent has been pinned again after refreshing the page.
Steps to reproduce
- Go to 'Agents'
- Click on one agent
- Go to 'Modules / Office365'
- Click on unpin button from the menu
- Refresh the page
- See the agent pinned again.
Screenshots
https://user-images.githubusercontent.com/26828184/129067680-c79b1d34-67db-4bc2-b0bb-19443448c3ac.mp4
Research
I was researching about the problem and:
- I could remove from the URL the
agentId
query param when using theUnpin agent
button displayed on the Office 365 HOC. - But, I could not get to remove it using the button on the Wazuh menu when there is an agent pinned
I attach a patch in that I am working to get a solution for this issue. It contains a workaround attaching a method to the $rootScope
variable to be accessible in the WzMenu
component because it doesn't receive the .setAgent
method defined in https://github.com/wazuh/wazuh-kibana-app/blob/feature/Office365/public/controllers/overview/overview.js
❗ The method removeAgentsFilter
in the https://github.com/wazuh/wazuh-kibana-app/blob/feature/Office365/public/components/wz-agent-selector/wz-agent-selector.js#L91-L107 defined the action to do when unpinning the agent from the agent selector and there is an agent pinned. This button could need some logic to remove the agentId
query param too. We should check it
Patch: remove_agentid_query_param_url_unppining_agent.patch.txt
I took a child branch from feature/office365
. You should be able to apply the patch to a branch like that.
Apply the patch with:
git apply path/to/remove_agentid_query_param_url_unppining_agent.patch.txt
Annotations:
- I am not sure if the
.setAgent
defined in theOverviewController
is required to use. I could not get some more clear. We should research if there is a cleaner solution and review the required logic to solve the problem.
I have found a bug checking this issue, when you pin an agent in Security Events or in any other part of Wazuh, the dashboards appears without any data even though there are data.
Current state of the issue:
I am trying to develop a better form to use of the method setAgent
and trying to figure out what is happening with the blank visualizations, because there aren't any errors in terminal
Today's feedback
-
Trying to upgrade Antonio's solution, trying with methods of Angular 1, but without solution because we are complicating the solution and extend the code.
-
Trying to find out the error that are making that visualizations are blank when we pin an agent