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 A7AA360D30
 for <pve-devel@lists.proxmox.com>; Wed,  2 Dec 2020 13:56:32 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 9DC191BA76
 for <pve-devel@lists.proxmox.com>; Wed,  2 Dec 2020 13:56:32 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (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 1497A1BA6E
 for <pve-devel@lists.proxmox.com>; Wed,  2 Dec 2020 13:56:32 +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 D252B44817
 for <pve-devel@lists.proxmox.com>; Wed,  2 Dec 2020 13:56:31 +0100 (CET)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Wed,  2 Dec 2020 13:56:31 +0100
Message-Id: <20201202125631.19336-1-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.302 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 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] fix #3182 #3183: change backup
 retention mask logic
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: Wed, 02 Dec 2020 12:56:32 -0000

instead of relying on the contentTypeField (which does not need to
exists, e.g. for iscsi), explicitely write it into the panel/icon
mapping and check that

better would be if we query the backend about storage capabilities,
but such an api call does not exist yet, so this should be ok for now

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/Utils.js          | 41 +++++++++++++++++++++++-----------
 www/manager6/dc/StorageView.js |  1 +
 www/manager6/storage/Base.js   |  3 +--
 3 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 6e6498a2..2bc505f2 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -713,78 +713,93 @@ Ext.define('PVE.Utils', { utilities: {
 	dir: {
 	    name: Proxmox.Utils.directoryText,
 	    ipanel: 'DirInputPanel',
-	    faIcon: 'folder'
+	    faIcon: 'folder',
+	    backups: true,
 	},
 	lvm: {
 	    name: 'LVM',
 	    ipanel: 'LVMInputPanel',
-	    faIcon: 'folder'
+	    faIcon: 'folder',
+	    backups: false,
 	},
 	lvmthin: {
 	    name: 'LVM-Thin',
 	    ipanel: 'LvmThinInputPanel',
-	    faIcon: 'folder'
+	    faIcon: 'folder',
+	    backups: false,
 	},
 	nfs: {
 	    name: 'NFS',
 	    ipanel: 'NFSInputPanel',
-	    faIcon: 'building'
+	    faIcon: 'building',
+	    backups: true,
 	},
 	cifs: {
 	    name: 'CIFS',
 	    ipanel: 'CIFSInputPanel',
-	    faIcon: 'building'
+	    faIcon: 'building',
+	    backups: true,
 	},
 	glusterfs: {
 	    name: 'GlusterFS',
 	    ipanel: 'GlusterFsInputPanel',
-	    faIcon: 'building'
+	    faIcon: 'building',
+	    backups: true,
 	},
 	iscsi: {
 	    name: 'iSCSI',
 	    ipanel: 'IScsiInputPanel',
-	    faIcon: 'building'
+	    faIcon: 'building',
+	    backups: false,
 	},
 	cephfs: {
 	    name: 'CephFS',
 	    ipanel: 'CephFSInputPanel',
-	    faIcon: 'building'
+	    faIcon: 'building',
+	    backups: true,
 	},
 	pvecephfs: {
 	    name: 'CephFS (PVE)',
 	    ipanel: 'CephFSInputPanel',
 	    hideAdd: true,
-	    faIcon: 'building'
+	    faIcon: 'building',
+	    backups: true,
 	},
 	rbd: {
 	    name: 'RBD',
 	    ipanel: 'RBDInputPanel',
-	    faIcon: 'building'
+	    faIcon: 'building',
+	    backups: false,
 	},
 	pveceph: {
 	    name: 'RBD (PVE)',
 	    ipanel: 'RBDInputPanel',
 	    hideAdd: true,
-	    faIcon: 'building'
+	    faIcon: 'building',
+	    backups: false,
 	},
 	zfs: {
 	    name: 'ZFS over iSCSI',
 	    ipanel: 'ZFSInputPanel',
-	    faIcon: 'building'
+	    faIcon: 'building',
+	    backups: false,
 	},
 	zfspool: {
 	    name: 'ZFS',
 	    ipanel: 'ZFSPoolInputPanel',
-	    faIcon: 'folder'
+	    faIcon: 'folder',
+	    backups: false,
 	},
 	pbs: {
 	    name: 'Proxmox Backup Server',
 	    ipanel: 'PBSInputPanel',
 	    faIcon: 'floppy-o',
+	    backups: true,
 	},
 	drbd: {
 	    name: 'DRBD',
 	    hideAdd: true,
+	    backups: false,
 	},
     },
 
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index 83f86c47..74deb442 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -18,6 +18,7 @@ Ext.define('PVE.dc.StorageView', {
 	    paneltype: 'PVE.storage.' + schema.ipanel,
 	    type: type,
 	    storageId: sid,
+	    canDoBackups: schema.backups,
 	    autoShow: true,
 	    listeners: {
 		destroy: this.reloadStore
diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.js
index 13ba5b7b..45fa2bb3 100644
--- a/www/manager6/storage/Base.js
+++ b/www/manager6/storage/Base.js
@@ -211,8 +211,7 @@ Ext.define('PVE.storage.BaseEdit', {
 
 	me.callParent();
 
-	let contentTypeField = me.ipanel.down('pveContentTypeSelector');
-	if (contentTypeField && !contentTypeField.cts.includes('backup')) {
+	if (!me.canDoBackups) {
 	    // cannot mask now, not fully rendered until activated
 	    me.down('pmxPruneInputPanel').needMask = true;
 	}
-- 
2.20.1