aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments
diff options
context:
space:
mode:
authorshrek2000 <orenkle@amdocs.com>2017-09-11 15:45:37 +0300
committershrek2000 <orenkle@amdocs.com>2017-09-12 10:38:35 +0300
commitc8a540b3c234449163f6fb1899807bba951113b4 (patch)
treea8aae0dd0f6a0feb27369914e9e3fa321740e7ed /openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments
parent82d454fd3e8c9fdf66517d01a99019a379dbfdb6 (diff)
Create new VSP, onboard from TOSCA file - UI
Change-Id: I018c6d07a4b9ec7e6b1507ab37e2550865423cfe Issue-ID: SDC-230 Signed-off-by: shrek2000 <orenkle@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js12
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js26
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js6
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsReducer.js25
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx42
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js11
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx6
7 files changed, 96 insertions, 32 deletions
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 945de4fc36..f14c988866 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js
@@ -23,6 +23,7 @@ import {errorLevels} from 'sdc-app/onboarding/softwareProduct/attachments/valida
import OnboardingActionHelper from 'sdc-app/onboarding/OnboardingActionHelper.js';
import HeatSetup from './setup/HeatSetup.js';
import {doesHeatDataExist} from './SoftwareProductAttachmentsUtils.js';
+import SoftwareProductAttachmentsActionHelper from './SoftwareProductAttachmentsActionHelper.js';
import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js';
@@ -30,7 +31,7 @@ export const mapStateToProps = (state) => {
let {
softwareProduct: {
softwareProductEditor:{data: currentSoftwareProduct = {}},
- softwareProductAttachments: {heatSetup, heatSetupCache, heatValidation : {errorList}}
+ softwareProductAttachments: {attachmentsDetails: {activeTab}, heatSetup, heatSetupCache, heatValidation : {errorList}}
}
} = state;
@@ -47,7 +48,7 @@ export const mapStateToProps = (state) => {
let isReadOnlyMode = currentSoftwareProduct && currentSoftwareProduct.version ?
VersionControllerUtils.isReadOnly(currentSoftwareProduct) : false;
- let {version} = currentSoftwareProduct;
+ let {version, onboardingOrigin} = currentSoftwareProduct;
return {
isValidationAvailable: unassigned.length === 0 && modules.length > 0,
heatSetup,
@@ -56,7 +57,9 @@ export const mapStateToProps = (state) => {
goToOverview,
HeatSetupComponent: HeatSetup,
isReadOnlyMode,
- version
+ version,
+ onboardingOrigin,
+ activeTab
};
};
@@ -83,7 +86,8 @@ export const mapActionsToProps = (dispatch, {softwareProductId}) => {
onProcessAndValidate: ({heatData, heatDataCache, isReadOnlyMode, version}) => {
return HeatSetupActionHelper.processAndValidateHeat(dispatch,
{softwareProductId, heatData, heatDataCache, isReadOnlyMode, version});
- }
+ },
+ setActiveTab: ({activeTab}) => SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {activeTab})
};
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js
new file mode 100644
index 0000000000..ae4a615a40
--- /dev/null
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js
@@ -0,0 +1,26 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+
+import {actionTypes} from './SoftwareProductAttachmentsConstants';
+
+export default {
+ setActiveTab(dispatch, {activeTab}) {
+ dispatch({
+ type: actionTypes.SET_ACTIVE_TAB,
+ activeTab
+ });
+ }
+};
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js
index b0410d1566..67265909d7 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js
@@ -13,7 +13,13 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
+import keyMirror from 'nfvo-utils/KeyMirror.js';
+
export const tabsMapping = {
SETUP: 1,
VALIDATION: 2
};
+
+export const actionTypes = keyMirror({
+ SET_ACTIVE_TAB: null
+});
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsReducer.js
new file mode 100644
index 0000000000..5f6538ab7e
--- /dev/null
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsReducer.js
@@ -0,0 +1,25 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+import {actionTypes} from './SoftwareProductAttachmentsConstants.js';
+
+export default (state = [], action) => {
+ switch (action.type) {
+ case actionTypes.SET_ACTIVE_TAB:
+ return {activeTab: action.activeTab};
+ default:
+ return state;
+ }
+};
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 3da26cc20f..8c59b2b1cc 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx
@@ -20,34 +20,34 @@ import {tabsMapping} from './SoftwareProductAttachmentsConstants.js';
import i18n from 'nfvo-utils/i18n/i18n.js';
import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js';
import HeatValidation from './validation/HeatValidation.js';
+import {onboardingOriginTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
class HeatScreenView extends Component {
static propTypes = {
isValidationAvailable: PropTypes.bool,
- goToOverview: PropTypes.bool
- };
-
- state = {
- activeTab: tabsMapping.SETUP
+ goToOverview: PropTypes.bool,
+ setActiveTab: PropTypes.function
};
render() {
- let {isValidationAvailable, isReadOnlyMode, heatDataExist, onDownload, softwareProductId, onProcessAndValidate, heatSetup, HeatSetupComponent, onGoToOverview, version, ...other} = this.props;
+ let {isValidationAvailable, isReadOnlyMode, heatDataExist, onDownload, softwareProductId, onProcessAndValidate,
+ heatSetup, HeatSetupComponent, onGoToOverview, version, onboardingOrigin, activeTab, setActiveTab, ...other} = this.props;
+
return (
<div className='vsp-attachments-view'>
<div className='attachments-view-controllers'>
- {(this.state.activeTab === tabsMapping.SETUP) &&
+ {(activeTab === tabsMapping.SETUP) &&
<SVGIcon
disabled={heatDataExist ? false : true}
name='download'
className='icon-component'
- label={i18n('Download HEAT')}
+ label={i18n('Export Validation')}
labelPosition='right'
color='secondary'
onClick={heatDataExist ? () => onDownload({heatCandidate: heatSetup, isReadOnlyMode, version}) : undefined}
data-test-id='download-heat'/>}
- {(this.state.activeTab === tabsMapping.VALIDATION && softwareProductId) &&
+ {(activeTab === tabsMapping.VALIDATION && softwareProductId) &&
<SVGIcon
disabled={this.props.goToOverview !== true}
onClick={this.props.goToOverview ? () => onGoToOverview({version}) : undefined}
@@ -60,7 +60,7 @@ class HeatScreenView extends Component {
<SVGIcon
name='upload'
className='icon-component'
- label={i18n('Upload New HEAT')}
+ label={i18n('Upload New File')}
labelPosition='right'
color='secondary'
disabled={isReadOnlyMode}
@@ -70,20 +70,20 @@ class HeatScreenView extends Component {
ref='hiddenImportFileInput'
type='file'
name='fileInput'
- accept='.zip'
+ accept='.zip, .csar'
onChange={evt => this.handleImport(evt)}/>
</div>
- <Tabs id='attachments-tabs' activeKey={this.state.activeTab} onSelect={key => this.handleTabPress(key)}>
- <Tab eventKey={tabsMapping.SETUP} title='HEAT Setup'>
+ <Tabs id='attachments-tabs' activeKey={activeTab} onSelect={key => this.handleTabPress(key)}>
+ <Tab eventKey={tabsMapping.SETUP} title='Setup' disabled={onboardingOrigin === onboardingOriginTypes.CSAR}>
<HeatSetupComponent
heatDataExist={heatDataExist}
- changeAttachmentsTab={tab => this.setState({activeTab: tab})}
+ changeAttachmentsTab={tab => setActiveTab({activeTab: tab})}
onProcessAndValidate={onProcessAndValidate}
softwareProductId={softwareProductId}
isReadOnlyMode={isReadOnlyMode}
version={version}/>
</Tab>
- <Tab eventKey={tabsMapping.VALIDATION} title='Heat Validation' disabled={!isValidationAvailable}>
+ <Tab eventKey={tabsMapping.VALIDATION} title='Validation' disabled={!isValidationAvailable}>
<HeatValidation {...other}/>
</Tab>
</Tabs>
@@ -92,15 +92,15 @@ class HeatScreenView extends Component {
}
handleTabPress(key) {
- let {heatSetup, heatSetupCache, onProcessAndValidate, isReadOnlyMode, version} = this.props;
+ let {heatSetup, heatSetupCache, onProcessAndValidate, isReadOnlyMode, version, setActiveTab} = this.props;
switch (key) {
case tabsMapping.VALIDATION:
onProcessAndValidate({heatData: heatSetup, heatDataCache: heatSetupCache, isReadOnlyMode, version}).then(
- () => this.setState({activeTab: tabsMapping.VALIDATION})
+ () => setActiveTab({activeTab: tabsMapping.VALIDATION})
);
return;
case tabsMapping.SETUP:
- this.setState({activeTab: tabsMapping.SETUP});
+ setActiveTab({activeTab: tabsMapping.SETUP});
return;
}
}
@@ -112,11 +112,13 @@ class HeatScreenView extends Component {
formData.append('upload', this.refs.hiddenImportFileInput.files[0]);
this.refs.hiddenImportFileInput.value = '';
this.props.onUpload(formData, version);
- this.setState({activeTab: tabsMapping.SETUP});
}
save() {
- return this.props.onSave(this.props.heatSetup, this.props.version);
+
+ return this.props.onboardingOrigin === onboardingOriginTypes.ZIP ?
+ this.props.onSave(this.props.heatSetup, this.props.version) :
+ Promise.resolve();
}
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js
index f0c10ed457..1d11bdd6b7 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js
@@ -89,16 +89,16 @@ function createErrorList(node, parent, deep = 0, errorList = []) {
return errorList;
}
-const mapValidationDataToTree = validationData => {
- let {heat, volume, network, artifacts, other} = validationData.importStructure || {};
+const mapValidationDataToTree = (validationData, packageName) => {
+ let {heat, nested, volume, network, artifacts, other} = validationData.importStructure || {};
return {
children: [
{
- name: 'HEAT',
+ name: packageName,
expanded: true,
type: 'heat',
header: true,
- children: (heat ? heat.map(mapHeatData) : [])
+ children: (heat ? heat.map(mapHeatData) : nested ? nested.map(mapHeatData) : [])
},
...(artifacts ? [{
name: 'artifacts',
@@ -165,7 +165,8 @@ export default (state = {attachmentsTree: {}}, action) => {
switch (action.type) {
case softwareProductsActionTypes.SOFTWARE_PRODUCT_LOADED:
let currentSoftwareProduct = action.response;
- let attachmentsTree = currentSoftwareProduct.validationData ? mapValidationDataToTree(currentSoftwareProduct.validationData) : {};
+ const packageName = currentSoftwareProduct.networkPackageName;
+ let attachmentsTree = currentSoftwareProduct.validationData ? mapValidationDataToTree(currentSoftwareProduct.validationData, packageName) : {};
let errorList = createErrorList(attachmentsTree);
return {
...state,
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx
index 2a2f4ac291..80d74b2964 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx
@@ -93,9 +93,9 @@ function HeatFileTreeHeader(props) {
<div onClick={() => props.selectNode(nodeFilters.ALL)} className={classNames({'attachments-tree-header': true,
'header-selected' : props.selectedNode === nodeFilters.ALL})} data-test-id='validation-tree-header'>
<div className='tree-header-title' >
- <SVGIcon name='zip' color={props.selectedNode === nodeFilters.ALL ? 'primary' : ''} iconClassName='header-icon' />
+ {/*<SVGIcon name='zip' color={props.selectedNode === nodeFilters.ALL ? 'primary' : ''} iconClassName='header-icon' />*/}
<span className={classNames({'tree-header-title-text' : true,
- 'tree-header-title-selected' : props.selectedNode === nodeFilters.ALL})}>{i18n(`HEAT${hasErrors ? ' (Draft)' : ''}`)}</span>
+ 'tree-header-title-selected' : props.selectedNode === nodeFilters.ALL})}>{i18n(`${props.headerTitle} ${hasErrors ? '(Draft)' : ''}`)}</span>
</div>
<ErrorsAndWarningsCount errorList={props.errorList} size='large' />
</div>);
@@ -134,7 +134,7 @@ class HeatFileTree extends React.Component {
<div key={node.name + rand} className={classNames({'tree-block-inside' : !node.header})}>
{
node.header ?
- <HeatFileTreeHeader selectedNode={selectedNode} errorList={this.props.errorList} selectNode={(nodeName) => this.selectNode(nodeName)} /> :
+ <HeatFileTreeHeader headerTitle={node.name} selectedNode={selectedNode} errorList={this.props.errorList} selectNode={(nodeName) => this.selectNode(nodeName)} /> :
<HeatFileTreeRow toggleExpanded={this.props.toggleExpanded} node={node} path={path} selectedNode={selectedNode} selectNode={() => this.selectNode(node.name)} />
}
{