From 69e5d71961a3d0ab9ed0578472e3c0c4317667c8 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 8 Jul 2020 12:21:56 +0200 Subject: [PATCH] ui: ds/content: disable some button for in-progress backup We cannot verify, download, file-browse backups which are currently in progress. 'Forget' could work but is probably not desirable? Signed-off-by: Thomas Lamprecht --- www/DataStoreContent.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/www/DataStoreContent.js b/www/DataStoreContent.js index b6cce462..70406b5c 100644 --- a/www/DataStoreContent.js +++ b/www/DataStoreContent.js @@ -402,12 +402,13 @@ Ext.define('PBS.DataStoreContent', { iconCls: 'fa fa-refresh', handler: 'reload', }, + '-', { xtype: 'proxmoxButton', text: gettext('Verify'), disabled: true, parentXType: 'pbsDataStoreContent', - enableFn: function(record) { return !!record.data; }, + enableFn: (rec) => !!rec.data && rec.data.size !== null, handler: 'onVerify', }, { @@ -415,7 +416,7 @@ Ext.define('PBS.DataStoreContent', { text: gettext('Prune'), disabled: true, parentXType: 'pbsDataStoreContent', - enableFn: function(record) { return !record.data.leaf; }, + enableFn: (rec) => !rec.data.leaf, handler: 'onPrune', }, { @@ -424,24 +425,22 @@ Ext.define('PBS.DataStoreContent', { disabled: true, parentXType: 'pbsDataStoreContent', handler: 'onForget', + dangerous: true, confirmMsg: function(record) { - console.log(record); + //console.log(record); let name = record.data.text; return Ext.String.format(gettext('Are you sure you want to remove snapshot {0}'), `'${name}'`); }, - enableFn: function(record) { - return !!record.data.leaf; - }, + enableFn: (rec) => !!rec.data.leaf && rec.data.size !== null, }, + '-', { xtype: 'proxmoxButton', text: gettext('Download Files'), disabled: true, parentXType: 'pbsDataStoreContent', handler: 'openBackupFileDownloader', - enableFn: function(record) { - return !!record.data.leaf; - }, + enableFn: (rec) => !!rec.data.leaf && rec.data.size !== null, }, { xtype: "proxmoxButton", @@ -450,7 +449,7 @@ Ext.define('PBS.DataStoreContent', { handler: 'openPxarBrowser', parentXType: 'pbsDataStoreContent', enableFn: function(record) { - return !!record.data.leaf && record.data.files.some(el => el.filename.endsWith('pxar.didx')); + return !!record.data.leaf && record.size !== null && record.data.files.some(el => el.filename.endsWith('pxar.didx')); }, } ],