]>
Commit | Line | Data |
---|---|---|
6c137003 DM |
1 | Ext.define('PMG.LDAPUserSelector', { |
2 | extend: 'Proxmox.form.ComboGrid', | |
3 | alias: 'widget.pmgLDAPUserSelector', | |
4 | ||
5 | profile: undefined, | |
c87d46fb | 6 | |
6c137003 | 7 | store: { |
c87d46fb | 8 | fields: ['account', 'pmail', 'dn'], |
6c137003 DM |
9 | filterOnLoad: true, |
10 | sorters: [ | |
11 | { | |
c87d46fb TL |
12 | property: 'account', |
13 | direction: 'ASC', | |
14 | }, | |
15 | ], | |
6c137003 DM |
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, | |
c87d46fb | 29 | width: 100, |
6c137003 DM |
30 | }, |
31 | { | |
64fb657f | 32 | header: gettext('E-Mail'), |
6c137003 | 33 | dataIndex: 'pmail', |
c87d46fb | 34 | width: 150, |
6c137003 DM |
35 | }, |
36 | { | |
37 | header: 'DN', | |
38 | dataIndex: 'dn', | |
c87d46fb TL |
39 | width: 200, |
40 | }, | |
41 | ], | |
6c137003 | 42 | }, |
c87d46fb | 43 | |
6c137003 DM |
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', | |
c87d46fb | 57 | url: '/api2/json/config/ldap/' + me.profile + '/users', |
6c137003 DM |
58 | }); |
59 | ||
60 | me.store.load(); | |
61 | }, | |
c87d46fb | 62 | |
6c137003 DM |
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 | 70 | } |
c87d46fb | 71 | }, |
6c137003 DM |
72 | }); |
73 |