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

Fixed errors in group reports #4350

Merged
merged 5 commits into from
Aug 5, 2022

Conversation

Desvelao
Copy link
Member

@Desvelao Desvelao commented Jul 21, 2022

Description

This PRs fixes some problems when generating a group reports:

  • Error due to accessing to a property of undefined
  • The agent in group table doesn't display all the agents in the group.

Closes #4348

Changes

  • Fixed an error due to accessing to a property of undefined when the API request to get the group configuration failed due to token expiration or another error.
  • Changed styles of Agents in groups title
  • Fixed a problem with missing agents in the table for a group report.
    Now it gets all the agents.
  • Removed unnecessary API request
  • Optimized API requests to get the agent information required to print
    the agents in group's table
  • Removed manager_host deprecated field (more information):
    • Removed of monitoring template mapping
    • Removed field meaning
    • Removed displaying its value reports if the field manager doesn't exist

Test

Manual tests

Scenario: Error due to accessing to a property of undefined
Given: Logged user in Management/Groups//Information, wait the time to the Wazuh API token expires.
When: The user click on "Export PDF" button.
Then: The PDF should be generated without errors. Check the generated PDF.

Scenario: Missing agents in the agent in group table of group report.
Given: group with more than 500 agents.
When: The user clicks on "Export PDF" button.
Then: The PDF should be genrated without errors and it should contains all the agents in the group displayed in a table.

@Desvelao Desvelao self-assigned this Jul 21, 2022
@Desvelao Desvelao linked an issue Jul 21, 2022 that may be closed by this pull request
…operty of undefined

- Fixed an error due to accessing to a property of undefined when the API request to get the group configuration failed due to token expiration or another error.
- Changed styles of `Agents in groups` title
- Fixed a problem with missing agents in the table for a group report.
  Now it gets all the agents.
- Removed unnecessary API request
- Optimized API requests to get the agent information required to print
  the agents in group's table
- Removed `manager_host` deprecated field:
  - Removed of monitoring template mapping
  - Removed field meaning
  - Removed displaying its value reports if the field `manager` doesn't exist
@Desvelao Desvelao force-pushed the fix/4348-error-generate-group-reports branch from 36907b9 to 5554910 Compare July 21, 2022 11:06
server/controllers/wazuh-reporting.ts Outdated Show resolved Hide resolved
server/controllers/wazuh-reporting.ts Outdated Show resolved Hide resolved
server/controllers/wazuh-reporting.ts Outdated Show resolved Hide resolved
@Desvelao Desvelao requested a review from AlexRuiz7 July 26, 2022 09:38
@github-actions
Copy link
Contributor

Jest Test Coverage % values
Statements 6.67% ( 2431 / 36452 )
Branches 2.67% ( 754 / 28233 )
Functions 4.46% ( 398 / 8916 )
Lines 6.75% ( 2352 / 34868 )

Copy link
Member

@AlexRuiz7 AlexRuiz7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@yenienserrano yenienserrano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Desvelao Desvelao merged commit 8ffce0e into 4.3-7.10 Aug 5, 2022
@Desvelao Desvelao deleted the fix/4348-error-generate-group-reports branch August 5, 2022 06:47
github-actions bot pushed a commit that referenced this pull request Aug 5, 2022
* fix(reports): error generating group reports due to accessing to a property of undefined

- Fixed an error due to accessing to a property of undefined when the API request to get the group configuration failed due to token expiration or another error.
- Changed styles of `Agents in groups` title
- Fixed a problem with missing agents in the table for a group report.
  Now it gets all the agents.
- Removed unnecessary API request
- Optimized API requests to get the agent information required to print
  the agents in group's table
- Removed `manager_host` deprecated field:
  - Removed of monitoring template mapping
  - Removed field meaning
  - Removed displaying its value reports if the field `manager` doesn't exist

* changelog: add PR entry

* fix(reporting): replaced parameter type

* fix(reporting): replaced message when there are no agent in group

Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
(cherry picked from commit 8ffce0e)
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2022

The backport to 4.3-1.2-wzd failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.3-1.2-wzd 4.3-1.2-wzd
# Navigate to the new working tree
cd .worktrees/backport-4.3-1.2-wzd
# Create a new branch
git switch --create backport-4350-to-4.3-1.2-wzd
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 8ffce0ea89f6ba534cfb20f6a26301d264a528fb
# Push it to GitHub
git push --set-upstream origin backport-4350-to-4.3-1.2-wzd
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.3-1.2-wzd

Then, create a pull request where the base branch is 4.3-1.2-wzd and the compare/head branch is backport-4350-to-4.3-1.2-wzd.

Desvelao added a commit that referenced this pull request Aug 5, 2022
Fixed errors in group reports (#4350)

* fix(reports): error generating group reports due to accessing to a property of undefined

- Fixed an error due to accessing to a property of undefined when the API request to get the group configuration failed due to token expiration or another error.
- Changed styles of `Agents in groups` title
- Fixed a problem with missing agents in the table for a group report.
  Now it gets all the agents.
- Removed unnecessary API request
- Optimized API requests to get the agent information required to print
  the agents in group's table
- Removed `manager_host` deprecated field:
  - Removed of monitoring template mapping
  - Removed field meaning
  - Removed displaying its value reports if the field `manager` doesn't exist

* changelog: add PR entry

* fix(reporting): replaced parameter type

* fix(reporting): replaced message when there are no agent in group

Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
(cherry picked from commit 8ffce0e)

Co-authored-by: Antonio <34042064+Desvelao@users.noreply.github.com>
Desvelao added a commit that referenced this pull request Aug 5, 2022
* fix(reports): error generating group reports due to accessing to a property of undefined

- Fixed an error due to accessing to a property of undefined when the API request to get the group configuration failed due to token expiration or another error.
- Changed styles of `Agents in groups` title
- Fixed a problem with missing agents in the table for a group report.
  Now it gets all the agents.
- Removed unnecessary API request
- Optimized API requests to get the agent information required to print
  the agents in group's table
- Removed `manager_host` deprecated field:
  - Removed of monitoring template mapping
  - Removed field meaning
  - Removed displaying its value reports if the field `manager` doesn't exist

* changelog: add PR entry

* fix(reporting): replaced parameter type

* fix(reporting): replaced message when there are no agent in group

Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
(cherry picked from commit 8ffce0e)
Desvelao added a commit that referenced this pull request Aug 5, 2022
Fixed errors in group reports (#4350)

* fix(reports): error generating group reports due to accessing to a property of undefined

- Fixed an error due to accessing to a property of undefined when the API request to get the group configuration failed due to token expiration or another error.
- Changed styles of `Agents in groups` title
- Fixed a problem with missing agents in the table for a group report.
  Now it gets all the agents.
- Removed unnecessary API request
- Optimized API requests to get the agent information required to print
  the agents in group's table
- Removed `manager_host` deprecated field:
  - Removed of monitoring template mapping
  - Removed field meaning
  - Removed displaying its value reports if the field `manager` doesn't exist

* changelog: add PR entry

* fix(reporting): replaced parameter type

* fix(reporting): replaced message when there are no agent in group

Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
(cherry picked from commit 8ffce0e)
@Mayons95 Mayons95 mentioned this pull request Aug 9, 2022
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bug issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Group report generation fails randomly
3 participants