Modernize Metrics Results Navigator resultsNav - sebiboga/testlink-upgraded GitHub Wiki
The standalone Metrics & Reports launcher — lib/results/resultsNavigator.php
(+ gui/templates/dashio/results/resultsNavigator.tpl) — is modernized as a
standalone Dashio screen backed by a REST BFF. It was the last standalone
lib/results/* screen without a modern twin. It lists every report available
for a chosen test plan and deep-links into the modern dashboards
(reportPrint.html, metricsDashboard.html, resultsByTSuite.html,
resultsMatrix.html, resultsTCFlat.html, charts.html, …).
-
Screen:
gui/templates/results/resultsNavigator.html— Dashio page: teal header ("Metrics & Reports", TLi18n locale switcher), toolbar with a test-plan selector (accessible active plans, legacygetAccessibleTestPlanscombo), a report-type selector (HTML / Pseudo MS Word / Email (HTML), driven by$tlCfg->reports_formats), and Refresh. Body lists the available reports as a DataTable (Report / Direct link columns) with the legacy direct-link toggle (lnl.php?apikey=…). Legacy warnings are honoured:report_tplan_has_no_tcasesandreport_tplan_has_no_build(warn box). Access-denied (401 anon / 403 no rights) and load-error states included. -
BFF:
api/resultsnav/index.php—GET ?action=init&tproject_id=&tplan_id=&format=(session auth + same-origin guard). It resolves the owning project from the plan, computes the req/BTS gating flags from the project options +isIssueTrackerEnabled()(hoisted out of thestatus_okbranch so both the empty-plan and healthy paths stay warning-free), replicatesreports_mgr->get_list_reports()key/item pairing including its enabled + format gating so req/BTS-disabled reports don't shift the key↔item alignment, then maps the 25 legacycfg/reports.cfg.phpreport keys onto their modern screens via alegacy2moderntable (e.g.report_exec_timeline → execTimelineStats.html,tcases_without_tester → casesWithoutTester.html,free_tcases → freeTestCases.html— the twin distinction is kept). Modern hrefs are rooted at/<screen>.html?tplan_id=&tproject_id=— both when the cfg url islib/...and when it already points atgui/templates/...(e.g.resultsMoreBuilds). JSON contract: 401 anon / 403 no rights on owning project (testplan_metrics, admin shortcut) + CSRF / 400 unknown action or no active plan / 404 unknown plan / 405 non-GET / 500 guarded. -
Link switch:
$actions->resultsNavinlib/functions/common.php(aftermetrics_dashboard);lib/general/frmWorkArea.phpshowMetricsdeep-links into the modern screen. -
i18n:
rsnav.*(14 keys: title/subtitle/testPlan/reportTypes/ colName/directLink/openReport/empty/loadFailed/planSelector/noRights/ anon/warnNoTc/warnNoBuild) +footers.resultsNavigatorin all 10 bundles. Real translations for en/ro/de/es/fr, English fallback for it/pt/ru/ja/zh. Validatedpython3 -m json.tool; RO locale verified in-browser ("Metrică și Rapoarte", "Rapoarte disponibile", "Raport"/"Link direct").
- Browser (admin, fixture project 27 / plan 28): title "Metrics & Reports",
toolbar selectors, table headers Report / Direct link, 24 report rows
with modern rooted hrefs (0
lib/results/or doubledgui/templates/gui/prefixes), direct-linklnl.php?apikey=…; format switch to Email (HTML) narrows to the singleresults_flat("Test Results Flat"); warning state (TC unlinked) renders the TPlan-has-no-TCs warn box and clears once relinked; RO locale renders correctly. - BFF curl contract: 401 anon, 403 POST/CSRF, 400 unknown action, 400 no active
plan, 404 unknown plan, 200 for
format=0/4/6(24 / 3 / 1 rows). - No-rights proven via role-less user (
rsnavguest,role_id NULL) →hasRightOnProj()NULL → 403 branch. - Event Viewer: initial run logged
E_WARNING Undefined $optReqs/$btsEnabled(gate flags computed inside thestatus_okbranch but referenced by the gating loop unconditionally) — root-caused, fixed by hoisting, re-verified 0 E_WARNING on both paths; events max id unchanged. - Fixture
tmp/fixtures_1568.phpre-runs clean on a fresh DB: project 27 "RSNAV1568", plan 28, suite 29, tc 30 / tcversion 31, TC linked to plan viaINSERT INTO testplan_tcversions.
Suite 1568 (Screen — Metrics & Reports hub) in tmp/TLU_Test_Cases.md —
7/7 PASS.
