Merge pull request #1585 from influxdata/revert-auto-func

Revert auto func
pull/1586/head
Andrew Watkins 2017-06-01 16:07:02 -07:00 committed by GitHub
commit 5a37e8f57f
3 changed files with 15 additions and 23 deletions

View File

@ -16,7 +16,6 @@
1. [#1549](https://github.com/influxdata/chronograf/pull/1549): Reset graph zoom when a new time range is selected
1. [#1544](https://github.com/influxdata/chronograf/pull/1544): Upgrade to new version of Influx Theme, remove excess stylesheets
1. [#1567](https://github.com/influxdata/chronograf/pull/1567): Replace outline style User icon with solid style
1. [#1560](https://github.com/influxdata/chronograf/pull/1560): Apply mean to fields by default
1. [#1561](https://github.com/influxdata/chronograf/pull/1561): Disable query save in dashboard editing if the query does not have a database, measurement, and field
1. [#1575](https://github.com/influxdata/chronograf/pull/1575): Improve UX of applying aggregator functions to Fields in Query Maker

View File

@ -149,22 +149,23 @@ describe('Chronograf.Reducers.queryConfig', () => {
expect(newState[queryId].fields[1].field).to.equal('a different field')
})
it('applies a funcs to newly selected fields', () => {
expect(state[queryId].fields.length).to.equal(1)
// TODO: uncomment when automatically applied funtions are added back to the code
// it('applies a funcs to newly selected fields', () => {
// expect(state[queryId].fields.length).to.equal(1)
const oneFieldOneFunc = reducer(
state,
applyFuncsToField(queryId, {field: 'a great field', funcs: ['func1']})
)
// const oneFieldOneFunc = reducer(
// state,
// applyFuncsToField(queryId, {field: 'a great field', funcs: ['func1']})
// )
const newState = reducer(
oneFieldOneFunc,
toggleField(queryId, {field: 'a different field', funcs: []})
)
// const newState = reducer(
// oneFieldOneFunc,
// toggleField(queryId, {field: 'a different field', funcs: []})
// )
expect(newState[queryId].fields[1].funcs.length).to.equal(1)
expect(newState[queryId].fields[1].funcs[0]).to.equal('func1')
})
// expect(newState[queryId].fields[1].funcs.length).to.equal(1)
// expect(newState[queryId].fields[1].funcs[0]).to.equal('func1')
// })
})
})

View File

@ -42,17 +42,9 @@ export const toggleField = (query, {field, funcs}, isKapacitorRule = false) => {
}
}
let newFuncs = ['mean']
if (query.fields.length) {
newFuncs = query.fields.find(f => f.funcs).funcs
}
return {
...query,
fields: query.fields.concat({
field,
funcs: newFuncs,
}),
fields: query.fields.concat({field, funcs}),
}
}