Add waiting message to hardware screen. Closes #2805

This commit is contained in:
Gabe Kangas 2023-03-13 13:18:37 -07:00
parent d5ca03fab7
commit 0b619b84a6
No known key found for this signature in database
GPG key ID: 4345B2060657F330

View file

@ -1,4 +1,4 @@
import { Row, Col, Typography } from 'antd'; import { Row, Col, Typography, Alert, Spin } from 'antd';
import React, { ReactElement, useEffect, useState } from 'react'; import React, { ReactElement, useEffect, useState } from 'react';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
import { fetchData, FETCH_INTERVAL, HARDWARE_STATS } from '../../utils/apis'; import { fetchData, FETCH_INTERVAL, HARDWARE_STATS } from '../../utils/apis';
@ -21,12 +21,6 @@ const SaveOutlined = dynamic(() => import('@ant-design/icons/SaveOutlined'), {
ssr: false, ssr: false,
}); });
// TODO: FIX TS WARNING FROM THIS.
// interface TimedValue {
// time: Date;
// value: Number;
// }
export default function HardwareInfo() { export default function HardwareInfo() {
const [hardwareStatus, setHardwareStatus] = useState({ const [hardwareStatus, setHardwareStatus] = useState({
cpu: [], // Array<TimedValue>(), cpu: [], // Array<TimedValue>(),
@ -57,7 +51,20 @@ export default function HardwareInfo() {
}, []); }, []);
if (!hardwareStatus.cpu) { if (!hardwareStatus.cpu) {
return null; return (
<div>
<Typography.Title>Hardware Info</Typography.Title>
<Alert
style={{ marginTop: '10px' }}
banner
message="Please wait"
description="No hardware details have been collected yet."
type="info"
/>
<Spin spinning style={{ width: '100%', margin: '10px' }} />
</div>
);
} }
const currentCPUUsage = hardwareStatus.cpu[hardwareStatus.cpu.length - 1]?.value; const currentCPUUsage = hardwareStatus.cpu[hardwareStatus.cpu.length - 1]?.value;