Skip to content

Commit

Permalink
Feat mgmt fixes (#213)
Browse files Browse the repository at this point in the history
* Fix role and group UI permissions

* remove magin on mgmt-UI
  • Loading branch information
N7Remus authored Feb 17, 2025
1 parent d7edd96 commit 0c8972f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/components/managementservice/groups/Groups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const GroupTable = () => {
setId(0);
setName('');
setDescription('');
setDescriptionDisabled(false);
setDescriptionDisabled(true);
// try to get current tenantId
// TODO
setTenantId(0);
Expand Down Expand Up @@ -209,7 +209,6 @@ const GroupTable = () => {
id="description"
label="description"
type="text"
required
fullWidth
disabled={descriptionDisabled}
onChange={handleDescriptionChange}
Expand Down
7 changes: 5 additions & 2 deletions src/components/managementservice/role/Role.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ const RoleTable = () => {
setDescription('');
setTenantId(0);
setChecked(new Array(permissions.length).fill(false));

setCheckedDisabled(true);
setOpen(true);
};

const handleClickOpenNoreset = () => {
setCheckedDisabled(false);
setOpen(true);
};

Expand Down Expand Up @@ -226,6 +227,7 @@ const RoleTable = () => {
const [ permissions, setPermissions ] = React.useState(Array<Permissions>);

const [ checked, setChecked ] = React.useState(new Array(0).fill(true));
const [ checkedDisabled, setCheckedDisabled ] = React.useState(false);

const handleChange1 = (event: React.ChangeEvent<HTMLInputElement>) => {
setChecked(new Array(permissions.length).fill(event.target.checked));
Expand All @@ -243,6 +245,7 @@ const RoleTable = () => {
<Box sx={{ display: 'flex', flexDirection: 'column', ml: 3 }}>
{Object.entries(permissions).map(([ key, value ]) =>
<FormControlLabel
disabled={checkedDisabled}
key={`${key}uniqe`}
control={<Checkbox checked={checked[parseInt(key)]}
onChange={(event) => handleChangeMod(event, parseInt(key))
Expand Down Expand Up @@ -285,7 +288,6 @@ const RoleTable = () => {
id="description"
label="description"
type="text"
required
fullWidth
onChange={handleDescriptionChange}
value={description}
Expand All @@ -306,6 +308,7 @@ const RoleTable = () => {
label="All permissions"
control={
<Checkbox
disabled={checkedDisabled}
checked={checked.every((num) => num === true)}
indeterminate={checked.some((num) => num === true) && checked.some((num) => num === false)}
onChange={handleChange1}
Expand Down
2 changes: 1 addition & 1 deletion src/views/management/Management.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export default function ManagementUI(/* props: Props */) {
);

return (
<Box sx={{ display: 'flex', flex: 1, marginRight: { sm: '300px' } }}>
<Box sx={{ display: 'flex', flex: 1, marginRight: { sm: '0px' } }}>
<CssBaseline />
<AppBar
position="fixed"
Expand Down

0 comments on commit 0c8972f

Please sign in to comment.