Closed Desvelao closed 9 months ago
The component OverviewWelcome (plugins/wazuh/public/components/common/welcome/overview-welcome.js)
has a button that is renderer only when there is no registered agents. The button has a href to the page #/agents-preview
The page #/agents-preview
is renderer by the template plugins/wazuh/public/templates/agents-prev/agents-prev.html
. This template uses the agentsPreviewController
controller.
At the end of the template, we can see that the React component RegisterAgent
is rendered (ng-if
) only if the addingNewAgent
controller value is true
, and another component, AgentsPreview
, is rendered but only displayed (ng-how
) if the addingNewAgent
value is false
. Therefore, the AgentsPreview
component is always rendered.
AgentsPreview
component?The component is responsible for retrieving and updating general information about the agents through the tableProps.updateSummary
function obtained in the props.
The updateSummary
function is declared in the controller and it updates the value of addingNewAgent
, which determines whether the RegisterAgent
component is rendered or not.
Therefore, when the page #/agents-preview
is initially loaded, the AgentsPreview
component is first rendered and displayed. If there are no registered agents, the AgentsPreview
component stops being displayed, and the RegisterAgent
component is rendered.
addingNewAgent
value is set before rendering the components.ng-show
option in the HTML template for the AgentsPreview
component should be modified to ng-if
.AgentsPreview
component return a loading while summary data is being retrieved.AgentsPreview
component add a condition and only return the dashboard and table if agent count > 0.AgentsPreview
controller in the RegisterAgent
component replace ng-if
with ng-show
.One must analyze what impact the changes may have on other use cases.
In a meeting with @asteriscos we decided to go for solution 2
Description The agents dashboard is displayed when using the Add agent button from the Modules directory section for a little period of time.
Preconditions
Steps to reproduce
Expected Result The displayed view should be what we want to navigate to instead of this redirection behavior.
Evidences https://github.com/wazuh/wazuh-dashboard-plugins/assets/34042064/69c6d5de-37f0-4a54-8dcd-e488bbd1c11c