diff --git a/ordinis-admin-ui/src/components/record/RecordHistoryDrawer.tsx b/ordinis-admin-ui/src/components/record/RecordHistoryDrawer.tsx index 0f527bc..40722f9 100644 --- a/ordinis-admin-ui/src/components/record/RecordHistoryDrawer.tsx +++ b/ordinis-admin-ui/src/components/record/RecordHistoryDrawer.tsx @@ -35,33 +35,50 @@ export const RecordHistoryDrawer = ({ open, onClose, dictionaryName, businessKey
    {data.map((rec, idx) => { const isLatest = idx === 0 - const closed = new Date(rec.validTo).getFullYear() < 9999 - // Нумерация по позиции в timeline: total..1, новая запись = total. - // rec.version (JPA optimistic lock) растёт на UPDATE и у нескольких - // закрытых может совпасть → дубли в UI. Index — стабильный 1-based счётчик. const displayVersion = data.length - idx + const now = new Date() + const from = new Date(rec.validFrom) + const to = new Date(rec.validTo) + const farFuture = to.getFullYear() >= 9999 + // Статус по реальному времени: + // future — validFrom ещё впереди (запланирована) + // active — сейчас в её диапазоне + // expired — validTo уже прошла (закрыта) + const status = from > now + ? 'future' + : !farFuture && to <= now + ? 'expired' + : 'active' return (
  1. v{displayVersion} - {isLatest && {t('history.current')}} - {!isLatest && closed && {t('history.closed')}} + {isLatest && status === 'active' && ( + {t('history.current')} + )} + {status === 'future' && {t('history.scheduled')}} + {status === 'expired' && {t('history.closed')}} + {status === 'active' && !isLatest && ( + {t('history.active')} + )}
    {t('history.validFrom')}:{' '} {new Date(rec.validFrom).toLocaleString()}
    - {closed && ( + {!farFuture && (
    {t('history.validTo')}:{' '} {new Date(rec.validTo).toLocaleString()} diff --git a/ordinis-admin-ui/src/i18n.ts b/ordinis-admin-ui/src/i18n.ts index 177c386..3a0e776 100644 --- a/ordinis-admin-ui/src/i18n.ts +++ b/ordinis-admin-ui/src/i18n.ts @@ -85,6 +85,8 @@ i18n 'history.title': 'История версий', 'history.empty': 'История пуста', 'history.current': 'текущая', + 'history.active': 'активна', + 'history.scheduled': 'запланирована', 'history.closed': 'закрыта', 'history.validFrom': 'действует с', 'history.validTo': 'действует до', @@ -202,6 +204,8 @@ i18n 'history.title': 'Version history', 'history.empty': 'No history', 'history.current': 'current', + 'history.active': 'active', + 'history.scheduled': 'scheduled', 'history.closed': 'closed', 'history.validFrom': 'valid from', 'history.validTo': 'valid to',