Skip to content

#13904 - Added structured/detailed view for external message display#13919

Merged
raulbob merged 1 commit into
developmentfrom
task-improve_external_message_display
Apr 29, 2026
Merged

#13904 - Added structured/detailed view for external message display#13919
raulbob merged 1 commit into
developmentfrom
task-improve_external_message_display

Conversation

@raulbob
Copy link
Copy Markdown
Contributor

@raulbob raulbob commented Apr 28, 2026

Fixes #13904

Summary by CodeRabbit

  • New Features

    • External messages now feature Structured and Detailed view modes accessible via a tabbed interface.
    • Structured View displays simplified HTML; Detailed View displays full HTML representation.
  • Improvements

    • Updated styling for different external message view modes.
    • Enhanced error handling with XML fallback on conversion failures.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

📝 Walkthrough

Walkthrough

The changes implement a dual-view interface for external message rendering. A new convertToDetailedHTML method is added to the adapter interface, and the external message form is refactored to display content in a tabbed layout with structured and detailed views. Supporting i18n labels and styling changes are included.

Changes

Cohort / File(s) Summary
API Interface & Internationalization
sormas-api/src/main/java/.../ExternalMessageAdapterFacade.java, sormas-api/src/main/java/.../Captions.java, sormas-api/src/main/resources/captions.properties
Added new convertToDetailedHTML default method to adapter facade (falls back to convertToHTML if not overridden). Added two new caption constants and resource bundle keys for "Structured view" and "Detailed view" UI labels. GPL license header added.
Form UI Refactoring
sormas-ui/src/main/java/.../ExternalMessageForm.java
Refactored external message details area from single Panel to TabSheet with two lazily-loaded views. Updated setValue method signature (removed exception declarations). Structured view uses convertToHTML; detailed view uses convertToDetailedHTML. Both views fall back to XML rendering on conversion failure with appropriate warning popups.
View Styling
sormas-ui/src/main/webapp/VAADIN/themes/sormas/views/lab-message.scss
Added conditional min-width constraints for Vaadin .v-customlayout based on structured vs. detailed view mode.

Sequence Diagram

sequenceDiagram
    actor User
    participant Form as ExternalMessageForm
    participant TabSheet as TabSheet Container
    participant StructuredView as Structured View
    participant DetailedView as Detailed View
    participant Facade as ExternalMessageAdapterFacade
    
    User->>Form: Open external message
    Form->>Form: setValue(message)
    Form->>TabSheet: Clear all tabs
    Form->>TabSheet: Initialize two tabs
    Form->>StructuredView: Load lazily
    StructuredView->>Facade: convertToHTML(message)
    alt Conversion successful
        Facade-->>StructuredView: HTML result
        StructuredView->>TabSheet: Render HTML
    else Conversion failed
        StructuredView->>TabSheet: Render XML fallback
        StructuredView->>User: Show warning popup
    end
    Form->>TabSheet: Select structured tab
    
    User->>TabSheet: Click detailed view tab
    Form->>DetailedView: Load lazily
    DetailedView->>Facade: convertToDetailedHTML(message)
    alt Conversion successful
        Facade-->>DetailedView: Detailed HTML result
        DetailedView->>TabSheet: Render detailed HTML
    else Conversion failed
        DetailedView->>TabSheet: Render XML fallback
        DetailedView->>User: Show warning popup
    end
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested Reviewers

  • obinna-h-n
  • KarnaiahPesula

Poem

🐰 Two tabs now dance where once was one,
Structured clarity meets details fun,
With lazy loads and fallback care,
The messages bloom in formats fair! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (1 warning, 2 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description only contains 'Fixes #13904' and lacks substantive details about the implementation, design decisions, or how the feature works. Provide more detailed description of the implementation, including how structured/detailed views work, any design decisions, and how the feature addresses the linked issue requirements.
Linked Issues check ❓ Inconclusive The PR partially implements the linked issue's requirements but it is unclear if all acceptance criteria are fully met due to vague issue specifications and incomplete PR documentation. Verify that remarks are displayed directly, national health ID blanks are shown explicitly, and any Liberia Unit requirements are addressed; document these implementations clearly.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding structured/detailed views for external message display, which aligns with the pull request's core objective.
Out of Scope Changes check ✅ Passed All code changes are directly related to implementing structured/detailed views for external messages, with no extraneous modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task-improve_external_message_display

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/ExternalMessageForm.java (1)

144-168: Log the exception object here.

logger.error(e.getMessage()) drops the stack trace, which makes conversion failures much harder to diagnose in production.

♻️ Suggested fix
-		} catch (Exception e) {
-			structuredViewContainer.addComponent(createXmlDisplay(externalMessage.getExternalMessageDetails()));
-			logger.error(e.getMessage());
+		} catch (Exception e) {
+			structuredViewContainer.addComponent(createXmlDisplay(externalMessage.getExternalMessageDetails()));
+			logger.error("Failed to render structured external message view", e);
 		}
@@
-		} catch (Exception e) {
-			detailedViewContainer.addComponent(createXmlDisplay(externalMessage.getExternalMessageDetails()));
-			logger.error(e.getMessage());
+		} catch (Exception e) {
+			detailedViewContainer.addComponent(createXmlDisplay(externalMessage.getExternalMessageDetails()));
+			logger.error("Failed to render detailed external message view", e);
 		}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/ExternalMessageForm.java`
around lines 144 - 168, In ExternalMessageForm update the exception logging in
the catch blocks (the one that follows
structuredViewContainer.addComponent(createXmlDisplay(...)) and the catch in
loadDetailedView) to log the exception object instead of only e.getMessage();
replace logger.error(e.getMessage()) with a call that includes a short
contextual message and the exception (e.g., logger.error("Failed to convert
external message to detailed HTML", e)) so the full stack trace is recorded for
debugging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/ExternalMessageForm.java`:
- Around line 144-168: In ExternalMessageForm update the exception logging in
the catch blocks (the one that follows
structuredViewContainer.addComponent(createXmlDisplay(...)) and the catch in
loadDetailedView) to log the exception object instead of only e.getMessage();
replace logger.error(e.getMessage()) with a call that includes a short
contextual message and the exception (e.g., logger.error("Failed to convert
external message to detailed HTML", e)) so the full stack trace is recorded for
debugging.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8f6ee0de-4f0a-48d3-b08c-648d284514c9

📥 Commits

Reviewing files that changed from the base of the PR and between ab2aa0b and b491aed.

📒 Files selected for processing (5)
  • sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/ExternalMessageAdapterFacade.java
  • sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java
  • sormas-api/src/main/resources/captions.properties
  • sormas-ui/src/main/java/de/symeda/sormas/ui/externalmessage/ExternalMessageForm.java
  • sormas-ui/src/main/webapp/VAADIN/themes/sormas/views/lab-message.scss

@raulbob raulbob merged commit 5ba0cd0 into development Apr 29, 2026
7 of 10 checks passed
@raulbob raulbob deleted the task-improve_external_message_display branch April 29, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alter external messages rendering

1 participant