blob: a762e4d338d092c51b9ae9b4ce8195fe77d8d8be [file] [log] [blame]
talig8e9c0652017-12-20 14:30:43 +02001/*!
2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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
13 * or implied. See the License for the specific language governing
14 * permissions and limitations under the License.
15 */
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020016import {
17 actionTypes,
18 VERSION_CREATION_FORM_NAME,
19 defaultState
20} from './VersionsPageCreationConstants.js';
talig8e9c0652017-12-20 14:30:43 +020021
22export default (state = {}, action) => {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020023 switch (action.type) {
24 case actionTypes.OPEN:
25 return {
26 ...state,
27 formReady: null,
28 formName: VERSION_CREATION_FORM_NAME,
29 data: { ...defaultState },
30 genericFieldInfo: {
31 description: {
32 isValid: true,
33 errorText: '',
34 validations: [
35 { type: 'required', data: true },
36 { type: 'maxLength', data: 120 }
37 ]
38 },
39 creationMethod: {
40 isValid: true,
41 errorText: '',
42 validations: [{ type: 'required', data: true }]
43 }
44 }
45 };
46 case actionTypes.CLOSE:
47 return {};
48 default:
49 return state;
50 }
talig8e9c0652017-12-20 14:30:43 +020051};