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