proxmox-backup/www/form/GroupSelector.js
Thomas Lamprecht f07e660153 ui: move max NS prefix length logic to reduced max-depth selector
for better re-usability in the future and it felt a bit odd to have
such specific logic in the sync job edit directly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-13 13:15:02 +02:00

56 lines
1.0 KiB
JavaScript

Ext.define('pbs-groups', {
extend: 'Ext.data.Model',
fields: [
'backup-type',
'backup-id',
{
name: 'group',
type: 'string',
convert: function(value, record) {
if (record.data['backup-type'] && record.data['backup-id']) {
return `${record.data['backup-type']}/${record.data['backup-id']}`;
}
return value;
},
},
],
proxy: {
type: 'proxmox',
},
});
Ext.define('PBS.form.GroupSelector', {
extend: 'Proxmox.form.ComboGrid',
alias: 'widget.pbsGroupSelector',
mixins: ['Proxmox.Mixin.CBind'],
allowBlank: false,
autoSelect: false,
notFoundIsValid: true,
editable: true,
valueField: 'group',
displayField: 'group',
store: {
sorters: 'group',
model: 'pbs-groups',
},
listConfig: {
minHeight: 80,
emptyText: gettext('No Groups'),
viewConfig: {
deferEmptyText: false,
},
columns: [
{
header: gettext('Group'),
sortable: true,
dataIndex: 'group',
renderer: Ext.String.htmlEncode,
flex: 1,
},
],
},
});