feat(schema): создание словаря по шаблону существующего

Для семейств похожих словарей (satellite_type / consumer_type /
processing_level — все 'code+name+description' с таким же scope)
admin копировал JSON руками или дублировал поля в Поля-табе. Это
~3 минуты на каждый.

Теперь в create-mode dictionary editor сверху появился блок 'Создать
по шаблону': SingleSelect списка существующих словарей. На выбор
fetch'ится detail и заполняются:
- description, scope, bundle
- supportedLocales / defaultLocale
- properties (через parseSchemaJson — round-trip preserved для FK,
  enum, localized, opaque kinds)
- idSource

Не трогаем:
- name (admin вводит уникальный имя — это валидация на 422)
- displayName (специфичен для нового словаря)
- schemaVersion (resets на 1.0.0)

Чисто client-side: queryClient.fetchQuery(dictionaryDetailQuery(name))
— TanStack Query сам кеширует результат и для users 'Изменить схему'
позже. Не требует backend изменений.

Edit-mode не показывает шаблон — там initial уже имеет schema
существующего словаря.
This commit is contained in:
Zimin A.N.
2026-05-06 21:41:21 +03:00
parent f2cf34e2fc
commit d8686c0352
2 changed files with 66 additions and 0 deletions
+6
View File
@@ -176,6 +176,9 @@ i18n
'schema.scope': 'Scope',
'schema.bundle': 'Bundle',
'schema.bundleHint': 'Обычно cuod',
'schema.template.label': 'Создать по шаблону',
'schema.template.hint': 'Скопирует схему, scope и locale выбранного словаря. Имя оставьте уникальное; версия сбросится на 1.0.0.',
'schema.template.placeholder': '— без шаблона —',
'schema.version': 'Версия схемы',
'schema.supportedLocales': 'Поддерживаемые локали',
'schema.defaultLocale': 'Локаль по умолчанию',
@@ -432,6 +435,9 @@ i18n
'schema.scope': 'Scope',
'schema.bundle': 'Bundle',
'schema.bundleHint': 'Usually cuod',
'schema.template.label': 'Create from template',
'schema.template.hint': 'Copies schema, scope and locales from the selected dictionary. Use a unique name; version resets to 1.0.0.',
'schema.template.placeholder': '— no template —',
'schema.version': 'Schema version',
'schema.supportedLocales': 'Supported locales',
'schema.defaultLocale': 'Default locale',