VLM overview - refactor of edit description input
Change-Id: I8ba60ecdd9febacdf77bc354bd969462d8bae3e6
Issue-ID: SDC-552
Signed-off-by: miriame <miriam.eini@amdocs.com>
diff --git a/openecomp-ui/resources/scss/common/_utils.scss b/openecomp-ui/resources/scss/common/_utils.scss
index 54f8b97..88a9ece 100644
--- a/openecomp-ui/resources/scss/common/_utils.scss
+++ b/openecomp-ui/resources/scss/common/_utils.scss
@@ -118,6 +118,7 @@
max-height: $lineHeight * $lineCount;
text-align: justify;
word-break: break-all;
+ white-space: nowrap;
// margin-right: -1em;
padding-right: 1em;
&:before {
diff --git a/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss b/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss
index 15bb9a7..9246b5f 100644
--- a/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss
+++ b/openecomp-ui/resources/scss/modules/_licenseModelOverview.scss
@@ -153,6 +153,12 @@
position: relative;
left: -12px;
}
+ .validation-error-message.tooltip {
+ z-index: 1000;
+ .tooltip-inner {
+ background-color: $red;
+ }
+ }
}
}
.summary-count-list {
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 f0286ba..af9bc22 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 @@
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 9232402..f4d6d4d 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 @@
type='textarea'/>
<div className='buttons-row'>
<div className='buttons-wrapper'>
- <div onClick={() => this.onClose()} className='description-button' data-test-id='vlm-summary-vendor-desc-cancel-btn'>cancel</div>
- <div onClick={() => this.submit()} className={saveButtonClassName} data-test-id='vlm-summary-vendor-desc-save-btn'>save</div>
+ <div onClick={() => this.submit()} className={saveButtonClassName} data-test-id='vlm-summary-vendor-desc-save-btn'>{i18n('Save')}</div>
+ <div onClick={() => this.onClose()} className='description-button' data-test-id='vlm-summary-vendor-desc-cancel-btn'>{i18n('Cancel')}</div>
</div>
</div>
</div>
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 deb4550..532ca32 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 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 @@
<div className='vendor-title'>vendor</div>
<div className='vendor-name' data-test-id='vlm-summary-vendor-name'>{vendorName}</div>
{
- description && !isReadOnlyMode ? this.renderDescriptionEdit() : this.renderDescription()
+ description !== undefined && !isReadOnlyMode ? this.renderDescriptionEdit() : this.renderDescription()
}
</div>
);
}
+ componentWillUnmount() {
+ this.props.onCancel();
+ }
+
renderDescription() {
let {data: {description}, onVendorDescriptionEdit, isReadOnlyMode} = this.props;
@@ -71,7 +75,7 @@
{this.renderOverlay(
<div className='description-data' data-test-id='vlm-summary-vendor-description'>
{description}
- <SVGIcon name='pencil'/>
+ {!isReadOnlyMode && <SVGIcon name='pencil'/>}
</div>
)}
</div>
diff --git a/openecomp-ui/test/licenseModel/overview/summary/VendorDataView.test.js b/openecomp-ui/test/licenseModel/overview/summary/VendorDataView.test.js
index 8fea3e4..7ec85a4 100644
--- a/openecomp-ui/test/licenseModel/overview/summary/VendorDataView.test.js
+++ b/openecomp-ui/test/licenseModel/overview/summary/VendorDataView.test.js
@@ -34,14 +34,14 @@
var props = mapStateToProps(state);
expect(props.isReadOnlyMode).toEqual(true);
- expect(props.description).toEqual(null);
+ expect(props.description).toEqual(undefined);
expect(props.data).toEqual(state.licenseModel.licenseModelEditor.data);
});
it('jsx view test', () => {
var data = LicenseModelStoreFactory.build();
- var view = TestUtils.renderIntoDocument(<VendorDataView isReadOnlyMode={false} description='' data={data} />);
+ var view = TestUtils.renderIntoDocument(<VendorDataView isReadOnlyMode={false} description='' data={data} genericFieldInfo={{description: {isValid: true}}}/>);
expect(view).toBeTruthy();
});