Skip to content

Commit

Permalink
fix: optional retention in schema (#5236)
Browse files Browse the repository at this point in the history
  • Loading branch information
drdelambre authored Jul 28, 2022
1 parent ebc153a commit cbab7db
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const CreateBucketForm: FC<CreateBucketFormProps> = props => {
] = useState(null)
const [showSchemaValidation, setShowSchemaValidation] = useState(false)

const retentionRule = state.retentionRules.find(
const retentionRule = state.retentionRules?.find(
(rule: RetentionRule) => rule.type === 'expire'
)
const retentionSeconds = retentionRule ? retentionRule.everySeconds : 3600
Expand Down
2 changes: 1 addition & 1 deletion src/schemas/buckets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {labelSchema} from './labels'
import {ruleToString} from 'src/utils/formatting'

export const getReadableRetention = (bucket: GenBucket): string => {
const expire = bucket.retentionRules.find(rule => rule.type === 'expire')
const expire = bucket.retentionRules?.find(rule => rule.type === 'expire')

if (!expire) {
return 'forever'
Expand Down
2 changes: 1 addition & 1 deletion src/timeMachine/components/SelectorListCreateBucket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const SelectorListCreateBucket: FC<Props> = ({
buttonDisabled = true
}

const retentionRule = state.retentionRules.find(r => r.type === 'expire')
const retentionRule = state.retentionRules?.find(r => r.type === 'expire')
const retentionSeconds = retentionRule ? retentionRule.everySeconds : 3600

const handleChangeRuleType = (ruleType: RuleType): void => {
Expand Down

0 comments on commit cbab7db

Please sign in to comment.