AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 1 | /*! |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 2 | * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 3 | * |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 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 |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 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. |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 15 | */ |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 16 | import { combineReducers } from 'redux'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 17 | |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 18 | import activityLogReducer from 'sdc-app/common/activity-log/ActivityLogReducer.js'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 19 | |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 20 | import licenseModelCreationReducer from './creation/LicenseModelCreationReducer.js'; |
| 21 | import licenseModelEditorReducer from './LicenseModelEditorReducer.js'; |
| 22 | |
| 23 | import licenseAgreementListReducer from './licenseAgreement/LicenseAgreementListReducer.js'; |
| 24 | import licenseAgreementEditorReducer from './licenseAgreement/LicenseAgreementEditorReducer.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 25 | |
| 26 | import featureGroupsEditorReducer from './featureGroups/FeatureGroupsEditorReducer.js'; |
| 27 | import featureGroupsListReducer from './featureGroups/FeatureGroupsListReducer.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 28 | |
| 29 | import entitlementPoolsListReducer from './entitlementPools/EntitlementPoolsListReducer.js'; |
| 30 | import entitlementPoolsEditorReducer from './entitlementPools/EntitlementPoolsEditorReducer.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 31 | |
| 32 | import licenseKeyGroupsEditorReducer from './licenseKeyGroups/LicenseKeyGroupsEditorReducer.js'; |
| 33 | import licenseKeyGroupsListReducer from './licenseKeyGroups/LicenseKeyGroupsListReducer.js'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 34 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 35 | import { createPlainDataReducer } from 'sdc-app/common/reducers/PlainDataReducer.js'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 36 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 37 | import { |
| 38 | actionTypes as licenseModelOverviewConstants, |
| 39 | VLM_DESCRIPTION_FORM |
| 40 | } from './overview/LicenseModelOverviewConstants.js'; |
| 41 | import limitEditorReducer from './limits/LimitEditorReducer.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 42 | |
| 43 | export default combineReducers({ |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 44 | licenseModelCreation: createPlainDataReducer(licenseModelCreationReducer), |
| 45 | licenseModelEditor: licenseModelEditorReducer, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 46 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 47 | licenseAgreement: combineReducers({ |
| 48 | licenseAgreementEditor: createPlainDataReducer( |
| 49 | licenseAgreementEditorReducer |
| 50 | ), |
| 51 | licenseAgreementList: licenseAgreementListReducer |
| 52 | }), |
| 53 | featureGroup: combineReducers({ |
| 54 | featureGroupEditor: createPlainDataReducer(featureGroupsEditorReducer), |
| 55 | featureGroupsList: featureGroupsListReducer |
| 56 | }), |
| 57 | entitlementPool: combineReducers({ |
| 58 | entitlementPoolEditor: createPlainDataReducer( |
| 59 | entitlementPoolsEditorReducer |
| 60 | ), |
| 61 | entitlementPoolsList: entitlementPoolsListReducer |
| 62 | }), |
| 63 | licenseKeyGroup: combineReducers({ |
| 64 | licenseKeyGroupsEditor: createPlainDataReducer( |
| 65 | licenseKeyGroupsEditorReducer |
| 66 | ), |
| 67 | licenseKeyGroupsList: licenseKeyGroupsListReducer |
| 68 | }), |
| 69 | licenseModelOverview: combineReducers({ |
| 70 | selectedTab: (state = null, action) => |
| 71 | action.type === |
| 72 | licenseModelOverviewConstants.LICENSE_MODEL_OVERVIEW_TAB_SELECTED |
| 73 | ? action.buttonTab |
| 74 | : state, |
| 75 | descriptionEditor: createPlainDataReducer(function( |
| 76 | state = false, |
| 77 | action |
| 78 | ) { |
| 79 | if (action.type === licenseModelOverviewConstants.LM_DATA_CHANGED) { |
| 80 | return { |
| 81 | ...state, |
| 82 | data: { |
| 83 | description: action.description |
| 84 | }, |
| 85 | formReady: null, |
| 86 | formName: VLM_DESCRIPTION_FORM, |
| 87 | genericFieldInfo: { |
| 88 | description: { |
| 89 | isValid: true, |
| 90 | errorText: '', |
| 91 | validations: [ |
| 92 | { type: 'required', data: true }, |
| 93 | { type: 'maxLength', data: 1000 } |
| 94 | ] |
| 95 | } |
| 96 | } |
| 97 | }; |
| 98 | //return action.description; |
| 99 | } else { |
| 100 | return state; |
| 101 | } |
| 102 | }) |
| 103 | }), |
| 104 | limitEditor: createPlainDataReducer(limitEditorReducer), |
| 105 | activityLog: activityLogReducer |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 106 | }); |