-
Notifications
You must be signed in to change notification settings - Fork 3
refactor(dashboard-manager): Extract focused providers from DashboardManagerProvider #585
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
Conversation
…ManagerProvider - Extract device info data into dedicated `deviceInfoProvider` - Extract ethernet ports data into `ethernetPortsProvider` - Extract router time data into `routerTimeProvider` - Extract system stats data into `systemStatsProvider` - Extract WiFi radios data into `wifiRadiosProvider` - Add `polling_helpers.dart` for shared polling data extraction utilities - Rename `DashboardManagerProvider` to `SessionProvider` for session operations - Rename `DashboardManagerService` to `SessionService` for clarity - Update all consumers to use new focused providers - Add comprehensive unit tests for all new providers - Remove obsolete `DashboardManagerState` and related files
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
- Add new `--collect` / `-p` flag to collect golden files after tests - Implement `_copyGoldensToSnapshots()` function to copy all golden files from test directories to snapshots folder - Fix issue where golden files were never collected when using the Dart tool (since it always passes `-f` to shell script)
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
User description
Summary
deviceInfoProviderethernetPortsProviderrouterTimeProvidersystemStatsProviderwifiRadiosProviderpolling_helpers.dartfor shared polling data extraction utilitiesDashboardManagerProvidertoSessionProviderfor session operationsDashboardManagerServicetoSessionServicefor clarityDashboardManagerStateand related filesChanges
New Providers (Read-only, derived from polling data):
deviceInfoProvider- Extracts NodeDeviceInfo and SKU model numberethernetPortsProvider- Extracts WAN/LAN connection statusrouterTimeProvider- Extracts router local time with system fallbacksystemStatsProvider- Extracts CPU, memory, and temperature statswifiRadiosProvider- Extracts WiFi radio informationRefactored Session Management:
SessionProvider(formerly DashboardManagerProvider) - Handles session operationsSessionService(formerly DashboardManagerService) - JNAP communication for sessionTest Coverage:
Impact
This refactoring improves:
PR Type
Enhancement, Refactoring, Tests
Description
Extract focused providers from DashboardManagerProvider: Created dedicated providers (
deviceInfoProvider,ethernetPortsProvider,routerTimeProvider,systemStatsProvider,wifiRadiosProvider) for specific polling data with improved single responsibility principleRename session management classes: Renamed
DashboardManagerProvidertoSessionProviderandDashboardManagerServicetoSessionServicefor clarityRefactor views to use new providers: Updated
InstantVerifyViewandInternetSettingsViewto consume focused providers instead of monolithic dashboard manager providerImprove test infrastructure: Introduced
TestHelperutility class for consistent test setup across multiple test files (AppsAndGamingViewTest,WiFiMainViewTest,InternetSettingsViewTest)Add golden file testing: Integrated visual regression testing with golden files in view tests for better test coverage
Refactor WiFiItem model: Removed
RouterRadioconversion and added null-safety checks with sensible defaultsAdd IPv6 WAN form factory: Implemented factory pattern for creating appropriate IPv6 WAN form widgets based on connection type
UI framework updates: Migrated from
StyledAppPageViewtoUiKitPageViewand updated button components to newAppButtonAPICode quality improvements: Fixed whitespace formatting in
JNAPRetryOptionsand added DDNS models barrel export fileDiagram Walkthrough
File Walkthrough
3 files
apps_and_gaming_view_test.dart
Refactor apps and gaming view tests with TestHelper and golden filestest/page/advanced_settings/apps_and_gaming/views/localizations/apps_and_gaming_view_test.dart
TestHelperclass instead of manualmock registration and dependency injection
testHelpermockmanagement
testHelper.pumpView()for widget setupinstead of
testableSingleRoute()APPGAManddetailed test case mapping table
switchToTab()helper functionappDataTable_addButton,applicationNameTextField)standardized naming convention
AppDropdownButton→AppDropdown,AppTabBar→TabBar)wifi_main_view_test.dart
Refactor WiFi main view tests with golden filestest/page/wifi_settings/views/localizations/wifi_main_view_test.dart
organization and documentation
TestHelperutility class forconsistent test infrastructure
etc.) mapping to specific UI scenarios
filenames for visual regression testing
getWifiBundleTestState()to generate teststate with dirty state support
internet_settings_view_test.dart
Refactor internet settings tests with TestHelper utilitytest/page/advanced_settings/internet_settings/views/localizations/internet_settings_view_test.dart
TestHelperutility class for cleanertest infrastructure
testHelper.pumpView()instead oftestableSingleRoute()for widget mountingdetailed scenario descriptions for each test case
ValueKeyandKeyinstead of icon-basedlookups for better test stability
testing
3 files
wifi_item.dart
Remove RouterRadio conversion and add null-safety to WiFiItemlib/page/wifi_settings/providers/wifi_item.dart
fromRadio()factory constructor that convertedRouterRadioobjects to
WiFiItemfromMap()factory to add null-safety checks for all map fieldswith sensible defaults
radio_info.darttowifi_enums.dartand addedre-export
WifiRadioBand.radio_24, emptystrings,
WifiSecurityType.open, etc.internet_settings_view.dart
Refactor internet settings view to use focused providerslib/page/advanced_settings/internet_settings/views/internet_settings_view.dart
(
internetSettingsIPv4FormValidityProvider,internetSettingsIPv6FormValidityProvider,optionalSettingsFormValidityProvider) instead of managing form statelocally
files (
Ipv4ConnectionView,Ipv6ConnectionView,ReleaseAndRenewView)replacing with form validity providers
StyledAppPageViewtoUiKitPageViewandbutton components to use new
AppButtonAPIisIpv4Editing,isIpv6Editing,originalState) in favor of provider-based state managementinstant_verify_view.dart
Refactor instant verify view with new focused providerslib/page/instant_verify/views/instant_verify_view.dart
deviceInfoProvider,routerTimeProvider,systemStatsProvider) instead ofdashboardManagerProviderAppTopologywidget andTopologyMenuHelperInstantVerifyPdfServiceclass
hierarchy and layout structure
StyledAppPageViewtoUiKitPageViewand updatedicon/spacing constants to new design system
1 files
ipv6_wan_form_factory.dart
Add IPv6 WAN form factory for connection type handlinglib/page/advanced_settings/internet_settings/widgets/wan_forms/ipv6/ipv6_wan_form_factory.dart
IPv6WanFormFactoryto create appropriate IPv6 WANform widgets based on connection type
create()method supportingWanIPv6Typeenum
automatictype withAutomaticIPv6Form_UnsupportedIPv6Formfor unsupported IPv6 connectiontypes
appropriate error messages
1 files
_models.dart
Add DDNS models barrel export filelib/page/advanced_settings/apps_and_gaming/ddns/models/_models.dart
ddns_ui_models.dartfor centralized model access1 files
jnap_retry_options.dart
Fix whitespace formatting in JNAPRetryOptionslib/core/jnap/command/http/jnap_retry_options.dart
space after opening parenthesis)
copyWithmethod (removed extra spacebefore
retryDelaysparameter)101 files