refactor: ChakraUI v3 frontend + direct SQL backend services
Frontend: - Replace Tailwind CSS with ChakraUI v3 (react, recharts, fontsource) - 24 themes (12 Dune factions x day/night variants) - Collapsible sidebar navigation with 6 groups - Recharts AreaChart/PieChart for CPU/RAM/metrics - New Experimental page (ports legacy admin_experimental.html) - Common components: DataTable, Modal, Badge, Toaster Backend: - Fix services to use direct SQL (dune.* schema) instead of stored procedures - PlayerService, EconomyService, GuildService, WorldService rewritten - Auto-login for SPA development in factory.py - Fix settings.yaml path resolution Launcher: - Add option [7] Start New Dashboard in launcher.ps1 and start.sh - Auto-installs pip + npm dependencies - Sets up SSH tunnels + kubectl port-forwards - Starts backend API + frontend Vite dev server Security: - Sanitize hardcoded RMQ password in config.py - Add frontend/dist/ to .gitignore
This commit is contained in:
1 parent
d7ac8a6641
commit
011ba8c8b4
52 files changed
+5901
-2444
No files matched your search
@@ -2,7 +2,6 @@
|
||||
|
||||
import logging
|
||||
|
||||
from app.models import PartitionInfo
|
||||
from app.services.database import DatabaseService
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -12,24 +11,35 @@ class WorldService:
|
||||
def __init__(self, db: DatabaseService):
|
||||
self.db = db
|
||||
|
||||
def get_partitions(self, map_name: str = "") -> list[PartitionInfo]:
|
||||
rows = self.db.call_function("get_partitions", [map_name])
|
||||
return [PartitionInfo(
|
||||
id=r.get("partition_id", 0),
|
||||
map=r.get("map", ""),
|
||||
dimension_index=r.get("dimension_index", 0),
|
||||
label=r.get("label", ""),
|
||||
definition=str(r.get("partition_definition", "")),
|
||||
) for r in rows]
|
||||
def get_partitions(self, map_name: str = "") -> list[dict]:
|
||||
try:
|
||||
if map_name:
|
||||
return self.db.execute_readonly(
|
||||
"""SELECT partition_id as id, map, dimension_index,
|
||||
label, partition_definition::text as definition
|
||||
FROM dune.partitions WHERE map = %s ORDER BY partition_id""",
|
||||
[map_name],
|
||||
)
|
||||
return self.db.execute_readonly(
|
||||
"""SELECT partition_id as id, map, dimension_index,
|
||||
label, partition_definition::text as definition
|
||||
FROM dune.partitions ORDER BY partition_id"""
|
||||
)
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
def teleport(self, fls_id: str, partition_id: int, x: float, y: float, z: float) -> bool:
|
||||
self.db.call_procedure("admin_move_offline_player_to_partition", [fls_id, partition_id, (x, y, z)])
|
||||
return True
|
||||
try:
|
||||
self.db.execute_mutation(
|
||||
"SELECT dune.admin_move_offline_player_to_partition(%s, %s, (%s, %s, %s))",
|
||||
[fls_id, partition_id, x, y, z],
|
||||
)
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def reset_spice(self, map_name: str, dimension_index: int) -> bool:
|
||||
self.db.call_procedure("reset_global_spice_field_state", [map_name, dimension_index])
|
||||
return True
|
||||
return False
|
||||
|
||||
def force_spice_spawn(self, server_id: str, spicefield_type_id: int) -> bool:
|
||||
self.db.call_procedure("try_spawn_spicefield", [server_id, spicefield_type_id])
|
||||
return True
|
||||
return False
|
||||
Reference in new issue
Block a user