]>
Commit | Line | Data |
---|---|---|
5f3ec152 DM |
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) { | |
28eb60c0 | 16 | let me = this; |
5f3ec152 DM |
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) { | |
28eb60c0 | 27 | let groupField = this.lookupReference('groupField'); |
5f3ec152 DM |
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) { | |
28eb60c0 | 39 | let groupField = this.lookupReference('groupField'); |
5f3ec152 DM |
40 | groupField.setDisabled(value !== 'group'); |
41 | groupField.setVisible(value === 'group'); | |
28eb60c0 TL |
42 | let profileField = this.lookupReference('profileField'); |
43 | let enabled = (value !== 'any') && (value !== 'none'); | |
5f3ec152 DM |
44 | profileField.setDisabled(!enabled); |
45 | profileField.setVisible(enabled); | |
46 | }, | |
47 | ||
48 | changeProfile: function(f, value) { | |
28eb60c0 | 49 | let groupField = this.lookupReference('groupField'); |
5f3ec152 DM |
50 | groupField.setProfile(value); |
51 | }, | |
52 | ||
53 | control: { | |
54 | 'field[name=mode]': { | |
c87d46fb | 55 | change: 'changeMode', |
5f3ec152 DM |
56 | }, |
57 | 'field[name=profile]': { | |
c87d46fb TL |
58 | change: 'changeProfile', |
59 | }, | |
60 | }, | |
5f3ec152 DM |
61 | }, |
62 | ||
63 | items: [ | |
64 | { | |
65 | xtype: 'proxmoxKVComboBox', | |
66 | name: 'mode', | |
6c137003 | 67 | value: 'group', |
5f3ec152 | 68 | comboItems: [ |
c87d46fb TL |
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'], | |
5f3ec152 | 76 | ], |
c87d46fb | 77 | fieldLabel: gettext("Match"), |
5f3ec152 DM |
78 | }, |
79 | { | |
80 | xtype: 'pmgLDAPProfileSelector', | |
81 | name: 'profile', | |
82 | reference: 'profileField', | |
c87d46fb | 83 | fieldLabel: gettext("Profile"), |
5f3ec152 DM |
84 | }, |
85 | { | |
86 | xtype: 'pmgLDAPGroupSelector', | |
87 | name: 'group', | |
88 | reference: 'groupField', | |
c87d46fb TL |
89 | fieldLabel: gettext("Group"), |
90 | }, | |
91 | ], | |
5f3ec152 DM |
92 | }); |
93 | ||
94 | Ext.define('PMG.LDAPGroupEditor', { | |
95 | extend: 'Proxmox.window.Edit', | |
96 | alias: 'widget.pmgLDAPGroupEditor', | |
573a6e8b | 97 | onlineHelp: 'pmgconfig_ldap', |
5f3ec152 DM |
98 | |
99 | width: 500, | |
100 | ||
c87d46fb | 101 | items: [{ xtype: 'pmgLDAPGroupInputPanel' }], |
5f3ec152 | 102 | }); |