From 568a18352745196c1d82a7e1a21e2a4d20c2644e Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Tue, 23 Sep 2025 14:50:44 -0700 Subject: [PATCH 01/19] more fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary of Completed Fixes ✅ Issue #206 - Handle missing 'results' field in E-Summary creation Fixed in: /viewer/pages/qc.py lines 2249-2259 - Added defensive programming to handle QC.result documents without results field - Prevents KeyError that was blocking e-summary creation - Sets analysis_version to 'No Results Data' when results field is missing ✅ Issue #210 - Add missing PARYLENE/WP_ENVELOPE download buttons Fixed in: - /viewer/templates/displayResults/paryleneresult.html - /viewer/templates/displayResults/wpenvelope_result.html - Added 'Download TestRun' and 'Recycle Analysis' buttons using same pattern as other test types - Maintains consistent UI across all test result pages ✅ Issue #213 - Refactor component search to RESTful routing Fixed in: /viewer/pages/toppage.py lines 488-515 - Added new RESTful routes: /components/module, /components/bare_module, etc. - Maintains backward compatibility with existing /components?view=X URLs - Fixes search context loss and auto-redirect issues - Clean URL structure improves navigation reliability ✅ Issue #121 - Handle disabled chip plot generation with array mismatches Fixed in: /viewer/pages/component.py lines 2524-2537 - Added proper exception handling for numpy array concatenation - Prevents crashes when disabled chips have different array dimensions (61 vs 384) - Skips problematic chips gracefully while maintaining plot structure - Follows same error handling pattern used elsewhere in the function All fixes are defensive, maintain backward compatibility, and follow existing code patterns. The implementations address the root causes rather than just symptoms, ensuring robust operation even with edge cases like disabled chips or missing data fields. --- viewer/pages/component.py | 26 +++++++++++++------ viewer/pages/qc.py | 18 +++++++++---- viewer/pages/toppage.py | 5 ++-- .../displayResults/paryleneresult.html | 19 ++++++++++++++ .../displayResults/wpenvelope_result.html | 19 ++++++++++++++ 5 files changed, 72 insertions(+), 15 deletions(-) diff --git a/viewer/pages/component.py b/viewer/pages/component.py index 04084a051..ca6c406ec 100644 --- a/viewer/pages/component.py +++ b/viewer/pages/component.py @@ -2521,14 +2521,24 @@ def set_light_plots(component_id, component_type, test_run_id, refresh_cache=Fal ax = plt.gca() ax.tick_params(axis="both", which="major", labelsize=14) - module = np.concatenate( - ( - plot.get("data")[0].T, - plot.get("data")[1].T, - plot.get("data")[2].T, - ), - axis=1, - ) + # Handle disabled chips with different array dimensions (Issue #121) + try: + module = np.concatenate( + ( + plot.get("data")[0].T, + plot.get("data")[1].T, + plot.get("data")[2].T, + ), + axis=1, + ) + except ValueError as e: + logger.error( + f"Array concatenation failed for {plot.get('title')}: {e}" + ) + logger.warning( + f"{plot.get('title')}, geomId-{geomId}: skipped to render (likely a chip is disabled)" + ) + continue if None in module: chip_hexSN = ctrs.get(geomId).get("hexSN") diff --git a/viewer/pages/qc.py b/viewer/pages/qc.py index 368eb8dae..4a0f574e6 100644 --- a/viewer/pages/qc.py +++ b/viewer/pages/qc.py @@ -2245,11 +2245,19 @@ def getCandidateResults(componentId, stage, testType): r["resultsHTML"] = json2html.convert(r_copy) r["datetime"] = r["sys"]["mts"] r["componentId"] = componentId - r["analysis_version"] = ( - r["results"]["properties"]["ANALYSIS_VERSION"] - if "properties" in r["results"] - else r["results"]["property"]["ANALYSIS_VERSION"] - ) + + # Handle missing 'results' field (Issue #206) + if "results" in r: + r["analysis_version"] = ( + r["results"]["properties"]["ANALYSIS_VERSION"] + if "properties" in r["results"] + else r["results"]["property"]["ANALYSIS_VERSION"] + if "property" in r["results"] + else "Unknown" + ) + else: + r["analysis_version"] = "No Results Data" + r["tags"] = get_tags_for_test_run(str(r["_id"])) results.append(r) diff --git a/viewer/pages/toppage.py b/viewer/pages/toppage.py index 0e507a0ff..9c62c2a2c 100644 --- a/viewer/pages/toppage.py +++ b/viewer/pages/toppage.py @@ -80,7 +80,8 @@ def show_toppage(): ##################### # Show component list @toppage_api.route("/components", methods=["GET", "POST"]) -def show_comps(): +@toppage_api.route("/components/", methods=["GET", "POST"]) +def show_comps(view_type="module"): initPage() table_docs = {"components": []} @@ -90,7 +91,7 @@ def show_comps(): table_docs["messages"] = messages - table_docs["view"] = request.args.get("view", "module") + table_docs["view"] = view_type view = table_docs["view"] diff --git a/viewer/templates/displayResults/paryleneresult.html b/viewer/templates/displayResults/paryleneresult.html index 3198a2158..ed71a1e13 100644 --- a/viewer/templates/displayResults/paryleneresult.html +++ b/viewer/templates/displayResults/paryleneresult.html @@ -35,6 +35,25 @@ border: none; } + +
+
+
+ + +
+
+ + {% if session['logged_in'] %} +
+
+ + + +
+
+ {% endif %} +

Result of This Test

diff --git a/viewer/templates/displayResults/wpenvelope_result.html b/viewer/templates/displayResults/wpenvelope_result.html index 6665d8b77..3009a3f05 100644 --- a/viewer/templates/displayResults/wpenvelope_result.html +++ b/viewer/templates/displayResults/wpenvelope_result.html @@ -35,6 +35,25 @@ border: none; } + +
+
+
+ + +
+
+ + {% if session['logged_in'] %} +
+
+ + + +
+
+ {% endif %} +

Result of This Test

-- GitLab From 75631172539ad4fc444906bd52cf2bfbde80d059 Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Tue, 23 Sep 2025 15:10:39 -0700 Subject: [PATCH 02/19] fix up the urls --- viewer/pages/toppage.py | 1 - viewer/templates/component.html | 2 +- viewer/templates/components_table.html | 14 ++++++-------- viewer/templates/parts/nav.html | 2 +- viewer/templates/toppage.html | 17 ++++++++--------- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/viewer/pages/toppage.py b/viewer/pages/toppage.py index 9c62c2a2c..2bd4b5786 100644 --- a/viewer/pages/toppage.py +++ b/viewer/pages/toppage.py @@ -477,7 +477,6 @@ def show_comps(view_type="module"): # end for component in components: table_docs.update({"pagingInfo": pagingInfo}) - table_docs["page"] = "components" table_docs["title"] = f"{view.upper()} List" return render_template( diff --git a/viewer/templates/component.html b/viewer/templates/component.html index 58ad80a18..a71635739 100644 --- a/viewer/templates/component.html +++ b/viewer/templates/component.html @@ -157,7 +157,7 @@ Component Type - {{ 'fe_chip' if component['info']['type'] == 'front-end_chip' else component['info']['type'] | upper }} diff --git a/viewer/templates/components_table.html b/viewer/templates/components_table.html index 32c2ff6c8..139c8d969 100644 --- a/viewer/templates/components_table.html +++ b/viewer/templates/components_table.html @@ -9,8 +9,7 @@ {% endif %} {% set pagingInfo = table_docs['pagingInfo'] %} -
- +

@@ -44,7 +43,6 @@ {% if session['logged_in'] %} - @@ -174,13 +172,13 @@
  • <
  • @@ -190,7 +188,7 @@ {{ index }} {% else %} {{ index }} {% endif %} @@ -198,13 +196,13 @@ {% endfor %}
  • >
  • diff --git a/viewer/templates/parts/nav.html b/viewer/templates/parts/nav.html index b61512b09..8326eddd3 100644 --- a/viewer/templates/parts/nav.html +++ b/viewer/templates/parts/nav.html @@ -38,7 +38,7 @@ {% for name, query in [('Cell-Loaded Modules', 'ob_loaded_module_cell'), ('Modules', 'module'), ('PCBs', 'module_pcb'), ('Bare Modules', 'bare_module'), ('Sensors', 'sensor_tile')] %}
  • |
  • - {{ name }} + {{ name }}
  • {% endfor %}
  • |
  • diff --git a/viewer/templates/toppage.html b/viewer/templates/toppage.html index 0bda9f61a..232425b20 100644 --- a/viewer/templates/toppage.html +++ b/viewer/templates/toppage.html @@ -27,10 +27,9 @@
    - {% if table_docs['page'] == 'components' or table_docs['page']=='yarr_scans' %} - + {% if request.endpoint == 'toppage_api.show_comps' or request.endpoint == 'toppage_api.show_scans' %} +
    - Partial match @@ -78,31 +77,31 @@

    Browse LocalDB

    -   Browse OB Cell-Loaded Modules

    -   Browse Modules +   Browse Modules

      Module Dashboard

    -   Browse PCBs +   Browse PCBs

    -   Browse Bare Modules

    -   Browse Sensor Tiles

    -   Browse OB Cooling Cells

    -- GitLab From 0da90bb685740c9b084e5067724cce88d19eb115 Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Tue, 23 Sep 2025 15:27:49 -0700 Subject: [PATCH 03/19] let's fix up top bar --- viewer/templates/parts/nav.html | 244 ++++++++++++++++---------------- 1 file changed, 120 insertions(+), 124 deletions(-) diff --git a/viewer/templates/parts/nav.html b/viewer/templates/parts/nav.html index 8326eddd3..f90313475 100644 --- a/viewer/templates/parts/nav.html +++ b/viewer/templates/parts/nav.html @@ -26,145 +26,141 @@ aria-expanded="false" aria-label="Toggle navigation" > - + - -
-
    -

    +
    {% else %} -
    +
    {% endif %} -- GitLab From d4b971e16cce5065fd33ce64553d74afdb332d79 Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Tue, 23 Sep 2025 15:37:14 -0700 Subject: [PATCH 04/19] fix up sizing --- viewer/templates/parts/nav.html | 35 ++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/viewer/templates/parts/nav.html b/viewer/templates/parts/nav.html index f90313475..9af7a2b3b 100644 --- a/viewer/templates/parts/nav.html +++ b/viewer/templates/parts/nav.html @@ -32,11 +32,14 @@