wazuh-dashboard-plugins icon indicating copy to clipboard operation
wazuh-dashboard-plugins copied to clipboard

Add frontend state service

Open Desvelao opened this issue 4 months ago • 3 comments

Description

This pull request adds a state service to the wazuh-core plugin and expose it in the plugin lifecycle methods.

The state service manages the shared state of the Wazuh plugins and it is a HUB of state containers. Features:

  • Extensible
  • Register state containers
  • Ability to get, set, remove data and subscribe to changes of state containers

The state containers provides a mechanism to manage a specific state. For example, some data is stored in cookies, others could be managed in-memory, local storage, session storage.

Others plugins can register new state containers.

The service creates hooks and HOCs that are exposed through the plugin lifecycle.

The state services is based on AppState old service:

AppState state Description
getClusterInfo server_host_cluster_info > get
setClusterInfo server_host_cluster_info > set
getCurrentApi server_host > get
setCurrentApi server_host > set
removeCurrentAPI server_host > remove
getCurrentPattern data_source_alerts > get
setCurrentPattern data_source_alerts > set
removeCurrentPattern data_source_alerts > remove

Issues Resolved

#6959

Check List

  • [ ] All tests pass
    • [ ] yarn test:jest
  • [ ] New functionality includes testing.
  • [ ] New functionality has been documented.
  • [ ] Update CHANGELOG.md
  • [x] Commits are signed per the DCO using --signoff

Desvelao avatar Sep 30 '24 14:09 Desvelao