Files
ImpTune/imptune/templates/printer_detail.html
T
kawa f96ea6fec9 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
2026-04-10 15:06:45 +02:00

68 lines
2.7 KiB
HTML

{% extends "base.html" %}
{% block content %}
<h1>{{ printer.name }}</h1>
<article>
<h2>Configuration</h2>
<dl>
<dt>IP Address</dt><dd>{{ printer.ip_address }}</dd>
<dt>Port Name</dt><dd>{{ printer.port_name }}</dd>
<dt>Duplex Mode</dt><dd>{{ printer.duplex_mode }}</dd>
<dt>Color Mode</dt><dd>{{ "Color" if printer.color_mode else "Grayscale" }}</dd>
<dt>Paper Size</dt><dd>{{ printer.paper_size }}</dd>
<dt>Collate</dt><dd>{{ "Yes" if printer.collate else "No" }}</dd>
<dt>Client</dt><dd>{{ printer.client.name if printer.client_id else "Unassigned" }}</dd>
</dl>
<h2>Driver</h2>
{% if printer.driver_id %}
<dl>
<dt>Package</dt><dd>{{ printer.driver.original_filename }}</dd>
<dt>Driver Name(s)</dt><dd>{{ driver_names | join(", ") }}</dd>
<dt>Architecture</dt><dd>{{ printer.driver.architecture or "Unknown" }}</dd>
</dl>
{% else %}
<p>No driver assigned</p>
{% endif %}
{% if has_driver %}
<h2>Intune Commands</h2>
<div x-data="{ copiedInstall: false }">
<label>Install command</label>
<code id="install-cmd">{{ install_cmd }}</code>
<button @click="
const text = document.getElementById('install-cmd').innerText;
navigator.clipboard.writeText(text).then(() => { copiedInstall = true; setTimeout(() => copiedInstall = false, 2000) })
.catch(() => { /* fallback: text is visible for manual copy */ })
" x-text="copiedInstall ? 'Copied!' : 'Copy'" class="secondary outline"></button>
</div>
<div x-data="{ copiedUninstall: false }">
<label>Uninstall command</label>
<code id="uninstall-cmd">{{ uninstall_cmd }}</code>
<button @click="
const text = document.getElementById('uninstall-cmd').innerText;
navigator.clipboard.writeText(text).then(() => { copiedUninstall = true; setTimeout(() => copiedUninstall = false, 2000) })
.catch(() => { /* fallback: text is visible for manual copy */ })
" x-text="copiedUninstall ? 'Copied!' : 'Uninstall copy'" class="secondary outline"></button>
</div>
<h2>Export</h2>
<a href="/printers/{{ printer.id }}/packages/ninja" role="button">Download NinjaRMM ZIP</a>
<a href="/printers/{{ printer.id }}/packages/intunewin" role="button">Download .intunewin</a>
{% endif %}
<h2>Icon</h2>
{% if has_icon %}
<p>Icon uploaded</p>
{% endif %}
<form hx-post="/printers/{{ printer.id }}/icon"
hx-target="#icon-status" hx-swap="innerHTML"
enctype="multipart/form-data">
<input type="file" name="file" accept="image/png" required>
<button type="submit">Upload Icon</button>
</form>
<div id="icon-status"></div>
<a href="/printers" role="button" class="secondary">Back to Printers</a>
</article>
{% endblock %}