blob: 688806cf9a32bf8b670ff91fa6f474f217a7c17e [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';
atulpurohit8b346842019-11-05 14:31:56 +053052import SoftwareProductValidationResultsViewActionHelper from './softwareProduct/validationResults/SoftwareProductValidationResultsViewActionHelper.js';
53
Vodafone804ec682019-03-18 15:46:53 +053054import { actionTypes as modalActionTypes } from 'nfvo-components/modal/GlobalModalConstants.js';
Michael Landoefa037d2017-02-19 12:57:33 +020055
56function setCurrentScreen(dispatch, screen, props = {}) {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020057 dispatch({
58 type: actionTypes.SET_CURRENT_SCREEN,
59 currentScreen: {
60 screen,
61 props,
62 forceBreadCrumbsUpdate: true
63 }
64 });
Michael Landoefa037d2017-02-19 12:57:33 +020065}
66
talig8e9c0652017-12-20 14:30:43 +020067export function updateCurrentScreenProps(dispatch, props = {}) {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020068 dispatch({
69 type: actionTypes.UPDATE_CURRENT_SCREEN_PROPS,
70 props
71 });
Michael Landoefa037d2017-02-19 12:57:33 +020072}
73
talig8e9c0652017-12-20 14:30:43 +020074const OnboardingActionHelper = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020075 loadItemsLists(dispatch) {
76 LicenseModelActionHelper.fetchLicenseModels(dispatch);
77 LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
78 LicenseModelActionHelper.fetchArchivedLicenseModels(dispatch);
79 SoftwareProductActionHelper.fetchSoftwareProductList(dispatch);
80 SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(dispatch);
81 SoftwareProductActionHelper.fetchArchivedSoftwareProductList(dispatch);
82 },
AviZi280f8012017-06-09 02:39:56 +030083
svishnevea5e43c2018-04-15 09:06:57 +030084 async navigateToOnboardingCatalog(dispatch) {
85 await FeaturesActionHelper.getFeaturesList(dispatch);
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020086 UsersActionHelper.fetchUsersList(dispatch);
87 this.loadItemsLists(dispatch);
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020088 setCurrentScreen(dispatch, enums.SCREEN.ONBOARDING_CATALOG);
svishnevea5e43c2018-04-15 09:06:57 +030089 dispatch({
90 type: filterActionTypes.FILTER_DATA_CHANGED,
91 deltaData: {}
92 });
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020093 },
talig8e9c0652017-12-20 14:30:43 +020094
Vodafone804ec682019-03-18 15:46:53 +053095 saveIsValidationDisabled(dispatch, { isValidationDisabled }) {
96 SoftwareProductValidationActionHelper.setIsVspValidationDisabled(
97 dispatch,
98 { isValidationDisabled }
99 );
100 },
101
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200102 autoSaveBeforeNavigate(
103 dispatch,
104 { softwareProductId, version, vspComponentId, dataToSave }
105 ) {
106 if (softwareProductId) {
107 if (vspComponentId) {
108 return SoftwareProductComponentsActionHelper.updateSoftwareProductComponent(
109 dispatch,
110 {
111 softwareProductId,
112 version,
113 vspComponentId,
114 componentData: dataToSave.componentData,
115 qdata: dataToSave.qdata
116 }
117 );
118 }
119 return SoftwareProductActionHelper.updateSoftwareProduct(dispatch, {
120 softwareProduct: dataToSave.softwareProduct,
121 version,
122 qdata: dataToSave.qdata
123 });
124 }
125 return Promise.resolve();
126 },
Michael Landoefa037d2017-02-19 12:57:33 +0200127
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200128 navigateToLicenseModelOverview(
129 dispatch,
130 { licenseModelId, version, status }
131 ) {
132 /**
133 * TODO change to specific rest
134 */
AviZi280f8012017-06-09 02:39:56 +0300135
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200136 LicenseModelActionHelper.fetchLicenseModelById(dispatch, {
137 licenseModelId,
138 version
139 }).then(() => {
140 LicenseModelActionHelper.fetchLicenseModelItems(dispatch, {
141 licenseModelId,
142 version
143 }).then(() => {
144 setCurrentScreen(
145 dispatch,
146 enums.SCREEN.LICENSE_MODEL_OVERVIEW,
147 { licenseModelId, version, status }
148 );
149 });
150 licenseModelOverviewActionHelper.selectVLMListView(dispatch, {
151 buttonTab: null
152 });
153 });
154 },
155 navigateToLicenseAgreements(dispatch, { licenseModelId, version, status }) {
156 LicenseAgreementActionHelper.fetchLicenseAgreementList(dispatch, {
157 licenseModelId,
158 version
159 });
160 LicenseModelActionHelper.fetchLicenseModelById(dispatch, {
161 licenseModelId,
162 version
163 }).then(() => {
164 setCurrentScreen(dispatch, enums.SCREEN.LICENSE_AGREEMENTS, {
165 licenseModelId,
166 version,
167 status
168 });
169 });
170 },
AviZi280f8012017-06-09 02:39:56 +0300171
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200172 navigateToFeatureGroups(dispatch, { licenseModelId, version, status }) {
173 FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {
174 licenseModelId,
175 version
176 });
177 setCurrentScreen(dispatch, enums.SCREEN.FEATURE_GROUPS, {
178 licenseModelId,
179 version,
180 status
181 });
182 },
AviZi280f8012017-06-09 02:39:56 +0300183
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200184 navigateToEntitlementPools(dispatch, { licenseModelId, version, status }) {
185 EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {
186 licenseModelId,
187 version
188 });
189 setCurrentScreen(dispatch, enums.SCREEN.ENTITLEMENT_POOLS, {
190 licenseModelId,
191 version,
192 status
193 });
194 },
Michael Landoefa037d2017-02-19 12:57:33 +0200195
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200196 navigateToLicenseKeyGroups(dispatch, { licenseModelId, version, status }) {
197 LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {
198 licenseModelId,
199 version
200 });
201 setCurrentScreen(dispatch, enums.SCREEN.LICENSE_KEY_GROUPS, {
202 licenseModelId,
203 version,
204 status
205 });
206 },
Michael Landoefa037d2017-02-19 12:57:33 +0200207
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200208 navigateToLicenseModelActivityLog(
209 dispatch,
210 { licenseModelId, version, status }
211 ) {
212 ActivityLogActionHelper.fetchActivityLog(dispatch, {
213 itemId: licenseModelId,
214 versionId: version.id
215 });
216 setCurrentScreen(dispatch, enums.SCREEN.ACTIVITY_LOG, {
217 licenseModelId,
218 version,
219 status
220 });
221 },
svishnev7c727c12018-05-24 13:20:51 +0300222 async getUpdatedSoftwareProduct(dispatch, { softwareProductId, version }) {
223 const response = await SoftwareProductActionHelper.fetchSoftwareProduct(
224 dispatch,
225 {
226 softwareProductId,
227 version
228 }
229 );
230 let newResponse = false;
231 let newVersion = false;
232 // checking if there was healing and a new version should be open
233 if (response[0].version !== version.id) {
234 newResponse = await SoftwareProductActionHelper.fetchSoftwareProduct(
235 dispatch,
236 {
237 softwareProductId,
238 version: { ...version, id: response[0].version }
239 }
240 );
241 newVersion = await ItemsHelper.fetchVersion({
242 itemId: softwareProductId,
243 versionId: response[0].version
244 });
Michael Landoefa037d2017-02-19 12:57:33 +0200245
svishnev7c727c12018-05-24 13:20:51 +0300246 dispatch(
247 notificationActions.showInfo({
248 message: i18n(
249 'This is the current version of the VSP, as a result of healing'
250 )
251 })
252 );
253 }
254 return Promise.resolve(
255 newResponse
256 ? { softwareProduct: newResponse[0], newVersion }
257 : { softwareProduct: response[0], newVersion: version }
258 );
259 },
260 async navigateToSoftwareProductLandingPage(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200261 dispatch,
262 { softwareProductId, version, status }
263 ) {
264 SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch);
svishnev7c727c12018-05-24 13:20:51 +0300265 /**
266 * TODO remove when Filter toggle will be removed
267 */
svishnevea5e43c2018-04-15 09:06:57 +0300268 LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
svishnev7c727c12018-05-24 13:20:51 +0300269
270 const {
271 softwareProduct,
272 newVersion
273 } = await this.getUpdatedSoftwareProduct(dispatch, {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200274 softwareProductId,
275 version
svishnev7c727c12018-05-24 13:20:51 +0300276 });
277
278 let { vendorId: licenseModelId, licensingVersion } = softwareProduct;
279 SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {
280 licenseModelId,
281 licensingVersion
282 });
283 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
284 dispatch,
285 { softwareProductId, version: newVersion }
286 );
287 if (softwareProduct.onboardingOrigin === onboardingOriginTypes.ZIP) {
288 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200289 dispatch,
svishnev7c727c12018-05-24 13:20:51 +0300290 { softwareProductId, version: newVersion }
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200291 );
svishnev7c727c12018-05-24 13:20:51 +0300292 }
293 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {
294 softwareProductId,
295 licenseModelId,
296 version: newVersion,
297 status
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200298 });
299 },
AviZi280f8012017-06-09 02:39:56 +0300300
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200301 navigateToSoftwareProductDetails(
302 dispatch,
303 { softwareProductId, version, status }
304 ) {
305 SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {
306 softwareProductId,
307 version
308 }).then(response => {
309 let { vendorId: licenseModelId, licensingVersion } = response[0];
310 SoftwareProductActionHelper.loadLicensingVersionsList(dispatch, {
311 licenseModelId
312 });
313 SoftwareProductActionHelper.loadSoftwareProductDetailsData(
314 dispatch,
315 { licenseModelId, licensingVersion }
316 );
317 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, {
318 softwareProductId,
319 version,
320 status
321 });
322 });
323 },
Michael Landoefa037d2017-02-19 12:57:33 +0200324
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200325 navigateToSoftwareProductAttachmentsSetupTab(
326 dispatch,
327 { softwareProductId, version, status }
328 ) {
329 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {
330 softwareProductId,
331 version
332 });
333 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {
334 activeTab: attachmentsTabsMapping.SETUP
335 });
336 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {
337 softwareProductId,
338 version,
339 status
340 });
341 },
342 navigateToSoftwareProductAttachmentsValidationTab(
343 dispatch,
344 { softwareProductId, version, status }
345 ) {
346 SoftwareProductActionHelper.processAndValidateHeatCandidate(dispatch, {
347 softwareProductId,
348 version
349 }).then(() => {
350 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {
351 activeTab: attachmentsTabsMapping.VALIDATION
352 });
353 setCurrentScreen(
354 dispatch,
355 enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS,
356 { softwareProductId, version, status }
357 );
358 });
359 },
andre.schmid6692cde2019-07-16 10:01:17 +0000360 viewSoftwareProductAttachmentsValidationTab(
361 dispatch,
362 { softwareProductId, version, status }
363 ) {
364 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {
365 softwareProductId,
366 version
367 });
368 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {
369 activeTab: attachmentsTabsMapping.VALIDATION
370 });
371 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {
372 softwareProductId,
373 version,
374 status
375 });
376 },
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200377 navigateToSoftwareProductProcesses(
378 dispatch,
379 { softwareProductId, version, status }
380 ) {
381 if (softwareProductId) {
382 SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, {
383 softwareProductId,
384 version
385 });
386 }
387 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, {
388 softwareProductId,
389 version,
390 status
391 });
392 },
Michael Landoefa037d2017-02-19 12:57:33 +0200393
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200394 navigateToSoftwareProductNetworks(
395 dispatch,
396 { softwareProductId, version, status }
397 ) {
398 if (softwareProductId) {
399 SoftwareProductNetworksActionHelper.fetchNetworksList(dispatch, {
400 softwareProductId,
401 version
402 });
403 }
404 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, {
405 softwareProductId,
406 version,
407 status
408 });
409 },
shrek2000c8a540b2017-09-11 15:45:37 +0300410
Vodafone804ec682019-03-18 15:46:53 +0530411 navigateToSoftwareProductValidation(
412 dispatch,
413 { softwareProductId, version, status }
414 ) {
415 SoftwareProductValidationActionHelper.fetchVspChecks(dispatch)
416 .then(() => {
417 SoftwareProductValidationActionHelper.setCertificationChecked(
418 dispatch,
419 []
420 );
421 SoftwareProductValidationActionHelper.setComplianceChecked(
422 dispatch,
423 []
424 );
425 setCurrentScreen(
426 dispatch,
427 enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION,
428 {
429 softwareProductId,
430 version,
431 status
432 }
433 );
434 })
435 .catch(error => {
436 dispatch({
437 type: modalActionTypes.GLOBAL_MODAL_ERROR,
438 data: {
439 title: 'ERROR',
440 msg: error.responseJSON.message,
441 cancelButtonText: i18n('OK')
442 }
443 });
444 });
445 },
446
447 navigateToSoftwareProductValidationResults(
448 dispatch,
449 { softwareProductId, version, status }
450 ) {
atulpurohit8b346842019-11-05 14:31:56 +0530451 SoftwareProductValidationResultsViewActionHelper.fetchVspChecks(
452 dispatch
453 )
454 .then(() => {
455 setCurrentScreen(
456 dispatch,
457 enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION_RESULTS,
458 { softwareProductId, version, status }
459 );
460 })
461 .catch(error => {
462 dispatch({
463 type: modalActionTypes.GLOBAL_MODAL_ERROR,
464 data: {
465 title: 'ERROR',
466 msg: error.responseJSON.message,
467 cancelButtonText: i18n('OK')
468 }
469 });
470 });
Vodafone804ec682019-03-18 15:46:53 +0530471 },
472
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200473 navigateToSoftwareProductDependencies(
474 dispatch,
475 { softwareProductId, version, status }
476 ) {
477 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
478 dispatch,
479 { softwareProductId, version }
480 ).then(result => {
481 if (result.listCount >= 2) {
482 SoftwareProductDependenciesActionHelper.fetchDependencies(
483 dispatch,
484 { softwareProductId, version }
485 );
486 setCurrentScreen(
487 dispatch,
488 enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES,
489 { softwareProductId, version, status }
490 );
491 } else {
492 this.navigateToSoftwareProductLandingPage(dispatch, {
493 softwareProductId,
494 version,
495 status
496 });
497 }
498 });
499 },
Michael Landoefa037d2017-02-19 12:57:33 +0200500
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200501 navigateToSoftwareProductComponents(
502 dispatch,
503 { softwareProductId, version, status }
504 ) {
505 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
506 dispatch,
507 { softwareProductId, version }
508 );
509 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, {
510 softwareProductId,
511 version,
512 status
513 });
514 },
515 navigateToSoftwareProductDeployment(
516 dispatch,
517 { softwareProductId, version, status }
518 ) {
519 SoftwareProductDeploymentActionHelper.fetchDeploymentFlavorsList(
520 dispatch,
521 { softwareProductId, version }
522 );
523 ComputeFlavorActionHelper.fetchComputesListForVSP(dispatch, {
524 softwareProductId,
525 version
526 });
527 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, {
528 softwareProductId,
529 version,
530 status
531 });
532 },
533 navigateToSoftwareProductActivityLog(
534 dispatch,
535 { softwareProductId, version, status }
536 ) {
537 ActivityLogActionHelper.fetchActivityLog(dispatch, {
538 itemId: softwareProductId,
539 versionId: version.id
540 });
541 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, {
542 softwareProductId,
543 version,
544 status
545 });
546 },
Michael Landoefa037d2017-02-19 12:57:33 +0200547
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200548 navigateToSoftwareProductComponentProcesses(
549 dispatch,
550 { softwareProductId, componentId, version, status }
551 ) {
552 if (componentId && softwareProductId) {
553 SoftwareProductComponentProcessesActionHelper.fetchProcessesList(
554 dispatch,
555 { componentId, softwareProductId, version }
556 );
557 }
558 setCurrentScreen(
559 dispatch,
560 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES,
561 { softwareProductId, componentId, version, status }
562 );
563 },
AviZi280f8012017-06-09 02:39:56 +0300564
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200565 navigateToSoftwareProductComponentMonitoring(
566 dispatch,
567 { softwareProductId, version, componentId, status }
568 ) {
569 if (componentId && softwareProductId && version) {
570 SoftwareProductComponentsMonitoringAction.fetchExistingFiles(
571 dispatch,
572 { componentId, softwareProductId, version }
573 );
574 }
575 setCurrentScreen(
576 dispatch,
577 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING,
578 { softwareProductId, componentId, version, status }
579 );
580 },
Michael Landoefa037d2017-02-19 12:57:33 +0200581
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200582 navigateToComponentStorage(
583 dispatch,
584 { softwareProductId, componentId, version, status }
585 ) {
586 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
587 dispatch,
588 { softwareProductId, vspComponentId: componentId, version }
589 );
590 setCurrentScreen(
591 dispatch,
592 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE,
593 { softwareProductId, version, componentId, status }
594 );
595 },
Michael Landoefa037d2017-02-19 12:57:33 +0200596
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200597 navigateToComponentCompute(
598 dispatch,
599 { softwareProductId, componentId, version, status }
600 ) {
601 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
602 dispatch,
603 { softwareProductId, vspComponentId: componentId, version }
604 );
605 if (componentId && softwareProductId) {
606 ComputeFlavorActionHelper.fetchComputesList(dispatch, {
607 softwareProductId,
608 componentId,
609 version
610 });
611 }
612 setCurrentScreen(
613 dispatch,
614 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE,
615 { softwareProductId, version, componentId, status }
616 );
617 },
Michael Landoefa037d2017-02-19 12:57:33 +0200618
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200619 navigateToComponentNetwork(
620 dispatch,
621 { softwareProductId, componentId, version, status }
622 ) {
623 SoftwareProductComponentsNetworkActionHelper.fetchNICsList(dispatch, {
624 softwareProductId,
625 componentId,
626 version
627 });
628 setCurrentScreen(
629 dispatch,
630 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK,
631 { softwareProductId, version, componentId, status }
632 );
633 },
Michael Landoefa037d2017-02-19 12:57:33 +0200634
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200635 navigateToSoftwareProductComponentGeneral(
636 dispatch,
637 { softwareProductId, componentId, version, status }
638 ) {
639 if (componentId && softwareProductId) {
640 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
641 dispatch,
642 { softwareProductId, vspComponentId: componentId, version }
643 );
644 }
645 setCurrentScreen(
646 dispatch,
647 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL,
648 { softwareProductId, version, componentId, status }
649 );
650 },
Michael Landoefa037d2017-02-19 12:57:33 +0200651
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200652 navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(
653 dispatch,
654 { softwareProductId, componentId, version, status }
655 ) {
656 this.navigateToSoftwareProductComponentGeneral(dispatch, {
657 softwareProductId,
658 componentId,
659 version,
660 status
661 });
662 dispatch({
663 type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM,
664 mapOfExpandedIds: {
665 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true,
666 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS +
667 '|' +
668 componentId]: true
669 }
670 });
671 },
Michael Landoefa037d2017-02-19 12:57:33 +0200672
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200673 navigateToComponentLoadBalancing(
674 dispatch,
675 { softwareProductId, componentId, version, status }
676 ) {
677 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
678 dispatch,
679 { softwareProductId, vspComponentId: componentId, version }
680 );
681 setCurrentScreen(
682 dispatch,
683 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING,
684 { softwareProductId, version, componentId, status }
685 );
686 },
Michael Landoefa037d2017-02-19 12:57:33 +0200687
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200688 navigateToComponentImages(
689 dispatch,
690 { softwareProductId, componentId, version, status }
691 ) {
692 SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, {
693 softwareProductId,
694 componentId,
695 version
696 });
697 setCurrentScreen(
698 dispatch,
699 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES,
700 { softwareProductId, version, componentId, status }
701 );
702 },
Michael Landoefa037d2017-02-19 12:57:33 +0200703
svishnevea5e43c2018-04-15 09:06:57 +0300704 async navigateToVersionsPage(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200705 dispatch,
706 { itemType, itemId, itemName, additionalProps, users }
707 ) {
708 PermissionsActionHelper.fetchItemUsers(dispatch, {
709 itemId,
710 allUsers: users
711 });
712 VersionsPageActionHelper.selectNone(dispatch);
svishnevea5e43c2018-04-15 09:06:57 +0300713 await VersionsPageActionHelper.fetchVersions(dispatch, {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200714 itemType,
715 itemId
svishnevea5e43c2018-04-15 09:06:57 +0300716 });
717 const items = await ItemsHelper.fetchItem(itemId);
718 setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, {
719 status: items.status,
720 itemType,
721 itemId,
722 itemName,
723 vendorName: items.properties.vendorName,
724 vendorId: items.properties.vendorId,
725 additionalProps
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200726 });
727 },
Avi Zivb8e2faf2017-07-18 19:45:38 +0300728
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200729 checkMergeStatus(dispatch, { itemId, versionId, version }) {
730 return ItemsHelper.fetchVersion({ itemId, versionId }).then(
731 response => {
732 let state = (response && response.state) || {};
733 let { synchronizationState } = state;
734 // let inMerge = synchronizationState === SyncStates.MERGE;
735 MergeEditorActionHelper.fetchConflicts(dispatch, {
736 itemId,
737 version
738 }).then(data => {
739 dispatch({
740 type: actionTypes.CHECK_MERGE_STATUS,
741 synchronizationState,
742 conflictInfoList: data.conflictInfoList
743 });
744 });
745 }
746 );
747 },
az2497644017c2017-08-10 17:49:40 +0300748
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200749 forceBreadCrumbsUpdate(dispatch) {
750 dispatch({
751 type: actionTypes.SET_CURRENT_SCREEN,
752 currentScreen: {
753 forceBreadCrumbsUpdate: true
754 }
755 });
756 },
talig8e9c0652017-12-20 14:30:43 +0200757
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200758 updateCurrentScreenVersion(dispatch, version) {
759 dispatch({
760 type: actionTypes.SET_CURRENT_SCREEN_VERSION,
761 version
762 });
763 }
Michael Landoefa037d2017-02-19 12:57:33 +0200764};
talig8e9c0652017-12-20 14:30:43 +0200765
766export default OnboardingActionHelper;