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 626651b commit 55bf3d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
1. [11990](https://github.com/influxdata/influxdb/pull/11990): Add the ability to select a custom time range in explorer and dashboard

### Bug Fixes
1. [11997](https://github.com/influxdata/influxdb/pull/11997): Update the bucket retention policy to update the time in seconds

### UI Improvements

Expand Down
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
}

export 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
7 changes: 5 additions & 2 deletions ui/src/organizations/components/UpdateBucketOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import {
} from 'src/clockface'
import BucketOverlayForm from 'src/organizations/components/BucketOverlayForm'

// Constants
import {DEFAULT_SECONDS} from 'src/organizations/components/Retention'

// Types
import {Bucket, BucketRetentionRules} from '@influxdata/influx'

Expand Down Expand Up @@ -75,7 +78,7 @@ export default class BucketOverlay extends PureComponent<Props, State> {
)

if (!rule) {
return 3600
return DEFAULT_SECONDS
}

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

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

Expand Down

0 comments on commit 55bf3d1

Please sign in to comment.