Skip to content

refactor(mongo-editor): migrate to shared ResultPanel - #495

Merged
Blankll merged 6 commits into
masterfrom
refactor/mongo-shared-result-panel
Aug 13, 2026
Merged

refactor(mongo-editor): migrate to shared ResultPanel#495
Blankll merged 6 commits into
masterfrom
refactor/mongo-shared-result-panel

Conversation

@Blankll

@Blankll Blankll commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary

Replace the MongoDB-specific result panel (mongo-editor/components/result-panel.vue, 973 lines) with the shared ResultPanel (@/components/result), reusing it via slots — the same component already used by the Elasticsearch docs browser.

Net effect: −1030 / +297 lines.

Changes (4 commits)

  1. feat(result) — Add @row-click emit + rowClassName prop to shared ResultPanel (purely additive; ES consumer passes neither).
  2. refactor(mongo-editor) — Migrate index.vue to the shared ResultPanel via 3 slots:
    • #toolbar: Insert Document button + total/queryTime status
    • #empty: executed-success ✓ card
    • #cell: actions DropdownMenu (edit/clone/delete) + value cells, row-click highlight
    • Lift the 3 document modals (insert/edit/delete) + mongoApi handlers into index.vue
    • Extract normalizeMongoResult + deriveMongoColumns pure utils (utils/mongo-result.ts) with 18 TDD tests
  3. refactor(mongo-editor) — Delete legacy result-panel.vue (973 lines: custom table/tree/json views, Monaco JSON editor, inline TreeNode — all covered by the shared component).
  4. chore(i18n) — Remove 8 orphaned editor.mongo.* keys (verified zero references).

Design decisions

  • Page reset on new query: :key="resultQueryId" forces remount (shared usePagination doesn't watch data).
  • Column derivation: explicit columns from first-20-docs sampling (bypasses shared auto-derive which sorts + scans all rows).
  • Row highlight: rowClassName render-prop; @update:page/@update:page-size clear selection.
  • Tree view: accepts the shared flat recursive tree (previously per-document cards).
  • JSON view: shared JsonView (Monaco readonly) is equivalent.

Verification

  • vue-tsc --noEmit — exit 0
  • vite build — exit 0
  • Jest: full suite 38 suites / 1608 tests pass; new utils tests 18/18 (TDD RED→GREEN, 100% coverage)
  • ESLint — clean
  • ES consumer (index-docs-browser-body.vue) — zero references to new props (no regression)
  • i18n — no dangling editor.mongo.* references

Blankll and others added 4 commits August 13, 2026 00:08
…ltPanel

Enables consumers to react to row selection (Mongo editor) and apply
row-level styling (selected-row highlight) without forking the shared
component. Purely additive — existing consumers pass neither prop.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Replace the legacy MongoDB result panel with the shared ResultPanel,
injecting Mongo-specific behavior through toolbar/empty/cell slots:
- Insert Document button + total/queryTime status (toolbar slot)
- executed-success empty state (empty slot)
- actions DropdownMenu (edit/clone/delete) + value cells (cell slot)
- row-click highlight via new rowClassName prop
Lift the three document modals (insert/edit/delete) and their mongoApi
handlers from the deleted result-panel.vue into index.vue.
Extract normalizeMongoResult + deriveMongoColumns pure utils with tests.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Superseded by the shared ResultPanel (commit 7f1f4a4). Removes 973
lines of Mongo-specific table/tree/json views, Monaco JSON editor and
inline TreeNode that the shared component now covers.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…igration

resultTitle, pageInfo, viewTable/viewTree/viewJson, actions, closePanel
and selectCollection are no longer referenced after the migration to the
shared ResultPanel (which renders its own labels) and the legacy
result-panel.vue deletion. Verified zero references via grep before
removing from enUS.ts and zhCN.ts.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.28%. Comparing base (8cb9aec) to head (a6a84fb).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #495      +/-   ##
==========================================
+ Coverage   60.22%   60.28%   +0.05%     
==========================================
  Files         121      122       +1     
  Lines       18935    18962      +27     
  Branches      880      885       +5     
==========================================
+ Hits        11404    11431      +27     
  Misses       7268     7268              
  Partials      263      263              
Files with missing lines Coverage Δ
src/lang/enUS.ts 100.00% <ø> (ø)
src/lang/zhCN.ts 100.00% <ø> (ø)
...rc/views/editor/mongo-editor/utils/mongo-result.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Blankll
Blankll merged commit 09de132 into master Aug 13, 2026
9 checks passed
Blankll added a commit that referenced this pull request Aug 14, 2026
## Summary

Replace the MongoDB-style legacy DynamoDB result panel
(`dynamo-editor/components/result-panel.vue`, 517 lines) with the
**shared ResultPanel** (`@/components/result`) — the same component used
by the Mongo editor (#495) and ES docs browser.

Net effect: **−526 / +248**.

## Commits

1. **`refactor(dynamo-editor): migrate to shared ResultPanel`**
- `ui-editor.vue`: shared panel, **offset-mode** pagination
(`pageCount×pageSize` → `total`), `@update:page`/`@update:page-size`
preserved
- `sql-editor.vue`: shared panel, **cursor mode** — `@next-page`
replaces data (`executePartiqlStatement` gains `mode: 'append' |
'replace'`, default append)
- `#cell` slot injects edit/delete action buttons (same pattern as Mongo
migration #495)
   - `delete-confirm-modal` lifted into both editors
- new `utils/dynamo-result.ts`: `flattenDynamoColumns` (unrolls Primary
Key group columns), `buildDynamoKeys`, `formatDynamoCell`

2. **`refactor(dynamo-editor): delete legacy result-panel, stop
persisting result data`**
   - Delete `result-panel.vue` (517 lines)
- `dbDataStore`: persist **only the query form** (`pick:
['dynamoData.uiQueryForm']`) — result panels start empty each visit
(previously stale rows were resurrected from localStorage)
   - Remove 3 orphaned i18n keys

## Behavior notes

- PartiQL pagination: "Load More (append)" → **next-page (replace)** —
confirmed with user
- Delete flow moved to editors; `deleteItem` store action still updates
both caches

## Verification

- `vue-tsc --noEmit` ✓
- `vite build` ✓
- No orphaned i18n references

---------

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant