2 * Copyright © 2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
34 } from 'features/version/inputOutput/inputOutputConstants';
36 export const defaultInputOutput = {
49 export const initialState = {
54 types: [STRING, BOOLEAN, INTEGER, FLOAT],
61 const inputOutputReducer = (state = initialState, action) => {
62 const { type, payload } = action;
64 case SET_INPUTS_OUTPUTS:
75 [state.current]: payload
80 return { ...state, current: INPUTS };
83 return { ...state, current: OUTPUTS };
86 return { ...state, search: payload };
92 ...state[state.current],
93 defaultInputOutput[state.current]
97 /* eslint-disable no-case-declarations */
100 case CHANGE_MANDATORY:
101 const { key, ...rest } = payload;
104 [state.current]: state[state.current].map(
114 /* eslint-enable no-case-declarations */
119 [state.current]: state[state.current].filter(
120 (_, index) => index !== payload
129 export default inputOutputReducer;