[pmg-devel] [PATCH pmg-gui 1/4] MailTracker: set min/maxValue for start/end

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Apr 24 21:20:21 CEST 2020


On 4/24/20 3:57 PM, Dominik Csapak wrote:
> every time the value changes, and also at the beginning
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  js/MailTracker.js | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/js/MailTracker.js b/js/MailTracker.js
> index 67ad371..23f7413 100644
> --- a/js/MailTracker.js
> +++ b/js/MailTracker.js
> @@ -27,9 +27,14 @@ Ext.define('PMG.MailTrackerFilter', {
>  
>          xclass: 'Ext.app.ViewController',
>  
> -	onFilterChange: function() {
> +	onFilterChange: function(comp) {
>  	    var view = this.getView();
>  	    view.fireEvent('filterChanged');
> +
> +	    let start = this.lookup('starttime');
> +	    let end = this.lookup('endtime');
> +	    end.setMinValue(start.getValue());
> +	    start.setMaxValue(end.getValue());
>  	},
>  
>  	onSpecialKey: function(field, e) {
> @@ -99,6 +104,15 @@ Ext.define('PMG.MailTrackerFilter', {
>  			var now = new Date();
>  			return new Date(now.getTime() - 3600000);
>  		    }()),
> +		    maxValue: (function() {
> +			var now = new Date();
> +			var tomorrow = new Date();
> +			tomorrow.setDate(now.getDate()+1);
> +			tomorrow.setHours(0);
> +			tomorrow.setMinutes(0);
> +			tomorrow.setSeconds(0);
> +			return tomorrow;
> +		    }()),
>  		    xtype: 'promxoxDateTimeField'
>  		},
>  		{
> @@ -114,6 +128,10 @@ Ext.define('PMG.MailTrackerFilter', {
>  			tomorrow.setSeconds(0);
>  			return tomorrow;
>  		    }()),
> +		    minValue: (function() {
> +			var now = new Date();
> +			return new Date(now.getTime() - 3600000);
> +		    }()),
>  		    xtype: 'promxoxDateTimeField'
>  		},
>  		{
> 

NOT applied for now, IMO while technically correct it really gets into ones way
when entering dates..

I'd really rather see the "just mark as invalid but allow all dates" approach we
talked about.

This should be quite simple to do..



More information about the pmg-devel mailing list