From cf9c366d2b59c2cb1902542c702f48ddc5432ce1 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 4 Jan 2021 11:00:10 -0700 Subject: [PATCH] Etemplate: Bugfixes - Early exit for arrayMgr().getEntry() if nothing is found, avoids returning all data - Remove debugger from selectbox --- api/js/etemplate/et2_core_arrayMgr.js | 2 ++ api/js/etemplate/et2_core_arrayMgr.ts | 1 + api/js/etemplate/et2_widget_selectbox.js | 1 - api/js/etemplate/et2_widget_selectbox.ts | 1 - 4 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/et2_core_arrayMgr.js b/api/js/etemplate/et2_core_arrayMgr.js index 7ddbbc122d..eb9a684bb0 100644 --- a/api/js/etemplate/et2_core_arrayMgr.js +++ b/api/js/etemplate/et2_core_arrayMgr.js @@ -178,6 +178,8 @@ var et2_arrayMgr = /** @class */ (function () { } // Parse the given key by removing the "]"-chars and splitting at "[" var indexes = this.explodeKey(_key); + if (indexes.length == 0 && _skipEmpty) + return null; var entry = this.data; for (var i = 0; i < indexes.length; i++) { // Abort if the current entry is not an object (associative array) and diff --git a/api/js/etemplate/et2_core_arrayMgr.ts b/api/js/etemplate/et2_core_arrayMgr.ts index 352356b9c3..9e1c791ea9 100644 --- a/api/js/etemplate/et2_core_arrayMgr.ts +++ b/api/js/etemplate/et2_core_arrayMgr.ts @@ -190,6 +190,7 @@ export class et2_arrayMgr // Parse the given key by removing the "]"-chars and splitting at "[" const indexes = this.explodeKey(_key); + if(indexes.length == 0 && _skipEmpty) return null; let entry = this.data; for (let i = 0; i < indexes.length; i++) { diff --git a/api/js/etemplate/et2_widget_selectbox.js b/api/js/etemplate/et2_widget_selectbox.js index 32b696ee94..fb37e3ce49 100644 --- a/api/js/etemplate/et2_widget_selectbox.js +++ b/api/js/etemplate/et2_widget_selectbox.js @@ -627,7 +627,6 @@ var et2_selectbox = /** @class */ (function (_super) { }); } this.input.on('liszt:ready', function (evt, params) { - debugger; this.set_statustext(this.statustext); }.bind(this)); this.input.chosen({ diff --git a/api/js/etemplate/et2_widget_selectbox.ts b/api/js/etemplate/et2_widget_selectbox.ts index 0b840b9372..79b4d13281 100644 --- a/api/js/etemplate/et2_widget_selectbox.ts +++ b/api/js/etemplate/et2_widget_selectbox.ts @@ -849,7 +849,6 @@ export class et2_selectbox extends et2_inputWidget }); } this.input.on('liszt:ready', function(evt, params) { - debugger; this.set_statustext(this.statustext); }.bind(this)); this.input.chosen({