From d71cde6c6bc98425f3b840005a9298f126f55459 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 8 Apr 2020 10:23:02 -0400 Subject: [PATCH] APIv4 Explorer - Improve display of limit & offset params --- Civi/Api4/Generic/AbstractQueryAction.php | 6 +++--- ang/api4Explorer/Explorer.html | 14 +++++++++++++- ang/api4Explorer/Explorer.js | 3 +++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Civi/Api4/Generic/AbstractQueryAction.php b/Civi/Api4/Generic/AbstractQueryAction.php index e58ab26659..41fa6f65d0 100644 --- a/Civi/Api4/Generic/AbstractQueryAction.php +++ b/Civi/Api4/Generic/AbstractQueryAction.php @@ -62,9 +62,9 @@ abstract class AbstractQueryAction extends AbstractAction { /** * Maximum number of $ENTITIES to return. * - * Defaults to unlimited. + * Defaults to `0` - unlimited. * - * Note: the Api Explorer sets this to 25 by default to avoid timeouts. + * Note: the Api Explorer sets this to `25` by default to avoid timeouts. * Change or remove this default for your application code. * * @var int @@ -74,7 +74,7 @@ abstract class AbstractQueryAction extends AbstractAction { /** * Zero-based index of first $ENTITY to return. * - * Defaults to "0" - first $ENTITY found. + * Defaults to `0` - first $ENTITY found. * * @var int */ diff --git a/ang/api4Explorer/Explorer.html b/ang/api4Explorer/Explorer.html index ad35e38103..e34476a416 100644 --- a/ang/api4Explorer/Explorer.html +++ b/ang/api4Explorer/Explorer.html @@ -112,7 +112,19 @@ - +
+
+ + + + + + + + + +
+
chain
diff --git a/ang/api4Explorer/Explorer.js b/ang/api4Explorer/Explorer.js index f75443dcf4..a8f825af17 100644 --- a/ang/api4Explorer/Explorer.js +++ b/ang/api4Explorer/Explorer.js @@ -238,6 +238,9 @@ $scope.isSpecial = function(name) { var specialParams = ['select', 'fields', 'action', 'where', 'values', 'defaults', 'orderBy', 'chain', 'groupBy']; + if ($scope.availableParams.limit && $scope.availableParams.offset) { + specialParams.push('limit', 'offset'); + } return _.contains(specialParams, name); }; -- 2.25.1