Migrate frontend to plugin-based asset architecture

- Add equipmentApi and computersApi to replace legacy machinesApi
- Add controller vendor/model fields to Equipment model and forms
- Fix map marker navigation to use plugin-specific IDs (equipmentid,
  computerid, printerid, networkdeviceid) instead of assetid
- Fix search to use unified Asset table with correct plugin IDs
- Remove legacy printer search that used non-existent field names
- Enable optional JWT auth for detail endpoints (public read access)
- Clean up USB plugin models (remove unused checkout model)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-01-29 16:07:41 -05:00
parent 9c220a4194
commit c3ce69da12
28 changed files with 4123 additions and 3454 deletions

View File

@@ -94,7 +94,7 @@ def create_printer_type():
# =============================================================================
@printers_asset_bp.route('', methods=['GET'])
@jwt_required()
@jwt_required(optional=True)
def list_printers():
"""
List all printers with filtering and pagination.
@@ -186,7 +186,7 @@ def list_printers():
@printers_asset_bp.route('/<int:printer_id>', methods=['GET'])
@jwt_required()
@jwt_required(optional=True)
def get_printer(printer_id: int):
"""Get a single printer with full details."""
printer = Printer.query.get(printer_id)
@@ -210,7 +210,7 @@ def get_printer(printer_id: int):
@printers_asset_bp.route('/by-asset/<int:asset_id>', methods=['GET'])
@jwt_required()
@jwt_required(optional=True)
def get_printer_by_asset(asset_id: int):
"""Get printer data by asset ID."""
printer = Printer.query.filter_by(assetid=asset_id).first()
@@ -437,7 +437,7 @@ def get_printer_supplies(printer_id: int):
# =============================================================================
@printers_asset_bp.route('/dashboard/summary', methods=['GET'])
@jwt_required()
@jwt_required(optional=True)
def dashboard_summary():
"""Get printer dashboard summary data."""
# Total active printers
@@ -467,6 +467,10 @@ def dashboard_summary():
return success_response({
'total': total,
'totalprinters': total, # For dashboard compatibility
'online': total, # Placeholder - would need monitoring integration
'lowsupplies': 0, # Placeholder - would need Zabbix integration
'criticalsupplies': 0, # Placeholder - would need Zabbix integration
'by_type': [{'type': t, 'count': c} for t, c in by_type],
'by_vendor': [{'vendor': v, 'count': c} for v, c in by_vendor],
})