ui/src/components/DetailView/DetailView.js
// I go trough all objects recursively and get main fields in topObjects array to display them before fields of that object
I go trough all objects recursively and get main fields in topObjects array to display them before fields of that object
I go trough all objects recursively and get main fields in topObjects array to display them before fields of that object
eachRecursive(obj)
  {
      Object.keys(obj).forEach((prop, index) =>
      {
          if(prop === 'id') {
            return null
          }
          var random = Random.get(10000), random1 = Random.get(100000)
          if (typeof obj[prop] === "object" && obj[prop] !== null) {
            var hasElements = Object.keys(obj[prop]).length > 0 || 
              (obj[prop] instanceof Array && obj[prop].length > 0)
            if(isNaN(parseInt(prop, 10)) && hasElements) {
              this.topObjects.push(prop) 
              var topObject = this.topObjects[this.topObjects.length - 1]
              var topObjectView = (<div className='objectDescription' key={random1 + topObject + random}> 
                  {this.getFieldDescription(topObject)}
                </div>)
              this.fields.push(topObjectView)
            }
            this.eachRecursive(obj[prop])
          }
          else {
            console.log('R: ', this.props.readOnly, prop)
            var value = 
              <p key={this.topObjects.length + prop + obj[prop] + random} className='detailFieldP'> 
                <span className='fieldDescription'>{this.getFieldDescription(prop)}: </span> 
                <Input placeholder="Basic usage" 
                  value={obj[prop]} 
                  readOnly={this.props.readOnly} 
                  onChange={(event) => this.props.editField(event, obj, prop)} />
              </p>
            this.fields.push(value)
          }
      })
  }
eachRecursive ( obj ) { Object . keys ( obj ) . forEach ( ( prop , index ) => { if ( prop === 'id' ) { return null } var random = Random . get ( 10000 ) , random1 = Random . get ( 100000 ) if ( typeof obj [ prop ] === "object" && obj [ prop ] !== null ) { var hasElements = Object . keys ( obj [ prop ] ) . length > 0 || ( obj [ prop ] instanceof Array && obj [ prop ] . length > 0 ) if ( isNaN ( parseInt ( prop , 10 ) ) && hasElements ) { this . topObjects . push ( prop ) var topObject = this . topObjects [ this . topObjects . length - 1 ] var topObjectView = ( < div className = 'objectDescription' key = { random1 + topObject + random } > { this . getFieldDescription ( topObject ) } < / div > ) this . fields . push ( topObjectView ) } this . eachRecursive ( obj [ prop ] ) } else { console . log ( 'R: ' , this . props . readOnly , prop ) var value = < p key = { this . topObjects . length + prop + obj [ prop ] + random } className = 'detailFieldP' > < span className = 'fieldDescription' > { this . getFieldDescription ( prop ) } :  < / span > < Input placeholder = "Basic usage" value = { obj [ prop ] } readOnly = { this . props . readOnly } onChange = { ( event ) => this . props . editField ( event , obj , prop ) } / > < / p > this . fields . push ( value ) } } ) }
I go trough all objects recursively and get main fields in topObjects array to display them before fields of that object
I go trough all objects recursively and get main fields in topObjects array to display them before fields of that object
// To avoid duplicate keys // To avoid adding array index in here       // To display top object only once