fix: view editor overlay should respect table view options

pull/17544/head
Bucky Schwarz 2020-03-31 15:23:39 -07:00 committed by Bucky Schwarz
parent 572e81e3ea
commit 02946a48a2
3 changed files with 37 additions and 1 deletions

View File

@ -21,6 +21,7 @@
1. [17391](https://github.com/influxdata/influxdb/pull/17391): Fixed threshold check bug where checks could not be created when a field had a space in the name
1. [17384](https://github.com/influxdata/influxdb/pull/17384): Reuse slices built by iterator to reduce allocations
1. [17404](https://github.com/influxdata/influxdb/pull/17404): Updated duplicate check error message to be more explicit and actionable
1. [17515](https://github.com/influxdata/influxdb/pull/17515): Editing a table cell shows the proper values and respects changes
### UI Improvements

View File

@ -7,6 +7,8 @@ import {
timeMachinesReducer,
} from 'src/timeMachine/reducers'
import {RemoteDataState, TableViewProperties} from 'src/types'
describe('the Time Machine reducer', () => {
describe('setting the default aggregateFunctionType', () => {
const store = createStore(timeMachinesReducer, initialState())
@ -189,4 +191,37 @@ describe('the Time Machine reducer', () => {
expect(activeTimeMachine.activeQueryIndex).toBe(originalActiveQueryIndex)
})
})
// Fix for: https://github.com/influxdata/influxdb/issues/17364
describe('editing a table view', () => {
it('does not overwrite internal TableViewProperites when files is an empty array', () => {
const initial = initialState()
const store = createStore(timeMachinesReducer, initial)
store.dispatch({type: 'SET_VIEW_TYPE', payload: {type: 'table'}})
const midState = store.getState()
const tableViewProperties = midState.timeMachines[
midState.activeTimeMachineID
].view.properties as TableViewProperties
tableViewProperties.fieldOptions = [
{internalName: '_foo', displayName: 'foo'},
]
store.dispatch({
type: 'SET_QUERY_RESULTS',
payload: {
status: RemoteDataState.Done,
files: [],
fetchDuration: 234,
},
})
const endState = store.getState()
expect(
(endState.timeMachines[endState.activeTimeMachineID].view
.properties as TableViewProperties).fieldOptions[0].displayName
).toBe(tableViewProperties.fieldOptions[0].displayName)
})
})
})

View File

@ -274,7 +274,7 @@ export const timeMachineReducer = (
draftState.queryResults.status = status
draftState.queryResults.errorMessage = errorMessage
if (files) {
if (files && files.length) {
if (
state.view &&
state.view.properties &&