feat: add last update in server
This commit is contained in:
parent
ceb28a75d0
commit
0dc90012ed
@ -7,6 +7,8 @@ import { useSocketSubscribe } from '../api/socketio';
|
|||||||
import { filesize } from 'filesize';
|
import { filesize } from 'filesize';
|
||||||
import prettyMilliseconds from 'pretty-ms';
|
import prettyMilliseconds from 'pretty-ms';
|
||||||
import { UpDownCounter } from '../components/UpDownCounter';
|
import { UpDownCounter } from '../components/UpDownCounter';
|
||||||
|
import { max } from 'lodash-es';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
export const Servers: React.FC = React.memo(() => {
|
export const Servers: React.FC = React.memo(() => {
|
||||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||||
@ -57,6 +59,7 @@ export const ServerList: React.FC = React.memo(() => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const dataSource = Object.values(serverMap);
|
const dataSource = Object.values(serverMap);
|
||||||
|
const lastUpdatedAt = max(dataSource.map((d) => d.updatedAt));
|
||||||
|
|
||||||
const columns = useMemo((): ColumnsType<ServerStatusInfo> => {
|
const columns = useMemo((): ColumnsType<ServerStatusInfo> => {
|
||||||
return [
|
return [
|
||||||
@ -141,12 +144,17 @@ export const ServerList: React.FC = React.memo(() => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table
|
<div>
|
||||||
rowKey="hostname"
|
<div className="text-right text-sm opacity-80">
|
||||||
columns={columns}
|
Last updated at: {dayjs(lastUpdatedAt).format('YYYY-MM-DD HH:mm:ss')}
|
||||||
dataSource={dataSource}
|
</div>
|
||||||
pagination={false}
|
<Table
|
||||||
/>
|
rowKey="hostname"
|
||||||
|
columns={columns}
|
||||||
|
dataSource={dataSource}
|
||||||
|
pagination={false}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
ServerList.displayName = 'ServerList';
|
ServerList.displayName = 'ServerList';
|
||||||
|
Loading…
Reference in New Issue
Block a user