Skip to content

Commit

Permalink
feat: hostd node profile uptime
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Feb 14, 2024
1 parent 3bd6287 commit b9cad6a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/wicked-sloths-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hostd': minor
---

The node profile details now include uptime. Closes https://github.com/SiaFoundation/hostd/issues/92
16 changes: 16 additions & 0 deletions apps/hostd/components/Profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { useSyncStatus } from '../../hooks/useSyncStatus'
import { useDialog } from '../../contexts/dialog'
import { useSiascanUrl } from '../../hooks/useSiascanUrl'
import { humanTime } from '@siafoundation/units'

export function Profile() {
const { openDialog } = useDialog()
Expand All @@ -38,6 +39,11 @@ export function Profile() {
const versionUrl = version?.match(/^v\d+\.\d+\.\d+/)
? `https://github.com/SiaFoundation/hostd/releases/${version}`
: `https://github.com/SiaFoundation/hostd/tree/${version}`

const uptime = state.data
? new Date().getTime() - new Date(state.data?.startTime).getTime()
: 0

return (
<DaemonProfile
name="hostd"
Expand Down Expand Up @@ -93,6 +99,16 @@ export function Profile() {
/>
</div>
</div>
{state.data && (
<div className="flex gap-4 justify-between items-center">
<Label size="14" color="subtle" noWrap className="w-[100px]">
Uptime
</Label>
<div className="flex-1 flex justify-end overflow-hidden -mr-0.5 pr-0.5">
<Text size="14">{humanTime(uptime, { format: 'long' })}</Text>
</div>
</div>
)}
<div className="flex gap-2 justify-between items-center">
<Label size="14" color="subtle" noWrap className="w-[100px]">
Network
Expand Down

0 comments on commit b9cad6a

Please sign in to comment.