From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 1D3477D102
 for <pve-devel@lists.proxmox.com>; Mon,  8 Nov 2021 14:08:05 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id DEF34251EF
 for <pve-devel@lists.proxmox.com>; Mon,  8 Nov 2021 14:08:04 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 02B1325180
 for <pve-devel@lists.proxmox.com>; Mon,  8 Nov 2021 14:08:00 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id CF81B422F3
 for <pve-devel@lists.proxmox.com>; Mon,  8 Nov 2021 14:07:59 +0100 (CET)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Mon,  8 Nov 2021 14:07:58 +0100
Message-Id: <20211108130758.160914-8-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20211108130758.160914-1-d.csapak@proxmox.com>
References: <20211108130758.160914-1-d.csapak@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.235 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH manager v2 6/6] ui: dc/backup: show id+schedule
 instead of dow+starttime
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 08 Nov 2021 13:08:05 -0000

we can now show the id (since its not autogenerated anymore),
and we can always show/edit the schedule instead of the dow+starttime

also add an 'ID' field to the edit/create window and update the
backupinfo window as well

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/dc/Backup.js          | 46 ++++++++++++++----------------
 www/manager6/dc/BackupJobDetail.js | 10 ++-----
 2 files changed, 23 insertions(+), 33 deletions(-)

diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index adefc5f4..dede8e6e 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -176,24 +176,22 @@ Ext.define('PVE.dc.BackupEdit', {
 	});
 
 	let column1 = [
-	    nodesel,
-	    storagesel,
 	    {
-		xtype: 'pveDayOfWeekSelector',
-		name: 'dow',
-		fieldLabel: gettext('Day of week'),
-		multiSelect: true,
-		value: ['sat'],
+		xtype: 'pmxDisplayEditField',
+		name: 'id',
+		fieldLabel: gettext('ID'),
+		renderer: Ext.htmlEncode,
 		allowBlank: false,
+		minLength: 4,
+		editable: me.isCreate,
 	    },
+	    nodesel,
+	    storagesel,
 	    {
-		xtype: 'timefield',
-		fieldLabel: gettext('Start Time'),
-		name: 'starttime',
-		format: 'H:i',
-		formatText: 'HH:MM',
-		value: '00:00',
+		xtype: 'pveCalendarEvent',
+		fieldLabel: gettext('Schedule'),
 		allowBlank: false,
+		name: 'schedule',
 	    },
 	    selModeField,
 	    selPool,
@@ -390,7 +388,7 @@ Ext.define('PVE.dc.BackupEdit', {
 		success: function(response, options) {
 		    let data = response.result.data;
 
-		    data.dow = data.dow.split(',');
+		    data.dow = (data.dow || '').split(',');
 
 		    if (data.all || data.exclude) {
 			if (data.exclude) {
@@ -532,6 +530,8 @@ Ext.define('PVE.dc.BackupView', {
 	    delete job.starttime;
 	    delete job.dow;
 	    delete job.id;
+	    delete job.schedule;
+	    delete job.type;
 	    delete job.node;
 	    job.all = job.all === true ? 1 : 0;
 
@@ -714,6 +714,10 @@ Ext.define('PVE.dc.BackupView', {
 		    disabledCls: 'x-item-enabled',
 		    stopSelection: false,
 		},
+		{
+		    header: gettext('ID'),
+		    dataIndex: 'id',
+		},
 		{
 		    header: gettext('Node'),
 		    width: 100,
@@ -727,17 +731,9 @@ Ext.define('PVE.dc.BackupView', {
 		    },
 		},
 		{
-		    header: gettext('Day of week'),
-		    width: 200,
-		    sortable: false,
-		    dataIndex: 'dow',
-		    renderer: PVE.Utils.render_backup_days_of_week,
-		},
-		{
-		    header: gettext('Start Time'),
-		    width: 60,
-		    sortable: true,
-		    dataIndex: 'starttime',
+		    header: gettext('Schedule'),
+		    width: 150,
+		    dataIndex: 'schedule',
 		},
 		{
 		    header: gettext('Storage'),
diff --git a/www/manager6/dc/BackupJobDetail.js b/www/manager6/dc/BackupJobDetail.js
index b91cb1b7..19b3b1a3 100644
--- a/www/manager6/dc/BackupJobDetail.js
+++ b/www/manager6/dc/BackupJobDetail.js
@@ -184,14 +184,8 @@ Ext.define('PVE.dc.BackupInfo', {
 	},
 	{
 	    xtype: 'displayfield',
-	    name: 'dow',
-	    fieldLabel: gettext('Day of week'),
-	    renderer: PVE.Utils.render_backup_days_of_week,
-	},
-	{
-	    xtype: 'displayfield',
-	    name: 'starttime',
-	    fieldLabel: gettext('Start Time'),
+	    name: 'schedule',
+	    fieldLabel: gettext('Schedule'),
 	},
 	{
 	    xtype: 'displayfield',
-- 
2.30.2