Introduce editRawQueryStatus action
parent
cd1271fde4
commit
cf8b8588b3
|
@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -128,3 +128,13 @@ export function updateRawQuery(queryID, text) {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function editRawQueryStatus(queryID, rawStatus) {
|
||||
return {
|
||||
type: 'EDIT_RAW_QUERY_STATUS',
|
||||
payload: {
|
||||
queryID,
|
||||
rawStatus,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue