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 |
| 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 | |
| 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'; |
| 34 | import SoftwareProductDependencies from './softwareProduct/dependencies/SoftwareProductDependencies.js'; |
| 35 | |
| 36 | import SoftwareProductComponentsList from './softwareProduct/components/SoftwareProductComponents.js'; |
| 37 | import SoftwareProductComponentProcessesList from './softwareProduct/components/processes/SoftwareProductComponentProcessesList.js'; |
| 38 | import SoftwareProductComponentStorage from './softwareProduct/components/storage/SoftwareProductComponentStorage.js'; |
| 39 | import SoftwareProductComponentsNetworkList from './softwareProduct/components/network/SoftwareProductComponentsNetworkList.js'; |
| 40 | import SoftwareProductComponentsGeneral from './softwareProduct/components/general/SoftwareProductComponentsGeneral.js'; |
| 41 | import SoftwareProductComponentsCompute from './softwareProduct/components/compute/SoftwareProductComponentCompute.js'; |
| 42 | import SoftwareProductComponentLoadBalancing from './softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancing.js'; |
| 43 | import SoftwareProductComponentsImageList from './softwareProduct/components/images/SoftwareProductComponentsImageList.js'; |
| 44 | import SoftwareProductComponentsMonitoring from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoring.js'; |
| 45 | import objectValues from 'lodash/values.js'; |
| 46 | import PropTypes from 'prop-types'; |
| 47 | |
| 48 | import React from 'react'; |
| 49 | |
| 50 | import ReactDOM from 'react-dom'; |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 51 | import { enums } from './OnboardingConstants.js'; |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 52 | |
| 53 | export default class OnboardingView extends React.Component { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 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 | }; |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 61 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 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 => |
| 71 | event.stopPropagation() |
| 72 | ) |
| 73 | ); |
| 74 | } |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 75 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 76 | render() { |
| 77 | let { currentScreen } = this.props; |
| 78 | let { screen, props } = currentScreen; |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 79 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 80 | return ( |
| 81 | <div className="dox-ui dox-ui-punch-out dox-ui-punch-out-full-page"> |
| 82 | {(() => { |
| 83 | switch (screen) { |
| 84 | case enums.SCREEN.ONBOARDING_CATALOG: |
| 85 | return <Onboard {...props} />; |
| 86 | case enums.SCREEN.VERSIONS_PAGE: |
| 87 | return <VersionsPage {...props} />; |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 88 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 89 | case enums.SCREEN.LICENSE_AGREEMENTS: |
| 90 | case enums.SCREEN.FEATURE_GROUPS: |
| 91 | case enums.SCREEN.ENTITLEMENT_POOLS: |
| 92 | case enums.SCREEN.LICENSE_KEY_GROUPS: |
| 93 | case enums.SCREEN.LICENSE_MODEL_OVERVIEW: |
| 94 | case enums.SCREEN.ACTIVITY_LOG: |
| 95 | return ( |
| 96 | <LicenseModel currentScreen={currentScreen}> |
| 97 | {(() => { |
| 98 | switch (screen) { |
| 99 | case enums.SCREEN |
| 100 | .LICENSE_MODEL_OVERVIEW: |
| 101 | return ( |
| 102 | <LicenseModelOverview |
| 103 | {...props} |
| 104 | /> |
| 105 | ); |
| 106 | case enums.SCREEN |
| 107 | .LICENSE_AGREEMENTS: |
| 108 | return ( |
| 109 | <LicenseAgreementListEditor |
| 110 | {...props} |
| 111 | /> |
| 112 | ); |
| 113 | case enums.SCREEN.FEATURE_GROUPS: |
| 114 | return ( |
| 115 | <FeatureGroupListEditor |
| 116 | {...props} |
| 117 | /> |
| 118 | ); |
| 119 | case enums.SCREEN.ENTITLEMENT_POOLS: |
| 120 | return ( |
| 121 | <EntitlementPoolsListEditor |
| 122 | {...props} |
| 123 | /> |
| 124 | ); |
| 125 | case enums.SCREEN |
| 126 | .LICENSE_KEY_GROUPS: |
| 127 | return ( |
| 128 | <LicenseKeyGroupsListEditor |
| 129 | {...props} |
| 130 | /> |
| 131 | ); |
| 132 | case enums.SCREEN.ACTIVITY_LOG: |
| 133 | return ( |
| 134 | <ActivityLog {...props} /> |
| 135 | ); |
| 136 | } |
| 137 | })()} |
| 138 | </LicenseModel> |
| 139 | ); |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 140 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 141 | case enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE: |
| 142 | case enums.SCREEN.SOFTWARE_PRODUCT_DETAILS: |
| 143 | case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS: |
| 144 | case enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES: |
| 145 | case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT: |
| 146 | case enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS: |
| 147 | case enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES: |
| 148 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS: |
| 149 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES: |
| 150 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE: |
| 151 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK: |
| 152 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL: |
| 153 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE: |
| 154 | case enums.SCREEN |
| 155 | .SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING: |
| 156 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES: |
| 157 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING: |
| 158 | case enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG: |
| 159 | return ( |
| 160 | <SoftwareProduct currentScreen={currentScreen}> |
| 161 | {(() => { |
| 162 | switch (screen) { |
| 163 | case enums.SCREEN |
| 164 | .SOFTWARE_PRODUCT_LANDING_PAGE: |
| 165 | return ( |
| 166 | <SoftwareProductLandingPage |
| 167 | {...props} |
| 168 | /> |
| 169 | ); |
| 170 | case enums.SCREEN |
| 171 | .SOFTWARE_PRODUCT_DETAILS: |
| 172 | return ( |
| 173 | <SoftwareProductDetails |
| 174 | {...props} |
| 175 | /> |
| 176 | ); |
| 177 | case enums.SCREEN |
| 178 | .SOFTWARE_PRODUCT_ATTACHMENTS: |
| 179 | return ( |
| 180 | <SoftwareProductAttachments |
| 181 | className="no-padding-content-area" |
| 182 | {...props} |
| 183 | /> |
| 184 | ); |
| 185 | case enums.SCREEN |
| 186 | .SOFTWARE_PRODUCT_PROCESSES: |
| 187 | return ( |
| 188 | <SoftwareProductProcesses |
| 189 | {...props} |
| 190 | /> |
| 191 | ); |
| 192 | case enums.SCREEN |
| 193 | .SOFTWARE_PRODUCT_DEPLOYMENT: |
| 194 | return ( |
| 195 | <SoftwareProductDeployment |
| 196 | {...props} |
| 197 | /> |
| 198 | ); |
| 199 | case enums.SCREEN |
| 200 | .SOFTWARE_PRODUCT_NETWORKS: |
| 201 | return ( |
| 202 | <SoftwareProductNetworks |
| 203 | {...props} |
| 204 | /> |
| 205 | ); |
| 206 | case enums.SCREEN |
| 207 | .SOFTWARE_PRODUCT_DEPENDENCIES: |
| 208 | return ( |
| 209 | <SoftwareProductDependencies |
| 210 | {...props} |
| 211 | /> |
| 212 | ); |
| 213 | case enums.SCREEN |
| 214 | .SOFTWARE_PRODUCT_COMPONENTS: |
| 215 | return ( |
| 216 | <SoftwareProductComponentsList |
| 217 | {...props} |
| 218 | /> |
| 219 | ); |
| 220 | case enums.SCREEN |
| 221 | .SOFTWARE_PRODUCT_COMPONENT_PROCESSES: |
| 222 | return ( |
| 223 | <SoftwareProductComponentProcessesList |
| 224 | {...props} |
| 225 | /> |
| 226 | ); |
| 227 | case enums.SCREEN |
| 228 | .SOFTWARE_PRODUCT_COMPONENT_STORAGE: |
| 229 | return ( |
| 230 | <SoftwareProductComponentStorage |
| 231 | {...props} |
| 232 | /> |
| 233 | ); |
| 234 | case enums.SCREEN |
| 235 | .SOFTWARE_PRODUCT_COMPONENT_NETWORK: |
| 236 | return ( |
| 237 | <SoftwareProductComponentsNetworkList |
| 238 | {...props} |
| 239 | /> |
| 240 | ); |
| 241 | case enums.SCREEN |
| 242 | .SOFTWARE_PRODUCT_COMPONENT_GENERAL: |
| 243 | return ( |
| 244 | <SoftwareProductComponentsGeneral |
| 245 | {...props} |
| 246 | /> |
| 247 | ); |
| 248 | case enums.SCREEN |
| 249 | .SOFTWARE_PRODUCT_COMPONENT_COMPUTE: |
| 250 | return ( |
| 251 | <SoftwareProductComponentsCompute |
| 252 | {...props} |
| 253 | /> |
| 254 | ); |
| 255 | case enums.SCREEN |
| 256 | .SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING: |
| 257 | return ( |
| 258 | <SoftwareProductComponentLoadBalancing |
| 259 | {...props} |
| 260 | /> |
| 261 | ); |
| 262 | case enums.SCREEN |
| 263 | .SOFTWARE_PRODUCT_COMPONENT_IMAGES: |
| 264 | return ( |
| 265 | <SoftwareProductComponentsImageList |
| 266 | {...props} |
| 267 | /> |
| 268 | ); |
| 269 | case enums.SCREEN |
| 270 | .SOFTWARE_PRODUCT_COMPONENT_MONITORING: |
| 271 | return ( |
| 272 | <SoftwareProductComponentsMonitoring |
| 273 | {...props} |
| 274 | /> |
| 275 | ); |
| 276 | case enums.SCREEN |
| 277 | .SOFTWARE_PRODUCT_ACTIVITY_LOG: |
| 278 | return ( |
| 279 | <ActivityLog {...props} /> |
| 280 | ); |
| 281 | } |
| 282 | })()} |
| 283 | </SoftwareProduct> |
| 284 | ); |
| 285 | } |
| 286 | })()} |
| 287 | </div> |
| 288 | ); |
| 289 | } |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 290 | } |