refactor: move match live admin ui to dedicated page
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user