Merge branch 'master' into feature/refreshing-jwts

pull/1286/head
Chris Goller 2017-04-17 15:24:10 -05:00
commit 76fdbc9d55
4 changed files with 56 additions and 15 deletions

View File

@ -1,7 +1,13 @@
## v1.2.0 [unreleased]
### Bug Fixes
1. [#1257](https://github.com/influxdata/chronograf/issues/1257): Fix function selection in query builder
1. [#1244](https://github.com/influxdata/chronograf/pull/1244): Fix env var name for Google client secret
1. [#1269](https://github.com/influxdata/chronograf/issues/1269): Add more functionality to query config generation
### Features
1. [#1232](https://github.com/influxdata/chronograf/pull/1232): Fuse the query builder and raw query editor
### UI Improvements
1. [#1259](https://github.com/influxdata/chronograf/pull/1259): Add default display for empty dashboard
1. [#1258](https://github.com/influxdata/chronograf/pull/1258): Display Kapacitor alert endpoint options as radio button group
@ -31,7 +37,6 @@
1. [#1209](https://github.com/influxdata/chronograf/pull/1209): Ask for the HipChat subdomain instead of the entire HipChat URL in the HipChat Kapacitor configuration
1. [#1223](https://github.com/influxdata/chronograf/pull/1223): Use vhost as Chronograf's proxy to Kapacitor
1. [#1205](https://github.com/influxdata/chronograf/pull/1205): Allow initial source to be an InfluxEnterprise source
1. [#1244](https://github.com/influxdata/chronograf/pull/1244): Fix env var name for Google client secret
### Features
1. [#1112](https://github.com/influxdata/chronograf/pull/1112): Add ability to delete a dashboard
@ -45,7 +50,6 @@
1. [#1212](https://github.com/influxdata/chronograf/pull/1212): Add meta query templates and loading animation to the RawQueryEditor
1. [#1221](https://github.com/influxdata/chronograf/pull/1221): Remove the default query from empty cells on dashboards
1. [#1101](https://github.com/influxdata/chronograf/pull/1101): Compress InfluxQL responses with gzip
1. [#1232](https://github.com/influxdata/chronograf/pull/1232): Fuse the query builder and raw query editor
### UI Improvements
1. [#1132](https://github.com/influxdata/chronograf/pull/1132): Show blue strip next to active tab on the sidebar

View File

@ -29,7 +29,7 @@ define CHRONOGIRAFFE
,"" _\_
," ## | 0 0.
," ## ,-\__ `.
," / `--._;)
," / `--._;) - "HAI, I'm Chronogiraffe. Will you be my friend?"
," ## /
," ## /
endef

View File

@ -2,8 +2,11 @@ package server
import (
"encoding/json"
"fmt"
"net/http"
"golang.org/x/net/context"
"github.com/influxdata/chronograf"
"github.com/influxdata/chronograf/influx/queries"
)
@ -37,7 +40,8 @@ func (s *Service) Queries(w http.ResponseWriter, r *http.Request) {
}
ctx := r.Context()
if _, err = s.SourcesStore.Get(ctx, srcID); err != nil {
src, err := s.SourcesStore.Get(ctx, srcID)
if err != nil {
notFound(w, srcID, s.Logger)
return
}
@ -54,16 +58,57 @@ func (s *Service) Queries(w http.ResponseWriter, r *http.Request) {
for i, q := range req.Queries {
qr := QueryResponse{
ID: q.ID,
Query: q.Query,
QueryConfig: ToQueryConfig(q.Query),
ID: q.ID,
Query: q.Query,
}
qc := ToQueryConfig(q.Query)
if err := s.DefaultRP(ctx, &qc, &src); err != nil {
Error(w, http.StatusBadRequest, err.Error(), s.Logger)
return
}
qr.QueryConfig = qc
if stmt, err := queries.ParseSelect(q.Query); err == nil {
qr.QueryAST = stmt
}
qr.QueryConfig.ID = q.ID
res.Queries[i] = qr
}
encodeJSON(w, http.StatusOK, res, s.Logger)
}
// DefaultRP will add the default retention policy to the QC if one has not been specified
func (s *Service) DefaultRP(ctx context.Context, qc *chronograf.QueryConfig, src *chronograf.Source) error {
// Only need to find the default RP IFF the qc's rp is empty
if qc.RetentionPolicy != "" {
return nil
}
// For queries without databases, measurements, or fields we will not
// be able to find an RP
if qc.Database == "" || qc.Measurement == "" || len(qc.Fields) == 0 {
return nil
}
db := s.Databases
if err := db.Connect(ctx, src); err != nil {
return fmt.Errorf("Unable to connect to source: %v", err)
}
rps, err := db.AllRP(ctx, qc.Database)
if err != nil {
return fmt.Errorf("Unable to load RPs from DB %s: %v", qc.Database, err)
}
for _, rp := range rps {
if rp.Default {
qc.RetentionPolicy = rp.Name
return nil
}
}
return nil
}

View File

@ -30,14 +30,6 @@ class MultiSelectDropdown extends Component {
this.onApplyFunctions = ::this.onApplyFunctions
}
componentWillReceiveProps(nextProps) {
if (!_.isEqual(this.state.localSelectedItems, nextProps.selectedItems)) {
this.setState({
localSelectedItems: nextProps.selectedItems,
})
}
}
handleClickOutside() {
this.setState({isOpen: false})
}