blob: 8385da750f3dfed49b91c73f4d057a5c30c9a36d [file] [log] [blame]
svishnev1eb66b72018-01-11 14:39:45 +02001/*
svishnev7c727c12018-05-24 13:20:51 +03002 * Copyright © 2016-2018 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
Yarin Dekel811fb482018-11-04 15:00:34 +02007 *
svishnev1eb66b72018-01-11 14:39:45 +02008 * http://www.apache.org/licenses/LICENSE-2.0
Yarin Dekel811fb482018-11-04 15:00:34 +02009 *
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';
talig8e9c0652017-12-20 14:30:43 +020034import MergeEditorActionHelper from 'sdc-app/common/merge/MergeEditorActionHelper.js';
Michael Landoefa037d2017-02-19 12:57:33 +020035import SoftwareProductComponentsMonitoringAction from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringActionHelper.js';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020036import { actionTypes, enums } from './OnboardingConstants.js';
37import {
38 actionTypes as SoftwareProductActionTypes,
39 onboardingOriginTypes
40} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
Avi Zivb8e2faf2017-07-18 19:45:38 +030041import ActivityLogActionHelper from 'sdc-app/common/activity-log/ActivityLogActionHelper.js';
talig8e9c0652017-12-20 14:30:43 +020042import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js';
43import SoftwareProductComponentsImageActionHelper from './softwareProduct/components/images/SoftwareProductComponentsImageActionHelper.js';
Michael Lando4d97d5f2017-06-17 22:40:44 +030044import licenseModelOverviewActionHelper from 'sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020045import { tabsMapping as attachmentsTabsMapping } from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js';
shrek2000c8a540b2017-09-11 15:45:37 +030046import SoftwareProductAttachmentsActionHelper from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js';
svishnevea5e43c2018-04-15 09:06:57 +030047import { actionTypes as filterActionTypes } from './onboard/filter/FilterConstants.js';
48import FeaturesActionHelper from 'sdc-app/features/FeaturesActionHelper.js';
svishnev7c727c12018-05-24 13:20:51 +030049import { notificationActions } from 'nfvo-components/notification/NotificationsConstants.js';
50import i18n from 'nfvo-utils/i18n/i18n.js';
Vodafone804ec682019-03-18 15:46:53 +053051import SoftwareProductValidationActionHelper from './softwareProduct/validation/SoftwareProductValidationActionHelper.js';
52import { actionTypes as modalActionTypes } from 'nfvo-components/modal/GlobalModalConstants.js';
Michael Landoefa037d2017-02-19 12:57:33 +020053
54function setCurrentScreen(dispatch, screen, props = {}) {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020055 dispatch({
56 type: actionTypes.SET_CURRENT_SCREEN,
57 currentScreen: {
58 screen,
59 props,
60 forceBreadCrumbsUpdate: true
61 }
62 });
Michael Landoefa037d2017-02-19 12:57:33 +020063}
64
talig8e9c0652017-12-20 14:30:43 +020065export function updateCurrentScreenProps(dispatch, props = {}) {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020066 dispatch({
67 type: actionTypes.UPDATE_CURRENT_SCREEN_PROPS,
68 props
69 });
Michael Landoefa037d2017-02-19 12:57:33 +020070}
71
talig8e9c0652017-12-20 14:30:43 +020072const OnboardingActionHelper = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020073 loadItemsLists(dispatch) {
74 LicenseModelActionHelper.fetchLicenseModels(dispatch);
75 LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
76 LicenseModelActionHelper.fetchArchivedLicenseModels(dispatch);
77 SoftwareProductActionHelper.fetchSoftwareProductList(dispatch);
78 SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(dispatch);
79 SoftwareProductActionHelper.fetchArchivedSoftwareProductList(dispatch);
80 },
AviZi280f8012017-06-09 02:39:56 +030081
svishnevea5e43c2018-04-15 09:06:57 +030082 async navigateToOnboardingCatalog(dispatch) {
83 await FeaturesActionHelper.getFeaturesList(dispatch);
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020084 UsersActionHelper.fetchUsersList(dispatch);
85 this.loadItemsLists(dispatch);
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020086 setCurrentScreen(dispatch, enums.SCREEN.ONBOARDING_CATALOG);
svishnevea5e43c2018-04-15 09:06:57 +030087 dispatch({
88 type: filterActionTypes.FILTER_DATA_CHANGED,
89 deltaData: {}
90 });
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020091 },
talig8e9c0652017-12-20 14:30:43 +020092
Vodafone804ec682019-03-18 15:46:53 +053093 saveIsValidationDisabled(dispatch, { isValidationDisabled }) {
94 SoftwareProductValidationActionHelper.setIsVspValidationDisabled(
95 dispatch,
96 { isValidationDisabled }
97 );
98 },
99
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200100 autoSaveBeforeNavigate(
101 dispatch,
102 { softwareProductId, version, vspComponentId, dataToSave }
103 ) {
104 if (softwareProductId) {
105 if (vspComponentId) {
106 return SoftwareProductComponentsActionHelper.updateSoftwareProductComponent(
107 dispatch,
108 {
109 softwareProductId,
110 version,
111 vspComponentId,
112 componentData: dataToSave.componentData,
113 qdata: dataToSave.qdata
114 }
115 );
116 }
117 return SoftwareProductActionHelper.updateSoftwareProduct(dispatch, {
118 softwareProduct: dataToSave.softwareProduct,
119 version,
120 qdata: dataToSave.qdata
121 });
122 }
123 return Promise.resolve();
124 },
Michael Landoefa037d2017-02-19 12:57:33 +0200125
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200126 navigateToLicenseModelOverview(
127 dispatch,
128 { licenseModelId, version, status }
129 ) {
130 /**
131 * TODO change to specific rest
132 */
AviZi280f8012017-06-09 02:39:56 +0300133
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200134 LicenseModelActionHelper.fetchLicenseModelById(dispatch, {
135 licenseModelId,
136 version
137 }).then(() => {
138 LicenseModelActionHelper.fetchLicenseModelItems(dispatch, {
139 licenseModelId,
140 version
141 }).then(() => {
142 setCurrentScreen(
143 dispatch,
144 enums.SCREEN.LICENSE_MODEL_OVERVIEW,
145 { licenseModelId, version, status }
146 );
147 });
148 licenseModelOverviewActionHelper.selectVLMListView(dispatch, {
149 buttonTab: null
150 });
151 });
152 },
153 navigateToLicenseAgreements(dispatch, { licenseModelId, version, status }) {
154 LicenseAgreementActionHelper.fetchLicenseAgreementList(dispatch, {
155 licenseModelId,
156 version
157 });
158 LicenseModelActionHelper.fetchLicenseModelById(dispatch, {
159 licenseModelId,
160 version
161 }).then(() => {
162 setCurrentScreen(dispatch, enums.SCREEN.LICENSE_AGREEMENTS, {
163 licenseModelId,
164 version,
165 status
166 });
167 });
168 },
AviZi280f8012017-06-09 02:39:56 +0300169
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200170 navigateToFeatureGroups(dispatch, { licenseModelId, version, status }) {
171 FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {
172 licenseModelId,
173 version
174 });
175 setCurrentScreen(dispatch, enums.SCREEN.FEATURE_GROUPS, {
176 licenseModelId,
177 version,
178 status
179 });
180 },
AviZi280f8012017-06-09 02:39:56 +0300181
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200182 navigateToEntitlementPools(dispatch, { licenseModelId, version, status }) {
183 EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {
184 licenseModelId,
185 version
186 });
187 setCurrentScreen(dispatch, enums.SCREEN.ENTITLEMENT_POOLS, {
188 licenseModelId,
189 version,
190 status
191 });
192 },
Michael Landoefa037d2017-02-19 12:57:33 +0200193
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200194 navigateToLicenseKeyGroups(dispatch, { licenseModelId, version, status }) {
195 LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {
196 licenseModelId,
197 version
198 });
199 setCurrentScreen(dispatch, enums.SCREEN.LICENSE_KEY_GROUPS, {
200 licenseModelId,
201 version,
202 status
203 });
204 },
Michael Landoefa037d2017-02-19 12:57:33 +0200205
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200206 navigateToLicenseModelActivityLog(
207 dispatch,
208 { licenseModelId, version, status }
209 ) {
210 ActivityLogActionHelper.fetchActivityLog(dispatch, {
211 itemId: licenseModelId,
212 versionId: version.id
213 });
214 setCurrentScreen(dispatch, enums.SCREEN.ACTIVITY_LOG, {
215 licenseModelId,
216 version,
217 status
218 });
219 },
svishnev7c727c12018-05-24 13:20:51 +0300220 async getUpdatedSoftwareProduct(dispatch, { softwareProductId, version }) {
221 const response = await SoftwareProductActionHelper.fetchSoftwareProduct(
222 dispatch,
223 {
224 softwareProductId,
225 version
226 }
227 );
228 let newResponse = false;
229 let newVersion = false;
230 // checking if there was healing and a new version should be open
231 if (response[0].version !== version.id) {
232 newResponse = await SoftwareProductActionHelper.fetchSoftwareProduct(
233 dispatch,
234 {
235 softwareProductId,
236 version: { ...version, id: response[0].version }
237 }
238 );
239 newVersion = await ItemsHelper.fetchVersion({
240 itemId: softwareProductId,
241 versionId: response[0].version
242 });
Michael Landoefa037d2017-02-19 12:57:33 +0200243
svishnev7c727c12018-05-24 13:20:51 +0300244 dispatch(
245 notificationActions.showInfo({
246 message: i18n(
247 'This is the current version of the VSP, as a result of healing'
248 )
249 })
250 );
251 }
252 return Promise.resolve(
253 newResponse
254 ? { softwareProduct: newResponse[0], newVersion }
255 : { softwareProduct: response[0], newVersion: version }
256 );
257 },
258 async navigateToSoftwareProductLandingPage(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200259 dispatch,
260 { softwareProductId, version, status }
261 ) {
262 SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch);
svishnev7c727c12018-05-24 13:20:51 +0300263 /**
264 * TODO remove when Filter toggle will be removed
265 */
svishnevea5e43c2018-04-15 09:06:57 +0300266 LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
svishnev7c727c12018-05-24 13:20:51 +0300267
268 const {
269 softwareProduct,
270 newVersion
271 } = await this.getUpdatedSoftwareProduct(dispatch, {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200272 softwareProductId,
273 version
svishnev7c727c12018-05-24 13:20:51 +0300274 });
275
276 let { vendorId: licenseModelId, licensingVersion } = softwareProduct;
277 SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {
278 licenseModelId,
279 licensingVersion
280 });
281 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
282 dispatch,
283 { softwareProductId, version: newVersion }
284 );
285 if (softwareProduct.onboardingOrigin === onboardingOriginTypes.ZIP) {
286 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200287 dispatch,
svishnev7c727c12018-05-24 13:20:51 +0300288 { softwareProductId, version: newVersion }
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200289 );
svishnev7c727c12018-05-24 13:20:51 +0300290 }
291 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {
292 softwareProductId,
293 licenseModelId,
294 version: newVersion,
295 status
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200296 });
297 },
AviZi280f8012017-06-09 02:39:56 +0300298
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200299 navigateToSoftwareProductDetails(
300 dispatch,
301 { softwareProductId, version, status }
302 ) {
303 SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {
304 softwareProductId,
305 version
306 }).then(response => {
307 let { vendorId: licenseModelId, licensingVersion } = response[0];
308 SoftwareProductActionHelper.loadLicensingVersionsList(dispatch, {
309 licenseModelId
310 });
311 SoftwareProductActionHelper.loadSoftwareProductDetailsData(
312 dispatch,
313 { licenseModelId, licensingVersion }
314 );
315 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, {
316 softwareProductId,
317 version,
318 status
319 });
320 });
321 },
Michael Landoefa037d2017-02-19 12:57:33 +0200322
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200323 navigateToSoftwareProductAttachmentsSetupTab(
324 dispatch,
325 { softwareProductId, version, status }
326 ) {
327 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {
328 softwareProductId,
329 version
330 });
331 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {
332 activeTab: attachmentsTabsMapping.SETUP
333 });
334 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {
335 softwareProductId,
336 version,
337 status
338 });
339 },
340 navigateToSoftwareProductAttachmentsValidationTab(
341 dispatch,
342 { softwareProductId, version, status }
343 ) {
344 SoftwareProductActionHelper.processAndValidateHeatCandidate(dispatch, {
345 softwareProductId,
346 version
347 }).then(() => {
348 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {
349 activeTab: attachmentsTabsMapping.VALIDATION
350 });
351 setCurrentScreen(
352 dispatch,
353 enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS,
354 { softwareProductId, version, status }
355 );
356 });
357 },
Michael Landoefa037d2017-02-19 12:57:33 +0200358
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200359 navigateToSoftwareProductProcesses(
360 dispatch,
361 { softwareProductId, version, status }
362 ) {
363 if (softwareProductId) {
364 SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, {
365 softwareProductId,
366 version
367 });
368 }
369 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, {
370 softwareProductId,
371 version,
372 status
373 });
374 },
Michael Landoefa037d2017-02-19 12:57:33 +0200375
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200376 navigateToSoftwareProductNetworks(
377 dispatch,
378 { softwareProductId, version, status }
379 ) {
380 if (softwareProductId) {
381 SoftwareProductNetworksActionHelper.fetchNetworksList(dispatch, {
382 softwareProductId,
383 version
384 });
385 }
386 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, {
387 softwareProductId,
388 version,
389 status
390 });
391 },
shrek2000c8a540b2017-09-11 15:45:37 +0300392
Vodafone804ec682019-03-18 15:46:53 +0530393 navigateToSoftwareProductValidation(
394 dispatch,
395 { softwareProductId, version, status }
396 ) {
397 SoftwareProductValidationActionHelper.fetchVspChecks(dispatch)
398 .then(() => {
399 SoftwareProductValidationActionHelper.setCertificationChecked(
400 dispatch,
401 []
402 );
403 SoftwareProductValidationActionHelper.setComplianceChecked(
404 dispatch,
405 []
406 );
407 setCurrentScreen(
408 dispatch,
409 enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION,
410 {
411 softwareProductId,
412 version,
413 status
414 }
415 );
416 })
417 .catch(error => {
418 dispatch({
419 type: modalActionTypes.GLOBAL_MODAL_ERROR,
420 data: {
421 title: 'ERROR',
422 msg: error.responseJSON.message,
423 cancelButtonText: i18n('OK')
424 }
425 });
426 });
427 },
428
429 navigateToSoftwareProductValidationResults(
430 dispatch,
431 { softwareProductId, version, status }
432 ) {
433 setCurrentScreen(
434 dispatch,
435 enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION_RESULTS,
436 { softwareProductId, version, status }
437 );
438 },
439
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200440 navigateToSoftwareProductDependencies(
441 dispatch,
442 { softwareProductId, version, status }
443 ) {
444 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
445 dispatch,
446 { softwareProductId, version }
447 ).then(result => {
448 if (result.listCount >= 2) {
449 SoftwareProductDependenciesActionHelper.fetchDependencies(
450 dispatch,
451 { softwareProductId, version }
452 );
453 setCurrentScreen(
454 dispatch,
455 enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES,
456 { softwareProductId, version, status }
457 );
458 } else {
459 this.navigateToSoftwareProductLandingPage(dispatch, {
460 softwareProductId,
461 version,
462 status
463 });
464 }
465 });
466 },
Michael Landoefa037d2017-02-19 12:57:33 +0200467
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200468 navigateToSoftwareProductComponents(
469 dispatch,
470 { softwareProductId, version, status }
471 ) {
472 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
473 dispatch,
474 { softwareProductId, version }
475 );
476 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, {
477 softwareProductId,
478 version,
479 status
480 });
481 },
482 navigateToSoftwareProductDeployment(
483 dispatch,
484 { softwareProductId, version, status }
485 ) {
486 SoftwareProductDeploymentActionHelper.fetchDeploymentFlavorsList(
487 dispatch,
488 { softwareProductId, version }
489 );
490 ComputeFlavorActionHelper.fetchComputesListForVSP(dispatch, {
491 softwareProductId,
492 version
493 });
494 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, {
495 softwareProductId,
496 version,
497 status
498 });
499 },
500 navigateToSoftwareProductActivityLog(
501 dispatch,
502 { softwareProductId, version, status }
503 ) {
504 ActivityLogActionHelper.fetchActivityLog(dispatch, {
505 itemId: softwareProductId,
506 versionId: version.id
507 });
508 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, {
509 softwareProductId,
510 version,
511 status
512 });
513 },
Michael Landoefa037d2017-02-19 12:57:33 +0200514
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200515 navigateToSoftwareProductComponentProcesses(
516 dispatch,
517 { softwareProductId, componentId, version, status }
518 ) {
519 if (componentId && softwareProductId) {
520 SoftwareProductComponentProcessesActionHelper.fetchProcessesList(
521 dispatch,
522 { componentId, softwareProductId, version }
523 );
524 }
525 setCurrentScreen(
526 dispatch,
527 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES,
528 { softwareProductId, componentId, version, status }
529 );
530 },
AviZi280f8012017-06-09 02:39:56 +0300531
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200532 navigateToSoftwareProductComponentMonitoring(
533 dispatch,
534 { softwareProductId, version, componentId, status }
535 ) {
536 if (componentId && softwareProductId && version) {
537 SoftwareProductComponentsMonitoringAction.fetchExistingFiles(
538 dispatch,
539 { componentId, softwareProductId, version }
540 );
541 }
542 setCurrentScreen(
543 dispatch,
544 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING,
545 { softwareProductId, componentId, version, status }
546 );
547 },
Michael Landoefa037d2017-02-19 12:57:33 +0200548
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200549 navigateToComponentStorage(
550 dispatch,
551 { softwareProductId, componentId, version, status }
552 ) {
553 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
554 dispatch,
555 { softwareProductId, vspComponentId: componentId, version }
556 );
557 setCurrentScreen(
558 dispatch,
559 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE,
560 { softwareProductId, version, componentId, status }
561 );
562 },
Michael Landoefa037d2017-02-19 12:57:33 +0200563
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200564 navigateToComponentCompute(
565 dispatch,
566 { softwareProductId, componentId, version, status }
567 ) {
568 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
569 dispatch,
570 { softwareProductId, vspComponentId: componentId, version }
571 );
572 if (componentId && softwareProductId) {
573 ComputeFlavorActionHelper.fetchComputesList(dispatch, {
574 softwareProductId,
575 componentId,
576 version
577 });
578 }
579 setCurrentScreen(
580 dispatch,
581 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE,
582 { softwareProductId, version, componentId, status }
583 );
584 },
Michael Landoefa037d2017-02-19 12:57:33 +0200585
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200586 navigateToComponentNetwork(
587 dispatch,
588 { softwareProductId, componentId, version, status }
589 ) {
590 SoftwareProductComponentsNetworkActionHelper.fetchNICsList(dispatch, {
591 softwareProductId,
592 componentId,
593 version
594 });
595 setCurrentScreen(
596 dispatch,
597 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK,
598 { softwareProductId, version, componentId, status }
599 );
600 },
Michael Landoefa037d2017-02-19 12:57:33 +0200601
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200602 navigateToSoftwareProductComponentGeneral(
603 dispatch,
604 { softwareProductId, componentId, version, status }
605 ) {
606 if (componentId && softwareProductId) {
607 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
608 dispatch,
609 { softwareProductId, vspComponentId: componentId, version }
610 );
611 }
612 setCurrentScreen(
613 dispatch,
614 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL,
615 { softwareProductId, version, componentId, status }
616 );
617 },
Michael Landoefa037d2017-02-19 12:57:33 +0200618
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200619 navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(
620 dispatch,
621 { softwareProductId, componentId, version, status }
622 ) {
623 this.navigateToSoftwareProductComponentGeneral(dispatch, {
624 softwareProductId,
625 componentId,
626 version,
627 status
628 });
629 dispatch({
630 type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM,
631 mapOfExpandedIds: {
632 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true,
633 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS +
634 '|' +
635 componentId]: true
636 }
637 });
638 },
Michael Landoefa037d2017-02-19 12:57:33 +0200639
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200640 navigateToComponentLoadBalancing(
641 dispatch,
642 { softwareProductId, componentId, version, status }
643 ) {
644 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
645 dispatch,
646 { softwareProductId, vspComponentId: componentId, version }
647 );
648 setCurrentScreen(
649 dispatch,
650 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING,
651 { softwareProductId, version, componentId, status }
652 );
653 },
Michael Landoefa037d2017-02-19 12:57:33 +0200654
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200655 navigateToComponentImages(
656 dispatch,
657 { softwareProductId, componentId, version, status }
658 ) {
659 SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, {
660 softwareProductId,
661 componentId,
662 version
663 });
664 setCurrentScreen(
665 dispatch,
666 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES,
667 { softwareProductId, version, componentId, status }
668 );
669 },
Michael Landoefa037d2017-02-19 12:57:33 +0200670
svishnevea5e43c2018-04-15 09:06:57 +0300671 async navigateToVersionsPage(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200672 dispatch,
673 { itemType, itemId, itemName, additionalProps, users }
674 ) {
675 PermissionsActionHelper.fetchItemUsers(dispatch, {
676 itemId,
677 allUsers: users
678 });
679 VersionsPageActionHelper.selectNone(dispatch);
svishnevea5e43c2018-04-15 09:06:57 +0300680 await VersionsPageActionHelper.fetchVersions(dispatch, {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200681 itemType,
682 itemId
svishnevea5e43c2018-04-15 09:06:57 +0300683 });
684 const items = await ItemsHelper.fetchItem(itemId);
685 setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, {
686 status: items.status,
687 itemType,
688 itemId,
689 itemName,
690 vendorName: items.properties.vendorName,
691 vendorId: items.properties.vendorId,
692 additionalProps
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200693 });
694 },
Avi Zivb8e2faf2017-07-18 19:45:38 +0300695
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200696 checkMergeStatus(dispatch, { itemId, versionId, version }) {
697 return ItemsHelper.fetchVersion({ itemId, versionId }).then(
698 response => {
699 let state = (response && response.state) || {};
700 let { synchronizationState } = state;
701 // let inMerge = synchronizationState === SyncStates.MERGE;
702 MergeEditorActionHelper.fetchConflicts(dispatch, {
703 itemId,
704 version
705 }).then(data => {
706 dispatch({
707 type: actionTypes.CHECK_MERGE_STATUS,
708 synchronizationState,
709 conflictInfoList: data.conflictInfoList
710 });
711 });
712 }
713 );
714 },
az2497644017c2017-08-10 17:49:40 +0300715
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200716 forceBreadCrumbsUpdate(dispatch) {
717 dispatch({
718 type: actionTypes.SET_CURRENT_SCREEN,
719 currentScreen: {
720 forceBreadCrumbsUpdate: true
721 }
722 });
723 },
talig8e9c0652017-12-20 14:30:43 +0200724
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200725 updateCurrentScreenVersion(dispatch, version) {
726 dispatch({
727 type: actionTypes.SET_CURRENT_SCREEN_VERSION,
728 version
729 });
730 }
Michael Landoefa037d2017-02-19 12:57:33 +0200731};
talig8e9c0652017-12-20 14:30:43 +0200732
733export default OnboardingActionHelper;