AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 1 | /*! |
| 2 | * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. |
| 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 |
| 13 | * or implied. See the License for the specific language governing |
| 14 | * permissions and limitations under the License. |
| 15 | */ |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 16 | import React from 'react'; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 17 | import PropTypes from 'prop-types'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 18 | import ReactDOM from 'react-dom'; |
| 19 | import {connect} from 'react-redux'; |
| 20 | import isEqual from 'lodash/isEqual.js'; |
| 21 | import objectValues from 'lodash/values.js'; |
| 22 | |
| 23 | import i18n from 'nfvo-utils/i18n/i18n.js'; |
| 24 | import Application from 'sdc-app/Application.jsx'; |
| 25 | import store from 'sdc-app/AppStore.js'; |
| 26 | import Configuration from 'sdc-app/config/Configuration.js'; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 27 | import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 28 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 29 | import Onboard from './onboard/Onboard.js'; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 30 | import VersionsPage from './versionsPage/VersionsPage.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 31 | import LicenseModel from './licenseModel/LicenseModel.js'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 32 | import LicenseModelOverview from './licenseModel/overview/LicenseModelOverview.js'; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 33 | import ActivityLog from 'sdc-app/common/activity-log/ActivityLog.js'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 34 | |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 35 | import LicenseAgreementListEditor from './licenseModel/licenseAgreement/LicenseAgreementListEditor.js'; |
| 36 | import FeatureGroupListEditor from './licenseModel/featureGroups/FeatureGroupListEditor.js'; |
| 37 | import LicenseKeyGroupsListEditor from './licenseModel/licenseKeyGroups/LicenseKeyGroupsListEditor.js'; |
| 38 | import EntitlementPoolsListEditor from './licenseModel/entitlementPools/EntitlementPoolsListEditor.js'; |
| 39 | import SoftwareProduct from './softwareProduct/SoftwareProduct.js'; |
| 40 | import SoftwareProductLandingPage from './softwareProduct/landingPage/SoftwareProductLandingPage.js'; |
| 41 | import SoftwareProductDetails from './softwareProduct/details/SoftwareProductDetails.js'; |
| 42 | import SoftwareProductAttachments from './softwareProduct/attachments/SoftwareProductAttachments.js'; |
| 43 | import SoftwareProductProcesses from './softwareProduct/processes/SoftwareProductProcesses.js'; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 44 | import SoftwareProductDeployment from './softwareProduct/deployment/SoftwareProductDeployment.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 45 | import SoftwareProductNetworks from './softwareProduct/networks/SoftwareProductNetworks.js'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 46 | import SoftwareProductDependencies from './softwareProduct/dependencies/SoftwareProductDependencies.js'; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 47 | |
| 48 | import SoftwareProductComponentsList from './softwareProduct/components/SoftwareProductComponents.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 49 | import SoftwareProductComponentProcessesList from './softwareProduct/components/processes/SoftwareProductComponentProcessesList.js'; |
| 50 | import SoftwareProductComponentStorage from './softwareProduct/components/storage/SoftwareProductComponentStorage.js'; |
| 51 | import SoftwareProductComponentsNetworkList from './softwareProduct/components/network/SoftwareProductComponentsNetworkList.js'; |
| 52 | import SoftwareProductComponentsGeneral from './softwareProduct/components/general/SoftwareProductComponentsGeneral.js'; |
| 53 | import SoftwareProductComponentsCompute from './softwareProduct/components/compute/SoftwareProductComponentCompute.js'; |
| 54 | import SoftwareProductComponentLoadBalancing from './softwareProduct/components/loadBalancing/SoftwareProductComponentLoadBalancing.js'; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 55 | import SoftwareProductComponentsImageList from './softwareProduct/components/images/SoftwareProductComponentsImageList.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 56 | import SoftwareProductComponentsMonitoring from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoring.js'; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 57 | import {onboardingMethod as onboardingMethodTypes, onboardingOriginTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 58 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 59 | import {itemTypes} from './versionsPage/VersionsPageConstants.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 60 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 61 | import HeatSetupActionHelper from './softwareProduct/attachments/setup/HeatSetupActionHelper.js'; |
| 62 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 63 | import {actionTypes, enums, screenTypes} from './OnboardingConstants.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 64 | import OnboardingActionHelper from './OnboardingActionHelper.js'; |
| 65 | |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 66 | class OnboardingView extends React.Component { |
| 67 | static propTypes = { |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 68 | currentScreen: PropTypes.shape({ |
| 69 | screen: PropTypes.oneOf(objectValues(enums.SCREEN)).isRequired, |
| 70 | props: PropTypes.object.isRequired, |
| 71 | itemPermission: PropTypes.object |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 72 | }).isRequired |
| 73 | }; |
| 74 | |
| 75 | componentDidMount() { |
| 76 | let element = ReactDOM.findDOMNode(this); |
| 77 | element.addEventListener('click', event => { |
| 78 | if (event.target.tagName === 'A') { |
| 79 | event.preventDefault(); |
| 80 | } |
| 81 | }); |
| 82 | ['wheel', 'mousewheel', 'DOMMouseScroll'].forEach(eventType => |
| 83 | element.addEventListener(eventType, event => event.stopPropagation()) |
| 84 | ); |
| 85 | } |
| 86 | |
| 87 | render() { |
| 88 | let {currentScreen} = this.props; |
| 89 | let {screen, props} = currentScreen; |
| 90 | |
| 91 | return ( |
| 92 | <div className='dox-ui dox-ui-punch-out dox-ui-punch-out-full-page'> |
| 93 | {(() => { |
| 94 | switch (screen) { |
| 95 | case enums.SCREEN.ONBOARDING_CATALOG: |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 96 | return <Onboard {...props}/>; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 97 | case enums.SCREEN.VERSIONS_PAGE: |
| 98 | return <VersionsPage {...props} />; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 99 | |
| 100 | case enums.SCREEN.LICENSE_AGREEMENTS: |
| 101 | case enums.SCREEN.FEATURE_GROUPS: |
| 102 | case enums.SCREEN.ENTITLEMENT_POOLS: |
| 103 | case enums.SCREEN.LICENSE_KEY_GROUPS: |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 104 | case enums.SCREEN.LICENSE_MODEL_OVERVIEW: |
| 105 | case enums.SCREEN.ACTIVITY_LOG: |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 106 | return ( |
| 107 | <LicenseModel currentScreen={currentScreen}> |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 108 | { |
| 109 | (()=>{ |
| 110 | switch(screen) { |
| 111 | case enums.SCREEN.LICENSE_MODEL_OVERVIEW: |
| 112 | return <LicenseModelOverview {...props}/>; |
| 113 | case enums.SCREEN.LICENSE_AGREEMENTS: |
| 114 | return <LicenseAgreementListEditor {...props}/>; |
| 115 | case enums.SCREEN.FEATURE_GROUPS: |
| 116 | return <FeatureGroupListEditor {...props}/>; |
| 117 | case enums.SCREEN.ENTITLEMENT_POOLS: |
| 118 | return <EntitlementPoolsListEditor {...props}/>; |
| 119 | case enums.SCREEN.LICENSE_KEY_GROUPS: |
| 120 | return <LicenseKeyGroupsListEditor {...props}/>; |
| 121 | case enums.SCREEN.ACTIVITY_LOG: |
| 122 | return <ActivityLog {...props}/>; |
| 123 | } |
| 124 | })() |
| 125 | } |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 126 | </LicenseModel> |
| 127 | ); |
| 128 | |
| 129 | case enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE: |
| 130 | case enums.SCREEN.SOFTWARE_PRODUCT_DETAILS: |
| 131 | case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS: |
| 132 | case enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES: |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 133 | case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT: |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 134 | case enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS: |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 135 | case enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES: |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 136 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS: |
| 137 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES: |
| 138 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE: |
| 139 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK: |
| 140 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL: |
| 141 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE: |
| 142 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING: |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 143 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES: |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 144 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING: |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 145 | case enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG: |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 146 | return ( |
| 147 | <SoftwareProduct currentScreen={currentScreen}> |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 148 | { |
| 149 | (()=>{ |
| 150 | switch(screen) { |
| 151 | case enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE: |
| 152 | return <SoftwareProductLandingPage {...props}/>; |
| 153 | case enums.SCREEN.SOFTWARE_PRODUCT_DETAILS: |
| 154 | return <SoftwareProductDetails {...props}/>; |
| 155 | case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS: |
| 156 | return <SoftwareProductAttachments className='no-padding-content-area' {...props} />; |
| 157 | case enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES: |
| 158 | return <SoftwareProductProcesses {...props}/>; |
| 159 | case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT: |
| 160 | return <SoftwareProductDeployment {...props}/>; |
| 161 | case enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS: |
| 162 | return <SoftwareProductNetworks {...props}/>; |
| 163 | case enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES: |
| 164 | return <SoftwareProductDependencies {...props} />; |
| 165 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS: |
| 166 | return <SoftwareProductComponentsList {...props}/>; |
| 167 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES: |
| 168 | return <SoftwareProductComponentProcessesList {...props}/>; |
| 169 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE: |
| 170 | return <SoftwareProductComponentStorage {...props}/>; |
| 171 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK: |
| 172 | return <SoftwareProductComponentsNetworkList {...props}/>; |
| 173 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL: |
| 174 | return <SoftwareProductComponentsGeneral{...props}/>; |
| 175 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE: |
| 176 | return <SoftwareProductComponentsCompute {...props}/>; |
| 177 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING: |
| 178 | return <SoftwareProductComponentLoadBalancing{...props}/>; |
| 179 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES: |
| 180 | return <SoftwareProductComponentsImageList{...props}/>; |
| 181 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING: |
| 182 | return <SoftwareProductComponentsMonitoring {...props}/>; |
| 183 | case enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG: |
| 184 | return <ActivityLog {...props}/>; |
| 185 | } |
| 186 | })() |
| 187 | } |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 188 | </SoftwareProduct> |
| 189 | ); |
| 190 | } |
| 191 | })()} |
| 192 | </div> |
| 193 | ); |
| 194 | } |
| 195 | } |
| 196 | const mapStateToProps = ({currentScreen}) => ({currentScreen}); |
| 197 | let Onboarding = connect(mapStateToProps, null)(OnboardingView); |
| 198 | |
| 199 | export default class OnboardingPunchOut { |
| 200 | |
| 201 | render({options: {data, apiRoot, apiHeaders}, onEvent}, element) { |
| 202 | if (!this.unsubscribeFromStore) { |
| 203 | this.unsubscribeFromStore = store.subscribe(() => this.handleStoreChange()); |
| 204 | } |
| 205 | |
| 206 | if (!this.isConfigSet) { |
| 207 | Configuration.setATTApiRoot(apiRoot); |
| 208 | Configuration.setATTApiHeaders(apiHeaders); |
| 209 | this.isConfigSet = true; |
| 210 | } |
| 211 | |
| 212 | this.onEvent = (...args) => onEvent(...args); |
| 213 | this.handleData(data); |
| 214 | |
| 215 | if (!this.rendered) { |
| 216 | ReactDOM.render( |
| 217 | <Application> |
| 218 | <Onboarding/> |
| 219 | </Application>, |
| 220 | element |
| 221 | ); |
| 222 | this.rendered = true; |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | unmount(element) { |
| 227 | ReactDOM.unmountComponentAtNode(element); |
| 228 | this.rendered = false; |
| 229 | this.unsubscribeFromStore(); |
| 230 | this.unsubscribeFromStore = null; |
| 231 | } |
| 232 | |
| 233 | handleData(data) { |
| 234 | let {breadcrumbs: {selectedKeys = []} = {}} = data; |
| 235 | let dispatch = action => store.dispatch(action); |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 236 | let {currentScreen, users: {usersList}, softwareProductList, licenseModelList, softwareProduct: {softwareProductEditor: {data: vspData = {}}, |
| 237 | softwareProductComponents = {}, softwareProductQuestionnaire = {}}} = store.getState(); |
| 238 | |
| 239 | let {props: {version, isReadOnlyMode}, screen} = currentScreen; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 240 | let {componentEditor: {data: componentData = {}, qdata: componentQData = {}}} = softwareProductComponents; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 241 | if (this.programmaticBreadcrumbsUpdate) { |
| 242 | this.prevSelectedKeys = selectedKeys; |
| 243 | this.programmaticBreadcrumbsUpdate = false; |
| 244 | return; |
| 245 | } |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 246 | if (!isEqual(selectedKeys, this.prevSelectedKeys)) { |
| 247 | this.breadcrumbsPrefixSelected = isEqual(selectedKeys, this.prevSelectedKeys && this.prevSelectedKeys.slice(0, selectedKeys.length)); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 248 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 249 | const [, screenType, prevVspId, , prevComponentId] = this.prevSelectedKeys || []; |
| 250 | let preNavigate = Promise.resolve(); |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 251 | if(screenType === enums.BREADCRUMS.SOFTWARE_PRODUCT && screen !== 'VERSIONS_PAGE' && !isReadOnlyMode) { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 252 | let dataToSave = prevVspId ? prevComponentId ? {componentData, qdata: componentQData} : {softwareProduct: vspData, qdata: softwareProductQuestionnaire.qdata} : {}; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 253 | preNavigate = OnboardingActionHelper.autoSaveBeforeNavigate(dispatch, { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 254 | softwareProductId: prevVspId, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 255 | version, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 256 | vspComponentId: prevComponentId, |
| 257 | dataToSave |
| 258 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 259 | } |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 260 | |
| 261 | let {currentScreen: {props: {softwareProductId}}, softwareProduct: {softwareProductAttachments: {heatSetup, heatSetupCache}}} = store.getState(); |
| 262 | let heatSetupPopupPromise = currentScreen.screen === enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS ? |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 263 | HeatSetupActionHelper.heatSetupLeaveConfirmation(dispatch, {softwareProductId, heatSetup, heatSetupCache}) : |
| 264 | Promise.resolve(); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 265 | Promise.all([preNavigate, heatSetupPopupPromise]).then(() => { |
| 266 | this.prevSelectedKeys = selectedKeys; |
| 267 | if (selectedKeys.length === 0) { |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 268 | ScreensHelper.loadScreen(dispatch, {screen: enums.SCREEN.ONBOARDING_CATALOG}); |
| 269 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 270 | } else if (selectedKeys.length === 1 || selectedKeys[1] === enums.BREADCRUMS.LICENSE_MODEL) { |
| 271 | let [licenseModelId, , licenseModelScreen] = selectedKeys; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 272 | let licenseModel = licenseModelList.find(vlm => vlm.id === licenseModelId); |
| 273 | ScreensHelper.loadScreen(dispatch, {screen: licenseModelScreen, screenType: screenTypes.LICENSE_MODEL, |
| 274 | props: {licenseModelId, version, licenseModel, usersList}}); |
| 275 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 276 | } else if (selectedKeys.length <= 4 && selectedKeys[1] === enums.BREADCRUMS.SOFTWARE_PRODUCT) { |
| 277 | let [licenseModelId, , softwareProductId, softwareProductScreen] = selectedKeys; |
| 278 | let softwareProduct = softwareProductId ? |
| 279 | softwareProductList.find(({id}) => id === softwareProductId) : |
| 280 | softwareProductList.find(({vendorId}) => vendorId === licenseModelId); |
| 281 | if (!softwareProductId) { |
| 282 | softwareProductId = softwareProduct.id; |
| 283 | } |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 284 | if (softwareProductScreen === enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS) { |
| 285 | softwareProduct = vspData; |
| 286 | //check current vsp fields to determine which file has uploaded |
| 287 | if(vspData.onboardingOrigin === onboardingOriginTypes.ZIP || vspData.candidateOnboardingOrigin === onboardingOriginTypes.ZIP) { |
| 288 | softwareProductScreen = enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS_SETUP; |
| 289 | } |
| 290 | else if(vspData.onboardingOrigin === onboardingOriginTypes.CSAR) { |
| 291 | softwareProductScreen = enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS_VALIDATION; |
| 292 | } |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 293 | } |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 294 | |
| 295 | ScreensHelper.loadScreen(dispatch, {screen: softwareProductScreen, screenType: screenTypes.SOFTWARE_PRODUCT, |
| 296 | props: {softwareProductId, softwareProduct, version, usersList}}); |
| 297 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 298 | } else if (selectedKeys.length === 5 && selectedKeys[1] === enums.BREADCRUMS.SOFTWARE_PRODUCT && selectedKeys[3] === enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENTS) { |
| 299 | let [licenseModelId, , softwareProductId, , componentId] = selectedKeys; |
| 300 | let softwareProduct = softwareProductId ? |
| 301 | softwareProductList.find(({id}) => id === softwareProductId) : |
| 302 | softwareProductList.find(({vendorId}) => vendorId === licenseModelId); |
| 303 | if (!softwareProductId) { |
| 304 | softwareProductId = softwareProduct.id; |
| 305 | } |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 306 | ScreensHelper.loadScreen(dispatch, {screen: enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, screenType: screenTypes.SOFTWARE_PRODUCT, |
| 307 | props: {softwareProductId, softwareProduct, componentId, version, usersList}}); |
| 308 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 309 | } else if (selectedKeys.length === 6 && selectedKeys[1] === enums.BREADCRUMS.SOFTWARE_PRODUCT && selectedKeys[3] === enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENTS) { |
| 310 | let [licenseModelId, , softwareProductId, , componentId, componentScreen] = selectedKeys; |
| 311 | let softwareProduct = softwareProductId ? |
| 312 | softwareProductList.find(({id}) => id === softwareProductId) : |
| 313 | softwareProductList.find(({vendorId}) => vendorId === licenseModelId); |
| 314 | if (!softwareProductId) { |
| 315 | softwareProductId = softwareProduct.id; |
| 316 | } |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 317 | ScreensHelper.loadScreen(dispatch, {screen: componentScreen, screenType: screenTypes.SOFTWARE_PRODUCT, |
| 318 | props: {softwareProductId, softwareProduct, componentId, version, usersList}}); |
| 319 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 320 | } else { |
| 321 | console.error('Unknown breadcrumbs path: ', selectedKeys); |
| 322 | } |
| 323 | }).catch(() => { |
| 324 | store.dispatch({ |
| 325 | type: actionTypes.SET_CURRENT_SCREEN, |
| 326 | currentScreen: { |
| 327 | ...currentScreen, |
| 328 | forceBreadCrumbsUpdate: true |
| 329 | } |
| 330 | }); |
| 331 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 332 | } |
| 333 | } |
| 334 | |
| 335 | handleStoreChange() { |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 336 | let {currentScreen, licenseModelList, finalizedLicenseModelList, softwareProductList, finalizedSoftwareProductList, versionsPage: |
| 337 | {versionsList: {itemType, itemId}}, |
| 338 | softwareProduct: {softwareProductEditor: {data: currentSoftwareProduct = {onboardingMethod: ''}}, |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 339 | softwareProductComponents: {componentsList}}} = store.getState(); |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 340 | const wholeSoftwareProductList = [...softwareProductList, ...finalizedSoftwareProductList]; |
| 341 | const wholeLicenseModelList = [...licenseModelList, ...finalizedLicenseModelList]; |
| 342 | let breadcrumbsData = {itemType, itemId, currentScreen, wholeLicenseModelList, wholeSoftwareProductList, currentSoftwareProduct, componentsList}; |
| 343 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 344 | if (currentScreen.forceBreadCrumbsUpdate || !isEqual(breadcrumbsData, this.prevBreadcrumbsData) || this.breadcrumbsPrefixSelected) { |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 345 | this.prevBreadcrumbsData = breadcrumbsData; |
| 346 | this.breadcrumbsPrefixSelected = false; |
| 347 | this.programmaticBreadcrumbsUpdate = true; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 348 | let breadcrumbs = this.buildBreadcrumbs(breadcrumbsData); |
| 349 | this.onEvent('breadcrumbsupdated', breadcrumbs); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 350 | store.dispatch({ |
| 351 | type: actionTypes.SET_CURRENT_SCREEN, |
| 352 | currentScreen: { |
| 353 | ...currentScreen, |
| 354 | forceBreadCrumbsUpdate: false |
| 355 | } |
| 356 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 357 | } |
| 358 | } |
| 359 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 360 | buildBreadcrumbs({currentScreen: {screen, props}, itemType, itemId, currentSoftwareProduct, |
| 361 | wholeLicenseModelList, wholeSoftwareProductList, componentsList}) { |
| 362 | let {onboardingMethod, onboardingOrigin, candidateOnboardingOrigin} = currentSoftwareProduct; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 363 | let screenToBreadcrumb; |
| 364 | switch (screen) { |
| 365 | case enums.SCREEN.ONBOARDING_CATALOG: |
| 366 | return []; |
| 367 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 368 | case enums.SCREEN.VERSIONS_PAGE: |
| 369 | let firstMenuItems = itemType === itemTypes.LICENSE_MODEL ? [ |
| 370 | { |
| 371 | selectedKey: itemId, |
| 372 | menuItems: wholeLicenseModelList.map(({id, name}) => ({ |
| 373 | key: id, |
| 374 | displayText: name |
| 375 | })) |
| 376 | }] : [ |
| 377 | { |
| 378 | selectedKey: props.additionalProps.licenseModelId || currentSoftwareProduct.vendorId, |
| 379 | menuItems: wholeLicenseModelList.map(({id, name}) => ({ |
| 380 | key: id, |
| 381 | displayText: name |
| 382 | })) |
| 383 | }, |
| 384 | { |
| 385 | selectedKey: enums.BREADCRUMS.SOFTWARE_PRODUCT, |
| 386 | menuItems: [{ |
| 387 | key: enums.BREADCRUMS.LICENSE_MODEL, |
| 388 | displayText: i18n('License Model') |
| 389 | }, { |
| 390 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT, |
| 391 | displayText: i18n('Software Products') |
| 392 | }] |
| 393 | }, |
| 394 | { |
| 395 | selectedKey: itemId, |
| 396 | menuItems: wholeSoftwareProductList |
| 397 | .filter(({id, vendorId}) => vendorId === currentSoftwareProduct.vendorId || id === itemId) |
| 398 | .map(({id, name}) => ({ |
| 399 | key: id, |
| 400 | displayText: name |
| 401 | })) |
| 402 | }, |
| 403 | ]; |
| 404 | return [ |
| 405 | ...firstMenuItems, |
| 406 | { |
| 407 | selectedKey: enums.BREADCRUMS.VERSIONS_PAGE, |
| 408 | menuItems: [{key: enums.BREADCRUMS.VERSIONS_PAGE, displayText: i18n('Versions Page')}] |
| 409 | } |
| 410 | ]; |
| 411 | |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 412 | case enums.SCREEN.LICENSE_AGREEMENTS: |
| 413 | case enums.SCREEN.FEATURE_GROUPS: |
| 414 | case enums.SCREEN.ENTITLEMENT_POOLS: |
| 415 | case enums.SCREEN.LICENSE_KEY_GROUPS: |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 416 | case enums.SCREEN.LICENSE_MODEL_OVERVIEW: |
| 417 | case enums.SCREEN.ACTIVITY_LOG: |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 418 | screenToBreadcrumb = { |
| 419 | [enums.SCREEN.LICENSE_AGREEMENTS]: enums.BREADCRUMS.LICENSE_AGREEMENTS, |
| 420 | [enums.SCREEN.FEATURE_GROUPS]: enums.BREADCRUMS.FEATURE_GROUPS, |
| 421 | [enums.SCREEN.ENTITLEMENT_POOLS]: enums.BREADCRUMS.ENTITLEMENT_POOLS, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 422 | [enums.SCREEN.LICENSE_KEY_GROUPS]: enums.BREADCRUMS.LICENSE_KEY_GROUPS, |
| 423 | [enums.SCREEN.LICENSE_MODEL_OVERVIEW]: enums.BREADCRUMS.LICENSE_MODEL_OVERVIEW, |
| 424 | [enums.SCREEN.ACTIVITY_LOG]: enums.BREADCRUMS.ACTIVITY_LOG |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 425 | }; |
| 426 | return [ |
| 427 | { |
| 428 | selectedKey: props.licenseModelId, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 429 | menuItems: wholeLicenseModelList.map(({id, name}) => ({ |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 430 | key: id, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 431 | displayText: name |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 432 | })) |
| 433 | }, |
| 434 | { |
| 435 | selectedKey: enums.BREADCRUMS.LICENSE_MODEL, |
| 436 | menuItems: [{ |
| 437 | key: enums.BREADCRUMS.LICENSE_MODEL, |
| 438 | displayText: i18n('License Model') |
| 439 | }, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 440 | ...(wholeSoftwareProductList.findIndex(({vendorId}) => vendorId === props.licenseModelId) === -1 ? [] : [{ |
| 441 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT, |
| 442 | displayText: i18n('Software Products') |
| 443 | }])] |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 444 | }, { |
| 445 | selectedKey: screenToBreadcrumb[screen], |
| 446 | menuItems: [{ |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 447 | key: enums.BREADCRUMS.LICENSE_MODEL_OVERVIEW, |
| 448 | displayText: i18n('Overview') |
| 449 | },{ |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 450 | key: enums.BREADCRUMS.LICENSE_AGREEMENTS, |
| 451 | displayText: i18n('License Agreements') |
| 452 | }, { |
| 453 | key: enums.BREADCRUMS.FEATURE_GROUPS, |
| 454 | displayText: i18n('Feature Groups') |
| 455 | }, { |
| 456 | key: enums.BREADCRUMS.ENTITLEMENT_POOLS, |
| 457 | displayText: i18n('Entitlement Pools') |
| 458 | }, { |
| 459 | key: enums.BREADCRUMS.LICENSE_KEY_GROUPS, |
| 460 | displayText: i18n('License Key Groups') |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 461 | }, { |
| 462 | key: enums.BREADCRUMS.ACTIVITY_LOG, |
| 463 | displayText: i18n('Activity Log') |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 464 | }] |
| 465 | } |
| 466 | ]; |
| 467 | |
| 468 | case enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE: |
| 469 | case enums.SCREEN.SOFTWARE_PRODUCT_DETAILS: |
| 470 | case enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS: |
| 471 | case enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES: |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 472 | case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT: |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 473 | case enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS: |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 474 | case enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES: |
| 475 | case enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG: |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 476 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS: |
| 477 | |
| 478 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES: |
| 479 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE: |
| 480 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE: |
| 481 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK: |
| 482 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL: |
| 483 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING: |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 484 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES: |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 485 | case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING: |
| 486 | screenToBreadcrumb = { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 487 | [enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE]: enums.BREADCRUMS.SOFTWARE_PRODUCT_LANDING_PAGE, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 488 | [enums.SCREEN.SOFTWARE_PRODUCT_DETAILS]: enums.BREADCRUMS.SOFTWARE_PRODUCT_DETAILS, |
| 489 | [enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS]: enums.BREADCRUMS.SOFTWARE_PRODUCT_ATTACHMENTS, |
| 490 | [enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES]: enums.BREADCRUMS.SOFTWARE_PRODUCT_PROCESSES, |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 491 | [enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT]: enums.BREADCRUMS.SOFTWARE_PRODUCT_DEPLOYMENT, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 492 | [enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS]: enums.BREADCRUMS.SOFTWARE_PRODUCT_NETWORKS, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 493 | [enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES]: enums.BREADCRUMS.SOFTWARE_PRODUCT_DEPENDENCIES, |
| 494 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENTS, |
| 495 | [enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG]: enums.BREADCRUMS.SOFTWARE_PRODUCT_ACTIVITY_LOG |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 496 | }; |
| 497 | let componentScreenToBreadcrumb = { |
| 498 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES]: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_PROCESSES, |
| 499 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE]: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_COMPUTE, |
| 500 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE]: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_STORAGE, |
| 501 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK]: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_NETWORK, |
| 502 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL]: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_GENERAL, |
| 503 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING]: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING, |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 504 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES]: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_IMAGES, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 505 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING]: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_MONITORING |
| 506 | }; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 507 | let licenseModelId = currentSoftwareProduct.vendorId; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 508 | let returnedBreadcrumb = [ |
| 509 | { |
| 510 | selectedKey: licenseModelId, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 511 | menuItems: wholeLicenseModelList.map(({id, name}) => ({ |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 512 | key: id, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 513 | displayText: name |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 514 | })) |
| 515 | }, |
| 516 | { |
| 517 | selectedKey: enums.BREADCRUMS.SOFTWARE_PRODUCT, |
| 518 | menuItems: [{ |
| 519 | key: enums.BREADCRUMS.LICENSE_MODEL, |
| 520 | displayText: i18n('License Model') |
| 521 | }, { |
| 522 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT, |
| 523 | displayText: i18n('Software Products') |
| 524 | }] |
| 525 | }, |
| 526 | { |
| 527 | selectedKey: props.softwareProductId, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 528 | menuItems: wholeSoftwareProductList |
| 529 | .filter(({vendorId, id}) => vendorId === licenseModelId || id === props.softwareProductId) |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 530 | .map(({id, name}) => ({ |
| 531 | key: id, |
| 532 | displayText: name |
| 533 | })) |
| 534 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 535 | ...(/*screen === enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE ? [] :*/ [{ |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 536 | selectedKey: screenToBreadcrumb[screen] || enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENTS, |
| 537 | menuItems: [{ |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 538 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_LANDING_PAGE, |
| 539 | displayText: i18n('Overview') |
| 540 | }, { |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 541 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_DETAILS, |
| 542 | displayText: i18n('General') |
| 543 | }, { |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 544 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_DEPLOYMENT, |
| 545 | displayText: i18n('Deployment Flavors') |
| 546 | }, { |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 547 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_PROCESSES, |
| 548 | displayText: i18n('Process Details') |
| 549 | }, { |
| 550 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_NETWORKS, |
| 551 | displayText: i18n('Networks') |
| 552 | }, { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 553 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_DEPENDENCIES, |
| 554 | displayText: i18n('Components Dependencies') |
| 555 | }, { |
| 556 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_ATTACHMENTS, |
| 557 | displayText: i18n('Attachments') |
| 558 | }, { |
| 559 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_ACTIVITY_LOG, |
| 560 | displayText: i18n('Activity Log') |
| 561 | }, { |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 562 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENTS, |
| 563 | displayText: i18n('Components') |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 564 | }].filter(item => { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 565 | switch (item.key) { |
| 566 | case enums.BREADCRUMS.SOFTWARE_PRODUCT_ATTACHMENTS: |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 567 | let isHeatData = onboardingOrigin !== onboardingOriginTypes.NONE || candidateOnboardingOrigin === onboardingOriginTypes.ZIP; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 568 | return isHeatData; |
| 569 | case enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENTS: |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 570 | return (componentsList.length > 0); |
| 571 | case enums.BREADCRUMS.SOFTWARE_PRODUCT_DEPLOYMENT: |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 572 | let isManualMode = onboardingMethod === onboardingMethodTypes.MANUAL; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 573 | return isManualMode; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 574 | case enums.BREADCRUMS.SOFTWARE_PRODUCT_DEPENDENCIES: |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 575 | return (componentsList.length > 1); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 576 | default: |
| 577 | return true; |
| 578 | } |
| 579 | }) |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 580 | }]) |
| 581 | ]; |
| 582 | if(props.componentId) { |
| 583 | returnedBreadcrumb = [ |
| 584 | ...returnedBreadcrumb, { |
| 585 | selectedKey: props.componentId, |
| 586 | menuItems: componentsList |
| 587 | .map(({id, displayName}) => ({ |
| 588 | key: id, |
| 589 | displayText: displayName |
| 590 | })) |
| 591 | }, |
| 592 | ...[{ |
| 593 | selectedKey: componentScreenToBreadcrumb[screen], |
| 594 | menuItems: [{ |
| 595 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_GENERAL, |
| 596 | displayText: i18n('General') |
| 597 | }, { |
| 598 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_COMPUTE, |
| 599 | displayText: i18n('Compute') |
| 600 | }, { |
| 601 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING, |
| 602 | displayText: i18n('High Availability & Load Balancing') |
| 603 | }, { |
| 604 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_NETWORK, |
| 605 | displayText: i18n('Networks') |
| 606 | }, { |
| 607 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_STORAGE, |
| 608 | displayText: i18n('Storage') |
| 609 | }, { |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 610 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_IMAGES, |
| 611 | displayText: i18n('Images') |
| 612 | }, { |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 613 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_PROCESSES, |
| 614 | displayText: i18n('Process Details') |
| 615 | }, { |
| 616 | key: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENT_MONITORING, |
| 617 | displayText: i18n('Monitoring') |
Avi Ziv | 61070c9 | 2017-07-26 17:37:57 +0300 | [diff] [blame] | 618 | }] |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 619 | }] |
| 620 | ]; |
| 621 | } |
| 622 | return returnedBreadcrumb; |
| 623 | } |
| 624 | } |
| 625 | } |