diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 6fd14ff5..26f41763 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -130,8 +130,8 @@ fn list_groups( let group = info.backup_dir.group(); let list_all = (user_privs & PRIV_DATASTORE_AUDIT) != 0; + let owner = datastore.get_owner(group)?; if !list_all { - let owner = datastore.get_owner(group)?; if owner != username { continue; } } @@ -141,6 +141,7 @@ fn list_groups( last_backup: info.backup_dir.backup_time().timestamp(), backup_count: list.len() as u64, files: info.files.clone(), + owner: Some(owner), }; groups.push(result_item); } @@ -329,8 +330,9 @@ pub fn list_snapshots ( } let list_all = (user_privs & PRIV_DATASTORE_AUDIT) != 0; + let owner = datastore.get_owner(group)?; + if !list_all { - let owner = datastore.get_owner(group)?; if owner != username { continue; } } @@ -340,6 +342,7 @@ pub fn list_snapshots ( backup_time: info.backup_dir.backup_time().timestamp(), files: info.files, size: None, + owner: Some(owner), }; if let Ok(index) = read_backup_index(&datastore, &info.backup_dir) { diff --git a/src/api2/types.rs b/src/api2/types.rs index f1870787..81b39ad5 100644 --- a/src/api2/types.rs +++ b/src/api2/types.rs @@ -388,6 +388,9 @@ pub struct GroupListItem { pub backup_count: u64, /// List of contained archive files. pub files: Vec, + /// The owner of group + #[serde(skip_serializing_if="Option::is_none")] + pub owner: Option, } #[api( @@ -420,6 +423,9 @@ pub struct SnapshotListItem { /// Overall snapshot size (sum of all archive sizes). #[serde(skip_serializing_if="Option::is_none")] pub size: Option, + /// The owner of the snapshots group + #[serde(skip_serializing_if="Option::is_none")] + pub owner: Option, } #[api( diff --git a/www/DataStoreContent.js b/www/DataStoreContent.js index 161f2af2..8099c99c 100644 --- a/www/DataStoreContent.js +++ b/www/DataStoreContent.js @@ -9,6 +9,7 @@ Ext.define('pbs-data-store-snapshots', { dateFormat: 'timestamp' }, 'files', + 'owner', { name: 'size', type: 'int' }, ] }); @@ -125,6 +126,7 @@ Ext.define('PBS.DataStoreContent', { group["backup-time"] = last_backup; group.files = item.files; group.size = item.size; + group.owner = item.owner; } } group.count = group.children.length; @@ -157,67 +159,59 @@ Ext.define('PBS.DataStoreContent', { } }, - initComponent: function() { - var me = this; + columns: [ + { + xtype: 'treecolumn', + header: gettext("Backup Group"), + dataIndex: 'text', + flex: 1 + }, + { + xtype: 'datecolumn', + header: gettext('Backup Time'), + sortable: true, + dataIndex: 'backup-time', + format: 'Y-m-d H:i:s', + width: 150 + }, + { + header: gettext("Size"), + sortable: true, + dataIndex: 'size', + renderer: Proxmox.Utils.format_size, + }, + { + xtype: 'numbercolumn', + format: '0', + header: gettext("Count"), + sortable: true, + dataIndex: 'count', + }, + { + header: gettext("Owner"), + sortable: true, + dataIndex: 'owner', + }, + { + header: gettext("Files"), + sortable: false, + dataIndex: 'files', + flex: 2 + }, + ], - var sm = Ext.create('Ext.selection.RowModel', {}); - - var prune_btn = new Proxmox.button.Button({ + tbar: [ + { + text: gettext('Reload'), + iconCls: 'fa fa-refresh', + handler: 'reload', + }, + { + xtype: 'proxmoxButton', text: gettext('Prune'), disabled: true, - selModel: sm, enableFn: function(record) { return !record.data.leaf; }, handler: 'onPrune', - }); - - Ext.apply(me, { - selModel: sm, - columns: [ - { - xtype: 'treecolumn', - header: gettext("Backup Group"), - dataIndex: 'text', - flex: 1 - }, - { - xtype: 'datecolumn', - header: gettext('Backup Time'), - sortable: true, - dataIndex: 'backup-time', - format: 'Y-m-d H:i:s', - width: 150 - }, - { - header: gettext("Size"), - sortable: true, - dataIndex: 'size', - renderer: Proxmox.Utils.format_size, - }, - { - xtype: 'numbercolumn', - format: '0', - header: gettext("Count"), - sortable: true, - dataIndex: 'count', - }, - { - header: gettext("Files"), - sortable: false, - dataIndex: 'files', - flex: 2 - } - ], - - tbar: [ - { - text: gettext('Reload'), - iconCls: 'fa fa-refresh', - handler: 'reload', - }, - prune_btn - ], - }); - - me.callParent(); - }, + } + ], });