Skip to content

Commit

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

The node profile details now include the net address and the uptime.
30 changes: 30 additions & 0 deletions apps/renterd/components/Profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ import {
useWallet,
} from '@siafoundation/react-renterd'
import { useDialog } from '../../contexts/dialog'
import { useAppSettings } from '@siafoundation/react-core'
import { humanTime } from '@siafoundation/units'

export function Profile() {
const { openDialog } = useDialog()
const appSettings = useAppSettings()
const state = useBusState({
config: {
swr: {
Expand All @@ -40,6 +43,10 @@ export function Profile() {
? `https://github.com/SiaFoundation/renterd/releases/${version}`
: `https://github.com/SiaFoundation/renterd/tree/${version}`

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

return (
<DaemonProfile
name="renterd"
Expand All @@ -52,6 +59,19 @@ export function Profile() {
firstTimeSyncing={syncStatus.firstTimeSyncing}
moreThan100BlocksToSync={syncStatus.moreThan100BlocksToSync}
>
<div className="flex gap-4 justify-between items-center">
<Label size="14" color="subtle" noWrap className="w-[100px]">
Net address
</Label>
<div className="flex-1 flex justify-end overflow-hidden -mr-0.5 pr-0.5">
<ValueCopyable
size="14"
maxLength={50}
value={appSettings.settings.api || window.location.origin}
label="net address"
/>
</div>
</div>
<div className="flex gap-4 justify-between items-center">
<Label size="14" color="subtle" noWrap className="w-[100px]">
Wallet address
Expand All @@ -65,6 +85,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-4 justify-between items-center">
<Label size="14" color="subtle" noWrap className="w-[100px]">
Network
Expand Down

0 comments on commit 3bd6287

Please sign in to comment.