Skip to content

Commit

Permalink
Merge pull request #486 from SiaFoundation/updates
Browse files Browse the repository at this point in the history
renterd reset lost sector count
  • Loading branch information
ChrisSchinnerl authored Feb 16, 2024
2 parents 2f414f4 + 035f90e commit c950e7a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-ads-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

The host context menu now has an option to reset the lost sector count.
5 changes: 5 additions & 0 deletions .changeset/red-vans-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/react-renterd': minor
---

Add useHostResetLostSectorCount.
17 changes: 17 additions & 0 deletions apps/renterd/components/Hosts/HostContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ import {
ListChecked16,
Filter16,
Copy16,
ResetAlt16,
} from '@siafoundation/react-icons'
import {
useHostResetLostSectorCount,
useHostsAllowlist,
useHostsBlocklist,
useRhpScan,
Expand Down Expand Up @@ -54,6 +56,7 @@ export function HostContextMenu({
const blocklistUpdate = useBlocklistUpdate()
const allowlistUpdate = useAllowlistUpdate()
const rescan = useRhpScan()
const resetLostSectors = useHostResetLostSectorCount()
return (
<DropdownMenu
trigger={
Expand Down Expand Up @@ -174,6 +177,20 @@ export function HostContextMenu({
Add public key to allowlist
</DropdownMenuItem>
)}
<DropdownMenuItem
onSelect={() =>
resetLostSectors.post({
params: {
publicKey,
},
})
}
>
<DropdownMenuLeftSlot>
<ResetAlt16 />
</DropdownMenuLeftSlot>
Reset lost sector count
</DropdownMenuItem>
<DropdownMenuLabel>Copy</DropdownMenuLabel>
<DropdownMenuItem
onSelect={() => copyToClipboard(publicKey, 'host public key')}
Expand Down
9 changes: 9 additions & 0 deletions libs/react-renterd/src/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,15 @@ export function useHostsBlocklistUpdate(
)
}

export function useHostResetLostSectorCount(
args?: HookArgsCallback<{ publicKey: string }, void, void>
) {
return usePostFunc({
...args,
route: '/bus/host/:publicKey/resetlostsectors',
})
}

// contracts

const contractsActiveRoute = '/bus/contracts'
Expand Down

0 comments on commit c950e7a

Please sign in to comment.