blob: b9ffdc307663b4154dc6d81b371afce7cc887bd3 [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
svishnev1eb66b72018-01-11 14:39:45 +02007 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
Michael Landoefa037d2017-02-19 12:57:33 +020010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
svishnev1eb66b72018-01-11 14:39:45 +020012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
Michael Landoefa037d2017-02-19 12:57:33 +020015 */
svishnev1eb66b72018-01-11 14:39:45 +020016
talig8e9c0652017-12-20 14:30:43 +020017import UsersActionHelper from './users/UsersActionHelper.js';
18import VersionsPageActionHelper from './versionsPage/VersionsPageActionHelper.js';
19import PermissionsActionHelper from './permissions/PermissionsActionHelper.js';
Michael Landoefa037d2017-02-19 12:57:33 +020020import LicenseModelActionHelper from './licenseModel/LicenseModelActionHelper.js';
21import LicenseAgreementActionHelper from './licenseModel/licenseAgreement/LicenseAgreementActionHelper.js';
22import FeatureGroupsActionHelper from './licenseModel/featureGroups/FeatureGroupsActionHelper.js';
23import LicenseKeyGroupsActionHelper from './licenseModel/licenseKeyGroups/LicenseKeyGroupsActionHelper.js';
24import EntitlementPoolsActionHelper from './licenseModel/entitlementPools/EntitlementPoolsActionHelper.js';
25import SoftwareProductActionHelper from './softwareProduct/SoftwareProductActionHelper.js';
26import SoftwareProductProcessesActionHelper from './softwareProduct/processes/SoftwareProductProcessesActionHelper.js';
Avi Zivb8e2faf2017-07-18 19:45:38 +030027import SoftwareProductDeploymentActionHelper from './softwareProduct/deployment/SoftwareProductDeploymentActionHelper.js';
Michael Landoefa037d2017-02-19 12:57:33 +020028import SoftwareProductNetworksActionHelper from './softwareProduct/networks/SoftwareProductNetworksActionHelper.js';
29import SoftwareProductComponentsActionHelper from './softwareProduct/components/SoftwareProductComponentsActionHelper.js';
30import SoftwareProductComponentProcessesActionHelper from './softwareProduct/components/processes/SoftwareProductComponentProcessesActionHelper.js';
31import SoftwareProductComponentsNetworkActionHelper from './softwareProduct/components/network/SoftwareProductComponentsNetworkActionHelper.js';
AviZi280f8012017-06-09 02:39:56 +030032import SoftwareProductDependenciesActionHelper from './softwareProduct/dependencies/SoftwareProductDependenciesActionHelper.js';
Avi Zivb8e2faf2017-07-18 19:45:38 +030033import ComputeFlavorActionHelper from './softwareProduct/components/compute/ComputeFlavorActionHelper.js';
AviZi280f8012017-06-09 02:39:56 +030034import OnboardActionHelper from './onboard/OnboardActionHelper.js';
talig8e9c0652017-12-20 14:30:43 +020035import MergeEditorActionHelper from 'sdc-app/common/merge/MergeEditorActionHelper.js';
Michael Landoefa037d2017-02-19 12:57:33 +020036import SoftwareProductComponentsMonitoringAction from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringActionHelper.js';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020037import { actionTypes, enums } from './OnboardingConstants.js';
38import {
39 actionTypes as SoftwareProductActionTypes,
40 onboardingOriginTypes
41} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
Avi Zivb8e2faf2017-07-18 19:45:38 +030042import ActivityLogActionHelper from 'sdc-app/common/activity-log/ActivityLogActionHelper.js';
talig8e9c0652017-12-20 14:30:43 +020043import ItemsHelper from 'sdc-app/common/helpers/ItemsHelper.js';
44import SoftwareProductComponentsImageActionHelper from './softwareProduct/components/images/SoftwareProductComponentsImageActionHelper.js';
Michael Lando4d97d5f2017-06-17 22:40:44 +030045import licenseModelOverviewActionHelper from 'sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020046import { tabsMapping as attachmentsTabsMapping } from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js';
shrek2000c8a540b2017-09-11 15:45:37 +030047import SoftwareProductAttachmentsActionHelper from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js';
svishnevea5e43c2018-04-15 09:06:57 +030048import { actionTypes as filterActionTypes } from './onboard/filter/FilterConstants.js';
49import FeaturesActionHelper from 'sdc-app/features/FeaturesActionHelper.js';
svishnev7c727c12018-05-24 13:20:51 +030050import { notificationActions } from 'nfvo-components/notification/NotificationsConstants.js';
51import i18n from 'nfvo-utils/i18n/i18n.js';
Michael Landoefa037d2017-02-19 12:57:33 +020052
53function setCurrentScreen(dispatch, screen, props = {}) {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020054 dispatch({
55 type: actionTypes.SET_CURRENT_SCREEN,
56 currentScreen: {
57 screen,
58 props,
59 forceBreadCrumbsUpdate: true
60 }
61 });
Michael Landoefa037d2017-02-19 12:57:33 +020062}
63
talig8e9c0652017-12-20 14:30:43 +020064export function updateCurrentScreenProps(dispatch, props = {}) {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020065 dispatch({
66 type: actionTypes.UPDATE_CURRENT_SCREEN_PROPS,
67 props
68 });
Michael Landoefa037d2017-02-19 12:57:33 +020069}
70
talig8e9c0652017-12-20 14:30:43 +020071const OnboardingActionHelper = {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020072 loadItemsLists(dispatch) {
73 LicenseModelActionHelper.fetchLicenseModels(dispatch);
74 LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
75 LicenseModelActionHelper.fetchArchivedLicenseModels(dispatch);
76 SoftwareProductActionHelper.fetchSoftwareProductList(dispatch);
77 SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(dispatch);
78 SoftwareProductActionHelper.fetchArchivedSoftwareProductList(dispatch);
79 },
AviZi280f8012017-06-09 02:39:56 +030080
svishnevea5e43c2018-04-15 09:06:57 +030081 async navigateToOnboardingCatalog(dispatch) {
82 await FeaturesActionHelper.getFeaturesList(dispatch);
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020083 UsersActionHelper.fetchUsersList(dispatch);
84 this.loadItemsLists(dispatch);
85 OnboardActionHelper.resetOnboardStore(dispatch);
86 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
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020093 autoSaveBeforeNavigate(
94 dispatch,
95 { softwareProductId, version, vspComponentId, dataToSave }
96 ) {
97 if (softwareProductId) {
98 if (vspComponentId) {
99 return SoftwareProductComponentsActionHelper.updateSoftwareProductComponent(
100 dispatch,
101 {
102 softwareProductId,
103 version,
104 vspComponentId,
105 componentData: dataToSave.componentData,
106 qdata: dataToSave.qdata
107 }
108 );
109 }
110 return SoftwareProductActionHelper.updateSoftwareProduct(dispatch, {
111 softwareProduct: dataToSave.softwareProduct,
112 version,
113 qdata: dataToSave.qdata
114 });
115 }
116 return Promise.resolve();
117 },
Michael Landoefa037d2017-02-19 12:57:33 +0200118
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200119 navigateToLicenseModelOverview(
120 dispatch,
121 { licenseModelId, version, status }
122 ) {
123 /**
124 * TODO change to specific rest
125 */
AviZi280f8012017-06-09 02:39:56 +0300126
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200127 LicenseModelActionHelper.fetchLicenseModelById(dispatch, {
128 licenseModelId,
129 version
130 }).then(() => {
131 LicenseModelActionHelper.fetchLicenseModelItems(dispatch, {
132 licenseModelId,
133 version
134 }).then(() => {
135 setCurrentScreen(
136 dispatch,
137 enums.SCREEN.LICENSE_MODEL_OVERVIEW,
138 { licenseModelId, version, status }
139 );
140 });
141 licenseModelOverviewActionHelper.selectVLMListView(dispatch, {
142 buttonTab: null
143 });
144 });
145 },
146 navigateToLicenseAgreements(dispatch, { licenseModelId, version, status }) {
147 LicenseAgreementActionHelper.fetchLicenseAgreementList(dispatch, {
148 licenseModelId,
149 version
150 });
151 LicenseModelActionHelper.fetchLicenseModelById(dispatch, {
152 licenseModelId,
153 version
154 }).then(() => {
155 setCurrentScreen(dispatch, enums.SCREEN.LICENSE_AGREEMENTS, {
156 licenseModelId,
157 version,
158 status
159 });
160 });
161 },
AviZi280f8012017-06-09 02:39:56 +0300162
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200163 navigateToFeatureGroups(dispatch, { licenseModelId, version, status }) {
164 FeatureGroupsActionHelper.fetchFeatureGroupsList(dispatch, {
165 licenseModelId,
166 version
167 });
168 setCurrentScreen(dispatch, enums.SCREEN.FEATURE_GROUPS, {
169 licenseModelId,
170 version,
171 status
172 });
173 },
AviZi280f8012017-06-09 02:39:56 +0300174
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200175 navigateToEntitlementPools(dispatch, { licenseModelId, version, status }) {
176 EntitlementPoolsActionHelper.fetchEntitlementPoolsList(dispatch, {
177 licenseModelId,
178 version
179 });
180 setCurrentScreen(dispatch, enums.SCREEN.ENTITLEMENT_POOLS, {
181 licenseModelId,
182 version,
183 status
184 });
185 },
Michael Landoefa037d2017-02-19 12:57:33 +0200186
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200187 navigateToLicenseKeyGroups(dispatch, { licenseModelId, version, status }) {
188 LicenseKeyGroupsActionHelper.fetchLicenseKeyGroupsList(dispatch, {
189 licenseModelId,
190 version
191 });
192 setCurrentScreen(dispatch, enums.SCREEN.LICENSE_KEY_GROUPS, {
193 licenseModelId,
194 version,
195 status
196 });
197 },
Michael Landoefa037d2017-02-19 12:57:33 +0200198
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200199 navigateToLicenseModelActivityLog(
200 dispatch,
201 { licenseModelId, version, status }
202 ) {
203 ActivityLogActionHelper.fetchActivityLog(dispatch, {
204 itemId: licenseModelId,
205 versionId: version.id
206 });
207 setCurrentScreen(dispatch, enums.SCREEN.ACTIVITY_LOG, {
208 licenseModelId,
209 version,
210 status
211 });
212 },
svishnev7c727c12018-05-24 13:20:51 +0300213 async getUpdatedSoftwareProduct(dispatch, { softwareProductId, version }) {
214 const response = await SoftwareProductActionHelper.fetchSoftwareProduct(
215 dispatch,
216 {
217 softwareProductId,
218 version
219 }
220 );
221 let newResponse = false;
222 let newVersion = false;
223 // checking if there was healing and a new version should be open
224 if (response[0].version !== version.id) {
225 newResponse = await SoftwareProductActionHelper.fetchSoftwareProduct(
226 dispatch,
227 {
228 softwareProductId,
229 version: { ...version, id: response[0].version }
230 }
231 );
232 newVersion = await ItemsHelper.fetchVersion({
233 itemId: softwareProductId,
234 versionId: response[0].version
235 });
Michael Landoefa037d2017-02-19 12:57:33 +0200236
svishnev7c727c12018-05-24 13:20:51 +0300237 dispatch(
238 notificationActions.showInfo({
239 message: i18n(
240 'This is the current version of the VSP, as a result of healing'
241 )
242 })
243 );
244 }
245 return Promise.resolve(
246 newResponse
247 ? { softwareProduct: newResponse[0], newVersion }
248 : { softwareProduct: response[0], newVersion: version }
249 );
250 },
251 async navigateToSoftwareProductLandingPage(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200252 dispatch,
253 { softwareProductId, version, status }
254 ) {
255 SoftwareProductComponentsActionHelper.clearComponentsStore(dispatch);
svishnev7c727c12018-05-24 13:20:51 +0300256 /**
257 * TODO remove when Filter toggle will be removed
258 */
svishnevea5e43c2018-04-15 09:06:57 +0300259 LicenseModelActionHelper.fetchFinalizedLicenseModels(dispatch);
svishnev7c727c12018-05-24 13:20:51 +0300260
261 const {
262 softwareProduct,
263 newVersion
264 } = await this.getUpdatedSoftwareProduct(dispatch, {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200265 softwareProductId,
266 version
svishnev7c727c12018-05-24 13:20:51 +0300267 });
268
269 let { vendorId: licenseModelId, licensingVersion } = softwareProduct;
270 SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {
271 licenseModelId,
272 licensingVersion
273 });
274 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
275 dispatch,
276 { softwareProductId, version: newVersion }
277 );
278 if (softwareProduct.onboardingOrigin === onboardingOriginTypes.ZIP) {
279 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200280 dispatch,
svishnev7c727c12018-05-24 13:20:51 +0300281 { softwareProductId, version: newVersion }
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200282 );
svishnev7c727c12018-05-24 13:20:51 +0300283 }
284 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {
285 softwareProductId,
286 licenseModelId,
287 version: newVersion,
288 status
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200289 });
290 },
AviZi280f8012017-06-09 02:39:56 +0300291
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200292 navigateToSoftwareProductDetails(
293 dispatch,
294 { softwareProductId, version, status }
295 ) {
296 SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {
297 softwareProductId,
298 version
299 }).then(response => {
300 let { vendorId: licenseModelId, licensingVersion } = response[0];
301 SoftwareProductActionHelper.loadLicensingVersionsList(dispatch, {
302 licenseModelId
303 });
304 SoftwareProductActionHelper.loadSoftwareProductDetailsData(
305 dispatch,
306 { licenseModelId, licensingVersion }
307 );
308 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, {
309 softwareProductId,
310 version,
311 status
312 });
313 });
314 },
Michael Landoefa037d2017-02-19 12:57:33 +0200315
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200316 navigateToSoftwareProductAttachmentsSetupTab(
317 dispatch,
318 { softwareProductId, version, status }
319 ) {
320 SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {
321 softwareProductId,
322 version
323 });
324 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {
325 activeTab: attachmentsTabsMapping.SETUP
326 });
327 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {
328 softwareProductId,
329 version,
330 status
331 });
332 },
333 navigateToSoftwareProductAttachmentsValidationTab(
334 dispatch,
335 { softwareProductId, version, status }
336 ) {
337 SoftwareProductActionHelper.processAndValidateHeatCandidate(dispatch, {
338 softwareProductId,
339 version
340 }).then(() => {
341 SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {
342 activeTab: attachmentsTabsMapping.VALIDATION
343 });
344 setCurrentScreen(
345 dispatch,
346 enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS,
347 { softwareProductId, version, status }
348 );
349 });
350 },
Michael Landoefa037d2017-02-19 12:57:33 +0200351
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200352 navigateToSoftwareProductProcesses(
353 dispatch,
354 { softwareProductId, version, status }
355 ) {
356 if (softwareProductId) {
357 SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, {
358 softwareProductId,
359 version
360 });
361 }
362 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_PROCESSES, {
363 softwareProductId,
364 version,
365 status
366 });
367 },
Michael Landoefa037d2017-02-19 12:57:33 +0200368
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200369 navigateToSoftwareProductNetworks(
370 dispatch,
371 { softwareProductId, version, status }
372 ) {
373 if (softwareProductId) {
374 SoftwareProductNetworksActionHelper.fetchNetworksList(dispatch, {
375 softwareProductId,
376 version
377 });
378 }
379 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_NETWORKS, {
380 softwareProductId,
381 version,
382 status
383 });
384 },
shrek2000c8a540b2017-09-11 15:45:37 +0300385
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200386 navigateToSoftwareProductDependencies(
387 dispatch,
388 { softwareProductId, version, status }
389 ) {
390 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
391 dispatch,
392 { softwareProductId, version }
393 ).then(result => {
394 if (result.listCount >= 2) {
395 SoftwareProductDependenciesActionHelper.fetchDependencies(
396 dispatch,
397 { softwareProductId, version }
398 );
399 setCurrentScreen(
400 dispatch,
401 enums.SCREEN.SOFTWARE_PRODUCT_DEPENDENCIES,
402 { softwareProductId, version, status }
403 );
404 } else {
405 this.navigateToSoftwareProductLandingPage(dispatch, {
406 softwareProductId,
407 version,
408 status
409 });
410 }
411 });
412 },
Michael Landoefa037d2017-02-19 12:57:33 +0200413
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200414 navigateToSoftwareProductComponents(
415 dispatch,
416 { softwareProductId, version, status }
417 ) {
418 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(
419 dispatch,
420 { softwareProductId, version }
421 );
422 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS, {
423 softwareProductId,
424 version,
425 status
426 });
427 },
428 navigateToSoftwareProductDeployment(
429 dispatch,
430 { softwareProductId, version, status }
431 ) {
432 SoftwareProductDeploymentActionHelper.fetchDeploymentFlavorsList(
433 dispatch,
434 { softwareProductId, version }
435 );
436 ComputeFlavorActionHelper.fetchComputesListForVSP(dispatch, {
437 softwareProductId,
438 version
439 });
440 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT, {
441 softwareProductId,
442 version,
443 status
444 });
445 },
446 navigateToSoftwareProductActivityLog(
447 dispatch,
448 { softwareProductId, version, status }
449 ) {
450 ActivityLogActionHelper.fetchActivityLog(dispatch, {
451 itemId: softwareProductId,
452 versionId: version.id
453 });
454 setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, {
455 softwareProductId,
456 version,
457 status
458 });
459 },
Michael Landoefa037d2017-02-19 12:57:33 +0200460
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200461 navigateToSoftwareProductComponentProcesses(
462 dispatch,
463 { softwareProductId, componentId, version, status }
464 ) {
465 if (componentId && softwareProductId) {
466 SoftwareProductComponentProcessesActionHelper.fetchProcessesList(
467 dispatch,
468 { componentId, softwareProductId, version }
469 );
470 }
471 setCurrentScreen(
472 dispatch,
473 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES,
474 { softwareProductId, componentId, version, status }
475 );
476 },
AviZi280f8012017-06-09 02:39:56 +0300477
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200478 navigateToSoftwareProductComponentMonitoring(
479 dispatch,
480 { softwareProductId, version, componentId, status }
481 ) {
482 if (componentId && softwareProductId && version) {
483 SoftwareProductComponentsMonitoringAction.fetchExistingFiles(
484 dispatch,
485 { componentId, softwareProductId, version }
486 );
487 }
488 setCurrentScreen(
489 dispatch,
490 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING,
491 { softwareProductId, componentId, version, status }
492 );
493 },
Michael Landoefa037d2017-02-19 12:57:33 +0200494
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200495 navigateToComponentStorage(
496 dispatch,
497 { softwareProductId, componentId, version, status }
498 ) {
499 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
500 dispatch,
501 { softwareProductId, vspComponentId: componentId, version }
502 );
503 setCurrentScreen(
504 dispatch,
505 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_STORAGE,
506 { softwareProductId, version, componentId, status }
507 );
508 },
Michael Landoefa037d2017-02-19 12:57:33 +0200509
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200510 navigateToComponentCompute(
511 dispatch,
512 { softwareProductId, componentId, version, status }
513 ) {
514 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
515 dispatch,
516 { softwareProductId, vspComponentId: componentId, version }
517 );
518 if (componentId && softwareProductId) {
519 ComputeFlavorActionHelper.fetchComputesList(dispatch, {
520 softwareProductId,
521 componentId,
522 version
523 });
524 }
525 setCurrentScreen(
526 dispatch,
527 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_COMPUTE,
528 { softwareProductId, version, componentId, status }
529 );
530 },
Michael Landoefa037d2017-02-19 12:57:33 +0200531
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200532 navigateToComponentNetwork(
533 dispatch,
534 { softwareProductId, componentId, version, status }
535 ) {
536 SoftwareProductComponentsNetworkActionHelper.fetchNICsList(dispatch, {
537 softwareProductId,
538 componentId,
539 version
540 });
541 setCurrentScreen(
542 dispatch,
543 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_NETWORK,
544 { softwareProductId, version, componentId, status }
545 );
546 },
Michael Landoefa037d2017-02-19 12:57:33 +0200547
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200548 navigateToSoftwareProductComponentGeneral(
549 dispatch,
550 { softwareProductId, componentId, version, status }
551 ) {
552 if (componentId && softwareProductId) {
553 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
554 dispatch,
555 { softwareProductId, vspComponentId: componentId, version }
556 );
557 }
558 setCurrentScreen(
559 dispatch,
560 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_GENERAL,
561 { softwareProductId, version, componentId, status }
562 );
563 },
Michael Landoefa037d2017-02-19 12:57:33 +0200564
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200565 navigateToSoftwareProductComponentGeneralAndUpdateLeftPanel(
566 dispatch,
567 { softwareProductId, componentId, version, status }
568 ) {
569 this.navigateToSoftwareProductComponentGeneral(dispatch, {
570 softwareProductId,
571 componentId,
572 version,
573 status
574 });
575 dispatch({
576 type: SoftwareProductActionTypes.TOGGLE_NAVIGATION_ITEM,
577 mapOfExpandedIds: {
578 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS]: true,
579 [enums.SCREEN.SOFTWARE_PRODUCT_COMPONENTS +
580 '|' +
581 componentId]: true
582 }
583 });
584 },
Michael Landoefa037d2017-02-19 12:57:33 +0200585
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200586 navigateToComponentLoadBalancing(
587 dispatch,
588 { softwareProductId, componentId, version, status }
589 ) {
590 SoftwareProductComponentsActionHelper.fetchSoftwareProductComponent(
591 dispatch,
592 { softwareProductId, vspComponentId: componentId, version }
593 );
594 setCurrentScreen(
595 dispatch,
596 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_LOAD_BALANCING,
597 { softwareProductId, version, componentId, status }
598 );
599 },
Michael Landoefa037d2017-02-19 12:57:33 +0200600
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200601 navigateToComponentImages(
602 dispatch,
603 { softwareProductId, componentId, version, status }
604 ) {
605 SoftwareProductComponentsImageActionHelper.fetchImagesList(dispatch, {
606 softwareProductId,
607 componentId,
608 version
609 });
610 setCurrentScreen(
611 dispatch,
612 enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_IMAGES,
613 { softwareProductId, version, componentId, status }
614 );
615 },
Michael Landoefa037d2017-02-19 12:57:33 +0200616
svishnevea5e43c2018-04-15 09:06:57 +0300617 async navigateToVersionsPage(
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200618 dispatch,
619 { itemType, itemId, itemName, additionalProps, users }
620 ) {
621 PermissionsActionHelper.fetchItemUsers(dispatch, {
622 itemId,
623 allUsers: users
624 });
625 VersionsPageActionHelper.selectNone(dispatch);
svishnevea5e43c2018-04-15 09:06:57 +0300626 await VersionsPageActionHelper.fetchVersions(dispatch, {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200627 itemType,
628 itemId
svishnevea5e43c2018-04-15 09:06:57 +0300629 });
630 const items = await ItemsHelper.fetchItem(itemId);
631 setCurrentScreen(dispatch, enums.SCREEN.VERSIONS_PAGE, {
632 status: items.status,
633 itemType,
634 itemId,
635 itemName,
636 vendorName: items.properties.vendorName,
637 vendorId: items.properties.vendorId,
638 additionalProps
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200639 });
640 },
Avi Zivb8e2faf2017-07-18 19:45:38 +0300641
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200642 checkMergeStatus(dispatch, { itemId, versionId, version }) {
643 return ItemsHelper.fetchVersion({ itemId, versionId }).then(
644 response => {
645 let state = (response && response.state) || {};
646 let { synchronizationState } = state;
647 // let inMerge = synchronizationState === SyncStates.MERGE;
648 MergeEditorActionHelper.fetchConflicts(dispatch, {
649 itemId,
650 version
651 }).then(data => {
652 dispatch({
653 type: actionTypes.CHECK_MERGE_STATUS,
654 synchronizationState,
655 conflictInfoList: data.conflictInfoList
656 });
657 });
658 }
659 );
660 },
az2497644017c2017-08-10 17:49:40 +0300661
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200662 forceBreadCrumbsUpdate(dispatch) {
663 dispatch({
664 type: actionTypes.SET_CURRENT_SCREEN,
665 currentScreen: {
666 forceBreadCrumbsUpdate: true
667 }
668 });
669 },
talig8e9c0652017-12-20 14:30:43 +0200670
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +0200671 updateCurrentScreenVersion(dispatch, version) {
672 dispatch({
673 type: actionTypes.SET_CURRENT_SCREEN_VERSION,
674 version
675 });
676 }
Michael Landoefa037d2017-02-19 12:57:33 +0200677};
talig8e9c0652017-12-20 14:30:43 +0200678
679export default OnboardingActionHelper;