Asset-side printer save, status CRUD, real printer types, network fix
- Printers save through the asset blueprint (PUT /printers) instead of the legacy machines API; restrict supply-model picker to printer models. - Asset statuses get full CRUD (PUT/DELETE with in-use guard); canonical set. - Printer types reseeded to a real classification set + list filter. - Equipment accepts gauge/maintenance references. - Fix network list emitting network_device instead of networkdevice (View 404). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@ from shopdb.extensions import db
|
||||
from shopdb.core.models.machine import MachineType
|
||||
from shopdb.core.models import AssetType
|
||||
|
||||
from .models import PrinterData, Printer, PrinterType
|
||||
from .models import PrinterData, Printer, PrinterType, ModelSupply
|
||||
from .api import printers_bp, printers_asset_bp
|
||||
from .services import ZabbixService
|
||||
|
||||
@@ -77,6 +77,7 @@ class PrintersPlugin(BasePlugin):
|
||||
PrinterData, # Legacy Machine-based
|
||||
Printer, # New Asset-based
|
||||
PrinterType, # New printer type classification
|
||||
ModelSupply, # model -> toner/drum/waste part numbers
|
||||
]
|
||||
|
||||
def get_services(self) -> Dict[str, Type]:
|
||||
@@ -131,6 +132,7 @@ class PrintersPlugin(BasePlugin):
|
||||
('Laser', 'Standard laser printer', 'printer'),
|
||||
('Inkjet', 'Inkjet printer', 'printer'),
|
||||
('Label', 'Label/barcode printer', 'barcode'),
|
||||
('Card', 'ID / card printer', 'id-card'),
|
||||
('MFP', 'Multifunction printer with scan/copy/fax', 'printer'),
|
||||
('Plotter', 'Large format plotter', 'drafting-compass'),
|
||||
('Thermal', 'Thermal printer', 'temperature-high'),
|
||||
@@ -209,6 +211,19 @@ class PrintersPlugin(BasePlugin):
|
||||
for supply in supplies:
|
||||
click.echo(f" {supply['name']}: {supply['level']}%")
|
||||
|
||||
@printerscli.command('seed-supplies')
|
||||
def seedsuppliescommand():
|
||||
"""Seed corrected model->toner part numbers into modelsupplies."""
|
||||
from flask import current_app
|
||||
from .services import seedsupplies
|
||||
|
||||
with current_app.app_context():
|
||||
summary = seedsupplies()
|
||||
click.echo(
|
||||
f"Seeded supplies: {summary['suppliesadded']} added across "
|
||||
f"{summary['modelstouched']} models."
|
||||
)
|
||||
|
||||
return [printerscli]
|
||||
|
||||
def get_dashboard_widgets(self) -> List[Dict]:
|
||||
|
||||
Reference in New Issue
Block a user