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

fix: renterd and hostd refine config #632

Merged
merged 1 commit into from
Jun 10, 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/breezy-knives-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Allowance now has a field-specific option to auto-calculate its value. Closes https://github.com/SiaFoundation/web/issues/628
5 changes: 5 additions & 0 deletions .changeset/brown-wolves-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': patch
---

Fixed an issue where first-time configuration would not show the optimal recommendations.
5 changes: 5 additions & 0 deletions .changeset/chilly-mugs-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': patch
---

Fixed a bug where the churn alert would display NaN for the percentage when the total size was zero.
5 changes: 5 additions & 0 deletions .changeset/lemon-timers-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siafoundation/design-system': minor
---

Fields now have better support and styling for readOnly.
5 changes: 5 additions & 0 deletions .changeset/popular-timers-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': patch
---

Fixed an issue where toggling between basic and advanced modes would sometimes not revalidate all configuration fields.
5 changes: 5 additions & 0 deletions .changeset/rich-houses-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hostd': minor
---

Max collateral now has a field-specific option to auto-calculate its value. Closes https://github.com/SiaFoundation/web/issues/628
6 changes: 6 additions & 0 deletions .changeset/thirty-peaches-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'hostd': minor
'renterd': minor
---

The configuration page now has a view menu in the action bar that is consistent with all other feature pages.
6 changes: 6 additions & 0 deletions .changeset/weak-cherries-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'hostd': minor
'renterd': minor
---

Basic configuration mode no longer sets certain fields in the background. Closes https://github.com/SiaFoundation/web/issues/628
4 changes: 2 additions & 2 deletions apps/hostd/components/CmdRoot/ConfigCmdGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Props = {

export function ConfigCmdGroup({ currentPage, parentPage, pushPage }: Props) {
const router = useRouter()
const { showAdvanced } = useConfig()
const { configViewMode } = useConfig()
const { closeDialog } = useDialog()
return (
<CommandGroup currentPage={currentPage} commandPage={commandPage}>
Expand Down Expand Up @@ -82,7 +82,7 @@ export function ConfigCmdGroup({ currentPage, parentPage, pushPage }: Props) {
>
Configure bandwidth
</CommandItemSearch>
{showAdvanced && (
{configViewMode === 'advanced' && (
<>
<CommandItemSearch
currentPage={currentPage}
Expand Down
2 changes: 2 additions & 0 deletions apps/hostd/components/Config/ConfigActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Reset16, Save16 } from '@siafoundation/react-icons'
import { AnnounceButton } from './AnnounceButton'
import { useConfig } from '../../contexts/config'
import { ConfigContextMenu } from './ConfigContextMenu'
import { ConfigViewDropdownMenu } from './ConfigViewDropdownMenu'

export function ConfigActions() {
const { changeCount, revalidateAndResetForm, form, onSubmit } = useConfig()
Expand Down Expand Up @@ -32,6 +33,7 @@ export function ConfigActions() {
</Button>
<AnnounceButton />
<ConfigContextMenu />
<ConfigViewDropdownMenu />
</div>
)
}
21 changes: 1 addition & 20 deletions apps/hostd/components/Config/ConfigNav.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
import { Text, Switch, Tooltip } from '@siafoundation/design-system'
import { useConfig } from '../../contexts/config'

export function ConfigNav() {
const { showAdvanced, setShowAdvanced } = useConfig()

return (
<div className="pl-1">
<Tooltip content={showAdvanced ? 'Hide advanced' : 'Show advanced'}>
<div className="flex gap-1 items-center">
<Switch
checked={showAdvanced}
onCheckedChange={(checked) => setShowAdvanced(checked)}
/>
<Text size="12" color="subtle">
Advanced
</Text>
</div>
</Tooltip>
</div>
)
return <div className="pl-1"></div>
}
34 changes: 34 additions & 0 deletions apps/hostd/components/Config/ConfigViewDropdownMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {
Button,
Label,
Popover,
MenuItemRightSlot,
BaseMenuItem,
} from '@siafoundation/design-system'
import { CaretDown16, SettingsAdjust16 } from '@siafoundation/react-icons'
import { ViewModeToggle } from './ViewModeToggle'

export function ConfigViewDropdownMenu() {
return (
<Popover
trigger={
<Button size="small" tip="Configure view" tipAlign="end">
<SettingsAdjust16 />
View
<CaretDown16 />
</Button>
}
contentProps={{
align: 'end',
className: 'max-w-[300px]',
}}
>
<BaseMenuItem>
<Label>Show advanced settings</Label>
<MenuItemRightSlot>
<ViewModeToggle />
</MenuItemRightSlot>
</BaseMenuItem>
</Popover>
)
}
28 changes: 28 additions & 0 deletions apps/hostd/components/Config/ViewModeToggle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Switch, Tooltip } from '@siafoundation/design-system'
import { useConfig } from '../../contexts/config'

export function ViewModeToggle() {
const { configViewMode, setConfigViewMode } = useConfig()

return (
<div className="pl-1">
<Tooltip
content={
configViewMode === 'advanced'
? 'Show advanced settings'
: 'Hide advanced settings'
}
>
<div>
<Switch
aria-label="configViewMode"
checked={configViewMode === 'advanced'}
onCheckedChange={(checked) =>
setConfigViewMode(checked ? 'advanced' : 'basic')
}
/>
</div>
</Tooltip>
</div>
)
}
Loading
Loading