Improve bulk import UI: split active/history jobs, fix text visibility, add match highlighting

- Split manage page into Active Jobs and History sections
- Fix source keyword text color (remove text-muted for better visibility)
- Add exact match indicators: green check badge when name or MPN matches
- Add translation keys for new UI elements
This commit is contained in:
Sebastian Almberg 2026-03-12 08:02:51 +01:00
parent 3819cb07e3
commit 55025a8a8f
4 changed files with 183 additions and 97 deletions

View file

@ -303,9 +303,23 @@ class BulkInfoProviderImportController extends AbstractController
}
}
// Refetch after cleanup and split into active vs finished
$allJobs = $this->entityManager->getRepository(BulkInfoProviderImportJob::class)
->findBy([], ['createdAt' => 'DESC']);
$activeJobs = [];
$finishedJobs = [];
foreach ($allJobs as $job) {
if ($job->isCompleted() || $job->isFailed() || $job->isStopped()) {
$finishedJobs[] = $job;
} else {
$activeJobs[] = $job;
}
}
return $this->render('info_providers/bulk_import/manage.html.twig', [
'jobs' => $this->entityManager->getRepository(BulkInfoProviderImportJob::class)
->findBy([], ['createdAt' => 'DESC']) // Refetch after cleanup
'active_jobs' => $activeJobs,
'finished_jobs' => $finishedJobs,
]);
}

View file

@ -22,103 +22,143 @@
</p>
</div>
{% if jobs is not empty %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans %}info_providers.bulk_import.job_name{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.parts_count{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.results_count{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.progress{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.status{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.created_by{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.created_at{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.completed_at{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.action.label{% endtrans %}</th>
</tr>
</thead>
<tbody>
{% for job in jobs %}
<tr>
<td>
<strong>{{ job.displayNameKey|trans(job.displayNameParams) }} - {{ job.formattedTimestamp }}</strong>
{% if job.isInProgress %}
<span class="badge bg-info ms-2">Active</span>
{% endif %}
</td>
<td>{{ job.partCount }}</td>
<td>{{ job.resultCount }}</td>
<td>
<div class="d-flex align-items-center">
<div class="progress me-2" style="width: 80px; height: 12px;">
<div class="progress-bar {% if job.isCompleted %}bg-success{% elseif job.isFailed %}bg-danger{% else %}bg-info{% endif %}"
role="progressbar"
style="width: {{ job.progressPercentage }}%"
aria-valuenow="{{ job.progressPercentage }}"
aria-valuemin="0" aria-valuemax="100">
</div>
</div>
<small class="text-muted">{{ job.progressPercentage }}%</small>
</div>
<small class="text-muted">
{% trans with {'%current%': job.completedPartsCount + job.skippedPartsCount, '%total%': job.partCount} %}info_providers.bulk_import.progress_label{% endtrans %}
</small>
</td>
<td>
{% if job.isPending %}
<span class="badge bg-warning">{% trans %}info_providers.bulk_import.status.pending{% endtrans %}</span>
{% elseif job.isInProgress %}
<span class="badge bg-info">{% trans %}info_providers.bulk_import.status.in_progress{% endtrans %}</span>
{% elseif job.isCompleted %}
<span class="badge bg-success">{% trans %}info_providers.bulk_import.status.completed{% endtrans %}</span>
{% elseif job.isStopped %}
<span class="badge bg-secondary">{% trans %}info_providers.bulk_import.status.stopped{% endtrans %}</span>
{% elseif job.isFailed %}
<span class="badge bg-danger">{% trans %}info_providers.bulk_import.status.failed{% endtrans %}</span>
{% endif %}
</td>
<td>{{ job.createdBy.fullName(true) }}</td>
<td>{{ job.createdAt|format_datetime('short') }}</td>
<td>
{% if job.completedAt %}
{{ job.completedAt|format_datetime('short') }}
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
<td>
<div class="btn-group btn-group-sm" role="group">
{% if job.isInProgress or job.isCompleted or job.isStopped %}
<a href="{{ path('bulk_info_provider_step2', {'jobId': job.id}) }}" class="btn btn-primary">
<i class="fas fa-eye"></i> {% trans %}info_providers.bulk_import.view_results{% endtrans %}
</a>
{% endif %}
{% if job.canBeStopped %}
<button type="button" class="btn btn-warning" data-action="click->bulk-job-manage#stopJob" data-job-id="{{ job.id }}">
<i class="fas fa-stop"></i> {% trans %}info_providers.bulk_import.action.stop{% endtrans %}
</button>
{% endif %}
{% if job.isCompleted or job.isFailed or job.isStopped %}
<button type="button" class="btn btn-danger" data-action="click->bulk-job-manage#deleteJob" data-job-id="{{ job.id }}">
<i class="fas fa-trash"></i> {% trans %}info_providers.bulk_import.action.delete{% endtrans %}
</button>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
{% if active_jobs is empty and finished_jobs is empty %}
<div class="alert alert-info" role="alert">
<i class="fas fa-info-circle"></i>
{% trans %}info_providers.bulk_import.no_jobs_found{% endtrans %}<br>
{% trans %}info_providers.bulk_import.create_first_job{% endtrans %}
</div>
{% else %}
{# Active Jobs #}
{% if active_jobs is not empty %}
<h5 class="mb-3">
<i class="fas fa-spinner fa-pulse me-1"></i> {% trans %}info_providers.bulk_import.active_jobs{% endtrans %}
<span class="badge bg-primary">{{ active_jobs|length }}</span>
</h5>
<div class="table-responsive mb-4">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans %}info_providers.bulk_import.job_name{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.parts_count{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.results_count{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.progress{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.status{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.created_by{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.created_at{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.action.label{% endtrans %}</th>
</tr>
</thead>
<tbody>
{% for job in active_jobs %}
{{ _self.job_row(job) }}
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{# Finished Jobs (History) #}
{% if finished_jobs is not empty %}
<h5 class="mb-3">
<i class="fas fa-history me-1"></i> {% trans %}info_providers.bulk_import.finished_jobs{% endtrans %}
<span class="badge bg-secondary">{{ finished_jobs|length }}</span>
</h5>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans %}info_providers.bulk_import.job_name{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.parts_count{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.results_count{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.progress{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.status{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.created_by{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.created_at{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.completed_at{% endtrans %}</th>
<th>{% trans %}info_providers.bulk_import.action.label{% endtrans %}</th>
</tr>
</thead>
<tbody>
{% for job in finished_jobs %}
{{ _self.job_row(job, true) }}
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% endif %}
</div>
{% endblock %}
{% macro job_row(job, showCompletedAt) %}
{% set showCompletedAt = showCompletedAt|default(false) %}
<tr>
<td>
<strong>{{ job.displayNameKey|trans(job.displayNameParams) }} - {{ job.formattedTimestamp }}</strong>
</td>
<td>{{ job.partCount }}</td>
<td>{{ job.resultCount }}</td>
<td>
<div class="d-flex align-items-center">
<div class="progress me-2" style="width: 80px; height: 12px;">
<div class="progress-bar {% if job.isCompleted %}bg-success{% elseif job.isFailed %}bg-danger{% else %}bg-info{% endif %}"
role="progressbar"
style="width: {{ job.progressPercentage }}%"
aria-valuenow="{{ job.progressPercentage }}"
aria-valuemin="0" aria-valuemax="100">
</div>
</div>
<small class="text-muted">{{ job.progressPercentage }}%</small>
</div>
<small class="text-muted">
{% trans with {'%current%': job.completedPartsCount + job.skippedPartsCount, '%total%': job.partCount} %}info_providers.bulk_import.progress_label{% endtrans %}
</small>
</td>
<td>
{% if job.isPending %}
<span class="badge bg-warning">{% trans %}info_providers.bulk_import.status.pending{% endtrans %}</span>
{% elseif job.isInProgress %}
<span class="badge bg-info">{% trans %}info_providers.bulk_import.status.in_progress{% endtrans %}</span>
{% elseif job.isCompleted %}
<span class="badge bg-success">{% trans %}info_providers.bulk_import.status.completed{% endtrans %}</span>
{% elseif job.isStopped %}
<span class="badge bg-secondary">{% trans %}info_providers.bulk_import.status.stopped{% endtrans %}</span>
{% elseif job.isFailed %}
<span class="badge bg-danger">{% trans %}info_providers.bulk_import.status.failed{% endtrans %}</span>
{% endif %}
</td>
<td>{{ job.createdBy.fullName(true) }}</td>
<td>{{ job.createdAt|format_datetime('short') }}</td>
{% if showCompletedAt %}
<td>
{% if job.completedAt %}
{{ job.completedAt|format_datetime('short') }}
{% else %}
<span class="text-muted">-</span>
{% endif %}
</td>
{% endif %}
<td>
<div class="btn-group btn-group-sm" role="group">
{% if job.isInProgress or job.isCompleted or job.isStopped %}
<a href="{{ path('bulk_info_provider_step2', {'jobId': job.id}) }}" class="btn btn-primary">
<i class="fas fa-eye"></i> {% trans %}info_providers.bulk_import.view_results{% endtrans %}
</a>
{% endif %}
{% if job.canBeStopped %}
<button type="button" class="btn btn-warning" data-action="click->bulk-job-manage#stopJob" data-job-id="{{ job.id }}">
<i class="fas fa-stop"></i> {% trans %}info_providers.bulk_import.action.stop{% endtrans %}
</button>
{% endif %}
{% if job.isCompleted or job.isFailed or job.isStopped %}
<button type="button" class="btn btn-danger" data-action="click->bulk-job-manage#deleteJob" data-job-id="{{ job.id }}">
<i class="fas fa-trash"></i> {% trans %}info_providers.bulk_import.action.delete{% endtrans %}
</button>
{% endif %}
</div>
</td>
</tr>
{% endmacro %}

View file

@ -220,13 +220,21 @@
class="hoverpic" style="max-width: 35px;" {{ stimulus_controller('elements/hoverpic') }}>
</td>
<td>
{% set nameMatch = dto.name is not null and part.name is not null and dto.name|lower == part.name|lower %}
{% set mpnMatch = dto.mpn is not null and part.manufacturerProductNumber is not null and dto.mpn|lower == part.manufacturerProductNumber|lower %}
{% if dto.provider_url is not null %}
<a href="{{ dto.provider_url }}" target="_blank" rel="noopener">{{ dto.name }}</a>
<a href="{{ dto.provider_url }}" target="_blank" rel="noopener"{% if nameMatch %} class="fw-bold"{% endif %}>{{ dto.name }}</a>
{% else %}
{{ dto.name }}
<span{% if nameMatch %} class="fw-bold"{% endif %}>{{ dto.name }}</span>
{% endif %}
{% if nameMatch %}
<span class="badge bg-success ms-1" title="{% trans %}info_providers.bulk_import.exact_match{% endtrans %}"><i class="fas fa-check-circle"></i></span>
{% endif %}
{% if dto.mpn is not null %}
<br><small class="text-muted">{{ dto.mpn }}</small>
<br><small{% if mpnMatch %} class="fw-bold text-success"{% else %} class="text-muted"{% endif %}>{{ dto.mpn }}</small>
{% if mpnMatch %}
<span class="badge bg-success ms-1" style="font-size: 0.65em;" title="{% trans %}info_providers.bulk_import.mpn_match{% endtrans %}">MPN <i class="fas fa-check-circle"></i></span>
{% endif %}
{% endif %}
</td>
<td>{{ dto.description }}</td>
@ -238,8 +246,8 @@
<td>
<span class="badge bg-info">{{ result.sourceField ?? 'unknown' }}</span>
{% if result.sourceKeyword %}
<br><small class="text-muted">{{ result.sourceKeyword }}</small>
{% endif %}
<br><small>{{ result.sourceKeyword }}</small>
{% endif %}
</td>
<td>
<div class="btn-group-vertical btn-group-sm" role="group">

View file

@ -11133,6 +11133,30 @@ Please note, that you can not impersonate a disabled user. If you try you will g
<target>Top</target>
</segment>
</unit>
<unit id="exact_match_badge" name="info_providers.bulk_import.exact_match">
<segment state="translated">
<source>info_providers.bulk_import.exact_match</source>
<target>Exact name match</target>
</segment>
</unit>
<unit id="mpn_match_badge" name="info_providers.bulk_import.mpn_match">
<segment state="translated">
<source>info_providers.bulk_import.mpn_match</source>
<target>MPN matches</target>
</segment>
</unit>
<unit id="active_jobs_header" name="info_providers.bulk_import.active_jobs">
<segment state="translated">
<source>info_providers.bulk_import.active_jobs</source>
<target>Active Jobs</target>
</segment>
</unit>
<unit id="finished_jobs_header" name="info_providers.bulk_import.finished_jobs">
<segment state="translated">
<source>info_providers.bulk_import.finished_jobs</source>
<target>History</target>
</segment>
</unit>
<unit id="quick_apply_btn" name="info_providers.bulk_import.quick_apply">
<segment state="translated">
<source>info_providers.bulk_import.quick_apply</source>