blob: f6355323483e635db875d426dbe044e718be4400 [file] [log] [blame]
AviZi280f8012017-06-09 02:39:56 +03001/*!
Michael Landoefa037d2017-02-19 12:57:33 +02002 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
AviZi280f8012017-06-09 02:39:56 +03003 *
Michael Landoefa037d2017-02-19 12:57:33 +02004 * 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
AviZi280f8012017-06-09 02:39:56 +03007 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
Michael Landoefa037d2017-02-19 12:57:33 +020010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
AviZi280f8012017-06-09 02:39:56 +030012 * 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 Landoefa037d2017-02-19 12:57:33 +020015 */
Michael Landoefa037d2017-02-19 12:57:33 +020016import {combineReducers} from 'redux';
17
Avi Zivb8e2faf2017-07-18 19:45:38 +030018import activityLogReducer from 'sdc-app/common/activity-log/ActivityLogReducer.js';
AviZi280f8012017-06-09 02:39:56 +030019
Michael Landoefa037d2017-02-19 12:57:33 +020020import licenseModelCreationReducer from './creation/LicenseModelCreationReducer.js';
21import licenseModelEditorReducer from './LicenseModelEditorReducer.js';
22
23import licenseAgreementListReducer from './licenseAgreement/LicenseAgreementListReducer.js';
24import licenseAgreementEditorReducer from './licenseAgreement/LicenseAgreementEditorReducer.js';
Michael Landoefa037d2017-02-19 12:57:33 +020025
26import featureGroupsEditorReducer from './featureGroups/FeatureGroupsEditorReducer.js';
27import featureGroupsListReducer from './featureGroups/FeatureGroupsListReducer.js';
Michael Landoefa037d2017-02-19 12:57:33 +020028
29import entitlementPoolsListReducer from './entitlementPools/EntitlementPoolsListReducer.js';
30import entitlementPoolsEditorReducer from './entitlementPools/EntitlementPoolsEditorReducer.js';
Michael Landoefa037d2017-02-19 12:57:33 +020031
32import licenseKeyGroupsEditorReducer from './licenseKeyGroups/LicenseKeyGroupsEditorReducer.js';
33import licenseKeyGroupsListReducer from './licenseKeyGroups/LicenseKeyGroupsListReducer.js';
AviZi280f8012017-06-09 02:39:56 +030034
35import {createPlainDataReducer} from 'sdc-app/common/reducers/PlainDataReducer.js';
36
ilanapc6a41de2017-11-07 11:54:10 +020037import {actionTypes as licenseModelOverviewConstants, VLM_DESCRIPTION_FORM} from './overview/LicenseModelOverviewConstants.js';
Avi Ziv61070c92017-07-26 17:37:57 +030038import limitEditorReducer from './limits/LimitEditorReducer.js';
Michael Landoefa037d2017-02-19 12:57:33 +020039
40export default combineReducers({
AviZi280f8012017-06-09 02:39:56 +030041 licenseModelCreation: createPlainDataReducer(licenseModelCreationReducer),
Michael Landoefa037d2017-02-19 12:57:33 +020042 licenseModelEditor: licenseModelEditorReducer,
43
44 licenseAgreement: combineReducers({
AviZi280f8012017-06-09 02:39:56 +030045 licenseAgreementEditor: createPlainDataReducer(licenseAgreementEditorReducer),
46 licenseAgreementList: licenseAgreementListReducer
Michael Landoefa037d2017-02-19 12:57:33 +020047 }),
48 featureGroup: combineReducers({
AviZi280f8012017-06-09 02:39:56 +030049 featureGroupEditor: createPlainDataReducer(featureGroupsEditorReducer),
50 featureGroupsList: featureGroupsListReducer
Michael Landoefa037d2017-02-19 12:57:33 +020051 }),
52 entitlementPool: combineReducers({
AviZi280f8012017-06-09 02:39:56 +030053 entitlementPoolEditor: createPlainDataReducer(entitlementPoolsEditorReducer),
54 entitlementPoolsList: entitlementPoolsListReducer
Michael Landoefa037d2017-02-19 12:57:33 +020055 }),
56 licenseKeyGroup: combineReducers({
AviZi280f8012017-06-09 02:39:56 +030057 licenseKeyGroupsEditor: createPlainDataReducer(licenseKeyGroupsEditorReducer),
58 licenseKeyGroupsList: licenseKeyGroupsListReducer
Michael Landoefa037d2017-02-19 12:57:33 +020059 }),
AviZi280f8012017-06-09 02:39:56 +030060 licenseModelOverview: combineReducers({
ilanapc6a41de2017-11-07 11:54:10 +020061 selectedTab: (state = null, action) => action.type === licenseModelOverviewConstants.LICENSE_MODEL_OVERVIEW_TAB_SELECTED ? action.buttonTab : state,
AviZi280f8012017-06-09 02:39:56 +030062 descriptionEditor: createPlainDataReducer(function(state = false, action) {
63 if (action.type === licenseModelOverviewConstants.LM_DATA_CHANGED) {
64 return {
65 ...state,
66 data : {
67 description : action.description
68 },
69 formReady: null,
70 formName: VLM_DESCRIPTION_FORM,
71 genericFieldInfo: {
72 'description': {
73 isValid: true,
74 errorText: '',
75 validations: [{type: 'required', data: true}, {type: 'maxLength', data: 1000}]
76 }
77 }
78 };
79 //return action.description;
80 } else {
81 return state;
82 }
83 }
84 )}),
Avi Ziv61070c92017-07-26 17:37:57 +030085 limitEditor: createPlainDataReducer(limitEditorReducer),
AviZi280f8012017-06-09 02:39:56 +030086 activityLog: activityLogReducer
Michael Landoefa037d2017-02-19 12:57:33 +020087});