fix(admin): широкий from/to для списка событий против пустого ±30d окна
Refs EventHub/EventHubFrontAdmin#32 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -116,11 +116,19 @@ const EventListPage: React.FC = () => {
|
||||
const { viewMode, setViewMode } = useExploreView();
|
||||
const [preview, setPreview] = useState<ExplorePreviewTarget>(null);
|
||||
const [searchDraft, setSearchDraft] = useState('');
|
||||
const [params, setParams] = useState<EventListParams>({
|
||||
limit: getSavedPageSize(TABLE_KEY),
|
||||
offset: 0,
|
||||
sort: 'id',
|
||||
order: 'asc',
|
||||
// Backend defaults to ±30 days on start_time when from/to omitted — empty list
|
||||
// for seed/stage data outside that window while stats still show totals.
|
||||
const [params, setParams] = useState<EventListParams>(() => {
|
||||
const now = Date.now();
|
||||
const yearMs = 365 * 24 * 60 * 60 * 1000;
|
||||
return {
|
||||
limit: getSavedPageSize(TABLE_KEY),
|
||||
offset: 0,
|
||||
sort: 'created_at',
|
||||
order: 'desc',
|
||||
from: new Date(now - 5 * yearMs).toISOString(),
|
||||
to: new Date(now + 2 * yearMs).toISOString(),
|
||||
};
|
||||
});
|
||||
const { data, isLoading } = useEvents(params);
|
||||
const { data: stats } = useEventStats();
|
||||
|
||||
Reference in New Issue
Block a user