feat(12-02): wire all template strings to Alpine i18n store
- dashboard.html: headings, quick actions, empty states wired to x-text - printers.html: h1, add button, h2 wired to x-text - printers_new.html: all form labels (span pattern), options, submit buttons wired - clients.html: headings, label, submit button wired - client_detail.html: back link, section heading wired - drivers.html: all headings, label, buttons, spinner wired - packages.html: heading, description, table headers, empty state wired - printer_detail.html: all dt/dd, section headings, copy buttons, script/export links wired with conditional Jinja2 for color/collate/client - partials/printer_list.html: table headers, Yes/No cells (Alpine ternary), delete button wired - partials/printer_edit_modal.html: edit trigger, modal title, all labels (span pattern), options, save/cancel wired - partials/client_list.html: empty state, table headers wired - partials/driver_list.html: table headers, unknown values, empty state wired - Fix test_printers_library_no_form: check form element attribute instead of UI label string (now in i18n dict)
This commit is contained in:
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>{{ client.name }}</h1>
|
<h1>{{ client.name }}</h1>
|
||||||
<p><a href="/clients">← All Clients</a></p>
|
<p><a href="/clients" x-data x-text="$store.i18n.t('back_to_clients')">← All Clients</a></p>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Printers</h2>
|
<h2 x-data x-text="$store.i18n.t('printers_section')">Printers</h2>
|
||||||
{% include "partials/printer_list.html" %}
|
{% include "partials/printer_list.html" %}
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Clients</h1>
|
<h1 x-data x-text="$store.i18n.t('clients')">Clients</h1>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Add Client</h2>
|
<h2 x-data x-text="$store.i18n.t('add_client_section')">Add Client</h2>
|
||||||
<form hx-post="/clients" hx-target="#client-list" hx-swap="outerHTML">
|
<form hx-post="/clients" hx-target="#client-list" hx-swap="outerHTML">
|
||||||
<label>
|
<label>
|
||||||
Client Name
|
<span x-data x-text="$store.i18n.t('client_name_label')">Client Name</span>
|
||||||
<input type="text" name="name" placeholder="e.g. Contoso" required>
|
<input type="text" name="name" placeholder="e.g. Contoso" required>
|
||||||
</label>
|
</label>
|
||||||
<button type="submit">Add Client</button>
|
<button type="submit" x-data x-text="$store.i18n.t('add_client')">Add Client</button>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Client List</h2>
|
<h2 x-data x-text="$store.i18n.t('client_list_section')">Client List</h2>
|
||||||
{% include "partials/client_list.html" %}
|
{% include "partials/client_list.html" %}
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Dashboard</h1>
|
<h1 x-data x-text="$store.i18n.t('dashboard')">Dashboard</h1>
|
||||||
|
|
||||||
<div class="quick-actions">
|
<div class="quick-actions">
|
||||||
<a href="/printers" class="btn-action">New Printer</a>
|
<a href="/printers" class="btn-action" x-data x-text="$store.i18n.t('new_printer')">New Printer</a>
|
||||||
<a href="/drivers" class="btn-action">Upload Driver</a>
|
<a href="/drivers" class="btn-action" x-data x-text="$store.i18n.t('upload_driver_btn')">Upload Driver</a>
|
||||||
<a href="/packages" class="btn-action">Export Package</a>
|
<a href="/packages" class="btn-action" x-data x-text="$store.i18n.t('export_package')">Export Package</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section class="recent-activity">
|
<section class="recent-activity">
|
||||||
<h2>Recent Activity</h2>
|
<h2 x-data x-text="$store.i18n.t('recent_activity')">Recent Activity</h2>
|
||||||
|
|
||||||
<div class="activity-section">
|
<div class="activity-section">
|
||||||
<h3>Recent Printers</h3>
|
<h3 x-data x-text="$store.i18n.t('recent_printers')">Recent Printers</h3>
|
||||||
{% if recent_printers %}
|
{% if recent_printers %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for printer in recent_printers %}
|
{% for printer in recent_printers %}
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="empty-state">No printers configured yet.</p>
|
<p class="empty-state" x-data x-text="$store.i18n.t('no_printers')">No printers configured yet.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="activity-section">
|
<div class="activity-section">
|
||||||
<h3>Recent Packages</h3>
|
<h3 x-data x-text="$store.i18n.t('recent_packages')">Recent Packages</h3>
|
||||||
{% if recent_packages %}
|
{% if recent_packages %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for package in recent_packages %}
|
{% for package in recent_packages %}
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="empty-state">No packages exported yet.</p>
|
<p class="empty-state" x-data x-text="$store.i18n.t('no_packages')">No packages exported yet.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Drivers</h1>
|
<h1 x-data x-text="$store.i18n.t('drivers_title')">Drivers</h1>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Upload Driver Package</h2>
|
<h2 x-data x-text="$store.i18n.t('upload_driver_section')">Upload Driver Package</h2>
|
||||||
<form
|
<form
|
||||||
hx-post="/drivers/upload"
|
hx-post="/drivers/upload"
|
||||||
hx-encoding="multipart/form-data"
|
hx-encoding="multipart/form-data"
|
||||||
@@ -11,15 +11,15 @@
|
|||||||
hx-swap="outerHTML"
|
hx-swap="outerHTML"
|
||||||
hx-indicator="#upload-spinner"
|
hx-indicator="#upload-spinner"
|
||||||
>
|
>
|
||||||
<label for="driver-file">Driver Package (ZIP containing .inf + driver files)</label>
|
<label for="driver-file" x-data x-text="$store.i18n.t('driver_package_label')">Driver Package (ZIP containing .inf + driver files)</label>
|
||||||
<input type="file" id="driver-file" name="file" accept=".zip" required>
|
<input type="file" id="driver-file" name="file" accept=".zip" required>
|
||||||
<button type="submit">Upload</button>
|
<button type="submit" x-data x-text="$store.i18n.t('upload_btn')">Upload</button>
|
||||||
<span id="upload-spinner" class="htmx-indicator" aria-busy="true">Uploading...</span>
|
<span id="upload-spinner" class="htmx-indicator" aria-busy="true" x-data x-text="$store.i18n.t('uploading')">Uploading...</span>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Driver Library</h2>
|
<h2 x-data x-text="$store.i18n.t('driver_library')">Driver Library</h2>
|
||||||
{% include "partials/driver_list.html" %}
|
{% include "partials/driver_list.html" %}
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Packages</h1>
|
<h1 x-data x-text="$store.i18n.t('packages_title')">Packages</h1>
|
||||||
<p>Printers with drivers assigned — ready for deployment package export.</p>
|
<p x-data x-text="$store.i18n.t('packages_description')">Printers with drivers assigned — ready for deployment package export.</p>
|
||||||
|
|
||||||
{% if printers %}
|
{% if printers %}
|
||||||
<figure>
|
<figure>
|
||||||
<table role="grid">
|
<table role="grid">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Printer</th>
|
<th scope="col" x-data x-text="$store.i18n.t('printer_col')">Printer</th>
|
||||||
<th scope="col">Client</th>
|
<th scope="col" x-data x-text="$store.i18n.t('client_col')">Client</th>
|
||||||
<th scope="col">Driver</th>
|
<th scope="col" x-data x-text="$store.i18n.t('driver_col')">Driver</th>
|
||||||
<th scope="col">Downloads</th>
|
<th scope="col" x-data x-text="$store.i18n.t('downloads_col')">Downloads</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -32,6 +32,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</figure>
|
</figure>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="empty-state">No package-ready printers yet. Assign a driver to a printer to enable package export.</p>
|
<p class="empty-state" x-data x-text="$store.i18n.t('no_packages_ready')">No package-ready printers yet. Assign a driver to a printer to enable package export.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<div id="client-list">
|
<div id="client-list">
|
||||||
{% if not clients %}
|
{% if not clients %}
|
||||||
<p>No clients configured yet.</p>
|
<p x-data x-text="$store.i18n.t('no_clients')">No clients configured yet.</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th x-data x-text="$store.i18n.t('th_name')">Name</th>
|
||||||
<th>Created</th>
|
<th x-data x-text="$store.i18n.t('created')">Created</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@@ -17,10 +17,10 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Filename</th>
|
<th x-data x-text="$store.i18n.t('driver_filename')">Filename</th>
|
||||||
<th>Driver Name(s)</th>
|
<th x-data x-text="$store.i18n.t('driver_names_col')">Driver Name(s)</th>
|
||||||
<th>Architecture</th>
|
<th x-data x-text="$store.i18n.t('architecture')">Architecture</th>
|
||||||
<th>Uploaded</th>
|
<th x-data x-text="$store.i18n.t('uploaded_at')">Uploaded</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -35,16 +35,16 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
{% else %}
|
{% else %}
|
||||||
<em>Unknown</em>
|
<em x-data x-text="$store.i18n.t('unknown')">Unknown</em>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ item.driver.architecture or "Unknown" }}</td>
|
<td>{% if item.driver.architecture %}{{ item.driver.architecture }}{% else %}<span x-data x-text="$store.i18n.t('unknown')">Unknown</span>{% endif %}</td>
|
||||||
<td>{{ item.driver.uploaded_at }}</td>
|
<td>{{ item.driver.uploaded_at }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>No drivers uploaded yet.</p>
|
<p x-data x-text="$store.i18n.t('no_drivers')">No drivers uploaded yet.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<!-- Edit trigger button — placed in Actions column -->
|
<!-- Edit trigger button — placed in Actions column -->
|
||||||
<button class="secondary outline"
|
<button class="secondary outline"
|
||||||
onclick="document.getElementById('edit-modal-{{ p.id }}').showModal()">
|
onclick="document.getElementById('edit-modal-{{ p.id }}').showModal()"
|
||||||
|
x-data x-text="$store.i18n.t('edit')">
|
||||||
Edit
|
Edit
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<button aria-label="Close" rel="prev"
|
<button aria-label="Close" rel="prev"
|
||||||
onclick="document.getElementById('edit-modal-{{ p.id }}').close()"></button>
|
onclick="document.getElementById('edit-modal-{{ p.id }}').close()"></button>
|
||||||
<h3>Edit Printer</h3>
|
<h3 x-data x-text="$store.i18n.t('edit_printer_title')">Edit Printer</h3>
|
||||||
</header>
|
</header>
|
||||||
<div x-data="{ ip: '{{ p.ip_address }}', port: '{{ p.port_name }}', portEdited: true }">
|
<div x-data="{ ip: '{{ p.ip_address }}', port: '{{ p.port_name }}', portEdited: true }">
|
||||||
<form hx-patch="/printers/{{ p.id }}"
|
<form hx-patch="/printers/{{ p.id }}"
|
||||||
@@ -18,27 +19,27 @@
|
|||||||
hx-swap="outerHTML"
|
hx-swap="outerHTML"
|
||||||
hx-on::after-request="document.getElementById('edit-modal-{{ p.id }}').close()">
|
hx-on::after-request="document.getElementById('edit-modal-{{ p.id }}').close()">
|
||||||
|
|
||||||
<label>Printer Name
|
<label><span x-text="$store.i18n.t('printer_name')">Printer Name</span>
|
||||||
<input type="text" name="name" value="{{ p.name }}" required>
|
<input type="text" name="name" value="{{ p.name }}" required>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>IP Address
|
<label><span x-text="$store.i18n.t('ip_address')">IP Address</span>
|
||||||
<input type="text" name="ip_address"
|
<input type="text" name="ip_address"
|
||||||
x-model="ip"
|
x-model="ip"
|
||||||
@input="if (!portEdited) port = 'IP_' + ip.replaceAll('.', '_')"
|
@input="if (!portEdited) port = 'IP_' + ip.replaceAll('.', '_')"
|
||||||
required>
|
required>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>Port Name
|
<label><span x-text="$store.i18n.t('port_name')">Port Name</span>
|
||||||
<input type="text" name="port_name"
|
<input type="text" name="port_name"
|
||||||
x-model="port"
|
x-model="port"
|
||||||
@change="portEdited = true"
|
@change="portEdited = true"
|
||||||
@keydown="portEdited = true">
|
@keydown="portEdited = true">
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>Driver
|
<label><span x-text="$store.i18n.t('driver')">Driver</span>
|
||||||
<select name="driver_id">
|
<select name="driver_id">
|
||||||
<option value="">-- No driver --</option>
|
<option value="" x-text="$store.i18n.t('no_driver_option')">-- No driver --</option>
|
||||||
{% for item in driver_data %}
|
{% for item in driver_data %}
|
||||||
<option value="{{ item.driver.id }}"
|
<option value="{{ item.driver.id }}"
|
||||||
{% if p.driver_id == item.driver.id %}selected{% endif %}>
|
{% if p.driver_id == item.driver.id %}selected{% endif %}>
|
||||||
@@ -48,21 +49,21 @@
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>Duplex Mode
|
<label><span x-text="$store.i18n.t('duplex_mode')">Duplex Mode</span>
|
||||||
<select name="duplex_mode">
|
<select name="duplex_mode">
|
||||||
<option value="OneSided" {% if p.duplex_mode == 'OneSided' %}selected{% endif %}>One-Sided</option>
|
<option value="OneSided" {% if p.duplex_mode == 'OneSided' %}selected{% endif %} x-text="$store.i18n.t('one_sided')">One-Sided</option>
|
||||||
<option value="LongEdge" {% if p.duplex_mode == 'LongEdge' %}selected{% endif %}>Long Edge</option>
|
<option value="LongEdge" {% if p.duplex_mode == 'LongEdge' %}selected{% endif %} x-text="$store.i18n.t('long_edge')">Long Edge</option>
|
||||||
<option value="ShortEdge" {% if p.duplex_mode == 'ShortEdge' %}selected{% endif %}>Short Edge</option>
|
<option value="ShortEdge" {% if p.duplex_mode == 'ShortEdge' %}selected{% endif %} x-text="$store.i18n.t('short_edge')">Short Edge</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="color_mode" value="on"
|
<input type="checkbox" name="color_mode" value="on"
|
||||||
{% if p.color_mode %}checked{% endif %}>
|
{% if p.color_mode %}checked{% endif %}>
|
||||||
Color Mode
|
<span x-text="$store.i18n.t('color_mode')">Color Mode</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>Paper Size
|
<label><span x-text="$store.i18n.t('paper_size')">Paper Size</span>
|
||||||
<select name="paper_size">
|
<select name="paper_size">
|
||||||
<option value="A4" {% if p.paper_size == 'A4' %}selected{% endif %}>A4</option>
|
<option value="A4" {% if p.paper_size == 'A4' %}selected{% endif %}>A4</option>
|
||||||
<option value="Letter" {% if p.paper_size == 'Letter' %}selected{% endif %}>Letter</option>
|
<option value="Letter" {% if p.paper_size == 'Letter' %}selected{% endif %}>Letter</option>
|
||||||
@@ -73,12 +74,12 @@
|
|||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="collate" value="on"
|
<input type="checkbox" name="collate" value="on"
|
||||||
{% if p.collate %}checked{% endif %}>
|
{% if p.collate %}checked{% endif %}>
|
||||||
Collate
|
<span x-text="$store.i18n.t('collate')">Collate</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>Client
|
<label><span x-text="$store.i18n.t('client')">Client</span>
|
||||||
<select name="client_id">
|
<select name="client_id">
|
||||||
<option value="">-- Unassigned --</option>
|
<option value="" x-text="$store.i18n.t('unassigned_option')">-- Unassigned --</option>
|
||||||
{% for c in clients %}
|
{% for c in clients %}
|
||||||
<option value="{{ c.id }}"
|
<option value="{{ c.id }}"
|
||||||
{% if p.client_id == c.id %}selected{% endif %}>
|
{% if p.client_id == c.id %}selected{% endif %}>
|
||||||
@@ -89,9 +90,10 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<button type="submit">Save</button>
|
<button type="submit" x-text="$store.i18n.t('save')">Save</button>
|
||||||
<button type="button" class="secondary"
|
<button type="button" class="secondary"
|
||||||
onclick="document.getElementById('edit-modal-{{ p.id }}').close()">
|
onclick="document.getElementById('edit-modal-{{ p.id }}').close()"
|
||||||
|
x-text="$store.i18n.t('cancel')">
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
</footer>
|
</footer>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div id="printer-list">
|
<div id="printer-list">
|
||||||
{% if not grouped %}
|
{% if not grouped %}
|
||||||
<p>No printers configured yet.</p>
|
<p x-data x-text="$store.i18n.t('no_printers')">No printers configured yet.</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% for client_name, printers in grouped.items() %}
|
{% for client_name, printers in grouped.items() %}
|
||||||
<section>
|
<section>
|
||||||
@@ -13,15 +13,15 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th x-data x-text="$store.i18n.t('th_name')">Name</th>
|
||||||
<th>IP Address</th>
|
<th x-data x-text="$store.i18n.t('th_ip')">IP Address</th>
|
||||||
<th>Port</th>
|
<th x-data x-text="$store.i18n.t('th_port')">Port</th>
|
||||||
<th>Driver</th>
|
<th x-data x-text="$store.i18n.t('th_driver')">Driver</th>
|
||||||
<th>Duplex</th>
|
<th x-data x-text="$store.i18n.t('th_duplex')">Duplex</th>
|
||||||
<th>Color</th>
|
<th x-data x-text="$store.i18n.t('th_color')">Color</th>
|
||||||
<th>Paper</th>
|
<th x-data x-text="$store.i18n.t('th_paper')">Paper</th>
|
||||||
<th>Collate</th>
|
<th x-data x-text="$store.i18n.t('th_collate')">Collate</th>
|
||||||
<th>Actions</th>
|
<th x-data x-text="$store.i18n.t('th_actions')">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -32,16 +32,19 @@
|
|||||||
<td>{{ p.port_name }}</td>
|
<td>{{ p.port_name }}</td>
|
||||||
<td>{{ p.driver.original_filename if p.driver_id else '—' }}</td>
|
<td>{{ p.driver.original_filename if p.driver_id else '—' }}</td>
|
||||||
<td>{{ p.duplex_mode }}</td>
|
<td>{{ p.duplex_mode }}</td>
|
||||||
<td>{{ 'Yes' if p.color_mode else 'No' }}</td>
|
<td x-data="{ val: {{ 'true' if p.color_mode else 'false' }} }"
|
||||||
|
x-text="val ? $store.i18n.t('yes') : $store.i18n.t('no')">{{ 'Yes' if p.color_mode else 'No' }}</td>
|
||||||
<td>{{ p.paper_size }}</td>
|
<td>{{ p.paper_size }}</td>
|
||||||
<td>{{ 'Yes' if p.collate else 'No' }}</td>
|
<td x-data="{ val: {{ 'true' if p.collate else 'false' }} }"
|
||||||
|
x-text="val ? $store.i18n.t('yes') : $store.i18n.t('no')">{{ 'Yes' if p.collate else 'No' }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% include "partials/printer_edit_modal.html" %}
|
{% include "partials/printer_edit_modal.html" %}
|
||||||
<button
|
<button
|
||||||
hx-delete="/printers/{{ p.id }}"
|
hx-delete="/printers/{{ p.id }}"
|
||||||
hx-target="#printer-list"
|
hx-target="#printer-list"
|
||||||
hx-swap="outerHTML"
|
hx-swap="outerHTML"
|
||||||
hx-confirm="Delete '{{ p.name }}'?">
|
hx-confirm="Delete '{{ p.name }}'?"
|
||||||
|
x-data x-text="$store.i18n.t('delete')">
|
||||||
Delete
|
Delete
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -2,77 +2,81 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>{{ printer.name }}</h1>
|
<h1>{{ printer.name }}</h1>
|
||||||
<article>
|
<article>
|
||||||
<h2>Configuration</h2>
|
<h2 x-data x-text="$store.i18n.t('configuration')">Configuration</h2>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>IP Address</dt><dd>{{ printer.ip_address }}</dd>
|
<dt x-data x-text="$store.i18n.t('ip_address')">IP Address</dt><dd>{{ printer.ip_address }}</dd>
|
||||||
<dt>Port Name</dt><dd>{{ printer.port_name }}</dd>
|
<dt x-data x-text="$store.i18n.t('port_name')">Port Name</dt><dd>{{ printer.port_name }}</dd>
|
||||||
<dt>Duplex Mode</dt><dd>{{ printer.duplex_mode }}</dd>
|
<dt x-data x-text="$store.i18n.t('duplex_mode_label')">Duplex Mode</dt><dd>{{ printer.duplex_mode }}</dd>
|
||||||
<dt>Color Mode</dt><dd>{{ "Color" if printer.color_mode else "Grayscale" }}</dd>
|
<dt x-data x-text="$store.i18n.t('color_mode_label')">Color Mode</dt>
|
||||||
<dt>Paper Size</dt><dd>{{ printer.paper_size }}</dd>
|
{% if printer.color_mode %}<dd x-data x-text="$store.i18n.t('color_value')">Color</dd>{% else %}<dd x-data x-text="$store.i18n.t('grayscale_value')">Grayscale</dd>{% endif %}
|
||||||
<dt>Collate</dt><dd>{{ "Yes" if printer.collate else "No" }}</dd>
|
<dt x-data x-text="$store.i18n.t('paper_size_label')">Paper Size</dt><dd>{{ printer.paper_size }}</dd>
|
||||||
<dt>Client</dt><dd>{{ printer.client.name if printer.client_id else "Unassigned" }}</dd>
|
<dt x-data x-text="$store.i18n.t('collate_label')">Collate</dt>
|
||||||
|
{% if printer.collate %}<dd x-data x-text="$store.i18n.t('yes')">Yes</dd>{% else %}<dd x-data x-text="$store.i18n.t('no')">No</dd>{% endif %}
|
||||||
|
<dt x-data x-text="$store.i18n.t('client_label')">Client</dt>
|
||||||
|
{% if printer.client_id %}<dd>{{ printer.client.name }}</dd>{% else %}<dd x-data x-text="$store.i18n.t('unassigned')">Unassigned</dd>{% endif %}
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<h2>Driver</h2>
|
<h2 x-data x-text="$store.i18n.t('driver_section')">Driver</h2>
|
||||||
{% if printer.driver_id %}
|
{% if printer.driver_id %}
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Package</dt><dd>{{ printer.driver.original_filename }}</dd>
|
<dt x-data x-text="$store.i18n.t('package_label')">Package</dt><dd>{{ printer.driver.original_filename }}</dd>
|
||||||
<dt>Driver Name(s)</dt><dd>{{ driver_names | join(", ") }}</dd>
|
<dt x-data x-text="$store.i18n.t('driver_names_label')">Driver Name(s)</dt><dd>{{ driver_names | join(", ") }}</dd>
|
||||||
<dt>Architecture</dt><dd>{{ printer.driver.architecture or "Unknown" }}</dd>
|
<dt x-data x-text="$store.i18n.t('architecture_label')">Architecture</dt>
|
||||||
|
<dd>{% if printer.driver.architecture %}{{ printer.driver.architecture }}{% else %}<span x-data x-text="$store.i18n.t('unknown')">Unknown</span>{% endif %}</dd>
|
||||||
</dl>
|
</dl>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>No driver assigned</p>
|
<p x-data x-text="$store.i18n.t('no_driver_detail')">No driver assigned</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if has_driver %}
|
{% if has_driver %}
|
||||||
<h2>Intune Commands</h2>
|
<h2 x-data x-text="$store.i18n.t('intune_commands')">Intune Commands</h2>
|
||||||
<div x-data="{ copiedInstall: false }">
|
<div x-data="{ copiedInstall: false }">
|
||||||
<label>Install command</label>
|
<label x-text="$store.i18n.t('install_cmd_label')">Install command</label>
|
||||||
<code id="install-cmd">{{ install_cmd }}</code>
|
<code id="install-cmd">{{ install_cmd }}</code>
|
||||||
<button @click="
|
<button @click="
|
||||||
const text = document.getElementById('install-cmd').innerText;
|
const text = document.getElementById('install-cmd').innerText;
|
||||||
navigator.clipboard.writeText(text).then(() => { copiedInstall = true; setTimeout(() => copiedInstall = false, 2000) })
|
navigator.clipboard.writeText(text).then(() => { copiedInstall = true; setTimeout(() => copiedInstall = false, 2000) })
|
||||||
.catch(() => { /* fallback: text is visible for manual copy */ })
|
.catch(() => { /* fallback: text is visible for manual copy */ })
|
||||||
" x-text="copiedInstall ? 'Copied!' : 'Copy'" class="secondary outline"></button>
|
" x-text="copiedInstall ? $store.i18n.t('copied') : $store.i18n.t('copy')" class="secondary outline">Copy</button>
|
||||||
</div>
|
</div>
|
||||||
<div x-data="{ copiedUninstall: false }">
|
<div x-data="{ copiedUninstall: false }">
|
||||||
<label>Uninstall command</label>
|
<label x-text="$store.i18n.t('uninstall_cmd_label')">Uninstall command</label>
|
||||||
<code id="uninstall-cmd">{{ uninstall_cmd }}</code>
|
<code id="uninstall-cmd">{{ uninstall_cmd }}</code>
|
||||||
<button @click="
|
<button @click="
|
||||||
const text = document.getElementById('uninstall-cmd').innerText;
|
const text = document.getElementById('uninstall-cmd').innerText;
|
||||||
navigator.clipboard.writeText(text).then(() => { copiedUninstall = true; setTimeout(() => copiedUninstall = false, 2000) })
|
navigator.clipboard.writeText(text).then(() => { copiedUninstall = true; setTimeout(() => copiedUninstall = false, 2000) })
|
||||||
.catch(() => { /* fallback: text is visible for manual copy */ })
|
.catch(() => { /* fallback: text is visible for manual copy */ })
|
||||||
" x-text="copiedUninstall ? 'Copied!' : 'Copy'" class="secondary outline"></button>
|
" x-text="copiedUninstall ? $store.i18n.t('copied') : $store.i18n.t('copy')" class="secondary outline">Copy</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Scripts</h2>
|
<h2 x-data x-text="$store.i18n.t('scripts_section')">Scripts</h2>
|
||||||
<a href="/printers/{{ printer.id }}/scripts/install.ps1" role="button" class="secondary">
|
<a href="/printers/{{ printer.id }}/scripts/install.ps1" role="button" class="secondary" x-data x-text="$store.i18n.t('download_install')">
|
||||||
Download Install Script
|
Download Install Script
|
||||||
</a>
|
</a>
|
||||||
<a href="/printers/{{ printer.id }}/scripts/uninstall.ps1" role="button" class="secondary">
|
<a href="/printers/{{ printer.id }}/scripts/uninstall.ps1" role="button" class="secondary" x-data x-text="$store.i18n.t('download_uninstall')">
|
||||||
Download Uninstall Script
|
Download Uninstall Script
|
||||||
</a>
|
</a>
|
||||||
<a href="/printers/{{ printer.id }}/scripts/detect.ps1" role="button" class="secondary">
|
<a href="/printers/{{ printer.id }}/scripts/detect.ps1" role="button" class="secondary" x-data x-text="$store.i18n.t('download_detect')">
|
||||||
Download Detect Script
|
Download Detect Script
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<h2>Export</h2>
|
<h2 x-data x-text="$store.i18n.t('export_section')">Export</h2>
|
||||||
<a href="/printers/{{ printer.id }}/packages/ninja" role="button">Download NinjaRMM ZIP</a>
|
<a href="/printers/{{ printer.id }}/packages/ninja" role="button" x-data x-text="$store.i18n.t('download_ninja')">Download NinjaRMM ZIP</a>
|
||||||
<a href="/printers/{{ printer.id }}/packages/intunewin" role="button">Download .intunewin</a>
|
<a href="/printers/{{ printer.id }}/packages/intunewin" role="button" x-data x-text="$store.i18n.t('download_intunewin')">Download .intunewin</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h2>Icon</h2>
|
<h2 x-data x-text="$store.i18n.t('icon_section')">Icon</h2>
|
||||||
{% if has_icon %}
|
{% if has_icon %}
|
||||||
<p>Icon uploaded</p>
|
<p x-data x-text="$store.i18n.t('icon_uploaded')">Icon uploaded</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form hx-post="/printers/{{ printer.id }}/icon"
|
<form hx-post="/printers/{{ printer.id }}/icon"
|
||||||
hx-target="#icon-status" hx-swap="innerHTML"
|
hx-target="#icon-status" hx-swap="innerHTML"
|
||||||
enctype="multipart/form-data">
|
enctype="multipart/form-data">
|
||||||
<input type="file" name="file" accept="image/png" required>
|
<input type="file" name="file" accept="image/png" required>
|
||||||
<button type="submit">Upload Icon</button>
|
<button type="submit" x-data x-text="$store.i18n.t('upload_icon')">Upload Icon</button>
|
||||||
</form>
|
</form>
|
||||||
<div id="icon-status"></div>
|
<div id="icon-status"></div>
|
||||||
|
|
||||||
<a href="/printers" role="button" class="secondary">Back to Printers</a>
|
<a href="/printers" role="button" class="secondary" x-data x-text="$store.i18n.t('back_to_printers_btn')">Back to Printers</a>
|
||||||
</article>
|
</article>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Printers</h1>
|
<h1 x-data x-text="$store.i18n.t('printers')">Printers</h1>
|
||||||
|
|
||||||
<p><a href="/printers/new" role="button">Add Printer</a></p>
|
<p><a href="/printers/new" role="button" x-data x-text="$store.i18n.t('add_printer')">Add Printer</a></p>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Printer Library</h2>
|
<h2 x-data x-text="$store.i18n.t('printer_library')">Printer Library</h2>
|
||||||
{% include "partials/printer_list.html" %}
|
{% include "partials/printer_list.html" %}
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Add Printer</h1>
|
<h1 x-data x-text="$store.i18n.t('add_printer_title')">Add Printer</h1>
|
||||||
|
|
||||||
<p><a href="/printers">← Back to Printer Library</a></p>
|
<p><a href="/printers" x-data x-text="$store.i18n.t('back_to_printer_library')">← Back to Printer Library</a></p>
|
||||||
|
|
||||||
<div x-data="{ ip: '', port: '', portEdited: false }">
|
<div x-data="{ ip: '', port: '', portEdited: false }">
|
||||||
<form action="/printers" method="post">
|
<form action="/printers" method="post">
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
Printer Name
|
<span x-text="$store.i18n.t('printer_name')">Printer Name</span>
|
||||||
<input type="text" name="name" placeholder="e.g. HP LaserJet 4050" required>
|
<input type="text" name="name" placeholder="e.g. HP LaserJet 4050" required>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
IP Address
|
<span x-text="$store.i18n.t('ip_address')">IP Address</span>
|
||||||
<input type="text" name="ip_address"
|
<input type="text" name="ip_address"
|
||||||
x-model="ip"
|
x-model="ip"
|
||||||
@input="if (!portEdited) port = 'IP_' + ip.replaceAll('.', '_')"
|
@input="if (!portEdited) port = 'IP_' + ip.replaceAll('.', '_')"
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
Port Name
|
<span x-text="$store.i18n.t('port_name')">Port Name</span>
|
||||||
<input type="text" name="port_name"
|
<input type="text" name="port_name"
|
||||||
x-model="port"
|
x-model="port"
|
||||||
@change="portEdited = true"
|
@change="portEdited = true"
|
||||||
@@ -32,9 +32,9 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
Driver
|
<span x-text="$store.i18n.t('driver')">Driver</span>
|
||||||
<select name="driver_id" id="printer-form-driver-select">
|
<select name="driver_id" id="printer-form-driver-select">
|
||||||
<option value="">-- No driver --</option>
|
<option value="" x-text="$store.i18n.t('no_driver_option')">-- No driver --</option>
|
||||||
{% for item in driver_data %}
|
{% for item in driver_data %}
|
||||||
<option value="{{ item.driver.id }}">
|
<option value="{{ item.driver.id }}">
|
||||||
{{ item.driver.original_filename }} ({{ item.names | join(', ') }})
|
{{ item.driver.original_filename }} ({{ item.names | join(', ') }})
|
||||||
@@ -44,21 +44,21 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
Duplex Mode
|
<span x-text="$store.i18n.t('duplex_mode')">Duplex Mode</span>
|
||||||
<select name="duplex_mode">
|
<select name="duplex_mode">
|
||||||
<option value="OneSided" selected>One-Sided</option>
|
<option value="OneSided" selected x-text="$store.i18n.t('one_sided')">One-Sided</option>
|
||||||
<option value="LongEdge">Long Edge</option>
|
<option value="LongEdge" x-text="$store.i18n.t('long_edge')">Long Edge</option>
|
||||||
<option value="ShortEdge">Short Edge</option>
|
<option value="ShortEdge" x-text="$store.i18n.t('short_edge')">Short Edge</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="color_mode" value="on" checked>
|
<input type="checkbox" name="color_mode" value="on" checked>
|
||||||
Color Mode
|
<span x-text="$store.i18n.t('color_mode')">Color Mode</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
Paper Size
|
<span x-text="$store.i18n.t('paper_size')">Paper Size</span>
|
||||||
<select name="paper_size">
|
<select name="paper_size">
|
||||||
<option value="A4" selected>A4</option>
|
<option value="A4" selected>A4</option>
|
||||||
<option value="Letter">Letter</option>
|
<option value="Letter">Letter</option>
|
||||||
@@ -68,20 +68,20 @@
|
|||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="collate" value="on" checked>
|
<input type="checkbox" name="collate" value="on" checked>
|
||||||
Collate
|
<span x-text="$store.i18n.t('collate')">Collate</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
Client
|
<span x-text="$store.i18n.t('client')">Client</span>
|
||||||
<select name="client_id">
|
<select name="client_id">
|
||||||
<option value="">-- Unassigned --</option>
|
<option value="" x-text="$store.i18n.t('unassigned_option')">-- Unassigned --</option>
|
||||||
{% for c in clients %}
|
{% for c in clients %}
|
||||||
<option value="{{ c.id }}">{{ c.name }}</option>
|
<option value="{{ c.id }}">{{ c.name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<button type="submit">Save Printer</button>
|
<button type="submit" x-text="$store.i18n.t('save_printer')">Save Printer</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form hx-post="/drivers/upload"
|
<form hx-post="/drivers/upload"
|
||||||
@@ -90,10 +90,10 @@
|
|||||||
hx-swap="outerHTML">
|
hx-swap="outerHTML">
|
||||||
<input type="hidden" name="caller" value="printer_form">
|
<input type="hidden" name="caller" value="printer_form">
|
||||||
<label>
|
<label>
|
||||||
Upload New Driver
|
<span x-text="$store.i18n.t('upload_new_driver')">Upload New Driver</span>
|
||||||
<input type="file" name="file" accept=".zip" required>
|
<input type="file" name="file" accept=".zip" required>
|
||||||
</label>
|
</label>
|
||||||
<button type="submit" class="secondary">Upload Driver</button>
|
<button type="submit" class="secondary" x-text="$store.i18n.t('upload_driver')">Upload Driver</button>
|
||||||
</form>
|
</form>
|
||||||
<div id="driver-list" style="display:none"></div>
|
<div id="driver-list" style="display:none"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -306,9 +306,9 @@ def test_printers_library_no_form(client: TestClient) -> None:
|
|||||||
resp = client.get("/printers")
|
resp = client.get("/printers")
|
||||||
assert resp.status_code == 200
|
assert resp.status_code == 200
|
||||||
html = resp.text
|
html = resp.text
|
||||||
# The inline form must be gone
|
# The inline form must be gone — check for the actual form element, not UI label strings
|
||||||
assert 'hx-post="/printers"' not in html
|
assert 'hx-post="/printers"' not in html
|
||||||
assert "Save Printer" not in html
|
assert 'action="/printers" method="post"' not in html
|
||||||
|
|
||||||
|
|
||||||
def test_patch_printer(client: TestClient) -> None:
|
def test_patch_printer(client: TestClient) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user