const name = path.join('.');
const isEditable = true;
const isGuid = Property.isGuid(property);
+ const isBoolean = Property.isBoolean(property);
const onChange = onFormFieldValueChanged.bind(container);
const isEnumeration = Property.isEnumeration(property);
const isLeafRef = Property.isLeafRef(property);
return <select key={fieldKey.toString()} id={fieldKey.toString()} className={ClassNames({'-value-not-set': !isValueSet})} name={name} value={value} title={name} onChange={onChange} onFocus={onFocus} onBlur={endEditing} onMouseDown={startEditing} onMouseOver={startEditing} readOnly={!isEditable}>{options}</select>;
}
+ if (isBoolean) {
+ let fullFieldKey = _.isArray(fieldKey) ? fieldKey.join(':') : fieldKey;
+ let containerRef = container;
+ while (containerRef.parent) {
+ fullFieldKey = containerRef.parent.key + ':' + fullFieldKey;
+ containerRef = containerRef.parent;
+ }
+
+ const options = [
+ <option key={fieldKey.toString() + '-true'} value="TRUE">TRUE</option>,
+ <option key={fieldKey.toString() + '-false'} value="FALSE">FALSE</option>
+ ]
+
+ // if (!isValueSet) {
+ const noValueDisplayText = changeCase.title(property.name);
+ options.unshift(<option key={'(value-not-in-leafref)' + fieldKey.toString()} value="" placeholder={placeholder}></option>);
+ // }
+ let val = value;
+ if(typeof(val) == 'number') {
+ val = value ? "TRUE" : "FALSE"
+ }
+ const isValueSet = (val != '' && val)
+ return <select key={fieldKey.toString()} id={fieldKey.toString()} className={ClassNames({'-value-not-set': !isValueSet})} name={name} value={val && val.toUpperCase()} title={name} onChange={onChange} onFocus={onFocus} onBlur={endEditing} onMouseDown={startEditing} onMouseOver={startEditing} readOnly={!isEditable}>{options}</select>;
+ }
+
if (property['preserve-line-breaks']) {
return <textarea key={fieldKey.toString()} cols="5" id={fieldKey.toString()} name={name} value={value} placeholder={placeholder} onChange={onChange} onFocus={onFocus} onBlur={endEditing} onMouseDown={startEditing} onMouseOver={startEditing} onMouseOut={endEditing} onMouseLeave={endEditing} readOnly={!isEditable} />;
}
import utils from '../utils'
export default {
+ isBoolean(property = {}) {
+ return (typeof(property['data-type']) == 'string') && (property['data-type'].toLowerCase() == 'boolean')
+ },
isLeaf(property = {}) {
return /leaf|choice/.test(property.type);
},
componentWillMount() {
(!this.state.nsrId && this.props.nsrId) && this.Store.saveNSRId(this.props.nsrId);
this.Store.saveMode(this.props.mode);
+ this.Store.saveOnSuccess(this.props.onSuccess);
switch (this.props.mode) {
case 'creating':
if (!this.state.vld) {
saveVnfdIdRefs: this.saveVnfdIdRefs,
saveIpProfileNames: this.saveIpProfileNames,
removeVirtualLink: this.removeVirtualLink,
- saveMode: this.saveMode
+ saveMode: this.saveMode,
+ saveOnSuccess: this.saveOnSuccess
});
}
});
}
+ saveOnSuccess = (onSuccess) => {
+ this.setState({
+ onSuccess: onSuccess
+ })
+ }
+
saveMode = (mode) => {
this.setState({
mode: mode
}
createVirtualLinkSuccess(data) {
- this.setState({
- // vld: this.vld,
- mode: 'editing',
- isLoading: false
- });
+ this.onSuccess();
}
editVirtualLinkSuccess(data) {
- this.setState({
- mode: 'editing',
- isLoading: false
- });
+ this.onSuccess();
}
deleteVirtualLinkSuccess(data) {
- this.setState({
- deleteState: 'success'
- });
+ this.onSuccess();
}
cleanupPayload = (mode, vld) => {
let nsd = nsr.nsd && nsr.nsd;
nsr['decorated-vlrs'] && nsr['decorated-vlrs'].map((vlr, vlrIndex) => {
- let name = vlr.name || 'New virtual link being created';
+ let name = vlr.name || 'Undergoing virtual link operation';
let operationalStatus = vlr['operational-status'];
let vlrId = vlr['id'];
let vldId = vlr['vld-ref'];
<div className="launchpadCard_title" style={{textAlign:'right'}}><span style={{float:'left'}}>VLD DETAILS</span>
</div>
{
- <NSVirtualLinkCreate vld={this.state.editingVirtualLink} mode={this.state.mode} nsd={this.state.nsd} nsrId={this.state.nsrId} onCancel={this.handleCancelCreate}/>
+ <NSVirtualLinkCreate vld={this.state.editingVirtualLink} mode={this.state.mode} nsd={this.state.nsd} nsrId={this.state.nsrId} onSuccess={this.resetState.bind(this)} onCancel={this.handleCancelCreate}/>
}
</div>
);