Skip to content

Commit

Permalink
Update retention policy for bucket if time changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Palakp41 committed Feb 20, 2019
1 parent fc11e74 commit 57a4f00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions ui/src/organizations/components/Retention.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ interface Props {
onChangeRuleType: (type: BucketRetentionRules.TypeEnum) => void
}

const DEFAULT_SECONDS = 0

export default class Retention extends PureComponent<Props> {
public render() {
const {retentionSeconds, type} = this.props
Expand Down Expand Up @@ -56,6 +58,7 @@ export default class Retention extends PureComponent<Props> {
}

private handleRadioClick = (type: BucketRetentionRules.TypeEnum) => {
this.props.onChangeRetentionRule(DEFAULT_SECONDS)
this.props.onChangeRuleType(type)
}

Expand Down
8 changes: 5 additions & 3 deletions ui/src/organizations/components/UpdateBucketOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default class BucketOverlay extends PureComponent<Props, State> {
)

if (!rule) {
return 3600
return 0
}

return rule.everySeconds
Expand Down Expand Up @@ -104,8 +104,10 @@ export default class BucketOverlay extends PureComponent<Props, State> {
this.setState({bucket})
}

private handleChangeRuleType = ruleType => {
this.setState({ruleType})
private handleChangeRuleType = async (
ruleType: BucketRetentionRules.TypeEnum
) => {
await this.setState({ruleType})
}

private handleSubmit = (e): void => {
Expand Down

0 comments on commit 57a4f00

Please sign in to comment.