feat(5.20): US-010 badge mediu RAR in liste/preview/detaliu/jurnal + audit + ecou API
labels.py: ETICHETE_ENV + eticheta_env(env)->(text,css). Productie afisata
"PRODUCȚIE" (majuscule+diacritice) cu badge fill de atentie (--err), Testare
outline discret muted — semnalizare risc L.142 (declaratie reala ireversibila).
Clase .env-badge-prod / .env-badge-test in base.html; eticheta_env expus ca
global Jinja.
Badge de mediu per rand in _submissions, _coada implicit prin view, _preview_rand,
_trimitere_detaliu, _jurnal. Statusbar (_status.html) aliniat la aceeasi conventie
(Productie = atentie, nu verde) — inlocuieste culorile ad-hoc din US-011, toggle
neatins.
rar_env in exportul de audit (AUDIT_COLUMNS + _audit_rows) si ecou in
GET /v1/prezentari(/{id}). _submission_row_view/_detaliu_ctx/fragment_submissions
duc rar_env pana in template.
tests/test_badge_rar_env.py: badge in lista, audit contine rar_env, GET ecou rar_env.
test_statusbar_env: asertie aliniata la eticheta PRODUCȚIE.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,7 @@ from ..web.csrf import get_csrf_token, verify_csrf
|
||||
from .labels import (
|
||||
ETICHETA_ULTIMA_AUTENTIFICARE_RAR,
|
||||
STARI_PREVIEW,
|
||||
eticheta_env,
|
||||
eticheta_rar,
|
||||
eticheta_scurta,
|
||||
eticheta_stare,
|
||||
@@ -110,8 +111,9 @@ def _import_env_ctx(conn, account_id: int) -> dict:
|
||||
|
||||
router = APIRouter(tags=["web"])
|
||||
templates = Jinja2Templates(directory=str(Path(__file__).resolve().parent / "templates"))
|
||||
# Expune parse_erori in toate template-urile
|
||||
# Expune parse_erori si eticheta_env in toate template-urile
|
||||
templates.env.globals["parse_erori"] = parse_erori
|
||||
templates.env.globals["eticheta_env"] = eticheta_env
|
||||
|
||||
_BLOCKED = ("error", "needs_data", "needs_mapping")
|
||||
|
||||
@@ -528,6 +530,8 @@ def _jurnal_context(
|
||||
"has_more": has_more,
|
||||
"prev_page": page - 1 if page > 0 else None,
|
||||
"next_page": page + 1 if has_more else None,
|
||||
# US-010 (PRD 5.20): mediul implicit al contului pentru badge de sectiune.
|
||||
"env_default": rar_env_efectiv_cont(conn, account_id) or "test",
|
||||
}
|
||||
|
||||
|
||||
@@ -1042,6 +1046,8 @@ def _submission_row_view(r) -> dict:
|
||||
# randurile blocate (error/needs_data/needs_mapping) sunt selectabile pentru
|
||||
# stergere bulk; sent/sending/queued raman read-only (fara checkbox).
|
||||
"gestionabil": r["status"] in _GESTIONABILE_WEB,
|
||||
# US-010 (PRD 5.20): mediul RAR tinta — badge in lista.
|
||||
"rar_env": r["rar_env"] if "rar_env" in r.keys() else None,
|
||||
}
|
||||
|
||||
|
||||
@@ -1089,7 +1095,7 @@ def fragment_submissions(
|
||||
# FARA LIMIT — altfel paginile >8 ar disparea silentios.
|
||||
rows_db = conn.execute(
|
||||
"SELECT id, status, id_prezentare, rar_status_code, rar_error, retry_count, "
|
||||
f"updated_at, payload_json FROM submissions WHERE {where_sql} ORDER BY id DESC",
|
||||
f"updated_at, payload_json, rar_env FROM submissions WHERE {where_sql} ORDER BY id DESC",
|
||||
params,
|
||||
).fetchall()
|
||||
|
||||
@@ -1130,7 +1136,7 @@ def fragment_submissions(
|
||||
|
||||
rows_db = conn.execute(
|
||||
"SELECT id, status, id_prezentare, rar_status_code, rar_error, retry_count, "
|
||||
f"updated_at, payload_json FROM submissions WHERE {where_sql} ORDER BY id DESC "
|
||||
f"updated_at, payload_json, rar_env FROM submissions WHERE {where_sql} ORDER BY id DESC "
|
||||
"LIMIT ? OFFSET ?",
|
||||
params + [_PAGE_SIZE, offset],
|
||||
).fetchall()
|
||||
@@ -1352,6 +1358,8 @@ def _detaliu_ctx(request: Request, row, *, message: str | None = None,
|
||||
"editabil": row["status"] in _CORECTABILE,
|
||||
# error/needs_data/needs_mapping pot fi sterse / re-puse in coada
|
||||
"gestionabil": row["status"] in _GESTIONABILE_WEB,
|
||||
# US-010 (PRD 5.20): mediul RAR tinta — badge in detaliu.
|
||||
"rar_env": row["rar_env"] if "rar_env" in row.keys() else None,
|
||||
# mapare inline (operatii nemapate ale acestui rand + nomenclator)
|
||||
"nemapate_inline": nemapate_inline,
|
||||
"nomenclator": nomenclator,
|
||||
|
||||
Reference in New Issue
Block a user