actions = {values: ['get']},
fields = [],
getFieldData = {},
- options = {},
params = {},
smartyStub,
entityDoc,
docCodeTpl = _.template($('#doc-code-tpl').html()),
// These types of entityRef don't require any input to open
+ // FIXME: ought to be in getfields metadata
OPEN_IMMEDIATELY = ['RelationshipType', 'Event', 'Group', 'Tag'],
// Actions that don't support fancy operators
function getFields(changedElement) {
var required = [];
fields = [];
- options = {};
getFieldData = {};
// Special case for getfields
if (action === 'getfields') {
fields.push({
id: 'api_action',
- text: 'Action'
+ text: 'Action',
+ options: _.reduce(actions.values, function(ret, item) {
+ ret[item] = item;
+ return ret;
+ }, {})
});
- options.api_action = _.reduce(actions.values, function(ret, item) {
- ret[item] = item;
- return ret;
- }, {});
showFields(['api_action']);
return;
}
if (field['api.required'] && field['api.required'] !== '0') {
required.push(field.name);
}
- if (field.options) {
- options[field.name] = field.options;
- }
}
});
if ($(changedElement).is('#api-entity') && data.deprecated) {
* @returns boolean
*/
function isSelect(fieldName, operator) {
- return (isYesNo(fieldName) || options[fieldName] || (getFieldData[fieldName] && getFieldData[fieldName].FKApiName)) && !_.includes(TEXT, operator);
+ var fieldSpec = getFieldData[fieldName] || {};
+ return (isYesNo(fieldName) || fieldSpec.options || fieldSpec.FKApiName) && !_.includes(TEXT, operator);
}
/**
});
}
// Select options
- else if (options[name]) {
+ else if (getFieldData[name].options) {
$valField.select2({
multiple: multiSelect,
- data: _.map(options[name], function (value, key) {
+ data: _.map(getFieldData[name].options, function (value, key) {
return {id: key, text: value};
})
});