Skip to content

Commit 8962658

Browse files
update commons-ui
1 parent e28d718 commit 8962658

File tree

7 files changed

+16
-65
lines changed

7 files changed

+16
-65
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
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": "file:../commons-ui/gridsuite-commons-ui-0.63.2.tgz",
19+
"@gridsuite/commons-ui": "file:../commons-ui/gridsuite-commons-ui-0.63.4.tgz",
2020
"@hookform/resolvers": "^3.3.4",
2121
"@mui/icons-material": "^5.15.14",
2222
"@mui/lab": "5.0.0-alpha.169",

src/components/App/app.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ import {
1515
getComputedLanguage,
1616
PARAM_LANGUAGE,
1717
PARAM_THEME,
18+
useDebugLog,
1819
useSnackMessage,
1920
} from '@gridsuite/commons-ui';
2021
import { selectComputedLanguage, selectLanguage, selectTheme } from '../../redux/actions';
2122
import { AppState } from '../../redux/reducer';
2223
import { configNotificationSrv, configSrv } from '../../services';
2324
import { APP_NAME } from '../../utils/config-params';
2425
import AppTopBar from './app-top-bar';
25-
import { useDebugRender } from '../../utils/hooks';
2626
import { AppDispatch } from '../../redux/store';
2727

2828
const App: FunctionComponent<PropsWithChildren<{}>> = (props, context) => {
29-
useDebugRender('app');
29+
useDebugLog('app');
3030
const { snackError } = useSnackMessage();
3131
const dispatch = useDispatch<AppDispatch>();
3232
const user = useSelector((state: AppState) => state.user ?? null);

src/components/Grid/AgGrid.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ import {
2222
import { Box, useTheme } from '@mui/material';
2323
import { AgGridReact } from 'ag-grid-react';
2424
import { useIntl } from 'react-intl';
25-
import { LANG_FRENCH } from '@gridsuite/commons-ui';
25+
import { LANG_FRENCH, useDebugLog } from '@gridsuite/commons-ui';
2626
import { AG_GRID_LOCALE_FR } from '../../translations/ag-grid/locales';
2727
import { GridOptions } from 'ag-grid-community';
28-
import { useDebugRender } from '../../utils/hooks';
2928

3029
const messages: Record<string, Record<string, string>> = {
3130
[LANG_FRENCH]: AG_GRID_LOCALE_FR,
@@ -70,7 +69,7 @@ export const AgGrid: AgGridWithRef = forwardRef(function AgGrid<TData, TContext
7069
const theme = useTheme();
7170

7271
const id = useId();
73-
useDebugRender(`ag-grid(${id}) ${props.gridId}`);
72+
useDebugLog(`ag-grid(${id}) ${props.gridId}`);
7473

7574
const agGridRef = useRef<AgGridReact<TData>>(null);
7675
const agGridRefContent = agGridRef.current;

src/services/app-local.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default class AppLocalSvc extends AppLocalComSvc {
1414
super();
1515
}
1616

17-
public async fetchEnv(): Promise<EnvJson> {
17+
public async fetchEnv() {
1818
return (await super.fetchEnv()) as EnvJson;
1919
}
2020
}

src/services/user-admin.ts

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,18 @@ export default class UserAdminSvc extends UserAdminComSvc {
3535

3636
public async updateUser(userInfos: UserInfos) {
3737
console.debug('Updating a user...');
38-
await this.backendFetch(`${this.getPrefix(1)}/users/${userInfos.sub}`, {
39-
method: 'PUT',
40-
headers: {
41-
'Content-Type': 'application/json',
42-
},
43-
body: JSON.stringify(userInfos),
44-
});
38+
await this.backendSend(`${this.getPrefix(1)}/users/${userInfos.sub}`, 'PUT', JSON.stringify(userInfos));
4539
}
4640

4741
public async deleteUsers(subs: string[]) {
4842
const jsonSubs = JSON.stringify(subs);
4943
console.debug(`Deleting sub users "${jsonSubs}"...`);
50-
await this.backendFetch(`${this.getPrefix(1)}/users`, {
51-
method: 'DELETE',
52-
headers: {
53-
'Content-Type': 'application/json',
54-
},
55-
body: jsonSubs,
56-
});
44+
await this.backendSend(`${this.getPrefix(1)}/users`, 'DELETE', jsonSubs);
5745
}
5846

5947
public async addUser(sub: string) {
6048
console.debug(`Creating sub user "${sub}"...`);
61-
await this.backendFetch(`${this.getPrefix(1)}/users/${sub}`, {
62-
method: 'POST',
63-
});
49+
await this.backendFetch(`${this.getPrefix(1)}/users/${sub}`, 'POST');
6450
}
6551

6652
public async fetchProfiles() {
@@ -80,35 +66,16 @@ export default class UserAdminSvc extends UserAdminComSvc {
8066

8167
public async modifyProfile(profileData: UserProfile) {
8268
console.debug(`Updating a profile...`);
83-
await this.backendFetch(`${this.getPrefix(1)}/profiles/${profileData.id}`, {
84-
method: 'PUT',
85-
headers: {
86-
'Content-Type': 'application/json',
87-
},
88-
body: JSON.stringify(profileData),
89-
});
69+
await this.backendSend(`${this.getPrefix(1)}/profiles/${profileData.id}`, 'PUT', JSON.stringify(profileData));
9070
}
9171

9272
public async addProfile(profileData: UserProfile) {
9373
console.debug(`Creating user profile "${profileData.name}"...`);
94-
await this.backendFetch(`${this.getPrefix(1)}/profiles`, {
95-
method: 'POST',
96-
headers: {
97-
Accept: 'application/json',
98-
'Content-Type': 'application/json',
99-
},
100-
body: JSON.stringify(profileData),
101-
});
74+
await this.backendSend(`${this.getPrefix(1)}/profiles`, 'POST', JSON.stringify(profileData));
10275
}
10376

10477
public async deleteProfiles(names: string[]) {
10578
console.debug(`Deleting profiles "${JSON.stringify(names)}"...`);
106-
await this.backendFetch(`${this.getPrefix(1)}/profiles`, {
107-
method: 'DELETE',
108-
headers: {
109-
'Content-Type': 'application/json',
110-
},
111-
body: JSON.stringify(names),
112-
});
79+
await this.backendSend(`${this.getPrefix(1)}/profiles`, 'DELETE', JSON.stringify(names));
11380
}
11481
}

src/utils/hooks.ts

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

0 commit comments

Comments
 (0)