aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx
diff options
context:
space:
mode:
authorEinav Weiss Keidar <einavw@amdocs.com>2018-03-20 14:45:40 +0200
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-03-20 13:52:31 +0000
commit7fdf733a64670fceefc3ded35cfa581e1c458179 (patch)
treeb3623ac9a331473830cb0167c0b487f2a176427c /openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx
parentc7916a4e5955ccc5f0f5252307363b791ec5c7b9 (diff)
Adding Prettier and fixing up eslint version
Issue-ID: SDC-1094 Change-Id: Ie83ad95a03899345dd90235daf0323cbe3bc6afd Signed-off-by: Einav Weiss Keidar <einavw@amdocs.com>
Diffstat (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx')
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx122
1 files changed, 71 insertions, 51 deletions
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx
index c2a3e0bd02..9c20723689 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsVendorSelector.jsx
@@ -22,57 +22,77 @@ import Input from 'nfvo-components/input/validation/Input.jsx';
import sortByStringProperty from 'nfvo-utils/sortByStringProperty.js';
class VendorSelector extends React.Component {
- static propTypes = {
- finalizedLicenseModelList: PropTypes.array,
- vendorName: PropTypes.string,
- onClose: PropTypes.func.isRequired,
- onConfirm: PropTypes.func.isRequired
- }
- constructor(props){
- super(props);
- const selectedValue = props.finalizedLicenseModelList.length ? props.finalizedLicenseModelList[0].id : '';
- this.state = {
- selectedValue
- };
- }
- submit() {
- const vendor = this.props.finalizedLicenseModelList.find(item => item.id === this.state.selectedValue);
- this.props.onConfirm(vendor.id);
- this.props.onClose();
- }
- render() {
- const {finalizedLicenseModelList, vendorName, onClose} = this.props;
- const {selectedValue} = this.state;
- return (
- <div className='vsp-details-vendor-select'>
- <Form
- onSubmit={() => this.submit()}
- onReset={() => onClose()}
- isValid = {!!selectedValue}
- submitButtonText={i18n('Save')}
- hasButtons={true}>
- <div className='vendor-selector-modal-title'>{`${i18n('The VLM')} '${vendorName}' ${i18n('assigned to this VSP is archived')}.`}</div>
- <div className='vendor-selector-modal-additional-text'>{i18n('If you select a different VLM you will not be able to reselect the archived VLM.')}</div>
- <Input
- data-test-id='vsp-vendor-name-select'
- label={i18n('Vendor')}
- type='select'
- onChange={e => {this.setState({
- selectedValue: e.target.options[e.target.selectedIndex].value
- });}}
- value={selectedValue}>
- <option key='emtyVendor' value=''>{i18n('please select...')}</option>
- {sortByStringProperty(
- finalizedLicenseModelList,
- 'name'
- ).map(lm => <option key={lm.id} value={lm.id}>{lm.name}</option>)
- }
- </Input>
- </Form>
- </div>
- );
- }
+ static propTypes = {
+ finalizedLicenseModelList: PropTypes.array,
+ vendorName: PropTypes.string,
+ onClose: PropTypes.func.isRequired,
+ onConfirm: PropTypes.func.isRequired
+ };
+ constructor(props) {
+ super(props);
+ const selectedValue = props.finalizedLicenseModelList.length
+ ? props.finalizedLicenseModelList[0].id
+ : '';
+ this.state = {
+ selectedValue
+ };
+ }
+ submit() {
+ const vendor = this.props.finalizedLicenseModelList.find(
+ item => item.id === this.state.selectedValue
+ );
+ this.props.onConfirm(vendor.id);
+ this.props.onClose();
+ }
+ render() {
+ const { finalizedLicenseModelList, vendorName, onClose } = this.props;
+ const { selectedValue } = this.state;
+ return (
+ <div className="vsp-details-vendor-select">
+ <Form
+ onSubmit={() => this.submit()}
+ onReset={() => onClose()}
+ isValid={!!selectedValue}
+ submitButtonText={i18n('Save')}
+ hasButtons={true}>
+ <div className="vendor-selector-modal-title">{`${i18n(
+ 'The VLM'
+ )} '${vendorName}' ${i18n(
+ 'assigned to this VSP is archived'
+ )}.`}</div>
+ <div className="vendor-selector-modal-additional-text">
+ {i18n(
+ 'If you select a different VLM you will not be able to reselect the archived VLM.'
+ )}
+ </div>
+ <Input
+ data-test-id="vsp-vendor-name-select"
+ label={i18n('Vendor')}
+ type="select"
+ onChange={e => {
+ this.setState({
+ selectedValue:
+ e.target.options[e.target.selectedIndex]
+ .value
+ });
+ }}
+ value={selectedValue}>
+ <option key="emtyVendor" value="">
+ {i18n('please select...')}
+ </option>
+ {sortByStringProperty(
+ finalizedLicenseModelList,
+ 'name'
+ ).map(lm => (
+ <option key={lm.id} value={lm.id}>
+ {lm.name}
+ </option>
+ ))}
+ </Input>
+ </Form>
+ </div>
+ );
+ }
}
export default VendorSelector;
-