wazuh-dashboard-plugins
wazuh-dashboard-plugins copied to clipboard
Add frontend state service
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