Skip to content

Task 2 – Tab UI, Context Menu, Indicators, and Shortcuts #3196

@astandrik

Description

@astandrik

Scope

  • Implement a QueryTabsBar UI above the editor in QueryEditor.tsx, separate from QueryTabs.tsx (New/History/Saved).
  • Basic interactions: open new tab (+), activate tab on click, close tab (respecting unsaved/dirty state), and inline rename (double-click).
  • Add a right-click / “more” button context menu per tab with options: Rename, Duplicate, Save query, Save query as…, Share query, Close tab.
  • Implement duplicate by creating a new tab that copies query text and title (e.g., Copy of …) but resets execution status.
  • Use the per-tab execution metadata from Task 1 to render visual indicators on each tab (Running, Success, Error, Idle) following the provided design (colored bar/underline).
  • Integrate Save / Save as… / Share with existing dialogs and flows in the Query area (e.g., SAVE_QUERY_DIALOG, saved queries, share actions).
  • Add keyboard shortcuts for core tab actions: new tab, close active tab, switch next/previous tab, and focus/rename current tab, ensuring no conflicts with existing Monaco keybindings from getKeyBindings.

Key files

  • New components under src/containers/Tenant/Query/QueryEditor/ for the query tab strip and context menu (e.g., QueryTabsBar.tsx plus .scss).
  • src/containers/Tenant/Query/QueryEditor/QueryEditor.tsx (mount tab strip and wire events to architecture from Task 1).
  • src/containers/Tenant/Query/QueryEditor/YqlEditor.tsx and helpers (integrate tab-related shortcuts with Monaco).
  • src/containers/Tenant/Query/SaveQuery/* and related dialogs (save/share wiring).
  • src/containers/Tenant/Query/i18n/*.json (tab titles, context menu labels, shortcuts descriptions).

Risks/constraints

  • Shortcut conflicts with existing editor-level bindings must be avoided; fall back or remap as needed.
  • Context menu and indicators must behave correctly in both light and dark themes and follow Gravity UI patterns.
  • Menu actions must handle disabled/hidden states gracefully when not applicable (e.g., no query text to save/share).

Acceptance criteria

  • Users can manage tabs entirely via UI: create, switch, rename, duplicate, save/share, and close.
  • Each tab shows an appropriate execution indicator (Running, Success, Error, Idle) independent of other tabs.
  • Keyboard shortcuts for tab open/close/switch/rename work and are listed in the shortcuts panel.
  • Tests cover context menu behavior, at least one shortcut path, and basic tab indicator behavior.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions