aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2017-12-20 14:30:43 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-21 11:12:33 +0000
commit8e9c0653dd6c6862123c9609ae34e1206d86456e (patch)
tree5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments
parent785ebcc95de3e064e843bec04ba7a209d854fc7c (diff)
Add collaboration feature
Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig <talig@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.js34
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx29
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx6
3 files changed, 42 insertions, 27 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 f14c988866..234953ec3b 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js
@@ -20,13 +20,12 @@ import SoftwareProductActionHelper from 'sdc-app/onboarding/softwareProduct/Soft
import HeatSetupActionHelper from './setup/HeatSetupActionHelper.js';
import SoftwareProductAttachmentsView from './SoftwareProductAttachmentsView.jsx';
import {errorLevels} from 'sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationConstants.js';
-import OnboardingActionHelper from 'sdc-app/onboarding/OnboardingActionHelper.js';
import HeatSetup from './setup/HeatSetup.js';
import {doesHeatDataExist} from './SoftwareProductAttachmentsUtils.js';
+import ScreensHelper from 'sdc-app/common/helpers/ScreensHelper.js';
+import {enums, screenTypes} from 'sdc-app/onboarding/OnboardingConstants.js';
import SoftwareProductAttachmentsActionHelper from './SoftwareProductAttachmentsActionHelper.js';
-import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js';
-
export const mapStateToProps = (state) => {
let {
softwareProduct: {
@@ -46,8 +45,6 @@ export const mapStateToProps = (state) => {
}
let heatDataExist = doesHeatDataExist(heatSetup);
- let isReadOnlyMode = currentSoftwareProduct && currentSoftwareProduct.version ?
- VersionControllerUtils.isReadOnly(currentSoftwareProduct) : false;
let {version, onboardingOrigin} = currentSoftwareProduct;
return {
isValidationAvailable: unassigned.length === 0 && modules.length > 0,
@@ -56,17 +53,16 @@ export const mapStateToProps = (state) => {
heatDataExist,
goToOverview,
HeatSetupComponent: HeatSetup,
- isReadOnlyMode,
version,
onboardingOrigin,
activeTab
};
};
-export const mapActionsToProps = (dispatch, {softwareProductId}) => {
+export const mapActionsToProps = (dispatch, {softwareProductId, version}) => {
return {
- onDownload: ({heatCandidate, isReadOnlyMode, version}) => SoftwareProductActionHelper.downloadHeatFile(dispatch, {softwareProductId, heatCandidate, isReadOnlyMode, version}),
- onUpload: (formData, version) => dispatch({
+ onDownload: ({heatCandidate, isReadOnlyMode}) => SoftwareProductActionHelper.downloadHeatFile(dispatch, {softwareProductId, heatCandidate, isReadOnlyMode, version}),
+ onUpload: (formData) => dispatch({
type: modalActionTypes.GLOBAL_MODAL_WARNING,
data:{
msg: i18n('Upload will erase existing data. Do you want to continue?'),
@@ -79,15 +75,25 @@ export const mapActionsToProps = (dispatch, {softwareProductId}) => {
})
}
}),
- onSave: (heatCandidate, version) => SoftwareProductActionHelper.updateSoftwareProductHeatCandidate(dispatch, {softwareProductId, heatCandidate, version}),
- onGoToOverview: ({version}) => {
- OnboardingActionHelper.navigateToSoftwareProductLandingPage(dispatch, {softwareProductId, version});
- },
- onProcessAndValidate: ({heatData, heatDataCache, isReadOnlyMode, version}) => {
+ onInvalidFileUpload: () => dispatch({
+ type: modalActionTypes.GLOBAL_MODAL_ERROR,
+ data: {
+ title: i18n('Upload Failed'),
+ confirmationButtonText: i18n('Continue'),
+ msg: i18n('no zip or csar file was uploaded or expected file doesn\'t exist')
+ }
+ }),
+ onSave: (heatCandidate) => SoftwareProductActionHelper.updateSoftwareProductHeatCandidate(dispatch, {softwareProductId, heatCandidate, version}),
+ onGoToOverview: () => ScreensHelper.loadScreen(dispatch, {
+ screen: enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, screenType: screenTypes.SOFTWARE_PRODUCT,
+ props: {softwareProductId, version}
+ }),
+ onProcessAndValidate: ({heatData, heatDataCache, isReadOnlyMode}) => {
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/SoftwareProductAttachmentsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx
index 8c59b2b1cc..a23015732b 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx
@@ -13,12 +13,12 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
-import React, {Component, PropTypes} from 'react';
-import Tabs from 'react-bootstrap/lib/Tabs.js';
-import Tab from 'react-bootstrap/lib/Tab.js';
+import React, {Component} from 'react';
+import PropTypes from 'prop-types';
+import accept from 'attr-accept';
+import {SVGIcon, Tab, Tabs} from 'sdc-ui/lib/react';
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';
@@ -27,7 +27,7 @@ class HeatScreenView extends Component {
static propTypes = {
isValidationAvailable: PropTypes.bool,
goToOverview: PropTypes.bool,
- setActiveTab: PropTypes.function
+ setActiveTab: PropTypes.func
};
render() {
@@ -64,7 +64,7 @@ class HeatScreenView extends Component {
labelPosition='right'
color='secondary'
disabled={isReadOnlyMode}
- onClick={evt => {this.refs.hiddenImportFileInput.click(evt);}}
+ onClick={isReadOnlyMode ? undefined : evt => this.refs.hiddenImportFileInput.click(evt)}
data-test-id='upload-heat'/>
<input
ref='hiddenImportFileInput'
@@ -73,8 +73,12 @@ class HeatScreenView extends Component {
accept='.zip, .csar'
onChange={evt => this.handleImport(evt)}/>
</div>
- <Tabs id='attachments-tabs' activeKey={activeTab} onSelect={key => this.handleTabPress(key)}>
- <Tab eventKey={tabsMapping.SETUP} title='Setup' disabled={onboardingOrigin === onboardingOriginTypes.CSAR}>
+ <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}
changeAttachmentsTab={tab => setActiveTab({activeTab: tab})}
@@ -83,7 +87,7 @@ class HeatScreenView extends Component {
isReadOnlyMode={isReadOnlyMode}
version={version}/>
</Tab>
- <Tab eventKey={tabsMapping.VALIDATION} title='Validation' disabled={!isValidationAvailable}>
+ <Tab tabId={tabsMapping.VALIDATION} title='Validation' disabled={!isValidationAvailable}>
<HeatValidation {...other}/>
</Tab>
</Tabs>
@@ -107,9 +111,14 @@ class HeatScreenView extends Component {
handleImport(evt) {
evt.preventDefault();
+ let file = this.refs.hiddenImportFileInput.files[0];
+ if(! (file && file.size && accept(file, ['.zip', '.csar'])) ) {
+ this.props.onInvalidFileUpload();
+ return;
+ }
let {version} = this.props;
let formData = new FormData();
- formData.append('upload', this.refs.hiddenImportFileInput.files[0]);
+ formData.append('upload', file);
this.refs.hiddenImportFileInput.value = '';
this.props.onUpload(formData, version);
}
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 2308527220..3fdaa9c591 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
@@ -13,7 +13,8 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
-import React, {Component, PropTypes} from 'react';
+import React, {Component} from 'react';
+import PropTypes from 'prop-types';
import classNames from 'classnames';
import Collapse from 'react-bootstrap/lib/Collapse.js';
import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js';
@@ -95,7 +96,7 @@ function HeatFileTreeHeader(props) {
<div className='tree-header-title' >
{/*<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(`${props.headerTitle} ${hasErrors ? '(Draft)' : ''}`)}</span>
+ 'tree-header-title-selected' : props.selectedNode === nodeFilters.ALL})}>{i18n('{title} {hasErrors}', {title: props.headerTitle, hasErrors: hasErrors ? '(Draft)' : ''})}</span>
</div>
<ErrorsAndWarningsCount errorList={props.errorList} size='large' />
</div>);
@@ -199,7 +200,6 @@ class HeatMessageBoard extends Component {
}
renderError(error) {
let rand = Math.random() * (3000 - 1) + 1;
- console.log(this.props.selectedNode );
return (
<div
key={error.name + error.errorMessage + error.parentName + rand}