blob: f102d286f090a5f5ef1142500c9b726dd3ace54a [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 */
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020016import { combineReducers } from 'redux';
Michael Landoefa037d2017-02-19 12:57:33 +020017
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
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020035import { createPlainDataReducer } from 'sdc-app/common/reducers/PlainDataReducer.js';
AviZi280f8012017-06-09 02:39:56 +030036
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020037import {
38 actionTypes as licenseModelOverviewConstants,
39 VLM_DESCRIPTION_FORM
40} from './overview/LicenseModelOverviewConstants.js';
41import limitEditorReducer from './limits/LimitEditorReducer.js';
Michael Landoefa037d2017-02-19 12:57:33 +020042
43export default combineReducers({
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020044 licenseModelCreation: createPlainDataReducer(licenseModelCreationReducer),
45 licenseModelEditor: licenseModelEditorReducer,
Michael Landoefa037d2017-02-19 12:57:33 +020046
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020047 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 Landoefa037d2017-02-19 12:57:33 +0200106});