From f654081e8f1c711b8425b8649b5f28606ec07086 Mon Sep 17 00:00:00 2001 From: hajimi Date: Sun, 21 Jun 2026 16:30:28 +0800 Subject: [PATCH] refactor: move match live admin ui to dedicated page --- docs/sql/insert_menu_match_live.sql | 14 ++++++------- qa/frontend/test_match_live_admin_static.py | 23 +++++++++++++++------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/docs/sql/insert_menu_match_live.sql b/docs/sql/insert_menu_match_live.sql index f04c0e5..7dbe9a5 100644 --- a/docs/sql/insert_menu_match_live.sql +++ b/docs/sql/insert_menu_match_live.sql @@ -1,35 +1,35 @@ INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) -SELECT parent.`id`, 'C', '直播线路管理', '', 0, 'match.matchLive/lists', 'match_live', 'match/lists/index', 'match/lists', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() +SELECT parent.`id`, 'C', '直播线路管理', '', 0, 'match.matchLive/index', 'match_live', 'match/live/index', '/match/lists', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() FROM `la_system_menu` parent WHERE parent.`perms` = 'match.match/lists' AND NOT EXISTS ( SELECT 1 FROM `la_system_menu` - WHERE `perms` = 'match.matchLive/lists' + WHERE `perms` = 'match.matchLive/index' ); INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) -SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/lists' LIMIT 1), 'A', '直播线路详情', '', 0, 'match.matchLive/detail', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() +SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/index' LIMIT 1), 'A', '直播线路详情', '', 0, 'match.matchLive/detail', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() WHERE NOT EXISTS ( SELECT 1 FROM `la_system_menu` WHERE `perms` = 'match.matchLive/detail' ); INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) -SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/lists' LIMIT 1), 'A', '直播线路新增', '', 0, 'match.matchLive/add', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() +SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/index' LIMIT 1), 'A', '直播线路新增', '', 0, 'match.matchLive/add', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() WHERE NOT EXISTS ( SELECT 1 FROM `la_system_menu` WHERE `perms` = 'match.matchLive/add' ); INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) -SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/lists' LIMIT 1), 'A', '直播线路编辑', '', 0, 'match.matchLive/edit', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() +SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/index' LIMIT 1), 'A', '直播线路编辑', '', 0, 'match.matchLive/edit', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() WHERE NOT EXISTS ( SELECT 1 FROM `la_system_menu` WHERE `perms` = 'match.matchLive/edit' ); INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) -SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/lists' LIMIT 1), 'A', '直播线路删除', '', 0, 'match.matchLive/delete', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() +SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/index' LIMIT 1), 'A', '直播线路删除', '', 0, 'match.matchLive/delete', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() WHERE NOT EXISTS ( SELECT 1 FROM `la_system_menu` WHERE `perms` = 'match.matchLive/delete' @@ -39,7 +39,7 @@ INSERT INTO `la_system_role_menu` (`role_id`, `menu_id`) SELECT 1, m.`id` FROM `la_system_menu` m WHERE m.`perms` IN ( - 'match.matchLive/lists', + 'match.matchLive/index', 'match.matchLive/detail', 'match.matchLive/add', 'match.matchLive/edit', diff --git a/qa/frontend/test_match_live_admin_static.py b/qa/frontend/test_match_live_admin_static.py index f78f8c5..fcfaaeb 100644 --- a/qa/frontend/test_match_live_admin_static.py +++ b/qa/frontend/test_match_live_admin_static.py @@ -6,6 +6,7 @@ REPO_ROOT = Path(__file__).resolve().parents[2] MATCH_API = ROOT / "src" / "api" / "match.ts" MATCH_INDEX = ROOT / "src" / "views" / "match" / "lists" / "index.vue" MATCH_LIVE_TABLE = ROOT / "src" / "views" / "match" / "lists" / "components" / "MatchLiveTable.vue" +MATCH_LIVE_PAGE = ROOT / "src" / "views" / "match" / "live" / "index.vue" MENU_SQL = REPO_ROOT / "docs" / "sql" / "insert_menu_match_live.sql" @@ -16,15 +17,20 @@ def assert_contains(path: Path, needle: str) -> None: def main() -> None: match_api = MATCH_API.read_text(encoding="utf-8") + match_index = MATCH_INDEX.read_text(encoding="utf-8") match_live_table = MATCH_LIVE_TABLE.read_text(encoding="utf-8") + match_live_page = MATCH_LIVE_PAGE.read_text(encoding="utf-8") assert MENU_SQL.is_file(), f"missing menu seed file: {MENU_SQL}" menu_sql = MENU_SQL.read_text(encoding="utf-8") normalized_menu_sql = " ".join(menu_sql.split()) first_insert_block = menu_sql.split(";", 1)[0] + ";" normalized_first_insert = " ".join(first_insert_block.split()) - assert_contains(MATCH_INDEX, 'type="expand"') - assert_contains(MATCH_INDEX, "MatchLiveTable") + assert MATCH_LIVE_PAGE.is_file(), f"missing page file: {MATCH_LIVE_PAGE}" + assert 'type="expand"' not in match_index, f"{MATCH_INDEX} should not use expand child table anymore" + assert "MatchLiveTable" not in match_index, f"{MATCH_INDEX} should not render MatchLiveTable inline anymore" + assert "match.matchLive/index" in match_index, f"{MATCH_INDEX} missing route perms match.matchLive/index" + assert "getRoutePath('match.matchLive/index')" in match_index, f"{MATCH_INDEX} must route to match.matchLive/index" for needle in ( "matchLiveLists", @@ -42,6 +48,11 @@ def main() -> None: ): assert needle in match_live_table, f"{MATCH_LIVE_TABLE} missing: {needle}" + assert "MatchLiveTable" in match_live_page, f"{MATCH_LIVE_PAGE} should reuse MatchLiveTable" + assert "matchDetail" in match_live_page, f"{MATCH_LIVE_PAGE} should load match detail" + assert "useRoute" in match_live_page, f"{MATCH_LIVE_PAGE} should read route query" + assert "router.back()" in match_live_page, f"{MATCH_LIVE_PAGE} should provide back navigation" + readonly_fields = ( 'play_url_m3u8" readonly', 'play_url_hd_m3u8" readonly', @@ -96,7 +107,7 @@ def main() -> None: assert needle in match_live_table, f"{MATCH_LIVE_TABLE} missing fetch_status mapping: {needle}" for needle in ( - "match.matchLive/lists", + "match.matchLive/index", "match.matchLive/detail", "match.matchLive/add", "match.matchLive/edit", @@ -120,7 +131,7 @@ def main() -> None: ), f"{MENU_SQL} must bind the match live menu to parent match.match/lists explicitly" assert ( "SELECT parent.`id`, 'C', '直播线路管理'" in menu_sql - ), f"{MENU_SQL} must insert the list menu only when the parent match.match/lists record exists" + ), f"{MENU_SQL} must insert the page menu only when the parent match.match/lists record exists" assert ( "WHERE parent.`perms` = 'match.match/lists' AND NOT EXISTS (" in normalized_first_insert ), f"{MENU_SQL} first insert must combine parent binding with AND NOT EXISTS in a single WHERE predicate" @@ -131,8 +142,8 @@ def main() -> None: f"{MENU_SQL} first insert should only have the outer WHERE plus the nested WHERE inside NOT EXISTS" ) assert ( - "SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/lists' LIMIT 1)" in normalized_menu_sql - ), f"{MENU_SQL} child permissions must bind to the inserted match.matchLive/lists menu" + "SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/index' LIMIT 1)" in normalized_menu_sql + ), f"{MENU_SQL} child permissions must bind to the inserted match.matchLive/index menu" print("match live admin static checks passed")