svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 1 | /* |
| 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 |
svishnev | 71782cf | 2018-07-17 10:37:38 +0300 | [diff] [blame] | 7 | * |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
svishnev | 71782cf | 2018-07-17 10:37:38 +0300 | [diff] [blame] | 9 | * |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 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 | |
| 17 | import Onboard from './onboard/Onboard.js'; |
| 18 | import VersionsPage from './versionsPage/VersionsPage.js'; |
| 19 | import LicenseModel from './licenseModel/LicenseModel.js'; |
| 20 | import LicenseModelOverview from './licenseModel/overview/LicenseModelOverview.js'; |
| 21 | import ActivityLog from 'sdc-app/common/activity-log/ActivityLog.js'; |
| 22 | |
| 23 | import LicenseAgreementListEditor from './licenseModel/licenseAgreement/LicenseAgreementListEditor.js'; |
| 24 | import FeatureGroupListEditor from './licenseModel/featureGroups/FeatureGroupListEditor.js'; |
| 25 | import LicenseKeyGroupsListEditor from './licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js'; |
| 26 | import EntitlementPoolsListEditor from './licenseModel/entitlementPools/EntitlementPoolsListEditor.js'; |
| 27 | import SoftwareProduct from './softwareProduct/SoftwareProduct.js'; |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 28 | import SoftwareProductLandingPage from './softwareProduct/landingPage/SoftwareProductLandingPage.js'; |
| 29 | import SoftwareProductDetails from './softwareProduct/details/SoftwareProductDetails.js'; |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 30 | import SoftwareProductAttachments from './softwareProduct/attachments/SoftwareProductAttachments.js'; |
| 31 | import SoftwareProductProcesses from './softwareProduct/processes/SoftwareProductProcesses.js'; |
| 32 | import SoftwareProductDeployment from './softwareProduct/deployment/SoftwareProductDeployment.js'; |
| 33 | import SoftwareProductNetworks from './softwareProduct/networks/SoftwareProductNetworks.js'; |
Vodafone | 804ec68 | 2019-03-18 15:46:53 +0530 | [diff] [blame] | 34 | import SoftwareProductValidation from './softwareProduct/validation/SoftwareProductValidation.js'; |
| 35 | import SoftwareProductValidationResults from './softwareProduct/validationResults/SoftwareProductValidationResults.js'; |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 36 | import SoftwareProductDependencies from './softwareProduct/dependencies/SoftwareProductDependencies.js'; |
| 37 | |
| 38 | import SoftwareProductComponentsList from './softwareProduct/components/SoftwareProductComponents.js'; |
| 39 | import SoftwareProductComponentProcessesList from './softwareProduct/components/processes/SoftwareProductComponentProcessesList.js'; |
| 40 | import SoftwareProductComponentStorage from './softwareProduct/components/storage/SoftwareProductComponentStorage.js'; |
| 41 | import SoftwareProductComponentsNetworkList from './softwareProduct/components/network/SoftwareProductComponentsNetworkList.js'; |
| 42 | import SoftwareProductComponentsGeneral from './softwareProduct/components/general/SoftwareProductComponentsGeneral.js'; |
| 43 | import SoftwareProductComponentsCompute from './softwareProduct/components/compute/SoftwareProductComponentCompute.js'; |
| 44 | import SoftwareProductComponentLoadBalancing from './softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancing.js'; |
| 45 | import SoftwareProductComponentsImageList from './softwareProduct/components/images/SoftwareProductComponentsImageList.js'; |
| 46 | import SoftwareProductComponentsMonitoring from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoring.js'; |
| 47 | import objectValues from 'lodash/values.js'; |
| 48 | import PropTypes from 'prop-types'; |
| 49 | |
| 50 | import React from 'react'; |
| 51 | |
| 52 | import ReactDOM from 'react-dom'; |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 53 | import { enums } from './OnboardingConstants.js'; |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 54 | |
| 55 | export default class OnboardingView extends React.Component { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 56 | 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 | }; |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 63 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 64 | 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 | } |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 77 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 78 | render() { |
svishnev | 71782cf | 2018-07-17 10:37:38 +0300 | [diff] [blame] | 79 | let { currentScreen, isLoading } = this.props; |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 80 | let { screen, props } = currentScreen; |
svishnev | 71782cf | 2018-07-17 10:37:38 +0300 | [diff] [blame] | 81 | const preventClicks = isLoading ? 'no-pointer-events' : ''; |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 82 | return ( |
svishnev | 71782cf | 2018-07-17 10:37:38 +0300 | [diff] [blame] | 83 | <div |
| 84 | className={`dox-ui dox-ui-punch-out dox-ui-punch-out-full-page ${preventClicks}`}> |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 85 | {(() => { |
| 86 | switch (screen) { |
| 87 | case enums.SCREEN.ONBOARDING_CATALOG: |
| 88 | return <Onboard {...props} />; |
| 89 | case enums.SCREEN.VERSIONS_PAGE: |
| 90 | return <VersionsPage {...props} />; |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 91 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 92 | 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 | ); |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 143 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 144 | 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: |
Vodafone | 804ec68 | 2019-03-18 15:46:53 +0530 | [diff] [blame] | 150 | case enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION: |
| 151 | case enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION_RESULTS: |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 152 | 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 |
Vodafone | 804ec68 | 2019-03-18 15:46:53 +0530 | [diff] [blame] | 212 | .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 Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 227 | .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 | } |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 310 | } |