diff --git a/api/src/types/provider.ts b/api/src/types/provider.ts index b6e95e412..2dedbd6e1 100644 --- a/api/src/types/provider.ts +++ b/api/src/types/provider.ts @@ -21,6 +21,7 @@ export interface ProviderList { uptime30d: number; isValidVersion: boolean; isOnline: boolean; + lastOnlineDate: Date; isAudited: boolean; gpuModels: { vendor: string; model: string; ram: string; interface: string }[]; activeStats: { diff --git a/deploy-web/src/pages/providers/[owner]/index.tsx b/deploy-web/src/pages/providers/[owner]/index.tsx index b2edd2e56..7a032fe28 100644 --- a/deploy-web/src/pages/providers/[owner]/index.tsx +++ b/deploy-web/src/pages/providers/[owner]/index.tsx @@ -91,7 +91,7 @@ const ProviderDetailPage: React.FunctionComponent = ({ owner, _provider } function groupUptimeChecksByPeriod(uptimeChecks: { isOnline: boolean; checkDate: string }[] = []) { const groupedSnapshots: { checkDate: Date; checks: boolean[] }[] = []; - const sortedUptimeChecks = uptimeChecks.toSorted((a, b) => new Date(a.checkDate).getTime() - new Date(b.checkDate).getTime()); + const sortedUptimeChecks = [...uptimeChecks].sort((a, b) => new Date(a.checkDate).getTime() - new Date(b.checkDate).getTime()); for (const snapshot of sortedUptimeChecks) { const recentGroup = groupedSnapshots.find(x => differenceInMinutes(new Date(snapshot.checkDate), x.checkDate) < 15); @@ -113,7 +113,7 @@ const ProviderDetailPage: React.FunctionComponent = ({ owner, _provider } } const uptimePeriods = useMemo(() => groupUptimeChecksByPeriod(provider?.uptime || []), [provider?.uptime]); - const wasRecentlyOnline = provider && (provider.isOnline || (provider.lastCheckDate && new Date(provider.lastCheckDate) >= sub(new Date(), { hours: 24 }))); + const wasRecentlyOnline = provider && (provider.isOnline || (provider.lastOnlineDate && new Date(provider.lastOnlineDate) >= sub(new Date(), { hours: 24 }))); return ( @@ -126,7 +126,7 @@ const ProviderDetailPage: React.FunctionComponent = ({ owner, _provider } )} - {provider && !wasRecentlyOnline && !isLoading && ( + {provider && !wasRecentlyOnline && !isLoadingProvider && (