diff --git a/src/modules/crud/decision.api.ts b/src/modules/crud/decision.api.ts index 5a5c8ce..d399399 100644 --- a/src/modules/crud/decision.api.ts +++ b/src/modules/crud/decision.api.ts @@ -124,6 +124,10 @@ export class DecisionApi implements Api { return requestPost(`switch/principal`, value); } + getPrincipals(keytab: string) { + return requestGet(`/principals?keytabPath=${keytab}`, {}); + } + private sendEditStatusEvent(name: string, type: string): Promise { return new Promise(resolve => { if (Dec && Dec.socket.connected) { diff --git a/src/modules/pages/maintain/forms/components/form.jdbc.ts b/src/modules/pages/maintain/forms/components/form.jdbc.ts index 3e1685d..9415eb7 100644 --- a/src/modules/pages/maintain/forms/components/form.jdbc.ts +++ b/src/modules/pages/maintain/forms/components/form.jdbc.ts @@ -121,6 +121,7 @@ export class FormJdbc extends BI.Widget { } = connectionData as ConnectionJDBC; this.oldPassword = password; this.oldSshSecret = sshSecret; + !BI.isUndefined(principal) && this.getPrincipals(keyPath, principal); const { initialSize, @@ -1335,6 +1336,20 @@ export class FormJdbc extends BI.Widget { this.form.keyPath.setFileInfo(KerberosParams); } + public getPrincipals(keyPath, principal) { + let self = this; + api.getPrincipals(keyPath).then(res => { + const principalsItems = BI.map(res.data, function(index, item) { + return { + text: item, + value: item + } + }); + self.form.principal.populate(principalsItems); + self.form.principal.setValue(principal); + }) + } + public changePrincipal() { let self = this; const KerberosParams = BI.extend({},{