blob: d4358909d5d17eee3d142d4166414bf3d37bdbac [file] [log] [blame]
svishnev1eb66b72018-01-11 14:39:45 +02001/*
2 * Copyright © 2016-2017 European Support Limited
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
svishnev71782cf2018-07-17 10:37:38 +03007 *
svishnev1eb66b72018-01-11 14:39:45 +02008 * http://www.apache.org/licenses/LICENSE-2.0
svishnev71782cf2018-07-17 10:37:38 +03009 *
svishnev1eb66b72018-01-11 14:39:45 +020010 * 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 or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import Onboard from './onboard/Onboard.js';
18import VersionsPage from './versionsPage/VersionsPage.js';
19import LicenseModel from './licenseModel/LicenseModel.js';
20import LicenseModelOverview from './licenseModel/overview/LicenseModelOverview.js';
21import ActivityLog from 'sdc-app/common/activity-log/ActivityLog.js';
22
23import LicenseAgreementListEditor from './licenseModel/licenseAgreement/LicenseAgreementListEditor.js';
24import FeatureGroupListEditor from './licenseModel/featureGroups/FeatureGroupListEditor.js';
25import LicenseKeyGroupsListEditor from './licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js';
26import EntitlementPoolsListEditor from './licenseModel/entitlementPools/EntitlementPoolsListEditor.js';
27import SoftwareProduct from './softwareProduct/SoftwareProduct.js';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020028import SoftwareProductLandingPage from './softwareProduct/landingPage/SoftwareProductLandingPage.js';
29import SoftwareProductDetails from './softwareProduct/details/SoftwareProductDetails.js';
svishnev1eb66b72018-01-11 14:39:45 +020030import SoftwareProductAttachments from './softwareProduct/attachments/SoftwareProductAttachments.js';
31import SoftwareProductProcesses from './softwareProduct/processes/SoftwareProductProcesses.js';
32import SoftwareProductDeployment from './softwareProduct/deployment/SoftwareProductDeployment.js';
33import SoftwareProductNetworks from './softwareProduct/networks/SoftwareProductNetworks.js';
Vodafone804ec682019-03-18 15:46:53 +053034import SoftwareProductValidation from './softwareProduct/validation/SoftwareProductValidation.js';
35import SoftwareProductValidationResults from './softwareProduct/validationResults/SoftwareProductValidationResults.js';
svishnev1eb66b72018-01-11 14:39:45 +020036import SoftwareProductDependencies from './softwareProduct/dependencies/SoftwareProductDependencies.js';
37
38import SoftwareProductComponentsList from './softwareProduct/components/SoftwareProductComponents.js';
39import SoftwareProductComponentProcessesList from './softwareProduct/components/processes/SoftwareProductComponentProcessesList.js';
40import SoftwareProductComponentStorage from './softwareProduct/components/storage/SoftwareProductComponentStorage.js';
41import SoftwareProductComponentsNetworkList from './softwareProduct/components/network/SoftwareProductComponentsNetworkList.js';
42import SoftwareProductComponentsGeneral from './softwareProduct/components/general/SoftwareProductComponentsGeneral.js';
43import SoftwareProductComponentsCompute from './softwareProduct/components/compute/SoftwareProductComponentCompute.js';
44import SoftwareProductComponentLoadBalancing from './softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancing.js';
45import SoftwareProductComponentsImageList from './softwareProduct/components/images/SoftwareProductComponentsImageList.js';
46import SoftwareProductComponentsMonitoring from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoring.js';
47import objectValues from 'lodash/values.js';
48import PropTypes from 'prop-types';
49
50import React from 'react';
51
52import ReactDOM from 'react-dom';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020053import { enums } from './OnboardingConstants.js';
svishnev1eb66b72018-01-11 14:39:45 +020054
55export default class OnboardingView extends React.Component {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020056 static propTypes = {
57 currentScreen: PropTypes.shape({
58 screen: PropTypes.oneOf(objectValues(enums.SCREEN)).isRequired,
59 props: PropTypes.object.isRequired,
60 itemPermission: PropTypes.object
61 }).isRequired
62 };
svishnev1eb66b72018-01-11 14:39:45 +020063
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020064 componentDidMount() {
65 let element = ReactDOM.findDOMNode(this);
66 element.addEventListener('click', event => {
67 if (event.target.tagName === 'A') {
68 event.preventDefault();
69 }
70 });
71 ['wheel', 'mousewheel', 'DOMMouseScroll'].forEach(eventType =>
72 element.addEventListener(eventType, event =>
73 event.stopPropagation()
74 )
75 );
76 }
svishnev1eb66b72018-01-11 14:39:45 +020077
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020078 render() {
svishnev71782cf2018-07-17 10:37:38 +030079 let { currentScreen, isLoading } = this.props;
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020080 let { screen, props } = currentScreen;
svishnev71782cf2018-07-17 10:37:38 +030081 const preventClicks = isLoading ? 'no-pointer-events' : '';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020082 return (
svishnev71782cf2018-07-17 10:37:38 +030083 <div
84 className={`dox-ui dox-ui-punch-out dox-ui-punch-out-full-page ${preventClicks}`}>
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020085 {(() => {
86 switch (screen) {
87 case enums.SCREEN.ONBOARDING_CATALOG:
88 return <Onboard {...props} />;
89 case enums.SCREEN.VERSIONS_PAGE:
90 return <VersionsPage {...props} />;
svishnev1eb66b72018-01-11 14:39:45 +020091
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020092 case enums.SCREEN.LICENSE_AGREEMENTS:
93 case enums.SCREEN.FEATURE_GROUPS:
94 case enums.SCREEN.ENTITLEMENT_POOLS:
95 case enums.SCREEN.LICENSE_KEY_GROUPS:
96 case enums.SCREEN.LICENSE_MODEL_OVERVIEW:
97 case enums.SCREEN.ACTIVITY_LOG:
98 return (
99 <LicenseModel currentScreen={currentScreen}>
100 {(() => {
101 switch (screen) {
102 case enums.SCREEN
103 .LICENSE_MODEL_OVERVIEW:
104 return (
105 <LicenseModelOverview
106 {...props}
107 />
108 );
109 case enums.SCREEN
110 .LICENSE_AGREEMENTS:
111 return (
112 <LicenseAgreementListEditor
113 {...props}
114 />
115 );
116 case enums.SCREEN.FEATURE_GROUPS:
117 return (
118 <FeatureGroupListEditor
119 {...props}
120 />
121 );
122 case enums.SCREEN.ENTITLEMENT_POOLS:
123 return (
124 <EntitlementPoolsListEditor
125 {...props}
126 />
127 );
128 case enums.SCREEN
129 .LICENSE_KEY_GROUPS:
130 return (
131 <LicenseKeyGroupsListEditor
132 {...props}
133 />
134 );
135 case enums.SCREEN.ACTIVITY_LOG:
136 return (
137 <ActivityLog {...props} />
138 );
139 }
140 })()}
141 </LicenseModel>
142 );
svishnev1eb66b72018-01-11 14:39:45 +0200143
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200144 case enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE:
145 case enums.SCREEN.SOFTWARE_PRODUCT_DETAILS:
146 case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS:
147 case enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES:
148 case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT:
149 case enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS:
Vodafone804ec682019-03-18 15:46:53 +0530150 case enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION:
151 case enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION_RESULTS:
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200152 case enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES:
153 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS:
154 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES:
155 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE:
156 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK:
157 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL:
158 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE:
159 case enums.SCREEN
160 .SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING:
161 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES:
162 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING:
163 case enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG:
164 return (
165 <SoftwareProduct currentScreen={currentScreen}>
166 {(() => {
167 switch (screen) {
168 case enums.SCREEN
169 .SOFTWARE_PRODUCT_LANDING_PAGE:
170 return (
171 <SoftwareProductLandingPage
172 {...props}
173 />
174 );
175 case enums.SCREEN
176 .SOFTWARE_PRODUCT_DETAILS:
177 return (
178 <SoftwareProductDetails
179 {...props}
180 />
181 );
182 case enums.SCREEN
183 .SOFTWARE_PRODUCT_ATTACHMENTS:
184 return (
185 <SoftwareProductAttachments
186 className="no-padding-content-area"
187 {...props}
188 />
189 );
190 case enums.SCREEN
191 .SOFTWARE_PRODUCT_PROCESSES:
192 return (
193 <SoftwareProductProcesses
194 {...props}
195 />
196 );
197 case enums.SCREEN
198 .SOFTWARE_PRODUCT_DEPLOYMENT:
199 return (
200 <SoftwareProductDeployment
201 {...props}
202 />
203 );
204 case enums.SCREEN
205 .SOFTWARE_PRODUCT_NETWORKS:
206 return (
207 <SoftwareProductNetworks
208 {...props}
209 />
210 );
211 case enums.SCREEN
Vodafone804ec682019-03-18 15:46:53 +0530212 .SOFTWARE_PRODUCT_VALIDATION:
213 return (
214 <SoftwareProductValidation
215 className="no-padding-content-area"
216 {...props}
217 />
218 );
219 case enums.SCREEN
220 .SOFTWARE_PRODUCT_VALIDATION_RESULTS:
221 return (
222 <SoftwareProductValidationResults
223 {...props}
224 />
225 );
226 case enums.SCREEN
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200227 .SOFTWARE_PRODUCT_DEPENDENCIES:
228 return (
229 <SoftwareProductDependencies
230 {...props}
231 />
232 );
233 case enums.SCREEN
234 .SOFTWARE_PRODUCT_COMPONENTS:
235 return (
236 <SoftwareProductComponentsList
237 {...props}
238 />
239 );
240 case enums.SCREEN
241 .SOFTWARE_PRODUCT_COMPONENT_PROCESSES:
242 return (
243 <SoftwareProductComponentProcessesList
244 {...props}
245 />
246 );
247 case enums.SCREEN
248 .SOFTWARE_PRODUCT_COMPONENT_STORAGE:
249 return (
250 <SoftwareProductComponentStorage
251 {...props}
252 />
253 );
254 case enums.SCREEN
255 .SOFTWARE_PRODUCT_COMPONENT_NETWORK:
256 return (
257 <SoftwareProductComponentsNetworkList
258 {...props}
259 />
260 );
261 case enums.SCREEN
262 .SOFTWARE_PRODUCT_COMPONENT_GENERAL:
263 return (
264 <SoftwareProductComponentsGeneral
265 {...props}
266 />
267 );
268 case enums.SCREEN
269 .SOFTWARE_PRODUCT_COMPONENT_COMPUTE:
270 return (
271 <SoftwareProductComponentsCompute
272 {...props}
273 />
274 );
275 case enums.SCREEN
276 .SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING:
277 return (
278 <SoftwareProductComponentLoadBalancing
279 {...props}
280 />
281 );
282 case enums.SCREEN
283 .SOFTWARE_PRODUCT_COMPONENT_IMAGES:
284 return (
285 <SoftwareProductComponentsImageList
286 {...props}
287 />
288 );
289 case enums.SCREEN
290 .SOFTWARE_PRODUCT_COMPONENT_MONITORING:
291 return (
292 <SoftwareProductComponentsMonitoring
293 {...props}
294 />
295 );
296 case enums.SCREEN
297 .SOFTWARE_PRODUCT_ACTIVITY_LOG:
298 return (
299 <ActivityLog {...props} />
300 );
301 }
302 })()}
303 </SoftwareProduct>
304 );
305 }
306 })()}
307 </div>
308 );
309 }
svishnev1eb66b72018-01-11 14:39:45 +0200310}