[pmg-devel] [PATCH pmg-gui 3/4] MailTracker: do not search when not all parameters are given

Dominik Csapak d.csapak at proxmox.com
Fri Apr 24 15:57:55 CEST 2020


in the gui, we always expect an end and starttime, the only
case where we do not get this is when the fields are invalid, so
bail out in that case instead of searching

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 js/MailTracker.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/js/MailTracker.js b/js/MailTracker.js
index 9a6774b..f506430 100644
--- a/js/MailTracker.js
+++ b/js/MailTracker.js
@@ -54,6 +54,10 @@ Ext.define('PMG.MailTrackerFilter', {
 	    if (value) { param[name] = value; }
 	});
 
+	// there must always be a start and endtime, otherwise the field was invalid
+	if (!param.starttime || !param.endtime) {
+	    return undefined;
+	}
 	return param;
     },
 
@@ -278,6 +282,9 @@ Ext.define('PMG.MailTracker', {
 	    var filter = this.lookupReference('filter');
 	    var status = this.lookupReference('status');
 	    var params = filter.getFilterParams();
+	    if (params === undefined) {
+		return; // something went wrong with the filters bail out
+	    }
 	    status.update(''); // clear status before load
 	    view.store.proxy.setExtraParams(params);
 	    view.store.proxy.setUrl('/api2/json/nodes/' + Proxmox.NodeName + '/tracker');
-- 
2.20.1




More information about the pmg-devel mailing list