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

Migrate AngularJS routing to React #6689

Merged
merged 104 commits into from
Jun 11, 2024
Merged

Conversation

Desvelao
Copy link
Member

@Desvelao Desvelao commented May 20, 2024

Description

This pull request migrates the AngularJS routing to React.

Changes:

  • Replace AngularJS by ReactJS router
  • Remove dependencies related to AngularJS
  • Create NavigationService to manage the navigation of the application and redirections to others applications and adapt the navigation
  • Create components, hocs and HOCs to let the routing based on search parameter
    • Switch
    • Route
    • Redirect
    • useRouterSearch
    • withRouterSearch
  • Remove unused files
  • Create route resolve HOCs to simulate the route resolvers of the AngularJS
  • Port route resolvers to ReacJS
  • Replace usage of AngularJS in services and components
  • Remove hooks:
    • useRootScope
  • Remove HOCs:
    • withReduxProvider
    • withModuleTabLoader
  • Remove components:
    • WzReduxProvider
  • Remove services:
    • ModulesHelper
  • Remove AngularJS view templates
    • healthCheckTemplate
    • agentsTemplate
    • agentDeployTemplate
    • agentsPrevTemplate
    • managementTemplate;
    • overviewTemplate
    • settingsTemplate
    • securityTemplate
    • blankScreenTemplate
    • toolsTemplate
  • Fixed I18nProvider error message in Statistics mentioned in PR 6723.

Clean changes (changes not related to routing issue):

  • Remove hooks:
    • useRefreshAngularDiscover
    • useUserPermissionsPrivate
  • Remove HOCs:
    • withUserPermissionsPrivate
  • Remove components:
    • VisCard
    • Dashboard
    • ClusterTimelions
    • KibanaVisWrapper
    • Metrics
    • WzVisualize
    • WzFilterBar
    • SecurityAlerts
    • Inventory, Details, FlyoutDetail, InventoryTable, MainVuls (old FIM based on server API data)
  • Remove AngularJS factories:
    • Vis2PNG
    • VisFactoryHandler
    • DiscoverPendingUpdates
    • LoadedVisualizations
    • RawVisualizations
    • VisHandlers
  • Remove Redux action creators and reducers:
    • visualizationsReducers
    • updateMetric and updateVis
  • Remove services:
    • DataFactory
    • orderObjectBy (filter)
    • regionmapsConfig, mapConfig, tilemapsConfig
    • VisFactoryService
    • getAggregation, getFilterValues, getLastScan (old FIM based on server API data)
    • vulnerabilityIndexFiltersAdapter
  • Remove some files related to kibana-integrations

QOL changes:

  • Unify tab parameter value to render the dashboard. It uses dashboard instead of panels or dashboard
  • Replace the routing based on component state by URL
    • agent view
    • security
    • settings
    • tools
    • management
  • Replace usage of window.location to navigate or getting values from the URL

Issues Resolved

#6680

Evidence

Evidence.webm

Test

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

Note

Due to the magnitude of the change that this PR implies, it is necessary to test the entire application, not just limit yourself to the general points shown below:

Test Chrome Firefox Safari
Check that all menus in the menu bar redirect correctly.
Check the correct operation of the breadcrumbs.
In Overview, check that the panels redirect to the different modules correctly. Also the links to the "AGENTS SUMMARY" visualization and the "LAST 24 HOURS ALERTS" KPIs.
In each module, check, if applicable, that the different tabs work correctly.
In the corresponding modules, check the operation of the pinned agent.
Check on the screens where the searchBar exists the correct functioning of the filters, both entered through the searchBar and through interaction with visualizations.
Check on the screens where tables exist, any onclick functionality of the rows, as well as links, if applicable.
Check the correct operation of the API change.
Check the correct operation of the index pattern change.
Check where appropriate the correct functioning of the flyouts, as well as the links present therein.
While testing the previous points, try using the browser's backward and forward redirection. Also check that the URL is updated correctly.

Details

⚫ Check that all menus in the menu bar redirect correctly.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check the correct operation of the breadcrumbs.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ In Overview, check that the panels redirect to the different modules correctly. Also the links to the "AGENTS SUMMARY" visualization and the "LAST 24 HOURS ALERTS" KPIs.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ In each module, check, if applicable, that the different tabs work correctly.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ In the corresponding modules, check the operation of the pinned agent.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check on the screens where the searchBar exists the correct functioning of the filters, both entered through the searchBar and through interaction with visualizations.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check on the screens where tables exist, any onclick functionality of the rows, as well as links, if applicable.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check the correct operation of the API change.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check the correct operation of the index pattern change.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check where appropriate the correct functioning of the flyouts, as well as the links present therein.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ While testing the previous points, try using the browser's backward and forward redirection. Also check that the URL is updated correctly.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

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

- Create basic router
- Remove initilization of AngularJS app
- Replace AngularJS injector usage by ReactJS
@Desvelao Desvelao self-assigned this May 20, 2024
Desvelao added 2 commits May 21, 2024 10:28
- Create route resolvers
  - ip
  - wzConfig
- Adapt components to the usage of route resolvers
- Fix an error related to circular dependency
@gdiazlo gdiazlo linked an issue May 21, 2024 that may be closed by this pull request
19 tasks
Desvelao and others added 20 commits May 22, 2024 09:09
- WzAgentSelectorWrapper
- ToastNotificationsModal
- WzUpdatesNotification
- useRootScope hook
- withModuleTabLoader HOC
- Dashboard component
- Remove AngularJS services:
  - DiscoverPendingUpdates
  - LoadedVisualizations
  - RawVisualizations
  - VisHandlers
- Remove components:
  - KibanaVis
  - ClusterTimelions
  - KibanaVisWrapper
  - Metrics
  - WzVisualize
  - WzFilterBar
- Remove components
  - SecurityAlerts
- Redux actions and reducers related to deprecated visualizations
@JuanGarriuz JuanGarriuz self-requested a review June 7, 2024 08:59
@Machi3mfl Machi3mfl self-requested a review June 10, 2024 10:04
@lucianogorza
Copy link
Contributor

lucianogorza commented Jun 10, 2024

CR 🟢

Test 🟡

Test Chrome Firefox Safari
Check that all menus in the menu bar redirect correctly. 🟢
Check the correct operation of the breadcrumbs. 🟢
In Overview, check that the panels redirect to the different modules correctly. Also the links to the "AGENTS SUMMARY" visualization and the "LAST 24 HOURS ALERTS" KPIs. 🟢
In each module, check, if applicable, that the different tabs work correctly. 🟢
In the corresponding modules, check the operation of the pinned agent. 🟢
Check on the screens where the searchBar exists the correct functioning of the filters, both entered through the searchBar and through interaction with visualizations. 🟢
Check on the screens where tables exist, any onclick functionality of the rows, as well as links, if applicable. 🟢
Check the correct operation of the API change. 🟢
Check the correct operation of the index pattern change. 🟢
Check where appropriate the correct functioning of the flyouts, as well as the links present therein. 🟢
While testing the previous points, try using the browser's backward and forward redirection. Also check that the URL is updated correctly. 🟡

Details

🟢 Check that all menus in the menu bar redirect correctly.

Chrome - 🟢

menu-route.webm

Firefox - ⚫

Safari - ⚫

🟢 Check the correct operation of the breadcrumbs.

Chrome - 🟢

breadcrumb.webm

image

image

image

Firefox - ⚫

Safari - ⚫

🟢 In Overview, check that the panels redirect to the different modules correctly. Also the links to the "AGENTS SUMMARY" visualization and the "LAST 24 HOURS ALERTS" KPIs.

Chrome - 🟢

Agents Summary

agents-summary.webm

Las 24 hs alerts

las-24hs-alerts.webm

Endpoint Security

endpoint-security.webm

Threat Intelligence

threat-intelligence.webm

Securiry Operations

security-operation.webm

Cloud Security

cloud-security.webm

Firefox - ⚫

Safari - ⚫

🟢 In each module, check, if applicable, that the different tabs work correctly.

Chrome - 🟢

Configuration Assessment

image
image
image

Malware Detection

image
image

FIM

image
image
image

Threat Hunting

image
image

Vulnerability Detection

image
image
image

Mittre Att&ct

image
image
image
image

VirusTotal

image
image

PCI

image
image
image

GDPR

image
image
image

HIPAA

image
image
image

NIST

image
image
image

TCS

image
image
image

Docker

image
image

AWS

image
image

Google Cloud

image
image

GitHub

image
image
image

Office 365

image
image
image

Firefox - ⚫

Safari - ⚫

🟢 In the corresponding modules, check the operation of the pinned agent.

Chrome - 🟢

pinned-agent.webm

Firefox - ⚫

Safari - ⚫

🟢 Check on the screens where the searchBar exists the correct functioning of the filters, both entered through the searchBar and through interaction with visualizations.

Chrome - 🟢

searchbar.webm

Firefox - ⚫

Safari - ⚫

🟢 Check on the screens where tables exist, any onclick functionality of the rows, as well as links, if applicable.

Chrome - 🟢

table-links.webm

Firefox - ⚫

Safari - ⚫

🟢 Check the correct operation of the API change.

Chrome - 🟢

api-change.webm

Firefox - ⚫

Safari - ⚫

🟢 Check the correct operation of the index pattern change.

Chrome - 🟢

index-pattern-change.webm

Firefox - ⚫

Safari - ⚫

🟢 Check where appropriate the correct functioning of the flyouts, as well as the links present therein.

Chrome - 🟢

table-links.webm

Firefox - ⚫

Safari - ⚫

🟡 While testing the previous points, try using the browser's backward and forward redirection. Also check that the URL is updated correctly.

Chrome - 🟡

After loading the Dashboard pages, when you press then back button, the url only removes the filters but remains on the same page.
This behavior also occurs in the 4.9.0 branch, so is not a bug introduced by this PR.

previous-page.webm

Firefox - ⚫

Safari - ⚫

@chantal-kelm
Copy link
Member

chantal-kelm commented Jun 10, 2024

CR ⚫

Test ⚫

Test Chrome Firefox Safari
Check that all menus in the menu bar redirect correctly. 🟢
Check the correct operation of the breadcrumbs. 🟢
In Overview, check that the panels redirect to the different modules correctly. Also the links to the "AGENTS SUMMARY" visualization and the "LAST 24 HOURS ALERTS" KPIs. 🟢
In each module, check, if applicable, that the different tabs work correctly. 🟢
In the corresponding modules, check the operation of the pinned agent. 🟢
Check on the screens where the searchBar exists the correct functioning of the filters, both entered through the searchBar and through interaction with visualizations. 🟢
Check on the screens where tables exist, any onclick functionality of the rows, as well as links, if applicable. 🟢
Check the correct operation of the API change. 🔴
Check the correct operation of the index pattern change. 🟢
Check where appropriate the correct functioning of the flyouts, as well as the links present therein. 🟢
While testing the previous points, try using the browser's backward and forward redirection. Also check that the URL is updated correctly. 🟡

Details

🟢 Check that all menus in the menu bar redirect correctly.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

Grabacion.de.pantalla.2024-06-11.a.la.s.10.57.41.a.m.mov
Grabacion.de.pantalla.2024-06-11.a.la.s.11.14.09.a.m.mov
🟢 Check the correct operation of the breadcrumbs.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

Some of the tests carried out:

Grabacion.de.pantalla.2024-06-11.a.la.s.11.25.10.a.m.mov
🟢 In Overview, check that the panels redirect to the different modules correctly. Also the links to the "AGENTS SUMMARY" visualization and the "LAST 24 HOURS ALERTS" KPIs.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

Grabacion.de.pantalla.2024-06-11.a.la.s.1.19.10.p.m.mov
Grabacion.de.pantalla.2024-06-11.a.la.s.1.24.32.p.m.mov
🟢 In each module, check, if applicable, that the different tabs work correctly.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

Grabacion.de.pantalla.2024-06-11.a.la.s.1.30.48.p.m.mov
🟢 In the corresponding modules, check the operation of the pinned agent.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

Grabacion.de.pantalla.2024-06-11.a.la.s.1.32.43.p.m.mov
🟢 Check on the screens where the searchBar exists the correct functioning of the filters, both entered through the searchBar and through interaction with visualizations.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

Grabacion.de.pantalla.2024-06-11.a.la.s.1.36.23.p.m.mov
🟢 Check on the screens where tables exist, any onclick functionality of the rows, as well as links, if applicable.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

Grabacion.de.pantalla.2024-06-11.a.la.s.1.39.13.p.m.mov
Grabacion.de.pantalla.2024-06-11.a.la.s.1.44.39.p.m.mov
🔴 Check the correct operation of the API change.

Chrome - ⚫

Firefox - ⚫

Safari - 🔴

Grabacion.de.pantalla.2024-06-11.a.la.s.1.50.52.p.m.mov
🟢 Check the correct operation of the index pattern change.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

Grabacion.de.pantalla.2024-06-11.a.la.s.2.27.13.p.m.mov
🟢 Check where appropriate the correct functioning of the flyouts, as well as the links present therein.

Chrome - ⚫

Firefox - ⚫

Safari - 🟢

Grabacion.de.pantalla.2024-06-11.a.la.s.2.08.55.p.m.mov
🟡 While testing the previous points, try using the browser's backward and forward redirection. Also check that the URL is updated correctly.

Chrome - ⚫

Firefox - ⚫

Safari - 🟡

In some cases the back button does not work:

Grabacion.de.pantalla.2024-06-11.a.la.s.11.54.37.a.m.mov

@yenienserrano
Copy link
Member

With sample data you navigate from events to some agent that doesn't exist when you go back to the dashboards, the view loads fine but the breadcrumb doesn't change and the error view appears below the graphs.

Screen.Recording.2024-06-10.at.10.27.49.PM.mov

@JuanGarriuz
Copy link
Member

JuanGarriuz commented Jun 11, 2024

Test

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

Note

Due to the magnitude of the change that this PR implies, it is necessary to test the entire application, not just limit yourself to the general points shown below:

Test Chrome Firefox Safari
Check that all menus in the menu bar redirect correctly. 🟢
Check the correct operation of the breadcrumbs. 🟢
In Overview, check that the panels redirect to the different modules correctly. Also the links to the "AGENTS SUMMARY" visualization and the "LAST 24 HOURS ALERTS" KPIs. 🟢
In each module, check, if applicable, that the different tabs work correctly. 🟢
In the corresponding modules, check the operation of the pinned agent.
Check on the screens where the searchBar exists the correct functioning of the filters, both entered through the searchBar and through interaction with visualizations.
Check on the screens where tables exist, any onclick functionality of the rows, as well as links, if applicable.
Check the correct operation of the API change. 🟢
Check the correct operation of the index pattern change.
Check where appropriate the correct functioning of the flyouts, as well as the links present therein.
While testing the previous points, try using the browser's backward and forward redirection. Also check that the URL is updated correctly. 🟡

Details

🟢 Check that all menus in the menu bar redirect correctly.

Chrome - 🟢

Grabacion.2024-06-11.120307.mp4

Firefox - ⚫

Safari - ⚫

🟢 Check the correct operation of the breadcrumbs.

Chrome - 🟢

Grabacion.2024-06-11.120307.mp4

Firefox - ⚫

Safari - ⚫

🟢 In Overview, check that the panels redirect to the different modules correctly. Also the links to the "AGENTS SUMMARY" visualization and the "LAST 24 HOURS ALERTS" KPIs.

Chrome - 🟢

Grabacion.2024-06-11.120307.mp4

Firefox - ⚫

Safari - ⚫

🟢 In each module, check, if applicable, that the different tabs work correctly.

Chrome - 🟢

Grabacion.2024-06-11.123352.mp4

Firefox - ⚫

Safari - ⚫

⚫ In the corresponding modules, check the operation of the pinned agent.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check on the screens where the searchBar exists the correct functioning of the filters, both entered through the searchBar and through interaction with visualizations.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check on the screens where tables exist, any onclick functionality of the rows, as well as links, if applicable.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

🟢 Check the correct operation of the API change.

Chrome - 🟢

Grabacion.2024-06-11.123352.mp4

Firefox - ⚫

Safari - ⚫

⚫ Check the correct operation of the index pattern change.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check where appropriate the correct functioning of the flyouts, as well as the links present therein.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

🟡 While testing the previous points, try using the browser's backward and forward redirection. Also check that the URL is updated correctly.

The security_authentication token was not set

Chrome - 🟡

Grabacion.2024-06-11.123352.mp4

Firefox - ⚫

Safari - ⚫

@Machi3mfl
Copy link
Member

Machi3mfl commented Jun 11, 2024

Evidence

Evidence.webm

Test

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

Note

Due to the magnitude of the change that this PR implies, it is necessary to test the entire application, not just limit yourself to the general points shown below:

Test Chrome Firefox Safari
Check that all menus in the menu bar redirect correctly. 🟢
Check the correct operation of the breadcrumbs. 🟢
In Overview, check that the panels redirect to the different modules correctly. Also the links to the "AGENTS SUMMARY" visualization and the "LAST 24 HOURS ALERTS" KPIs. 🟢
In each module, check, if applicable, that the different tabs work correctly.
In the corresponding modules, check the operation of the pinned agent.
Check on the screens where the searchBar exists the correct functioning of the filters, both entered through the searchBar and through interaction with visualizations.
Check on the screens where tables exist, any onclick functionality of the rows, as well as links, if applicable.
Check the correct operation of the API change.
Check the correct operation of the index pattern change.
Check where appropriate the correct functioning of the flyouts, as well as the links present therein.
While testing the previous points, try using the browser's backward and forward redirection. Also check that the URL is updated correctly.

Details

🟢 Check that all menus in the menu bar redirect correctly.

Chrome - 🟢

Screen.Recording.2024-06-11.at.10.58.14.mov
Screen.Recording.2024-06-11.at.11.00.23.mov

Firefox - ⚫

Safari - ⚫

🟢 Check the correct operation of the breadcrumbs.

Chrome - 🟢

Screen.Recording.2024-06-11.at.11.22.13.mov

Firefox - ⚫

Safari - ⚫

🟢 In Overview, check that the panels redirect to the different modules correctly. Also the links to the "AGENTS SUMMARY" visualization and the "LAST 24 HOURS ALERTS" KPIs.

Chrome - 🟢

Screen.Recording.2024-06-11.at.11.29.39.mov

Firefox - ⚫

Safari - ⚫

⚫ In each module, check, if applicable, that the different tabs work correctly.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ In the corresponding modules, check the operation of the pinned agent.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check on the screens where the searchBar exists the correct functioning of the filters, both entered through the searchBar and through interaction with visualizations.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check on the screens where tables exist, any onclick functionality of the rows, as well as links, if applicable.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check the correct operation of the API change.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check the correct operation of the index pattern change.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Check where appropriate the correct functioning of the flyouts, as well as the links present therein.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ While testing the previous points, try using the browser's backward and forward redirection. Also check that the URL is updated correctly.

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

Machi3mfl
Machi3mfl previously approved these changes Jun 11, 2024
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
Contributor

Wazuh Core plugin code coverage (Jest) test % values
Statements 45.96% ( 399 / 868 )
Branches 41.97% ( 157 / 374 )
Functions 44.01% ( 136 / 309 )
Lines 46.16% ( 397 / 860 )

Copy link
Contributor

Wazuh Check Updates plugin code coverage (Jest) test % values
Statements 76.44% ( 172 / 225 )
Branches 58.65% ( 61 / 104 )
Functions 61.7% ( 29 / 47 )
Lines 76.44% ( 172 / 225 )

Copy link
Contributor

Main plugin code coverage (Jest) test % values
Statements 12.17% ( 3980 / 32702 )
Branches 8.11% ( 1743 / 21478 )
Functions 11.67% ( 940 / 8052 )
Lines 12.36% ( 3878 / 31373 )

@lucianogorza lucianogorza merged commit eebd474 into 4.9.0 Jun 11, 2024
8 checks passed
@lucianogorza lucianogorza deleted the feat/6680-migrate-app-routing branch June 11, 2024 22:13
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.

[Remove discover] Migrate AngularJS routing to React
7 participants