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'; |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 51 | |
| 52 | function setCurrentScreen(dispatch, screen, props = {}) { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 53 | dispatch({ |
| 54 | type: actionTypes.SET_CURRENT_SCREEN, |
| 55 | currentScreen: { |
| 56 | screen, |
| 57 | props, |
| 58 | forceBreadCrumbsUpdate: true |
| 59 | } |
| 60 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 61 | } |
| 62 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 63 | export function updateCurrentScreenProps(dispatch, props = {}) { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 64 | dispatch({ |
| 65 | type: actionTypes.UPDATE_CURRENT_SCREEN_PROPS, |
| 66 | props |
| 67 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 68 | } |
| 69 | |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 70 | const OnboardingActionHelper = { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 71 | loadItemsLists(dispatch) { |
| 72 | LicenseModelActionHelper.fetchLicenseModels(dispatch); |
| 73 | LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch); |
| 74 | LicenseModelActionHelper.fetchArchivedLicenseModels(dispatch); |
| 75 | SoftwareProductActionHelper.fetchSoftwareProductList(dispatch); |
| 76 | SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(dispatch); |
| 77 | SoftwareProductActionHelper.fetchArchivedSoftwareProductList(dispatch); |
| 78 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 79 | |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 80 | async navigateToOnboardingCatalog(dispatch) { |
| 81 | await FeaturesActionHelper.getFeaturesList(dispatch); |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 82 | UsersActionHelper.fetchUsersList(dispatch); |
| 83 | this.loadItemsLists(dispatch); |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 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 | }, |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 211 | async getUpdatedSoftwareProduct(dispatch, { softwareProductId, version }) { |
| 212 | const response = await SoftwareProductActionHelper.fetchSoftwareProduct( |
| 213 | dispatch, |
| 214 | { |
| 215 | softwareProductId, |
| 216 | version |
| 217 | } |
| 218 | ); |
| 219 | let newResponse = false; |
| 220 | let newVersion = false; |
| 221 | // checking if there was healing and a new version should be open |
| 222 | if (response[0].version !== version.id) { |
| 223 | newResponse = await SoftwareProductActionHelper.fetchSoftwareProduct( |
| 224 | dispatch, |
| 225 | { |
| 226 | softwareProductId, |
| 227 | version: { ...version, id: response[0].version } |
| 228 | } |
| 229 | ); |
| 230 | newVersion = await ItemsHelper.fetchVersion({ |
| 231 | itemId: softwareProductId, |
| 232 | versionId: response[0].version |
| 233 | }); |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 234 | |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 235 | dispatch( |
| 236 | notificationActions.showInfo({ |
| 237 | message: i18n( |
| 238 | 'This is the current version of the VSP, as a result of healing' |
| 239 | ) |
| 240 | }) |
| 241 | ); |
| 242 | } |
| 243 | return Promise.resolve( |
| 244 | newResponse |
| 245 | ? { softwareProduct: newResponse[0], newVersion } |
| 246 | : { softwareProduct: response[0], newVersion: version } |
| 247 | ); |
| 248 | }, |
| 249 | async navigateToSoftwareProductLandingPage( |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 250 | dispatch, |
| 251 | { softwareProductId, version, status } |
| 252 | ) { |
| 253 | SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch); |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 254 | /** |
| 255 | * TODO remove when Filter toggle will be removed |
| 256 | */ |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 257 | LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch); |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 258 | |
| 259 | const { |
| 260 | softwareProduct, |
| 261 | newVersion |
| 262 | } = await this.getUpdatedSoftwareProduct(dispatch, { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 263 | softwareProductId, |
| 264 | version |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 265 | }); |
| 266 | |
| 267 | let { vendorId: licenseModelId, licensingVersion } = softwareProduct; |
| 268 | SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, { |
| 269 | licenseModelId, |
| 270 | licensingVersion |
| 271 | }); |
| 272 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents( |
| 273 | dispatch, |
| 274 | { softwareProductId, version: newVersion } |
| 275 | ); |
| 276 | if (softwareProduct.onboardingOrigin === onboardingOriginTypes.ZIP) { |
| 277 | SoftwareProductActionHelper.loadSoftwareProductHeatCandidate( |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 278 | dispatch, |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 279 | { softwareProductId, version: newVersion } |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 280 | ); |
svishnev | 7c727c1 | 2018-05-24 13:20:51 +0300 | [diff] [blame] | 281 | } |
| 282 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, { |
| 283 | softwareProductId, |
| 284 | licenseModelId, |
| 285 | version: newVersion, |
| 286 | status |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 287 | }); |
| 288 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 289 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 290 | navigateToSoftwareProductDetails( |
| 291 | dispatch, |
| 292 | { softwareProductId, version, status } |
| 293 | ) { |
| 294 | SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, { |
| 295 | softwareProductId, |
| 296 | version |
| 297 | }).then(response => { |
| 298 | let { vendorId: licenseModelId, licensingVersion } = response[0]; |
| 299 | SoftwareProductActionHelper.loadLicensingVersionsList(dispatch, { |
| 300 | licenseModelId |
| 301 | }); |
| 302 | SoftwareProductActionHelper.loadSoftwareProductDetailsData( |
| 303 | dispatch, |
| 304 | { licenseModelId, licensingVersion } |
| 305 | ); |
| 306 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, { |
| 307 | softwareProductId, |
| 308 | version, |
| 309 | status |
| 310 | }); |
| 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 | navigateToSoftwareProductAttachmentsSetupTab( |
| 315 | dispatch, |
| 316 | { softwareProductId, version, status } |
| 317 | ) { |
| 318 | SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, { |
| 319 | softwareProductId, |
| 320 | version |
| 321 | }); |
| 322 | SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, { |
| 323 | activeTab: attachmentsTabsMapping.SETUP |
| 324 | }); |
| 325 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, { |
| 326 | softwareProductId, |
| 327 | version, |
| 328 | status |
| 329 | }); |
| 330 | }, |
| 331 | navigateToSoftwareProductAttachmentsValidationTab( |
| 332 | dispatch, |
| 333 | { softwareProductId, version, status } |
| 334 | ) { |
| 335 | SoftwareProductActionHelper.processAndValidateHeatCandidate(dispatch, { |
| 336 | softwareProductId, |
| 337 | version |
| 338 | }).then(() => { |
| 339 | SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, { |
| 340 | activeTab: attachmentsTabsMapping.VALIDATION |
| 341 | }); |
| 342 | setCurrentScreen( |
| 343 | dispatch, |
| 344 | enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, |
| 345 | { softwareProductId, version, status } |
| 346 | ); |
| 347 | }); |
| 348 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 349 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 350 | navigateToSoftwareProductProcesses( |
| 351 | dispatch, |
| 352 | { softwareProductId, version, status } |
| 353 | ) { |
| 354 | if (softwareProductId) { |
| 355 | SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, { |
| 356 | softwareProductId, |
| 357 | version |
| 358 | }); |
| 359 | } |
| 360 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, { |
| 361 | softwareProductId, |
| 362 | version, |
| 363 | status |
| 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 | navigateToSoftwareProductNetworks( |
| 368 | dispatch, |
| 369 | { softwareProductId, version, status } |
| 370 | ) { |
| 371 | if (softwareProductId) { |
| 372 | SoftwareProductNetworksActionHelper.fetchNetworksList(dispatch, { |
| 373 | softwareProductId, |
| 374 | version |
| 375 | }); |
| 376 | } |
| 377 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, { |
| 378 | softwareProductId, |
| 379 | version, |
| 380 | status |
| 381 | }); |
| 382 | }, |
shrek2000 | c8a540b | 2017-09-11 15:45:37 +0300 | [diff] [blame] | 383 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 384 | navigateToSoftwareProductDependencies( |
| 385 | dispatch, |
| 386 | { softwareProductId, version, status } |
| 387 | ) { |
| 388 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents( |
| 389 | dispatch, |
| 390 | { softwareProductId, version } |
| 391 | ).then(result => { |
| 392 | if (result.listCount >= 2) { |
| 393 | SoftwareProductDependenciesActionHelper.fetchDependencies( |
| 394 | dispatch, |
| 395 | { softwareProductId, version } |
| 396 | ); |
| 397 | setCurrentScreen( |
| 398 | dispatch, |
| 399 | enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES, |
| 400 | { softwareProductId, version, status } |
| 401 | ); |
| 402 | } else { |
| 403 | this.navigateToSoftwareProductLandingPage(dispatch, { |
| 404 | softwareProductId, |
| 405 | version, |
| 406 | status |
| 407 | }); |
| 408 | } |
| 409 | }); |
| 410 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 411 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 412 | navigateToSoftwareProductComponents( |
| 413 | dispatch, |
| 414 | { softwareProductId, version, status } |
| 415 | ) { |
| 416 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents( |
| 417 | dispatch, |
| 418 | { softwareProductId, version } |
| 419 | ); |
| 420 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, { |
| 421 | softwareProductId, |
| 422 | version, |
| 423 | status |
| 424 | }); |
| 425 | }, |
| 426 | navigateToSoftwareProductDeployment( |
| 427 | dispatch, |
| 428 | { softwareProductId, version, status } |
| 429 | ) { |
| 430 | SoftwareProductDeploymentActionHelper.fetchDeploymentFlavorsList( |
| 431 | dispatch, |
| 432 | { softwareProductId, version } |
| 433 | ); |
| 434 | ComputeFlavorActionHelper.fetchComputesListForVSP(dispatch, { |
| 435 | softwareProductId, |
| 436 | version |
| 437 | }); |
| 438 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, { |
| 439 | softwareProductId, |
| 440 | version, |
| 441 | status |
| 442 | }); |
| 443 | }, |
| 444 | navigateToSoftwareProductActivityLog( |
| 445 | dispatch, |
| 446 | { softwareProductId, version, status } |
| 447 | ) { |
| 448 | ActivityLogActionHelper.fetchActivityLog(dispatch, { |
| 449 | itemId: softwareProductId, |
| 450 | versionId: version.id |
| 451 | }); |
| 452 | setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, { |
| 453 | softwareProductId, |
| 454 | version, |
| 455 | status |
| 456 | }); |
| 457 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 458 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 459 | navigateToSoftwareProductComponentProcesses( |
| 460 | dispatch, |
| 461 | { softwareProductId, componentId, version, status } |
| 462 | ) { |
| 463 | if (componentId && softwareProductId) { |
| 464 | SoftwareProductComponentProcessesActionHelper.fetchProcessesList( |
| 465 | dispatch, |
| 466 | { componentId, softwareProductId, version } |
| 467 | ); |
| 468 | } |
| 469 | setCurrentScreen( |
| 470 | dispatch, |
| 471 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES, |
| 472 | { softwareProductId, componentId, version, status } |
| 473 | ); |
| 474 | }, |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 475 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 476 | navigateToSoftwareProductComponentMonitoring( |
| 477 | dispatch, |
| 478 | { softwareProductId, version, componentId, status } |
| 479 | ) { |
| 480 | if (componentId && softwareProductId && version) { |
| 481 | SoftwareProductComponentsMonitoringAction.fetchExistingFiles( |
| 482 | dispatch, |
| 483 | { componentId, softwareProductId, version } |
| 484 | ); |
| 485 | } |
| 486 | setCurrentScreen( |
| 487 | dispatch, |
| 488 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING, |
| 489 | { softwareProductId, componentId, version, 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 | navigateToComponentStorage( |
| 494 | dispatch, |
| 495 | { softwareProductId, componentId, version, status } |
| 496 | ) { |
| 497 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 498 | dispatch, |
| 499 | { softwareProductId, vspComponentId: componentId, version } |
| 500 | ); |
| 501 | setCurrentScreen( |
| 502 | dispatch, |
| 503 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE, |
| 504 | { softwareProductId, version, componentId, status } |
| 505 | ); |
| 506 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 507 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 508 | navigateToComponentCompute( |
| 509 | dispatch, |
| 510 | { softwareProductId, componentId, version, status } |
| 511 | ) { |
| 512 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 513 | dispatch, |
| 514 | { softwareProductId, vspComponentId: componentId, version } |
| 515 | ); |
| 516 | if (componentId && softwareProductId) { |
| 517 | ComputeFlavorActionHelper.fetchComputesList(dispatch, { |
| 518 | softwareProductId, |
| 519 | componentId, |
| 520 | version |
| 521 | }); |
| 522 | } |
| 523 | setCurrentScreen( |
| 524 | dispatch, |
| 525 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE, |
| 526 | { softwareProductId, version, componentId, status } |
| 527 | ); |
| 528 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 529 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 530 | navigateToComponentNetwork( |
| 531 | dispatch, |
| 532 | { softwareProductId, componentId, version, status } |
| 533 | ) { |
| 534 | SoftwareProductComponentsNetworkActionHelper.fetchNICsList(dispatch, { |
| 535 | softwareProductId, |
| 536 | componentId, |
| 537 | version |
| 538 | }); |
| 539 | setCurrentScreen( |
| 540 | dispatch, |
| 541 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK, |
| 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 | navigateToSoftwareProductComponentGeneral( |
| 547 | dispatch, |
| 548 | { softwareProductId, componentId, version, status } |
| 549 | ) { |
| 550 | if (componentId && softwareProductId) { |
| 551 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 552 | dispatch, |
| 553 | { softwareProductId, vspComponentId: componentId, version } |
| 554 | ); |
| 555 | } |
| 556 | setCurrentScreen( |
| 557 | dispatch, |
| 558 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL, |
| 559 | { softwareProductId, version, componentId, status } |
| 560 | ); |
| 561 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 562 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 563 | navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel( |
| 564 | dispatch, |
| 565 | { softwareProductId, componentId, version, status } |
| 566 | ) { |
| 567 | this.navigateToSoftwareProductComponentGeneral(dispatch, { |
| 568 | softwareProductId, |
| 569 | componentId, |
| 570 | version, |
| 571 | status |
| 572 | }); |
| 573 | dispatch({ |
| 574 | type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM, |
| 575 | mapOfExpandedIds: { |
| 576 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true, |
| 577 | [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS + |
| 578 | '|' + |
| 579 | componentId]: true |
| 580 | } |
| 581 | }); |
| 582 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 583 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 584 | navigateToComponentLoadBalancing( |
| 585 | dispatch, |
| 586 | { softwareProductId, componentId, version, status } |
| 587 | ) { |
| 588 | SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent( |
| 589 | dispatch, |
| 590 | { softwareProductId, vspComponentId: componentId, version } |
| 591 | ); |
| 592 | setCurrentScreen( |
| 593 | dispatch, |
| 594 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING, |
| 595 | { softwareProductId, version, componentId, status } |
| 596 | ); |
| 597 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 598 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 599 | navigateToComponentImages( |
| 600 | dispatch, |
| 601 | { softwareProductId, componentId, version, status } |
| 602 | ) { |
| 603 | SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, { |
| 604 | softwareProductId, |
| 605 | componentId, |
| 606 | version |
| 607 | }); |
| 608 | setCurrentScreen( |
| 609 | dispatch, |
| 610 | enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES, |
| 611 | { softwareProductId, version, componentId, status } |
| 612 | ); |
| 613 | }, |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 614 | |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 615 | async navigateToVersionsPage( |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 616 | dispatch, |
| 617 | { itemType, itemId, itemName, additionalProps, users } |
| 618 | ) { |
| 619 | PermissionsActionHelper.fetchItemUsers(dispatch, { |
| 620 | itemId, |
| 621 | allUsers: users |
| 622 | }); |
| 623 | VersionsPageActionHelper.selectNone(dispatch); |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 624 | await VersionsPageActionHelper.fetchVersions(dispatch, { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 625 | itemType, |
| 626 | itemId |
svishnev | ea5e43c | 2018-04-15 09:06:57 +0300 | [diff] [blame] | 627 | }); |
| 628 | const items = await ItemsHelper.fetchItem(itemId); |
| 629 | setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, { |
| 630 | status: items.status, |
| 631 | itemType, |
| 632 | itemId, |
| 633 | itemName, |
| 634 | vendorName: items.properties.vendorName, |
| 635 | vendorId: items.properties.vendorId, |
| 636 | additionalProps |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 637 | }); |
| 638 | }, |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 639 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 640 | checkMergeStatus(dispatch, { itemId, versionId, version }) { |
| 641 | return ItemsHelper.fetchVersion({ itemId, versionId }).then( |
| 642 | response => { |
| 643 | let state = (response && response.state) || {}; |
| 644 | let { synchronizationState } = state; |
| 645 | // let inMerge = synchronizationState === SyncStates.MERGE; |
| 646 | MergeEditorActionHelper.fetchConflicts(dispatch, { |
| 647 | itemId, |
| 648 | version |
| 649 | }).then(data => { |
| 650 | dispatch({ |
| 651 | type: actionTypes.CHECK_MERGE_STATUS, |
| 652 | synchronizationState, |
| 653 | conflictInfoList: data.conflictInfoList |
| 654 | }); |
| 655 | }); |
| 656 | } |
| 657 | ); |
| 658 | }, |
az2497 | 644017c | 2017-08-10 17:49:40 +0300 | [diff] [blame] | 659 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 660 | forceBreadCrumbsUpdate(dispatch) { |
| 661 | dispatch({ |
| 662 | type: actionTypes.SET_CURRENT_SCREEN, |
| 663 | currentScreen: { |
| 664 | forceBreadCrumbsUpdate: true |
| 665 | } |
| 666 | }); |
| 667 | }, |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 668 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 669 | updateCurrentScreenVersion(dispatch, version) { |
| 670 | dispatch({ |
| 671 | type: actionTypes.SET_CURRENT_SCREEN_VERSION, |
| 672 | version |
| 673 | }); |
| 674 | } |
Michael Lando | efa037d | 2017-02-19 12:57:33 +0200 | [diff] [blame] | 675 | }; |
talig | 8e9c065 | 2017-12-20 14:30:43 +0200 | [diff] [blame] | 676 | |
| 677 | export default OnboardingActionHelper; |