blob: 754c11206de4865355324b08f009c10df433a3d0 [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 },
andre.schmid6692cde2019-07-16 10:01:17 +0000358 viewSoftwareProductAttachmentsValidationTab(
359 dispatch,
360 { softwareProductId, version, status }
361 ) {
362 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {
363 softwareProductId,
364 version
365 });
366 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {
367 activeTab: attachmentsTabsMapping.VALIDATION
368 });
369 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {
370 softwareProductId,
371 version,
372 status
373 });
374 },
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200375 navigateToSoftwareProductProcesses(
376 dispatch,
377 { softwareProductId, version, status }
378 ) {
379 if (softwareProductId) {
380 SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, {
381 softwareProductId,
382 version
383 });
384 }
385 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, {
386 softwareProductId,
387 version,
388 status
389 });
390 },
Michael Landoefa037d2017-02-19 12:57:33 +0200391
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200392 navigateToSoftwareProductNetworks(
393 dispatch,
394 { softwareProductId, version, status }
395 ) {
396 if (softwareProductId) {
397 SoftwareProductNetworksActionHelper.fetchNetworksList(dispatch, {
398 softwareProductId,
399 version
400 });
401 }
402 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, {
403 softwareProductId,
404 version,
405 status
406 });
407 },
shrek2000c8a540b2017-09-11 15:45:37 +0300408
Vodafone804ec682019-03-18 15:46:53 +0530409 navigateToSoftwareProductValidation(
410 dispatch,
411 { softwareProductId, version, status }
412 ) {
413 SoftwareProductValidationActionHelper.fetchVspChecks(dispatch)
414 .then(() => {
415 SoftwareProductValidationActionHelper.setCertificationChecked(
416 dispatch,
417 []
418 );
419 SoftwareProductValidationActionHelper.setComplianceChecked(
420 dispatch,
421 []
422 );
423 setCurrentScreen(
424 dispatch,
425 enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION,
426 {
427 softwareProductId,
428 version,
429 status
430 }
431 );
432 })
433 .catch(error => {
434 dispatch({
435 type: modalActionTypes.GLOBAL_MODAL_ERROR,
436 data: {
437 title: 'ERROR',
438 msg: error.responseJSON.message,
439 cancelButtonText: i18n('OK')
440 }
441 });
442 });
443 },
444
445 navigateToSoftwareProductValidationResults(
446 dispatch,
447 { softwareProductId, version, status }
448 ) {
449 setCurrentScreen(
450 dispatch,
451 enums.SCREEN.SOFTWARE_PRODUCT_VALIDATION_RESULTS,
452 { softwareProductId, version, status }
453 );
454 },
455
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200456 navigateToSoftwareProductDependencies(
457 dispatch,
458 { softwareProductId, version, status }
459 ) {
460 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
461 dispatch,
462 { softwareProductId, version }
463 ).then(result => {
464 if (result.listCount >= 2) {
465 SoftwareProductDependenciesActionHelper.fetchDependencies(
466 dispatch,
467 { softwareProductId, version }
468 );
469 setCurrentScreen(
470 dispatch,
471 enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES,
472 { softwareProductId, version, status }
473 );
474 } else {
475 this.navigateToSoftwareProductLandingPage(dispatch, {
476 softwareProductId,
477 version,
478 status
479 });
480 }
481 });
482 },
Michael Landoefa037d2017-02-19 12:57:33 +0200483
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200484 navigateToSoftwareProductComponents(
485 dispatch,
486 { softwareProductId, version, status }
487 ) {
488 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
489 dispatch,
490 { softwareProductId, version }
491 );
492 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, {
493 softwareProductId,
494 version,
495 status
496 });
497 },
498 navigateToSoftwareProductDeployment(
499 dispatch,
500 { softwareProductId, version, status }
501 ) {
502 SoftwareProductDeploymentActionHelper.fetchDeploymentFlavorsList(
503 dispatch,
504 { softwareProductId, version }
505 );
506 ComputeFlavorActionHelper.fetchComputesListForVSP(dispatch, {
507 softwareProductId,
508 version
509 });
510 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, {
511 softwareProductId,
512 version,
513 status
514 });
515 },
516 navigateToSoftwareProductActivityLog(
517 dispatch,
518 { softwareProductId, version, status }
519 ) {
520 ActivityLogActionHelper.fetchActivityLog(dispatch, {
521 itemId: softwareProductId,
522 versionId: version.id
523 });
524 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, {
525 softwareProductId,
526 version,
527 status
528 });
529 },
Michael Landoefa037d2017-02-19 12:57:33 +0200530
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200531 navigateToSoftwareProductComponentProcesses(
532 dispatch,
533 { softwareProductId, componentId, version, status }
534 ) {
535 if (componentId && softwareProductId) {
536 SoftwareProductComponentProcessesActionHelper.fetchProcessesList(
537 dispatch,
538 { componentId, softwareProductId, version }
539 );
540 }
541 setCurrentScreen(
542 dispatch,
543 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES,
544 { softwareProductId, componentId, version, status }
545 );
546 },
AviZi280f8012017-06-09 02:39:56 +0300547
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200548 navigateToSoftwareProductComponentMonitoring(
549 dispatch,
550 { softwareProductId, version, componentId, status }
551 ) {
552 if (componentId && softwareProductId && version) {
553 SoftwareProductComponentsMonitoringAction.fetchExistingFiles(
554 dispatch,
555 { componentId, softwareProductId, version }
556 );
557 }
558 setCurrentScreen(
559 dispatch,
560 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING,
561 { softwareProductId, componentId, version, status }
562 );
563 },
Michael Landoefa037d2017-02-19 12:57:33 +0200564
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200565 navigateToComponentStorage(
566 dispatch,
567 { softwareProductId, componentId, version, status }
568 ) {
569 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
570 dispatch,
571 { softwareProductId, vspComponentId: componentId, version }
572 );
573 setCurrentScreen(
574 dispatch,
575 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE,
576 { softwareProductId, version, componentId, status }
577 );
578 },
Michael Landoefa037d2017-02-19 12:57:33 +0200579
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200580 navigateToComponentCompute(
581 dispatch,
582 { softwareProductId, componentId, version, status }
583 ) {
584 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
585 dispatch,
586 { softwareProductId, vspComponentId: componentId, version }
587 );
588 if (componentId && softwareProductId) {
589 ComputeFlavorActionHelper.fetchComputesList(dispatch, {
590 softwareProductId,
591 componentId,
592 version
593 });
594 }
595 setCurrentScreen(
596 dispatch,
597 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE,
598 { softwareProductId, version, componentId, status }
599 );
600 },
Michael Landoefa037d2017-02-19 12:57:33 +0200601
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200602 navigateToComponentNetwork(
603 dispatch,
604 { softwareProductId, componentId, version, status }
605 ) {
606 SoftwareProductComponentsNetworkActionHelper.fetchNICsList(dispatch, {
607 softwareProductId,
608 componentId,
609 version
610 });
611 setCurrentScreen(
612 dispatch,
613 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK,
614 { softwareProductId, version, componentId, status }
615 );
616 },
Michael Landoefa037d2017-02-19 12:57:33 +0200617
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200618 navigateToSoftwareProductComponentGeneral(
619 dispatch,
620 { softwareProductId, componentId, version, status }
621 ) {
622 if (componentId && softwareProductId) {
623 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
624 dispatch,
625 { softwareProductId, vspComponentId: componentId, version }
626 );
627 }
628 setCurrentScreen(
629 dispatch,
630 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL,
631 { softwareProductId, version, componentId, status }
632 );
633 },
Michael Landoefa037d2017-02-19 12:57:33 +0200634
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200635 navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(
636 dispatch,
637 { softwareProductId, componentId, version, status }
638 ) {
639 this.navigateToSoftwareProductComponentGeneral(dispatch, {
640 softwareProductId,
641 componentId,
642 version,
643 status
644 });
645 dispatch({
646 type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM,
647 mapOfExpandedIds: {
648 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true,
649 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS +
650 '|' +
651 componentId]: true
652 }
653 });
654 },
Michael Landoefa037d2017-02-19 12:57:33 +0200655
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200656 navigateToComponentLoadBalancing(
657 dispatch,
658 { softwareProductId, componentId, version, status }
659 ) {
660 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
661 dispatch,
662 { softwareProductId, vspComponentId: componentId, version }
663 );
664 setCurrentScreen(
665 dispatch,
666 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING,
667 { softwareProductId, version, componentId, status }
668 );
669 },
Michael Landoefa037d2017-02-19 12:57:33 +0200670
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200671 navigateToComponentImages(
672 dispatch,
673 { softwareProductId, componentId, version, status }
674 ) {
675 SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, {
676 softwareProductId,
677 componentId,
678 version
679 });
680 setCurrentScreen(
681 dispatch,
682 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES,
683 { softwareProductId, version, componentId, status }
684 );
685 },
Michael Landoefa037d2017-02-19 12:57:33 +0200686
svishnevea5e43c2018-04-15 09:06:57 +0300687 async navigateToVersionsPage(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200688 dispatch,
689 { itemType, itemId, itemName, additionalProps, users }
690 ) {
691 PermissionsActionHelper.fetchItemUsers(dispatch, {
692 itemId,
693 allUsers: users
694 });
695 VersionsPageActionHelper.selectNone(dispatch);
svishnevea5e43c2018-04-15 09:06:57 +0300696 await VersionsPageActionHelper.fetchVersions(dispatch, {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200697 itemType,
698 itemId
svishnevea5e43c2018-04-15 09:06:57 +0300699 });
700 const items = await ItemsHelper.fetchItem(itemId);
701 setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, {
702 status: items.status,
703 itemType,
704 itemId,
705 itemName,
706 vendorName: items.properties.vendorName,
707 vendorId: items.properties.vendorId,
708 additionalProps
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200709 });
710 },
Avi Zivb8e2faf2017-07-18 19:45:38 +0300711
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200712 checkMergeStatus(dispatch, { itemId, versionId, version }) {
713 return ItemsHelper.fetchVersion({ itemId, versionId }).then(
714 response => {
715 let state = (response && response.state) || {};
716 let { synchronizationState } = state;
717 // let inMerge = synchronizationState === SyncStates.MERGE;
718 MergeEditorActionHelper.fetchConflicts(dispatch, {
719 itemId,
720 version
721 }).then(data => {
722 dispatch({
723 type: actionTypes.CHECK_MERGE_STATUS,
724 synchronizationState,
725 conflictInfoList: data.conflictInfoList
726 });
727 });
728 }
729 );
730 },
az2497644017c2017-08-10 17:49:40 +0300731
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200732 forceBreadCrumbsUpdate(dispatch) {
733 dispatch({
734 type: actionTypes.SET_CURRENT_SCREEN,
735 currentScreen: {
736 forceBreadCrumbsUpdate: true
737 }
738 });
739 },
talig8e9c0652017-12-20 14:30:43 +0200740
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200741 updateCurrentScreenVersion(dispatch, version) {
742 dispatch({
743 type: actionTypes.SET_CURRENT_SCREEN_VERSION,
744 version
745 });
746 }
Michael Landoefa037d2017-02-19 12:57:33 +0200747};
talig8e9c0652017-12-20 14:30:43 +0200748
749export default OnboardingActionHelper;