ui: add GroupSelector
to select either a group from a datastore for now it is expected to set the data in the store manually Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
		
				
					committed by
					
						
						Dietmar Maurer
					
				
			
			
				
	
			
			
			
						parent
						
							73fba2edea
						
					
				
				
					commit
					7d4d8f47c9
				
			@ -42,6 +42,7 @@ JSSRC=							\
 | 
			
		||||
	form/DataStoreSelector.js			\
 | 
			
		||||
	form/CalendarEvent.js				\
 | 
			
		||||
	form/PermissionPathSelector.js			\
 | 
			
		||||
	form/GroupSelector.js				\
 | 
			
		||||
	data/RunningTasksStore.js			\
 | 
			
		||||
	button/TaskButton.js				\
 | 
			
		||||
	config/UserView.js				\
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										54
									
								
								www/form/GroupSelector.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								www/form/GroupSelector.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,54 @@
 | 
			
		||||
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',
 | 
			
		||||
 | 
			
		||||
    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,
 | 
			
		||||
	    },
 | 
			
		||||
	],
 | 
			
		||||
    },
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user