mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-05-16 00:11:35 +00:00
Fix spinning icon, text visibility, auto-priority, and SPN match highlighting
- Replace spinning icon with static icon on Active Jobs header - Match highlighting now checks source keyword against name, MPN, AND provider ID (SPN) - Show green "Match" badge in source field column when any field matches 100% - Auto-increment priority when adding new field mapping rows - Fix text-muted visibility issues on table-success background
This commit is contained in:
parent
55025a8a8f
commit
49b97fc077
4 changed files with 48 additions and 6 deletions
|
|
@ -70,6 +70,13 @@ export default class extends Controller {
|
||||||
newFieldSelect.addEventListener('change', this.updateFieldOptions.bind(this))
|
newFieldSelect.addEventListener('change', this.updateFieldOptions.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto-increment priority based on existing mappings
|
||||||
|
const nextPriority = this.getNextPriority()
|
||||||
|
const priorityInput = newRow.querySelector('input[name*="[priority]"]')
|
||||||
|
if (priorityInput) {
|
||||||
|
priorityInput.value = nextPriority
|
||||||
|
}
|
||||||
|
|
||||||
this.updateFieldOptions()
|
this.updateFieldOptions()
|
||||||
this.updateAddButtonState()
|
this.updateAddButtonState()
|
||||||
}
|
}
|
||||||
|
|
@ -119,6 +126,18 @@ export default class extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getNextPriority() {
|
||||||
|
const priorityInputs = this.tbodyTarget.querySelectorAll('input[name*="[priority]"]')
|
||||||
|
let maxPriority = 0
|
||||||
|
priorityInputs.forEach(input => {
|
||||||
|
const val = parseInt(input.value, 10)
|
||||||
|
if (!isNaN(val) && val > maxPriority) {
|
||||||
|
maxPriority = val
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return Math.min(maxPriority + 1, 10)
|
||||||
|
}
|
||||||
|
|
||||||
handleFormSubmit(event) {
|
handleFormSubmit(event) {
|
||||||
if (this.hasSubmitButtonTarget) {
|
if (this.hasSubmitButtonTarget) {
|
||||||
this.submitButtonTarget.disabled = true
|
this.submitButtonTarget.disabled = true
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
{# Active Jobs #}
|
{# Active Jobs #}
|
||||||
{% if active_jobs is not empty %}
|
{% if active_jobs is not empty %}
|
||||||
<h5 class="mb-3">
|
<h5 class="mb-3">
|
||||||
<i class="fas fa-spinner fa-pulse me-1"></i> {% trans %}info_providers.bulk_import.active_jobs{% endtrans %}
|
<i class="fas fa-tasks me-1"></i> {% trans %}info_providers.bulk_import.active_jobs{% endtrans %}
|
||||||
<span class="badge bg-primary">{{ active_jobs|length }}</span>
|
<span class="badge bg-primary">{{ active_jobs|length }}</span>
|
||||||
</h5>
|
</h5>
|
||||||
<div class="table-responsive mb-4">
|
<div class="table-responsive mb-4">
|
||||||
|
|
|
||||||
|
|
@ -220,8 +220,12 @@
|
||||||
class="hoverpic" style="max-width: 35px;" {{ stimulus_controller('elements/hoverpic') }}>
|
class="hoverpic" style="max-width: 35px;" {{ stimulus_controller('elements/hoverpic') }}>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% set nameMatch = dto.name is not null and part.name is not null and dto.name|lower == part.name|lower %}
|
{# Check for matches against source keyword (what was searched) #}
|
||||||
{% set mpnMatch = dto.mpn is not null and part.manufacturerProductNumber is not null and dto.mpn|lower == part.manufacturerProductNumber|lower %}
|
{% set sourceKw = result.sourceKeyword|default('')|lower %}
|
||||||
|
{% set nameMatch = sourceKw is not empty and dto.name is not null and dto.name|lower == sourceKw %}
|
||||||
|
{% set mpnMatch = sourceKw is not empty and dto.mpn is not null and dto.mpn|lower == sourceKw %}
|
||||||
|
{% set spnMatch = sourceKw is not empty and dto.provider_id is not null and dto.provider_id|lower == sourceKw %}
|
||||||
|
{% set anyMatch = nameMatch or mpnMatch or spnMatch %}
|
||||||
{% if dto.provider_url is not null %}
|
{% if dto.provider_url is not null %}
|
||||||
<a href="{{ dto.provider_url }}" target="_blank" rel="noopener"{% if nameMatch %} class="fw-bold"{% endif %}>{{ dto.name }}</a>
|
<a href="{{ dto.provider_url }}" target="_blank" rel="noopener"{% if nameMatch %} class="fw-bold"{% endif %}>{{ dto.name }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
@ -231,7 +235,7 @@
|
||||||
<span class="badge bg-success ms-1" title="{% trans %}info_providers.bulk_import.exact_match{% endtrans %}"><i class="fas fa-check-circle"></i></span>
|
<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 %}
|
{% endif %}
|
||||||
{% if dto.mpn is not null %}
|
{% if dto.mpn is not null %}
|
||||||
<br><small{% if mpnMatch %} class="fw-bold text-success"{% else %} class="text-muted"{% endif %}>{{ dto.mpn }}</small>
|
<br><small{% if mpnMatch %} class="fw-bold text-success"{% endif %}>{{ dto.mpn }}</small>
|
||||||
{% if mpnMatch %}
|
{% 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>
|
<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 %}
|
||||||
|
|
@ -241,10 +245,17 @@
|
||||||
<td>{{ dto.manufacturer ?? '' }}</td>
|
<td>{{ dto.manufacturer ?? '' }}</td>
|
||||||
<td>
|
<td>
|
||||||
{{ info_provider_label(dto.provider_key)|default(dto.provider_key) }}
|
{{ info_provider_label(dto.provider_key)|default(dto.provider_key) }}
|
||||||
<br><small class="text-muted">{{ dto.provider_id }}</small>
|
<br><small{% if spnMatch %} class="fw-bold text-success"{% endif %}>{{ dto.provider_id }}</small>
|
||||||
|
{% if spnMatch %}
|
||||||
|
<span class="badge bg-success ms-1" style="font-size: 0.65em;" title="{% trans %}info_providers.bulk_import.spn_match{% endtrans %}">SPN <i class="fas fa-check-circle"></i></span>
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="badge bg-info">{{ result.sourceField ?? 'unknown' }}</span>
|
{% if anyMatch %}
|
||||||
|
<span class="badge bg-success">{% trans %}info_providers.bulk_import.match{% endtrans %}</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="badge bg-info">{{ result.sourceField ?? 'unknown' }}</span>
|
||||||
|
{% endif %}
|
||||||
{% if result.sourceKeyword %}
|
{% if result.sourceKeyword %}
|
||||||
<br><small>{{ result.sourceKeyword }}</small>
|
<br><small>{{ result.sourceKeyword }}</small>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -11157,6 +11157,18 @@ Please note, that you can not impersonate a disabled user. If you try you will g
|
||||||
<target>History</target>
|
<target>History</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id="spn_match_badge" name="info_providers.bulk_import.spn_match">
|
||||||
|
<segment state="translated">
|
||||||
|
<source>info_providers.bulk_import.spn_match</source>
|
||||||
|
<target>SPN matches</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="match_badge" name="info_providers.bulk_import.match">
|
||||||
|
<segment state="translated">
|
||||||
|
<source>info_providers.bulk_import.match</source>
|
||||||
|
<target>Match</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
<unit id="quick_apply_btn" name="info_providers.bulk_import.quick_apply">
|
<unit id="quick_apply_btn" name="info_providers.bulk_import.quick_apply">
|
||||||
<segment state="translated">
|
<segment state="translated">
|
||||||
<source>info_providers.bulk_import.quick_apply</source>
|
<source>info_providers.bulk_import.quick_apply</source>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue