]>
Commit | Line | Data |
---|---|---|
1 | Ext.define('PMG.LDAPGroupInputPanel', { | |
2 | extend: 'Proxmox.panel.InputPanel', | |
3 | alias: 'widget.pmgLDAPGroupInputPanel', | |
4 | ||
5 | onGetValues: function(values) { | |
6 | if (values.mode === 'profile-any') { | |
7 | values.mode = 'any'; | |
8 | } else if (values.mode === 'profile-none') { | |
9 | values.mode = 'none'; | |
10 | } | |
11 | ||
12 | return values; | |
13 | }, | |
14 | ||
15 | setValues: function(values) { | |
16 | let me = this; | |
17 | ||
18 | if (values.profile !== undefined) { | |
19 | if (values.mode === 'any') { | |
20 | values.mode = 'profile-any'; | |
21 | } else if (values.mode === 'none') { | |
22 | values.mode = 'profile-none'; | |
23 | } | |
24 | } | |
25 | ||
26 | if (values.profile !== undefined) { | |
27 | let groupField = this.lookupReference('groupField'); | |
28 | groupField.setProfile(values.profile); | |
29 | } | |
30 | ||
31 | me.callParent([values]); | |
32 | }, | |
33 | ||
34 | controller: { | |
35 | ||
36 | xclass: 'Ext.app.ViewController', | |
37 | ||
38 | changeMode: function(f, value) { | |
39 | let groupField = this.lookupReference('groupField'); | |
40 | groupField.setDisabled(value !== 'group'); | |
41 | groupField.setVisible(value === 'group'); | |
42 | let profileField = this.lookupReference('profileField'); | |
43 | let enabled = (value !== 'any') && (value !== 'none'); | |
44 | profileField.setDisabled(!enabled); | |
45 | profileField.setVisible(enabled); | |
46 | }, | |
47 | ||
48 | changeProfile: function(f, value) { | |
49 | let groupField = this.lookupReference('groupField'); | |
50 | groupField.setProfile(value); | |
51 | }, | |
52 | ||
53 | control: { | |
54 | 'field[name=mode]': { | |
55 | change: 'changeMode', | |
56 | }, | |
57 | 'field[name=profile]': { | |
58 | change: 'changeProfile', | |
59 | }, | |
60 | }, | |
61 | }, | |
62 | ||
63 | items: [ | |
64 | { | |
65 | xtype: 'proxmoxKVComboBox', | |
66 | name: 'mode', | |
67 | value: 'group', | |
68 | comboItems: [ | |
69 | ['group', gettext('Group member')], | |
70 | ['profile-any', gettext('Existing LDAP address')], | |
71 | ['any', gettext('Existing LDAP address') + | |
72 | ', any profile'], | |
73 | ['profile-none', gettext('Unknown LDAP address')], | |
74 | ['none', gettext('Unknown LDAP address') + | |
75 | ', any profile'], | |
76 | ], | |
77 | fieldLabel: gettext("Match"), | |
78 | }, | |
79 | { | |
80 | xtype: 'pmgLDAPProfileSelector', | |
81 | name: 'profile', | |
82 | reference: 'profileField', | |
83 | fieldLabel: gettext("Profile"), | |
84 | }, | |
85 | { | |
86 | xtype: 'pmgLDAPGroupSelector', | |
87 | name: 'group', | |
88 | reference: 'groupField', | |
89 | fieldLabel: gettext("Group"), | |
90 | }, | |
91 | ], | |
92 | }); | |
93 | ||
94 | Ext.define('PMG.LDAPGroupEditor', { | |
95 | extend: 'Proxmox.window.Edit', | |
96 | alias: 'widget.pmgLDAPGroupEditor', | |
97 | onlineHelp: 'pmgconfig_ldap', | |
98 | ||
99 | width: 500, | |
100 | ||
101 | items: [{ xtype: 'pmgLDAPGroupInputPanel' }], | |
102 | }); |