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