blob: c3cf8b292fd50fd8fa9a0b8ae5c4eb4e99eb6dfd [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';
Michael Landoefa037d2017-02-19 12:57:33 +020051
52function setCurrentScreen(dispatch, screen, props = {}) {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020053 dispatch({
54 type: actionTypes.SET_CURRENT_SCREEN,
55 currentScreen: {
56 screen,
57 props,
58 forceBreadCrumbsUpdate: true
59 }
60 });
Michael Landoefa037d2017-02-19 12:57:33 +020061}
62
talig8e9c0652017-12-20 14:30:43 +020063export function updateCurrentScreenProps(dispatch, props = {}) {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020064 dispatch({
65 type: actionTypes.UPDATE_CURRENT_SCREEN_PROPS,
66 props
67 });
Michael Landoefa037d2017-02-19 12:57:33 +020068}
69
talig8e9c0652017-12-20 14:30:43 +020070const OnboardingActionHelper = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020071 loadItemsLists(dispatch) {
72 LicenseModelActionHelper.fetchLicenseModels(dispatch);
73 LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
74 LicenseModelActionHelper.fetchArchivedLicenseModels(dispatch);
75 SoftwareProductActionHelper.fetchSoftwareProductList(dispatch);
76 SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(dispatch);
77 SoftwareProductActionHelper.fetchArchivedSoftwareProductList(dispatch);
78 },
AviZi280f8012017-06-09 02:39:56 +030079
svishnevea5e43c2018-04-15 09:06:57 +030080 async navigateToOnboardingCatalog(dispatch) {
81 await FeaturesActionHelper.getFeaturesList(dispatch);
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020082 UsersActionHelper.fetchUsersList(dispatch);
83 this.loadItemsLists(dispatch);
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020084 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 },
svishnev7c727c12018-05-24 13:20:51 +0300211 async getUpdatedSoftwareProduct(dispatch, { softwareProductId, version }) {
212 const response = await SoftwareProductActionHelper.fetchSoftwareProduct(
213 dispatch,
214 {
215 softwareProductId,
216 version
217 }
218 );
219 let newResponse = false;
220 let newVersion = false;
221 // checking if there was healing and a new version should be open
222 if (response[0].version !== version.id) {
223 newResponse = await SoftwareProductActionHelper.fetchSoftwareProduct(
224 dispatch,
225 {
226 softwareProductId,
227 version: { ...version, id: response[0].version }
228 }
229 );
230 newVersion = await ItemsHelper.fetchVersion({
231 itemId: softwareProductId,
232 versionId: response[0].version
233 });
Michael Landoefa037d2017-02-19 12:57:33 +0200234
svishnev7c727c12018-05-24 13:20:51 +0300235 dispatch(
236 notificationActions.showInfo({
237 message: i18n(
238 'This is the current version of the VSP, as a result of healing'
239 )
240 })
241 );
242 }
243 return Promise.resolve(
244 newResponse
245 ? { softwareProduct: newResponse[0], newVersion }
246 : { softwareProduct: response[0], newVersion: version }
247 );
248 },
249 async navigateToSoftwareProductLandingPage(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200250 dispatch,
251 { softwareProductId, version, status }
252 ) {
253 SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch);
svishnev7c727c12018-05-24 13:20:51 +0300254 /**
255 * TODO remove when Filter toggle will be removed
256 */
svishnevea5e43c2018-04-15 09:06:57 +0300257 LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
svishnev7c727c12018-05-24 13:20:51 +0300258
259 const {
260 softwareProduct,
261 newVersion
262 } = await this.getUpdatedSoftwareProduct(dispatch, {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200263 softwareProductId,
264 version
svishnev7c727c12018-05-24 13:20:51 +0300265 });
266
267 let { vendorId: licenseModelId, licensingVersion } = softwareProduct;
268 SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {
269 licenseModelId,
270 licensingVersion
271 });
272 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
273 dispatch,
274 { softwareProductId, version: newVersion }
275 );
276 if (softwareProduct.onboardingOrigin === onboardingOriginTypes.ZIP) {
277 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200278 dispatch,
svishnev7c727c12018-05-24 13:20:51 +0300279 { softwareProductId, version: newVersion }
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200280 );
svishnev7c727c12018-05-24 13:20:51 +0300281 }
282 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {
283 softwareProductId,
284 licenseModelId,
285 version: newVersion,
286 status
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200287 });
288 },
AviZi280f8012017-06-09 02:39:56 +0300289
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200290 navigateToSoftwareProductDetails(
291 dispatch,
292 { softwareProductId, version, status }
293 ) {
294 SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {
295 softwareProductId,
296 version
297 }).then(response => {
298 let { vendorId: licenseModelId, licensingVersion } = response[0];
299 SoftwareProductActionHelper.loadLicensingVersionsList(dispatch, {
300 licenseModelId
301 });
302 SoftwareProductActionHelper.loadSoftwareProductDetailsData(
303 dispatch,
304 { licenseModelId, licensingVersion }
305 );
306 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, {
307 softwareProductId,
308 version,
309 status
310 });
311 });
312 },
Michael Landoefa037d2017-02-19 12:57:33 +0200313
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200314 navigateToSoftwareProductAttachmentsSetupTab(
315 dispatch,
316 { softwareProductId, version, status }
317 ) {
318 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {
319 softwareProductId,
320 version
321 });
322 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {
323 activeTab: attachmentsTabsMapping.SETUP
324 });
325 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {
326 softwareProductId,
327 version,
328 status
329 });
330 },
331 navigateToSoftwareProductAttachmentsValidationTab(
332 dispatch,
333 { softwareProductId, version, status }
334 ) {
335 SoftwareProductActionHelper.processAndValidateHeatCandidate(dispatch, {
336 softwareProductId,
337 version
338 }).then(() => {
339 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {
340 activeTab: attachmentsTabsMapping.VALIDATION
341 });
342 setCurrentScreen(
343 dispatch,
344 enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS,
345 { softwareProductId, version, status }
346 );
347 });
348 },
Michael Landoefa037d2017-02-19 12:57:33 +0200349
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200350 navigateToSoftwareProductProcesses(
351 dispatch,
352 { softwareProductId, version, status }
353 ) {
354 if (softwareProductId) {
355 SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, {
356 softwareProductId,
357 version
358 });
359 }
360 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, {
361 softwareProductId,
362 version,
363 status
364 });
365 },
Michael Landoefa037d2017-02-19 12:57:33 +0200366
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200367 navigateToSoftwareProductNetworks(
368 dispatch,
369 { softwareProductId, version, status }
370 ) {
371 if (softwareProductId) {
372 SoftwareProductNetworksActionHelper.fetchNetworksList(dispatch, {
373 softwareProductId,
374 version
375 });
376 }
377 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, {
378 softwareProductId,
379 version,
380 status
381 });
382 },
shrek2000c8a540b2017-09-11 15:45:37 +0300383
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200384 navigateToSoftwareProductDependencies(
385 dispatch,
386 { softwareProductId, version, status }
387 ) {
388 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
389 dispatch,
390 { softwareProductId, version }
391 ).then(result => {
392 if (result.listCount >= 2) {
393 SoftwareProductDependenciesActionHelper.fetchDependencies(
394 dispatch,
395 { softwareProductId, version }
396 );
397 setCurrentScreen(
398 dispatch,
399 enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES,
400 { softwareProductId, version, status }
401 );
402 } else {
403 this.navigateToSoftwareProductLandingPage(dispatch, {
404 softwareProductId,
405 version,
406 status
407 });
408 }
409 });
410 },
Michael Landoefa037d2017-02-19 12:57:33 +0200411
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200412 navigateToSoftwareProductComponents(
413 dispatch,
414 { softwareProductId, version, status }
415 ) {
416 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
417 dispatch,
418 { softwareProductId, version }
419 );
420 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, {
421 softwareProductId,
422 version,
423 status
424 });
425 },
426 navigateToSoftwareProductDeployment(
427 dispatch,
428 { softwareProductId, version, status }
429 ) {
430 SoftwareProductDeploymentActionHelper.fetchDeploymentFlavorsList(
431 dispatch,
432 { softwareProductId, version }
433 );
434 ComputeFlavorActionHelper.fetchComputesListForVSP(dispatch, {
435 softwareProductId,
436 version
437 });
438 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, {
439 softwareProductId,
440 version,
441 status
442 });
443 },
444 navigateToSoftwareProductActivityLog(
445 dispatch,
446 { softwareProductId, version, status }
447 ) {
448 ActivityLogActionHelper.fetchActivityLog(dispatch, {
449 itemId: softwareProductId,
450 versionId: version.id
451 });
452 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, {
453 softwareProductId,
454 version,
455 status
456 });
457 },
Michael Landoefa037d2017-02-19 12:57:33 +0200458
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200459 navigateToSoftwareProductComponentProcesses(
460 dispatch,
461 { softwareProductId, componentId, version, status }
462 ) {
463 if (componentId && softwareProductId) {
464 SoftwareProductComponentProcessesActionHelper.fetchProcessesList(
465 dispatch,
466 { componentId, softwareProductId, version }
467 );
468 }
469 setCurrentScreen(
470 dispatch,
471 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES,
472 { softwareProductId, componentId, version, status }
473 );
474 },
AviZi280f8012017-06-09 02:39:56 +0300475
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200476 navigateToSoftwareProductComponentMonitoring(
477 dispatch,
478 { softwareProductId, version, componentId, status }
479 ) {
480 if (componentId && softwareProductId && version) {
481 SoftwareProductComponentsMonitoringAction.fetchExistingFiles(
482 dispatch,
483 { componentId, softwareProductId, version }
484 );
485 }
486 setCurrentScreen(
487 dispatch,
488 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING,
489 { softwareProductId, componentId, version, status }
490 );
491 },
Michael Landoefa037d2017-02-19 12:57:33 +0200492
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200493 navigateToComponentStorage(
494 dispatch,
495 { softwareProductId, componentId, version, status }
496 ) {
497 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
498 dispatch,
499 { softwareProductId, vspComponentId: componentId, version }
500 );
501 setCurrentScreen(
502 dispatch,
503 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE,
504 { softwareProductId, version, componentId, status }
505 );
506 },
Michael Landoefa037d2017-02-19 12:57:33 +0200507
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200508 navigateToComponentCompute(
509 dispatch,
510 { softwareProductId, componentId, version, status }
511 ) {
512 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
513 dispatch,
514 { softwareProductId, vspComponentId: componentId, version }
515 );
516 if (componentId && softwareProductId) {
517 ComputeFlavorActionHelper.fetchComputesList(dispatch, {
518 softwareProductId,
519 componentId,
520 version
521 });
522 }
523 setCurrentScreen(
524 dispatch,
525 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE,
526 { softwareProductId, version, componentId, status }
527 );
528 },
Michael Landoefa037d2017-02-19 12:57:33 +0200529
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200530 navigateToComponentNetwork(
531 dispatch,
532 { softwareProductId, componentId, version, status }
533 ) {
534 SoftwareProductComponentsNetworkActionHelper.fetchNICsList(dispatch, {
535 softwareProductId,
536 componentId,
537 version
538 });
539 setCurrentScreen(
540 dispatch,
541 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK,
542 { softwareProductId, version, componentId, status }
543 );
544 },
Michael Landoefa037d2017-02-19 12:57:33 +0200545
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200546 navigateToSoftwareProductComponentGeneral(
547 dispatch,
548 { softwareProductId, componentId, version, status }
549 ) {
550 if (componentId && softwareProductId) {
551 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
552 dispatch,
553 { softwareProductId, vspComponentId: componentId, version }
554 );
555 }
556 setCurrentScreen(
557 dispatch,
558 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL,
559 { softwareProductId, version, componentId, status }
560 );
561 },
Michael Landoefa037d2017-02-19 12:57:33 +0200562
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200563 navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(
564 dispatch,
565 { softwareProductId, componentId, version, status }
566 ) {
567 this.navigateToSoftwareProductComponentGeneral(dispatch, {
568 softwareProductId,
569 componentId,
570 version,
571 status
572 });
573 dispatch({
574 type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM,
575 mapOfExpandedIds: {
576 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true,
577 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS +
578 '|' +
579 componentId]: true
580 }
581 });
582 },
Michael Landoefa037d2017-02-19 12:57:33 +0200583
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200584 navigateToComponentLoadBalancing(
585 dispatch,
586 { softwareProductId, componentId, version, status }
587 ) {
588 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
589 dispatch,
590 { softwareProductId, vspComponentId: componentId, version }
591 );
592 setCurrentScreen(
593 dispatch,
594 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING,
595 { softwareProductId, version, componentId, status }
596 );
597 },
Michael Landoefa037d2017-02-19 12:57:33 +0200598
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200599 navigateToComponentImages(
600 dispatch,
601 { softwareProductId, componentId, version, status }
602 ) {
603 SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, {
604 softwareProductId,
605 componentId,
606 version
607 });
608 setCurrentScreen(
609 dispatch,
610 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES,
611 { softwareProductId, version, componentId, status }
612 );
613 },
Michael Landoefa037d2017-02-19 12:57:33 +0200614
svishnevea5e43c2018-04-15 09:06:57 +0300615 async navigateToVersionsPage(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200616 dispatch,
617 { itemType, itemId, itemName, additionalProps, users }
618 ) {
619 PermissionsActionHelper.fetchItemUsers(dispatch, {
620 itemId,
621 allUsers: users
622 });
623 VersionsPageActionHelper.selectNone(dispatch);
svishnevea5e43c2018-04-15 09:06:57 +0300624 await VersionsPageActionHelper.fetchVersions(dispatch, {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200625 itemType,
626 itemId
svishnevea5e43c2018-04-15 09:06:57 +0300627 });
628 const items = await ItemsHelper.fetchItem(itemId);
629 setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, {
630 status: items.status,
631 itemType,
632 itemId,
633 itemName,
634 vendorName: items.properties.vendorName,
635 vendorId: items.properties.vendorId,
636 additionalProps
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200637 });
638 },
Avi Zivb8e2faf2017-07-18 19:45:38 +0300639
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200640 checkMergeStatus(dispatch, { itemId, versionId, version }) {
641 return ItemsHelper.fetchVersion({ itemId, versionId }).then(
642 response => {
643 let state = (response && response.state) || {};
644 let { synchronizationState } = state;
645 // let inMerge = synchronizationState === SyncStates.MERGE;
646 MergeEditorActionHelper.fetchConflicts(dispatch, {
647 itemId,
648 version
649 }).then(data => {
650 dispatch({
651 type: actionTypes.CHECK_MERGE_STATUS,
652 synchronizationState,
653 conflictInfoList: data.conflictInfoList
654 });
655 });
656 }
657 );
658 },
az2497644017c2017-08-10 17:49:40 +0300659
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200660 forceBreadCrumbsUpdate(dispatch) {
661 dispatch({
662 type: actionTypes.SET_CURRENT_SCREEN,
663 currentScreen: {
664 forceBreadCrumbsUpdate: true
665 }
666 });
667 },
talig8e9c0652017-12-20 14:30:43 +0200668
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200669 updateCurrentScreenVersion(dispatch, version) {
670 dispatch({
671 type: actionTypes.SET_CURRENT_SCREEN_VERSION,
672 version
673 });
674 }
Michael Landoefa037d2017-02-19 12:57:33 +0200675};
talig8e9c0652017-12-20 14:30:43 +0200676
677export default OnboardingActionHelper;