svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2016-2017 European Support Limited |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 3 | * |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 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 | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
Michael Lando | efa037d | 2017-02-19 12:57:33 +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, |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 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. |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 15 | */ |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 16 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 17 | import UsersActionHelper from './users/UsersActionHelper.js'; |
| 18 | import VersionsPageActionHelper from './versionsPage/VersionsPageActionHelper.js'; |
| 19 | import PermissionsActionHelper from './permissions/PermissionsActionHelper.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 20 | import LicenseModelActionHelper from './licenseModel/LicenseModelActionHelper.js'; |
| 21 | import LicenseAgreementActionHelper from './licenseModel/licenseAgreement/LicenseAgreementActionHelper.js'; |
| 22 | import FeatureGroupsActionHelper from './licenseModel/featureGroups/FeatureGroupsActionHelper.js'; |
| 23 | import LicenseKeyGroupsActionHelper from './licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js'; |
| 24 | import EntitlementPoolsActionHelper from './licenseModel/entitlementPools/EntitlementPoolsActionHelper.js'; |
| 25 | import SoftwareProductActionHelper from './softwareProduct/SoftwareProductActionHelper.js'; |
| 26 | import SoftwareProductProcessesActionHelper from './softwareProduct/processes/SoftwareProductProcessesActionHelper.js'; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 27 | import SoftwareProductDeploymentActionHelper from './softwareProduct/deployment/SoftwareProductDeploymentActionHelper.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 28 | import SoftwareProductNetworksActionHelper from './softwareProduct/networks/SoftwareProductNetworksActionHelper.js'; |
| 29 | import SoftwareProductComponentsActionHelper from './softwareProduct/components/SoftwareProductComponentsActionHelper.js'; |
| 30 | import SoftwareProductComponentProcessesActionHelper from './softwareProduct/components/processes/SoftwareProductComponentProcessesActionHelper.js'; |
| 31 | import SoftwareProductComponentsNetworkActionHelper from './softwareProduct/components/network/SoftwareProductComponentsNetworkActionHelper.js'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 32 | import SoftwareProductDependenciesActionHelper from './softwareProduct/dependencies/SoftwareProductDependenciesActionHelper.js'; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 33 | import ComputeFlavorActionHelper from './softwareProduct/components/compute/ComputeFlavorActionHelper.js'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 34 | import OnboardActionHelper from './onboard/OnboardActionHelper.js'; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 35 | import MergeEditorActionHelper from 'sdc-app/common/merge/MergeEditorActionHelper.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 36 | import SoftwareProductComponentsMonitoringAction from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringActionHelper.js'; |
| 37 | import {actionTypes, enums} from './OnboardingConstants.js'; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 38 | import {actionTypes as SoftwareProductActionTypes, onboardingOriginTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 39 | import ActivityLogActionHelper from 'sdc-app/common/activity-log/ActivityLogActionHelper.js'; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 40 | import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js'; |
| 41 | import SoftwareProductComponentsImageActionHelper from './softwareProduct/components/images/SoftwareProductComponentsImageActionHelper.js'; |
Michael Lando | 4d97d5f | 2017-06-17 22:40:44 +0300 | [diff] [blame] | 42 | import licenseModelOverviewActionHelper from 'sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js'; |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 43 | import {tabsMapping as attachmentsTabsMapping} from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js'; |
| 44 | import SoftwareProductAttachmentsActionHelper from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 45 | |
| 46 | function setCurrentScreen(dispatch, screen, props = {}) { |
| 47 | dispatch({ |
| 48 | type: actionTypes.SET_CURRENT_SCREEN, |
| 49 | currentScreen: { |
| 50 | screen, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 51 | props, |
| 52 | forceBreadCrumbsUpdate: true |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 53 | } |
| 54 | }); |
| 55 | } |
| 56 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 57 | export function updateCurrentScreenProps(dispatch, props = {}) { |
| 58 | dispatch({ |
| 59 | type: actionTypes.UPDATE_CURRENT_SCREEN_PROPS, |
| 60 | props |
| 61 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 62 | } |
| 63 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 64 | const OnboardingActionHelper = { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 65 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 66 | loadItemsLists(dispatch) { |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 67 | LicenseModelActionHelper.fetchLicenseModels(dispatch); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 68 | LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 69 | SoftwareProductActionHelper.fetchSoftwareProductList(dispatch); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 70 | SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(dispatch); |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 71 | }, |
| 72 | |
| 73 | navigateToOnboardingCatalog(dispatch) { |
| 74 | UsersActionHelper.fetchUsersList(dispatch); |
| 75 | this.loadItemsLists(dispatch); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 76 | OnboardActionHelper.resetOnboardStore(dispatch); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 77 | setCurrentScreen(dispatch, enums.SCREEN.ONBOARDING_CATALOG); |
| 78 | }, |
| 79 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 80 | autoSaveBeforeNavigate(dispatch, {softwareProductId, version, vspComponentId, dataToSave}) { |
| 81 | if(softwareProductId) { |
| 82 | if(vspComponentId) { |
| 83 | return SoftwareProductComponentsActionHelper.updateSoftwareProductComponent(dispatch, { |
| 84 | softwareProductId, version, vspComponentId, |
| 85 | componentData: dataToSave.componentData, |
| 86 | qdata: dataToSave.qdata |
| 87 | }); |
| 88 | } |
| 89 | return SoftwareProductActionHelper.updateSoftwareProduct(dispatch, { |
| 90 | softwareProduct: dataToSave.softwareProduct, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 91 | version, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 92 | qdata: dataToSave.qdata |
| 93 | }); |
| 94 | } |
| 95 | return Promise.resolve(); |
| 96 | }, |
| 97 | |
| 98 | navigateToLicenseModelOverview(dispatch, {licenseModelId, version}) { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 99 | |
| 100 | /** |
| 101 | * TODO change to specific rest |
| 102 | */ |
| 103 | |
| 104 | LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => { |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 105 | LicenseModelActionHelper.fetchLicenseModelItems(dispatch, {licenseModelId, version}).then(() => { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 106 | setCurrentScreen(dispatch, enums.SCREEN.LICENSE_MODEL_OVERVIEW, {licenseModelId, version}); |
| 107 | }); |
ilanap | c6a41de | 2017-11-07 11:54:10 +0200 | [diff] [blame] | 108 | licenseModelOverviewActionHelper.selectVLMListView(dispatch, {buttonTab: null}); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 109 | }); |
| 110 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 111 | navigateToLicenseAgreements(dispatch, {licenseModelId, version}) { |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 112 | LicenseAgreementActionHelper.fetchLicenseAgreementList(dispatch, {licenseModelId, version}); |
| 113 | LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 114 | setCurrentScreen(dispatch, enums.SCREEN.LICENSE_AGREEMENTS, {licenseModelId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 115 | }); |
| 116 | }, |
| 117 | |
| 118 | navigateToFeatureGroups(dispatch, {licenseModelId, version}) { |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 119 | FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {licenseModelId, version}); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 120 | setCurrentScreen(dispatch, enums.SCREEN.FEATURE_GROUPS, {licenseModelId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 121 | }, |
| 122 | |
| 123 | navigateToEntitlementPools(dispatch, {licenseModelId, version}) { |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 124 | EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version}); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 125 | setCurrentScreen(dispatch, enums.SCREEN.ENTITLEMENT_POOLS, {licenseModelId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 126 | }, |
| 127 | |
| 128 | navigateToLicenseKeyGroups(dispatch, {licenseModelId, version}) { |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 129 | LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version}); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 130 | setCurrentScreen(dispatch, enums.SCREEN.LICENSE_KEY_GROUPS, {licenseModelId, version}); |
| 131 | }, |
| 132 | |
| 133 | navigateToLicenseModelActivityLog(dispatch, {licenseModelId, version}){ |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 134 | ActivityLogActionHelper.fetchActivityLog(dispatch, {itemId: licenseModelId, versionId: version.id}); |
| 135 | setCurrentScreen(dispatch, enums.SCREEN.ACTIVITY_LOG, {licenseModelId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 136 | }, |
| 137 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 138 | navigateToSoftwareProductLandingPage(dispatch, {softwareProductId, version}) { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 139 | SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 140 | SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {softwareProductId, version}).then(response => { |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 141 | let {vendorId: licenseModelId, licensingVersion} = response[0]; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 142 | SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {licenseModelId, licensingVersion}); |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 143 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version: version}); |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 144 | if(response[0].onboardingOrigin === onboardingOriginTypes.ZIP) { |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 145 | SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version: version}); |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 146 | } |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 147 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {softwareProductId, licenseModelId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 148 | }); |
| 149 | }, |
| 150 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 151 | navigateToSoftwareProductDetails(dispatch, {softwareProductId, version}) { |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 152 | SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {softwareProductId, version}).then(response => { |
| 153 | let {vendorId: licenseModelId, licensingVersion} = response[0]; |
| 154 | SoftwareProductActionHelper.loadLicensingVersionsList(dispatch, {licenseModelId}); |
| 155 | SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {licenseModelId, licensingVersion}); |
| 156 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, {softwareProductId, version}); |
| 157 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 158 | }, |
| 159 | |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 160 | navigateToSoftwareProductAttachmentsSetupTab(dispatch, {softwareProductId, version}) { |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 161 | SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version}); |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 162 | SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {activeTab: attachmentsTabsMapping.SETUP}); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 163 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {softwareProductId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 164 | }, |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 165 | navigateToSoftwareProductAttachmentsValidationTab(dispatch, {softwareProductId, version}) { |
| 166 | SoftwareProductActionHelper.processAndValidateHeatCandidate(dispatch, {softwareProductId, version}).then(() => { |
| 167 | SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {activeTab: attachmentsTabsMapping.VALIDATION}); |
| 168 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {softwareProductId, version}); |
| 169 | }); |
| 170 | }, |
| 171 | |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 172 | navigateToSoftwareProductProcesses(dispatch, {softwareProductId, version}) { |
| 173 | if (softwareProductId) { |
| 174 | SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, {softwareProductId, version}); |
| 175 | } |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 176 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, {softwareProductId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 177 | }, |
| 178 | |
| 179 | navigateToSoftwareProductNetworks(dispatch, {softwareProductId, version}) { |
| 180 | if (softwareProductId) { |
| 181 | SoftwareProductNetworksActionHelper.fetchNetworksList(dispatch, {softwareProductId, version}); |
| 182 | } |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 183 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, {softwareProductId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 184 | }, |
| 185 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 186 | navigateToSoftwareProductDependencies(dispatch, {softwareProductId, version}) { |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 187 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version}).then(result => { |
| 188 | if(result.listCount >= 2) { |
| 189 | SoftwareProductDependenciesActionHelper.fetchDependencies(dispatch, {softwareProductId, version}); |
| 190 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES, {softwareProductId, version}); |
| 191 | } |
| 192 | else { |
| 193 | this.navigateToSoftwareProductLandingPage(dispatch, {softwareProductId, version}); |
| 194 | } |
| 195 | }); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 196 | }, |
| 197 | |
| 198 | navigateToSoftwareProductComponents(dispatch, {softwareProductId, version}) { |
| 199 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version}); |
| 200 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, {softwareProductId, version}); |
| 201 | }, |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 202 | navigateToSoftwareProductDeployment(dispatch, {softwareProductId, version}) { |
| 203 | SoftwareProductDeploymentActionHelper.fetchDeploymentFlavorsList(dispatch, {softwareProductId, version}); |
| 204 | ComputeFlavorActionHelper.fetchComputesListForVSP(dispatch, {softwareProductId, version}); |
| 205 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, {softwareProductId, version}); |
| 206 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 207 | navigateToSoftwareProductActivityLog(dispatch, {softwareProductId, version}){ |
| 208 | ActivityLogActionHelper.fetchActivityLog(dispatch, {itemId: softwareProductId, versionId: version.id}); |
| 209 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, {softwareProductId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 210 | }, |
| 211 | |
| 212 | navigateToSoftwareProductComponentProcesses(dispatch, {softwareProductId, componentId, version}) { |
| 213 | if (componentId && softwareProductId) { |
| 214 | SoftwareProductComponentProcessesActionHelper.fetchProcessesList(dispatch, {componentId, softwareProductId, version}); |
| 215 | } |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 216 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES, {softwareProductId, componentId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 217 | }, |
| 218 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 219 | navigateToSoftwareProductComponentMonitoring(dispatch, {softwareProductId, version, componentId}){ |
| 220 | if (componentId && softwareProductId && version) { |
| 221 | SoftwareProductComponentsMonitoringAction.fetchExistingFiles(dispatch, {componentId, softwareProductId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 222 | } |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 223 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING, {softwareProductId, componentId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 224 | }, |
| 225 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 226 | navigateToComponentStorage(dispatch, {softwareProductId, componentId, version}) { |
| 227 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version}); |
| 228 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE, {softwareProductId, version, componentId}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 229 | }, |
| 230 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 231 | navigateToComponentCompute(dispatch, {softwareProductId, componentId, version}) { |
| 232 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version}); |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 233 | if (componentId && softwareProductId) { |
| 234 | ComputeFlavorActionHelper.fetchComputesList(dispatch, {softwareProductId, componentId, version}); |
| 235 | } |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 236 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE, {softwareProductId, version, componentId}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 237 | }, |
| 238 | |
| 239 | navigateToComponentNetwork(dispatch, {softwareProductId, componentId, version}) { |
| 240 | SoftwareProductComponentsNetworkActionHelper.fetchNICsList(dispatch, {softwareProductId, componentId, version}); |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 241 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK, {softwareProductId, version, componentId}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 242 | }, |
| 243 | |
| 244 | navigateToSoftwareProductComponentGeneral(dispatch, {softwareProductId, componentId, version}) { |
| 245 | if (componentId && softwareProductId) { |
| 246 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 247 | } |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 248 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL, {softwareProductId, version, componentId}); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 249 | }, |
| 250 | |
| 251 | navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(dispatch, {softwareProductId, componentId, version}) { |
| 252 | this.navigateToSoftwareProductComponentGeneral(dispatch, {softwareProductId, componentId, version}); |
| 253 | dispatch({ |
| 254 | type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM, |
| 255 | mapOfExpandedIds: { |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 256 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true, |
| 257 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS + '|' + componentId]: true |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 258 | } |
| 259 | }); |
| 260 | }, |
| 261 | |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 262 | navigateToComponentLoadBalancing(dispatch, {softwareProductId, componentId, version}) { |
| 263 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version}); |
| 264 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING, {softwareProductId, version, componentId}); |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 265 | }, |
| 266 | |
| 267 | navigateToComponentImages(dispatch, {softwareProductId, componentId, version}) { |
| 268 | SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, { |
| 269 | softwareProductId, |
| 270 | componentId, |
| 271 | version |
| 272 | }); |
| 273 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES, {softwareProductId, version, componentId}); |
az2497 | 644017c | 2017-08-10 17:49:40 +0300 | [diff] [blame] | 274 | }, |
| 275 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 276 | navigateToVersionsPage(dispatch, {itemType, itemId, itemName, additionalProps, users}) { |
| 277 | PermissionsActionHelper.fetchItemUsers(dispatch, {itemId, allUsers: users}); |
| 278 | VersionsPageActionHelper.selectNone(dispatch); |
| 279 | VersionsPageActionHelper.fetchVersions(dispatch, {itemType, itemId}).then(() => { |
| 280 | setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, {itemType, itemId, itemName, additionalProps}); |
| 281 | }); |
| 282 | }, |
| 283 | |
| 284 | checkMergeStatus(dispatch, {itemId, versionId, version}) { |
| 285 | return ItemsHelper.fetchVersion({itemId, versionId}).then(response => { |
| 286 | let state = response && response.state || {}; |
| 287 | let {synchronizationState} = state; |
| 288 | // let inMerge = synchronizationState === SyncStates.MERGE; |
| 289 | MergeEditorActionHelper.fetchConflicts(dispatch, {itemId, version}).then(data => { |
| 290 | dispatch({ |
| 291 | type: actionTypes.CHECK_MERGE_STATUS, |
| 292 | synchronizationState, |
| 293 | conflictInfoList: data.conflictInfoList |
| 294 | }); |
| 295 | }); |
| 296 | }); |
| 297 | }, |
| 298 | |
| 299 | forceBreadCrumbsUpdate(dispatch) { |
| 300 | dispatch({ |
| 301 | type: actionTypes.SET_CURRENT_SCREEN, |
| 302 | currentScreen: { |
| 303 | forceBreadCrumbsUpdate: true |
| 304 | } |
| 305 | }); |
| 306 | }, |
| 307 | |
az2497 | 644017c | 2017-08-10 17:49:40 +0300 | [diff] [blame] | 308 | updateCurrentScreenVersion(dispatch, version) { |
| 309 | dispatch({ |
| 310 | type: actionTypes.SET_CURRENT_SCREEN_VERSION, |
| 311 | version |
| 312 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 313 | } |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 314 | }; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 315 | |
| 316 | export default OnboardingActionHelper; |