]>
Commit | Line | Data |
---|---|---|
6c137003 DM |
1 | Ext.define('PMG.LDAPUserSelector', { |
2 | extend: 'Proxmox.form.ComboGrid', | |
3 | alias: 'widget.pmgLDAPUserSelector', | |
4 | ||
5 | profile: undefined, | |
6 | ||
7 | store: { | |
8 | fields: [ 'account', 'pmail', 'dn' ], | |
9 | filterOnLoad: true, | |
10 | sorters: [ | |
11 | { | |
12 | property : 'account', | |
13 | direction: 'ASC' | |
14 | } | |
15 | ] | |
16 | }, | |
17 | ||
18 | valueField: 'account', | |
19 | displayField: 'account', | |
20 | ||
21 | allowBlank: false, | |
22 | ||
23 | listConfig: { | |
24 | columns: [ | |
25 | { | |
26 | header: gettext('Account'), | |
27 | dataIndex: 'account', | |
28 | hideable: false, | |
29 | width: 100 | |
30 | }, | |
31 | { | |
32 | header: gettext('EMail'), | |
33 | dataIndex: 'pmail', | |
34 | width: 150 | |
35 | }, | |
36 | { | |
37 | header: 'DN', | |
38 | dataIndex: 'dn', | |
39 | width: 200 | |
40 | } | |
41 | ] | |
42 | }, | |
43 | ||
44 | setProfile: function(profile, force) { | |
45 | var me = this; | |
46 | ||
47 | if (!force && (profile === undefined || profile === null || me.profile === profile)) { | |
48 | return; | |
49 | } | |
50 | ||
51 | me.profile = profile; | |
52 | ||
53 | me.setValue(''); | |
54 | ||
55 | me.store.setProxy({ | |
56 | type: 'proxmox', | |
57 | url: '/api2/json/config/ldap/' + me.profile + '/users' | |
58 | }); | |
59 | ||
60 | me.store.load(); | |
61 | }, | |
62 | ||
63 | initComponent: function() { | |
64 | var me = this; | |
65 | ||
66 | me.callParent(); | |
67 | ||
68 | if (me.profile !== undefined) { | |
7a3b5e2d | 69 | me.setProfile(me.profile, true); |
6c137003 DM |
70 | } |
71 | } | |
72 | }); | |
73 |