MailTracker: do not search when not both datetime parameters are given

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@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-04-24 15:57:55 +02:00 committed by Thomas Lamprecht
parent 2e330d4477
commit e8e332fe01

View File

@ -49,6 +49,10 @@ Ext.define('PMG.MailTrackerFilter', {
if (value) { param[name] = value; } 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; return param;
}, },
@ -260,6 +264,9 @@ Ext.define('PMG.MailTracker', {
var filter = this.lookupReference('filter'); var filter = this.lookupReference('filter');
var status = this.lookupReference('status'); var status = this.lookupReference('status');
var params = filter.getFilterParams(); var params = filter.getFilterParams();
if (params === undefined) {
return; // something went wrong with the filters bail out
}
status.update(''); // clear status before load status.update(''); // clear status before load
view.store.proxy.setExtraParams(params); view.store.proxy.setExtraParams(params);
view.store.proxy.setUrl('/api2/json/nodes/' + Proxmox.NodeName + '/tracker'); view.store.proxy.setUrl('/api2/json/nodes/' + Proxmox.NodeName + '/tracker');