690328:1547 Fixing Refactor uuid by Kimi #10
This commit is contained in:
@@ -64,7 +64,7 @@ export function OrganizationDialog({ open, onOpenChange, organization }: Organiz
|
||||
reset({
|
||||
organizationCode: organization.organizationCode,
|
||||
organizationName: organization.organizationName,
|
||||
roleId: organization.roleId?.toString() || '',
|
||||
roleId: organization.publicId?.toString() || '',
|
||||
isActive: organization.isActive,
|
||||
});
|
||||
} else {
|
||||
@@ -80,7 +80,7 @@ export function OrganizationDialog({ open, onOpenChange, organization }: Organiz
|
||||
const onSubmit = (data: OrganizationFormData) => {
|
||||
const submitData = {
|
||||
...data,
|
||||
roleId: data.roleId ? Number(data.roleId) : undefined,
|
||||
roleId: data.roleId ? String(data.roleId) : undefined,
|
||||
};
|
||||
|
||||
if (organization) {
|
||||
|
||||
@@ -137,7 +137,7 @@ export function RbacMatrix() {
|
||||
<TableRow>
|
||||
<TableHead className="w-[300px]">Permission</TableHead>
|
||||
{roleList.map((role) => (
|
||||
<TableHead key={role.roleId} className="text-center min-w-[100px]">
|
||||
<TableHead key={role.publicId} className="text-center min-w-[100px]">
|
||||
{role.roleName}
|
||||
</TableHead>
|
||||
))}
|
||||
@@ -153,14 +153,14 @@ export function RbacMatrix() {
|
||||
{roleList.map((role) => {
|
||||
// Assume role.permissions is populated
|
||||
const currentRolePerms = role.permissions?.map((p) => p.permissionId) || [];
|
||||
const activePerms = pendingChanges[role.roleId] || currentRolePerms;
|
||||
const activePerms = pendingChanges[role.publicId] || currentRolePerms;
|
||||
const isChecked = activePerms.includes(perm.permissionId);
|
||||
|
||||
return (
|
||||
<TableCell key={`${role.roleId}-${perm.permissionId}`} className="text-center">
|
||||
<TableCell key={`${role.publicId}-${perm.permissionId}`} className="text-center">
|
||||
<Checkbox
|
||||
checked={isChecked}
|
||||
onCheckedChange={() => handleToggle(role.roleId, perm.permissionId, currentRolePerms)}
|
||||
onCheckedChange={() => handleToggle(role.publicId, perm.permissionId, currentRolePerms)}
|
||||
/>
|
||||
</TableCell>
|
||||
);
|
||||
|
||||
@@ -108,7 +108,7 @@ export function UserDialog({ open, onOpenChange, user }: UserDialogProps) {
|
||||
isActive: user.isActive,
|
||||
lineId: user.lineId || '',
|
||||
primaryOrganizationId: user.primaryOrganizationId?.toString() || ALL_ORGANIZATIONS_VALUE,
|
||||
roleIds: user.roles?.map((r: { roleId: number }) => r.roleId) || [],
|
||||
roleIds: user.roles?.map((r: { publicId: string }) => r.publicId) || [],
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
});
|
||||
@@ -297,26 +297,26 @@ export function UserDialog({ open, onOpenChange, user }: UserDialogProps) {
|
||||
<p className="text-sm text-muted-foreground">Loading roles...</p>
|
||||
)}
|
||||
{Array.isArray(roles) &&
|
||||
roles.map((role: { roleId: number; roleName: string; description?: string }) => (
|
||||
<div key={role.roleId} className="flex items-start space-x-2">
|
||||
roles.map((role: { publicId: string; roleName: string; description?: string }) => (
|
||||
<div key={role.publicId} className="flex items-start space-x-2">
|
||||
<Checkbox
|
||||
id={`role-${role.roleId}`}
|
||||
checked={selectedRoleIds.includes(role.roleId)}
|
||||
id={`role-${role.publicId}`}
|
||||
checked={selectedRoleIds.includes(role.publicId)}
|
||||
onCheckedChange={(checked) => {
|
||||
const current = selectedRoleIds;
|
||||
if (checked) {
|
||||
setValue('roleIds', [...current, role.roleId]);
|
||||
setValue('roleIds', [...current, role.publicId]);
|
||||
} else {
|
||||
setValue(
|
||||
'roleIds',
|
||||
current.filter((id) => id !== role.roleId)
|
||||
current.filter((id) => id !== role.publicId)
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<div className="grid gap-1.5 leading-none">
|
||||
<label
|
||||
htmlFor={`role-${role.roleId}`}
|
||||
htmlFor={`role-${role.publicId}`}
|
||||
className="text-sm font-medium leading-none cursor-pointer"
|
||||
>
|
||||
{role.roleName}
|
||||
|
||||
Reference in New Issue
Block a user