Skip to content

Commit

Permalink
refactor(renterd): remove contract sets
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Nov 19, 2024
1 parent 3f826c7 commit 4d226b4
Show file tree
Hide file tree
Showing 55 changed files with 237 additions and 825 deletions.
5 changes: 5 additions & 0 deletions .changeset/empty-bears-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Remove contract sets and autopilot set indicator from the contracts list.
7 changes: 7 additions & 0 deletions .changeset/friendly-bags-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/renterd-js': minor
'@siafoundation/renterd-react': minor
'@siafoundation/renterd-types': minor
---

Remove contract set list and update APIs.
5 changes: 5 additions & 0 deletions .changeset/friendly-mirrors-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Remove the autopilot contract set contracts count metrics graph.
5 changes: 5 additions & 0 deletions .changeset/neat-tomatoes-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Remove the autopilot contract set from configuration.
7 changes: 7 additions & 0 deletions .changeset/nine-grapes-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/renterd-js': minor
'@siafoundation/renterd-react': minor
'@siafoundation/renterd-types': minor
---

Remove set from the autopilot config API.
7 changes: 7 additions & 0 deletions .changeset/nine-terms-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/renterd-js': minor
'@siafoundation/renterd-react': minor
'@siafoundation/renterd-types': minor
---

Remove default contract set from config settings API.
5 changes: 5 additions & 0 deletions .changeset/quick-bobcats-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Remove contract set contracts filters.
5 changes: 5 additions & 0 deletions .changeset/shaggy-dolls-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Add overall contract count metrics graph.
5 changes: 5 additions & 0 deletions .changeset/shy-students-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Remove expiring (out of set) concept from the prunable data features.
7 changes: 7 additions & 0 deletions .changeset/silver-bobcats-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/renterd-js': minor
'@siafoundation/renterd-react': minor
'@siafoundation/renterd-types': minor
---

Remove contractSets from contracts list API.
7 changes: 7 additions & 0 deletions .changeset/stale-pots-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/renterd-js': minor
'@siafoundation/renterd-react': minor
'@siafoundation/renterd-types': minor
---

Add overall contract count metrics API.
7 changes: 7 additions & 0 deletions .changeset/stupid-dots-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/renterd-js': minor
'@siafoundation/renterd-react': minor
'@siafoundation/renterd-types': minor
---

Remove contractset param from worker multipart upload part API.
7 changes: 7 additions & 0 deletions .changeset/swift-knives-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/renterd-js': minor
'@siafoundation/renterd-react': minor
'@siafoundation/renterd-types': minor
---

Remove the contract set contract churn metrics API.
5 changes: 5 additions & 0 deletions .changeset/ten-carrots-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Remove contract set mismatch warnings.
5 changes: 5 additions & 0 deletions .changeset/thick-years-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Add usability column showing good for renewal or bad states to the contracts list.
5 changes: 5 additions & 0 deletions .changeset/tidy-stingrays-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Remove the default contract set from configuration.
5 changes: 5 additions & 0 deletions .changeset/tricky-dingos-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': minor
---

Remove the configuration feature for syncing the default contract set with changes to the autopilot set.
7 changes: 7 additions & 0 deletions .changeset/two-seas-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/renterd-js': minor
'@siafoundation/renterd-react': minor
'@siafoundation/renterd-types': minor
---

Add overall contract churn metrics API.
7 changes: 7 additions & 0 deletions .changeset/weak-steaks-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@siafoundation/renterd-js': minor
'@siafoundation/renterd-react': minor
'@siafoundation/renterd-types': minor
---

Remove the contract set contract count metrics API.
2 changes: 0 additions & 2 deletions apps/renterd-e2e/src/fixtures/configResetSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export const configResetAllSettings = step(
await fillTextInputByName(page, 'periodWeeks', '6')
await fillTextInputByName(page, 'renewWindowWeeks', '2')
await fillTextInputByName(page, 'amountHosts', '3')
await fillTextInputByName(page, 'autopilotContractSet', 'autopilot')
await setSwitchByLabel(page, 'prune', false)

// hosts
Expand All @@ -37,7 +36,6 @@ export const configResetAllSettings = step(
await fillTextInputByName(page, 'minProtocolVersion', '1.6.0')

// contracts
await fillTextInputByName(page, 'defaultContractSet', 'autopilot')
await setSwitchByLabel(page, 'uploadPackingEnabled', true)

// gouging
Expand Down
19 changes: 7 additions & 12 deletions apps/renterd-e2e/src/specs/contracts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test('contracts prunable size', async ({ page }) => {
const summaryRowCell = summaryRow.getByTestId('prunableSize')
await expect(summaryRowCell).toBeVisible()
await expect(summaryRowCell.getByRole('button')).toBeVisible()
await expect(summaryRowCell.getByLabel('prunable sizes')).toBeHidden({
await expect(summaryRowCell.getByLabel('prunable size')).toBeHidden({
timeout: 30_000,
})

Expand All @@ -38,32 +38,27 @@ test('contracts prunable size', async ({ page }) => {
const row1Cell = row1.getByTestId('prunableSize')
await expect(row1Cell).toBeVisible()
await expect(row1Cell.getByRole('button')).toBeVisible()
await expect(row1Cell.getByLabel('prunable sizes')).toBeHidden()
await expect(row1Cell.getByLabel('prunable size')).toBeHidden()

// Fetch prunable size on the first row.
await row1Cell.getByRole('button').click()

// Check that the prunable size is visible on the first row but not the summary.
await expect(row1Cell.getByLabel('prunable sizes')).toBeVisible()
await expect(summaryRowCell.getByLabel('prunable sizes')).toBeHidden()
await expect(row1Cell.getByLabel('prunable size')).toBeVisible()
await expect(summaryRowCell.getByLabel('prunable size')).toBeHidden()

// Fetch prunable size for all contracts.
await summaryRowCell.getByRole('button').click()

// Check that the prunable summary is visible.
const summarySizes = summaryRowCell.getByLabel('prunable sizes')
const summarySizes = summaryRowCell.getByLabel('prunable size')
await expect(summarySizes).toBeVisible()
await expect(summarySizes.getByLabel('prunable')).toBeVisible()
await expect(summarySizes.getByLabel('expiring')).toBeVisible()

// Check that the prunable size is visible for all contracts.
const rows = await getContractRows(page)
for (const row of rows) {
const prunableSizes = row.getByLabel('prunable sizes')
await expect(prunableSizes).toBeVisible()
await expect(prunableSizes).toHaveAttribute(
'aria-label',
/prunable|expiring/
)
const prunableSize = row.getByLabel('prunable size')
await expect(prunableSize).toBeVisible()
}
})
47 changes: 3 additions & 44 deletions apps/renterd/components/Config/ConfigActions.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
import {
Text,
Button,
Switch,
ControlGroup,
Popover,
Label,
Paragraph,
} from '@siafoundation/design-system'
import { Reset16, Save16, Settings16 } from '@siafoundation/react-icons'
import { Text, Button, ControlGroup } from '@siafoundation/design-system'
import { Reset16, Save16 } from '@siafoundation/react-icons'
import { useConfig } from '../../contexts/config'
import { ConfigContextMenu } from './ConfigContextMenu'
import { ConfigViewDropdownMenu } from './ConfigViewDropdownMenu'
import { pluralize } from '@siafoundation/units'

export function ConfigActions() {
const {
onSubmit,
changeCount,
shouldSyncDefaultContractSet,
setShouldSyncDefaultContractSet,
revalidateAndResetForm,
form,
} = useConfig()
const { onSubmit, changeCount, revalidateAndResetForm, form } = useConfig()

return (
<div className="flex items-center gap-2">
Expand All @@ -48,32 +33,6 @@ export function ConfigActions() {
<Save16 />
Save changes
</Button>
<Popover
contentProps={{
align: 'end',
}}
trigger={
<Button variant="accent" icon="hover">
<Settings16 />
</Button>
}
>
<div className="px-1">
<Label>Options</Label>
<div>
<Switch
checked={shouldSyncDefaultContractSet}
onCheckedChange={(val) => setShouldSyncDefaultContractSet(val)}
>
sync default contract set
</Switch>
<Paragraph size="12">
Automatically update the default contract set to be the same as
the autopilot contract set when changes are saved.
</Paragraph>
</div>
</div>
</Popover>
</ControlGroup>
<ConfigContextMenu />
<ConfigViewDropdownMenu />
Expand Down
12 changes: 0 additions & 12 deletions apps/renterd/components/Config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ export function Config() {
form={form}
fields={fields}
/>
<ConfigurationPanelSetting
autoVisibility
form={form}
fields={fields}
name="autopilotContractSet"
/>
<ConfigurationPanelSetting
autoVisibility
form={form}
Expand Down Expand Up @@ -240,12 +234,6 @@ export function Config() {
fields={fields}
form={form}
/>
<ConfigurationPanel
title="Contracts"
category="contractset"
fields={fields}
form={form}
/>
<ConfigurationPanel
title="Uploads"
category="uploadpacking"
Expand Down
8 changes: 4 additions & 4 deletions apps/renterd/components/Contracts/ContractMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function ContractMetrics() {
selectedContract,
allContractsSpendingMetrics,
selectedContractSpendingMetrics,
contractSetCountMetrics,
contractsCountMetrics,
graphMode,
setGraphMode,
} = useContracts()
Expand Down Expand Up @@ -70,9 +70,9 @@ export function ContractMetrics() {
<ChartXY
id="renterd/v0/contracts/graphs/count"
height="100%"
data={contractSetCountMetrics.data}
config={contractSetCountMetrics.config}
isLoading={contractSetCountMetrics.isLoading}
data={contractsCountMetrics.data}
config={contractsCountMetrics.config}
isLoading={contractsCountMetrics.isLoading}
actionsLeft={tabsEl}
emptyState={<StateNoData />}
/>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { RenewCmdGroup } from './Renew'
import { Page } from '../../../../CmdRoot/types'
import { AddressCmdGroup } from './Address'
import { PublicKeyCmdGroup } from './PublicKey'
import { ContractSetCmdGroup } from './ContractSet'

type Props = {
currentPage: Page
Expand All @@ -16,7 +15,6 @@ export function ContractFilterCmdGroups({ currentPage, select }: Props) {
<>
<AddressCmdGroup currentPage={currentPage} select={select} />
<PublicKeyCmdGroup currentPage={currentPage} select={select} />
<ContractSetCmdGroup currentPage={currentPage} select={select} />
<ExpiryCmdGroup currentPage={currentPage} select={select} />
<FormationCmdGroup currentPage={currentPage} select={select} />
<RenewCmdGroup currentPage={currentPage} select={select} />
Expand Down
Loading

0 comments on commit 4d226b4

Please sign in to comment.