Merge branch 'v1.1' 56/1056/1
authorLaurence Maultsby <laurence.maultsby@riftio.com>
Tue, 31 Jan 2017 19:54:49 +0000 (14:54 -0500)
committerLaurence Maultsby <laurence.maultsby@riftio.com>
Tue, 31 Jan 2017 19:55:14 +0000 (14:55 -0500)
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
skyquake/plugins/composer/src/src/components/EditDescriptorModelProperties.js
skyquake/plugins/composer/src/src/libraries/model/DescriptorModelMetaProperty.js
skyquake/plugins/launchpad/src/virtual_links/nsVirtualLinkCreate.jsx
skyquake/plugins/launchpad/src/virtual_links/nsVirtualLinkCreateStore.js
skyquake/plugins/launchpad/src/virtual_links/nsVirtualLinks.jsx

index 4ee4345..a69f3bb 100644 (file)
@@ -180,6 +180,7 @@ export default function EditDescriptorModelProperties(props) {
                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);
@@ -224,6 +225,31 @@ export default function EditDescriptorModelProperties(props) {
                        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} />;
                }
index 89d1fe9..8fe51d9 100644 (file)
@@ -32,6 +32,9 @@ import DescriptorTemplateFactory from './DescriptorTemplateFactory'
 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);
        },
index 30f7694..d3dc011 100644 (file)
@@ -39,6 +39,7 @@ class NsVirtualLinkCreate extends React.Component {
        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) {
index 61ebe3d..dbd7f58 100644 (file)
@@ -84,7 +84,8 @@ class NSVirtualLinkCreateStore {
             saveVnfdIdRefs: this.saveVnfdIdRefs,
             saveIpProfileNames: this.saveIpProfileNames,
             removeVirtualLink: this.removeVirtualLink,
-            saveMode: this.saveMode
+            saveMode: this.saveMode,
+            saveOnSuccess: this.saveOnSuccess
         });
        }
 
@@ -97,6 +98,12 @@ class NSVirtualLinkCreateStore {
                });
        }
 
+       saveOnSuccess = (onSuccess) => {
+               this.setState({
+                       onSuccess: onSuccess
+               })
+       }
+
        saveMode = (mode) => {
                this.setState({
                        mode: mode
@@ -240,22 +247,13 @@ class NSVirtualLinkCreateStore {
        }
 
        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) => {
index 8870dfc..fa09d9f 100644 (file)
@@ -137,7 +137,7 @@ class NsVirtualLinks extends React.Component {
                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'];
@@ -208,7 +208,7 @@ class NsVirtualLinks extends React.Component {
                        <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>
             );