Skip to content

feat(web): add collapsible connections list pane#2047

Closed
deviationist wants to merge 2 commits into
emqx:mainfrom
deviationist:feature/collapsible-connections-pane-web
Closed

feat(web): add collapsible connections list pane#2047
deviationist wants to merge 2 commits into
emqx:mainfrom
deviationist:feature/collapsible-connections-pane-web

Conversation

@deviationist
Copy link
Copy Markdown
Contributor

@deviationist deviationist commented May 16, 2026

Summary

Brings the desktop app's "show/hide connections list" feature to the web build. The connections list pane on the left can now be collapsed to give more horizontal space to messages, subscriptions, and the publish editor — which is especially useful for long topic trees or wide payloads.

State is persisted to localStorage (showConnectionList) so the layout sticks across reloads.

Behavior

  • A single rotating chevron sits at the top-left of the detail pane. Clicking it slides the list out (or back in) — same .collapse-btn + collapse-btn-transform(...) pattern used for the inner client-info collapse, so the feel is consistent with the existing topbar behavior.
  • All affected layout offsets (.right-topbar, .connections-detail-main margin, .filter-bar, the subscriptions LeftPanel, plus the dynamic marginLeft getter that accounts for showSubs + largeDesktop) reflow with matching 0.3s cubic-bezier(0.4, 0, 0.2, 1) transitions.
  • The Leftbar's connections icon is now route-aware: if you're already on /recent_connections or any of its subpages (i.e. a connection detail / form at /recent_connections/:id, including the ?oper=create form), clicking it toggles the pane in-place; from anywhere else (settings, help, about) it routes to /recent_connections as before without toggling. This means you can collapse/expand the list without leaving the connection you're currently viewing or editing.

Why this exists in desktop but not web

The desktop variant (src/) already has this feature (showConnectionList in store/modules/app.ts, iconfont icon-hide-connections / icon-show-connections in ConnectionsList.vue and ConnectionsDetail.vue). The web variant (web/src/) shipped without it — the .left-list div in web/src/views/connections/index.vue had no toggle wrapper, no Vuex state, and no buttons. This PR closes that parity gap.

Files

File Change
web/src/store/modules/app.ts showConnectionList state, TOGGLE_SHOW_CONNECTION_LIST mutation + action, localStorage persistence
web/src/store/getter.ts new showConnectionList getter
web/src/types/global.d.ts App.showConnectionList: boolean
web/src/lang/connections.ts hideConnections / showConnections (zh, en, ja)
web/src/views/connections/index.vue transition wrapper, toggle button, layout overrides, transitions
web/src/views/connections/ConnectionsDetail.vue showConnectionList getter wired into the existing marginLeft getter so the right-side reflows correctly
web/src/components/Leftbar.vue route-aware toggle on the connections icon

Test plan

  • Toggle the chevron — list slides out, detail/empty/form pane fills the freed space
  • Reload the page — state is restored from localStorage
  • With a connection open and subscriptions visible, toggle — filter bar, footer, message list, and subscriptions popup all reflow smoothly
  • Switch to settings / help / about with list hidden — return via the Leftbar connections icon → routes there without changing the toggle state
  • On /recent_connections (list view), click the Leftbar connections icon → toggles in place
  • On /recent_connections/:id (connection detail or ?oper=create form), click the Leftbar connections icon → toggles in place without navigating away
  • Try at <1920px and ≥1920px viewports — offsets adapt for both breakpoints
  • Light / dark / night themes — chevron color follows var(--color-main-green)

Screenshots

Collapsed — list hidden, chevron points right; the detail / publish / subscriptions area expands into the freed space.
collapsed

Expanded — list visible (default state), chevron points left and rotates 180° on toggle, matching the inner topbar's collapse animation.
expanded

Mirrors the desktop app's "show/hide connections" feature in the web
build, giving users more screen real estate for messages and
subscriptions. State persists in localStorage so the panel stays
collapsed across reloads.

- Vuex: add showConnectionList state, mutation, action, and getter
- Single rotating .collapse-btn that toggles the pane, matching the
  inner .topbar collapse pattern (icon, rotation, easing)
- Layout: reflow .right-topbar, .filter-bar, .left-panel, and
  .connections-detail-main margins when the pane is hidden
- Leftbar: clicking the connections icon toggles when already on
  /recent_connections, otherwise routes there as before
- i18n: add hideConnections / showConnections (zh, en, ja)
@deviationist
Copy link
Copy Markdown
Contributor Author

@ysfscream If you have time and possibility, and you agree with the value this small change gives, would you consider merging this into main?

@ysfscream
Copy link
Copy Markdown
Member

@deviationist thanks for your PR. let me see now.

@ysfscream ysfscream self-requested a review May 21, 2026 06:45
@ysfscream ysfscream moved this to In Progress in MQTTX May 21, 2026
@ysfscream ysfscream added this to the v1.13.1 milestone May 21, 2026
@ysfscream ysfscream requested a review from Copilot May 21, 2026 07:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a web-parity feature to collapse/expand the left-side connections list, persisting the state across reloads.

Changes:

  • Introduces showConnectionList Vuex state with persistence and a new getter.
  • Adds a slide transition + chevron toggle in the connections view and reflows the right-side layout when collapsed.
  • Updates the Leftbar connections icon to toggle the pane when already on a connections-related route.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
web/src/views/connections/index.vue Adds the collapsible left pane, toggle UI, and layout/transition CSS.
web/src/views/connections/ConnectionsDetail.vue Updates the computed marginLeft to account for the collapsed list.
web/src/types/global.d.ts Extends App typing with showConnectionList.
web/src/store/modules/app.ts Adds Vuex state/mutation/action and localStorage persistence for showConnectionList.
web/src/store/getter.ts Exposes showConnectionList via a getter.
web/src/lang/connections.ts Adds i18n strings for “Hide/Show Connections”.
web/src/components/Leftbar.vue Makes the connections icon toggle the pane when already on a connections route.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +161 to +174
a.toggle-list-btn {
position: fixed;
top: 21px;
left: 369px;
z-index: 1001;
font-size: 18px;
line-height: 1;
transition: left $collapse-duration $collapse-ease, transform $collapse-duration $collapse-ease;
@media (min-width: 1920px) {
left: 489px;
}
}
@include collapse-btn-transform(0deg, 180deg);
.connections-view {
Comment on lines +174 to +190
.connections-view {
.right-topbar {
transition: left $collapse-duration $collapse-ease;
}
.connections-detail-main {
transition: margin-left $collapse-duration $collapse-ease, padding-top 0.3s;
}
.connections-detail-main .connections-body .filter-bar {
transition: left $collapse-duration $collapse-ease;
}
.connections-footer {
transition: margin-left $collapse-duration $collapse-ease;
}
.left-panel > div {
transition: left $collapse-duration $collapse-ease;
}
}
Copy link
Copy Markdown
Contributor Author

@deviationist deviationist May 21, 2026

Choose a reason for hiding this comment

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

FYI - In terms of my addition, the connections-pane is sliding in/out smoothly as it should.

Comment thread web/src/store/modules/app.ts Outdated
Comment thread web/src/components/Leftbar.vue
.connections-detail-main .connections-body .filter-bar,
.left-panel > div {
left: 76px;
}
@ysfscream
Copy link
Copy Markdown
Member

Suggestion: could we align this with the existing desktop UI pattern?

Desktop uses icon-hide-connections in the connections list header and icon-show-connections in the detail header when the list is hidden. The web version currently uses a single floating rotating chevron. Matching the desktop icons and hide/show placement would make the behavior feel more consistent across Desktop and Web.

Wrap JSON.parse in try/catch and verify the parsed value is a boolean
before returning it; fall back to true on parse failure or wrong type.
Prevents a corrupted showConnectionList entry from throwing during
module initialization and blocking app load.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ysfscream ysfscream added enhancement New feature or request web MQTTX Web labels May 21, 2026
@deviationist
Copy link
Copy Markdown
Contributor Author

deviationist commented May 21, 2026

Suggestion: could we align this with the existing desktop UI pattern?

Desktop uses icon-hide-connections in the connections list header and icon-show-connections in the detail header when the list is hidden. The web version currently uses a single floating rotating chevron. Matching the desktop icons and hide/show placement would make the behavior feel more consistent across Desktop and Web.

Thanks for considering the PR. I'm looking into the scope of aligning with the desktop version, will get back to you.

@deviationist
Copy link
Copy Markdown
Contributor Author

Opened #2049 as an alternative implementation incorporating @ysfscream's icon-pattern suggestion above — same feature, but uses desktop's two-icon presentation (icon-hide-connections in the list titlebar, icon-show-connections in the detail header) instead of this PR's single floating chevron. Visually aligned with the desktop app.

Closing this PR in favor of #2049. Reviewers, please continue there.

@deviationist
Copy link
Copy Markdown
Contributor Author

Closing in favor of #2049, which implements the same feature using the desktop icon pattern as @ysfscream suggested in the review. Thanks for the call!

@github-project-automation github-project-automation Bot moved this from In Progress to Done in MQTTX May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request web MQTTX Web

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants