Fixed collection bug issue. Bug was caused by ordering assumption I made.

This commit is contained in:
ajmaley
2018-12-10 16:09:30 -05:00
parent 3feec479f2
commit df5052a917
4 changed files with 29 additions and 20 deletions

View File

@@ -1,24 +1,32 @@
import React, { Component } from 'react';
import flamelinkApp from '../../utilities/flamelink.js';
import Grid from '@material-ui/core/Grid';
import FlameLinkCollectionComponentCreations from './FlameLinkCollectionComponentCreations';
class FlameLinkCollection extends Component {
state = {
schemaContent: '',
}
constructor(props) {
super(props);
this.state = {
schemaContent: '',
}
componentDidMount() {
flamelinkApp.content.get(this.props.schemaName)
.then(result => this.setState({
schemaContent: result
}))
}
.then(result => this.setState({
schemaContent: result
}))
}
getCollectionContent(schemaData) {
var arr2 = [];
var collectionInfo = [schemaData, this.state.schemaContent];
for (var val in this.state.schemaContent) {
arr2[this.state.schemaContent[val]['order']] = val;
if ( this.state.schemaContent[val].hasOwnProperty('order') ) {
arr2[this.state.schemaContent[val]['order']] = val;
}
else{
arr2.push(val);
}
}
return arr2.map(this.getCollectionComponentInfo, collectionInfo);
}
@@ -28,6 +36,7 @@ class FlameLinkCollection extends Component {
for (var val in this[0]) {
arr3.push(val);
}
return <FlameLinkCollectionComponentCreations schemaData={this[0]} schemaContent={this[1][num]} arr={arr3} key={num} />
}
@@ -44,9 +53,9 @@ class FlameLinkCollection extends Component {
render() {
return (
<div>
<Grid container>
{this.getCollectionContent(this.props.schemaData)}
</div>
</Grid>
);
}
}

View File

@@ -16,7 +16,7 @@ const styles = theme => ({
class About extends Component {
state = {
researcherSchemaName: 'martenAbout',
developerSchemaName: 'martenAboutDev',
developerSchemaName: 'martenAboutDevelopers',
researcherSchemaDetails: '',
researcherSchemaType: '',
developerSchemaDetails: '',