Merge branch 'feat/user-display-persistent-cache' into 'main'

feat(user-display): persistent DB cache + Keycloak Admin lookup (Phase 1+2)

See merge request 2-6/2-6-4/terravault/ordinis!180
This commit is contained in:
Александр Зимин
2026-05-14 11:52:20 +00:00
12 changed files with 707 additions and 47 deletions
@@ -1,6 +1,7 @@
import { useTranslation } from 'react-i18next'
import { Badge, LoadingBlock, Modal, QueryErrorState } from '@/ui'
import { useChangelogDiff } from '@/api/queries'
import { UserCell } from '@/lib/useUserDisplay'
import { kindBadgeVariant, kindLabel } from './kind-meta'
/**
@@ -52,9 +53,9 @@ export function ChangelogDiffModal({
{/* Header strip — kind + author */}
<div className="flex flex-wrap items-center gap-2">
<Badge variant={kindBadgeVariant(data.kind)}>{kindLabel(data.kind, t)}</Badge>
<span className="text-cell text-mute">
<span className="text-cell text-mute inline-flex items-center gap-1">
{t('changelog.diff.by', { defaultValue: 'автор' })}:{' '}
<span className="text-ink font-mono">{data.publishedBy.name}</span>
<UserCell uuid={data.publishedBy.sub} />
</span>
</div>
@@ -6,6 +6,7 @@ import type { ChangelogEntry, DictionaryDetail, FlattenedRecord } from '@/api/cl
import { useChangelog, useChangelogDiff, useRecords } from '@/api/queries'
import { kindBadgeVariant, kindIcon, kindLabel } from '@/components/changelog/kind-meta'
import { ChangelogDiffModal } from '@/components/changelog/ChangelogDiffModal'
import { UserCell } from '@/lib/useUserDisplay'
import { cn } from '@/lib/utils'
/**
@@ -411,7 +412,9 @@ function ComparePanel({
· <span className="text-mono">{note}</span>
</span>
)}
{author && <span className="text-mute">· {author}</span>}
{author && (
<span className="text-mute inline-flex items-center gap-1">· <UserCell uuid={author} /></span>
)}
</div>
</div>
)
@@ -683,7 +686,7 @@ function ChangesTabContent({
<span className="tabular-nums">
{new Date(e.publishedAt).toLocaleString()}
</span>
<span className="font-mono">{e.publishedBy.name}</span>
<UserCell uuid={e.publishedBy.sub} />
<button
type="button"
onClick={() => onOpenDiff(e.id)}
@@ -895,7 +898,7 @@ function SchemaTabContent({
<dt className="text-cap text-mute uppercase tracking-wider">
{t('timeTravel.schema.author', { defaultValue: 'автор' })}
</dt>
<dd className="font-mono">{pickedEntry.publishedBy.name}</dd>
<dd><UserCell uuid={pickedEntry.publishedBy.sub} /></dd>
<dt className="text-cap text-mute uppercase tracking-wider">
{t('timeTravel.schema.date', { defaultValue: 'дата' })}
</dt>
@@ -56,6 +56,7 @@ import { TimeTravelModal } from '@/components/timetravel/TimeTravelModal'
import { ChangelogDiffModal } from '@/components/changelog/ChangelogDiffModal'
import { kindBadgeVariant, kindIcon, kindLabel, isVersioningKind } from '@/components/changelog/kind-meta'
import { CreateSchemaDraftModal } from '@/components/workflow/CreateSchemaDraftModal'
import { UserCell } from '@/lib/useUserDisplay'
import { nowIsoLocal } from '@/lib/dates'
import { recordDisplayName } from '@/lib/locales'
import { SCOPE_BORDER_TOP } from '@/lib/scope-style'
@@ -2258,8 +2259,8 @@ function EventsTabContent({ dictName }: { dictName: string }) {
{status}
</span>
</td>
<td className="px-3 py-2 text-mono text-cell text-ink-2">
{r.userId ?? 'anonymous'}
<td className="px-3 py-2 text-cell text-ink-2">
{r.userId ? <UserCell uuid={r.userId} /> : <span className="text-mono text-mute">anonymous</span>}
</td>
<td className="px-3 py-2 text-cell text-ink-2 max-w-md truncate">
{r.businessKey ? (
@@ -2396,7 +2397,7 @@ function ChangelogTimelineItem({
)}
<div className="flex items-center gap-3 mt-1 text-cell text-mute">
<span className="tabular-nums">{occurredAt.toLocaleString()}</span>
<span className="font-mono">{entry.publishedBy.name}</span>
<UserCell uuid={entry.publishedBy.sub} />
{entry.recordsAffected > 0 && (
<span>
{t('changelog.recordsAffected', {