Introduce editRawQueryStatus action

pull/10616/head
Andrew Watkins 2017-03-29 14:36:06 -07:00
parent cd1271fde4
commit cf8b8588b3
3 changed files with 35 additions and 1 deletions

View File

@ -10,7 +10,8 @@ import {
groupByTime,
toggleTagAcceptance,
updateRawQuery,
} from 'src/data_explorer/actions/view'
editRawQueryStatus,
} from 'src/data_explorer/actions/view';
const fakeAddQueryAction = (panelID, queryID) => {
return {
@ -321,4 +322,18 @@ describe('Chronograf.Reducers.queryConfig', () => {
expect(nextState[queryId].rawText).to.equal('foo')
})
it('updates a query\'s raw status', () => {
const queryId = 123
const initialState = {
[queryId]: buildInitialState(queryId),
}
const status = 'your query was sweet'
const action = editRawQueryStatus(queryId, status)
const nextState = reducer(initialState, action)
expect(nextState[queryId].rawStatus).to.equal(status)
})
})

View File

@ -128,3 +128,13 @@ export function updateRawQuery(queryID, text) {
},
}
}
export function editRawQueryStatus(queryID, rawStatus) {
return {
type: 'EDIT_RAW_QUERY_STATUS',
payload: {
queryID,
rawStatus,
},
};
}

View File

@ -145,6 +145,15 @@ export default function queryConfigs(state = {}, action) {
[queryID]: nextQueryConfig,
})
}
case 'EDIT_RAW_QUERY_STATUS': {
const {queryID, rawStatus} = action.payload
const nextState = {
[queryID]: {...state[queryID], rawStatus},
}
return {...state, ...nextState}
}
}
return state
}