X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=ang%2Fapi4Explorer%2FExplorer.js;h=63cb5dedd5bf9ef682c307189e69c81dedddfbc0;hb=7c7cc622fb9ecae222bfa161850ffb41598ddbb9;hp=97c6152e2355e3b0e5035d8e7fbe677853b35966;hpb=da80ef3d400fc84c175ce13f47e41ffd65030174;p=civicrm-core.git diff --git a/ang/api4Explorer/Explorer.js b/ang/api4Explorer/Explorer.js index 97c6152e23..63cb5dedd5 100644 --- a/ang/api4Explorer/Explorer.js +++ b/ang/api4Explorer/Explorer.js @@ -52,6 +52,7 @@ $scope.loading = false; $scope.controls = {}; $scope.langs = ['php', 'js', 'ang', 'cli']; + $scope.joinTypes = [{k: false, v: ts('Optional')}, {k: true, v: ts('Required')}]; $scope.code = { php: [ {name: 'oop', label: ts('OOP Style'), code: ''}, @@ -136,7 +137,7 @@ } fields.push({ text: link.alias, - description: 'Join to ' + link.entity, + description: 'Implicit join to ' + link.entity, children: wildCard.concat(formatForSelect2(linkFields, [], 'name', ['description'], link.alias + '.')) }); } @@ -253,7 +254,7 @@ if (_.isEmpty($scope.availableParams)) { return; } - var specialParams = ['select', 'fields', 'action', 'where', 'values', 'defaults', 'orderBy', 'chain', 'groupBy', 'having']; + var specialParams = ['select', 'fields', 'action', 'where', 'values', 'defaults', 'orderBy', 'chain', 'groupBy', 'having', 'join']; if ($scope.availableParams.limit && $scope.availableParams.offset) { specialParams.push('limit', 'offset'); } @@ -454,12 +455,15 @@ }); }); } - if (typeof objectParams[name] !== 'undefined' || name === 'groupBy' || name === 'select') { + if (typeof objectParams[name] !== 'undefined' || name === 'groupBy' || name === 'select' || name === 'join') { $scope.$watch('controls.' + name, function(value) { var field = value; $timeout(function() { if (field) { - if (typeof objectParams[name] === 'undefined') { + if (name === 'join') { + $scope.params[name].push([field + ' AS ' + _.snakeCase(field), false, '[]']); + } + else if (typeof objectParams[name] === 'undefined') { $scope.params[name].push(field); } else { var defaultOp = _.cloneDeep(objectParams[name]);