pmg-gui/js/LDAPGroupEditor.js
Stoiko Ivanov 573a6e8b71 add onlineHelp properties to all edit windows
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-10-03 14:32:24 +02:00

103 lines
2.3 KiB
JavaScript

Ext.define('PMG.LDAPGroupInputPanel', {
extend: 'Proxmox.panel.InputPanel',
alias: 'widget.pmgLDAPGroupInputPanel',
onGetValues: function(values) {
if (values.mode === 'profile-any') {
values.mode = 'any';
} else if (values.mode === 'profile-none') {
values.mode = 'none';
}
return values;
},
setValues: function(values) {
var me = this;
if (values.profile !== undefined) {
if (values.mode === 'any') {
values.mode = 'profile-any';
} else if (values.mode === 'none') {
values.mode = 'profile-none';
}
}
if (values.profile !== undefined) {
var groupField = this.lookupReference('groupField');
groupField.setProfile(values.profile);
}
me.callParent([values]);
},
controller: {
xclass: 'Ext.app.ViewController',
changeMode: function(f, value) {
var groupField = this.lookupReference('groupField');
groupField.setDisabled(value !== 'group');
groupField.setVisible(value === 'group');
var profileField = this.lookupReference('profileField');
var enabled = ((value != 'any') && (value != 'none'));
profileField.setDisabled(!enabled);
profileField.setVisible(enabled);
},
changeProfile: function(f, value) {
var groupField = this.lookupReference('groupField');
groupField.setProfile(value);
},
control: {
'field[name=mode]': {
change: 'changeMode'
},
'field[name=profile]': {
change: 'changeProfile'
}
}
},
items: [
{
xtype: 'proxmoxKVComboBox',
name: 'mode',
value: 'group',
comboItems: [
[ 'group', gettext('Group member') ],
[ 'profile-any', gettext('Existing LDAP address')],
[ 'any', gettext('Existing LDAP address') +
', any profile' ],
[ 'profile-none', gettext('Unknown LDAP address')],
[ 'none', gettext('Unknown LDAP address') +
', any profile' ]
],
fieldLabel: gettext("Match")
},
{
xtype: 'pmgLDAPProfileSelector',
name: 'profile',
reference: 'profileField',
fieldLabel: gettext("Profile")
},
{
xtype: 'pmgLDAPGroupSelector',
name: 'group',
reference: 'groupField',
fieldLabel: gettext("Group")
}
]
});
Ext.define('PMG.LDAPGroupEditor', {
extend: 'Proxmox.window.Edit',
alias: 'widget.pmgLDAPGroupEditor',
onlineHelp: 'pmgconfig_ldap',
width: 500,
items: [{ xtype: 'pmgLDAPGroupInputPanel' }]
});