feat(05-02): printer detail page with export buttons and command preview
- Update printer_detail() to pass install_cmd, uninstall_cmd, has_driver, has_icon to template - Rewrite printer_detail.html with Intune Commands, Export, and Icon sections - Show command strings with Alpine.js copy-to-clipboard buttons (install-cmd, uninstall-cmd) - Show NinjaRMM ZIP and .intunewin download links when driver assigned - Add HTMX icon upload form with #icon-status swap target - Remove disabled placeholder Regenerate Package button - Add TestCommandPreview class (4 tests) to test_packages.py - All 94 tests pass
This commit is contained in:
+15
-2
@@ -76,7 +76,7 @@ def printers_page(request: Request):
|
||||
|
||||
@router.get("/printers/{printer_id}", response_class=HTMLResponse)
|
||||
def printer_detail(request: Request, printer_id: int):
|
||||
from imptune.db.models import Client, Driver, Printer
|
||||
from imptune.db.models import Client, Driver, Icon, Printer
|
||||
|
||||
printer = (
|
||||
Printer.select(Printer, Client, Driver)
|
||||
@@ -96,10 +96,23 @@ def printer_detail(request: Request, printer_id: int):
|
||||
if printer.driver_id and printer.driver.driver_desc:
|
||||
driver_names = json.loads(printer.driver.driver_desc)
|
||||
|
||||
has_driver = printer.driver_id is not None and bool(driver_names)
|
||||
icon = Icon.get_or_none(Icon.printer == printer_id)
|
||||
|
||||
install_cmd = "powershell.exe -ExecutionPolicy Bypass -File install.ps1"
|
||||
uninstall_cmd = "powershell.exe -ExecutionPolicy Bypass -File uninstall.ps1"
|
||||
|
||||
return templates.TemplateResponse(
|
||||
request=request,
|
||||
name="printer_detail.html",
|
||||
context={"printer": printer, "driver_names": driver_names},
|
||||
context={
|
||||
"printer": printer,
|
||||
"driver_names": driver_names,
|
||||
"has_driver": has_driver,
|
||||
"has_icon": icon is not None,
|
||||
"install_cmd": install_cmd,
|
||||
"uninstall_cmd": uninstall_cmd,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user