File tree Expand file tree Collapse file tree 14 files changed +82
-53
lines changed Expand file tree Collapse file tree 14 files changed +82
-53
lines changed Original file line number Diff line number Diff line change 1
1
EXTEND_ESLINT = true
2
+ REACT_APP_DEBUG_REQUESTS = false
2
3
3
4
REACT_APP_API_GATEWAY = /api/gateway
4
5
REACT_APP_WS_GATEWAY = /ws/gateway
Original file line number Diff line number Diff line change 16
16
"dependencies" : {
17
17
"@emotion/react" : " ^11.8.2" ,
18
18
"@emotion/styled" : " ^11.8.1" ,
19
- "@gridsuite/commons-ui" : " ^0.44 .0" ,
19
+ "@gridsuite/commons-ui" : " ^0.46 .0" ,
20
20
"@hookform/resolvers" : " ^3.3.1" ,
21
21
"@mui/icons-material" : " ^5.5.1" ,
22
22
"@mui/lab" : " ^5.0.0-alpha.75" ,
Original file line number Diff line number Diff line change @@ -37,12 +37,12 @@ import {
37
37
import { AppState } from '../redux/reducer' ;
38
38
import {
39
39
ConfigSrv ,
40
+ ConfigNotif ,
40
41
ConfigParameter ,
41
42
ConfigParameters ,
42
43
UserAdminSrv ,
43
44
AppsMetadataSrv ,
44
45
} from '../services' ;
45
- import { connectNotificationsWsUpdateConfig } from '../utils/rest-api' ;
46
46
import { UserManager } from 'oidc-client' ;
47
47
import {
48
48
APP_NAME ,
@@ -104,7 +104,7 @@ const App: FunctionComponent = () => {
104
104
105
105
const connectNotificationsUpdateConfig : ( ) => ReconnectingWebSocket =
106
106
useCallback ( ( ) => {
107
- const ws = connectNotificationsWsUpdateConfig ( ) ;
107
+ const ws = ConfigNotif . connectNotificationsWsUpdateConfig ( ) ;
108
108
ws . onmessage = function ( event ) {
109
109
let eventData = JSON . parse ( event . data ) ;
110
110
if ( eventData ?. headers ?. parameterName ) {
@@ -174,7 +174,7 @@ const App: FunctionComponent = () => {
174
174
} )
175
175
) ;
176
176
177
- ConfigSrv . fetchConfigParameters ( APP_NAME )
177
+ ConfigSrv . fetchConfigParameters ( APP_NAME . toLowerCase ( ) )
178
178
. then ( ( params ) => updateParams ( params ) )
179
179
. catch ( ( error ) =>
180
180
snackError ( {
Original file line number Diff line number Diff line change 1
- import { ReqResponse } from '../utils/rest- api' ;
1
+ import { ReqResponse } from '../utils/api-rest ' ;
2
2
3
3
export type EnvJson = typeof import ( '../../public/env.json' ) ;
4
4
Original file line number Diff line number Diff line change
1
+ import ReconnectingWebSocket , { Event } from 'reconnecting-websocket' ;
2
+ import { APP_NAME } from '../utils/config-params' ;
3
+ import { getUrlWithToken , getWsBase } from '../utils/api-ws' ;
4
+
5
+ const PREFIX_CONFIG_NOTIFICATION_WS = `${ process . env . REACT_APP_WS_GATEWAY } /config-notification` ;
6
+
7
+ export function connectNotificationsWsUpdateConfig ( ) : ReconnectingWebSocket {
8
+ const webSocketUrl = `${ getWsBase ( ) } ${ PREFIX_CONFIG_NOTIFICATION_WS } /notify?appName=${ APP_NAME . toLowerCase ( ) } ` ;
9
+ const reconnectingWebSocket = new ReconnectingWebSocket (
10
+ ( ) => getUrlWithToken ( webSocketUrl ) ,
11
+ undefined ,
12
+ { debug : process . env . REACT_APP_DEBUG_REQUESTS === 'true' }
13
+ ) ;
14
+ reconnectingWebSocket . onopen = function ( event : Event ) {
15
+ console . info (
16
+ `Connected Websocket update config ui ${ webSocketUrl } ...`
17
+ ) ;
18
+ } ;
19
+ return reconnectingWebSocket ;
20
+ }
Original file line number Diff line number Diff line change 1
1
import { getAppName } from '../utils/config-params' ;
2
- import { backendFetch , backendFetchJson } from '../utils/rest- api' ;
2
+ import { backendFetch , backendFetchJson } from '../utils/api-rest ' ;
3
3
4
4
const PREFIX_CONFIG_QUERIES = `${ process . env . REACT_APP_API_GATEWAY } /config` ;
5
5
Original file line number Diff line number Diff line change 1
1
import * as Config from './config' ;
2
+ import * as ConfigNotif from './config-notification' ;
2
3
import * as AppsMetadata from './apps-metadata' ;
3
4
import * as Study from './study' ;
4
5
import * as UserAdmin from './user-admin' ;
5
6
6
7
const _ = {
7
8
...Config ,
9
+ ...ConfigNotif ,
8
10
...AppsMetadata ,
9
11
...Study ,
10
12
...UserAdmin ,
@@ -14,6 +16,9 @@ export default _;
14
16
export * as ConfigSrv from './config' ;
15
17
export type * from './config' ;
16
18
19
+ export * as ConfigNotif from './config-notification' ;
20
+ export type * from './config-notification' ;
21
+
17
22
export * as AppsMetadataSrv from './apps-metadata' ;
18
23
export type * from './apps-metadata' ;
19
24
Original file line number Diff line number Diff line change 4
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
*/
7
- import { backendFetchJson , Token } from '../utils/rest- api' ;
7
+ import { backendFetchJson , Token } from '../utils/api-rest ' ;
8
8
9
9
const STUDY_URL = `${ process . env . REACT_APP_API_GATEWAY } /study/v1` ;
10
10
Original file line number Diff line number Diff line change 1
- import { backendFetch , ReqResponse } from '../utils/rest- api' ;
1
+ import { backendFetch , ReqResponse } from '../utils/api-rest ' ;
2
2
3
3
const USER_ADMIN_URL = `${ process . env . REACT_APP_API_GATEWAY } /user-admin` ;
4
4
You can’t perform that action at this time.
0 commit comments