Refresh option in validation result page
[sdc.git] / openecomp-ui / src / sdc-app / onboarding / softwareProduct / SoftwareProductReducer.js
1 /*!
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  */
16 import { combineReducers } from 'redux';
17 import {
18     actionTypes,
19     PRODUCT_QUESTIONNAIRE
20 } from './SoftwareProductConstants.js';
21 import SoftwareProductAttachmentsReducer from './attachments/SoftwareProductAttachmentsReducer.js';
22 import HeatValidationReducer from './attachments/validation/HeatValidationReducer.js';
23 import HeatSetupReducer from './attachments/setup/HeatSetupReducer.js';
24 import { actionTypes as heatSetupActionTypes } from './attachments/setup/HeatSetupConstants.js';
25 import SoftwareProductCreationReducer from './creation/SoftwareProductCreationReducer.js';
26 import SoftwareProductDetailsReducer from './details/SoftwareProductDetailsReducer.js';
27 import SoftwareProductProcessesListReducer from './processes/SoftwareProductProcessesListReducer.js';
28 import SoftwareProductValidationReducer from './validation/SoftwareProductValidationReducer.js';
29 import SoftwareProductProcessesEditorReducer from './processes/SoftwareProductProcessesEditorReducer.js';
30 import SoftwareProductDeploymentListReducer from './deployment/SoftwareProductDeploymentListReducer.js';
31 import SoftwareProductDeploymentEditorReducer from './deployment/editor/SoftwareProductDeploymentEditorReducer.js';
32 import SoftwareProductNetworksListReducer from './networks/SoftwareProductNetworksListReducer.js';
33 import SoftwareProductComponentsListReducer from './components/SoftwareProductComponentsListReducer.js';
34 import SoftwareProductComponentEditorReducer from './components/SoftwareProductComponentEditorReducer.js';
35 import { actionTypes as processesActionTypes } from './processes/SoftwareProductProcessesConstants.js';
36 import SoftwareProductComponentProcessesListReducer from './components/processes/SoftwareProductComponentProcessesListReducer.js';
37 import SoftwareProductComponentProcessesEditorReducer from './components/processes/SoftwareProductComponentProcessesEditorReducer.js';
38 import { actionTypes as componentProcessesActionTypes } from './components/processes/SoftwareProductComponentProcessesConstants.js';
39 import SoftwareProductComponentsNICListReducer from './components/network/SoftwareProductComponentsNICListReducer.js';
40 import SoftwareProductComponentsNICEditorReducer from './components/network/SoftwareProductComponentsNICEditorReducer.js';
41 import SoftwareProductComponentsImageListReducer from './components/images/SoftwareProductComponentsImageListReducer.js';
42 import SoftwareProductComponentsImageEditorReducer from './components/images/SoftwareProductComponentsImageEditorReducer.js';
43 import SoftwareProductComponentsNICCreationReducer from './components/network/NICCreation/NICCreationReducer.js';
44 import SoftwareProductComponentsMonitoringReducer from './components/monitoring/SoftwareProductComponentsMonitoringReducer.js';
45 import SoftwareProductComponentsComputeFlavorListReducer from './components/compute/computeComponents/computeFlavor/ComputeFlavorListReducer.js';
46 import SoftwareProductComponentsComputeFlavorReducer from './components/compute/computeComponents/computeFlavor/ComputeFlavorReducer.js';
47 import { createPlainDataReducer } from 'sdc-app/common/reducers/PlainDataReducer.js';
48 import SoftwareProductDependenciesReducer from './dependencies/SoftwareProductDependenciesReducer.js';
49 import SoftwareProductValidationResultsViewReducer from './validationResults/SoftwareProductValidationResultsViewReducer.js';
50 import {
51     createJSONSchemaReducer,
52     createComposedJSONSchemaReducer
53 } from 'sdc-app/common/reducers/JSONSchemaReducer.js';
54 import {
55     COMPONENTS_QUESTIONNAIRE,
56     COMPONENTS_COMPUTE_QUESTIONNAIRE
57 } from 'sdc-app/onboarding/softwareProduct/components/SoftwareProductComponentsConstants.js';
58 import { NIC_QUESTIONNAIRE } from 'sdc-app/onboarding/softwareProduct/components/network/SoftwareProductComponentsNetworkConstants.js';
59 import { IMAGE_QUESTIONNAIRE } from 'sdc-app/onboarding/softwareProduct/components/images/SoftwareProductComponentsImageConstants.js';
60
61 import VNFImportReducer from './vnfMarketPlace/VNFImportReducer.js';
62
63 export default combineReducers({
64     softwareProductAttachments: combineReducers({
65         attachmentsDetails: SoftwareProductAttachmentsReducer,
66         heatValidation: HeatValidationReducer,
67         heatSetup: HeatSetupReducer,
68         heatSetupCache: (state = {}, action) =>
69             action.type === heatSetupActionTypes.FILL_HEAT_SETUP_CACHE
70                 ? action.payload
71                 : state
72     }),
73     softwareProductCreation: createPlainDataReducer(
74         SoftwareProductCreationReducer
75     ),
76     softwareProductEditor: createPlainDataReducer(
77         SoftwareProductDetailsReducer
78     ),
79     softwareProductValidation: createPlainDataReducer(
80         SoftwareProductValidationReducer
81     ),
82     softwareProductValidationResult: createPlainDataReducer(
83         SoftwareProductValidationResultsViewReducer
84     ),
85     softwareProductProcesses: combineReducers({
86         processesList: SoftwareProductProcessesListReducer,
87         processesEditor: createPlainDataReducer(
88             SoftwareProductProcessesEditorReducer
89         ),
90         processToDelete: (state = false, action) =>
91             action.type ===
92             processesActionTypes.SOFTWARE_PRODUCT_PROCESS_DELETE_CONFIRM
93                 ? action.processToDelete
94                 : state
95     }),
96     softwareProductDeployment: combineReducers({
97         deploymentFlavors: SoftwareProductDeploymentListReducer,
98         deploymentFlavorEditor: createPlainDataReducer(
99             SoftwareProductDeploymentEditorReducer
100         )
101     }),
102     softwareProductNetworks: combineReducers({
103         networksList: SoftwareProductNetworksListReducer
104     }),
105     softwareProductDependencies: SoftwareProductDependenciesReducer,
106     softwareProductComponents: combineReducers({
107         componentsList: SoftwareProductComponentsListReducer,
108         componentEditor: createPlainDataReducer(
109             createComposedJSONSchemaReducer(
110                 COMPONENTS_QUESTIONNAIRE,
111                 SoftwareProductComponentEditorReducer
112             )
113         ),
114         componentProcesses: combineReducers({
115             processesList: SoftwareProductComponentProcessesListReducer,
116             processesEditor: createPlainDataReducer(
117                 SoftwareProductComponentProcessesEditorReducer
118             ),
119             processToDelete: (state = false, action) =>
120                 action.type ===
121                 componentProcessesActionTypes.SOFTWARE_PRODUCT_PROCESS_DELETE_COMPONENTS_CONFIRM
122                     ? action.processToDelete
123                     : state
124         }),
125         network: combineReducers({
126             nicList: SoftwareProductComponentsNICListReducer,
127             nicEditor: createPlainDataReducer(
128                 createComposedJSONSchemaReducer(
129                     NIC_QUESTIONNAIRE,
130                     SoftwareProductComponentsNICEditorReducer
131                 )
132             ),
133             nicCreation: createPlainDataReducer(
134                 SoftwareProductComponentsNICCreationReducer
135             )
136         }),
137         images: combineReducers({
138             imagesList: SoftwareProductComponentsImageListReducer,
139             imageEditor: createPlainDataReducer(
140                 createComposedJSONSchemaReducer(
141                     IMAGE_QUESTIONNAIRE,
142                     SoftwareProductComponentsImageEditorReducer
143                 )
144             )
145         }),
146         computeFlavor: combineReducers({
147             computesList: SoftwareProductComponentsComputeFlavorListReducer,
148             computeEditor: createPlainDataReducer(
149                 createComposedJSONSchemaReducer(
150                     COMPONENTS_COMPUTE_QUESTIONNAIRE,
151                     SoftwareProductComponentsComputeFlavorReducer
152                 )
153             )
154         }),
155         monitoring: SoftwareProductComponentsMonitoringReducer
156     }),
157     softwareProductCategories: (state = [], action) => {
158         if (action.type === actionTypes.SOFTWARE_PRODUCT_CATEGORIES_LOADED) {
159             return action.softwareProductCategories;
160         }
161         return state;
162     },
163     softwareProductQuestionnaire: createJSONSchemaReducer(
164         PRODUCT_QUESTIONNAIRE
165     ),
166     VNFMarketPlaceImport: VNFImportReducer
167 });