Add print badges, pagination, route splitting, JWT auth fixes, and list page alignment
- Fix equipment badge barcode not rendering (loading race condition) - Fix printer QR code not rendering on initial load (same race condition) - Add model image to equipment badge via imageurl from Model table - Fix white-on-white machine number text on badge, tighten barcode spacing - Add PaginationBar component used across all list pages - Split monolithic router into per-plugin route modules - Fix 25 GET API endpoints returning 401 (jwt_required -> optional=True) - Align list page columns across Equipment, PCs, and Network pages - Add print views: EquipmentBadge, PrinterQRSingle, PrinterQRBatch, USBLabelBatch - Add PC Relationships report, migration docs, and CLAUDE.md project guide - Various plugin model, API, and frontend refinements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Dashboard API endpoints."""
|
||||
|
||||
from flask import Blueprint
|
||||
from flask import Blueprint, current_app
|
||||
from flask_jwt_extended import jwt_required
|
||||
|
||||
from shopdb.extensions import db
|
||||
@@ -60,10 +60,10 @@ def get_dashboard():
|
||||
'counts': {
|
||||
'equipment': equipment_count,
|
||||
'pcs': pc_count,
|
||||
'network_devices': network_count,
|
||||
'networkdevices': network_count,
|
||||
'total': equipment_count + pc_count + network_count
|
||||
},
|
||||
'by_status': status_dict,
|
||||
'bystatus': status_dict,
|
||||
'recent': [
|
||||
{
|
||||
'machineid': m.machineid,
|
||||
@@ -93,13 +93,51 @@ def get_stats():
|
||||
).all()
|
||||
|
||||
return success_response({
|
||||
'by_type': [
|
||||
'bytype': [
|
||||
{'type': t, 'category': c, 'count': count}
|
||||
for t, c, count in type_counts
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
@dashboard_bp.route('/navigation', methods=['GET'])
|
||||
def get_navigation():
|
||||
"""Get navigation items from all loaded plugins."""
|
||||
pm = current_app.extensions.get('plugin_manager')
|
||||
if not pm:
|
||||
return success_response([])
|
||||
|
||||
all_items = []
|
||||
|
||||
# Core navigation items (always present)
|
||||
all_items.extend([
|
||||
{'name': 'Dashboard', 'icon': 'layout-dashboard', 'route': '/', 'position': 0},
|
||||
{'name': 'Map', 'icon': 'map', 'route': '/map', 'position': 4},
|
||||
])
|
||||
|
||||
# Collect navigation items from all plugins
|
||||
for name, plugin in pm.get_all_plugins().items():
|
||||
try:
|
||||
items = plugin.get_navigation_items()
|
||||
for item in items:
|
||||
item['plugin'] = name
|
||||
all_items.extend(items)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Add core information section items
|
||||
all_items.extend([
|
||||
{'name': 'Applications', 'icon': 'app-window', 'route': '/applications', 'position': 30, 'section': 'information'},
|
||||
{'name': 'Knowledge Base', 'icon': 'book-open', 'route': '/knowledgebase', 'position': 35, 'section': 'information'},
|
||||
{'name': 'Reports', 'icon': 'bar-chart-3', 'route': '/reports', 'position': 40, 'section': 'information'},
|
||||
])
|
||||
|
||||
# Sort by position
|
||||
all_items.sort(key=lambda x: x.get('position', 99))
|
||||
|
||||
return success_response(all_items)
|
||||
|
||||
|
||||
@dashboard_bp.route('/health', methods=['GET'])
|
||||
def health_check():
|
||||
"""Health check endpoint (no auth required)."""
|
||||
|
||||
Reference in New Issue
Block a user