blob: bd060a4c287ddf0df0941907c7d8f6ca8c73bb21 [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
37import {actionTypes as licenseModelOverviewConstants, selectedButton, VLM_DESCRIPTION_FORM} from './overview/LicenseModelOverviewConstants.js';
Michael Landoefa037d2017-02-19 12:57:33 +020038
39export default combineReducers({
AviZi280f8012017-06-09 02:39:56 +030040 licenseModelCreation: createPlainDataReducer(licenseModelCreationReducer),
Michael Landoefa037d2017-02-19 12:57:33 +020041 licenseModelEditor: licenseModelEditorReducer,
42
43 licenseAgreement: combineReducers({
AviZi280f8012017-06-09 02:39:56 +030044 licenseAgreementEditor: createPlainDataReducer(licenseAgreementEditorReducer),
45 licenseAgreementList: licenseAgreementListReducer
Michael Landoefa037d2017-02-19 12:57:33 +020046 }),
47 featureGroup: combineReducers({
AviZi280f8012017-06-09 02:39:56 +030048 featureGroupEditor: createPlainDataReducer(featureGroupsEditorReducer),
49 featureGroupsList: featureGroupsListReducer
Michael Landoefa037d2017-02-19 12:57:33 +020050 }),
51 entitlementPool: combineReducers({
AviZi280f8012017-06-09 02:39:56 +030052 entitlementPoolEditor: createPlainDataReducer(entitlementPoolsEditorReducer),
53 entitlementPoolsList: entitlementPoolsListReducer
Michael Landoefa037d2017-02-19 12:57:33 +020054 }),
55 licenseKeyGroup: combineReducers({
AviZi280f8012017-06-09 02:39:56 +030056 licenseKeyGroupsEditor: createPlainDataReducer(licenseKeyGroupsEditorReducer),
57 licenseKeyGroupsList: licenseKeyGroupsListReducer
Michael Landoefa037d2017-02-19 12:57:33 +020058 }),
AviZi280f8012017-06-09 02:39:56 +030059 licenseModelOverview: combineReducers({
60 selectedTab: (state = selectedButton.VLM_LIST_VIEW, action) => action.type === licenseModelOverviewConstants.LICENSE_MODEL_OVERVIEW_TAB_SELECTED ? action.buttonTab : state,
61 descriptionEditor: createPlainDataReducer(function(state = false, action) {
62 if (action.type === licenseModelOverviewConstants.LM_DATA_CHANGED) {
63 return {
64 ...state,
65 data : {
66 description : action.description
67 },
68 formReady: null,
69 formName: VLM_DESCRIPTION_FORM,
70 genericFieldInfo: {
71 'description': {
72 isValid: true,
73 errorText: '',
74 validations: [{type: 'required', data: true}, {type: 'maxLength', data: 1000}]
75 }
76 }
77 };
78 //return action.description;
79 } else {
80 return state;
81 }
82 }
83 )}),
84 activityLog: activityLogReducer
Michael Landoefa037d2017-02-19 12:57:33 +020085});