diff options
author | svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com> | 2018-02-12 09:10:35 +0200 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-02-13 08:14:17 +0000 |
commit | f6784900012e11850d8e98bbf198f04bd0e411c7 (patch) | |
tree | 722fffa9ea325a1ff9b76eeb10b17fa1bc366a40 /openecomp-ui/src/sdc-app | |
parent | 7ce8756746b298e644eca57fa586bc20e880848a (diff) |
heat validation flow
Issue-ID: SDC-1024
Change-Id: I4248fef46c7f8f5132644628f320231eeafe8070
Signed-off-by: svishnev <shlomo-stanisla.vishnevetskiy@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app')
8 files changed, 120 insertions, 62 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js index cdaf189fc0..683dd4f682 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,7 +90,7 @@ const buildComponentNavigationBarGroups = ({componentId, meta}) => { const buildNavigationBarProps = ({softwareProduct, meta, screen, componentId, componentsList, mapOfExpandedIds}) => { const {softwareProductEditor: {data: currentSoftwareProduct = {}}} = softwareProduct; - const {id, name, onboardingMethod, candidateOnboardingOrigin} = currentSoftwareProduct; + const {id, name, onboardingMethod, candidateOnboardingOrigin, onboardingOrigin} = currentSoftwareProduct; const groups = [{ id: id, name: name, @@ -126,7 +126,7 @@ const buildNavigationBarProps = ({softwareProduct, meta, screen, componentId, co id: enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, name: i18n('Attachments'), disabled: false, - hidden: candidateOnboardingOrigin === onboardingOriginTypes.NONE, + hidden: !candidateOnboardingOrigin && !onboardingOrigin, meta }, { id: enums.SCREEN.SOFTWARE_PRODUCT_ACTIVITY_LOG, @@ -159,14 +159,14 @@ const buildNavigationBarProps = ({softwareProduct, meta, screen, componentId, co }]; let activeItemId = getActiveNavigationId(screen, componentId); return { - activeItemId, groups + activeItemId, groups, disabled: !!candidateOnboardingOrigin }; }; const buildVersionControllerProps = ({softwareProduct, versions, currentVersion, permissions, userInfo, usersList, itemPermission, isReadOnlyMode}) => { const {softwareProductEditor = {data: {}}} = softwareProduct; - const {isValidityData = true, data: {name, onboardingMethod}} = softwareProductEditor; - + const {isValidityData = true, data: {name, onboardingMethod, candidateOnboardingOrigin}} = softwareProductEditor; + return { version: currentVersion, viewableVersions: versions, @@ -177,7 +177,8 @@ const buildVersionControllerProps = ({softwareProduct, versions, currentVersion, isReadOnlyMode, userInfo, usersList, - isManual: onboardingMethod === onboardingMethodType.MANUAL + isManual: onboardingMethod === onboardingMethodType.MANUAL, + candidateInProcess: !!candidateOnboardingOrigin }; }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js index ebd660f71c..9ed6005397 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js @@ -1,17 +1,17 @@ -/* - * Copyright © 2016-2017 European Support Limited +/*! + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. */ import RestAPIUtil from 'nfvo-utils/RestAPIUtil.js'; import showFileSaveDialog from 'nfvo-utils/ShowFileSaveDialog.js'; @@ -116,6 +116,10 @@ function fetchOrchestrationTemplateCandidate(softwareProductId, version, ) { return RestAPIUtil.fetch(`${baseUrl()}${softwareProductId}/versions/${version.id}/orchestration-template-candidate`, {dataType: 'binary'}); } +function abortValidationProcess(softwareProductId, version) { + return RestAPIUtil.destroy(`${baseUrl()}${softwareProductId}/versions/${version.id}/orchestration-template-candidate`); +} + function objToString(obj) { let str = ''; if (obj instanceof Array) { @@ -242,6 +246,8 @@ const SoftwareProductActionHelper = { if (response.status === 'Success') { SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version}); SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {softwareProductId, version}); + } else { + SoftwareProductActionHelper.fetchSoftwareProduct(dispatch, {softwareProductId, version}); } }); }, @@ -267,6 +273,10 @@ const SoftwareProductActionHelper = { screen: enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS_SETUP, screenType: screenTypes.SOFTWARE_PRODUCT, props: {softwareProductId, version} }); + dispatch({ + type: actionTypes.CANDIDATE_IN_PROCESS, + inProcess: true + }); break; case onboardingOriginTypes.CSAR: ScreensHelper.loadScreen(dispatch, { @@ -540,6 +550,10 @@ const SoftwareProductActionHelper = { screen: enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, screenType: screenTypes.SOFTWARE_PRODUCT, props: {softwareProductId, version: {id: newVer, label: newVer}} })); + }, + + abortCandidateValidation(dispatch, {softwareProductId, version}) { + return abortValidationProcess(softwareProductId, version); } }; diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js index 7df46589c3..c82483740f 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ export const actionTypes = keyMirror({ SOFTWARE_PRODUCT_QUESTIONNAIRE_UPDATE: null, LOAD_LICENSING_VERSIONS_LIST: null, TOGGLE_NAVIGATION_ITEM: null, + CANDIDATE_IN_PROCESS: null, softwareProductEditor: { OPEN: null, diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js index 234953ec3b..d942172973 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,8 @@ export const mapStateToProps = (state) => { HeatSetupComponent: HeatSetup, version, onboardingOrigin, - activeTab + activeTab, + candidateInProcess: !!currentSoftwareProduct.candidateOnboardingOrigin }; }; @@ -67,6 +68,8 @@ export const mapActionsToProps = (dispatch, {softwareProductId, version}) => { data:{ msg: i18n('Upload will erase existing data. Do you want to continue?'), confirmationButtonText: i18n('Continue'), + title: i18n('WARNING'), + onConfirmed: ()=>SoftwareProductActionHelper.uploadFile(dispatch, { softwareProductId, formData, @@ -75,6 +78,15 @@ export const mapActionsToProps = (dispatch, {softwareProductId, version}) => { }) } }), + onUploadAbort: () => { + SoftwareProductActionHelper.abortCandidateValidation(dispatch, {softwareProductId, version}) + .then(()=>{ + ScreensHelper.loadScreen(dispatch, { + screen: enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, screenType: screenTypes.SOFTWARE_PRODUCT, + props: {softwareProductId, version} + }); + }); + }, onInvalidFileUpload: () => dispatch({ type: modalActionTypes.GLOBAL_MODAL_ERROR, data: { diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx index a23015732b..90dd7692bf 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import {tabsMapping} from './SoftwareProductAttachmentsConstants.js'; import i18n from 'nfvo-utils/i18n/i18n.js'; import HeatValidation from './validation/HeatValidation.js'; import {onboardingOriginTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js'; +import Button from 'sdc-ui/lib/react/Button.js'; class HeatScreenView extends Component { @@ -30,40 +31,56 @@ class HeatScreenView extends Component { setActiveTab: PropTypes.func }; + componentDidMount() { + if (!this.props.goToOverview && this.props.candidateInProcess) { + this.props.setActiveTab({activeTab: tabsMapping.VALIDATION}); + } + } + render() { - let {isValidationAvailable, isReadOnlyMode, heatDataExist, onDownload, softwareProductId, onProcessAndValidate, - heatSetup, HeatSetupComponent, onGoToOverview, version, onboardingOrigin, activeTab, setActiveTab, ...other} = this.props; + let {isValidationAvailable, isReadOnlyMode, heatDataExist, onDownload, softwareProductId, onProcessAndValidate, onUploadAbort, + candidateInProcess, heatSetup, HeatSetupComponent, onGoToOverview, version, onboardingOrigin, activeTab, setActiveTab, ...other} = this.props; return ( <div className='vsp-attachments-view'> <div className='attachments-view-controllers'> - {(activeTab === tabsMapping.SETUP) && - <SVGIcon - disabled={heatDataExist ? false : true} - name='download' - className='icon-component' - label={i18n('Export Validation')} - labelPosition='right' - color='secondary' - onClick={heatDataExist ? () => onDownload({heatCandidate: heatSetup, isReadOnlyMode, version}) : undefined} - data-test-id='download-heat'/>} + {(activeTab === tabsMapping.SETUP) && + <Button btnType='outline' + data-test-id='proceed-to-validation-btn' + disabled={!isValidationAvailable} + className='proceed-to-validation-btn' + onClick={()=>this.handleTabPress(tabsMapping.VALIDATION)}>{i18n('PROCEED TO VALIDATION')}</Button> + } + {candidateInProcess && <SVGIcon + onClick={onUploadAbort} + name='close' + className='icon-component abort-btn' + label={i18n('ABORT')} + labelPosition='right' + color='secondary' + data-test-id='abort-btn'/> + } + {(activeTab === tabsMapping.VALIDATION && softwareProductId) && - <SVGIcon + <Button btnType='outline' + data-test-id='go-to-overview' disabled={this.props.goToOverview !== true} - onClick={this.props.goToOverview ? () => onGoToOverview({version}) : undefined} - name='proceedToOverview' - className='icon-component' - label={i18n('Go to Overview')} - labelPosition='right' - color={this.props.goToOverview ? 'primary' : 'secondary'} - data-test-id='go-to-overview'/>} + className='go-to-overview-btn' + onClick={this.props.goToOverview ? () => onGoToOverview({version}) : undefined}>{i18n('GO TO OVERVIEW')}</Button>} + <div className='separator'></div> + <SVGIcon + disabled={heatDataExist ? false : true} + name='download' + className='icon-component' + color='dark-gray' + onClick={heatDataExist ? () => onDownload({heatCandidate: heatSetup, isReadOnlyMode, version}) : undefined} + data-test-id='download-heat'/> + <SVGIcon name='upload' - className='icon-component' - label={i18n('Upload New File')} - labelPosition='right' - color='secondary' - disabled={isReadOnlyMode} + className='icon-component' + color='dark-gray' + disabled={isReadOnlyMode || candidateInProcess} onClick={isReadOnlyMode ? undefined : evt => this.refs.hiddenImportFileInput.click(evt)} data-test-id='upload-heat'/> <input @@ -73,11 +90,11 @@ class HeatScreenView extends Component { accept='.zip, .csar' onChange={evt => this.handleImport(evt)}/> </div> - <Tabs - className='attachments-tabs' - type='header' - activeTab={activeTab} - onTabClick={key => this.handleTabPress(key)}> + <Tabs + className='attachments-tabs' + type='header' + activeTab={activeTab} + onTabClick={key => this.handleTabPress(key)}> <Tab tabId={tabsMapping.SETUP} title='Setup' disabled={onboardingOrigin === onboardingOriginTypes.CSAR}> <HeatSetupComponent heatDataExist={heatDataExist} diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js index 54dc1a4d37..1a293264c3 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,6 +50,11 @@ export default (state = {}, action) => { ...state, licensingVersionsList: action.licensingVersionsList }; + case actionTypes.CANDIDATE_IN_PROCESS: + return { + ...state, + data: {...state.data, candidateOnboardingOrigin: true} + }; default: return state; } diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js index 90ea182dfa..64e0d562ce 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ export const mapStateToProps = ({ softwareProduct, licenseModel: {licenseAgreement}, }) => { - let {softwareProductEditor: {data:currentSoftwareProduct = {}}, softwareProductComponents, softwareProductCategories = []} = softwareProduct; + let {softwareProductEditor: {data:currentSoftwareProduct = {}}, softwareProductComponents, softwareProductCategories = [], } = softwareProduct; let {licensingData = {}} = currentSoftwareProduct; let {licenseAgreementList} = licenseAgreement; let {componentsList} = softwareProductComponents; @@ -53,8 +53,8 @@ export const mapStateToProps = ({ currentSoftwareProduct: { ...currentSoftwareProduct, licenseAgreementName, - fullCategoryDisplayName - }, + fullCategoryDisplayName + }, componentsList, isManual: currentSoftwareProduct.onboardingMethod === onboardingMethod.MANUAL }; @@ -67,7 +67,10 @@ const mapActionsToProps = (dispatch, {version}) => { screen: enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, screenType: screenTypes.SOFTWARE_PRODUCT, props: {softwareProductId, version} }), - + onCandidateInProcess: (softwareProductId) => ScreensHelper.loadScreen(dispatch, { + screen: enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS_SETUP, screenType: screenTypes.SOFTWARE_PRODUCT, + props: {softwareProductId, version} + }), onUpload: (softwareProductId, formData) => SoftwareProductActionHelper.uploadFile(dispatch, { softwareProductId, diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx index 76228b0731..70c04f01a3 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx @@ -1,17 +1,17 @@ -/* - * Copyright © 2016-2017 European Support Limited +/*! + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. */ import React from 'react'; import PropTypes from 'prop-types'; @@ -65,7 +65,12 @@ class SoftwareProductLandingPageView extends React.Component { onComponentSelect: PropTypes.func, onAddComponent: PropTypes.func }; - + componentDidMount() { + const {onCandidateInProcess, currentSoftwareProduct} = this.props; + if (currentSoftwareProduct.candidateOnboardingOrigin) { + onCandidateInProcess(currentSoftwareProduct.id); + } + } render() { let {currentSoftwareProduct, isReadOnlyMode, isManual, onDetailsSelect} = this.props; return ( |