Skip to content

Commit

Permalink
Merge pull request EUDAT-B2SHARE#1622 from emanueldima/fix-ui-md-sche…
Browse files Browse the repository at this point in the history
…ma-bug

check that all declared presentation items in schemas exist
  • Loading branch information
nharraud authored Jan 9, 2018
2 parents 38b912d + 0c24be4 commit 9389b78
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions webui/src/components/schema.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export function getSchemaOrderedMajorAndMinorFields(schema) {
const presentation = schema.getIn(['b2share', 'presentation']);
const properties = schema.get('properties');

const majorIDs = presentation ? presentation.get('major') : null;
const minorIDs = presentation ? presentation.get('minor') : null;
const majorIDs = presentation && presentation.get('major') ?
presentation.get('major').filter(id => properties.get(id)) : null;
const minorIDs = presentation && presentation.get('minor') ?
presentation.get('minor').filter(id => properties.get(id)) : null;

let minors = OrderedMap(minorIDs ? minorIDs.map(id => [id, properties.get(id)]) : []);
let majors = OrderedMap(majorIDs ? majorIDs.map(id => [id, properties.get(id)]) : []);
Expand Down

0 comments on commit 9389b78

Please sign in to comment.