chore: add temporary menu debug diagnostics
Show current lg_idx and resolved menu type values on admin menu page when debug=1 to diagnose empty menu rendering. Made-with: Cursor
This commit is contained in:
@@ -32,6 +32,7 @@ class Menu extends BaseController
|
||||
$types = $this->typeModel->orderBy('mt_sort', 'ASC')->findAll();
|
||||
$requestedMtIdx = (int) ($this->request->getGet('mt_idx') ?? 0);
|
||||
$mtIdx = $this->resolveMtIdx($requestedMtIdx, $types);
|
||||
$debugMode = $this->request->getGet('debug') === '1';
|
||||
$list = $mtIdx > 0 ? $this->menuModel->getAllByType($mtIdx, $lgIdx) : [];
|
||||
|
||||
// 현재 지자체에 메뉴가 없으면, mt_idx별로 기본 지자체(lg_idx=1)의 메뉴를 한 번 복사한다.
|
||||
@@ -56,6 +57,14 @@ class Menu extends BaseController
|
||||
'mtCode' => $currentType->mt_code ?? '',
|
||||
'list' => $list,
|
||||
'levelNames' => config('Roles')->levelNames,
|
||||
'debug_mode' => $debugMode,
|
||||
'debug_info' => [
|
||||
'lg_idx' => $lgIdx,
|
||||
'requested_mt_idx' => $requestedMtIdx,
|
||||
'resolved_mt_idx' => $mtIdx,
|
||||
'resolved_mt_code' => (string) ($currentType->mt_code ?? ''),
|
||||
'list_count' => count($list),
|
||||
],
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ $list = $list ?? [];
|
||||
$mtIdx = (int) ($mtIdx ?? 0);
|
||||
$mtCode = (string) ($mtCode ?? '');
|
||||
$levelNames = $levelNames ?? [];
|
||||
$debugMode = (bool) ($debug_mode ?? false);
|
||||
$debugInfo = is_array($debug_info ?? null) ? $debug_info : [];
|
||||
helper('admin');
|
||||
$adminMenusNavPath = current_nav_request_path();
|
||||
|
||||
@@ -44,6 +46,17 @@ $adminMenuListResolveHref = static function (string $rawLink) use ($adminMenusNa
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php if ($debugMode): ?>
|
||||
<section class="mt-2 border border-amber-300 bg-amber-50 text-amber-900 rounded p-2 text-xs">
|
||||
<strong>[DEBUG]</strong>
|
||||
lg_idx=<?= esc((string) ($debugInfo['lg_idx'] ?? '')) ?>,
|
||||
requested_mt_idx=<?= esc((string) ($debugInfo['requested_mt_idx'] ?? '')) ?>,
|
||||
resolved_mt_idx=<?= esc((string) ($debugInfo['resolved_mt_idx'] ?? '')) ?>,
|
||||
resolved_mt_code=<?= esc((string) ($debugInfo['resolved_mt_code'] ?? '')) ?>,
|
||||
list_count=<?= esc((string) ($debugInfo['list_count'] ?? '')) ?>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="flex gap-4 mt-2 flex-wrap">
|
||||
<div class="border border-gray-300 bg-white rounded p-4 flex-1 min-w-0" style="min-width: 320px;">
|
||||
<h3 class="text-sm font-bold text-gray-700 mb-2">메뉴 목록</h3>
|
||||
|
||||
Reference in New Issue
Block a user