Skip to content

feat: plugin system UI extensions, error modal, and test fixes#101

Open
debba wants to merge 19 commits intomainfrom
feat/plugin-system-ui
Open

feat: plugin system UI extensions, error modal, and test fixes#101
debba wants to merge 19 commits intomainfrom
feat/plugin-system-ui

Conversation

@debba
Copy link
Copy Markdown
Owner

@debba debba commented Mar 23, 2026

Summary

  • Plugin UI Extensions (Phase 2): Full plugin slot system with PluginSlotProvider, SlotAnchor, error boundaries, and IIFE module loading for external plugin bundles. Plugins can contribute UI components to predefined slots (toolbar, context menu, sidebar, row editor, settings, connection modal).
  • Plugin Modal & API: Added PluginModalContext/PluginModalProvider for plugin-managed modals, and usePluginApi hooks (usePluginQuery, usePluginConnection, usePluginToast, usePluginModal, usePluginTheme, usePluginTranslation, usePluginSetting).
  • manage_tables capability: Gating for table management actions (create, rename, drop, truncate) based on driver capabilities — external plugin drivers can now opt in or out.
  • ErrorModal component: New in-app error modal replacing native Tauri message() dialogs in DataGrid.tsx and Editor.tsx for a consistent UX.
  • Test fixes: Fixed SlotAnchor, PluginSlotProvider, and EditorProvider tests — added missing SettingsContext wrapper, removed stale builtinPluginContributions import, and handled load_editor_preferences mock.
  • Docs & guides: Plugin guide, wiki page, and updated UI extensions spec.

Test plan

  • Rust tests: 97/97 passed
  • Frontend tests: 1540/1540 passed (all 3 previously failing tests fixed)
  • Manual: verify plugin slot rendering with an external plugin (e.g. Google Sheets auth UI)
  • Manual: verify ErrorModal displays correctly on update/delete failures
  • Manual: verify manage_tables gating hides actions for plugins without the capability

claude and others added 12 commits March 15, 2026 21:41
Adds a slot-based UI extension system allowing plugins to inject React
components into predefined locations throughout the application. Includes
PluginSlotRegistry context, SlotAnchor component with ErrorBoundary
isolation, plugin API hooks (usePluginQuery, usePluginConnection,
usePluginToast, usePluginSetting, usePluginTheme), dynamic module
loader, and 8 slot anchors across NewRowModal, RowEditorSidebar,
TableToolbar, DataGrid context menu, Sidebar footer, and Settings
plugin actions.

https://claude.ai/code/session_01CJqE5Hdg5nXnEJSK4SCXbt
Update spec from Draft v0.1 to Implemented v0.2 with actual types
matching the implementation (SlotName, SlotContext, SlotComponentProps,
PluginSlotRegistryType). Add the 8th slot (settings.plugin.actions) to
spec, blog post, wiki, and plugin guide. Add UI Extensions section to
wiki/plugins.md and PLUGIN_GUIDE.md. Update plugins/README.md with
UI extension references.

https://claude.ai/code/session_01CJqE5Hdg5nXnEJSK4SCXbt
Add a built-in JSON Viewer plugin demonstrating the slot-based UI extension
system. The plugin renders collapsible, syntax-highlighted JSON trees for
JSON/JSONB columns in the row editor sidebar and new row modal.

- Create JsonPreview component with recursive JSON tree rendering
- Register builtin plugin contributions in PluginSlotProvider
- Add 12 tests for JsonPreview and fix 3 PluginSlotProvider tests
- Update plugin documentation (wiki, guide) with example plugin details

https://claude.ai/code/session_01CJqE5Hdg5nXnEJSK4SCXbt
export usePluginModal and PluginModalOptions; integrate provider into
App and plugin API
replace tauri dialog messages in DataGrid and Editor
@debba debba self-assigned this Mar 23, 2026
@debba debba added the enhancement New feature or request label Mar 23, 2026
@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot bot commented Mar 23, 2026

Code Review Summary

Status: 5 Issues Found (all pre-existing) | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 5
SUGGESTION 0

Summary

This PR introduces a comprehensive Plugin UI Extensions system (Phase 2) including:

  • Slot-based UI extension system - Plugins can inject React components into predefined slots (toolbar, context menu, sidebar, row editor, settings)
  • Plugin API hooks - usePluginQuery, usePluginConnection, usePluginToast, usePluginModal, usePluginTheme, usePluginTranslation
  • Driver capabilities - manage_tables and readonly flags for fine-grained UI control
  • UI-only plugins - Support for plugins without executables
  • ErrorModal component - Consistent in-app error dialogs replacing native Tauri messages

Pre-existing Issues

File Line Issue
src/components/ui/DataGrid.tsx 412 Missing separator between translated message and error object
src/components/ui/SlotAnchor.tsx 27 Context object in useMemo dependency array may cause excessive re-renders
src/pages/Editor.tsx 1046 Missing space between translated message and error
src/pages/Editor.tsx 1156 Missing space between translated message and error
src/pages/Editor.tsx 1272 Missing space between translated message and error

Code Quality Observations

Positive:

  • Proper error isolation with SlotErrorBoundary for plugin components
  • Good use of dynamic imports with IIFE bundle loading for external plugins
  • Security-conscious path validation in read_plugin_file command (prevents directory traversal)
  • Clean separation between driver-based and UI-only plugins
  • Comprehensive TypeScript types for slot system

Notes:

  • The SlotAnchor.tsx context dependency issue (line 27) is a React best practice concern - consider using a stable context reference or memoizing at the call site
  • String concatenation for error messages should include separators for readability (e.g., t("key") + ": " + String(err) instead of direct concatenation)

Files Reviewed (33 files)

Core Plugin System:

  • src/components/ui/SlotAnchor.tsx
  • src/components/ui/SlotErrorBoundary.tsx
  • src/contexts/PluginSlotProvider.tsx
  • src/contexts/PluginModalProvider.tsx
  • src/hooks/usePluginApi.ts
  • src/types/pluginSlots.ts
  • src/utils/pluginModuleLoader.ts
  • src/pluginApi.ts

UI Components:

  • src/components/ui/DataGrid.tsx
  • src/components/ui/RowEditorSidebar.tsx
  • src/components/ui/TableToolbar.tsx
  • src/components/modals/ErrorModal.tsx
  • src/components/modals/NewRowModal.tsx
  • src/components/modals/NewConnectionModal.tsx

Layout Components:

  • src/components/layout/ExplorerSidebar.tsx
  • src/components/layout/Sidebar.tsx
  • src/components/layout/sidebar/*.tsx

Backend (Rust):

  • src-tauri/src/plugins/commands.rs
  • src-tauri/src/plugins/manager.rs
  • src-tauri/src/drivers/driver_trait.rs
  • src-tauri/src/drivers/registry.rs

Other:

  • src/App.tsx
  • src/pages/Editor.tsx
  • src/pages/Settings.tsx
  • src/utils/driverCapabilities.ts
  • Documentation and test files

Fix these issues in Kilo Cloud


Reviewed by kimi-k2.5-0127 · 410,279 tokens

title: t("general.error"),
kind: "error",
});
setErrorModal({ isOpen: true, message: t("editor.failedCreateRow") + String(err) });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Missing space between translated message and error

The error message concatenation is missing a separator space:

Suggested change
setErrorModal({ isOpen: true, message: t("editor.failedCreateRow") + String(err) });
setErrorModal({ isOpen: true, message: t("editor.failedCreateRow") + " " + String(err) });

title: t("common.error"),
kind: "error",
});
setErrorModal({ isOpen: true, message: t("editor.failedProcessInsertions") + String(err) });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Missing space between translated message and error

The error message concatenation is missing a separator space:

Suggested change
setErrorModal({ isOpen: true, message: t("editor.failedProcessInsertions") + String(err) });
setErrorModal({ isOpen: true, message: t("editor.failedProcessInsertions") + " " + String(err) });

title: t("common.error"),
kind: "error",
});
setErrorModal({ isOpen: true, message: t("dataGrid.updateFailed") + String(e) });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Missing space between translated message and error

The error message concatenation is missing a separator space:

Suggested change
setErrorModal({ isOpen: true, message: t("dataGrid.updateFailed") + String(e) });
setErrorModal({ isOpen: true, message: t("dataGrid.updateFailed") + " " + String(e) });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants