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

[Remove discover] Refactor AngularJS overview controller #6593

Closed
Tracked by #6535
yenienserrano opened this issue Apr 17, 2024 · 3 comments · Fixed by #6594
Closed
Tracked by #6535

[Remove discover] Refactor AngularJS overview controller #6593

yenienserrano opened this issue Apr 17, 2024 · 3 comments · Fixed by #6594
Assignees
Labels
level/task Task issue type/enhancement Enhancement issue

Comments

@yenienserrano
Copy link
Member

yenienserrano commented Apr 17, 2024

Description

To deprecate angularJS in the plugins we need to refactor the overview controller into a ReactJS component.
The files are located in:

  • /plugins/main/public/controllers/overview/overview.js
@yenienserrano yenienserrano changed the title /plugins/main/public/controllers/overview/overview.js [Remove discover] Refactor AngularJS settings controller Apr 17, 2024
@yenienserrano yenienserrano added type/enhancement Enhancement issue level/task Task issue labels Apr 17, 2024
@yenienserrano yenienserrano changed the title [Remove discover] Refactor AngularJS settings controller [Remove discover] Refactor AngularJS overview controller Apr 17, 2024
@yenienserrano yenienserrano self-assigned this Apr 17, 2024
@wazuhci wazuhci moved this to In progress in Release 4.9.0 Apr 17, 2024
@yenienserrano yenienserrano linked a pull request Apr 17, 2024 that will close this issue
6 tasks
@yenienserrano
Copy link
Member Author

I am looking at how to replace the configurations needed for the different models.

@wazuhci wazuhci moved this from In progress to Blocked in Release 4.9.0 Apr 18, 2024
@wazuhci wazuhci moved this from Blocked to In progress in Release 4.9.0 Apr 25, 2024
@jbiset jbiset self-assigned this Apr 26, 2024
@jbiset
Copy link
Member

jbiset commented Apr 29, 2024

RESEARCH - Update 29/04/2024

RESEARCH MANAGEMENT OF PERSISTENCE OF STATES

  • OSD documentation:
    • docs/plugins/data_persistence.md
    • src/plugins/opensearch_dashboards_utils/docs/global_data_persistence.md
    • src/plugins/opensearch_dashboards_utils/docs/state_sync/README.md
  • Using OsdUrlStateStorage in Wazuh: plugins/main/public/kibana-integrations/discover/application/angular/discover_state.ts

REVIEW OVERVIEW CONTROLLER

Relative path: plugins/main/public/controllers/overview/overview.js
Class: OverviewController
Methods:

  • $onInit (Initializes module descriptions through the WAZUH_MODULES constant. Remove the _a parameter from the URL. Initializes the filterHandler so that it can be used later to update visualizations. Defines the getMainProps and getVisualizeProps methods in $scope. Subscribe the destroy event to clear the displays. Finally, if there is an agent selected, it compares it with the one listed in the application state and updates the URL if they do not match.)
  • inArray (This method is not used. It must be removed. In plugins/main/public/controllers/agent/agents.js the same method is also defined but they are defined in the $scope)
  • updateSelectedAgents (Updates if an agent is selected for views. Also updates the value of agentId in the URL)
  • switchSubtab (Updates the properties of the overview section, updates the tabView of the URL, and emits the changeTabView message that kibana-discover listens for with the tabListener)
  • calculateWodleTagFromTab (This method is not used. It must be removed)
  • switchTab (Updates the properties of visualizations and agent selection, updates refreshInterval of common-data, and updates the tabView via switchSubtab)
  • startVis2Png (Used to transform a visualization into an image. Use the reportingService that comes as a parameter)
  • getSummary (Gets the summary of the agents. Replaced to get the agent summary locally in the Overview component)
  • loadConfiguration (Set the wzMonitoringEnabled setting to Overview with wazuh.monitoring.enabled)
  • addMitrefilter (Adds Filter by Mitre.ID. This will be replaced with the new DataSource)
  • init (Load the configuration from the overview section via loadConfiguration, update the current tab in the URL via switchTab and in the application state via updateCurrentTab with Redux. It also subscribes to the sendVisDataRows event to update attacksCount in the $scope, although attacksCount is no longer used, so this subscription can be removed.)

Overview diagram

overview_diagram

@jbiset
Copy link
Member

jbiset commented May 2, 2024

Update 02/05/2024

The problem is analyzed when an agent is pinned to the different modules that render Overview and the following is detected:
The state of a pinned agent has 3 sources of truth: URL, FilterManager and AppStateReducer (Redux). Since in different places not all sources of truth are taken into account to manage the pinned agent, inconsistencies occur that lead to erratic behavior.

TO DO:

Analyze the different components that interact with the state of a pinned agent and bring them to use a single source of truth, probably the PatternDataSourceFilterManager.

@wazuhci wazuhci moved this from In progress to In review in Release 4.9.0 May 3, 2024
@wazuhci wazuhci moved this from In review to Pending review in Release 4.9.0 May 3, 2024
@lucianogorza lucianogorza moved this from Pending review to Pending final review in Release 4.9.0 May 3, 2024
@wazuhci wazuhci moved this from Pending final review to Done in Release 4.9.0 May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue type/enhancement Enhancement issue
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants