mirror of
https://github.com/documize/community.git
synced 2025-07-20 13:49:42 +02:00
Display Keycloak settings outcome on save
Errors detected and displayed.
This commit is contained in:
parent
628a633a0a
commit
ce9d314837
2 changed files with 10 additions and 3 deletions
|
@ -32,6 +32,7 @@ export default Component.extend(Notifier, {
|
||||||
KeycloakPublicKeyError: empty('keycloakConfig.publicKey'),
|
KeycloakPublicKeyError: empty('keycloakConfig.publicKey'),
|
||||||
KeycloakAdminUserError: empty('keycloakConfig.adminUser'),
|
KeycloakAdminUserError: empty('keycloakConfig.adminUser'),
|
||||||
KeycloakAdminPasswordError: empty('keycloakConfig.adminPassword'),
|
KeycloakAdminPasswordError: empty('keycloakConfig.adminPassword'),
|
||||||
|
keycloakFailure: '',
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
@ -91,6 +92,8 @@ export default Component.extend(Notifier, {
|
||||||
let provider = this.get('authProvider');
|
let provider = this.get('authProvider');
|
||||||
let config = this.get('authConfig');
|
let config = this.get('authConfig');
|
||||||
|
|
||||||
|
this.set('keycloakFailure', '');
|
||||||
|
|
||||||
switch (provider) {
|
switch (provider) {
|
||||||
case constants.AuthProvider.Documize:
|
case constants.AuthProvider.Documize:
|
||||||
config = {};
|
config = {};
|
||||||
|
@ -148,10 +151,10 @@ export default Component.extend(Notifier, {
|
||||||
if (data.authProvider === constants.AuthProvider.Keycloak) {
|
if (data.authProvider === constants.AuthProvider.Keycloak) {
|
||||||
this.get('onSync')().then((response) => {
|
this.get('onSync')().then((response) => {
|
||||||
if (response.isError) {
|
if (response.isError) {
|
||||||
|
this.set('keycloakFailure', response.message);
|
||||||
console.log(response.message); // eslint-disable-line no-console
|
console.log(response.message); // eslint-disable-line no-console
|
||||||
data.authProvider = constants.AuthProvider.Documize;
|
data.authProvider = constants.AuthProvider.Documize;
|
||||||
this.get('onSave')(data).then(() => {
|
this.get('onSave')(data).then(() => {});
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
if (data.authProvider === this.get('appMeta.authProvider')) {
|
if (data.authProvider === this.get('appMeta.authProvider')) {
|
||||||
console.log(response.message); // eslint-disable-line no-console
|
console.log(response.message); // eslint-disable-line no-console
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="keycloak-realm" class="col-sm-2 col-form-label">Keycloak Realm</label>
|
<label for="keycloak-realm" class="col-sm-2 col-form-label">Keycloak Realm</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
{{input id="keycloak-realm" type="text" value=keycloakConfig.realm class=(if keycloakRealmError 'form-control is-invalid' 'form-control')}}
|
{{input id="keycloak-realm" type="text" value=keycloakConfig.realm class=(if KeycloakRealmError 'form-control is-invalid' 'form-control')}}
|
||||||
<small class="form-text text-muted">e.g. main</small>
|
<small class="form-text text-muted">e.g. main</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -96,4 +96,8 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="btn btn-success mt-4" {{action 'onSave'}}>Save</div>
|
<div class="btn btn-success mt-4" {{action 'onSave'}}>Save</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
{{#if (gt keycloakFailure.length 0)}}
|
||||||
|
<p class="admin-setting-failure my-3">Keycloak connection failed: {{keycloakFailure}}</p>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
Loading…
Add table
Add a link
Reference in a new issue