Skip to content

Tier 4: Migrate 6 Reflux stores with UI state or cross-store dependencies#25372

Draft
dennisoelkers wants to merge 24 commits intomasterfrom
refactor/migrate-reflux-stores-tier-4
Draft

Tier 4: Migrate 6 Reflux stores with UI state or cross-store dependencies#25372
dennisoelkers wants to merge 24 commits intomasterfrom
refactor/migrate-reflux-stores-tier-4

Conversation

@dennisoelkers
Copy link
Member

Description

Motivation and Context

  • Replace SystemLoadBalancerStore and SystemProcessingStore (action-only stores) with plain async functions in src/api/, remove their listenTo chains from ClusterOverviewStore
  • Replace StartpageStore and PreferencesStore with plain async functions that call CurrentUserStore.reload() directly, removing Reflux action/completed listener coupling from CurrentUserStore
  • Replace TelemetrySettingsStore with react-query hooks (useTelemetrySettings, useUpdateTelemetrySettings) for automatic cache management
  • Replace ServerAvailabilityStore with a React Context + Provider + module-level callback pattern, allowing both React components and the non-React FetchProvider to report/consume server availability state
  • Net deletion of ~100 lines, removing 6 Reflux stores and 2 Reflux action objects

/nocl Internal refactoring

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have requested a documentation update.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

dennisoelkers and others added 24 commits March 19, 2026 08:42
Use StaticFields.create/remove from @graylog/server-api instead of
the Reflux store. Remove cross-store dependency from InputsStore
since react-query cache invalidation already handles input list refresh.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace all usages of the Reflux InputStatesStore with the existing
useInputsStates hook and useInputStateMutations hook. Components now
use SystemInputStates from @graylog/server-api directly where hooks
cannot be used (StartInputStep).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace all usages of InputTypesStore with existing hooks:
- useInputTypesDescriptions for input type descriptions
- useInputTypes (hooks/) for input type summaries
- fetchInputType for fetching a single input type definition

Move InputDescription type to hooks/useInputType.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create usePipelineConnections hook for fetching connections and
usePipelineConnectionMutation for updating pipeline-to-stream
connections. Uses PipelinesConnections from @graylog/server-api.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace StreamRulesStore with useStreamRuleMutations hook for create/update/remove
operations. Update useStreamRuleTypes to use generated API client directly.
Remove onChange/unregister callbacks in favor of query invalidation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace GrokPatternsStore with exported functions in hooks/useGrokPatterns.ts
that call the generated SystemGrok API client. Update all three consumers
(GrokPatterns, BulkLoadPatternModal, GrokExtractorConfiguration) and replace
CancellablePromise patterns with unmounted flags.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create useOutputMutations hook for save/update/remove operations using
SystemOutputs API client. Move Output type to hooks/useOutputs. Update
OutputsComponent to use useOutputs/useStreamOutputs hooks instead of
store callbacks. Update OutputsList and AddOutputButton to use mutations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace ContentPacksActions with direct calls to SystemContentPacks API
client. Replace useStore(ContentPacksStore) in EditContentPackPage with
useContentPackRevisions hook. Use queryClient.invalidateQueries for
cache refresh after upload.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… API calls

Replace LookupTablesStore, LookupTableCachesStore, and LookupTableDataAdaptersStore
with direct REST calls via lookupTablesAPI.ts. Consumers now use react-query or
call API functions directly instead of going through Reflux stores.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…query hooks

Replace the Reflux store with standalone API functions (fetchIndexSets,
createIndexSet, updateIndexSet, deleteIndexSet, setDefaultIndexSet, etc.)
and leverage existing useIndexSetsList/useSingleIndexSet react-query hooks.
Update all 20 consumer files including tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the useFetchLookupTables hook with direct named exports of
fetchPaginatedLookupTables and lookupTablesKeyFn from useLookupTablesAPI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract the load balancer override logic from the Reflux store into a
plain exported function in src/api/system-load-balancer.ts. Update
NodesActions and GraylogNodeActions to import the new function, and
remove the SystemLoadBalancerStore listener from ClusterOverviewStore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract pause/resume processing into src/api/system-processing.ts,
update all consumers to use the new functions, and remove the
SystemProcessingStore listenTo from ClusterOverviewStore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migrate StartpageStore to a plain `setStartpage` function in `api/startpage.ts`.
The new function calls `CurrentUserStore.reload()` directly after success
instead of relying on Reflux trigger/listenTo coupling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migrate from Reflux TelemetrySettingsStore/TelemetrySettingsActions to
react-query useTelemetrySettings and useUpdateTelemetrySettings hooks,
with plain fetch functions for the telemetry settings API endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…vider

- Create ServerAvailabilityContext with types and context definition
- Create ServerAvailabilityProvider with state management and ping logic
- Create api/server-availability module-level callback pattern for FetchProvider
- Update FetchProvider to use new reportSuccess/reportError imports
- Update AppFacade to consume context instead of Reflux store
- Update useServerVersion to use context
- Update ServerUnavailablePage to import ServerError from new location
- Wrap AppFacade with ServerAvailabilityProvider in index.tsx
- Update FetchProvider test mock
- Delete ServerAvailabilityStore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove vestigial TelemetrySettingsStoreState type with no consumers
- Replace @ts-ignore with proper type assertion in convertPreferences

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…flux-stores-tier-4

# Conflicts:
#	graylog2-web-interface/src/routing/AppFacade.tsx
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.

1 participant