From 6ef2c123721eb0061be3d6ece1e00349aadf7392 Mon Sep 17 00:00:00 2001 From: miriame Date: Sun, 29 Oct 2017 13:59:52 +0200 Subject: VLM overview - refactor of edit description input Change-Id: I8ba60ecdd9febacdf77bc354bd969462d8bae3e6 Issue-ID: SDC-552 Signed-off-by: miriame --- .../overview/licenseModelOverviewActionHelper.js | 2 +- .../overview/summary/LicenseModelDescriptionEdit.jsx | 5 +++-- .../licenseModel/overview/summary/VendorDataView.js | 12 ++++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'openecomp-ui/src/sdc-app/onboarding/licenseModel') diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js index f0286ba3bb..af9bc22b07 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js @@ -33,7 +33,7 @@ export default { editDescriptionClose(dispatch) { dispatch({ type: actionTypes.LM_DATA_CHANGED, - description: false + description: undefined }); } }; diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx index 9232402b75..f4d6d4d42c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/LicenseModelDescriptionEdit.jsx @@ -15,6 +15,7 @@ */ import React from 'react'; import Input from 'nfvo-components/input/validation/Input.jsx'; +import i18n from 'nfvo-utils/i18n/i18n.js'; class LicenseModelDescriptionEdit extends React.Component { render() { @@ -33,8 +34,8 @@ class LicenseModelDescriptionEdit extends React.Component { type='textarea'/>
-
this.onClose()} className='description-button' data-test-id='vlm-summary-vendor-desc-cancel-btn'>cancel
-
this.submit()} className={saveButtonClassName} data-test-id='vlm-summary-vendor-desc-save-btn'>save
+
this.submit()} className={saveButtonClassName} data-test-id='vlm-summary-vendor-desc-save-btn'>{i18n('Save')}
+
this.onClose()} className='description-button' data-test-id='vlm-summary-vendor-desc-cancel-btn'>{i18n('Cancel')}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js index deb4550347..532ca32f8e 100644 --- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js +++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/overview/summary/VendorDataView.js @@ -26,8 +26,8 @@ import LicenseModelDescriptionEdit from './LicenseModelDescriptionEdit.jsx'; import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js'; import {VLM_DESCRIPTION_FORM} from '../LicenseModelOverviewConstants.js'; -export const mapStateToProps = ({licenseModel: {licenseModelEditor: {data}, licenseModelOverview: {descriptionEditor: {data: descriptionData, genericFieldInfo} }}}) => { - let description = (descriptionData && descriptionData.description) ? descriptionData.description : null; +export const mapStateToProps = ({licenseModel: {licenseModelEditor: {data}, licenseModelOverview: {descriptionEditor: {data: descriptionData = {}, genericFieldInfo} }}}) => { + let {description} = descriptionData; let isReadOnlyMode = VersionControllerUtils.isReadOnly(data); return { data, @@ -57,12 +57,16 @@ export class VendorDataView extends Component {
vendor
{vendorName}
{ - description && !isReadOnlyMode ? this.renderDescriptionEdit() : this.renderDescription() + description !== undefined && !isReadOnlyMode ? this.renderDescriptionEdit() : this.renderDescription() } ); } + componentWillUnmount() { + this.props.onCancel(); + } + renderDescription() { let {data: {description}, onVendorDescriptionEdit, isReadOnlyMode} = this.props; @@ -71,7 +75,7 @@ export class VendorDataView extends Component { {this.renderOverlay(
{description} - + {!isReadOnlyMode && }
)} -- cgit 1.2.3-korg