From 6ba6f2bd40e3a42e9c1f7095964dc1c6df52e141 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 11 Nov 2019 11:59:33 -0500 Subject: [PATCH] Fix api explorer formatting IS NULL clauses --- ang/api4Explorer/Explorer.js | 13 ++++++++++++- ang/api4Explorer/WhereClause.html | 2 +- css/api4-explorer.css | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ang/api4Explorer/Explorer.js b/ang/api4Explorer/Explorer.js index 3e16b4f574..5ecf08d362 100644 --- a/ang/api4Explorer/Explorer.js +++ b/ang/api4Explorer/Explorer.js @@ -207,7 +207,7 @@ _.each($scope.params, function(param, key) { if (param != $scope.availableParams[key].default && !(typeof param === 'object' && _.isEmpty(param))) { if (_.contains($scope.availableParams[key].type, 'array') && (typeof objectParams[key] === 'undefined')) { - params[key] = parseYaml(_.cloneDeep(param)); + params[key] = parseYaml(JSON.parse(angular.toJson(param))); } else { params[key] = param; } @@ -239,6 +239,9 @@ if (typeof input === 'undefined') { return undefined; } + if (input === '') { + return ''; + } if (_.isObject(input) || _.isArray(input)) { _.each(input, function(item, index) { input[index] = parseYaml(item); @@ -490,6 +493,9 @@ if (typeof val === 'undefined') { return ''; } + if (val === null || val === true || val === false) { + return JSON.stringify(val).toUpperCase(); + } indent = (typeof indent === 'number') ? _.repeat(' ', indent) : (indent || ''); var ret = '', baseLine = indent ? indent.slice(0, -2) : '', @@ -627,6 +633,11 @@ if (typeof clause !== 'undefined' && !clause[0]) { values.splice(index, 1); } + if (typeof clause[1] === 'string' && _.contains(clause[1], 'NULL')) { + clause.length = 2; + } else if (typeof clause[1] === 'string' && clause.length == 2) { + clause.push(''); + } }); }, true); } diff --git a/ang/api4Explorer/WhereClause.html b/ang/api4Explorer/WhereClause.html index d36480f9de..52a237b504 100644 --- a/ang/api4Explorer/WhereClause.html +++ b/ang/api4Explorer/WhereClause.html @@ -36,4 +36,4 @@ - \ No newline at end of file + diff --git a/css/api4-explorer.css b/css/api4-explorer.css index a5be9c8a06..2171d003e8 100644 --- a/css/api4-explorer.css +++ b/css/api4-explorer.css @@ -148,10 +148,10 @@ #bootstrap-theme.api4-explorer-page .api4-chain-index, #bootstrap-theme.api4-explorer-page .api4-index, #bootstrap-theme.api4-explorer-page .api4-chain-action { - width: 70px; + width: 90px; } #bootstrap-theme.api4-explorer-page .api4-chain-params { - width: calc( 100% - 346px); + width: calc(100% - 386px); } #bootstrap-theme.api4-explorer-page .api4-add-where-group-menu { -- 2.25.1