feat(admin-ui): Phase 1 lineage UI — "Used by" + record refs cards
dict-relationships-v2 epic, Phase 1 admin UI. Backend endpoints поднимаются
коммитом 46a0a9c, тут — UI surface'ит их.
Что добавлено:
- `DictionaryDependentsPanel` — schema-level "На этот словарь ссылаются:"
panel на странице справочника. Chip per (sourceDict.field → targetField,
active records count, onClose mode badge: block/warn/cascade).
Hide-on-empty: большинство справочников без incoming refs panel не видят.
- `RecordDependentsPanel` — record-level "На эту запись ссылаются:" section
внутри `RecordHistoryDrawer`. Per-source summary chips + paginated items
list (size=20, prev/next). Hide-on-empty.
Types в `client.ts`: `OnCloseAction`, `SchemaDependent`, `RecordDependent`,
`PerSourceSummary`, `RecordDependentsPage`.
Queries в `queries.ts`:
- `useDictionaryDependents(name)` — staleTime 5min (schemas slow-moving),
404/403 → empty.
- `useRecordDependents(dict, key, page, size)` — disabled пока key undefined.
Mount points:
- `routes/dictionaries.$name.tsx`: `<DictionaryDependentsPanel>` после
PageHeader, перед AOI banner.
- `components/record/RecordHistoryDrawer.tsx`: `<RecordDependentsPanel>`
выше existing version timeline.
i18n RU/EN:
- `lineage.usedBy.{title,count,activeCount,openSourceDict}`
- `lineage.refs.{title,total,field,created,openSourceRecord}`
- `lineage.onClose.{BLOCK,WARN,CASCADE}` (показ как лейблы)
- `pagination.{prev,next,pageOf}` — общие keys.
Plurals: `_one/_few/_many/_other` для RU (правильная грамматика count'ов).
Verify:
- pnpm tsc --noEmit: clean.
- pnpm test (vitest): 89/89 PASS (4.04s).
- pnpm build: clean (warnings о chunk size — pre-existing для @nstart/ui).
Бекенд endpoints живут на:
- GET /api/v1/dictionaries/{name}/dependents
- GET /api/v1/records/{dict}/{key}/dependents?page&size
This commit is contained in:
@@ -230,6 +230,31 @@ i18n
|
||||
'history.validTo': 'действует до',
|
||||
'history.updatedBy': 'кем',
|
||||
'history.viewData': 'данные записи (JSON)',
|
||||
// === Lineage (dict-relationships-v2 Phase 1) ===
|
||||
'lineage.usedBy.title': 'На этот словарь ссылаются',
|
||||
'lineage.usedBy.count_one': '{{count}} связь',
|
||||
'lineage.usedBy.count_few': '{{count}} связи',
|
||||
'lineage.usedBy.count_many': '{{count}} связей',
|
||||
'lineage.usedBy.count_other': '{{count}} связей',
|
||||
'lineage.usedBy.activeCount_one': '{{count}} запись',
|
||||
'lineage.usedBy.activeCount_few': '{{count}} записи',
|
||||
'lineage.usedBy.activeCount_many': '{{count}} записей',
|
||||
'lineage.usedBy.activeCount_other': '{{count}} записей',
|
||||
'lineage.usedBy.openSourceDict': 'Открыть словарь {{dict}}',
|
||||
'lineage.refs.title': 'На эту запись ссылаются',
|
||||
'lineage.refs.total_one': 'всего {{count}} ссылка',
|
||||
'lineage.refs.total_few': 'всего {{count}} ссылки',
|
||||
'lineage.refs.total_many': 'всего {{count}} ссылок',
|
||||
'lineage.refs.total_other': 'всего {{count}} ссылок',
|
||||
'lineage.refs.field': 'поле {{field}}',
|
||||
'lineage.refs.created': 'создана {{when}}',
|
||||
'lineage.refs.openSourceRecord': 'Открыть запись {{key}} в источнике',
|
||||
'lineage.onClose.BLOCK': 'block',
|
||||
'lineage.onClose.WARN': 'warn',
|
||||
'lineage.onClose.CASCADE': 'cascade',
|
||||
'pagination.prev': 'Назад',
|
||||
'pagination.next': 'Вперёд',
|
||||
'pagination.pageOf': 'стр. {{page}} из {{total}}',
|
||||
'schema.empty': 'Полей нет — добавь первое',
|
||||
'schema.addProperty': 'Добавить поле',
|
||||
'schema.delete': 'Удалить',
|
||||
@@ -514,6 +539,25 @@ i18n
|
||||
'history.validTo': 'valid to',
|
||||
'history.updatedBy': 'by',
|
||||
'history.viewData': 'record data (JSON)',
|
||||
// === Lineage (dict-relationships-v2 Phase 1) ===
|
||||
'lineage.usedBy.title': 'Used by',
|
||||
'lineage.usedBy.count_one': '{{count}} reference',
|
||||
'lineage.usedBy.count_other': '{{count}} references',
|
||||
'lineage.usedBy.activeCount_one': '{{count}} record',
|
||||
'lineage.usedBy.activeCount_other': '{{count}} records',
|
||||
'lineage.usedBy.openSourceDict': 'Open dictionary {{dict}}',
|
||||
'lineage.refs.title': 'References to this record',
|
||||
'lineage.refs.total_one': '{{count}} reference total',
|
||||
'lineage.refs.total_other': '{{count}} references total',
|
||||
'lineage.refs.field': 'field {{field}}',
|
||||
'lineage.refs.created': 'created {{when}}',
|
||||
'lineage.refs.openSourceRecord': 'Open referencing record {{key}}',
|
||||
'lineage.onClose.BLOCK': 'block',
|
||||
'lineage.onClose.WARN': 'warn',
|
||||
'lineage.onClose.CASCADE': 'cascade',
|
||||
'pagination.prev': 'Prev',
|
||||
'pagination.next': 'Next',
|
||||
'pagination.pageOf': 'page {{page}} of {{total}}',
|
||||
'schema.empty': 'No fields yet — add the first one',
|
||||
'schema.addProperty': 'Add field',
|
||||
'schema.delete': 'Delete',
|
||||
|
||||
Reference in New Issue
Block a user