9
9
//
10
10
// https://documize.com
11
11
12
- import Ember from 'ember' ;
12
+ import { equal , empty } from '@ember/object/computed' ;
13
+ import { set } from '@ember/object' ;
14
+ import { copy } from '@ember/object/internals' ;
15
+ import { inject as service } from '@ember/service' ;
16
+ import Component from '@ember/component' ;
13
17
import constants from '../../utils/constants' ;
14
18
import encoding from '../../utils/encoding' ;
15
- import NotifierMixin from "../../mixins/notifier" ;
16
-
17
- const {
18
- computed
19
- } = Ember ;
20
-
21
- export default Ember . Component . extend ( NotifierMixin , {
22
- appMeta : Ember . inject . service ( ) ,
23
- isDocumizeProvider : computed . equal ( 'authProvider' , constants . AuthProvider . Documize ) ,
24
- isKeycloakProvider : computed . equal ( 'authProvider' , constants . AuthProvider . Keycloak ) ,
25
- KeycloakUrlError : computed . empty ( 'keycloakConfig.url' ) ,
26
- KeycloakRealmError : computed . empty ( 'keycloakConfig.realm' ) ,
27
- KeycloakClientIdError : computed . empty ( 'keycloakConfig.clientId' ) ,
28
- KeycloakPublicKeyError : computed . empty ( 'keycloakConfig.publicKey' ) ,
29
- KeycloakAdminUserError : computed . empty ( 'keycloakConfig.adminUser' ) ,
30
- KeycloakAdminPasswordError : computed . empty ( 'keycloakConfig.adminPassword' ) ,
31
- keycloakConfig : {
19
+
20
+ export default Component . extend ( {
21
+ appMeta : service ( ) ,
22
+ isDocumizeProvider : equal ( 'authProvider' , constants . AuthProvider . Documize ) ,
23
+ isKeycloakProvider : equal ( 'authProvider' , constants . AuthProvider . Keycloak ) ,
24
+ KeycloakUrlError : empty ( 'keycloakConfig.url' ) ,
25
+ KeycloakRealmError : empty ( 'keycloakConfig.realm' ) ,
26
+ KeycloakClientIdError : empty ( 'keycloakConfig.clientId' ) ,
27
+ KeycloakPublicKeyError : empty ( 'keycloakConfig.publicKey' ) ,
28
+ KeycloakAdminUserError : empty ( 'keycloakConfig.adminUser' ) ,
29
+ KeycloakAdminPasswordError : empty ( 'keycloakConfig.adminPassword' ) ,
30
+ keycloakConfig : {
32
31
url : '' ,
33
32
realm : '' ,
34
33
clientId : '' ,
@@ -109,7 +108,7 @@ export default Ember.Component.extend(NotifierMixin, {
109
108
return ;
110
109
}
111
110
112
- config = Ember . copy ( this . get ( 'keycloakConfig' ) ) ;
111
+ config = copy ( this . get ( 'keycloakConfig' ) ) ;
113
112
config . url = config . url . trim ( ) ;
114
113
config . realm = config . realm . trim ( ) ;
115
114
config . clientId = config . clientId . trim ( ) ;
@@ -124,10 +123,10 @@ export default Ember.Component.extend(NotifierMixin, {
124
123
config . url = config . url . substring ( 0 , config . url . length - 1 ) ;
125
124
}
126
125
127
- Ember . set ( config , 'publicKey' , encoding . Base64 . encode ( this . get ( 'keycloakConfig.publicKey' ) ) ) ;
126
+ set ( config , 'publicKey' , encoding . Base64 . encode ( this . get ( 'keycloakConfig.publicKey' ) ) ) ;
128
127
break ;
129
128
}
130
-
129
+
131
130
let data = { authProvider : provider , authConfig : JSON . stringify ( config ) } ;
132
131
133
132
this . get ( 'onSave' ) ( data ) . then ( ( ) => {
@@ -137,18 +136,15 @@ export default Ember.Component.extend(NotifierMixin, {
137
136
this . showNotification ( response . message ) ;
138
137
data . authProvider = constants . AuthProvider . Documize ;
139
138
this . get ( 'onSave' ) ( data ) . then ( ( ) => {
140
- this . showNotification ( 'Reverted back to Documize' ) ;
141
139
} ) ;
142
140
} else {
143
141
if ( data . authProvider === this . get ( 'appMeta.authProvider' ) ) {
144
- this . showNotification ( response . message ) ;
142
+ // this.showNotification(response.message);
145
143
} else {
146
144
this . get ( 'onChange' ) ( data ) ;
147
145
}
148
146
}
149
147
} ) ;
150
- } else {
151
- this . showNotification ( 'Saved' ) ;
152
148
}
153
149
} ) ;
154
150
}
0 commit comments