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:
@@ -24,7 +24,7 @@ printers_asset_bp = Blueprint('printers_asset', __name__)
|
||||
# =============================================================================
|
||||
|
||||
@printers_asset_bp.route('/types', methods=['GET'])
|
||||
@jwt_required()
|
||||
@jwt_required(optional=True)
|
||||
def list_printer_types():
|
||||
"""List all printer types."""
|
||||
page, per_page = get_pagination_params(request)
|
||||
@@ -46,7 +46,7 @@ def list_printer_types():
|
||||
|
||||
|
||||
@printers_asset_bp.route('/types/<int:type_id>', methods=['GET'])
|
||||
@jwt_required()
|
||||
@jwt_required(optional=True)
|
||||
def get_printer_type(type_id: int):
|
||||
"""Get a single printer type."""
|
||||
t = PrinterType.query.get(type_id)
|
||||
@@ -471,6 +471,6 @@ def dashboard_summary():
|
||||
'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],
|
||||
'bytype': [{'type': t, 'count': c} for t, c in by_type],
|
||||
'byvendor': [{'vendor': v, 'count': c} for v, c in by_vendor],
|
||||
})
|
||||
|
||||
@@ -113,10 +113,10 @@ class Printer(BaseModel):
|
||||
|
||||
# Add related object names
|
||||
if self.printertype:
|
||||
result['printertype_name'] = self.printertype.printertype
|
||||
result['printertypename'] = self.printertype.printertype
|
||||
if self.vendor:
|
||||
result['vendor_name'] = self.vendor.vendor
|
||||
result['vendorname'] = self.vendor.vendor
|
||||
if self.model:
|
||||
result['model_name'] = self.model.modelnumber
|
||||
result['modelname'] = self.model.modelnumber
|
||||
|
||||
return result
|
||||
|
||||
@@ -116,8 +116,8 @@ class PrintersPlugin(BasePlugin):
|
||||
if not existing:
|
||||
at = AssetType(
|
||||
assettype='printer',
|
||||
plugin_name='printers',
|
||||
table_name='printers',
|
||||
pluginname='printers',
|
||||
tablename='printers',
|
||||
description='Printers (laser, inkjet, label, MFP, plotter)',
|
||||
icon='printer'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user