blob: b8ce714bce52831befc8b522dbb5008b8018905a [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';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020037import { actionTypes, enums } from './OnboardingConstants.js';
38import {
39 actionTypes as SoftwareProductActionTypes,
40 onboardingOriginTypes
41} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
Avi Zivb8e2faf2017-07-18 19:45:38 +030042import ActivityLogActionHelper from 'sdc-app/common/activity-log/ActivityLogActionHelper.js';
talig8e9c0652017-12-20 14:30:43 +020043import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js';
44import SoftwareProductComponentsImageActionHelper from './softwareProduct/components/images/SoftwareProductComponentsImageActionHelper.js';
Michael Lando4d97d5f2017-06-17 22:40:44 +030045import licenseModelOverviewActionHelper from 'sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020046import { tabsMapping as attachmentsTabsMapping } from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js';
shrek2000c8a540b2017-09-11 15:45:37 +030047import SoftwareProductAttachmentsActionHelper from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js';
svishnevea5e43c2018-04-15 09:06:57 +030048import { actionTypes as filterActionTypes } from './onboard/filter/FilterConstants.js';
49import FeaturesActionHelper from 'sdc-app/features/FeaturesActionHelper.js';
Michael Landoefa037d2017-02-19 12:57:33 +020050
51function setCurrentScreen(dispatch, screen, props = {}) {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020052 dispatch({
53 type: actionTypes.SET_CURRENT_SCREEN,
54 currentScreen: {
55 screen,
56 props,
57 forceBreadCrumbsUpdate: true
58 }
59 });
Michael Landoefa037d2017-02-19 12:57:33 +020060}
61
talig8e9c0652017-12-20 14:30:43 +020062export function updateCurrentScreenProps(dispatch, props = {}) {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020063 dispatch({
64 type: actionTypes.UPDATE_CURRENT_SCREEN_PROPS,
65 props
66 });
Michael Landoefa037d2017-02-19 12:57:33 +020067}
68
talig8e9c0652017-12-20 14:30:43 +020069const OnboardingActionHelper = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020070 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 },
AviZi280f8012017-06-09 02:39:56 +030078
svishnevea5e43c2018-04-15 09:06:57 +030079 async navigateToOnboardingCatalog(dispatch) {
80 await FeaturesActionHelper.getFeaturesList(dispatch);
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020081 UsersActionHelper.fetchUsersList(dispatch);
82 this.loadItemsLists(dispatch);
83 OnboardActionHelper.resetOnboardStore(dispatch);
84 setCurrentScreen(dispatch, enums.SCREEN.ONBOARDING_CATALOG);
svishnevea5e43c2018-04-15 09:06:57 +030085 dispatch({
86 type: filterActionTypes.FILTER_DATA_CHANGED,
87 deltaData: {}
88 });
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020089 },
talig8e9c0652017-12-20 14:30:43 +020090
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020091 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 Landoefa037d2017-02-19 12:57:33 +0200116
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200117 navigateToLicenseModelOverview(
118 dispatch,
119 { licenseModelId, version, status }
120 ) {
121 /**
122 * TODO change to specific rest
123 */
AviZi280f8012017-06-09 02:39:56 +0300124
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200125 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 },
AviZi280f8012017-06-09 02:39:56 +0300160
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200161 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 },
AviZi280f8012017-06-09 02:39:56 +0300172
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200173 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 Landoefa037d2017-02-19 12:57:33 +0200184
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200185 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 Landoefa037d2017-02-19 12:57:33 +0200196
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200197 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 Landoefa037d2017-02-19 12:57:33 +0200211
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200212 navigateToSoftwareProductLandingPage(
213 dispatch,
214 { softwareProductId, version, status }
215 ) {
216 SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch);
svishnevea5e43c2018-04-15 09:06:57 +0300217 LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200218 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 },
AviZi280f8012017-06-09 02:39:56 +0300244
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200245 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 Landoefa037d2017-02-19 12:57:33 +0200268
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200269 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 Landoefa037d2017-02-19 12:57:33 +0200304
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200305 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 Landoefa037d2017-02-19 12:57:33 +0200321
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200322 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 },
shrek2000c8a540b2017-09-11 15:45:37 +0300338
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200339 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 Landoefa037d2017-02-19 12:57:33 +0200366
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200367 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 Landoefa037d2017-02-19 12:57:33 +0200413
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200414 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 },
AviZi280f8012017-06-09 02:39:56 +0300430
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200431 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 Landoefa037d2017-02-19 12:57:33 +0200447
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200448 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 Landoefa037d2017-02-19 12:57:33 +0200462
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200463 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 Landoefa037d2017-02-19 12:57:33 +0200484
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200485 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 Landoefa037d2017-02-19 12:57:33 +0200500
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200501 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 Landoefa037d2017-02-19 12:57:33 +0200517
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200518 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 Landoefa037d2017-02-19 12:57:33 +0200538
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200539 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 Landoefa037d2017-02-19 12:57:33 +0200553
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200554 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 Landoefa037d2017-02-19 12:57:33 +0200569
svishnevea5e43c2018-04-15 09:06:57 +0300570 async navigateToVersionsPage(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200571 dispatch,
572 { itemType, itemId, itemName, additionalProps, users }
573 ) {
574 PermissionsActionHelper.fetchItemUsers(dispatch, {
575 itemId,
576 allUsers: users
577 });
578 VersionsPageActionHelper.selectNone(dispatch);
svishnevea5e43c2018-04-15 09:06:57 +0300579 await VersionsPageActionHelper.fetchVersions(dispatch, {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200580 itemType,
581 itemId
svishnevea5e43c2018-04-15 09:06:57 +0300582 });
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 Keidar7fdf7332018-03-20 14:45:40 +0200592 });
593 },
Avi Zivb8e2faf2017-07-18 19:45:38 +0300594
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200595 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 },
az2497644017c2017-08-10 17:49:40 +0300614
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200615 forceBreadCrumbsUpdate(dispatch) {
616 dispatch({
617 type: actionTypes.SET_CURRENT_SCREEN,
618 currentScreen: {
619 forceBreadCrumbsUpdate: true
620 }
621 });
622 },
talig8e9c0652017-12-20 14:30:43 +0200623
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200624 updateCurrentScreenVersion(dispatch, version) {
625 dispatch({
626 type: actionTypes.SET_CURRENT_SCREEN_VERSION,
627 version
628 });
629 }
Michael Landoefa037d2017-02-19 12:57:33 +0200630};
talig8e9c0652017-12-20 14:30:43 +0200631
632export default OnboardingActionHelper;