blob: 7877085316841617cdf70a3aa648db17a36ac891 [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
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 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';
28import SoftwareProductLandingPage from './softwareProduct/landingPage/SoftwareProductLandingPage.js';
29import SoftwareProductDetails from './softwareProduct/details/SoftwareProductDetails.js';
30import 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';
51import {enums} from './OnboardingConstants.js';
52
53export default class OnboardingView extends React.Component {
54 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 };
61
62 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 => event.stopPropagation())
71 );
72 }
73
74 render() {
75 let {currentScreen} = this.props;
76 let {screen, props} = currentScreen;
77
78 return (
79 <div className='dox-ui dox-ui-punch-out dox-ui-punch-out-full-page'>
80 {(() => {
81 switch (screen) {
82 case enums.SCREEN.ONBOARDING_CATALOG:
83 return <Onboard {...props}/>;
84 case enums.SCREEN.VERSIONS_PAGE:
85 return <VersionsPage {...props} />;
86
87 case enums.SCREEN.LICENSE_AGREEMENTS:
88 case enums.SCREEN.FEATURE_GROUPS:
89 case enums.SCREEN.ENTITLEMENT_POOLS:
90 case enums.SCREEN.LICENSE_KEY_GROUPS:
91 case enums.SCREEN.LICENSE_MODEL_OVERVIEW:
92 case enums.SCREEN.ACTIVITY_LOG:
93 return (
94 <LicenseModel currentScreen={currentScreen}>
95 {
96 (()=>{
97 switch(screen) {
98 case enums.SCREEN.LICENSE_MODEL_OVERVIEW:
99 return <LicenseModelOverview {...props}/>;
100 case enums.SCREEN.LICENSE_AGREEMENTS:
101 return <LicenseAgreementListEditor {...props}/>;
102 case enums.SCREEN.FEATURE_GROUPS:
103 return <FeatureGroupListEditor {...props}/>;
104 case enums.SCREEN.ENTITLEMENT_POOLS:
105 return <EntitlementPoolsListEditor {...props}/>;
106 case enums.SCREEN.LICENSE_KEY_GROUPS:
107 return <LicenseKeyGroupsListEditor {...props}/>;
108 case enums.SCREEN.ACTIVITY_LOG:
109 return <ActivityLog {...props}/>;
110 }
111 })()
112 }
113 </LicenseModel>
114 );
115
116 case enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE:
117 case enums.SCREEN.SOFTWARE_PRODUCT_DETAILS:
118 case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS:
119 case enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES:
120 case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT:
121 case enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS:
122 case enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES:
123 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS:
124 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES:
125 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE:
126 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK:
127 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL:
128 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE:
129 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING:
130 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES:
131 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING:
132 case enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG:
133 return (
134 <SoftwareProduct currentScreen={currentScreen}>
135 {
136 (()=>{
137 switch(screen) {
138 case enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE:
139 return <SoftwareProductLandingPage {...props}/>;
140 case enums.SCREEN.SOFTWARE_PRODUCT_DETAILS:
141 return <SoftwareProductDetails {...props}/>;
142 case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS:
143 return <SoftwareProductAttachments className='no-padding-content-area' {...props} />;
144 case enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES:
145 return <SoftwareProductProcesses {...props}/>;
146 case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT:
147 return <SoftwareProductDeployment {...props}/>;
148 case enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS:
149 return <SoftwareProductNetworks {...props}/>;
150 case enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES:
151 return <SoftwareProductDependencies {...props} />;
152 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS:
153 return <SoftwareProductComponentsList {...props}/>;
154 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES:
155 return <SoftwareProductComponentProcessesList {...props}/>;
156 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE:
157 return <SoftwareProductComponentStorage {...props}/>;
158 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK:
159 return <SoftwareProductComponentsNetworkList {...props}/>;
160 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL:
161 return <SoftwareProductComponentsGeneral{...props}/>;
162 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE:
163 return <SoftwareProductComponentsCompute {...props}/>;
164 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING:
165 return <SoftwareProductComponentLoadBalancing{...props}/>;
166 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES:
167 return <SoftwareProductComponentsImageList{...props}/>;
168 case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING:
169 return <SoftwareProductComponentsMonitoring {...props}/>;
170 case enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG:
171 return <ActivityLog {...props}/>;
172 }
173 })()
174 }
175 </SoftwareProduct>
176 );
177 }
178 })()}
179 </div>
180 );
181 }
182}
183