- Show custom field values in asset list, dashboard and list Excel export - New status flag to exclude assets (e.g. scrapped) from MeshCentral sync - Require a secure SESSION_SECRET with a readable startup message - Add SESSION_COOKIE_SECURE and refresh session permissions per request - Translate HTTP errors and remaining fixed UI texts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
3.2 KiB
HTML
Executable File
80 lines
3.2 KiB
HTML
Executable File
{% extends "base.html" %}
|
|
{% block content %}
|
|
<div class="toolbar">
|
|
<h1>{{ t('assets.import_title') }}</h1>
|
|
<div class="toolbar-actions"><a class="button button-secondary" href="/assets">← {{ t('assets.import.back_to_list') }}</a></div>
|
|
</div>
|
|
|
|
<section class="panel">
|
|
<form method="post" action="/assets/import" enctype="multipart/form-data">
|
|
<label>{{ t('common.category') }}
|
|
<select name="category_id" required>
|
|
{% for category in categories %}
|
|
<option value="{{ category.id }}" {% if selected and selected.id == category.id %}selected{% endif %}>{{ category.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</label>
|
|
|
|
{% if selected %}
|
|
<p><a class="button button-secondary" href="/assets/import/template.xlsx?category_id={{ selected.id }}">{{ t('assets.import_template') }}</a></p>
|
|
{% endif %}
|
|
|
|
<label>{{ t('assets.import_file') }}
|
|
<input type="file" name="file" accept=".xlsx" required>
|
|
</label>
|
|
|
|
<label class="checkbox-label">
|
|
<input class="checkbox" type="checkbox" name="import_only_active_fields" {% if import_only_active_fields %}checked{% endif %}>
|
|
{{ t('assets.import_only_active') }}
|
|
</label>
|
|
<p class="muted">{{ t('assets.import_only_active_help') }}</p>
|
|
|
|
<div class="form-actions">
|
|
<button type="submit" class="button button-secondary" name="import_mode" value="dry_run">🧪 {{ t('assets.import.dry_run') }}</button>
|
|
<button type="submit" class="button button-save" name="import_mode" value="import">{{ t('assets.import_start') }}</button>
|
|
</div>
|
|
<p class="muted">{{ t('assets.import.dry_run_help') }}</p>
|
|
</form>
|
|
</section>
|
|
|
|
{% if result %}
|
|
<section class="panel">
|
|
<h2>{% if result.dry_run %}{{ t('assets.import.dry_run_result') }}{% else %}{{ t('assets.import.result') }}{% endif %}</h2>
|
|
{% if result.dry_run %}
|
|
<div class="notice"><strong>{{ t('assets.import.dry_run_label') }}</strong> {{ t('assets.import.dry_run_notice') }}</div>
|
|
{% endif %}
|
|
<dl class="config-list">
|
|
<dt>{{ t('assets.import.created') }}</dt><dd>{{ result.created }}</dd>
|
|
<dt>{{ t('assets.import.updated') }}</dt><dd>{{ result.updated }}</dd>
|
|
<dt>{{ t('assets.import.unchanged') }}</dt><dd>{{ result.skipped }}</dd>
|
|
</dl>
|
|
{% if result.unknown_headers %}
|
|
<h3>{{ t('assets.import.unknown_columns') }}</h3>
|
|
<p>{{ result.unknown_headers|join(', ') }}</p>
|
|
{% endif %}
|
|
{% if result.row_results %}
|
|
<h3>{{ t('assets.import.row_results') }}</h3>
|
|
<div class="table-scroll">
|
|
<table class="data-table">
|
|
<thead><tr><th>{{ t('assets.import.excel_row') }}</th><th>{{ t('assets.asset_id') }}</th><th>{{ t('jobs.action') }}</th><th>{{ t('assets.import.reason') }}</th></tr></thead>
|
|
<tbody>
|
|
{% for row in result.row_results %}
|
|
<tr>
|
|
<td>{{ row.row }}</td>
|
|
<td>{{ row.asset_id }}</td>
|
|
<td>{{ row.action }}</td>
|
|
<td>{{ row.reason }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
{% if result.errors %}
|
|
<h3>{{ t('assets.import.error_summary') }}</h3>
|
|
<ul>{% for error in result.errors %}<li>{{ error }}</li>{% endfor %}</ul>
|
|
{% endif %}
|
|
</section>
|
|
{% endif %}
|
|
{% endblock %}
|