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