all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com, Matthias Heiserer <m.heiserer@proxmox.com>
Subject: Re: [pbs-devel] [PATCH v2 proxmox-backup] prune-simulator: allow setting a custom date/time
Date: Tue, 20 Sep 2022 14:10:37 +0200	[thread overview]
Message-ID: <895444e8-e091-272d-d6c2-355d902a547f@proxmox.com> (raw)
In-Reply-To: <20220919111347.187510-1-m.heiserer@proxmox.com>

Am 19.09.22 um 13:13 schrieb Matthias Heiserer:
> @@ -456,9 +461,10 @@ Ext.onReady(function() {
>  		    let weekday = parseInt(Ext.Date.format(daysDate, 'w'), 10);
>  		    if (weekdayFlags[weekday]) {
>  			timesOnSingleDay.forEach(function(time) {
> -			    backups.push({
> -				backuptime: Ext.Date.subtract(new Date(time), Ext.Date.DAY, i),
> -			    });
> +			    const backuptime = Ext.Date.subtract(new Date(time), Ext.Date.DAY, i);
> +			    if (backuptime < vmDate) {

Should we use '<='? Feels more intuitive to me to include a backup that
happens at the end of the schedule. (Well, one could argue it's more
realistic with '<', because that backup wouldn't be completed in
practice :P)

> +				backups.push({ backuptime: backuptime });
> +			    }
>  			});
>  		    }
>  		}

(...)

> +				    items: [
> +					{
> +					    xtype: 'datefield',
> +					    name: 'currentDate',
> +					    fieldLabel: 'Date',
> +					    allowBlank: false,
> +					    padding: '0 0 0 10',

Should we use "Y-m-d" format here, like in the backup listing? The
default seems to be "m/d/Y" and that is confusing to many people ;)

> +					    value: vm.get('now'),
> +					    listeners: {
> +						select: function(_, day) {

While this seems to work as-is, I'd prefer a change listener here too,
see below.

> +						    const date = me.getViewModel().get('now');
> +						    date.setFullYear(
> +							day.getFullYear(),
> +							day.getMonth(),
> +							day.getDay(),

getDay() returns the day of the week (0-6), not the day of the month.
getDate() seems to be the correct one, but yeah, it's a confusing name :/

> +						    );
> +						},
> +					    },
> +					},
> +					{
> +					    xtype: 'timefield',
> +					    name: 'currentTime',
> +					    reference: 'currentTime',
> +					    fieldLabel: 'Time',
> +					    allowBlank: false,
> +					    padding: '0 0 0 10',
> +					    format: 'H:i',
> +					    // cant bind value because ExtJS sets the year
> +					    // to 2008 to protect against DST issues
> +					    // and date picker zeroes hour/minute
> +					    value: vm.get('now'),
> +					    listeners: {
> +						select: function(_, record) {

Using a 'change' listener instead should make manual editing work too.
Currently, manual edits don't seem to update the view model entry.

> +						    const time = record.get('date');
> +						    const date = me.getViewModel().get('now');
> +						    date.setHours(time.getHours());
> +						    date.setMinutes(time.getMinutes());
> +						},
> +					    },
> +					},
> +				    ],
>  				},
>  			    ],
>  			},




      reply	other threads:[~2022-09-20 12:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19 11:13 Matthias Heiserer
2022-09-20 12:10 ` Fiona Ebner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=895444e8-e091-272d-d6c2-355d902a547f@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=m.heiserer@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal