fix(masters): 메뉴 권한 목록 라벨과 액션 영역 정리
- group_permission_page에서 메뉴 경로를 allAppPages 라벨로 매핑하고 없는 경우 메뉴명을 유지하도록 MenuItem 표시를 보완했음 - group_permission_page와 user_page의 액션 버튼을 Row로 재구성하고 여백을 고정해 버튼 정렬을 안정화했음 - group_permission_page와 user_page의 ShadTable 컬럼 폭을 조정해 액션 영역이 잘리지 않도록 했음 - flutter analyze, flutter test
This commit is contained in:
@@ -20,6 +20,18 @@ import '../../domain/entities/group_permission.dart';
|
|||||||
import '../../domain/repositories/group_permission_repository.dart';
|
import '../../domain/repositories/group_permission_repository.dart';
|
||||||
import '../controllers/group_permission_controller.dart';
|
import '../controllers/group_permission_controller.dart';
|
||||||
|
|
||||||
|
String _menuDisplayLabelFromPath(String? path, String fallback) {
|
||||||
|
if (path != null && path.isNotEmpty) {
|
||||||
|
final normalized = path.toLowerCase();
|
||||||
|
for (final page in allAppPages) {
|
||||||
|
if (page.path.toLowerCase() == normalized) {
|
||||||
|
return page.label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
|
||||||
/// 그룹-메뉴 권한 설정 페이지. 기능 플래그에 따라 사양/실제 화면을 전환한다.
|
/// 그룹-메뉴 권한 설정 페이지. 기능 플래그에 따라 사양/실제 화면을 전환한다.
|
||||||
class GroupPermissionPage extends StatelessWidget {
|
class GroupPermissionPage extends StatelessWidget {
|
||||||
const GroupPermissionPage({super.key});
|
const GroupPermissionPage({super.key});
|
||||||
@@ -296,7 +308,7 @@ class _GroupPermissionEnabledPageState
|
|||||||
orElse: () =>
|
orElse: () =>
|
||||||
MenuItem(id: value, menuCode: '', menuName: ''),
|
MenuItem(id: value, menuCode: '', menuName: ''),
|
||||||
);
|
);
|
||||||
return Text(menuItem.menuName);
|
return Text(_menuDisplayLabel(menuItem));
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
_controller.updateMenuFilter(value);
|
_controller.updateMenuFilter(value);
|
||||||
@@ -306,7 +318,7 @@ class _GroupPermissionEnabledPageState
|
|||||||
..._controller.menus.map(
|
..._controller.menus.map(
|
||||||
(menuItem) => ShadOption<int?>(
|
(menuItem) => ShadOption<int?>(
|
||||||
value: menuItem.id,
|
value: menuItem.id,
|
||||||
child: Text(menuItem.menuName),
|
child: Text(_menuDisplayLabel(menuItem)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -419,6 +431,10 @@ class _GroupPermissionEnabledPageState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _menuDisplayLabel(MenuItem menu) {
|
||||||
|
return _menuDisplayLabelFromPath(menu.path, menu.menuName);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _openPermissionForm(
|
Future<void> _openPermissionForm(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
GroupPermission? permission,
|
GroupPermission? permission,
|
||||||
@@ -840,7 +856,10 @@ class _PermissionTable extends StatelessWidget {
|
|||||||
final cells = [
|
final cells = [
|
||||||
permission.id?.toString() ?? '-',
|
permission.id?.toString() ?? '-',
|
||||||
permission.group.groupName,
|
permission.group.groupName,
|
||||||
permission.menu.menuName,
|
_menuDisplayLabelFromPath(
|
||||||
|
permission.menu.path,
|
||||||
|
permission.menu.menuName,
|
||||||
|
),
|
||||||
permission.menu.path ?? '-',
|
permission.menu.path ?? '-',
|
||||||
permission.canCreate ? 'Y' : '-',
|
permission.canCreate ? 'Y' : '-',
|
||||||
permission.canRead ? 'Y' : '-',
|
permission.canRead ? 'Y' : '-',
|
||||||
@@ -858,17 +877,15 @@ class _PermissionTable extends StatelessWidget {
|
|||||||
ShadTableCell(
|
ShadTableCell(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Wrap(
|
child: Row(
|
||||||
spacing: 8,
|
mainAxisSize: MainAxisSize.min,
|
||||||
runSpacing: 6,
|
|
||||||
alignment: WrapAlignment.end,
|
|
||||||
runAlignment: WrapAlignment.end,
|
|
||||||
children: [
|
children: [
|
||||||
ShadButton.ghost(
|
ShadButton.ghost(
|
||||||
size: ShadButtonSize.sm,
|
size: ShadButtonSize.sm,
|
||||||
onPressed: onEdit == null ? null : () => onEdit!(permission),
|
onPressed: onEdit == null ? null : () => onEdit!(permission),
|
||||||
child: const Icon(LucideIcons.pencil, size: 16),
|
child: const Icon(LucideIcons.pencil, size: 16),
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
permission.isDeleted
|
permission.isDeleted
|
||||||
? ShadButton.ghost(
|
? ShadButton.ghost(
|
||||||
size: ShadButtonSize.sm,
|
size: ShadButtonSize.sm,
|
||||||
@@ -906,7 +923,7 @@ class _PermissionTable extends StatelessWidget {
|
|||||||
case 9:
|
case 9:
|
||||||
return const FixedTableSpanExtent(220);
|
return const FixedTableSpanExtent(220);
|
||||||
case 11:
|
case 11:
|
||||||
return const FixedTableSpanExtent(160);
|
return const FixedTableSpanExtent(200);
|
||||||
default:
|
default:
|
||||||
return const FixedTableSpanExtent(110);
|
return const FixedTableSpanExtent(110);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -965,8 +965,8 @@ class _UserTable extends StatelessWidget {
|
|||||||
ShadTableCell(
|
ShadTableCell(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Wrap(
|
child: Row(
|
||||||
spacing: 8,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
ShadButton.ghost(
|
ShadButton.ghost(
|
||||||
size: ShadButtonSize.sm,
|
size: ShadButtonSize.sm,
|
||||||
@@ -975,11 +975,13 @@ class _UserTable extends StatelessWidget {
|
|||||||
: () => onResetPassword!(user),
|
: () => onResetPassword!(user),
|
||||||
child: const Icon(LucideIcons.refreshCcw, size: 16),
|
child: const Icon(LucideIcons.refreshCcw, size: 16),
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
ShadButton.ghost(
|
ShadButton.ghost(
|
||||||
size: ShadButtonSize.sm,
|
size: ShadButtonSize.sm,
|
||||||
onPressed: onEdit == null ? null : () => onEdit!(user),
|
onPressed: onEdit == null ? null : () => onEdit!(user),
|
||||||
child: const Icon(LucideIcons.pencil, size: 16),
|
child: const Icon(LucideIcons.pencil, size: 16),
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
user.isDeleted
|
user.isDeleted
|
||||||
? ShadButton.ghost(
|
? ShadButton.ghost(
|
||||||
size: ShadButtonSize.sm,
|
size: ShadButtonSize.sm,
|
||||||
@@ -1008,7 +1010,7 @@ class _UserTable extends StatelessWidget {
|
|||||||
header: header,
|
header: header,
|
||||||
children: rows,
|
children: rows,
|
||||||
columnSpanExtent: (index) => index == 10
|
columnSpanExtent: (index) => index == 10
|
||||||
? const FixedTableSpanExtent(160)
|
? const FixedTableSpanExtent(200)
|
||||||
: const FixedTableSpanExtent(140),
|
: const FixedTableSpanExtent(140),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user