Add Database Status section to admin panel
- Added table_counts query in /admin route to get record counts for all tables * Reference tables (TrnsType, TrnsLkup, Footers, FileStat, Employee, etc.) * Core data tables (Rolodex, LegacyPhone, LegacyFile, Ledger, etc.) * Specialized tables (PlanInfo, Qdros, Pensions, etc.) * Modern models (Client, Phone, Case, Transaction, Payment, Document) - Created Database Status UI section in admin.html * Four-column layout showing all table categories * Color-coded badges (green=has data, gray=empty) * Check mark icons for populated tables * Table row highlighting based on data presence * Legend explaining the visual indicators - Helps users track import progress at a glance - Shows which tables have been successfully imported - Distinguishes between legacy and modern model data
This commit is contained in:
58
app/main.py
58
app/main.py
@@ -1846,11 +1846,69 @@ async def admin_panel(request: Request, db: Session = Depends(get_db)):
|
||||
files_by_type[import_type] = []
|
||||
files_by_type[import_type].append(file_info)
|
||||
|
||||
# Get record counts for all legacy and modern tables
|
||||
from .models import (
|
||||
# Legacy tables
|
||||
Rolodex, LegacyPhone, LegacyFile, FilesR, FilesV, FileNots,
|
||||
Ledger, Deposits, LegacyPayment, TrnsType, TrnsLkup,
|
||||
Footers, FileStat, Employee, GroupLkup, FileType,
|
||||
Qdros, PlanInfo, Pensions, PensionMarriage, PensionDeath,
|
||||
PensionSchedule, PensionSeparate, PensionResults,
|
||||
RolexV, FVarLkup, RVarLkup,
|
||||
# Modern tables
|
||||
Client, Phone, Case, Transaction, Payment, Document
|
||||
)
|
||||
|
||||
table_counts = {
|
||||
'reference': {
|
||||
'TrnsType': db.query(TrnsType).count(),
|
||||
'TrnsLkup': db.query(TrnsLkup).count(),
|
||||
'Footers': db.query(Footers).count(),
|
||||
'FileStat': db.query(FileStat).count(),
|
||||
'Employee': db.query(Employee).count(),
|
||||
'GroupLkup': db.query(GroupLkup).count(),
|
||||
'FileType': db.query(FileType).count(),
|
||||
'FVarLkup': db.query(FVarLkup).count(),
|
||||
'RVarLkup': db.query(RVarLkup).count(),
|
||||
},
|
||||
'core': {
|
||||
'Rolodex': db.query(Rolodex).count(),
|
||||
'LegacyPhone': db.query(LegacyPhone).count(),
|
||||
'RolexV': db.query(RolexV).count(),
|
||||
'LegacyFile': db.query(LegacyFile).count(),
|
||||
'FilesR': db.query(FilesR).count(),
|
||||
'FilesV': db.query(FilesV).count(),
|
||||
'FileNots': db.query(FileNots).count(),
|
||||
'Ledger': db.query(Ledger).count(),
|
||||
'Deposits': db.query(Deposits).count(),
|
||||
'LegacyPayment': db.query(LegacyPayment).count(),
|
||||
},
|
||||
'specialized': {
|
||||
'PlanInfo': db.query(PlanInfo).count(),
|
||||
'Qdros': db.query(Qdros).count(),
|
||||
'Pensions': db.query(Pensions).count(),
|
||||
'PensionMarriage': db.query(PensionMarriage).count(),
|
||||
'PensionDeath': db.query(PensionDeath).count(),
|
||||
'PensionSchedule': db.query(PensionSchedule).count(),
|
||||
'PensionSeparate': db.query(PensionSeparate).count(),
|
||||
'PensionResults': db.query(PensionResults).count(),
|
||||
},
|
||||
'modern': {
|
||||
'Client': db.query(Client).count(),
|
||||
'Phone': db.query(Phone).count(),
|
||||
'Case': db.query(Case).count(),
|
||||
'Transaction': db.query(Transaction).count(),
|
||||
'Payment': db.query(Payment).count(),
|
||||
'Document': db.query(Document).count(),
|
||||
}
|
||||
}
|
||||
|
||||
return templates.TemplateResponse("admin.html", {
|
||||
"request": request,
|
||||
"user": user,
|
||||
"recent_imports": recent_imports,
|
||||
"available_files": available_files,
|
||||
"table_counts": table_counts,
|
||||
"files_by_type": files_by_type
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user