Skip to content

Commit

Permalink
fix: renterd hosts last announcement column
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Nov 3, 2023
1 parent c8ae5ae commit 4462f12
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/wild-elephants-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

The hosts table now has a last announcement column instead of the known since column.
8 changes: 4 additions & 4 deletions apps/renterd/contexts/hosts/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,17 @@ export const columns: HostsTableColumn[] = (
),
},
{
id: 'knownSince',
label: 'known since',
id: 'lastAnnouncement',
label: 'last announcement',
category: 'general',
render: ({ data }) => {
return (
<div className="flex flex-col">
<Text size="12" noWrap>
{formatDistance(new Date(), new Date(data.knownSince))} old
{formatDistance(new Date(), new Date(data.lastAnnouncement))} ago
</Text>
<Text color="subtle" size="10" noWrap>
{formatRelative(new Date(data.knownSince), new Date())}
{formatRelative(new Date(data.lastAnnouncement), new Date())}
</Text>
</div>
)
Expand Down
7 changes: 6 additions & 1 deletion apps/renterd/contexts/hosts/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ function getHostFields(host: Host, allContracts: ContractData[]) {
host.interactions.LastScan === '0001-01-01T00:00:00Z'
? null
: host.interactions.LastScan,
knownSince: host.knownSince,
knownSince:
host.knownSince === '0001-01-01T00:00:00Z' ? null : host.knownSince,
lastAnnouncement:
host.lastAnnouncement === '0001-01-01T00:00:00Z'
? null
: host.lastAnnouncement,
uptime: new BigNumber(host.interactions.Uptime || 0),
downtime: new BigNumber(host.interactions.Downtime || 0),
successfulInteractions: new BigNumber(
Expand Down
5 changes: 3 additions & 2 deletions apps/renterd/contexts/hosts/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type HostData = {
publicKey: string
lastScanSuccess: boolean
lastScan: string
lastAnnouncement: string
knownSince: string
uptime: BigNumber
downtime: BigNumber
Expand Down Expand Up @@ -63,7 +64,7 @@ const generalColumns = [
'publicKey',
'lastScan',
'totalScans',
'knownSince',
'lastAnnouncement',
'uptime',
'downtime',
'successfulInteractions',
Expand Down Expand Up @@ -165,7 +166,7 @@ export const columnsDefaultVisible: TableColumnId[] = [
'netAddress',
'publicKey',
'lastScan',
'knownSince',
'lastAnnouncement',
'totalScans',
'uptime',
'hasContract',
Expand Down
1 change: 1 addition & 0 deletions libs/react-renterd/src/siaTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export interface Host {
publicKey: string
netAddress: string
knownSince: string
lastAnnouncement: string
Announcements?: Announcement[]
interactions: {
Downtime: number
Expand Down

0 comments on commit 4462f12

Please sign in to comment.