1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 00:09:40 +02:00

refactor(docker/events): migrate list view to react [EE-2228] (#11581)

This commit is contained in:
Chaim Lev-Ari 2024-08-28 13:41:15 -06:00 committed by GitHub
parent 9797201c2a
commit 33ce841040
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 71 additions and 69 deletions

View file

@ -0,0 +1,33 @@
import { useState } from 'react';
import moment from 'moment';
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
import { PageHeader } from '@@/PageHeader';
import { useEvents } from '../proxy/queries/useEvents';
import { EventsDatatable } from './EventsDatatables';
export function ListView() {
const { since, until } = useDateRange();
const envId = useEnvironmentId();
const eventsQuery = useEvents(envId, { params: { since, until } });
return (
<>
<PageHeader title="Event list" breadcrumbs="Events" reload />
<EventsDatatable dataset={eventsQuery.data} />
</>
);
}
function useDateRange() {
return useState(() => {
const since = moment().subtract(24, 'hour').unix();
const until = moment().unix();
return { since, until };
})[0];
}