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: hostd navigation bug #468

Merged
merged 2 commits into from
Jan 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/funny-lions-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hostd': minor
---

Fixed an issue where the app would not navigate when the metrics data interval was set to ALL.
9 changes: 8 additions & 1 deletion apps/hostd/contexts/metrics/useNowAtInterval.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import { useEffect, useState } from 'react'
import { DataInterval, getDataIntervalInMs } from './types'
import { hoursInMilliseconds } from '@siafoundation/design-system'

// now timestamp updated every interval
// used to reset the time range and keep the graph up to date
export function useNowAtInterval(dataInterval: DataInterval) {
const [now, setNow] = useState(new Date().getTime())
useEffect(() => {
setNow(new Date().getTime())
// set a minimum refresh rate of every 1 hour
const minIntervalMs = hoursInMilliseconds(1)
const intervalMs = Math.min(
getDataIntervalInMs(dataInterval),
minIntervalMs
)
const i = setInterval(() => {
setNow(new Date().getTime())
}, getDataIntervalInMs(dataInterval))
}, intervalMs)
return () => clearInterval(i)
}, [dataInterval])

Expand Down
14 changes: 14 additions & 0 deletions apps/renterd/hooks/useS3AuthenticationSettings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { HookArgsSwr } from '@siafoundation/react-core'
import {
S3AuthenticationSettings,
useSetting,
} from '@siafoundation/react-renterd'

export function useS3AuthenticationSettings(
args?: HookArgsSwr<void, S3AuthenticationSettings>
) {
return useSetting<S3AuthenticationSettings>({
...args,
params: { key: 's3authentication' },
})
}
1 change: 0 additions & 1 deletion libs/design-system/src/components/ChartXY/ChartXYGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ export function ChartXYGraph<Key extends string, Cat extends string>({
// values don't make sense in stream graph
// tickFormat={stackOffset === 'wiggle' ? () => '' : undefined}
tickFormat={config.formatTickY}
tickTransform={`translate(-300px, 0)`}
tickLabelProps={(p) => ({
...p,
fill: theme.labels.color,
Expand Down
6 changes: 6 additions & 0 deletions libs/react-renterd/src/siaTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ export type ContractSpending = {
fundAccount: Currency
}

export type S3AuthenticationSettings = {
v4Keypairs: {
[key: string]: string
}
}

export type ContractState = 'pending' | 'active' | 'complete' | 'failed'

export type Contract = {
Expand Down