Clean up suppressions.html: standardise pill attribute and remove inline onclick
Lint / Python (flake8) (push) Failing after 1m26s
Lint / JS (eslint) (push) Successful in 12s
Security / Python Security (bandit) (push) Failing after 1m59s
Test / Python Tests (pytest) (push) Successful in 53s
Lint / Notify on failure (push) Successful in 2s
Lint / Deploy (push) Has been skipped
Lint / Python (flake8) (push) Failing after 1m26s
Lint / JS (eslint) (push) Successful in 12s
Security / Python Security (bandit) (push) Failing after 1m59s
Test / Python Tests (pytest) (push) Successful in 53s
Lint / Notify on failure (push) Successful in 2s
Lint / Deploy (push) Has been skipped
- Rename data-dur → data-duration to match index.html/app.js convention
- Replace onclick="removeSuppression({{ s.id }})" with data-action="remove-sup" data-sup-id delegation
- Scope pill delegation to #create-suppression-form to avoid cross-page conflicts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -51,11 +51,11 @@
|
|||||||
<div class="lt-form-group">
|
<div class="lt-form-group">
|
||||||
<label class="lt-label">Duration</label>
|
<label class="lt-label">Duration</label>
|
||||||
<div class="duration-pills">
|
<div class="duration-pills">
|
||||||
<button type="button" class="pill" data-dur="30">30 min</button>
|
<button type="button" class="pill" data-duration="30">30 min</button>
|
||||||
<button type="button" class="pill" data-dur="60">1 hr</button>
|
<button type="button" class="pill" data-duration="60">1 hr</button>
|
||||||
<button type="button" class="pill" data-dur="240">4 hr</button>
|
<button type="button" class="pill" data-duration="240">4 hr</button>
|
||||||
<button type="button" class="pill" data-dur="480">8 hr</button>
|
<button type="button" class="pill" data-duration="480">8 hr</button>
|
||||||
<button type="button" class="pill pill-manual active" data-dur="">Manual ∞</button>
|
<button type="button" class="pill pill-manual active" data-duration="">Manual ∞</button>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" id="s-expires" name="expires_minutes" value="">
|
<input type="hidden" id="s-expires" name="expires_minutes" value="">
|
||||||
<div class="lt-field-hint" id="s-dur-hint">Persists until manually removed.</div>
|
<div class="lt-field-hint" id="s-dur-hint">Persists until manually removed.</div>
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
<td class="ts-cell">{{ s.created_at }}</td>
|
<td class="ts-cell">{{ s.created_at }}</td>
|
||||||
<td class="ts-cell">{% if s.expires_at %}{{ s.expires_at }}{% else %}<em>manual</em>{% endif %}</td>
|
<td class="ts-cell">{% if s.expires_at %}{{ s.expires_at }}{% else %}<em>manual</em>{% endif %}</td>
|
||||||
<td>
|
<td>
|
||||||
<button class="lt-btn lt-btn-danger lt-btn-sm" onclick="removeSuppression({{ s.id }})">Remove</button>
|
<button class="lt-btn lt-btn-danger lt-btn-sm" data-action="remove-sup" data-sup-id="{{ s.id }}">Remove</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -228,10 +228,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('click', e => {
|
document.addEventListener('click', e => {
|
||||||
const pill = e.target.closest('.pill[data-dur]');
|
const pill = e.target.closest('#create-suppression-form .pill[data-duration]');
|
||||||
if (!pill) return;
|
if (pill) {
|
||||||
const val = pill.dataset.dur;
|
const val = pill.dataset.duration;
|
||||||
setDur(val ? parseInt(val) : null, pill);
|
setDur(val ? parseInt(val) : null, pill);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const removeBtn = e.target.closest('[data-action="remove-sup"]');
|
||||||
|
if (removeBtn) removeSuppression(parseInt(removeBtn.dataset.supId));
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user