Skip to content

Index tree items lack visual indication of hidden state & show incorrect context menu actions 👁️🗂️ #656

@tnaum-ms

Description

@tnaum-ms

Problem

When viewing indexes in the tree view, there is no visual distinction between hidden and non-hidden indexes — the hidden state is only visible in the tooltip. Both "Hide Index…" and "Unhide Index…" context menu actions appear for every index regardless of state, leading to confusing error messages when users pick the wrong one.

Additionally, the _id_ index (which cannot be hidden) also shows the "Hide Index…" option, resulting in an error on click.

Expected Behavior

  1. Visual indication: Hidden indexes should display a hidden description next to their name in the tree view
  2. Context menu: Only the applicable action should appear:
    • Non-hidden indexes → show "Hide Index…" only
    • Hidden indexes → show "Unhide Index…" only
    • _id_ index → show neither "Hide" nor "Unhide"

Implementation Guide

1. Add hidden/default state to contextValue in IndexItem.ts

In src/tree/documentdb/IndexItem.ts, extend the context value based on state:

  • Hidden indexes: include an index_hidden segment → treeItem_index;index_hidden;experience_documentDB
  • The _id_ default index: include an index_default segment → treeItem_index;index_default;experience_documentDB
  • Regular indexes: keep current → treeItem_index;experience_documentDB

Use createContextValue() (already imported) to compose segments.

2. Add description for hidden indexes in IndexItem.ts

In getTreeItem(), set:

description: this.indexInfo.hidden ? 'hidden' : undefined

3. Update when clauses in package.json

Update the menu contributions for:

  • Hide Index: add && viewItem =~ /(?!.*\\bindex_hidden\\b)(?!.*\\bindex_default\\b)/i — only show when the item is neither hidden nor default
  • Unhide Index: add && viewItem =~ /\\bindex_hidden\\b/i — only show when the item is hidden

Files to Modify

File Change
src/tree/documentdb/IndexItem.ts Add index_hidden / index_default to contextValue; add description field
package.json Update when clauses for hideIndex and unhideIndex commands

Acceptance Criteria

  • Hidden indexes show hidden description in the tree
  • Right-clicking a hidden index shows only "Unhide Index…"
  • Right-clicking a non-hidden index shows only "Hide Index…"
  • Right-clicking the _id_ index shows neither hide nor unhide
  • Tooltip behavior unchanged

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

Status

In review

Relationships

None yet

Development

No branches or pull requests

Issue actions