@goplusvn/core 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/package.json +1 -1
- package/src/rbac/components/roles/role-card.tsx +25 -24
- package/src/rbac/components/roles/role-toolbar.tsx +70 -84
- package/src/rbac/index.ts +8 -0
- package/src/rbac/lib/fetch-error.ts +26 -0
- package/src/rbac/pages/action-list-page.tsx +581 -19
- package/src/rbac/pages/index.ts +13 -0
- package/src/rbac/pages/resource-list-page.tsx +1415 -19
- package/src/rbac/pages/role-form-page.tsx +704 -0
- package/src/rbac/pages/role-list-page.tsx +14 -12
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useMemo, useCallback, useState } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
4
|
+
import type { ReactNode } from "react";
|
|
5
|
+
import { Loader2, UserX, KeyRound } from "lucide-react";
|
|
6
|
+
import {
|
|
7
|
+
Button,
|
|
7
8
|
Badge,
|
|
9
|
+
StatusIndicator,
|
|
8
10
|
AlertDialog,
|
|
9
11
|
AlertDialogAction,
|
|
10
12
|
AlertDialogCancel,
|
|
@@ -59,6 +61,8 @@ export interface RoleListPageProps {
|
|
|
59
61
|
description: string | null;
|
|
60
62
|
isDefault?: boolean;
|
|
61
63
|
}>;
|
|
64
|
+
/** Nút Import app-specific (vd ImportDialog) — render trong toolbar khi có quyền import. */
|
|
65
|
+
importSlot?: ReactNode;
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
export function RoleListPage({
|
|
@@ -68,6 +72,7 @@ export function RoleListPage({
|
|
|
68
72
|
initialData,
|
|
69
73
|
resources,
|
|
70
74
|
actions,
|
|
75
|
+
importSlot,
|
|
71
76
|
}: RoleListPageProps) {
|
|
72
77
|
const canCreate = permissions.create;
|
|
73
78
|
const canUpdate = permissions.update;
|
|
@@ -199,7 +204,9 @@ export function RoleListPage({
|
|
|
199
204
|
|
|
200
205
|
if (error) {
|
|
201
206
|
return (
|
|
202
|
-
<div className="text-
|
|
207
|
+
<div className="text-destructive">
|
|
208
|
+
Không thể tải dữ liệu: {error.message}
|
|
209
|
+
</div>
|
|
203
210
|
);
|
|
204
211
|
}
|
|
205
212
|
|
|
@@ -223,6 +230,7 @@ export function RoleListPage({
|
|
|
223
230
|
canCreate={canCreate}
|
|
224
231
|
canImport={canImport}
|
|
225
232
|
canExport={canExport}
|
|
233
|
+
importSlot={importSlot}
|
|
226
234
|
/>
|
|
227
235
|
|
|
228
236
|
{/* Roles Grid */}
|
|
@@ -342,15 +350,9 @@ export function RoleListPage({
|
|
|
342
350
|
</div>
|
|
343
351
|
<div className="flex items-center space-x-2">
|
|
344
352
|
{user.isActive ? (
|
|
345
|
-
<
|
|
346
|
-
<UserCheck className="h-3 w-3 mr-1" />
|
|
347
|
-
Active
|
|
348
|
-
</Badge>
|
|
353
|
+
<StatusIndicator status="active" />
|
|
349
354
|
) : (
|
|
350
|
-
<
|
|
351
|
-
<UserX className="h-3 w-3 mr-1" />
|
|
352
|
-
Inactive
|
|
353
|
-
</Badge>
|
|
355
|
+
<StatusIndicator status="inactive" />
|
|
354
356
|
)}
|
|
355
357
|
</div>
|
|
356
358
|
</div>
|