webpack/components/ParameterSelection/ParameterSelectionReducer.js in foreman_acd-0.2.1 vs webpack/components/ParameterSelection/ParameterSelectionReducer.js in foreman_acd-0.3.0
- old
+ new
@@ -20,13 +20,15 @@
PARAMETER_SELECTION_EDIT_ACTIVATE,
PARAMETER_SELECTION_EDIT_CONFIRM,
PARAMETER_SELECTION_EDIT_CHANGE,
PARAMETER_SELECTION_EDIT_CANCEL,
PARAMETER_SELECTION_SORT,
- PARAMETER_SELECTION_LOAD_FOREMAN_DATA_REQUEST,
- PARAMETER_SELECTION_LOAD_FOREMAN_DATA_SUCCESS,
- PARAMETER_SELECTION_LOAD_FOREMAN_DATA_FAILURE,
+ PARAMETER_SELECTION_PARAM_TYPE_FOREMAN,
+ PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE,
+ PARAMETER_SELECTION_LOAD_PARAM_DATA_REQUEST,
+ PARAMETER_SELECTION_LOAD_PARAM_DATA_SUCCESS,
+ PARAMETER_SELECTION_LOAD_PARAM_DATA_FAILURE,
} from './ParameterSelectionConstants';
import {
APPLICATION_DEFINITION_PARAMETER_SELECTION_MODAL_CLOSE,
} from '../ApplicationDefinition/ApplicationDefinitionConstants';
@@ -125,34 +127,48 @@
sortingOrder: payload.defaultSortingOrder,
selectedColumn
})
);
}
- case PARAMETER_SELECTION_LOAD_FOREMAN_DATA_FAILURE: {
+ case PARAMETER_SELECTION_LOAD_PARAM_DATA_FAILURE: {
return state.merge({
error: payload.error,
loading: false
});
}
- case PARAMETER_SELECTION_LOAD_FOREMAN_DATA_REQUEST: {
- const newState = {
- foremanData: {},
- hostgroupId: -1,
- loading: true
- };
+ case PARAMETER_SELECTION_LOAD_PARAM_DATA_REQUEST: {
+ let newState = {};
+ if (payload.dataType == PARAMETER_SELECTION_PARAM_TYPE_FOREMAN) {
+ newState = {
+ paramData: {},
+ hostgroupId: -1,
+ loading: true
+ };
+ } else if (payload.dataType == PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE) {
+ newState = {
+ loading: true
+ };
+ }
+
if (payload.clearParameters === true) {
Object.assign(newState, { parameters: [] });
}
return state.merge(newState);
}
- case PARAMETER_SELECTION_LOAD_FOREMAN_DATA_SUCCESS: {
- return state.merge({
- loading: false,
- foremanData: payload,
- hostgroupId: payload.hostgroup_id,
- });
+ case PARAMETER_SELECTION_LOAD_PARAM_DATA_SUCCESS: {
+ let newState = {};
+
+ if (payload.dataType == PARAMETER_SELECTION_PARAM_TYPE_FOREMAN) {
+ newState = {
+ loading: false,
+ paramData: payload,
+ hostgroupId: payload.hostgroup_id,
+ };
+ }
+
+ return state.merge(newState);
}
case APPLICATION_DEFINITION_PARAMETER_SELECTION_MODAL_CLOSE: {
const parameters = cloneDeep(state.parameters);
parameters.forEach((param, index) => {