blob: d75c234caf4e0b9cc174c4a7cd61d6ca272bb577 [file] [log] [blame]
svishnev1eb66b72018-01-11 14:39:45 +02001/*
2 * Copyright © 2016-2017 European Support Limited
AviZi280f8012017-06-09 02:39:56 +03003 *
Michael Landoefa037d2017-02-19 12:57:33 +02004 * 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
svishnev1eb66b72018-01-11 14:39:45 +02007 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
Michael Landoefa037d2017-02-19 12:57:33 +020010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
svishnev1eb66b72018-01-11 14:39:45 +020012 * 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 Landoefa037d2017-02-19 12:57:33 +020015 */
svishnev1eb66b72018-01-11 14:39:45 +020016
talig8e9c0652017-12-20 14:30:43 +020017import UsersActionHelper from './users/UsersActionHelper.js';
18import VersionsPageActionHelper from './versionsPage/VersionsPageActionHelper.js';
19import PermissionsActionHelper from './permissions/PermissionsActionHelper.js';
Michael Landoefa037d2017-02-19 12:57:33 +020020import LicenseModelActionHelper from './licenseModel/LicenseModelActionHelper.js';
21import LicenseAgreementActionHelper from './licenseModel/licenseAgreement/LicenseAgreementActionHelper.js';
22import FeatureGroupsActionHelper from './licenseModel/featureGroups/FeatureGroupsActionHelper.js';
23import LicenseKeyGroupsActionHelper from './licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js';
24import EntitlementPoolsActionHelper from './licenseModel/entitlementPools/EntitlementPoolsActionHelper.js';
25import SoftwareProductActionHelper from './softwareProduct/SoftwareProductActionHelper.js';
26import SoftwareProductProcessesActionHelper from './softwareProduct/processes/SoftwareProductProcessesActionHelper.js';
Avi Zivb8e2faf2017-07-18 19:45:38 +030027import SoftwareProductDeploymentActionHelper from './softwareProduct/deployment/SoftwareProductDeploymentActionHelper.js';
Michael Landoefa037d2017-02-19 12:57:33 +020028import SoftwareProductNetworksActionHelper from './softwareProduct/networks/SoftwareProductNetworksActionHelper.js';
29import SoftwareProductComponentsActionHelper from './softwareProduct/components/SoftwareProductComponentsActionHelper.js';
30import SoftwareProductComponentProcessesActionHelper from './softwareProduct/components/processes/SoftwareProductComponentProcessesActionHelper.js';
31import SoftwareProductComponentsNetworkActionHelper from './softwareProduct/components/network/SoftwareProductComponentsNetworkActionHelper.js';
AviZi280f8012017-06-09 02:39:56 +030032import SoftwareProductDependenciesActionHelper from './softwareProduct/dependencies/SoftwareProductDependenciesActionHelper.js';
Avi Zivb8e2faf2017-07-18 19:45:38 +030033import ComputeFlavorActionHelper from './softwareProduct/components/compute/ComputeFlavorActionHelper.js';
AviZi280f8012017-06-09 02:39:56 +030034import OnboardActionHelper from './onboard/OnboardActionHelper.js';
talig8e9c0652017-12-20 14:30:43 +020035import MergeEditorActionHelper from 'sdc-app/common/merge/MergeEditorActionHelper.js';
Michael Landoefa037d2017-02-19 12:57:33 +020036import SoftwareProductComponentsMonitoringAction from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringActionHelper.js';
37import {actionTypes, enums} from './OnboardingConstants.js';
talig8e9c0652017-12-20 14:30:43 +020038import {actionTypes as SoftwareProductActionTypes, onboardingOriginTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
Avi Zivb8e2faf2017-07-18 19:45:38 +030039import ActivityLogActionHelper from 'sdc-app/common/activity-log/ActivityLogActionHelper.js';
talig8e9c0652017-12-20 14:30:43 +020040import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js';
41import SoftwareProductComponentsImageActionHelper from './softwareProduct/components/images/SoftwareProductComponentsImageActionHelper.js';
Michael Lando4d97d5f2017-06-17 22:40:44 +030042import licenseModelOverviewActionHelper from 'sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js';
shrek2000c8a540b2017-09-11 15:45:37 +030043import {tabsMapping as attachmentsTabsMapping} from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js';
44import SoftwareProductAttachmentsActionHelper from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js';
Michael Landoefa037d2017-02-19 12:57:33 +020045
46function setCurrentScreen(dispatch, screen, props = {}) {
47 dispatch({
48 type: actionTypes.SET_CURRENT_SCREEN,
49 currentScreen: {
50 screen,
AviZi280f8012017-06-09 02:39:56 +030051 props,
52 forceBreadCrumbsUpdate: true
Michael Landoefa037d2017-02-19 12:57:33 +020053 }
54 });
55}
56
talig8e9c0652017-12-20 14:30:43 +020057export function updateCurrentScreenProps(dispatch, props = {}) {
58 dispatch({
59 type: actionTypes.UPDATE_CURRENT_SCREEN_PROPS,
60 props
61 });
Michael Landoefa037d2017-02-19 12:57:33 +020062}
63
talig8e9c0652017-12-20 14:30:43 +020064const OnboardingActionHelper = {
AviZi280f8012017-06-09 02:39:56 +030065
talig8e9c0652017-12-20 14:30:43 +020066 loadItemsLists(dispatch) {
Michael Landoefa037d2017-02-19 12:57:33 +020067 LicenseModelActionHelper.fetchLicenseModels(dispatch);
AviZi280f8012017-06-09 02:39:56 +030068 LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
svishnev091edfd2018-03-19 12:15:19 +020069 LicenseModelActionHelper.fetchArchivedLicenseModels(dispatch);
Michael Landoefa037d2017-02-19 12:57:33 +020070 SoftwareProductActionHelper.fetchSoftwareProductList(dispatch);
AviZi280f8012017-06-09 02:39:56 +030071 SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(dispatch);
svishnev091edfd2018-03-19 12:15:19 +020072 SoftwareProductActionHelper.fetchArchivedSoftwareProductList(dispatch);
talig8e9c0652017-12-20 14:30:43 +020073 },
74
75 navigateToOnboardingCatalog(dispatch) {
76 UsersActionHelper.fetchUsersList(dispatch);
77 this.loadItemsLists(dispatch);
AviZi280f8012017-06-09 02:39:56 +030078 OnboardActionHelper.resetOnboardStore(dispatch);
Michael Landoefa037d2017-02-19 12:57:33 +020079 setCurrentScreen(dispatch, enums.SCREEN.ONBOARDING_CATALOG);
80 },
81
AviZi280f8012017-06-09 02:39:56 +030082 autoSaveBeforeNavigate(dispatch, {softwareProductId, version, vspComponentId, dataToSave}) {
83 if(softwareProductId) {
84 if(vspComponentId) {
85 return SoftwareProductComponentsActionHelper.updateSoftwareProductComponent(dispatch, {
86 softwareProductId, version, vspComponentId,
87 componentData: dataToSave.componentData,
88 qdata: dataToSave.qdata
89 });
90 }
91 return SoftwareProductActionHelper.updateSoftwareProduct(dispatch, {
92 softwareProduct: dataToSave.softwareProduct,
talig8e9c0652017-12-20 14:30:43 +020093 version,
AviZi280f8012017-06-09 02:39:56 +030094 qdata: dataToSave.qdata
95 });
96 }
97 return Promise.resolve();
98 },
99
svishnev091edfd2018-03-19 12:15:19 +0200100 navigateToLicenseModelOverview(dispatch, {licenseModelId, version, status}) {
AviZi280f8012017-06-09 02:39:56 +0300101
102 /**
103 * TODO change to specific rest
104 */
105
106 LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => {
talig8e9c0652017-12-20 14:30:43 +0200107 LicenseModelActionHelper.fetchLicenseModelItems(dispatch, {licenseModelId, version}).then(() => {
svishnev091edfd2018-03-19 12:15:19 +0200108 setCurrentScreen(dispatch, enums.SCREEN.LICENSE_MODEL_OVERVIEW, {licenseModelId, version, status});
AviZi280f8012017-06-09 02:39:56 +0300109 });
ilanapc6a41de2017-11-07 11:54:10 +0200110 licenseModelOverviewActionHelper.selectVLMListView(dispatch, {buttonTab: null});
AviZi280f8012017-06-09 02:39:56 +0300111 });
112 },
svishnev091edfd2018-03-19 12:15:19 +0200113 navigateToLicenseAgreements(dispatch, {licenseModelId, version, status}) {
Michael Landoefa037d2017-02-19 12:57:33 +0200114 LicenseAgreementActionHelper.fetchLicenseAgreementList(dispatch, {licenseModelId, version});
115 LicenseModelActionHelper.fetchLicenseModelById(dispatch, {licenseModelId, version}).then(() => {
svishnev091edfd2018-03-19 12:15:19 +0200116 setCurrentScreen(dispatch, enums.SCREEN.LICENSE_AGREEMENTS, {licenseModelId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200117 });
118 },
119
svishnev091edfd2018-03-19 12:15:19 +0200120 navigateToFeatureGroups(dispatch, {licenseModelId, version, status}) {
Michael Landoefa037d2017-02-19 12:57:33 +0200121 FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {licenseModelId, version});
svishnev091edfd2018-03-19 12:15:19 +0200122 setCurrentScreen(dispatch, enums.SCREEN.FEATURE_GROUPS, {licenseModelId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200123 },
124
svishnev091edfd2018-03-19 12:15:19 +0200125 navigateToEntitlementPools(dispatch, {licenseModelId, version, status}) {
Michael Landoefa037d2017-02-19 12:57:33 +0200126 EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {licenseModelId, version});
svishnev091edfd2018-03-19 12:15:19 +0200127 setCurrentScreen(dispatch, enums.SCREEN.ENTITLEMENT_POOLS, {licenseModelId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200128 },
129
svishnev091edfd2018-03-19 12:15:19 +0200130 navigateToLicenseKeyGroups(dispatch, {licenseModelId, version, status}) {
Michael Landoefa037d2017-02-19 12:57:33 +0200131 LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {licenseModelId, version});
svishnev091edfd2018-03-19 12:15:19 +0200132 setCurrentScreen(dispatch, enums.SCREEN.LICENSE_KEY_GROUPS, {licenseModelId, version, status});
AviZi280f8012017-06-09 02:39:56 +0300133 },
134
svishnev091edfd2018-03-19 12:15:19 +0200135 navigateToLicenseModelActivityLog(dispatch, {licenseModelId, version, status}){
AviZi280f8012017-06-09 02:39:56 +0300136 ActivityLogActionHelper.fetchActivityLog(dispatch, {itemId: licenseModelId, versionId: version.id});
svishnev091edfd2018-03-19 12:15:19 +0200137 setCurrentScreen(dispatch, enums.SCREEN.ACTIVITY_LOG, {licenseModelId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200138 },
139
svishnev091edfd2018-03-19 12:15:19 +0200140 navigateToSoftwareProductLandingPage(dispatch, {softwareProductId, version, status}) {
AviZi280f8012017-06-09 02:39:56 +0300141 SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch);
Michael Landoefa037d2017-02-19 12:57:33 +0200142 SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {softwareProductId, version}).then(response => {
talig8e9c0652017-12-20 14:30:43 +0200143 let {vendorId: licenseModelId, licensingVersion} = response[0];
Michael Landoefa037d2017-02-19 12:57:33 +0200144 SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {licenseModelId, licensingVersion});
talig8e9c0652017-12-20 14:30:43 +0200145 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version: version});
shrek2000c8a540b2017-09-11 15:45:37 +0300146 if(response[0].onboardingOrigin === onboardingOriginTypes.ZIP) {
talig8e9c0652017-12-20 14:30:43 +0200147 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version: version});
shrek2000c8a540b2017-09-11 15:45:37 +0300148 }
svishnev091edfd2018-03-19 12:15:19 +0200149 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {softwareProductId, licenseModelId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200150 });
151 },
152
svishnev091edfd2018-03-19 12:15:19 +0200153 navigateToSoftwareProductDetails(dispatch, {softwareProductId, version, status}) {
talig8e9c0652017-12-20 14:30:43 +0200154 SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {softwareProductId, version}).then(response => {
155 let {vendorId: licenseModelId, licensingVersion} = response[0];
156 SoftwareProductActionHelper.loadLicensingVersionsList(dispatch, {licenseModelId});
157 SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {licenseModelId, licensingVersion});
svishnev091edfd2018-03-19 12:15:19 +0200158 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, {softwareProductId, version, status});
talig8e9c0652017-12-20 14:30:43 +0200159 });
Michael Landoefa037d2017-02-19 12:57:33 +0200160 },
161
svishnev091edfd2018-03-19 12:15:19 +0200162 navigateToSoftwareProductAttachmentsSetupTab(dispatch, {softwareProductId, version, status}) {
AviZi280f8012017-06-09 02:39:56 +0300163 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version});
shrek2000c8a540b2017-09-11 15:45:37 +0300164 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {activeTab: attachmentsTabsMapping.SETUP});
svishnev091edfd2018-03-19 12:15:19 +0200165 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {softwareProductId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200166 },
svishnev091edfd2018-03-19 12:15:19 +0200167 navigateToSoftwareProductAttachmentsValidationTab(dispatch, {softwareProductId, version, status}) {
shrek2000c8a540b2017-09-11 15:45:37 +0300168 SoftwareProductActionHelper.processAndValidateHeatCandidate(dispatch, {softwareProductId, version}).then(() => {
169 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {activeTab: attachmentsTabsMapping.VALIDATION});
svishnev091edfd2018-03-19 12:15:19 +0200170 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {softwareProductId, version, status});
shrek2000c8a540b2017-09-11 15:45:37 +0300171 });
172 },
173
svishnev091edfd2018-03-19 12:15:19 +0200174 navigateToSoftwareProductProcesses(dispatch, {softwareProductId, version, status}) {
Michael Landoefa037d2017-02-19 12:57:33 +0200175 if (softwareProductId) {
176 SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, {softwareProductId, version});
177 }
svishnev091edfd2018-03-19 12:15:19 +0200178 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, {softwareProductId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200179 },
180
svishnev091edfd2018-03-19 12:15:19 +0200181 navigateToSoftwareProductNetworks(dispatch, {softwareProductId, version, status}) {
Michael Landoefa037d2017-02-19 12:57:33 +0200182 if (softwareProductId) {
183 SoftwareProductNetworksActionHelper.fetchNetworksList(dispatch, {softwareProductId, version});
184 }
svishnev091edfd2018-03-19 12:15:19 +0200185 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, {softwareProductId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200186 },
187
svishnev091edfd2018-03-19 12:15:19 +0200188 navigateToSoftwareProductDependencies(dispatch, {softwareProductId, version, status}) {
talig8e9c0652017-12-20 14:30:43 +0200189 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version}).then(result => {
190 if(result.listCount >= 2) {
191 SoftwareProductDependenciesActionHelper.fetchDependencies(dispatch, {softwareProductId, version});
svishnev091edfd2018-03-19 12:15:19 +0200192 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES, {softwareProductId, version, status});
talig8e9c0652017-12-20 14:30:43 +0200193 }
194 else {
svishnev091edfd2018-03-19 12:15:19 +0200195 this.navigateToSoftwareProductLandingPage(dispatch, {softwareProductId, version, status});
talig8e9c0652017-12-20 14:30:43 +0200196 }
197 });
AviZi280f8012017-06-09 02:39:56 +0300198 },
199
svishnev091edfd2018-03-19 12:15:19 +0200200 navigateToSoftwareProductComponents(dispatch, {softwareProductId, version, status}) {
AviZi280f8012017-06-09 02:39:56 +0300201 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version});
svishnev091edfd2018-03-19 12:15:19 +0200202 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, {softwareProductId, version, status});
AviZi280f8012017-06-09 02:39:56 +0300203 },
svishnev091edfd2018-03-19 12:15:19 +0200204 navigateToSoftwareProductDeployment(dispatch, {softwareProductId, version, status}) {
Avi Zivb8e2faf2017-07-18 19:45:38 +0300205 SoftwareProductDeploymentActionHelper.fetchDeploymentFlavorsList(dispatch, {softwareProductId, version});
206 ComputeFlavorActionHelper.fetchComputesListForVSP(dispatch, {softwareProductId, version});
svishnev091edfd2018-03-19 12:15:19 +0200207 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, {softwareProductId, version, status});
Avi Zivb8e2faf2017-07-18 19:45:38 +0300208 },
svishnev091edfd2018-03-19 12:15:19 +0200209 navigateToSoftwareProductActivityLog(dispatch, {softwareProductId, version, status}){
AviZi280f8012017-06-09 02:39:56 +0300210 ActivityLogActionHelper.fetchActivityLog(dispatch, {itemId: softwareProductId, versionId: version.id});
svishnev091edfd2018-03-19 12:15:19 +0200211 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, {softwareProductId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200212 },
213
svishnev091edfd2018-03-19 12:15:19 +0200214 navigateToSoftwareProductComponentProcesses(dispatch, {softwareProductId, componentId, version, status}) {
Michael Landoefa037d2017-02-19 12:57:33 +0200215 if (componentId && softwareProductId) {
216 SoftwareProductComponentProcessesActionHelper.fetchProcessesList(dispatch, {componentId, softwareProductId, version});
217 }
svishnev091edfd2018-03-19 12:15:19 +0200218 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES, {softwareProductId, componentId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200219 },
220
svishnev091edfd2018-03-19 12:15:19 +0200221 navigateToSoftwareProductComponentMonitoring(dispatch, {softwareProductId, version, componentId, status}){
AviZi280f8012017-06-09 02:39:56 +0300222 if (componentId && softwareProductId && version) {
223 SoftwareProductComponentsMonitoringAction.fetchExistingFiles(dispatch, {componentId, softwareProductId, version});
Michael Landoefa037d2017-02-19 12:57:33 +0200224 }
svishnev091edfd2018-03-19 12:15:19 +0200225 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING, {softwareProductId, componentId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200226 },
227
svishnev091edfd2018-03-19 12:15:19 +0200228 navigateToComponentStorage(dispatch, {softwareProductId, componentId, version, status}) {
AviZi280f8012017-06-09 02:39:56 +0300229 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version});
svishnev091edfd2018-03-19 12:15:19 +0200230 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE, {softwareProductId, version, componentId, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200231 },
232
svishnev091edfd2018-03-19 12:15:19 +0200233 navigateToComponentCompute(dispatch, {softwareProductId, componentId, version, status}) {
AviZi280f8012017-06-09 02:39:56 +0300234 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version});
Avi Zivb8e2faf2017-07-18 19:45:38 +0300235 if (componentId && softwareProductId) {
236 ComputeFlavorActionHelper.fetchComputesList(dispatch, {softwareProductId, componentId, version});
237 }
svishnev091edfd2018-03-19 12:15:19 +0200238 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE, {softwareProductId, version, componentId, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200239 },
240
svishnev091edfd2018-03-19 12:15:19 +0200241 navigateToComponentNetwork(dispatch, {softwareProductId, componentId, version, status}) {
Michael Landoefa037d2017-02-19 12:57:33 +0200242 SoftwareProductComponentsNetworkActionHelper.fetchNICsList(dispatch, {softwareProductId, componentId, version});
svishnev091edfd2018-03-19 12:15:19 +0200243 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK, {softwareProductId, version, componentId, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200244 },
245
svishnev091edfd2018-03-19 12:15:19 +0200246 navigateToSoftwareProductComponentGeneral(dispatch, {softwareProductId, componentId, version, status}) {
Michael Landoefa037d2017-02-19 12:57:33 +0200247 if (componentId && softwareProductId) {
248 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version});
Michael Landoefa037d2017-02-19 12:57:33 +0200249 }
svishnev091edfd2018-03-19 12:15:19 +0200250 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL, {softwareProductId, version, componentId, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200251 },
252
svishnev091edfd2018-03-19 12:15:19 +0200253 navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(dispatch, {softwareProductId, componentId, version, status}) {
254 this.navigateToSoftwareProductComponentGeneral(dispatch, {softwareProductId, componentId, version, status});
Michael Landoefa037d2017-02-19 12:57:33 +0200255 dispatch({
256 type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM,
257 mapOfExpandedIds: {
talig8e9c0652017-12-20 14:30:43 +0200258 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true,
259 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS + '|' + componentId]: true
Michael Landoefa037d2017-02-19 12:57:33 +0200260 }
261 });
262 },
263
svishnev091edfd2018-03-19 12:15:19 +0200264 navigateToComponentLoadBalancing(dispatch, {softwareProductId, componentId, version, status}) {
AviZi280f8012017-06-09 02:39:56 +0300265 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(dispatch, {softwareProductId, vspComponentId: componentId, version});
svishnev091edfd2018-03-19 12:15:19 +0200266 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING, {softwareProductId, version, componentId, status});
Avi Zivb8e2faf2017-07-18 19:45:38 +0300267 },
268
svishnev091edfd2018-03-19 12:15:19 +0200269 navigateToComponentImages(dispatch, {softwareProductId, componentId, version, status}) {
Avi Zivb8e2faf2017-07-18 19:45:38 +0300270 SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, {
271 softwareProductId,
272 componentId,
273 version
274 });
svishnev091edfd2018-03-19 12:15:19 +0200275 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES, {softwareProductId, version, componentId, status});
az2497644017c2017-08-10 17:49:40 +0300276 },
277
talig8e9c0652017-12-20 14:30:43 +0200278 navigateToVersionsPage(dispatch, {itemType, itemId, itemName, additionalProps, users}) {
279 PermissionsActionHelper.fetchItemUsers(dispatch, {itemId, allUsers: users});
280 VersionsPageActionHelper.selectNone(dispatch);
281 VersionsPageActionHelper.fetchVersions(dispatch, {itemType, itemId}).then(() => {
svishnev091edfd2018-03-19 12:15:19 +0200282 ItemsHelper.fetchItem(itemId).then(result => {
283 setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, {status: result.status, itemType, itemId, itemName, additionalProps});
284 });
285
talig8e9c0652017-12-20 14:30:43 +0200286 });
svishnev091edfd2018-03-19 12:15:19 +0200287
talig8e9c0652017-12-20 14:30:43 +0200288 },
289
290 checkMergeStatus(dispatch, {itemId, versionId, version}) {
291 return ItemsHelper.fetchVersion({itemId, versionId}).then(response => {
292 let state = response && response.state || {};
293 let {synchronizationState} = state;
294 // let inMerge = synchronizationState === SyncStates.MERGE;
295 MergeEditorActionHelper.fetchConflicts(dispatch, {itemId, version}).then(data => {
296 dispatch({
297 type: actionTypes.CHECK_MERGE_STATUS,
298 synchronizationState,
299 conflictInfoList: data.conflictInfoList
300 });
301 });
302 });
303 },
304
305 forceBreadCrumbsUpdate(dispatch) {
306 dispatch({
307 type: actionTypes.SET_CURRENT_SCREEN,
308 currentScreen: {
309 forceBreadCrumbsUpdate: true
310 }
311 });
312 },
313
az2497644017c2017-08-10 17:49:40 +0300314 updateCurrentScreenVersion(dispatch, version) {
315 dispatch({
316 type: actionTypes.SET_CURRENT_SCREEN_VERSION,
317 version
318 });
Michael Landoefa037d2017-02-19 12:57:33 +0200319 }
Michael Landoefa037d2017-02-19 12:57:33 +0200320};
talig8e9c0652017-12-20 14:30:43 +0200321
322export default OnboardingActionHelper;