Skip to content

Commit 98c987b

Browse files
author
Hugo Marcellin
committed
Remove mutualized ws functions
1 parent 664aee0 commit 98c987b

File tree

8 files changed

+199
-189
lines changed

8 files changed

+199
-189
lines changed

package-lock.json

Lines changed: 180 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@emotion/react": "^11.11.4",
1818
"@emotion/styled": "^11.11.5",
19-
"@gridsuite/commons-ui": "0.53.0",
19+
"@gridsuite/commons-ui": "file:../commons-ui/gridsuite-commons-ui-0.59.0.tgz",
2020
"@hookform/resolvers": "^3.3.4",
2121
"@mui/icons-material": "^5.15.14",
2222
"@mui/lab": "5.0.0-alpha.169",
@@ -85,8 +85,8 @@
8585
"jest-environment-jsdom": "^29.7.0",
8686
"jest-svg-transformer": "^1.0.0",
8787
"prettier": "^2.8.8",
88-
"typescript": "5.1.6",
8988
"ts-node": "^10.9.2",
89+
"typescript": "5.1.6",
9090
"vite": "^5.2.7",
9191
"vite-plugin-eslint": "^1.8.1",
9292
"vite-plugin-svgr": "^4.2.0",

src/components/App/app-top-bar.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ import {
1515
} from 'react';
1616
import { capitalize, Tab, Tabs, useTheme } from '@mui/material';
1717
import { ManageAccounts, PeopleAlt } from '@mui/icons-material';
18-
import { logout, TopBar } from '@gridsuite/commons-ui';
18+
import {
19+
logout,
20+
TopBar,
21+
fetchVersion,
22+
fetchAppsMetadata,
23+
CommonMetadata,
24+
} from '@gridsuite/commons-ui';
1925
import { useParameterState } from '../parameters';
2026
import {
2127
APP_NAME,
@@ -25,7 +31,7 @@ import {
2531
import { NavLink, useMatches, useNavigate } from 'react-router-dom';
2632
import { useDispatch, useSelector } from 'react-redux';
2733
import { FormattedMessage } from 'react-intl';
28-
import { AppsMetadataSrv, MetadataJson, StudySrv } from '../../services';
34+
import { StudySrv } from '../../services';
2935
import GridAdminLogoLight from '../../images/GridAdmin_logo_light.svg?react';
3036
import GridAdminLogoDark from '../../images/GridAdmin_logo_dark.svg?react';
3137
import AppPackage from '../../../package.json';
@@ -86,11 +92,11 @@ const AppTopBar: FunctionComponent = () => {
8692
const [languageLocal, handleChangeLanguage] =
8793
useParameterState(PARAM_LANGUAGE);
8894

89-
const [appsAndUrls, setAppsAndUrls] = useState<MetadataJson[]>([]);
95+
const [appsMetadata, setAppsMetadata] = useState<CommonMetadata[]>([]);
9096
useEffect(() => {
9197
if (user !== null) {
92-
AppsMetadataSrv.fetchAppsAndUrls().then((res) => {
93-
setAppsAndUrls(res);
98+
fetchAppsMetadata().then((res) => {
99+
setAppsMetadata(res);
94100
});
95101
}
96102
}, [user]);
@@ -111,9 +117,9 @@ const AppTopBar: FunctionComponent = () => {
111117
onLogoutClick={() => logout(dispatch, userManagerInstance)}
112118
onLogoClick={() => navigate('/', { replace: true })}
113119
user={user}
114-
appsAndUrls={appsAndUrls}
120+
appsAndUrls={appsMetadata}
115121
globalVersionPromise={() =>
116-
AppsMetadataSrv.fetchVersion().then((res) => res?.deployVersion)
122+
fetchVersion().then((res) => res?.deployVersion)
117123
}
118124
additionalModulesPromise={StudySrv.getServersInfos}
119125
onThemeClick={handleChangeTheme}

src/routes/router.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
import { FormattedMessage } from 'react-intl';
1616
import {
1717
AuthenticationRouter,
18+
fetchAuthorizationCodeFlowFeatureFlag,
1819
getPreLoginPath,
1920
initializeAuthenticationProd,
2021
} from '@gridsuite/commons-ui';
@@ -31,7 +32,7 @@ import {
3132
import { UserManager } from 'oidc-client';
3233
import { useDispatch, useSelector } from 'react-redux';
3334
import { AppState } from '../redux/reducer';
34-
import { AppsMetadataSrv, UserAdminSrv } from '../services';
35+
import { UserAdminSrv } from '../services';
3536
import { App } from '../components/App';
3637
import { Users, Profiles } from '../pages';
3738
import ErrorPage from './ErrorPage';
@@ -138,7 +139,7 @@ const AppAuthStateWithRouterLayer: FunctionComponent<
138139
);
139140

140141
useEffect(() => {
141-
AppsMetadataSrv.fetchAuthorizationCodeFlowFeatureFlag()
142+
fetchAuthorizationCodeFlowFeatureFlag()
142143
.then((authorizationCodeFlowEnabled) =>
143144
initializeAuthenticationProd(
144145
dispatch,

src/services/apps-metadata.ts

Lines changed: 0 additions & 116 deletions
This file was deleted.

src/services/config-notification.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import ReconnectingWebSocket, { Event } from 'reconnecting-websocket';
99
import { APP_NAME } from '../utils/config-params';
10-
import { getUrlWithToken, getWsBase } from '../utils/api-ws';
10+
import { getUrlWithToken, getWsBase } from '@gridsuite/commons-ui';
1111

1212
const PREFIX_CONFIG_NOTIFICATION_WS = `${getWsBase()}/config-notification`;
1313

src/services/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import * as Config from './config';
22
import * as ConfigNotif from './config-notification';
3-
import * as AppsMetadata from './apps-metadata';
43
import * as Study from './study';
54
import * as UserAdmin from './user-admin';
65

76
const _ = {
87
...Config,
98
...ConfigNotif,
10-
...AppsMetadata,
119
...Study,
1210
...UserAdmin,
1311
};
@@ -19,9 +17,6 @@ export type * from './config';
1917
export * as ConfigNotif from './config-notification';
2018
export type * from './config-notification';
2119

22-
export * as AppsMetadataSrv from './apps-metadata';
23-
export type * from './apps-metadata';
24-
2520
export * as StudySrv from './study';
2621
export type * from './study';
2722

src/utils/api-ws.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)