feat(records): «Запланировано» badge per row для scheduled future versions

Last item из QA report backlog'а. Banner + empty-state hint показывают
aggregate count, но не помогают find конкретные записи которые скоро
изменятся. Badge per row даёт O(1) visual scan.

Backend (read-api):
- ScheduledRecordsSummary.scheduledBusinessKeys: List<String> (capped 500)
- Repo method findScheduledBusinessKeys (DISTINCT subquery)
- Single fetch вместо N+1 per-row queries

Frontend:
- scheduledByKey Set<string> построен из summary
- Badge variant=info «Запланировано» рядом с businessKey badge'ом
- Title attribute с full RU/EN tooltip
- Не блокирует layout — gap-1.5 с pendingReview badge'ем (могут быть оба)

i18n keys для ru/en — short label «Запланировано» / «Scheduled».
This commit is contained in:
Zimin A.N.
2026-05-16 12:49:42 +03:00
parent dbbefe0510
commit e5a07fc391
6 changed files with 74 additions and 3 deletions
@@ -24,9 +24,15 @@ import java.util.List;
public record ScheduledRecordsSummary(
long count,
OffsetDateTime nearestValidFrom,
List<OffsetDateTime> upcomingValidFroms) {
List<OffsetDateTime> upcomingValidFroms,
/**
* Distinct businessKeys имеющие future scheduled version. Frontend
* lookup-set для рендеринга «Scheduled» badge per row в records table.
* Capped 500 (если больше — banner показывает общий count).
*/
List<String> scheduledBusinessKeys) {
public static ScheduledRecordsSummary empty() {
return new ScheduledRecordsSummary(0L, null, List.of());
return new ScheduledRecordsSummary(0L, null, List.of(), List.of());
}
}
@@ -216,7 +216,15 @@ public class RecordReadService {
List<OffsetDateTime> upcoming = recordRepository.findUpcomingValidFroms(
def.getId(), allowedScopes, now,
org.springframework.data.domain.PageRequest.of(0, 50));
return new ScheduledRecordsSummary(count, nearest, upcoming);
// Distinct businessKeys → frontend lookup-Set для «Scheduled» badge per row.
// Cap 500 — admin редко смотрит > 500 строк, banner показывает общий count
// (юзер всё равно увидит scheduled через time-travel или filter).
List<String> scheduledKeys = recordRepository.findScheduledBusinessKeys(
def.getId(), allowedScopes, now,
org.springframework.data.domain.PageRequest.of(0, 500));
return new ScheduledRecordsSummary(count, nearest, upcoming, scheduledKeys);
}
public static class ScopeAccessDeniedException extends RuntimeException {