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
@@ -64,7 +64,7 @@ const ConfirmAsync: FC<Props> = ({ title, description, onConfirm, okText, cancel
{isLoading && (
<Icons.spinner className="mr-1 h-4 w-4 animate-spin" />
)}
{okText || 'Continue'}
{okText || 'Delete'}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
@@ -1,6 +1,7 @@
'use client';
import { ChangeEvent, FC, useEffect, useState } from 'react';
import { useRouter } from 'next/navigation';
import { MoreHorizontalIcon } from 'lucide-react';
import { Table } from 'antd';
import { TableProps, type ColumnsType } from 'antd/es/table';
@@ -27,6 +28,7 @@ const ComponentPermissionPage: FC<Props> = ({ data }) => {
const [searchText, setSearchText] = useState('');
const axios = useAxiosAuth();
const router = useRouter();
useEffect(() => {
if (data && Array.isArray(data)) {
@@ -63,7 +65,7 @@ const ComponentPermissionPage: FC<Props> = ({ data }) => {
const columns: ColumnsType<IPermission> = [
{
title: 'Num',
title: 'No',
dataIndex: 'key',
width: 70,
align: 'center',
@@ -91,7 +93,7 @@ const ComponentPermissionPage: FC<Props> = ({ data }) => {
),
},
{
title: 'Action',
title: 'Actions',
key: 'action',
width: 80,
align: 'center',
@@ -101,7 +103,7 @@ const ComponentPermissionPage: FC<Props> = ({ data }) => {
<DropdownMenuTrigger asChild>
<Button variant="ghost" size="icon" className="h-8 w-8">
<MoreHorizontalIcon className="h-4 w-4" />
<span className="sr-only">Action</span>
<span className="sr-only">Actions</span>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
@@ -111,20 +113,20 @@ const ComponentPermissionPage: FC<Props> = ({ data }) => {
setShowFormDialog(true);
}}
>
Edit
Edit Permission
</DropdownMenuItem>
<AlertDialogTrigger asChild>
<DropdownMenuItem className="text-rose-600 dark:text-rose-400">
Delete
Delete Permission
</DropdownMenuItem>
</AlertDialogTrigger>
</DropdownMenuContent>
</DropdownMenu>
<ConfirmAsync
title="Delete Access Permission?"
title="Delete Permission"
description={`Are you sure you want to delete permission "${record.name}"? This may affect menus and roles using this permission.`}
onConfirm={() => handleDelete(record.id)}
onOkSuccess={() => { }}
onOkSuccess={() => router.refresh()}
/>
</AlertDialog>
),
@@ -168,7 +170,7 @@ const ComponentPermissionPage: FC<Props> = ({ data }) => {
}}
>
<PlusCircledIcon className="mr-2 h-4 w-4" />
Create New Permission
Create Permission
</Button>
</div>
@@ -183,7 +185,7 @@ const ComponentPermissionPage: FC<Props> = ({ data }) => {
<i className="ti ti-shield-lock text-3xl mb-2 text-zinc-400 block" />
<p className="text-sm font-medium">No permissions found</p>
<p className="text-xs text-zinc-400 mt-1">
{searchText ? 'Try adjusting your search criteria.' : 'Click "Create New Permission" to add the first permission.'}
{searchText ? 'Try adjusting your search criteria.' : 'Click "Create Permission" to add the first permission.'}
</p>
</div>
),