mirror of
https://github.com/owncast/owncast.git
synced 2024-11-23 05:14:20 +03:00
Add waiting message to hardware screen. Closes #2805
This commit is contained in:
parent
d5ca03fab7
commit
0b619b84a6
1 changed files with 15 additions and 8 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue