From af6f5ac8fc2ce4316867670d2ea9ed76ae17eafb Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 22 Jun 2020 16:04:51 -0400 Subject: [PATCH] APIv4 Explorer - UI support for join ON clause --- ang/api4Explorer/Clause.html | 44 ++++++++++--------- ang/api4Explorer/Explorer.html | 25 ++++++----- ang/api4Explorer/Explorer.js | 79 +++++++++++++++++++--------------- 3 files changed, 82 insertions(+), 66 deletions(-) diff --git a/ang/api4Explorer/Clause.html b/ang/api4Explorer/Clause.html index 9f9412e9f7..96698212f4 100644 --- a/ang/api4Explorer/Clause.html +++ b/ang/api4Explorer/Clause.html @@ -1,39 +1,41 @@ -{{ data.label || data.op + ' group' }} * +{{ data.label || ts('%1 group', {1: $ctrl.conjunctions[data.op]}) }}
-
-
-
-
- - {{ data.type }} - {{ data.op }} - - +
+
+
+
+ + {{ data.label }} + {{ $ctrl.conjunctions[data.op] }} + + +
+
+ + + +
+
+
-
- - - -
-
-
- +
diff --git a/ang/api4Explorer/Explorer.html b/ang/api4Explorer/Explorer.html index d1379c8929..fe618337ec 100644 --- a/ang/api4Explorer/Explorer.html +++ b/ang/api4Explorer/Explorer.html @@ -63,16 +63,19 @@
-
+
join * -
-
- - - - - -
+
+
+
+ + + + +
+
+
+
@@ -97,7 +100,7 @@
-
+
{{:: name }} * @@ -122,7 +125,7 @@
-
+
orderBy * diff --git a/ang/api4Explorer/Explorer.js b/ang/api4Explorer/Explorer.js index dc4ac31ca5..faacc68efa 100644 --- a/ang/api4Explorer/Explorer.js +++ b/ang/api4Explorer/Explorer.js @@ -465,7 +465,7 @@ $timeout(function() { if (field) { if (name === 'join') { - $scope.params[name].push([field + ' AS ' + _.snakeCase(field), false, '[]']); + $scope.params[name].push([field + ' AS ' + _.snakeCase(field), false]); } else if (typeof objectParams[name] === 'undefined') { $scope.params[name].push(field); @@ -905,59 +905,70 @@ }; }); - angular.module('api4Explorer').directive('crmApi4Clause', function($timeout) { + angular.module('api4Explorer').directive('crmApi4Clause', function() { return { scope: { - data: '=crmApi4Clause' + data: '= ($scope.data.skip || 0)) { + if (typeof clause !== 'undefined' && !clause[0]) { + values.splice(index, 1); + } + // Add/remove value if operator allows for one + else if (typeof clause[1] === 'string' && _.contains(clause[1], 'NULL')) { + clause.length = 2; + } else if (typeof clause[1] === 'string' && clause.length === 2) { + clause.push(''); + } } }); }, true); @@ -1073,7 +1084,7 @@ scope.$watchCollection('data', function(data) { destroyWidget(); var field = getField(data.field, entity, action); - if (field) { + if (field && data.format !== 'plain') { makeWidget(field, data.op); } }); -- 2.25.1