Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renterd reset lost sector count #486

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading