feat: expand shusub2 dashboard columns

This commit is contained in:
2026-07-27 20:34:26 +08:00
parent 0c7e437b7b
commit b248a6c9c1
5 changed files with 31 additions and 50 deletions
+14 -8
View File
@@ -678,7 +678,7 @@ class Sub2APILogsTests(unittest.TestCase):
class DashboardLayoutTests(unittest.IsolatedAsyncioTestCase):
async def test_dashboard_fits_three_tables_at_80_by_24_and_focuses_each(self) -> None:
async def test_dashboard_supports_wide_columns_at_80_by_24_and_focuses_each(self) -> None:
from textual.app import App
mod = load_module()
@@ -688,7 +688,7 @@ class DashboardLayoutTests(unittest.IsolatedAsyncioTestCase):
"accounts": [
{
"id": 1,
"name": "account-one",
"name": "account-one-with-a-complete-expanded-dashboard-name",
"routing_group": "fast",
"provider": "openai",
"kind": "pay_as_you_go",
@@ -708,9 +708,9 @@ class DashboardLayoutTests(unittest.IsolatedAsyncioTestCase):
"items": [
{
"id": 1,
"api_key_name": "key-one",
"account_name": "account-one",
"model": "gpt-5.5-codex",
"api_key_name": "wmy-production-key-with-a-complete-expanded-name",
"account_name": "account-one-with-a-complete-expanded-dashboard-name",
"model": "gpt-5.5-codex-with-a-complete-expanded-dashboard-model-name",
"duration_ms": 1200,
"created_at": "2026-07-24T12:00:00+08:00",
}
@@ -723,8 +723,9 @@ class DashboardLayoutTests(unittest.IsolatedAsyncioTestCase):
"_node": "cn",
"id": 1,
"status_code": 500,
"account_name": "account-one",
"requested_model": "gpt-5.5-codex",
"api_key_name": "wmy-production-key-with-a-complete-expanded-name",
"account_name": "account-one-with-a-complete-expanded-dashboard-name",
"requested_model": "gpt-5.5-codex-with-a-complete-expanded-dashboard-model-name",
"phase": "upstream",
"type": "api_error",
"created_at": "2026-07-24T12:01:00+08:00",
@@ -767,7 +768,12 @@ class DashboardLayoutTests(unittest.IsolatedAsyncioTestCase):
tables = [screen.query_one(selector) for selector in ("#accounts", "#keys", "#logs", "#errors")]
for table in tables:
self.assertGreaterEqual(table.region.height, 4)
self.assertLessEqual(table.virtual_size.width, table.region.width)
logs_table = screen.query_one("#logs")
errors_table = screen.query_one("#errors")
self.assertGreater(logs_table.virtual_size.width, logs_table.region.width)
self.assertGreater(errors_table.virtual_size.width, errors_table.region.width)
self.assertGreater(logs_table.max_scroll_x, 0)
self.assertGreater(errors_table.max_scroll_x, 0)
self.assertEqual(len({table.styles.background for table in tables}), 4)
self.assertIn("wmy", str(screen.query_one("#summary").render()))
for key, expected_id in (("k", "keys"), ("l", "logs"), ("e", "errors"), ("a", "accounts")):