Skip to content

feat(web): add collapsible connections list pane (desktop icon pattern) - #2049

Merged
ysfscream merged 5 commits into
emqx:mainfrom
deviationist:feature/collapsible-connections-pane-web-desktop-icons
May 22, 2026
Merged

feat(web): add collapsible connections list pane (desktop icon pattern)#2049
ysfscream merged 5 commits into
emqx:mainfrom
deviationist:feature/collapsible-connections-pane-web-desktop-icons

Conversation

@deviationist

@deviationist deviationist commented May 21, 2026

Copy link
Copy Markdown
Contributor

⚠️ Alternative to #2047 — same feature, different presentation.

#2047 introduced the connections-list collapse with a single floating rotating chevron. This PR is the same feature implemented with the desktop icon pattern instead, per @ysfscream's review suggestion on #2047 ("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").

Summary

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

State is persisted into the existing db lowdb store under settings.showConnectionList — the same JSON blob in localStorage that already holds currentTheme, currentLang, autoCheck, etc. — so the layout sticks across reloads.

Behavior

  • Desktop icon pattern: icon-hide-connections lives in a flex topbar next to the list's connections titlebar; icon-show-connections renders inside the detail header (.connection-head, before the title) with v-if="!showConnectionList". Mirrors src/views/connections/ConnectionsList.vue:24-41 and src/views/connections/ConnectionsDetail.vue:13-31 on desktop.
  • From the form (?oper=create / edit) and empty-state views, the recovery path is the Leftbar connections icon — matches desktop, which also doesn't render a show-button on those views.
  • The Leftbar's connections icon is route-aware: on /recent_connections or any of its subpages (/recent_connections/:id, including the ?oper=create form), clicking it toggles the pane in-place; from settings/help/about it routes to /recent_connections as before without toggling. You can collapse/expand the list without leaving the connection you're viewing or editing.
  • All affected layout offsets (.right-topbar, .connections-detail-main margin, .filter-bar, the subscriptions LeftPanel, plus the marginLeft getter that accounts for showSubs + largeDesktop) reflow with 0.3s cubic-bezier(0.4, 0, 0.2, 1) transitions.

Note on one small divergence from desktop

On the desktop app, the show-button only lives inside ConnectionsDetail.vue — there's no show-button on the empty-state view or the create/edit form. So on desktop, if a user has zero registered connections and hides the list, they can't bring it back until they add at least one connection. The pane stays hidden through the entire onboarding flow.

This PR matches desktop's icon placement exactly (no show-button on the empty-state or form views either — src/components/EmptyPage.vue and src/views/connections/ConnectionForm.vue are unchanged). What does differ: web's Leftbar connections icon is now route-aware (see web/src/components/Leftbar.vue change), so on /recent_connections* — including the empty-state view — clicking it toggles the pane. Net effect: visually aligned with desktop on the icons; slightly more forgiving on recovery from empty-state because the Leftbar gives users a way out. Keeping that small asymmetry — happy to remove it if reviewers prefer strict parity.

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, no Vuex state, and no buttons. This PR closes that parity gap, and unlike #2047 it also matches desktop on the presentation layer.

Files

File Change
web/src/store/modules/app.ts showConnectionList state, TOGGLE_SHOW_CONNECTION_LIST mutation + action; persists via setSettings('settings.showConnectionList', …) so it lives in the existing db lowdb store alongside theme/lang/etc. — no extra top-level localStorage key
web/src/database/index.ts showConnectionList: boolean added to the settings schema, with a default of true on first run
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 flex .left-list-topbar with hide-button, layout overrides, transitions
web/src/views/connections/ConnectionsDetail.vue show-button in .connection-head, TOGGLE_SHOW_CONNECTION_LIST action wired, marginLeft getter accounts for hidden list
web/src/components/Leftbar.vue route-aware toggle on the connections icon

Test plan

Verified locally so far: light, dark, and night themes — both icon-hide-connections and icon-show-connections render correctly in all three (color follows var(--color-text-title), hover state preserved). Also verified the lowdb migration: existing users without settings.showConnectionList get it seeded to true on first load.

  • Hide-button in the list's titlebar — clicking slides the list out, detail/empty/form pane fills the freed space
  • Show-button appears in the detail header (.connection-head, before the title) when the list is hidden — clicking restores the list
  • 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
  • From the empty-state and form views with the list hidden, the Leftbar connections icon restores the list
  • Reload the page — showConnectionList state restored from db.settings.showConnectionList (inspect the db entry in localStorage to confirm there's no separate showConnectionList key)
  • 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
  • Try at <1920px and ≥1920px viewports — offsets adapt for both breakpoints
  • Light / dark / night themes — both icons follow var(--color-text-title)

Screenshots

Screenshot 2026-05-21 at 15 59 12 Screenshot 2026-05-21 at 15 59 21

deviationist and others added 3 commits May 16, 2026 10:24
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)
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>
Swap the single floating rotating chevron for the two-icon pattern desktop
uses: icon-hide-connections lives in a new flex topbar next to the list
titlebar; icon-show-connections renders in the detail header with
v-if="!showConnectionList", matching ConnectionsDetail.vue:13-31 on desktop.

State and action are unchanged — purely presentational.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@deviationist
deviationist marked this pull request as ready for review May 21, 2026 14:21
deviationist and others added 2 commits May 21, 2026 14:33
Replace the standalone `showConnectionList` localStorage key with the
existing `db.settings` namespace used by the rest of the web app's
preferences (theme, language, autoCheck, etc.). Initial value reads
through `loadSettings()`, and the toggle action persists via
`setSettings('settings.showConnectionList', …)` for consistency with
the other settings.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pulled out of this PR's scope. The unguarded `JSON.parse` has been in
`src/store/modules/app.ts` since the desktop hide feature shipped in
39e47f8 (Jan 2024) — it's a pre-existing pattern, not something this
branch introduced. Smaller blast radius and a cleaner review surface
to keep the change web-only; if the guard is worth applying, it
belongs in its own desktop-scoped PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ysfscream
ysfscream requested review from Copilot and ysfscream and removed request for Copilot May 22, 2026 01:54
@ysfscream ysfscream assigned ysfscream and deviationist and unassigned ysfscream May 22, 2026
@ysfscream ysfscream added enhancement New feature or request UI/UX Improve some UI \ UX web MQTTX Web labels May 22, 2026
@ysfscream ysfscream moved this to In Progress in MQTTX May 22, 2026
@ysfscream ysfscream added this to the v1.13.1 milestone May 22, 2026

@ysfscream ysfscream 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.

Thanks for the update, this looks good.

@ysfscream
ysfscream merged commit f62fb66 into emqx:main May 22, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in MQTTX May 22, 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 UI/UX Improve some UI \ UX web MQTTX Web

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants