ui: add resource mapping view for directories

To save vertical space in the Resource Mappings tab, there is a
temporary Directory Mappings tab until we find content fitting the
general 'resource mapping' panel and can put all types as submenu items.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
Link: https://lore.proxmox.com/20250407134950.265270-9-m.frank@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Markus Frank 2025-04-07 15:49:48 +02:00 committed by Thomas Lamprecht
parent 04078c7b9b
commit 3ac01b4ede
3 changed files with 45 additions and 0 deletions

View File

@ -189,6 +189,7 @@ JSSRC= \
dc/RealmSyncJob.js \ dc/RealmSyncJob.js \
dc/PCIMapView.js \ dc/PCIMapView.js \
dc/USBMapView.js \ dc/USBMapView.js \
dc/DirMapView.js \
lxc/CmdMenu.js \ lxc/CmdMenu.js \
lxc/Config.js \ lxc/Config.js \
lxc/CreateWizard.js \ lxc/CreateWizard.js \

View File

@ -331,6 +331,12 @@ Ext.define('PVE.dc.Config', {
}, },
], ],
}, },
{
xtype: 'pveDcDirMapView',
itemId: 'directories',
title: gettext('Directory Mappings'),
iconCls: 'fa fa-folder',
},
); );
} }

View File

@ -0,0 +1,38 @@
Ext.define('pve-resource-dir-tree', {
extend: 'Ext.data.Model',
idProperty: 'internalId',
fields: ['type', 'text', 'path', 'id', 'description', 'digest'],
});
Ext.define('PVE.dc.DirMapView', {
extend: 'PVE.tree.ResourceMapTree',
alias: 'widget.pveDcDirMapView',
editWindowClass: 'PVE.window.DirMapEditWindow',
baseUrl: '/cluster/mapping/dir',
mapIconCls: 'fa fa-folder',
entryIdProperty: 'path',
store: {
sorters: 'text',
model: 'pve-resource-dir-tree',
data: {},
},
columns: [
{
xtype: 'treecolumn',
text: gettext('ID/Node'),
dataIndex: 'text',
width: 200,
},
{
header: gettext('Comment'),
dataIndex: 'description',
renderer: function(value, _meta, record) {
return Ext.String.htmlEncode(value ?? record.data.comment);
},
flex: 1,
},
],
});