From 1778c97cffc5128e70baab9a658f0d9bb1e9f79b Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Sat, 15 Aug 2026 08:37:44 +0200 Subject: [PATCH] ui : derive the syncable parameter list in the parameter sync service The syncable parameter mapping is only consumed by the sync service, so derive it there from the registry instead of exporting it from the constants file. --- tools/ui/src/lib/constants/settings.constants.ts | 15 +-------------- .../src/lib/services/parameter-sync.service.ts | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/tools/ui/src/lib/constants/settings.constants.ts b/tools/ui/src/lib/constants/settings.constants.ts index 46c5a8dac4..0139836b7a 100644 --- a/tools/ui/src/lib/constants/settings.constants.ts +++ b/tools/ui/src/lib/constants/settings.constants.ts @@ -23,8 +23,7 @@ import type { SettingsEntry, SettingsFieldConfig, SettingsSection, - SettingsSectionEntry, - SyncableParameter + SettingsSectionEntry } from '$lib/types'; /** Settings sections — slug is the routing identity, title is the display label. */ @@ -754,15 +753,3 @@ export const NUMERIC_FIELDS = getAllSettings() export const POSITIVE_INTEGER_FIELDS = getAllSettings() .filter((s) => s.isPositiveInteger) .map((s) => s.key) as readonly string[]; - -/** Mapping of UI setting keys to server parameter keys, for the sync service. */ -export const SYNCABLE_PARAMETERS: SyncableParameter[] = SETTINGS_REGISTRY.flatMap( - (section) => section.settings -) - .filter((s) => s.sync !== undefined) - .map((s) => ({ - canSync: true, - key: s.key, - serverKey: s.sync!.serverKey, - type: s.sync!.paramType - })); diff --git a/tools/ui/src/lib/services/parameter-sync.service.ts b/tools/ui/src/lib/services/parameter-sync.service.ts index 467e7c2dbd..e140874491 100644 --- a/tools/ui/src/lib/services/parameter-sync.service.ts +++ b/tools/ui/src/lib/services/parameter-sync.service.ts @@ -6,11 +6,23 @@ * No reactive state; consumed by settingsStore. */ -import { SETTINGS_KEYS, SYNCABLE_PARAMETERS } from '$lib/constants'; +import { SETTINGS_KEYS, SETTINGS_REGISTRY } from '$lib/constants'; import { ParameterSource, SyncableParameterType } from '$lib/enums'; -import type { ParameterInfo, ParameterRecord, ParameterValue } from '$lib/types'; +import type { ParameterInfo, ParameterRecord, ParameterValue, SyncableParameter } from '$lib/types'; import { normalizeFloatingPoint } from '$lib/utils'; +/** Mapping of UI setting keys to server parameter keys, derived from the registry. */ +export const SYNCABLE_PARAMETERS: SyncableParameter[] = SETTINGS_REGISTRY.flatMap( + (section) => section.settings +) + .filter((s) => s.sync !== undefined) + .map((s) => ({ + canSync: true, + key: s.key, + serverKey: s.sync!.serverKey, + type: s.sync!.paramType + })); + export class ParameterSyncService { /** * Check if a parameter can be synced from server.