feat(config): add support for setting custom identifier field (#1543)
This commit is contained in:
committed by
Shawn Erquhart
parent
288359da3b
commit
12418dd7f0
@ -113,9 +113,10 @@ export const selectAllowDeletion = collection =>
|
||||
export const selectTemplateName = (collection, slug) =>
|
||||
selectors[collection.get('type')].templateName(collection, slug);
|
||||
export const selectIdentifier = collection => {
|
||||
const identifier = collection.get('identifier_field');
|
||||
const indentifierFields = identifier ? [identifier, ...IDENTIFIER_FIELDS] : IDENTIFIER_FIELDS;
|
||||
const fieldNames = collection.get('fields').map(field => field.get('name'));
|
||||
return IDENTIFIER_FIELDS.find(id => fieldNames.find(name => name.toLowerCase().trim() === id));
|
||||
// There must be a field whose `name` matches one of the IDENTIFIER_FIELDS.
|
||||
return indentifierFields.find(id => fieldNames.find(name => name.toLowerCase().trim() === id));
|
||||
};
|
||||
export const selectInferedField = (collection, fieldName) => {
|
||||
const inferableField = INFERABLE_FIELDS[fieldName];
|
||||
|
Reference in New Issue
Block a user