From 55bf3d1679544047ac24a07db84de1d4efdc07ef Mon Sep 17 00:00:00 2001 From: Palak Bhojani Date: Tue, 19 Feb 2019 17:17:39 -0800 Subject: [PATCH] Update retention policy for bucket if time changes --- CHANGELOG.md | 1 + ui/src/organizations/components/Retention.tsx | 3 +++ ui/src/organizations/components/UpdateBucketOverlay.tsx | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b178de3ef5c..55f23f31d4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/ui/src/organizations/components/Retention.tsx b/ui/src/organizations/components/Retention.tsx index 65b4c660de8..5c41d917041 100644 --- a/ui/src/organizations/components/Retention.tsx +++ b/ui/src/organizations/components/Retention.tsx @@ -23,6 +23,8 @@ interface Props { onChangeRuleType: (type: BucketRetentionRules.TypeEnum) => void } +export const DEFAULT_SECONDS = 0 + export default class Retention extends PureComponent { public render() { const {retentionSeconds, type} = this.props @@ -56,6 +58,7 @@ export default class Retention extends PureComponent { } private handleRadioClick = (type: BucketRetentionRules.TypeEnum) => { + this.props.onChangeRetentionRule(DEFAULT_SECONDS) this.props.onChangeRuleType(type) } diff --git a/ui/src/organizations/components/UpdateBucketOverlay.tsx b/ui/src/organizations/components/UpdateBucketOverlay.tsx index 4b8d1295e47..c3685f775f6 100644 --- a/ui/src/organizations/components/UpdateBucketOverlay.tsx +++ b/ui/src/organizations/components/UpdateBucketOverlay.tsx @@ -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' @@ -75,7 +78,7 @@ export default class BucketOverlay extends PureComponent { ) if (!rule) { - return 3600 + return DEFAULT_SECONDS } return rule.everySeconds @@ -104,7 +107,7 @@ export default class BucketOverlay extends PureComponent { this.setState({bucket}) } - private handleChangeRuleType = ruleType => { + private handleChangeRuleType = (ruleType: BucketRetentionRules.TypeEnum) => { this.setState({ruleType}) }