svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 1 | /* |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 2 | * Copyright © 2016-2018 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 |
Yarin Dekel | 811fb48 | 2018-11-04 15:00:34 +0200 | [diff] [blame] | 7 | * |
svishnev | 1eb66b7 | 2018-01-11 14:39:45 +0200 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Yarin Dekel | 811fb48 | 2018-11-04 15:00:34 +0200 | [diff] [blame] | 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'; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 34 | import MergeEditorActionHelper from 'sdc-app/common/merge/MergeEditorActionHelper.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 35 | import SoftwareProductComponentsMonitoringAction from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringActionHelper.js'; |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 36 | import { actionTypes, enums } from './OnboardingConstants.js'; |
| 37 | import { |
| 38 | actionTypes as SoftwareProductActionTypes, |
| 39 | onboardingOriginTypes |
| 40 | } from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 41 | import ActivityLogActionHelper from 'sdc-app/common/activity-log/ActivityLogActionHelper.js'; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 42 | import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js'; |
| 43 | import SoftwareProductComponentsImageActionHelper from './softwareProduct/components/images/SoftwareProductComponentsImageActionHelper.js'; |
Michael Lando | 4d97d5f | 2017-06-17 22:40:44 +0300 | [diff] [blame] | 44 | import licenseModelOverviewActionHelper from 'sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js'; |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 45 | import { tabsMapping as attachmentsTabsMapping } from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js'; |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 46 | import SoftwareProductAttachmentsActionHelper from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js'; |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 47 | import { actionTypes as filterActionTypes } from './onboard/filter/FilterConstants.js'; |
| 48 | import FeaturesActionHelper from 'sdc-app/features/FeaturesActionHelper.js'; |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 49 | import { notificationActions } from 'nfvo-components/notification/NotificationsConstants.js'; |
| 50 | import i18n from 'nfvo-utils/i18n/i18n.js'; |
Vodafone | 804ec68 | 2019-03-18 15:46:53 +0530 | [diff] [blame] | 51 | import SoftwareProductValidationActionHelper from './softwareProduct/validation/SoftwareProductValidationActionHelper.js'; |
| 52 | import { actionTypes as modalActionTypes } from 'nfvo-components/modal/GlobalModalConstants.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 53 | |
| 54 | function setCurrentScreen(dispatch, screen, props = {}) { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 55 | dispatch({ |
| 56 | type: actionTypes.SET_CURRENT_SCREEN, |
| 57 | currentScreen: { |
| 58 | screen, |
| 59 | props, |
| 60 | forceBreadCrumbsUpdate: true |
| 61 | } |
| 62 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 63 | } |
| 64 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 65 | export function updateCurrentScreenProps(dispatch, props = {}) { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 66 | dispatch({ |
| 67 | type: actionTypes.UPDATE_CURRENT_SCREEN_PROPS, |
| 68 | props |
| 69 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 70 | } |
| 71 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 72 | const OnboardingActionHelper = { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 73 | loadItemsLists(dispatch) { |
| 74 | LicenseModelActionHelper.fetchLicenseModels(dispatch); |
| 75 | LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch); |
| 76 | LicenseModelActionHelper.fetchArchivedLicenseModels(dispatch); |
| 77 | SoftwareProductActionHelper.fetchSoftwareProductList(dispatch); |
| 78 | SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(dispatch); |
| 79 | SoftwareProductActionHelper.fetchArchivedSoftwareProductList(dispatch); |
| 80 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 81 | |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 82 | async navigateToOnboardingCatalog(dispatch) { |
| 83 | await FeaturesActionHelper.getFeaturesList(dispatch); |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 84 | UsersActionHelper.fetchUsersList(dispatch); |
| 85 | this.loadItemsLists(dispatch); |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 86 | setCurrentScreen(dispatch, enums.SCREEN.ONBOARDING_CATALOG); |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 87 | dispatch({ |
| 88 | type: filterActionTypes.FILTER_DATA_CHANGED, |
| 89 | deltaData: {} |
| 90 | }); |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 91 | }, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 92 | |
Vodafone | 804ec68 | 2019-03-18 15:46:53 +0530 | [diff] [blame] | 93 | saveIsValidationDisabled(dispatch, { isValidationDisabled }) { |
| 94 | SoftwareProductValidationActionHelper.setIsVspValidationDisabled( |
| 95 | dispatch, |
| 96 | { isValidationDisabled } |
| 97 | ); |
| 98 | }, |
| 99 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 100 | autoSaveBeforeNavigate( |
| 101 | dispatch, |
| 102 | { softwareProductId, version, vspComponentId, dataToSave } |
| 103 | ) { |
| 104 | if (softwareProductId) { |
| 105 | if (vspComponentId) { |
| 106 | return SoftwareProductComponentsActionHelper.updateSoftwareProductComponent( |
| 107 | dispatch, |
| 108 | { |
| 109 | softwareProductId, |
| 110 | version, |
| 111 | vspComponentId, |
| 112 | componentData: dataToSave.componentData, |
| 113 | qdata: dataToSave.qdata |
| 114 | } |
| 115 | ); |
| 116 | } |
| 117 | return SoftwareProductActionHelper.updateSoftwareProduct(dispatch, { |
| 118 | softwareProduct: dataToSave.softwareProduct, |
| 119 | version, |
| 120 | qdata: dataToSave.qdata |
| 121 | }); |
| 122 | } |
| 123 | return Promise.resolve(); |
| 124 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 125 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 126 | navigateToLicenseModelOverview( |
| 127 | dispatch, |
| 128 | { licenseModelId, version, status } |
| 129 | ) { |
| 130 | /** |
| 131 | * TODO change to specific rest |
| 132 | */ |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 133 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 134 | LicenseModelActionHelper.fetchLicenseModelById(dispatch, { |
| 135 | licenseModelId, |
| 136 | version |
| 137 | }).then(() => { |
| 138 | LicenseModelActionHelper.fetchLicenseModelItems(dispatch, { |
| 139 | licenseModelId, |
| 140 | version |
| 141 | }).then(() => { |
| 142 | setCurrentScreen( |
| 143 | dispatch, |
| 144 | enums.SCREEN.LICENSE_MODEL_OVERVIEW, |
| 145 | { licenseModelId, version, status } |
| 146 | ); |
| 147 | }); |
| 148 | licenseModelOverviewActionHelper.selectVLMListView(dispatch, { |
| 149 | buttonTab: null |
| 150 | }); |
| 151 | }); |
| 152 | }, |
| 153 | navigateToLicenseAgreements(dispatch, { licenseModelId, version, status }) { |
| 154 | LicenseAgreementActionHelper.fetchLicenseAgreementList(dispatch, { |
| 155 | licenseModelId, |
| 156 | version |
| 157 | }); |
| 158 | LicenseModelActionHelper.fetchLicenseModelById(dispatch, { |
| 159 | licenseModelId, |
| 160 | version |
| 161 | }).then(() => { |
| 162 | setCurrentScreen(dispatch, enums.SCREEN.LICENSE_AGREEMENTS, { |
| 163 | licenseModelId, |
| 164 | version, |
| 165 | status |
| 166 | }); |
| 167 | }); |
| 168 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 169 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 170 | navigateToFeatureGroups(dispatch, { licenseModelId, version, status }) { |
| 171 | FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, { |
| 172 | licenseModelId, |
| 173 | version |
| 174 | }); |
| 175 | setCurrentScreen(dispatch, enums.SCREEN.FEATURE_GROUPS, { |
| 176 | licenseModelId, |
| 177 | version, |
| 178 | status |
| 179 | }); |
| 180 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 181 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 182 | navigateToEntitlementPools(dispatch, { licenseModelId, version, status }) { |
| 183 | EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, { |
| 184 | licenseModelId, |
| 185 | version |
| 186 | }); |
| 187 | setCurrentScreen(dispatch, enums.SCREEN.ENTITLEMENT_POOLS, { |
| 188 | licenseModelId, |
| 189 | version, |
| 190 | status |
| 191 | }); |
| 192 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 193 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 194 | navigateToLicenseKeyGroups(dispatch, { licenseModelId, version, status }) { |
| 195 | LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, { |
| 196 | licenseModelId, |
| 197 | version |
| 198 | }); |
| 199 | setCurrentScreen(dispatch, enums.SCREEN.LICENSE_KEY_GROUPS, { |
| 200 | licenseModelId, |
| 201 | version, |
| 202 | status |
| 203 | }); |
| 204 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 205 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 206 | navigateToLicenseModelActivityLog( |
| 207 | dispatch, |
| 208 | { licenseModelId, version, status } |
| 209 | ) { |
| 210 | ActivityLogActionHelper.fetchActivityLog(dispatch, { |
| 211 | itemId: licenseModelId, |
| 212 | versionId: version.id |
| 213 | }); |
| 214 | setCurrentScreen(dispatch, enums.SCREEN.ACTIVITY_LOG, { |
| 215 | licenseModelId, |
| 216 | version, |
| 217 | status |
| 218 | }); |
| 219 | }, |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 220 | async getUpdatedSoftwareProduct(dispatch, { softwareProductId, version }) { |
| 221 | const response = await SoftwareProductActionHelper.fetchSoftwareProduct( |
| 222 | dispatch, |
| 223 | { |
| 224 | softwareProductId, |
| 225 | version |
| 226 | } |
| 227 | ); |
| 228 | let newResponse = false; |
| 229 | let newVersion = false; |
| 230 | // checking if there was healing and a new version should be open |
| 231 | if (response[0].version !== version.id) { |
| 232 | newResponse = await SoftwareProductActionHelper.fetchSoftwareProduct( |
| 233 | dispatch, |
| 234 | { |
| 235 | softwareProductId, |
| 236 | version: { ...version, id: response[0].version } |
| 237 | } |
| 238 | ); |
| 239 | newVersion = await ItemsHelper.fetchVersion({ |
| 240 | itemId: softwareProductId, |
| 241 | versionId: response[0].version |
| 242 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 243 | |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 244 | dispatch( |
| 245 | notificationActions.showInfo({ |
| 246 | message: i18n( |
| 247 | 'This is the current version of the VSP, as a result of healing' |
| 248 | ) |
| 249 | }) |
| 250 | ); |
| 251 | } |
| 252 | return Promise.resolve( |
| 253 | newResponse |
| 254 | ? { softwareProduct: newResponse[0], newVersion } |
| 255 | : { softwareProduct: response[0], newVersion: version } |
| 256 | ); |
| 257 | }, |
| 258 | async navigateToSoftwareProductLandingPage( |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 259 | dispatch, |
| 260 | { softwareProductId, version, status } |
| 261 | ) { |
| 262 | SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch); |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 263 | /** |
| 264 | * TODO remove when Filter toggle will be removed |
| 265 | */ |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 266 | LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch); |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 267 | |
| 268 | const { |
| 269 | softwareProduct, |
| 270 | newVersion |
| 271 | } = await this.getUpdatedSoftwareProduct(dispatch, { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 272 | softwareProductId, |
| 273 | version |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 274 | }); |
| 275 | |
| 276 | let { vendorId: licenseModelId, licensingVersion } = softwareProduct; |
| 277 | SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, { |
| 278 | licenseModelId, |
| 279 | licensingVersion |
| 280 | }); |
| 281 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents( |
| 282 | dispatch, |
| 283 | { softwareProductId, version: newVersion } |
| 284 | ); |
| 285 | if (softwareProduct.onboardingOrigin === onboardingOriginTypes.ZIP) { |
| 286 | SoftwareProductActionHelper.loadSoftwareProductHeatCandidate( |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 287 | dispatch, |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 288 | { softwareProductId, version: newVersion } |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 289 | ); |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 290 | } |
| 291 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, { |
| 292 | softwareProductId, |
| 293 | licenseModelId, |
| 294 | version: newVersion, |
| 295 | status |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 296 | }); |
| 297 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 298 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 299 | navigateToSoftwareProductDetails( |
| 300 | dispatch, |
| 301 | { softwareProductId, version, status } |
| 302 | ) { |
| 303 | SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, { |
| 304 | softwareProductId, |
| 305 | version |
| 306 | }).then(response => { |
| 307 | let { vendorId: licenseModelId, licensingVersion } = response[0]; |
| 308 | SoftwareProductActionHelper.loadLicensingVersionsList(dispatch, { |
| 309 | licenseModelId |
| 310 | }); |
| 311 | SoftwareProductActionHelper.loadSoftwareProductDetailsData( |
| 312 | dispatch, |
| 313 | { licenseModelId, licensingVersion } |
| 314 | ); |
| 315 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, { |
| 316 | softwareProductId, |
| 317 | version, |
| 318 | status |
| 319 | }); |
| 320 | }); |
| 321 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 322 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 323 | navigateToSoftwareProductAttachmentsSetupTab( |
| 324 | dispatch, |
| 325 | { softwareProductId, version, status } |
| 326 | ) { |
| 327 | SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, { |
| 328 | softwareProductId, |
| 329 | version |
| 330 | }); |
| 331 | SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, { |
| 332 | activeTab: attachmentsTabsMapping.SETUP |
| 333 | }); |
| 334 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, { |
| 335 | softwareProductId, |
| 336 | version, |
| 337 | status |
| 338 | }); |
| 339 | }, |
| 340 | navigateToSoftwareProductAttachmentsValidationTab( |
| 341 | dispatch, |
| 342 | { softwareProductId, version, status } |
| 343 | ) { |
| 344 | SoftwareProductActionHelper.processAndValidateHeatCandidate(dispatch, { |
| 345 | softwareProductId, |
| 346 | version |
| 347 | }).then(() => { |
| 348 | SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, { |
| 349 | activeTab: attachmentsTabsMapping.VALIDATION |
| 350 | }); |
| 351 | setCurrentScreen( |
| 352 | dispatch, |
| 353 | enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, |
| 354 | { softwareProductId, version, status } |
| 355 | ); |
| 356 | }); |
| 357 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 358 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 359 | navigateToSoftwareProductProcesses( |
| 360 | dispatch, |
| 361 | { softwareProductId, version, status } |
| 362 | ) { |
| 363 | if (softwareProductId) { |
| 364 | SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, { |
| 365 | softwareProductId, |
| 366 | version |
| 367 | }); |
| 368 | } |
| 369 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, { |
| 370 | softwareProductId, |
| 371 | version, |
| 372 | status |
| 373 | }); |
| 374 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 375 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 376 | navigateToSoftwareProductNetworks( |
| 377 | dispatch, |
| 378 | { softwareProductId, version, status } |
| 379 | ) { |
| 380 | if (softwareProductId) { |
| 381 | SoftwareProductNetworksActionHelper.fetchNetworksList(dispatch, { |
| 382 | softwareProductId, |
| 383 | version |
| 384 | }); |
| 385 | } |
| 386 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, { |
| 387 | softwareProductId, |
| 388 | version, |
| 389 | status |
| 390 | }); |
| 391 | }, |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 392 | |
Vodafone | 804ec68 | 2019-03-18 15:46:53 +0530 | [diff] [blame] | 393 | navigateToSoftwareProductValidation( |
| 394 | dispatch, |
| 395 | { softwareProductId, version, status } |
| 396 | ) { |
| 397 | SoftwareProductValidationActionHelper.fetchVspChecks(dispatch) |
| 398 | .then(() => { |
| 399 | SoftwareProductValidationActionHelper.setCertificationChecked( |
| 400 | dispatch, |
| 401 | [] |
| 402 | ); |
| 403 | SoftwareProductValidationActionHelper.setComplianceChecked( |
| 404 | dispatch, |
| 405 | [] |
| 406 | ); |
| 407 | setCurrentScreen( |
| 408 | dispatch, |
| 409 | enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION, |
| 410 | { |
| 411 | softwareProductId, |
| 412 | version, |
| 413 | status |
| 414 | } |
| 415 | ); |
| 416 | }) |
| 417 | .catch(error => { |
| 418 | dispatch({ |
| 419 | type: modalActionTypes.GLOBAL_MODAL_ERROR, |
| 420 | data: { |
| 421 | title: 'ERROR', |
| 422 | msg: error.responseJSON.message, |
| 423 | cancelButtonText: i18n('OK') |
| 424 | } |
| 425 | }); |
| 426 | }); |
| 427 | }, |
| 428 | |
| 429 | navigateToSoftwareProductValidationResults( |
| 430 | dispatch, |
| 431 | { softwareProductId, version, status } |
| 432 | ) { |
| 433 | setCurrentScreen( |
| 434 | dispatch, |
| 435 | enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION_RESULTS, |
| 436 | { softwareProductId, version, status } |
| 437 | ); |
| 438 | }, |
| 439 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 440 | navigateToSoftwareProductDependencies( |
| 441 | dispatch, |
| 442 | { softwareProductId, version, status } |
| 443 | ) { |
| 444 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents( |
| 445 | dispatch, |
| 446 | { softwareProductId, version } |
| 447 | ).then(result => { |
| 448 | if (result.listCount >= 2) { |
| 449 | SoftwareProductDependenciesActionHelper.fetchDependencies( |
| 450 | dispatch, |
| 451 | { softwareProductId, version } |
| 452 | ); |
| 453 | setCurrentScreen( |
| 454 | dispatch, |
| 455 | enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES, |
| 456 | { softwareProductId, version, status } |
| 457 | ); |
| 458 | } else { |
| 459 | this.navigateToSoftwareProductLandingPage(dispatch, { |
| 460 | softwareProductId, |
| 461 | version, |
| 462 | status |
| 463 | }); |
| 464 | } |
| 465 | }); |
| 466 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 467 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 468 | navigateToSoftwareProductComponents( |
| 469 | dispatch, |
| 470 | { softwareProductId, version, status } |
| 471 | ) { |
| 472 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents( |
| 473 | dispatch, |
| 474 | { softwareProductId, version } |
| 475 | ); |
| 476 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, { |
| 477 | softwareProductId, |
| 478 | version, |
| 479 | status |
| 480 | }); |
| 481 | }, |
| 482 | navigateToSoftwareProductDeployment( |
| 483 | dispatch, |
| 484 | { softwareProductId, version, status } |
| 485 | ) { |
| 486 | SoftwareProductDeploymentActionHelper.fetchDeploymentFlavorsList( |
| 487 | dispatch, |
| 488 | { softwareProductId, version } |
| 489 | ); |
| 490 | ComputeFlavorActionHelper.fetchComputesListForVSP(dispatch, { |
| 491 | softwareProductId, |
| 492 | version |
| 493 | }); |
| 494 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, { |
| 495 | softwareProductId, |
| 496 | version, |
| 497 | status |
| 498 | }); |
| 499 | }, |
| 500 | navigateToSoftwareProductActivityLog( |
| 501 | dispatch, |
| 502 | { softwareProductId, version, status } |
| 503 | ) { |
| 504 | ActivityLogActionHelper.fetchActivityLog(dispatch, { |
| 505 | itemId: softwareProductId, |
| 506 | versionId: version.id |
| 507 | }); |
| 508 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, { |
| 509 | softwareProductId, |
| 510 | version, |
| 511 | status |
| 512 | }); |
| 513 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 514 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 515 | navigateToSoftwareProductComponentProcesses( |
| 516 | dispatch, |
| 517 | { softwareProductId, componentId, version, status } |
| 518 | ) { |
| 519 | if (componentId && softwareProductId) { |
| 520 | SoftwareProductComponentProcessesActionHelper.fetchProcessesList( |
| 521 | dispatch, |
| 522 | { componentId, softwareProductId, version } |
| 523 | ); |
| 524 | } |
| 525 | setCurrentScreen( |
| 526 | dispatch, |
| 527 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES, |
| 528 | { softwareProductId, componentId, version, status } |
| 529 | ); |
| 530 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 531 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 532 | navigateToSoftwareProductComponentMonitoring( |
| 533 | dispatch, |
| 534 | { softwareProductId, version, componentId, status } |
| 535 | ) { |
| 536 | if (componentId && softwareProductId && version) { |
| 537 | SoftwareProductComponentsMonitoringAction.fetchExistingFiles( |
| 538 | dispatch, |
| 539 | { componentId, softwareProductId, version } |
| 540 | ); |
| 541 | } |
| 542 | setCurrentScreen( |
| 543 | dispatch, |
| 544 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING, |
| 545 | { softwareProductId, componentId, version, status } |
| 546 | ); |
| 547 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 548 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 549 | navigateToComponentStorage( |
| 550 | dispatch, |
| 551 | { softwareProductId, componentId, version, status } |
| 552 | ) { |
| 553 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 554 | dispatch, |
| 555 | { softwareProductId, vspComponentId: componentId, version } |
| 556 | ); |
| 557 | setCurrentScreen( |
| 558 | dispatch, |
| 559 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE, |
| 560 | { softwareProductId, version, componentId, status } |
| 561 | ); |
| 562 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 563 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 564 | navigateToComponentCompute( |
| 565 | dispatch, |
| 566 | { softwareProductId, componentId, version, status } |
| 567 | ) { |
| 568 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 569 | dispatch, |
| 570 | { softwareProductId, vspComponentId: componentId, version } |
| 571 | ); |
| 572 | if (componentId && softwareProductId) { |
| 573 | ComputeFlavorActionHelper.fetchComputesList(dispatch, { |
| 574 | softwareProductId, |
| 575 | componentId, |
| 576 | version |
| 577 | }); |
| 578 | } |
| 579 | setCurrentScreen( |
| 580 | dispatch, |
| 581 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE, |
| 582 | { softwareProductId, version, componentId, status } |
| 583 | ); |
| 584 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 585 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 586 | navigateToComponentNetwork( |
| 587 | dispatch, |
| 588 | { softwareProductId, componentId, version, status } |
| 589 | ) { |
| 590 | SoftwareProductComponentsNetworkActionHelper.fetchNICsList(dispatch, { |
| 591 | softwareProductId, |
| 592 | componentId, |
| 593 | version |
| 594 | }); |
| 595 | setCurrentScreen( |
| 596 | dispatch, |
| 597 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK, |
| 598 | { softwareProductId, version, componentId, status } |
| 599 | ); |
| 600 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 601 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 602 | navigateToSoftwareProductComponentGeneral( |
| 603 | dispatch, |
| 604 | { softwareProductId, componentId, version, status } |
| 605 | ) { |
| 606 | if (componentId && softwareProductId) { |
| 607 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 608 | dispatch, |
| 609 | { softwareProductId, vspComponentId: componentId, version } |
| 610 | ); |
| 611 | } |
| 612 | setCurrentScreen( |
| 613 | dispatch, |
| 614 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL, |
| 615 | { softwareProductId, version, componentId, status } |
| 616 | ); |
| 617 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 618 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 619 | navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel( |
| 620 | dispatch, |
| 621 | { softwareProductId, componentId, version, status } |
| 622 | ) { |
| 623 | this.navigateToSoftwareProductComponentGeneral(dispatch, { |
| 624 | softwareProductId, |
| 625 | componentId, |
| 626 | version, |
| 627 | status |
| 628 | }); |
| 629 | dispatch({ |
| 630 | type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM, |
| 631 | mapOfExpandedIds: { |
| 632 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true, |
| 633 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS + |
| 634 | '|' + |
| 635 | componentId]: true |
| 636 | } |
| 637 | }); |
| 638 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 639 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 640 | navigateToComponentLoadBalancing( |
| 641 | dispatch, |
| 642 | { softwareProductId, componentId, version, status } |
| 643 | ) { |
| 644 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 645 | dispatch, |
| 646 | { softwareProductId, vspComponentId: componentId, version } |
| 647 | ); |
| 648 | setCurrentScreen( |
| 649 | dispatch, |
| 650 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING, |
| 651 | { softwareProductId, version, componentId, status } |
| 652 | ); |
| 653 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 654 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 655 | navigateToComponentImages( |
| 656 | dispatch, |
| 657 | { softwareProductId, componentId, version, status } |
| 658 | ) { |
| 659 | SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, { |
| 660 | softwareProductId, |
| 661 | componentId, |
| 662 | version |
| 663 | }); |
| 664 | setCurrentScreen( |
| 665 | dispatch, |
| 666 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES, |
| 667 | { softwareProductId, version, componentId, status } |
| 668 | ); |
| 669 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 670 | |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 671 | async navigateToVersionsPage( |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 672 | dispatch, |
| 673 | { itemType, itemId, itemName, additionalProps, users } |
| 674 | ) { |
| 675 | PermissionsActionHelper.fetchItemUsers(dispatch, { |
| 676 | itemId, |
| 677 | allUsers: users |
| 678 | }); |
| 679 | VersionsPageActionHelper.selectNone(dispatch); |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 680 | await VersionsPageActionHelper.fetchVersions(dispatch, { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 681 | itemType, |
| 682 | itemId |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 683 | }); |
| 684 | const items = await ItemsHelper.fetchItem(itemId); |
| 685 | setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, { |
| 686 | status: items.status, |
| 687 | itemType, |
| 688 | itemId, |
| 689 | itemName, |
| 690 | vendorName: items.properties.vendorName, |
| 691 | vendorId: items.properties.vendorId, |
| 692 | additionalProps |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 693 | }); |
| 694 | }, |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 695 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 696 | checkMergeStatus(dispatch, { itemId, versionId, version }) { |
| 697 | return ItemsHelper.fetchVersion({ itemId, versionId }).then( |
| 698 | response => { |
| 699 | let state = (response && response.state) || {}; |
| 700 | let { synchronizationState } = state; |
| 701 | // let inMerge = synchronizationState === SyncStates.MERGE; |
| 702 | MergeEditorActionHelper.fetchConflicts(dispatch, { |
| 703 | itemId, |
| 704 | version |
| 705 | }).then(data => { |
| 706 | dispatch({ |
| 707 | type: actionTypes.CHECK_MERGE_STATUS, |
| 708 | synchronizationState, |
| 709 | conflictInfoList: data.conflictInfoList |
| 710 | }); |
| 711 | }); |
| 712 | } |
| 713 | ); |
| 714 | }, |
az2497 | 644017c | 2017-08-10 17:49:40 +0300 | [diff] [blame] | 715 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 716 | forceBreadCrumbsUpdate(dispatch) { |
| 717 | dispatch({ |
| 718 | type: actionTypes.SET_CURRENT_SCREEN, |
| 719 | currentScreen: { |
| 720 | forceBreadCrumbsUpdate: true |
| 721 | } |
| 722 | }); |
| 723 | }, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 724 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 725 | updateCurrentScreenVersion(dispatch, version) { |
| 726 | dispatch({ |
| 727 | type: actionTypes.SET_CURRENT_SCREEN_VERSION, |
| 728 | version |
| 729 | }); |
| 730 | } |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 731 | }; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 732 | |
| 733 | export default OnboardingActionHelper; |