blob: 7156e2e2530703eb1bea59edcb15e5e6f96bf795 [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';
34import SoftwareProductDependencies from './softwareProduct/dependencies/SoftwareProductDependencies.js';
35
36import SoftwareProductComponentsList from './softwareProduct/components/SoftwareProductComponents.js';
37import SoftwareProductComponentProcessesList from './softwareProduct/components/processes/SoftwareProductComponentProcessesList.js';
38import SoftwareProductComponentStorage from './softwareProduct/components/storage/SoftwareProductComponentStorage.js';
39import SoftwareProductComponentsNetworkList from './softwareProduct/components/network/SoftwareProductComponentsNetworkList.js';
40import SoftwareProductComponentsGeneral from './softwareProduct/components/general/SoftwareProductComponentsGeneral.js';
41import SoftwareProductComponentsCompute from './softwareProduct/components/compute/SoftwareProductComponentCompute.js';
42import SoftwareProductComponentLoadBalancing from './softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancing.js';
43import SoftwareProductComponentsImageList from './softwareProduct/components/images/SoftwareProductComponentsImageList.js';
44import SoftwareProductComponentsMonitoring from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoring.js';
45import objectValues from 'lodash/values.js';
46import PropTypes from 'prop-types';
47
48import React from 'react';
49
50import ReactDOM from 'react-dom';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020051import { enums } from './OnboardingConstants.js';
svishnev1eb66b72018-01-11 14:39:45 +020052
53export default class OnboardingView extends React.Component {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020054 static propTypes = {
55 currentScreen: PropTypes.shape({
56 screen: PropTypes.oneOf(objectValues(enums.SCREEN)).isRequired,
57 props: PropTypes.object.isRequired,
58 itemPermission: PropTypes.object
59 }).isRequired
60 };
svishnev1eb66b72018-01-11 14:39:45 +020061
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020062 componentDidMount() {
63 let element = ReactDOM.findDOMNode(this);
64 element.addEventListener('click', event => {
65 if (event.target.tagName === 'A') {
66 event.preventDefault();
67 }
68 });
69 ['wheel', 'mousewheel', 'DOMMouseScroll'].forEach(eventType =>
70 element.addEventListener(eventType, event =>
71 event.stopPropagation()
72 )
73 );
74 }
svishnev1eb66b72018-01-11 14:39:45 +020075
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020076 render() {
svishnev71782cf2018-07-17 10:37:38 +030077 let { currentScreen, isLoading } = this.props;
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020078 let { screen, props } = currentScreen;
svishnev71782cf2018-07-17 10:37:38 +030079 const preventClicks = isLoading ? 'no-pointer-events' : '';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020080 return (
svishnev71782cf2018-07-17 10:37:38 +030081 <div
82 className={`dox-ui dox-ui-punch-out dox-ui-punch-out-full-page ${preventClicks}`}>
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020083 {(() => {
84 switch (screen) {
85 case enums.SCREEN.ONBOARDING_CATALOG:
86 return <Onboard {...props} />;
87 case enums.SCREEN.VERSIONS_PAGE:
88 return <VersionsPage {...props} />;
svishnev1eb66b72018-01-11 14:39:45 +020089
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020090 case enums.SCREEN.LICENSE_AGREEMENTS:
91 case enums.SCREEN.FEATURE_GROUPS:
92 case enums.SCREEN.ENTITLEMENT_POOLS:
93 case enums.SCREEN.LICENSE_KEY_GROUPS:
94 case enums.SCREEN.LICENSE_MODEL_OVERVIEW:
95 case enums.SCREEN.ACTIVITY_LOG:
96 return (
97 <LicenseModel currentScreen={currentScreen}>
98 {(() => {
99 switch (screen) {
100 case enums.SCREEN
101 .LICENSE_MODEL_OVERVIEW:
102 return (
103 <LicenseModelOverview
104 {...props}
105 />
106 );
107 case enums.SCREEN
108 .LICENSE_AGREEMENTS:
109 return (
110 <LicenseAgreementListEditor
111 {...props}
112 />
113 );
114 case enums.SCREEN.FEATURE_GROUPS:
115 return (
116 <FeatureGroupListEditor
117 {...props}
118 />
119 );
120 case enums.SCREEN.ENTITLEMENT_POOLS:
121 return (
122 <EntitlementPoolsListEditor
123 {...props}
124 />
125 );
126 case enums.SCREEN
127 .LICENSE_KEY_GROUPS:
128 return (
129 <LicenseKeyGroupsListEditor
130 {...props}
131 />
132 );
133 case enums.SCREEN.ACTIVITY_LOG:
134 return (
135 <ActivityLog {...props} />
136 );
137 }
138 })()}
139 </LicenseModel>
140 );
svishnev1eb66b72018-01-11 14:39:45 +0200141
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200142 case enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE:
143 case enums.SCREEN.SOFTWARE_PRODUCT_DETAILS:
144 case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS:
145 case enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES:
146 case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT:
147 case enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS:
148 case enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES:
149 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS:
150 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES:
151 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE:
152 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK:
153 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL:
154 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE:
155 case enums.SCREEN
156 .SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING:
157 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES:
158 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING:
159 case enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG:
160 return (
161 <SoftwareProduct currentScreen={currentScreen}>
162 {(() => {
163 switch (screen) {
164 case enums.SCREEN
165 .SOFTWARE_PRODUCT_LANDING_PAGE:
166 return (
167 <SoftwareProductLandingPage
168 {...props}
169 />
170 );
171 case enums.SCREEN
172 .SOFTWARE_PRODUCT_DETAILS:
173 return (
174 <SoftwareProductDetails
175 {...props}
176 />
177 );
178 case enums.SCREEN
179 .SOFTWARE_PRODUCT_ATTACHMENTS:
180 return (
181 <SoftwareProductAttachments
182 className="no-padding-content-area"
183 {...props}
184 />
185 );
186 case enums.SCREEN
187 .SOFTWARE_PRODUCT_PROCESSES:
188 return (
189 <SoftwareProductProcesses
190 {...props}
191 />
192 );
193 case enums.SCREEN
194 .SOFTWARE_PRODUCT_DEPLOYMENT:
195 return (
196 <SoftwareProductDeployment
197 {...props}
198 />
199 );
200 case enums.SCREEN
201 .SOFTWARE_PRODUCT_NETWORKS:
202 return (
203 <SoftwareProductNetworks
204 {...props}
205 />
206 );
207 case enums.SCREEN
208 .SOFTWARE_PRODUCT_DEPENDENCIES:
209 return (
210 <SoftwareProductDependencies
211 {...props}
212 />
213 );
214 case enums.SCREEN
215 .SOFTWARE_PRODUCT_COMPONENTS:
216 return (
217 <SoftwareProductComponentsList
218 {...props}
219 />
220 );
221 case enums.SCREEN
222 .SOFTWARE_PRODUCT_COMPONENT_PROCESSES:
223 return (
224 <SoftwareProductComponentProcessesList
225 {...props}
226 />
227 );
228 case enums.SCREEN
229 .SOFTWARE_PRODUCT_COMPONENT_STORAGE:
230 return (
231 <SoftwareProductComponentStorage
232 {...props}
233 />
234 );
235 case enums.SCREEN
236 .SOFTWARE_PRODUCT_COMPONENT_NETWORK:
237 return (
238 <SoftwareProductComponentsNetworkList
239 {...props}
240 />
241 );
242 case enums.SCREEN
243 .SOFTWARE_PRODUCT_COMPONENT_GENERAL:
244 return (
245 <SoftwareProductComponentsGeneral
246 {...props}
247 />
248 );
249 case enums.SCREEN
250 .SOFTWARE_PRODUCT_COMPONENT_COMPUTE:
251 return (
252 <SoftwareProductComponentsCompute
253 {...props}
254 />
255 );
256 case enums.SCREEN
257 .SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING:
258 return (
259 <SoftwareProductComponentLoadBalancing
260 {...props}
261 />
262 );
263 case enums.SCREEN
264 .SOFTWARE_PRODUCT_COMPONENT_IMAGES:
265 return (
266 <SoftwareProductComponentsImageList
267 {...props}
268 />
269 );
270 case enums.SCREEN
271 .SOFTWARE_PRODUCT_COMPONENT_MONITORING:
272 return (
273 <SoftwareProductComponentsMonitoring
274 {...props}
275 />
276 );
277 case enums.SCREEN
278 .SOFTWARE_PRODUCT_ACTIVITY_LOG:
279 return (
280 <ActivityLog {...props} />
281 );
282 }
283 })()}
284 </SoftwareProduct>
285 );
286 }
287 })()}
288 </div>
289 );
290 }
svishnev1eb66b72018-01-11 14:39:45 +0200291}