| 1 | import type { MutableRefObject } from 'react' |
| 2 | import type { ConfigFileFormat } from '@/api/config-editor/config-editor.types' |
| 3 | |
| 4 | export type ConfigPathSegment = string | number |
| 5 | export type ConfigPath = ConfigPathSegment[] |
| 6 | export type ConfigValue = unknown |
| 7 | |
| 8 | export interface ConfigSectionView { |
| 9 | id: string |
| 10 | label: string |
| 11 | description: string |
| 12 | paths: ConfigPath[] |
| 13 | fieldCount: number |
| 14 | modifiedFieldCount: number |
| 15 | notRecommended?: boolean |
| 16 | } |
| 17 | |
| 18 | export interface ConfigPathFocusRequest { |
| 19 | id: number |
| 20 | path: ConfigPath |
| 21 | } |
| 22 | |
| 23 | export interface ConfigEditorStatus { |
| 24 | service: 'unknown' | 'running' | 'restarting' | 'failed' |
| 25 | format?: ConfigFileFormat |
| 26 | dirty: boolean |
| 27 | } |
| 28 | |
| 29 | export interface ConfigFormPanelProps { |
| 30 | sections: ConfigSectionView[] |
| 31 | config: Record<string, unknown> |
| 32 | originalConfig: Record<string, unknown> | null |
| 33 | disabled: boolean |
| 34 | scrollContainerRef: MutableRefObject<HTMLDivElement | null> |
| 35 | focusRequest: ConfigPathFocusRequest | null |
| 36 | highlightedPathKey: string |
| 37 | initialScrollTop: number |
| 38 | onFocusRequestHandled: (requestId: number) => void |
| 39 | onValueChange: (path: ConfigPath, value: ConfigValue) => void |
| 40 | onNavigateToJson: (path: ConfigPath) => void |
| 41 | onScrollTopChange: (scrollTop: number) => void |
| 42 | onSectionClick: (sectionId: string) => void |
| 43 | } |
| 44 | |
| 45 | export interface ConfigFieldProps { |
| 46 | path: ConfigPath |
| 47 | fieldKey: string |
| 48 | value: ConfigValue |
| 49 | originalValue?: ConfigValue |
| 50 | disabled: boolean |
| 51 | depth?: number |
| 52 | focusPath: ConfigPath | null |
| 53 | highlightedPathKey: string |
| 54 | onValueChange: (path: ConfigPath, value: ConfigValue) => void |
| 55 | onNavigateToJson: (path: ConfigPath) => void |
| 56 | } |
| 57 |