From fc382defb83eeb74d9b8fdbdced574b961375a12 Mon Sep 17 00:00:00 2001 From: Michael Desa Date: Thu, 2 Aug 2018 16:55:51 -0400 Subject: [PATCH] add retention policy name to bucket --- bucket.go | 11 ++++++----- chronograf/ui/src/shared/apis/flux/metaQueries.ts | 6 ++++-- http/influxdb/bucket.go | 5 +++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/bucket.go b/bucket.go index cdf9f875c2..32e6799fd0 100644 --- a/bucket.go +++ b/bucket.go @@ -7,11 +7,12 @@ import ( // Bucket is a bucket. 🎉 type Bucket struct { - ID ID `json:"id,omitempty"` - OrganizationID ID `json:"organizationID,omitempty"` - Organization string `json:"organization,omitempty"` - Name string `json:"name"` - RetentionPeriod time.Duration `json:"retentionPeriod"` + ID ID `json:"id,omitempty"` + OrganizationID ID `json:"organizationID,omitempty"` + Organization string `json:"organization,omitempty"` + Name string `json:"name"` + RetentionPolicyName string `json:"rp,omitempty"` // This to support v1 sources + RetentionPeriod time.Duration `json:"retentionPeriod"` } // BucketService represents a service for managing bucket data. diff --git a/chronograf/ui/src/shared/apis/flux/metaQueries.ts b/chronograf/ui/src/shared/apis/flux/metaQueries.ts index 87629c7db3..51c05b4eb6 100644 --- a/chronograf/ui/src/shared/apis/flux/metaQueries.ts +++ b/chronograf/ui/src/shared/apis/flux/metaQueries.ts @@ -114,14 +114,16 @@ const tagsetFilter = (filter: SchemaFilter[]): string => { return `|> filter(fn: (r) => ${predicates.join(' and ')} )` } -const metaQuery = async (source: Source, script: string) => { +const metaQuery = async (source: Source, query: string) => { const url = source.links.query + const type = "flux" try { const response = await AJAX({ method: 'POST', url, data: { - script, + type, + query, }, }) diff --git a/http/influxdb/bucket.go b/http/influxdb/bucket.go index 8ee58f9e55..d6f2e1e98b 100644 --- a/http/influxdb/bucket.go +++ b/http/influxdb/bucket.go @@ -45,8 +45,9 @@ func (s *BucketService) FindBuckets(ctx context.Context, filter platform.BucketF } b := &platform.Bucket{ // TODO(desa): what to do about IDs? - RetentionPeriod: d, - Name: fmt.Sprintf("%v.%v", db.Name, rp.Name), + RetentionPeriod: d, + Name: db.Name, + RetentionPolicyName: rp.Name, } bs = append(bs, b)