Add Approve/Deny verdicts to pending requests on P104
All checks were successful
Deploy / deploy (push) Successful in 55s
All checks were successful
Deploy / deploy (push) Successful in 55s
Every TV request now needs a decision, so P104 offers the two verdicts
inline on the rows actually waiting rather than sending the visitor to
Ombi's own UI.
Ombi is now the one service the app writes to. Three details the new
ombi_write() helper and /api/ombi/decide route have to get right:
approve is a POST but deny is a PUT; a TV decision acts on the child
request id, not the show, so get_ombi_summary() carries child["id"] for
TV rows and m["id"] for movies; and Ombi answers 200 with
{"result": false, ...} on a logical refusal, so the body is checked
rather than the status code. A successful decision clears _ombi_cache —
the 4-hour TTL would otherwise keep calling the row pending for the
rest of the afternoon.
The buttons reuse the existing two-tap arming and share its armed slot,
so arming one disarms the other: an approval starts a download and a
denial is somebody's answer, neither wants a stray tap. They reverse
into green and red rather than the shared red of .tt-btn.armed, so the
confirming press states which verdict it is about to send. After a
decision the row's status flips in place and the Pending figure and its
"N of M" both settle; at zero the page drops its warn weight, since
nothing waits on a human any more (discipline 5). Below 560px the
verdicts take a full line of their own rather than shrinking below the
tap target.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YNc3gd3GRPudFwgPXNEm8A
This commit is contained in:
parent
8115ed4855
commit
d38ab1b561
5 changed files with 208 additions and 7 deletions
|
|
@ -10,15 +10,17 @@
|
|||
{{ service_error('Ombi', ombi.error) }}
|
||||
{% else %}
|
||||
{#- Pending requests are the only thing here that wants a human, so a
|
||||
page holding any is set heavier than one holding none (discipline 5). -#}
|
||||
<div class="tt-field {{ 'warn' if ombi.total_pending else '' }}">
|
||||
page holding any is set heavier than one holding none (discipline 5).
|
||||
The ids are what the verdict buttons write back to when a decision
|
||||
empties the queue, so the page stops contradicting itself. -#}
|
||||
<div class="tt-field {{ 'warn' if ombi.total_pending else '' }}" id="req-field">
|
||||
<span>Awaiting A Decision</span>
|
||||
<span class="tt-field-meta">{{ ombi.total_pending }} of {{ ombi.total_requests }}</span>
|
||||
<span class="tt-field-meta"><span id="req-pending-meta">{{ ombi.total_pending }}</span> of {{ ombi.total_requests }}</span>
|
||||
</div>
|
||||
|
||||
<div class="tt-figs">
|
||||
<div class="tt-fig">
|
||||
<div class="tt-dh tt-fig-v {{ 'pending' if ombi.total_pending else 'ok' }}">{{ ombi.total_pending }}</div>
|
||||
<div class="tt-dh tt-fig-v {{ 'pending' if ombi.total_pending else 'ok' }}" id="req-pending">{{ ombi.total_pending }}</div>
|
||||
<div class="tt-fig-l">Pending</div>
|
||||
</div>
|
||||
<div class="tt-fig">
|
||||
|
|
@ -39,6 +41,21 @@
|
|||
</span>
|
||||
{%- set st = (r.status or '') | lower -%}
|
||||
<span class="tt-row-val {% if st in ('available', 'approved') %}ok{% elif st == 'denied' %}alert{% elif st == 'pending' %}pending{% else %}off{% endif %}">{{ (r.status or '—') | upper }}</span>
|
||||
{#- Magenta says a human must decide; these are the two things that
|
||||
human can decide, offered only on the rows actually waiting.
|
||||
Both take a confirming second press, the same two-tap the add
|
||||
buttons use — an approval starts a download and a denial is
|
||||
somebody's answer. -#}
|
||||
{% if st == 'pending' and r.id %}
|
||||
<span class="tt-row-acts">
|
||||
<button class="tt-btn tt-btn-yes" data-id="{{ r.id }}" data-type="{{ (r.type or '') | lower }}"
|
||||
data-verdict="approve" onclick="armDecision(this)"
|
||||
aria-label="Approve {{ r.title }}">Approve</button>
|
||||
<button class="tt-btn tt-btn-no" data-id="{{ r.id }}" data-type="{{ (r.type or '') | lower }}"
|
||||
data-verdict="deny" onclick="armDecision(this)"
|
||||
aria-label="Deny {{ r.title }}">Deny</button>
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue