mirror of https://github.com/jetkvm/kvm.git
feat(ui): add empty state handling for DHCP lease information
This commit is contained in:
parent
5c07b8444c
commit
d430cc5496
|
@ -5,6 +5,8 @@ import { GridCard } from "@/components/Card";
|
||||||
import { LifeTimeLabel } from "@/routes/devices.$id.settings.network";
|
import { LifeTimeLabel } from "@/routes/devices.$id.settings.network";
|
||||||
import { NetworkState } from "@/hooks/stores";
|
import { NetworkState } from "@/hooks/stores";
|
||||||
|
|
||||||
|
import EmptyCard from "./EmptyCard";
|
||||||
|
|
||||||
export default function DhcpLeaseCard({
|
export default function DhcpLeaseCard({
|
||||||
networkState,
|
networkState,
|
||||||
setShowRenewLeaseConfirm,
|
setShowRenewLeaseConfirm,
|
||||||
|
@ -12,6 +14,17 @@ export default function DhcpLeaseCard({
|
||||||
networkState: NetworkState | null;
|
networkState: NetworkState | null;
|
||||||
setShowRenewLeaseConfirm: (show: boolean) => void;
|
setShowRenewLeaseConfirm: (show: boolean) => void;
|
||||||
}) {
|
}) {
|
||||||
|
const isDhcpLeaseEmpty = Object.keys(networkState?.dhcp_lease || {}).length === 0;
|
||||||
|
|
||||||
|
if (isDhcpLeaseEmpty) {
|
||||||
|
return (
|
||||||
|
<EmptyCard
|
||||||
|
headline="No DHCP Lease information"
|
||||||
|
description="We haven't received any DHCP lease information from the device yet."
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GridCard>
|
<GridCard>
|
||||||
<div className="animate-fadeIn p-4 text-black opacity-0 animation-duration-500 dark:text-white">
|
<div className="animate-fadeIn p-4 text-black opacity-0 animation-duration-500 dark:text-white">
|
||||||
|
|
Loading…
Reference in New Issue