Skip to content

Commit 7e6b1a8

Browse files
committed
refacto user page, missing groups in edit dialog
Signed-off-by: David BRAQUART <[email protected]>
1 parent c7e5e7c commit 7e6b1a8

File tree

13 files changed

+605
-383
lines changed

13 files changed

+605
-383
lines changed

src/pages/common/table-config.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
8+
import { ColDef, RowSelectionOptions } from 'ag-grid-community';
9+
10+
export const defaultColDef: ColDef = {
11+
editable: false,
12+
resizable: true,
13+
minWidth: 50,
14+
cellRenderer: 'agAnimateSlideCellRenderer',
15+
rowDrag: false,
16+
sortable: true,
17+
};
18+
19+
export const defaultRowSelection: RowSelectionOptions = {
20+
mode: 'multiRow',
21+
enableClickSelection: false,
22+
checkboxes: true,
23+
headerCheckbox: true,
24+
hideDisabledCheckboxes: false,
25+
};

src/pages/groups/GroupsPage.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,9 @@ import DeleteConfirmationDialog from '../common/delete-confirmation-dialog';
1717
import MultiSelectEditorComponent from '../common/multi-select-editor-component';
1818
import MultiChipsRendererComponent from '../common/multi-chips-renderer-component';
1919
import { UUID } from 'crypto';
20+
import { defaultColDef } from '../common/table-config';
2021
import AddGroupDialog from './add-group-dialog';
2122

22-
const defaultColDef: ColDef<GroupInfos> = {
23-
editable: false,
24-
resizable: true,
25-
minWidth: 50,
26-
cellRenderer: 'agAnimateSlideCellRenderer',
27-
rowDrag: false,
28-
sortable: true,
29-
};
30-
3123
function getRowId(params: GetRowIdParams<GroupInfos>): string {
3224
return params.data.name;
3325
}

src/pages/profiles/modification/profile-modification-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const ProfileModificationForm: FunctionComponent = () => {
2727
return (
2828
<Grid container spacing={2} marginTop={'auto'}>
2929
<Grid item xs={12}>
30-
<TextInput name={PROFILE_NAME} label={'profiles.table.id'} clearable={false} />
30+
<TextInput name={PROFILE_NAME} label={'profiles.table.id'} clearable={true} />
3131
</Grid>
3232
<Grid item xs={12}>
3333
<h3>

src/pages/profiles/profiles-table.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,7 @@ import { UserAdminSrv, UserProfile } from '../../services';
1313
import { ColDef, GetRowIdParams, RowClickedEvent, SelectionChangedEvent, TextFilterParams } from 'ag-grid-community';
1414
import { useSnackMessage } from '@gridsuite/commons-ui';
1515
import DeleteConfirmationDialog from '../common/delete-confirmation-dialog';
16-
17-
const defaultColDef: ColDef<UserProfile> = {
18-
editable: false,
19-
resizable: true,
20-
minWidth: 50,
21-
cellRenderer: 'agAnimateSlideCellRenderer',
22-
rowDrag: false,
23-
sortable: true,
24-
};
16+
import { defaultColDef, defaultRowSelection } from '../common/table-config';
2517

2618
export interface ProfilesTableProps {
2719
gridRef: RefObject<GridTableRef<UserProfile>>;
@@ -126,13 +118,7 @@ const ProfilesTable: FunctionComponent<ProfilesTableProps> = (props) => {
126118
defaultColDef={defaultColDef}
127119
gridId="table-profiles"
128120
getRowId={getRowId}
129-
rowSelection={{
130-
mode: 'multiRow',
131-
enableClickSelection: false,
132-
checkboxes: true,
133-
headerCheckbox: true,
134-
hideDisabledCheckboxes: false,
135-
}}
121+
rowSelection={defaultRowSelection}
136122
onRowClicked={props.onRowClicked}
137123
onSelectionChanged={onSelectionChanged}
138124
>

0 commit comments

Comments
 (0)