Skip to content

fix(viewer): Raw dialog, grid and navbar layout fixes - #625

Merged
wsobel merged 8 commits into
mtconnect:mainfrom
skibum1869:feature/viewer-grid-fixes
Nov 6, 2026
Merged

wsobel merged 8 commits into
mtconnect:mainfrom
skibum1869:feature/viewer-grid-fixes

Conversation

@skibum1869

Copy link
Copy Markdown
Collaborator

Fixes layout and usability problems in the JavaScript browser view (styles/viewer.html). No agent C++ changes.

Raw dialog

  • Long lines wrap between words. Bootstrap's word-break: break-all on pre was splitting names mid-word.
  • A wrapped line continues just past its own indent, so the nesting stays readable.
  • The close button no longer overlaps the text, and the border is the same on all four sides.
  • The dialog sizes to its content, with one scroll area and a darker backdrop.
  • XML and JSON have syntax coloring on a light background. Every token color reaches at least 4.5:1 contrast. The coloring builds spans with textContent, never innerHTML.

Grid and navbar

  • The Value column stays on screen at 1024px. It used to start past the right edge.
  • Below 768px the table was over 11,000px wide, because .table-responsive turns off wrapping. It's now 784px at a 400px window, with a minimum width so the columns stay readable.
  • Ids and names wrap only after an underscore or before a capital. Copying a name still gives the exact name.
  • Values over 120 characters show four lines until clicked, and stay open through autorefresh.
  • On phones the navbar went from 370px to 181px tall. The whole MTConnect logo and its registered trademark mark now show. A Bootstrap offset was clipping the logo and letting the tabs cover the mark.

Behavior

  • Autorefresh keeps keyboard focus on the same control.
  • A path-only Fetch on the Sample tab stays on Sample instead of going to Current.
  • All localStorage access is guarded, so blocked storage no longer stops the page from setting up.
  • <!DOCTYPE xhtml> becomes <!DOCTYPE html>, in demo/styles/viewer.html too. The page was in quirks mode.

Testing

Checked in a browser against the published mtconnect/agent 2.8.0.4 image, with this styles/ folder mounted and the demo Okuma and Mazak adapters feeding it. I measured the layout at 400, 1024 and 1280px in Chromium.

Not tested:

  • An agent built from this branch, since nothing in src/ changed.
  • Firefox or Safari.
  • The localStorage guard with storage actually blocked.
  • The demo compose stack. I only checked the Mazak and Okuma Twin links on a phone-width navbar by adding them to the live page.

🤖 Generated with Claude Code

skibum1869 and others added 8 commits November 5, 2026 22:47
Wrap long lines, keep the close button clear of the text, size the dialog
to its content, darken the backdrop, and color XML and JSON output.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The top padding was double the bottom to make room for the close
button, so the border looked uneven. Use the same padding on all
sides and fit a smaller close button inside the top edge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Names were split mid-word because Bootstrap sets break-all on pre, and
wrapped lines lost their nesting. Wrap between words and continue a
wrapped line past its own indent. Use a light palette where every token
color reaches at least 4.5:1 contrast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each refresh replaces every row, which moved focus to the body. Find
the focused control again by its row key and class.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A fetch with only a path went to Current, because only From and Count
selected Sample.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Autorefresh read localStorage unguarded. Where storage is blocked that
throws, which stopped the dialogs and the table from being set up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
<!DOCTYPE xhtml> put the page in quirks mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At 1024px the Value column was off-screen, and below 768px a Bootstrap
no-wrap rule made the table over 11,000px wide. Names now wrap only
between words, long values show a few lines until clicked, and header
subtables no longer widen the table.

On phones the navbar took over half the screen, and a Bootstrap offset
clipped the logo and let the tabs cover its registered trademark mark.
Pack the navbar into rows and always show the whole logo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@wsobel wsobel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good.

@wsobel
wsobel merged commit 8ee6a72 into mtconnect:main Nov 6, 2026
7 checks passed
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.

2 participants