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 <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-07-08 12:21:56 +02:00
parent 48e22a8900
commit 69e5d71961
1 changed files with 9 additions and 10 deletions

View File

@ -402,12 +402,13 @@ Ext.define('PBS.DataStoreContent', {
iconCls: 'fa fa-refresh', iconCls: 'fa fa-refresh',
handler: 'reload', handler: 'reload',
}, },
'-',
{ {
xtype: 'proxmoxButton', xtype: 'proxmoxButton',
text: gettext('Verify'), text: gettext('Verify'),
disabled: true, disabled: true,
parentXType: 'pbsDataStoreContent', parentXType: 'pbsDataStoreContent',
enableFn: function(record) { return !!record.data; }, enableFn: (rec) => !!rec.data && rec.data.size !== null,
handler: 'onVerify', handler: 'onVerify',
}, },
{ {
@ -415,7 +416,7 @@ Ext.define('PBS.DataStoreContent', {
text: gettext('Prune'), text: gettext('Prune'),
disabled: true, disabled: true,
parentXType: 'pbsDataStoreContent', parentXType: 'pbsDataStoreContent',
enableFn: function(record) { return !record.data.leaf; }, enableFn: (rec) => !rec.data.leaf,
handler: 'onPrune', handler: 'onPrune',
}, },
{ {
@ -424,24 +425,22 @@ Ext.define('PBS.DataStoreContent', {
disabled: true, disabled: true,
parentXType: 'pbsDataStoreContent', parentXType: 'pbsDataStoreContent',
handler: 'onForget', handler: 'onForget',
dangerous: true,
confirmMsg: function(record) { confirmMsg: function(record) {
console.log(record); //console.log(record);
let name = record.data.text; let name = record.data.text;
return Ext.String.format(gettext('Are you sure you want to remove snapshot {0}'), `'${name}'`); return Ext.String.format(gettext('Are you sure you want to remove snapshot {0}'), `'${name}'`);
}, },
enableFn: function(record) { enableFn: (rec) => !!rec.data.leaf && rec.data.size !== null,
return !!record.data.leaf;
},
}, },
'-',
{ {
xtype: 'proxmoxButton', xtype: 'proxmoxButton',
text: gettext('Download Files'), text: gettext('Download Files'),
disabled: true, disabled: true,
parentXType: 'pbsDataStoreContent', parentXType: 'pbsDataStoreContent',
handler: 'openBackupFileDownloader', handler: 'openBackupFileDownloader',
enableFn: function(record) { enableFn: (rec) => !!rec.data.leaf && rec.data.size !== null,
return !!record.data.leaf;
},
}, },
{ {
xtype: "proxmoxButton", xtype: "proxmoxButton",
@ -450,7 +449,7 @@ Ext.define('PBS.DataStoreContent', {
handler: 'openPxarBrowser', handler: 'openPxarBrowser',
parentXType: 'pbsDataStoreContent', parentXType: 'pbsDataStoreContent',
enableFn: function(record) { 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'));
}, },
} }
], ],