mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 02:59:29 +00:00
Fixed step2 template
This commit is contained in:
parent
710569daaf
commit
1d38c50abc
2 changed files with 29 additions and 20 deletions
|
|
@ -24,12 +24,13 @@ namespace App\Services\InfoProviderSystem\DTOs;
|
||||||
|
|
||||||
use App\Entity\Parts\Part;
|
use App\Entity\Parts\Part;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Traversable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the complete response from a bulk info provider search operation.
|
* Represents the complete response from a bulk info provider search operation.
|
||||||
* It contains a list of PartSearchResultDTOs, one for each part searched.
|
* It contains a list of PartSearchResultDTOs, one for each part searched.
|
||||||
*/
|
*/
|
||||||
readonly class BulkSearchResponseDTO implements \ArrayAccess
|
readonly class BulkSearchResponseDTO implements \ArrayAccess, \IteratorAggregate
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param BulkSearchPartResultsDTO[] $partResults Array of search results for each part
|
* @param BulkSearchPartResultsDTO[] $partResults Array of search results for each part
|
||||||
|
|
@ -216,4 +217,9 @@ readonly class BulkSearchResponseDTO implements \ArrayAccess
|
||||||
{
|
{
|
||||||
throw new \LogicException('BulkSearchResponseDTO is immutable.');
|
throw new \LogicException('BulkSearchResponseDTO is immutable.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getIterator(): Traversable
|
||||||
|
{
|
||||||
|
return new \ArrayIterator($this->partResults);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@
|
||||||
<div>
|
<div>
|
||||||
<h5 class="mb-1">{{ job.displayNameKey|trans(job.displayNameParams) }} - {{ job.formattedTimestamp }}</h5>
|
<h5 class="mb-1">{{ job.displayNameKey|trans(job.displayNameParams) }} - {{ job.formattedTimestamp }}</h5>
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
{{ job.partCount }} {% trans %}info_providers.bulk_import.parts{% endtrans %} •
|
{{ job.partCount }} {% trans %}info_providers.bulk_import.parts{% endtrans %} •
|
||||||
{{ job.resultCount }} {% trans %}info_providers.bulk_import.results{% endtrans %} •
|
{{ job.resultCount }} {% trans %}info_providers.bulk_import.results{% endtrans %} •
|
||||||
{% trans %}info_providers.bulk_import.created_at{% endtrans %}: {{ job.createdAt|date('Y-m-d H:i') }}
|
{% trans %}info_providers.bulk_import.created_at{% endtrans %}: {{ job.createdAt|date('Y-m-d H:i') }}
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -52,14 +52,14 @@
|
||||||
<span data-bulk-import-target="progressText">{{ job.completedPartsCount }} / {{ job.partCount }} completed</span>
|
<span data-bulk-import-target="progressText">{{ job.completedPartsCount }} / {{ job.partCount }} completed</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="progress" style="height: 8px;">
|
<div class="progress" style="height: 8px;">
|
||||||
<div data-bulk-import-target="progressBar" class="progress-bar" role="progressbar"
|
<div data-bulk-import-target="progressBar" class="progress-bar" role="progressbar"
|
||||||
style="width: {{ job.progressPercentage }}%"
|
style="width: {{ job.progressPercentage }}%"
|
||||||
aria-valuenow="{{ job.progressPercentage }}" aria-valuemin="0" aria-valuemax="100">
|
aria-valuenow="{{ job.progressPercentage }}" aria-valuemin="0" aria-valuemax="100">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between mt-2">
|
<div class="d-flex justify-content-between mt-2">
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
<span id="completed-count">{{ job.completedPartsCount }}</span> {% trans %}info_providers.bulk_import.completed{% endtrans %} •
|
<span id="completed-count">{{ job.completedPartsCount }}</span> {% trans %}info_providers.bulk_import.completed{% endtrans %} •
|
||||||
<span id="skipped-count">{{ job.skippedPartsCount }}</span> {% trans %}info_providers.bulk_import.skipped{% endtrans %}
|
<span id="skipped-count">{{ job.skippedPartsCount }}</span> {% trans %}info_providers.bulk_import.skipped{% endtrans %}
|
||||||
</small>
|
</small>
|
||||||
<small class="text-muted"><span id="progress-percentage">{{ job.progressPercentage }}%</span></small>
|
<small class="text-muted"><span id="progress-percentage">{{ job.progressPercentage }}%</span></small>
|
||||||
|
|
@ -89,7 +89,7 @@
|
||||||
<small class="text-muted">{% trans %}info_providers.bulk_import.research.description{% endtrans %}</small>
|
<small class="text-muted">{% trans %}info_providers.bulk_import.research.description{% endtrans %}</small>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button type="button" class="btn btn-outline-primary btn-sm me-2"
|
<button type="button" class="btn btn-outline-primary btn-sm me-2"
|
||||||
data-action="click->bulk-import#researchAllParts"
|
data-action="click->bulk-import#researchAllParts"
|
||||||
id="research-all-btn">
|
id="research-all-btn">
|
||||||
<span class="spinner-border spinner-border-sm me-1" style="display: none;" id="research-all-spinner"></span>
|
<span class="spinner-border spinner-border-sm me-1" style="display: none;" id="research-all-spinner"></span>
|
||||||
|
|
@ -101,11 +101,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% for part_result in search_results %}
|
{% for part_result in search_results %}
|
||||||
|
{# @var part_result \App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultsDTO #}
|
||||||
|
|
||||||
{% set part = part_result.part %}
|
{% set part = part_result.part %}
|
||||||
{% set isCompleted = job.isPartCompleted(part.id) %}
|
{% set isCompleted = job.isPartCompleted(part.id) %}
|
||||||
{% set isSkipped = job.isPartSkipped(part.id) %}
|
{% set isSkipped = job.isPartSkipped(part.id) %}
|
||||||
<div class="card mb-3 {% if isCompleted %}border-success{% elseif isSkipped %}border-warning{% endif %}"
|
<div class="card mb-3 {% if isCompleted %}border-success{% elseif isSkipped %}border-warning{% endif %}"
|
||||||
data-part-id="{{ part.id }}"
|
data-part-id="{{ part.id }}"
|
||||||
{% if isCompleted %}style="background-color: rgba(25, 135, 84, 0.1);"{% endif %}>
|
{% if isCompleted %}style="background-color: rgba(25, 135, 84, 0.1);"{% endif %}>
|
||||||
<div class="card-header d-flex justify-content-between align-items-center">
|
<div class="card-header d-flex justify-content-between align-items-center">
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -125,12 +127,12 @@
|
||||||
{% if part_result.errors is not empty %}
|
{% if part_result.errors is not empty %}
|
||||||
<span class="badge bg-danger">{% trans with {'%count%': part_result.errors|length} %}info_providers.bulk_import.errors{% endtrans %}</span>
|
<span class="badge bg-danger">{% trans with {'%count%': part_result.errors|length} %}info_providers.bulk_import.errors{% endtrans %}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="badge bg-info">{% trans with {'%count%': part_result.search_results|length} %}info_providers.bulk_import.results_found{% endtrans %}</span>
|
<span class="badge bg-info">{% trans with {'%count%': part_result.searchResults|length} %}info_providers.bulk_import.results_found{% endtrans %}</span>
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
<button type="button" class="btn btn-outline-info btn-sm"
|
<button type="button" class="btn btn-outline-info btn-sm"
|
||||||
data-action="click->bulk-import#researchPart"
|
data-action="click->bulk-import#researchPart"
|
||||||
data-part-id="{{ part.id }}"
|
data-part-id="{{ part.id }}"
|
||||||
title="{% trans %}info_providers.bulk_import.research.part_tooltip{% endtrans %}">
|
title="{% trans %}info_providers.bulk_import.research.part_tooltip{% endtrans %}">
|
||||||
<span class="spinner-border spinner-border-sm me-1" style="display: none;" data-research-spinner="{{ part.id }}"></span>
|
<span class="spinner-border spinner-border-sm me-1" style="display: none;" data-research-spinner="{{ part.id }}"></span>
|
||||||
|
|
@ -163,8 +165,8 @@
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if part_result.search_results|length > 0 %}
|
{% if part_result.searchResults|length > 0 %}
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-sm">
|
<table class="table table-sm">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
@ -179,13 +181,14 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for result in part_result.search_results %}
|
{% for result in part_result.searchResults %}
|
||||||
{% set dto = result.dto %}
|
{# @var result \App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultDTO #}
|
||||||
|
{% set dto = result.searchResult %}
|
||||||
{% set localPart = result.localPart %}
|
{% set localPart = result.localPart %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<img src="{{ dto.preview_image_url }}" data-thumbnail="{{ dto.preview_image_url }}"
|
<img src="{{ dto.preview_image_url }}" data-thumbnail="{{ dto.preview_image_url }}"
|
||||||
class="hoverpic" style="max-width: 30px;" {{ stimulus_controller('elements/hoverpic') }}>
|
class="hoverpic" style="max-width: 35px;" {{ stimulus_controller('elements/hoverpic') }}>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if dto.provider_url is not null %}
|
{% if dto.provider_url is not null %}
|
||||||
|
|
@ -204,9 +207,9 @@
|
||||||
<br><small class="text-muted">{{ dto.provider_id }}</small>
|
<br><small class="text-muted">{{ dto.provider_id }}</small>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="badge bg-info">{{ result.source_field ?? 'unknown' }}</span>
|
<span class="badge bg-info">{{ result.sourceField ?? 'unknown' }}</span>
|
||||||
{% if result.source_keyword %}
|
{% if result.sourceKeyword %}
|
||||||
<br><small class="text-muted">{{ result.source_keyword }}</small>
|
<br><small class="text-muted">{{ result.sourceKeyword }}</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue