Improve RBAC management and permissions UI

Unify interactive and read-only role permission rows, refine role and menu forms and labels, and correct the access-permissions sidebar route. Update role payloads and admin-menu handling.
This commit is contained in:
Ichsan Kurniawan
2026-11-05 20:37:39 +07:00
parent 751b28fab2
commit 6ffe7746c8
20 changed files with 542 additions and 356 deletions
+18 -17
View File
@@ -145,7 +145,7 @@ const ComponentMenuPage: FC<Props> = ({ data }) => {
),
},
{
title: 'Path URL',
title: 'Menu Path',
dataIndex: 'path_url',
key: 'path_url',
render: (path: string) => (
@@ -156,29 +156,30 @@ const ComponentMenuPage: FC<Props> = ({ data }) => {
},
{
title: 'Type',
dataIndex: 'is_admin_menu',
key: 'is_admin_menu',
width: 120,
dataIndex: 'is_menu_admin',
key: 'is_menu_admin',
width: 140,
align: 'center',
render: (isAdmin?: boolean) => (
isAdmin ? (
render: (_val: any, record: IMenu) => {
const isAdmin = Boolean(record.is_admin_menu);
return isAdmin ? (
<span className="inline-flex items-center px-2 py-0.5 rounded-sm text-[11px] font-semibold bg-indigo-500/10 text-indigo-600 border border-indigo-500/20 dark:bg-indigo-500/20 dark:text-indigo-300 dark:border-indigo-500/30">
Admin Panel
Admin Menu
</span>
) : (
<span className="inline-flex items-center px-2 py-0.5 rounded-sm text-[11px] font-semibold bg-zinc-500/10 text-zinc-600 border border-zinc-500/20 dark:bg-zinc-500/20 dark:text-zinc-400 dark:border-zinc-500/30">
General
Non-Admin Menu
</span>
)
),
);
},
},
{
title: 'Actions / Permissions',
title: 'Permissions',
dataIndex: 'action',
key: 'action',
render: (actions?: string[]) => {
if (!actions || actions.length === 0) {
return <span className="text-xs text-muted-foreground italic">No action assigned</span>;
return <span className="text-xs text-muted-foreground italic">No permissions assigned</span>;
}
return (
<div className="flex flex-wrap gap-1 max-w-md">
@@ -200,7 +201,7 @@ const ComponentMenuPage: FC<Props> = ({ data }) => {
),
},
{
title: 'Action',
title: 'Actions',
key: 'row_action',
width: 80,
align: 'center',
@@ -230,7 +231,7 @@ const ComponentMenuPage: FC<Props> = ({ data }) => {
</DropdownMenuContent>
</DropdownMenu>
<ConfirmAsync
title="Delete Menu?"
title="Delete Menu"
description={`Are you sure you want to delete menu "${record.name}"? If this menu has child menus or permissions assigned, access may be affected.`}
onConfirm={() => handleDelete(record.id!)}
onOkSuccess={() => router.refresh()}
@@ -276,7 +277,7 @@ const ComponentMenuPage: FC<Props> = ({ data }) => {
}}
>
<PlusCircledIcon className="mr-2 h-4 w-4" />
Create New Menu
Create Menu
</Button>
</div>
@@ -289,9 +290,9 @@ const ComponentMenuPage: FC<Props> = ({ data }) => {
emptyText: (
<div className="py-8 text-center text-muted-foreground">
<i className="ti ti-category text-3xl mb-2 text-zinc-400 block" />
<p className="text-sm font-medium">No menus registered</p>
<p className="text-sm font-medium">No menus found</p>
<p className="text-xs text-zinc-400 mt-1">
{searchText ? 'No menu matching your search.' : 'Click "Create New Menu" to register your first navigation menu.'}
{searchText ? 'No menu matching your search.' : 'Click "Create Menu" to register your first navigation menu.'}
</p>
</div>
),