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'; |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 37 | import { actionTypes, enums } from './OnboardingConstants.js'; |
| 38 | import { |
| 39 | actionTypes as SoftwareProductActionTypes, |
| 40 | onboardingOriginTypes |
| 41 | } from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 42 | import ActivityLogActionHelper from 'sdc-app/common/activity-log/ActivityLogActionHelper.js'; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 43 | import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js'; |
| 44 | import SoftwareProductComponentsImageActionHelper from './softwareProduct/components/images/SoftwareProductComponentsImageActionHelper.js'; |
Michael Lando | 4d97d5f | 2017-06-17 22:40:44 +0300 | [diff] [blame] | 45 | import licenseModelOverviewActionHelper from 'sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js'; |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 46 | import { tabsMapping as attachmentsTabsMapping } from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js'; |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 47 | import SoftwareProductAttachmentsActionHelper from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 48 | |
| 49 | function setCurrentScreen(dispatch, screen, props = {}) { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 50 | dispatch({ |
| 51 | type: actionTypes.SET_CURRENT_SCREEN, |
| 52 | currentScreen: { |
| 53 | screen, |
| 54 | props, |
| 55 | forceBreadCrumbsUpdate: true |
| 56 | } |
| 57 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 58 | } |
| 59 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 60 | export function updateCurrentScreenProps(dispatch, props = {}) { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 61 | dispatch({ |
| 62 | type: actionTypes.UPDATE_CURRENT_SCREEN_PROPS, |
| 63 | props |
| 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 | const OnboardingActionHelper = { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 68 | loadItemsLists(dispatch) { |
| 69 | LicenseModelActionHelper.fetchLicenseModels(dispatch); |
| 70 | LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch); |
| 71 | LicenseModelActionHelper.fetchArchivedLicenseModels(dispatch); |
| 72 | SoftwareProductActionHelper.fetchSoftwareProductList(dispatch); |
| 73 | SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(dispatch); |
| 74 | SoftwareProductActionHelper.fetchArchivedSoftwareProductList(dispatch); |
| 75 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 76 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 77 | navigateToOnboardingCatalog(dispatch) { |
| 78 | UsersActionHelper.fetchUsersList(dispatch); |
| 79 | this.loadItemsLists(dispatch); |
| 80 | OnboardActionHelper.resetOnboardStore(dispatch); |
| 81 | setCurrentScreen(dispatch, enums.SCREEN.ONBOARDING_CATALOG); |
| 82 | }, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 83 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 84 | autoSaveBeforeNavigate( |
| 85 | dispatch, |
| 86 | { softwareProductId, version, vspComponentId, dataToSave } |
| 87 | ) { |
| 88 | if (softwareProductId) { |
| 89 | if (vspComponentId) { |
| 90 | return SoftwareProductComponentsActionHelper.updateSoftwareProductComponent( |
| 91 | dispatch, |
| 92 | { |
| 93 | softwareProductId, |
| 94 | version, |
| 95 | vspComponentId, |
| 96 | componentData: dataToSave.componentData, |
| 97 | qdata: dataToSave.qdata |
| 98 | } |
| 99 | ); |
| 100 | } |
| 101 | return SoftwareProductActionHelper.updateSoftwareProduct(dispatch, { |
| 102 | softwareProduct: dataToSave.softwareProduct, |
| 103 | version, |
| 104 | qdata: dataToSave.qdata |
| 105 | }); |
| 106 | } |
| 107 | return Promise.resolve(); |
| 108 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 109 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 110 | navigateToLicenseModelOverview( |
| 111 | dispatch, |
| 112 | { licenseModelId, version, status } |
| 113 | ) { |
| 114 | /** |
| 115 | * TODO change to specific rest |
| 116 | */ |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 117 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 118 | LicenseModelActionHelper.fetchLicenseModelById(dispatch, { |
| 119 | licenseModelId, |
| 120 | version |
| 121 | }).then(() => { |
| 122 | LicenseModelActionHelper.fetchLicenseModelItems(dispatch, { |
| 123 | licenseModelId, |
| 124 | version |
| 125 | }).then(() => { |
| 126 | setCurrentScreen( |
| 127 | dispatch, |
| 128 | enums.SCREEN.LICENSE_MODEL_OVERVIEW, |
| 129 | { licenseModelId, version, status } |
| 130 | ); |
| 131 | }); |
| 132 | licenseModelOverviewActionHelper.selectVLMListView(dispatch, { |
| 133 | buttonTab: null |
| 134 | }); |
| 135 | }); |
| 136 | }, |
| 137 | navigateToLicenseAgreements(dispatch, { licenseModelId, version, status }) { |
| 138 | LicenseAgreementActionHelper.fetchLicenseAgreementList(dispatch, { |
| 139 | licenseModelId, |
| 140 | version |
| 141 | }); |
| 142 | LicenseModelActionHelper.fetchLicenseModelById(dispatch, { |
| 143 | licenseModelId, |
| 144 | version |
| 145 | }).then(() => { |
| 146 | setCurrentScreen(dispatch, enums.SCREEN.LICENSE_AGREEMENTS, { |
| 147 | licenseModelId, |
| 148 | version, |
| 149 | status |
| 150 | }); |
| 151 | }); |
| 152 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 153 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 154 | navigateToFeatureGroups(dispatch, { licenseModelId, version, status }) { |
| 155 | FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, { |
| 156 | licenseModelId, |
| 157 | version |
| 158 | }); |
| 159 | setCurrentScreen(dispatch, enums.SCREEN.FEATURE_GROUPS, { |
| 160 | licenseModelId, |
| 161 | version, |
| 162 | status |
| 163 | }); |
| 164 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 165 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 166 | navigateToEntitlementPools(dispatch, { licenseModelId, version, status }) { |
| 167 | EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, { |
| 168 | licenseModelId, |
| 169 | version |
| 170 | }); |
| 171 | setCurrentScreen(dispatch, enums.SCREEN.ENTITLEMENT_POOLS, { |
| 172 | licenseModelId, |
| 173 | version, |
| 174 | status |
| 175 | }); |
| 176 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 177 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 178 | navigateToLicenseKeyGroups(dispatch, { licenseModelId, version, status }) { |
| 179 | LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, { |
| 180 | licenseModelId, |
| 181 | version |
| 182 | }); |
| 183 | setCurrentScreen(dispatch, enums.SCREEN.LICENSE_KEY_GROUPS, { |
| 184 | licenseModelId, |
| 185 | version, |
| 186 | status |
| 187 | }); |
| 188 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 189 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 190 | navigateToLicenseModelActivityLog( |
| 191 | dispatch, |
| 192 | { licenseModelId, version, status } |
| 193 | ) { |
| 194 | ActivityLogActionHelper.fetchActivityLog(dispatch, { |
| 195 | itemId: licenseModelId, |
| 196 | versionId: version.id |
| 197 | }); |
| 198 | setCurrentScreen(dispatch, enums.SCREEN.ACTIVITY_LOG, { |
| 199 | licenseModelId, |
| 200 | version, |
| 201 | status |
| 202 | }); |
| 203 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 204 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 205 | navigateToSoftwareProductLandingPage( |
| 206 | dispatch, |
| 207 | { softwareProductId, version, status } |
| 208 | ) { |
| 209 | SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch); |
| 210 | SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, { |
| 211 | softwareProductId, |
| 212 | version |
| 213 | }).then(response => { |
| 214 | let { vendorId: licenseModelId, licensingVersion } = response[0]; |
| 215 | SoftwareProductActionHelper.loadSoftwareProductDetailsData( |
| 216 | dispatch, |
| 217 | { licenseModelId, licensingVersion } |
| 218 | ); |
| 219 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents( |
| 220 | dispatch, |
| 221 | { softwareProductId, version: version } |
| 222 | ); |
| 223 | if (response[0].onboardingOrigin === onboardingOriginTypes.ZIP) { |
| 224 | SoftwareProductActionHelper.loadSoftwareProductHeatCandidate( |
| 225 | dispatch, |
| 226 | { softwareProductId, version: version } |
| 227 | ); |
| 228 | } |
| 229 | setCurrentScreen( |
| 230 | dispatch, |
| 231 | enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, |
| 232 | { softwareProductId, licenseModelId, version, status } |
| 233 | ); |
| 234 | }); |
| 235 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 236 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 237 | navigateToSoftwareProductDetails( |
| 238 | dispatch, |
| 239 | { softwareProductId, version, status } |
| 240 | ) { |
| 241 | SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, { |
| 242 | softwareProductId, |
| 243 | version |
| 244 | }).then(response => { |
| 245 | let { vendorId: licenseModelId, licensingVersion } = response[0]; |
| 246 | SoftwareProductActionHelper.loadLicensingVersionsList(dispatch, { |
| 247 | licenseModelId |
| 248 | }); |
| 249 | SoftwareProductActionHelper.loadSoftwareProductDetailsData( |
| 250 | dispatch, |
| 251 | { licenseModelId, licensingVersion } |
| 252 | ); |
| 253 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, { |
| 254 | softwareProductId, |
| 255 | version, |
| 256 | status |
| 257 | }); |
| 258 | }); |
| 259 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 260 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 261 | navigateToSoftwareProductAttachmentsSetupTab( |
| 262 | dispatch, |
| 263 | { softwareProductId, version, status } |
| 264 | ) { |
| 265 | SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, { |
| 266 | softwareProductId, |
| 267 | version |
| 268 | }); |
| 269 | SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, { |
| 270 | activeTab: attachmentsTabsMapping.SETUP |
| 271 | }); |
| 272 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, { |
| 273 | softwareProductId, |
| 274 | version, |
| 275 | status |
| 276 | }); |
| 277 | }, |
| 278 | navigateToSoftwareProductAttachmentsValidationTab( |
| 279 | dispatch, |
| 280 | { softwareProductId, version, status } |
| 281 | ) { |
| 282 | SoftwareProductActionHelper.processAndValidateHeatCandidate(dispatch, { |
| 283 | softwareProductId, |
| 284 | version |
| 285 | }).then(() => { |
| 286 | SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, { |
| 287 | activeTab: attachmentsTabsMapping.VALIDATION |
| 288 | }); |
| 289 | setCurrentScreen( |
| 290 | dispatch, |
| 291 | enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, |
| 292 | { softwareProductId, version, status } |
| 293 | ); |
| 294 | }); |
| 295 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 296 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 297 | navigateToSoftwareProductProcesses( |
| 298 | dispatch, |
| 299 | { softwareProductId, version, status } |
| 300 | ) { |
| 301 | if (softwareProductId) { |
| 302 | SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, { |
| 303 | softwareProductId, |
| 304 | version |
| 305 | }); |
| 306 | } |
| 307 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, { |
| 308 | softwareProductId, |
| 309 | version, |
| 310 | status |
| 311 | }); |
| 312 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 313 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 314 | navigateToSoftwareProductNetworks( |
| 315 | dispatch, |
| 316 | { softwareProductId, version, status } |
| 317 | ) { |
| 318 | if (softwareProductId) { |
| 319 | SoftwareProductNetworksActionHelper.fetchNetworksList(dispatch, { |
| 320 | softwareProductId, |
| 321 | version |
| 322 | }); |
| 323 | } |
| 324 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, { |
| 325 | softwareProductId, |
| 326 | version, |
| 327 | status |
| 328 | }); |
| 329 | }, |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 330 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 331 | navigateToSoftwareProductDependencies( |
| 332 | dispatch, |
| 333 | { softwareProductId, version, status } |
| 334 | ) { |
| 335 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents( |
| 336 | dispatch, |
| 337 | { softwareProductId, version } |
| 338 | ).then(result => { |
| 339 | if (result.listCount >= 2) { |
| 340 | SoftwareProductDependenciesActionHelper.fetchDependencies( |
| 341 | dispatch, |
| 342 | { softwareProductId, version } |
| 343 | ); |
| 344 | setCurrentScreen( |
| 345 | dispatch, |
| 346 | enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES, |
| 347 | { softwareProductId, version, status } |
| 348 | ); |
| 349 | } else { |
| 350 | this.navigateToSoftwareProductLandingPage(dispatch, { |
| 351 | softwareProductId, |
| 352 | version, |
| 353 | status |
| 354 | }); |
| 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 | navigateToSoftwareProductComponents( |
| 360 | dispatch, |
| 361 | { softwareProductId, version, status } |
| 362 | ) { |
| 363 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents( |
| 364 | dispatch, |
| 365 | { softwareProductId, version } |
| 366 | ); |
| 367 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, { |
| 368 | softwareProductId, |
| 369 | version, |
| 370 | status |
| 371 | }); |
| 372 | }, |
| 373 | navigateToSoftwareProductDeployment( |
| 374 | dispatch, |
| 375 | { softwareProductId, version, status } |
| 376 | ) { |
| 377 | SoftwareProductDeploymentActionHelper.fetchDeploymentFlavorsList( |
| 378 | dispatch, |
| 379 | { softwareProductId, version } |
| 380 | ); |
| 381 | ComputeFlavorActionHelper.fetchComputesListForVSP(dispatch, { |
| 382 | softwareProductId, |
| 383 | version |
| 384 | }); |
| 385 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, { |
| 386 | softwareProductId, |
| 387 | version, |
| 388 | status |
| 389 | }); |
| 390 | }, |
| 391 | navigateToSoftwareProductActivityLog( |
| 392 | dispatch, |
| 393 | { softwareProductId, version, status } |
| 394 | ) { |
| 395 | ActivityLogActionHelper.fetchActivityLog(dispatch, { |
| 396 | itemId: softwareProductId, |
| 397 | versionId: version.id |
| 398 | }); |
| 399 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, { |
| 400 | softwareProductId, |
| 401 | version, |
| 402 | status |
| 403 | }); |
| 404 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 405 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 406 | navigateToSoftwareProductComponentProcesses( |
| 407 | dispatch, |
| 408 | { softwareProductId, componentId, version, status } |
| 409 | ) { |
| 410 | if (componentId && softwareProductId) { |
| 411 | SoftwareProductComponentProcessesActionHelper.fetchProcessesList( |
| 412 | dispatch, |
| 413 | { componentId, softwareProductId, version } |
| 414 | ); |
| 415 | } |
| 416 | setCurrentScreen( |
| 417 | dispatch, |
| 418 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES, |
| 419 | { softwareProductId, componentId, version, status } |
| 420 | ); |
| 421 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 422 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 423 | navigateToSoftwareProductComponentMonitoring( |
| 424 | dispatch, |
| 425 | { softwareProductId, version, componentId, status } |
| 426 | ) { |
| 427 | if (componentId && softwareProductId && version) { |
| 428 | SoftwareProductComponentsMonitoringAction.fetchExistingFiles( |
| 429 | dispatch, |
| 430 | { componentId, softwareProductId, version } |
| 431 | ); |
| 432 | } |
| 433 | setCurrentScreen( |
| 434 | dispatch, |
| 435 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING, |
| 436 | { softwareProductId, componentId, version, status } |
| 437 | ); |
| 438 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 439 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 440 | navigateToComponentStorage( |
| 441 | dispatch, |
| 442 | { softwareProductId, componentId, version, status } |
| 443 | ) { |
| 444 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 445 | dispatch, |
| 446 | { softwareProductId, vspComponentId: componentId, version } |
| 447 | ); |
| 448 | setCurrentScreen( |
| 449 | dispatch, |
| 450 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE, |
| 451 | { softwareProductId, version, componentId, status } |
| 452 | ); |
| 453 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 454 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 455 | navigateToComponentCompute( |
| 456 | dispatch, |
| 457 | { softwareProductId, componentId, version, status } |
| 458 | ) { |
| 459 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 460 | dispatch, |
| 461 | { softwareProductId, vspComponentId: componentId, version } |
| 462 | ); |
| 463 | if (componentId && softwareProductId) { |
| 464 | ComputeFlavorActionHelper.fetchComputesList(dispatch, { |
| 465 | softwareProductId, |
| 466 | componentId, |
| 467 | version |
| 468 | }); |
| 469 | } |
| 470 | setCurrentScreen( |
| 471 | dispatch, |
| 472 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE, |
| 473 | { softwareProductId, version, componentId, status } |
| 474 | ); |
| 475 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 476 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 477 | navigateToComponentNetwork( |
| 478 | dispatch, |
| 479 | { softwareProductId, componentId, version, status } |
| 480 | ) { |
| 481 | SoftwareProductComponentsNetworkActionHelper.fetchNICsList(dispatch, { |
| 482 | softwareProductId, |
| 483 | componentId, |
| 484 | version |
| 485 | }); |
| 486 | setCurrentScreen( |
| 487 | dispatch, |
| 488 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK, |
| 489 | { softwareProductId, version, componentId, status } |
| 490 | ); |
| 491 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 492 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 493 | navigateToSoftwareProductComponentGeneral( |
| 494 | dispatch, |
| 495 | { softwareProductId, componentId, version, status } |
| 496 | ) { |
| 497 | if (componentId && softwareProductId) { |
| 498 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 499 | dispatch, |
| 500 | { softwareProductId, vspComponentId: componentId, version } |
| 501 | ); |
| 502 | } |
| 503 | setCurrentScreen( |
| 504 | dispatch, |
| 505 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL, |
| 506 | { softwareProductId, version, componentId, status } |
| 507 | ); |
| 508 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 509 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 510 | navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel( |
| 511 | dispatch, |
| 512 | { softwareProductId, componentId, version, status } |
| 513 | ) { |
| 514 | this.navigateToSoftwareProductComponentGeneral(dispatch, { |
| 515 | softwareProductId, |
| 516 | componentId, |
| 517 | version, |
| 518 | status |
| 519 | }); |
| 520 | dispatch({ |
| 521 | type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM, |
| 522 | mapOfExpandedIds: { |
| 523 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true, |
| 524 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS + |
| 525 | '|' + |
| 526 | componentId]: true |
| 527 | } |
| 528 | }); |
| 529 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 530 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 531 | navigateToComponentLoadBalancing( |
| 532 | dispatch, |
| 533 | { softwareProductId, componentId, version, status } |
| 534 | ) { |
| 535 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 536 | dispatch, |
| 537 | { softwareProductId, vspComponentId: componentId, version } |
| 538 | ); |
| 539 | setCurrentScreen( |
| 540 | dispatch, |
| 541 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING, |
| 542 | { softwareProductId, version, componentId, status } |
| 543 | ); |
| 544 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 545 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 546 | navigateToComponentImages( |
| 547 | dispatch, |
| 548 | { softwareProductId, componentId, version, status } |
| 549 | ) { |
| 550 | SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, { |
| 551 | softwareProductId, |
| 552 | componentId, |
| 553 | version |
| 554 | }); |
| 555 | setCurrentScreen( |
| 556 | dispatch, |
| 557 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES, |
| 558 | { softwareProductId, version, componentId, status } |
| 559 | ); |
| 560 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 561 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 562 | navigateToVersionsPage( |
| 563 | dispatch, |
| 564 | { itemType, itemId, itemName, additionalProps, users } |
| 565 | ) { |
| 566 | PermissionsActionHelper.fetchItemUsers(dispatch, { |
| 567 | itemId, |
| 568 | allUsers: users |
| 569 | }); |
| 570 | VersionsPageActionHelper.selectNone(dispatch); |
| 571 | VersionsPageActionHelper.fetchVersions(dispatch, { |
| 572 | itemType, |
| 573 | itemId |
| 574 | }).then(() => { |
| 575 | ItemsHelper.fetchItem(itemId).then(result => { |
| 576 | setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, { |
| 577 | status: result.status, |
| 578 | itemType, |
| 579 | itemId, |
| 580 | itemName, |
| 581 | additionalProps |
| 582 | }); |
| 583 | }); |
| 584 | }); |
| 585 | }, |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 586 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 587 | checkMergeStatus(dispatch, { itemId, versionId, version }) { |
| 588 | return ItemsHelper.fetchVersion({ itemId, versionId }).then( |
| 589 | response => { |
| 590 | let state = (response && response.state) || {}; |
| 591 | let { synchronizationState } = state; |
| 592 | // let inMerge = synchronizationState === SyncStates.MERGE; |
| 593 | MergeEditorActionHelper.fetchConflicts(dispatch, { |
| 594 | itemId, |
| 595 | version |
| 596 | }).then(data => { |
| 597 | dispatch({ |
| 598 | type: actionTypes.CHECK_MERGE_STATUS, |
| 599 | synchronizationState, |
| 600 | conflictInfoList: data.conflictInfoList |
| 601 | }); |
| 602 | }); |
| 603 | } |
| 604 | ); |
| 605 | }, |
az2497 | 644017c | 2017-08-10 17:49:40 +0300 | [diff] [blame] | 606 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 607 | forceBreadCrumbsUpdate(dispatch) { |
| 608 | dispatch({ |
| 609 | type: actionTypes.SET_CURRENT_SCREEN, |
| 610 | currentScreen: { |
| 611 | forceBreadCrumbsUpdate: true |
| 612 | } |
| 613 | }); |
| 614 | }, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 615 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 616 | updateCurrentScreenVersion(dispatch, version) { |
| 617 | dispatch({ |
| 618 | type: actionTypes.SET_CURRENT_SCREEN_VERSION, |
| 619 | version |
| 620 | }); |
| 621 | } |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 622 | }; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 623 | |
| 624 | export default OnboardingActionHelper; |