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

Create plugin wazuh check updates #5897

Conversation

lucianogorza
Copy link
Contributor

@lucianogorza lucianogorza commented Sep 18, 2023

Description

Create new plugin Wazuh Check Updates

Issues Resolved

wazuh/wazuh-dashboard#87

Evidence

image

image

image

Test

To test the plugin, it must integrate with the main plugin and use the frontend components. The following patch can be applied which will integrate the plugin with the main plugin, and only for testing purposes will consume the components on the main security page since the About page is currently programmed with Angular.

gitDiff.txt

Check List

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

@lucianogorza lucianogorza self-assigned this Sep 18, 2023
@lucianogorza lucianogorza linked an issue Sep 18, 2023 that may be closed by this pull request
11 tasks
Copy link
Member

@Desvelao Desvelao left a comment

Choose a reason for hiding this comment

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

Please review the comments.

@lucianogorza lucianogorza marked this pull request as ready for review September 22, 2023 02:11
@lucianogorza lucianogorza requested a review from a team as a code owner September 22, 2023 02:11
@Desvelao
Copy link
Member

Desvelao commented Sep 22, 2023

Test

Toast

Mocked error
image

I had some problems running the tests:
image
image

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

Copy link
Member

@Desvelao Desvelao left a comment

Choose a reason for hiding this comment

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

LGTM!

Signed-off-by: Luciano Gorza <[email protected]>
Signed-off-by: Luciano Gorza <[email protected]>
Signed-off-by: Luciano Gorza <[email protected]>
Signed-off-by: Luciano Gorza <[email protected]>
Signed-off-by: Luciano Gorza <[email protected]>
Signed-off-by: Luciano Gorza <[email protected]>
Signed-off-by: Luciano Gorza <[email protected]>
Signed-off-by: Luciano Gorza <[email protected]>
Signed-off-by: Luciano Gorza <[email protected]>
Signed-off-by: Luciano Gorza <[email protected]>
Signed-off-by: Luciano Gorza <[email protected]>
Signed-off-by: Luciano Gorza <[email protected]>
@lucianogorza lucianogorza force-pushed the enhancement/87-create-plugin-wazuh-check-updates branch from e856fbc to 6e23821 Compare September 25, 2023 14:16
@github-actions
Copy link
Contributor

Code coverage (Jest) % values
Statements 11.56% ( 3988 / 34476 )
Branches 7.66% ( 1785 / 23283 )
Functions 10.97% ( 905 / 8244 )
Lines 11.75% ( 3877 / 32978 )

@lucianogorza lucianogorza merged commit 20e61a7 into enhancement/84-update-check-service-ui Sep 25, 2023
2 checks passed
@lucianogorza lucianogorza deleted the enhancement/87-create-plugin-wazuh-check-updates branch September 25, 2023 14:27
asteriscos added a commit that referenced this pull request Nov 3, 2023
* Create plugin wazuh check updates (#5897)

* Add wazuh_check_updates plugin

Signed-off-by: Luciano Gorza <[email protected]>

* Manage saved object for plugin configurations

Signed-off-by: Luciano Gorza <[email protected]>

* New componente UpToDateStatus and improvements

Signed-off-by: Luciano Gorza <[email protected]>

* Current update component and improvements

Signed-off-by: Luciano Gorza <[email protected]>

* CurrentUpdateDetails improvements and others

Signed-off-by: Luciano Gorza <[email protected]>

* Improvements with unit tests

Signed-off-by: Luciano Gorza <[email protected]>

* Complete public unit tests

Signed-off-by: Luciano Gorza <[email protected]>

* Unit test updatesNotification component

Signed-off-by: Luciano Gorza <[email protected]>

* Backend unit tests

Signed-off-by: Luciano Gorza <[email protected]>

* Add current update details to currentUpdateDetails component

Signed-off-by: Luciano Gorza <[email protected]>

* Add translation to show details message

Signed-off-by: Luciano Gorza <[email protected]>

* Add DismissNotificationCheck component

Signed-off-by: Luciano Gorza <[email protected]>

* Modify styles

Signed-off-by: Luciano Gorza <[email protected]>

* Expose new component

Signed-off-by: Luciano Gorza <[email protected]>

* Update DismissNotificationCheck component

Signed-off-by: Luciano Gorza <[email protected]>

* Add getCurrentUser implementation

Signed-off-by: Luciano Gorza <[email protected]>

* Fix plugin start types

Signed-off-by: Luciano Gorza <[email protected]>

* Fix checks ids

Signed-off-by: Luciano Gorza <[email protected]>

* Delete console.log in component

Signed-off-by: Luciano Gorza <[email protected]>

* Fixes in PR

Signed-off-by: Luciano Gorza <[email protected]>

* Modify README

Signed-off-by: Luciano Gorza <[email protected]>

* Delete unused files

Signed-off-by: Luciano Gorza <[email protected]>

* Delete commented code

Signed-off-by: Luciano Gorza <[email protected]>

* Removing unnecessary packages

Signed-off-by: Luciano Gorza <[email protected]>

* Clear available updates value on error

Signed-off-by: Luciano Gorza <[email protected]>

* Change constant name

Signed-off-by: Luciano Gorza <[email protected]>

* Change message on new update

Signed-off-by: Luciano Gorza <[email protected]>

* Change camelCase to kebab-case

Signed-off-by: Luciano Gorza <[email protected]>

* Change plugin name using kebab-case

Signed-off-by: Luciano Gorza <[email protected]>

* Add useEffect to component UpToDateStatus

Signed-off-by: Luciano Gorza <[email protected]>

* Improve return errors in routes

Signed-off-by: Luciano Gorza <[email protected]>

* Show update description in lines

Signed-off-by: Luciano Gorza <[email protected]>

* Add Logger

Signed-off-by: Luciano Gorza <[email protected]>

* Improve constant name

Signed-off-by: Luciano Gorza <[email protected]>

* Improve check texts and links icons

Signed-off-by: Luciano Gorza <[email protected]>

* Fix if statements

Signed-off-by: Luciano Gorza <[email protected]>

* Change folder name in dev.yml using kebab-case

Signed-off-by: Luciano Gorza <[email protected]>

* Update test snapshots

Signed-off-by: Luciano Gorza <[email protected]>

* Add I18nProvider wrapper to components

Signed-off-by: Luciano Gorza <[email protected]>

* Unit test for routes and kebab case fixes

Signed-off-by: Luciano Gorza <[email protected]>

* Add toast when on get updates error

Signed-off-by: Luciano Gorza <[email protected]>

* Omit username property on GET user preferences

Signed-off-by: Luciano Gorza <[email protected]>

* Improve try catch finally

Signed-off-by: Luciano Gorza <[email protected]>

* Add mock html_id_generator to component unit tests

Signed-off-by: Luciano Gorza <[email protected]>

* Fix unit test get-user-preferences

Signed-off-by: Luciano Gorza <[email protected]>

* Fix route unit tests port by adding a random port

Signed-off-by: Luciano Gorza <[email protected]>

* Improved user preferences saved object

Signed-off-by: Luciano Gorza <[email protected]>

* Fix toast message

Signed-off-by: Luciano Gorza <[email protected]>

* Change port in route unit tests

Signed-off-by: Luciano Gorza <[email protected]>

---------

Signed-off-by: Luciano Gorza <[email protected]>

* Enhancement/88 integrate plugin and update about page (#5939)

* Integrate plugin wazuh-check-updates

* Replace the Angular template for a React component

* Add wazuh-check-updates plugin to the manifest main plugin

* Add CurrentUpdateDetails component

* Improve About page and unit tests

* Add information to Change Log

* Make the About page accessible to any user

* Notify user when a new update is available (#5959)

* New React component WzUpdatesNotification

* Add unit test

* Get and show available updates for each api (#5984)

* Add APIs table version status

* Add available updates columns

* Add changes to show one mayor, one minor and one patch update per API

* Improve messages

* Improve notification

* Change camelCase for snake_case in API response

* Fix server unit tests

* Fix frontend unit tests

* Fix main plugin about page unit tests

* Apis table components unit tests

* Update CHANGELOG.md

* Update unit test snapshot

* Update CHANGELOG

* Fix get updates status

* Fix release notes url with current

* Improve toast id on Apis table

* ApisUpdateStatus: Show error callout only the first time

* Create new plugin wazuh core (#5985)

* Add wazuh-core plugin

* Add API Wazuh Core services

* Wazuh Core Plugin API service POC

* Remove files not used

* Integrate Wazuh Core plugin with Wazuh Check Updates plugin

* Delete imposter endpoint

* Add field 'update_check' to saved object mapping

* Delete comment

* Delete getUpdates at cron job start

---------

Co-authored-by: Luciano Gorza <[email protected]>

* Check for updates when user logs in (#6001)

* Delete cron job

* Delete settings managment

* Remove 'Wazuh' word from UI

* Remove unnecesary constants

* Expose and consume security from Wazuh Core

* Fix unit test types

* Delete 'Wazuh' from title

* Set sessionStorage with checkUpdates

* Fix snapshot unit test

* Improve default messages and colors in update status column

* Move constant definition to inside the component

* Add check updates columns to APIs table and other fixes (#6058)

* Add check updates columns to APIs table and other fixes

* Update notification link to the API configuration page

* Fix link to API configuration page

* Update plataform version in package.json for all plugins

* Update test snapshots

---------

Co-authored-by: Federico Rodriguez <[email protected]>

* Update WZ_HOME in README file

* Change href for onClick in bottom bar link

* Handle check updates endpoint error

* Make about page the same as angular template

* Update about page unit tests

* Delete unused componets from Wazuh Check Updates plugin

* Replace availableUpdates hook with getAvailableUpdates function

* Add unit tests for new components

* Fix typo

* Fix unit test html id generator

* Show error message in Updates status column

* Improve README file

* Improve table and columns layout

* Improve README file

* Fix Update status column

* Fix unit test

---------

Signed-off-by: Luciano Gorza <[email protected]>
Co-authored-by: Federico Rodriguez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create new plugin wazuh-check-updates
3 participants