Skip to content

feat(web): collapse Index tab's two indexing buttons into one (#582)#592

Merged
memtomem merged 1 commit intomainfrom
feat/582-collapse-index-buttons
Apr 30, 2026
Merged

feat(web): collapse Index tab's two indexing buttons into one (#582)#592
memtomem merged 1 commit intomainfrom
feat/582-collapse-index-buttons

Conversation

@memtomem
Copy link
Copy Markdown
Owner

Summary

The folder-mode panel of the Index tab exposed two side-by-side buttons:

  • Index (primary, blue) → POST /api/index (non-stream)
  • Index with Progress (ghost, gray) → SSE-streamed GET /api/index/stream

The two-button shape made users guess which one to pick and diluted the form's primary action. This PR drops the non-stream button entirely and routes the single primary 인덱스 / Index button through the streaming handler so progress is always visible.

This is option (a) from the umbrella discussion (Prev #1). Option (b) — single button + a "show progress" toggle — would have kept two indexing paths alive and required a more complex STATE.indexing shape in #582 PR #6 (4.11). With (a) the indexing path is unified; PR #6 can use a single boolean flag.

Made possible by #591

#591 (closed #590) gave index_path_stream the missing namespace parameter and a complete.errors field — both consumed here. Without #591, this PR would silently regress the namespace input and the partial-failure UX (#354 fix).

Changes

  • web/static/app.js:
    • Delete the inline qs('index-btn').addEventListener('click', async () => {...}) handler (~70 LOC) that called POST /api/index.
    • runIndexStream now: reads namespace from qs('index-namespace') and passes it as a query param when non-empty; renders complete.errors into r-errors-row with the 5-cap "+N more" rule (preserves the index: POST /api/index returns 200 OK when all embeddings fail #354 partial-failure surface); dispatches toast.index_partial (red) on partial failure or toast.indexed_count (green, with the "Register as Source" toast action — folder mode is one-shot, mirroring the previous inline behavior).
    • Drop all qs('index-stream-btn') references (button no longer exists).
    • Listener registration switches from index-stream-btnindex-btn.
    • Section header renamed // Index stream (SSE progress)// Index (SSE-streamed; folder-mode primary action) to reflect the new role.
  • web/static/index.html: drop the <div class="index-btn-row"> wrapper and the index-stream-btn button. Single primary index-btn remains.
  • web/static/locales/{en,ko}.json: remove index.stream_btn and toast.stream_complete. Other keys (index.index_btn, toast.indexed_count, toast.index_partial, toast.action.register_persistent, toast.index_failed, toast.stream_fallback) stay.
  • web/static/style.css: drop .index-btn-row rule (it wrapped two buttons; now wraps one → row container unnecessary).
  • tests/test_i18n.py: remove toast.stream_complete from the required-key set so the parity guard stays green.

Net diff: −97 / +47, six files (mostly deletions; a handful of additions inside runIndexStream for namespace + error rendering).

What does NOT change

  • Backend (POST /api/index is still mounted; CLI / MCP callers continue to use it). This PR only changes the web folder-mode UI.
  • runIndexStream function name is kept (the mechanism IS streaming via EventSource — the name describes the implementation faithfully).
  • Hardcoded English status message "Please enter a path to index." (existed in both the inline handler and runIndexStream pre-PR; pre-existing i18n gap, out of scope here).

Refs

Test plan

  • uv run ruff check packages/memtomem/src && uv run ruff format --check packages/memtomem/src
  • uv run pytest packages/memtomem/tests/test_i18n.py -m "not ollama" — 12/12 pass (parity guard green after stream_complete removal from the required set).
  • uv run pytest packages/memtomem/tests/test_indexing_engine.py packages/memtomem/tests/test_web_routes.py packages/memtomem/tests/test_i18n.py packages/memtomem/tests/test_web_exclude_guard.py -m "not ollama" — 204/204 pass. No regressions in engine / routes / i18n / exclude guards.
  • Visual via Playwright (1280×800):
    • Index → 폴더 인덱싱 mode shows a single primary 인덱스 button (no ghost 진행률 표시 인덱스 sibling).
    • Empty-path click → status message Please enter a path to index. displays directly under the button (the .index-btn-row removal does not cause cramping; index-progress and index-msg keep their own spacing).
    • 0 console errors after page load + button click.
    • All /api/* initialization calls return 200.

🤖 Generated with Claude Code

The folder-mode panel exposed two side-by-side buttons — primary
``Index`` (POST /api/index) and ghost ``Index with Progress`` (SSE
stream). The two-button shape made users guess which one to pick and
diluted the form's primary action. Drop the non-stream button entirely
and route the single primary ``인덱스 / Index`` button through the
streaming handler so progress is always visible.

This is option (a) from the umbrella discussion (Prev #1). Option (b)
— single button + a "show progress" toggle — would have kept two
indexing paths alive and required a more complex ``STATE.indexing``
shape in #582 PR #6 (4.11). With (a) the indexing path is unified;
PR #6 can use a single boolean flag.

Made possible by #591 (closes #590), which gave ``index_path_stream``
the missing ``namespace`` parameter and a ``complete.errors`` field —
both consumed here. The streaming handler now matches the full UX of
the removed inline POST handler:

- Reads ``namespace`` from the form input and forwards it as a query
  param when non-empty.
- On ``complete``: renders ``r-errors-row`` with the same 5-cap
  "+N more" rule that the inline handler used (#354 partial-failure
  surface), then dispatches either ``toast.index_partial`` (red, with
  error count + first error) or ``toast.indexed_count`` (green, with
  the "Register as Source" toast action — folder mode is one-shot,
  so this nudge mirrors the inline behavior).

Removes ``index.stream_btn``, ``toast.stream_complete``, and the
``.index-btn-row`` CSS rule (now wraps a single button → row container
unnecessary). Updates ``test_i18n.py``'s required key set so the
parity guard stays green.

Refs #582 (Prev #1).

Co-Authored-By: Claude <[email protected]>
@memtomem memtomem merged commit ee7fbd0 into main Apr 30, 2026
7 checks passed
@memtomem memtomem deleted the feat/582-collapse-index-buttons branch April 30, 2026 04:20
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming indexing endpoint missing namespace + errors parity

2 participants