From 87fa234c49a8782e7a930d7813445a2d0e14d856 Mon Sep 17 00:00:00 2001 From: "Leon.Schmidt" Date: Fri, 21 Aug 2026 03:05:44 +0200 Subject: [PATCH] ENH - add configurator field descriptions --- .../src/components/AdminConfigValueEditor.vue | 153 +++++++++++++++--- frontend/src/components/AdminPanel.vue | 45 +++++- frontend/src/stores/phone.ts | 35 ++++ .../adminConfiguratorDescription.test.ts | 55 +++++++ .../src/utils/adminConfiguratorDescription.ts | 103 ++++++++++++ sky_phone/config/locales/de.lua | 2 +- sky_phone/config/locales/en.lua | 2 +- 7 files changed, 365 insertions(+), 30 deletions(-) create mode 100644 frontend/src/utils/adminConfiguratorDescription.test.ts create mode 100644 frontend/src/utils/adminConfiguratorDescription.ts diff --git a/frontend/src/components/AdminConfigValueEditor.vue b/frontend/src/components/AdminConfigValueEditor.vue index 74bf46f..fe4a758 100644 --- a/frontend/src/components/AdminConfigValueEditor.vue +++ b/frontend/src/components/AdminConfigValueEditor.vue @@ -9,6 +9,7 @@ import { import { computed, ref } from 'vue' import type { AdminConfiguratorStructure } from '@/types/admin' +import type { AdminConfiguratorDescribe } from '@/utils/adminConfiguratorDescription' export type AdminConfigEditorLabels = { addField: string @@ -19,6 +20,7 @@ export type AdminConfigEditorLabels = { convertToTable: string emptyList: string emptyTable: string + entry: string keyPlaceholder: string list: string remove: string @@ -39,12 +41,14 @@ const props = withDefaults( defineProps<{ ariaLabel?: string depth?: number + describe: AdminConfiguratorDescribe disabled?: boolean labels: AdminConfigEditorLabels modelValue: unknown + path?: string structure?: AdminConfiguratorStructure }>(), - { ariaLabel: '', depth: 0, disabled: false }, + { ariaLabel: '', depth: 0, disabled: false, path: '' }, ) const emit = defineEmits<{ 'update:modelValue': [value: unknown] }>() @@ -211,6 +215,18 @@ function toggleStructuredEntry(entry: string): void { expandedEntry.value = expandedEntry.value === entry ? null : entry } +function tableEntryPath(key: string): string { + return props.path ? `${props.path}.${key}` : key +} + +function listEntryPath(index: number): string { + return `${props.path || props.ariaLabel}[${index + 1}]` +} + +function mapValuePath(entry: SerializedMapEntry): string { + return props.path ? `${props.path}.${entry.key}` : String(entry.key) +} + function blankFromStructure(structure: AdminConfiguratorStructure): unknown { if (structure.kind === 'optionalString') return '' if (structure.kind === 'value') return blankValue(structure.valueType) @@ -493,12 +509,33 @@ function mapEntryStructure( :aria-expanded="expandedEntry === `list:${index}`" @click="toggleStructuredEntry(`list:${index}`)" > - {{ labels.list }} {{ index + 1 }} - {{ - structuredValueLabel(row, listStructure?.items[index]) - }} + + {{ labels.entry }} {{ index + 1 }} + + {{ + describe(listEntryPath(index), row, listStructure?.items[index]) + }} + + + {{ structuredValueLabel(row, listStructure?.items[index]) }} + + {{ labels.entry }} {{ index + 1 }} + + {{ + describe(listEntryPath(index), row, listStructure?.items[index]) + }} + + - {{ key }} + + {{ key }} + + {{ describe(tableEntryPath(key), value, tableFieldStructure(key)) }} + +