-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Plugin Extensions: DataSource Configuration Components #108350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ents - Add DataSourceConfigActions and DataSourceConfigStatus extension points - Add PluginExtensionDataSourceConfigActionsContext and PluginExtensionDataSourceConfigStatusContext types - Update EditDataSourceActions.tsx with plugin extension support and allowlist filtering - Update DataSourceTestingStatus.tsx with dual extension point support (new + backward compatible) - Create getDataSourceExtensionConfigs.tsx with example core extensions - Update getCoreExtensionConfigurations.ts to include datasource extensions - Implement grafana-owned plugin allowlist for security and quality control - Support context-aware extensions based on datasource type and testing status - Maintain backward compatibility with existing DataSourceConfigErrorStatus extension point - Add proper TypeScript types and export them in index.ts This enables grafana-owned plugins to provide contextual actions and status-specific integrations within the datasource configuration workflow while maintaining security through plugin filtering.
- Add comprehensive implementation status section with completed features - Document critical lessons learned during implementation: * Translation limitations in extension configurations * Plugin security through allowlist filtering * Extension registration timing constraints * TypeScript context type patterns - Update implementation checklist with actual completion status - Add detailed next steps and recommendations - Include plugin development guidelines (do's and don'ts) - Document architectural insights and patterns discovered - Transform specs from theoretical design to practical implementation guide This update serves as both historical record and developer guide for future plugin extension work in Grafana.
- Add EditDataSourceActions.test.tsx with 12 tests covering: * Core Grafana actions functionality and permissions * Plugin extension rendering and interaction * Plugin allowlist filtering and security * Context passing and URL generation - Add getDataSourceExtensionConfigs.test.tsx with 14 tests covering: * Core extension configurations for both extension points * Context filtering logic (datasource type, severity) * Error handling and graceful failures * Extension structure validation and type safety Total: 26 tests passing, providing comprehensive coverage of the DataSourceConfigActions and DataSourceConfigStatus extension points implemented in previous commits.
- Mark unit testing phase as complete (26 tests added) - Add comprehensive Test Implementation section documenting: * Test file details and coverage areas * Testing challenges and solutions discovered * Performance metrics and execution strategy * Command examples for running tests - Update Success Metrics with concrete testing validation - Update Next Steps to reflect testing completion - Document new test files in Files Modified section The plugin extensions implementation now has complete unit test coverage for both DataSourceConfigActions and DataSourceConfigStatus extension points with 26 passing tests.
…rce extension tests
The troubleshooting link extension was using an invalid path format '/docs/troubleshooting/datasources' which caused console.error during test execution. Updated to proper Grafana core extension path format '/a/grafana/docs/troubleshooting/datasources' to comply with plugin extension validation rules.
- Fix incorrect data-testid expectations to use proper e2e selectors - Add contextSrv mock for hasAccessToExplore() dependency - Create proper plugin links mock handling different extension points - Update plugin link tests to use allowed plugin IDs - Fix test logic to match actual component behavior for status/error links - Add test coverage for non-allowed plugin filtering All 10 tests now pass successfully.
…eTestingStatus test - Replace any[] with PluginExtensionLink[] for statusLinks and errorLinks parameters - Replace any with UsePluginLinksOptions for setPluginLinksHook callback parameter - Add proper imports for PluginExtensionLink and UsePluginLinksOptions - Improve type safety and IntelliSense support in tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds plugin extension points to DataSource configuration components, enabling plugins to register custom actions and status links in the datasource configuration interface. The implementation focuses on providing entry points for drilldown apps and healthcheck interfaces.
- Introduces two new extension points:
DataSourceConfigActionsandDataSourceConfigStatus - Updates
EditDataSourceActionsandDataSourceTestingStatuscomponents to consume plugin extensions - Includes comprehensive test coverage and example configurations for the new extension functionality
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
getCoreExtensionConfigurations.ts |
Integrates datasource extensions into core extension configuration |
getDataSourceExtensionConfigs.tsx |
Provides example plugin extension configurations for datasource actions and status |
getDataSourceExtensionConfigs.test.tsx |
Comprehensive test suite covering extension configuration behavior |
EditDataSourceActions.tsx |
Adds plugin extension support with allowlist filtering for datasource actions |
EditDataSourceActions.test.tsx |
Test coverage for plugin extension integration in datasource actions |
DataSourceTestingStatus.tsx |
Extends status component to support both general and error-specific plugin links |
DataSourceTestingStatus.test.tsx |
Updates existing tests and adds coverage for new plugin extension functionality |
pluginExtensions.ts |
Defines new extension points and context types for datasource configuration |
index.ts |
Exports new context types for external plugin consumption |
public/app/features/datasources/extensions/getDataSourceExtensionConfigs.tsx
Outdated
Show resolved
Hide resolved
public/app/features/datasources/extensions/getDataSourceExtensionConfigs.tsx
Outdated
Show resolved
Hide resolved
public/app/features/datasources/components/EditDataSourceActions.tsx
Outdated
Show resolved
Hide resolved
public/app/features/datasources/components/DataSourceTestingStatus.tsx
Outdated
Show resolved
Hide resolved
public/app/features/datasources/components/EditDataSourceActions.tsx
Outdated
Show resolved
Hide resolved
I think it's almost there! 👍 Left two small comments.
…plugin contributions to datasource configuration pages
…ilable - When hasActions is empty: shows normal Explore data and Build dashboard buttons - When hasActions is not empty: converts Explore data to dropdown with angle-down icon - First dropdown item: 'Open in Explore View' - Following items: extension links - Build dashboard button remains unchanged - Maintains existing tracking functionality and internationalization
- Update tests to work with new Explore data dropdown that includes extensions - Replace references to 'Extensions' button with 'Explore data' dropdown - Add test for 'Open in Explore View' menu item in dropdown - Verify correct behavior when extensions are present vs absent - All 13 tests now passing
- Add test to verify explore action href when extensions are present - Ensure both dropdown and direct link behaviors are tested - Complete test coverage for new dropdown implementation
- Move extension links from inline definition to props for better reusability - Add proper TypeScript support for PluginExtensionLink types - Improve component architecture by separating concerns - Add extensionLinks styling to getStyles function for consistency - Support both real extension links and custom link rendering in success messages This improves the component's flexibility while maintaining type safety.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀

This PR adds plugin extension points to DataSource configuration components, enabling plugins to register custom actions and status links in the datasource configuration interface. The implementation focuses on providing entry points for drilldown apps and healthcheck interfaces.
Introduces two new extension points:
DataSourceConfigActionsandDataSourceConfigStatusUpdates
EditDataSourceActionsandDataSourceTestingStatuscomponents to consume plugin extensionsOverview
This specification defines the addition of plugin extension points to DataSource configuration components, allowing plugins to register custom actions and status links in the datasource configuration interface.
tl;dr We want to add more entry points for the drilldown apps, healthcheck to drilldown interface is added
Only limited to the following plugins:
Supports: grafana/metrics-drilldown#424