save settings draft (#5872)

pull/5884/head
Marcelo Rydel 2021-10-12 14:51:43 -03:00 committed by GitHub
parent 54d47ebc76
commit 109b27594a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 7 deletions

View File

@ -4,7 +4,7 @@ const SERVER_TYPES = {
AD: 2,
};
import { buildOpenLDAPSettingsModel } from '@/portainer/settings/authentication/ldap/ldap-settings.model';
import { buildLdapSettingsModel, buildOpenLDAPSettingsModel } from '@/portainer/settings/authentication/ldap/ldap-settings.model';
import { EXTERNAL_AUTH_LDAP } from '@/portainer/feature-flags/feature-ids';
const DEFAULT_GROUP_FILTER = '(objectClass=groupOfNames)';
@ -16,6 +16,7 @@ export default class LdapSettingsController {
Object.assign(this, { LDAPService, SERVER_TYPES });
this.tlscaCert = null;
this.settingsDrafts = {};
this.boxSelectorOptions = [
{ id: 'ldap_custom', value: SERVER_TYPES.CUSTOM, label: 'Custom', icon: 'fa fa-server' },
@ -37,18 +38,23 @@ export default class LdapSettingsController {
}
onChangeServerType(serverType) {
this.settingsDrafts[this.settings.ServerType] = this.settings;
if (this.settingsDrafts[serverType]) {
this.settings = this.settingsDrafts[serverType];
return;
}
switch (serverType) {
case SERVER_TYPES.OPEN_LDAP:
return this.onChangeToOpenLDAP();
default:
this.settings = buildOpenLDAPSettingsModel();
break;
case SERVER_TYPES.CUSTOM:
this.settings = buildLdapSettingsModel();
break;
}
}
onChangeToOpenLDAP() {
this.settings = buildOpenLDAPSettingsModel();
}
searchUsers() {
const settings = {
...this.settings,