]>
Commit | Line | Data |
---|---|---|
5f3ec152 DM |
1 | Ext.define('PMG.LDAPGroupSelector', { |
2 | extend: 'Ext.form.ComboBox', | |
3 | alias: 'widget.pmgLDAPGroupSelector', | |
4 | ||
5 | profile: undefined, | |
6 | ||
7 | queryMode: 'local', | |
8 | ||
9 | store: { | |
10 | fields: [ 'dn' ], | |
11 | filterOnLoad: true, | |
12 | sorters: [ | |
13 | { | |
14 | property : 'dn', | |
15 | direction: 'ASC' | |
16 | } | |
17 | ] | |
18 | }, | |
19 | ||
20 | valueField: 'dn', | |
21 | displayField: 'dn', | |
22 | ||
23 | allowBlank: false, | |
24 | ||
25 | setProfile: function(profile, force) { | |
26 | var me = this; | |
27 | ||
6c137003 | 28 | if (!force && (profile === undefined || profile === null || me.profile === profile)) { |
5f3ec152 DM |
29 | return; |
30 | } | |
31 | ||
32 | me.profile = profile; | |
33 | ||
34 | me.setValue(''); | |
35 | ||
36 | me.store.setProxy({ | |
37 | type: 'proxmox', | |
38 | url: '/api2/json/config/ldap/' + me.profile + '/groups' | |
39 | }); | |
40 | ||
41 | me.store.load(); | |
42 | }, | |
43 | ||
44 | initComponent: function() { | |
45 | var me = this; | |
46 | ||
47 | me.callParent(); | |
48 | ||
49 | if (me.profile !== undefined) { | |
7a3b5e2d | 50 | me.setProfile(me.profile, true); |
5f3ec152 DM |
51 | } |
52 | } | |
53 | }); | |
54 |