Skip to content

Commit e898f46

Browse files
committed
clean code
Signed-off-by: David BRAQUART <[email protected]>
1 parent 4880091 commit e898f46

File tree

7 files changed

+26
-25
lines changed

7 files changed

+26
-25
lines changed

src/pages/common/table-config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export const defaultColDef: ColDef = {
1111
editable: false,
1212
resizable: true,
1313
minWidth: 50,
14-
cellRenderer: 'agAnimateSlideCellRenderer',
1514
rowDrag: false,
1615
sortable: true,
1716
};

src/pages/common/table-selection.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { ColDef, GetRowIdParams, GridReadyEvent } from 'ag-grid-community';
1414
import { defaultColDef, defaultRowSelection } from './table-config';
1515

1616
export interface TableSelectionProps {
17-
itemNameTranslationKey: string;
17+
itemName: string;
1818
tableItems: string[];
1919
tableSelectedItems?: string[];
2020
onSelectionChanged: (selectedItems: string[]) => void;
@@ -45,8 +45,8 @@ const TableSelection: FunctionComponent<TableSelectionProps> = (props) => {
4545
field: 'id',
4646
filter: true,
4747
sortable: true,
48-
minWidth: 80,
4948
tooltipField: 'id',
49+
flex: 1,
5050
},
5151
],
5252
[]
@@ -71,7 +71,7 @@ const TableSelection: FunctionComponent<TableSelectionProps> = (props) => {
7171
<Grid item container direction={'column'} style={{ height: '100%' }}>
7272
<Grid item>
7373
<Typography variant="subtitle1">
74-
<FormattedMessage id={props.itemNameTranslationKey}></FormattedMessage>
74+
<FormattedMessage id={props.itemName}></FormattedMessage>
7575
{` (${selectedRowsLength} / ${rowData?.length ?? 0})`}
7676
</Typography>
7777
</Grid>

src/pages/groups/groups-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
ITooltipParams,
1717
RowClickedEvent,
1818
SelectionChangedEvent,
19-
TextFilterParams
19+
TextFilterParams,
2020
} from 'ag-grid-community';
2121
import { useSnackMessage } from '@gridsuite/commons-ui';
2222
import DeleteConfirmationDialog from '../common/delete-confirmation-dialog';

src/pages/groups/modification/group-modification-form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ const GroupModificationForm: FunctionComponent<GroupModificationFormProps> = ({
4040
<Grid item xs={12}>
4141
<TextInput name={GROUP_NAME} label={'groups.table.id'} clearable={true} />
4242
</Grid>
43-
<Grid item xs={12} style={{ height: '85%' }}>
43+
<Grid item xs={12} style={{ height: '90%' }}>
4444
<TableSelection
45-
itemNameTranslationKey={'groups.table.users'}
45+
itemName={'groups.table.users'}
4646
tableItems={usersOptions}
4747
tableSelectedItems={selectedUsers}
4848
onSelectionChanged={onSelectionChanged}

src/pages/profiles/profiles-page.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,24 @@ const ProfilesPage: FunctionComponent = () => {
4141
}, []);
4242

4343
return (
44-
<Grid item container direction="column" spacing={2} component="section">
45-
<Grid item container xs sx={{ width: 1 }}>
46-
<ProfilesTable
47-
gridRef={gridRef}
48-
onRowClicked={onRowClicked}
49-
setOpenAddProfileDialog={setOpenAddProfileDialog}
50-
/>
51-
<AddProfileDialog gridRef={gridRef} open={openAddProfileDialog} setOpen={setOpenAddProfileDialog} />
52-
<ProfileModificationDialog
53-
profileId={editingProfileId}
54-
open={openProfileModificationDialog}
55-
onClose={handleCloseProfileModificationDialog}
56-
onUpdate={handleUpdateProfileModificationDialog}
57-
/>
44+
<>
45+
<Grid item container direction="column" spacing={2} component="section">
46+
<Grid item container xs sx={{ width: 1 }}>
47+
<ProfilesTable
48+
gridRef={gridRef}
49+
onRowClicked={onRowClicked}
50+
setOpenAddProfileDialog={setOpenAddProfileDialog}
51+
/>
52+
</Grid>
5853
</Grid>
59-
</Grid>
54+
<AddProfileDialog gridRef={gridRef} open={openAddProfileDialog} setOpen={setOpenAddProfileDialog} />
55+
<ProfileModificationDialog
56+
profileId={editingProfileId}
57+
open={openProfileModificationDialog}
58+
onClose={handleCloseProfileModificationDialog}
59+
onUpdate={handleUpdateProfileModificationDialog}
60+
/>
61+
</>
6062
);
6163
};
6264
export default ProfilesPage;

src/pages/users/modification/user-modification-dialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ const UserModificationDialog: FunctionComponent<UserModificationDialogProps> = (
110110
(userFormData: UserModificationFormType) => {
111111
if (userInfos) {
112112
const newData: UpdateUserInfos = {
113-
sub: userInfos.sub, // sub cannot be changed, it is a PK in database
114-
isAdmin: userInfos.isAdmin, // cannot be changed for now
113+
sub: userInfos.sub, // can't be changed
114+
isAdmin: userInfos.isAdmin, // can't be changed
115115
profileName: userFormData.profileName ?? undefined,
116116
groups: selectedGroups,
117117
};

src/pages/users/modification/user-modification-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const UserModificationForm: FunctionComponent<UserModificationFormProps> = ({
6363
</Grid>
6464
<Grid item xs={12} style={{ height: '85%' }}>
6565
<TableSelection
66-
itemNameTranslationKey={'users.table.groups'}
66+
itemName={'users.table.groups'}
6767
tableItems={groupOptions}
6868
tableSelectedItems={selectedGroups}
6969
onSelectionChanged={onSelectionChanged}

0 commit comments

Comments
 (0)