PluginExtensions: Added support for sharing functions (#98888)

* feat: add generic plugin extension functions

* updated betterer.

* Fixed type issues after sync with main.

* Remved extensions from datasource and panel.

* Added validation for extension function registry.

* Added tests and validation logic for function extensions registry.

* removed prop already existing on base.

* fixed lint error.

---------

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
This commit is contained in:
Dominik Süß
2025-02-13 10:18:55 +01:00
committed by GitHub
parent fbf96916aa
commit 8a8e47fcea
40 changed files with 1182 additions and 69 deletions

View File

@ -63,6 +63,7 @@ type ExtensionsV2 struct {
AddedComponents []AddedComponent `json:"addedComponents"`
ExposedComponents []ExposedComponent `json:"exposedComponents"`
ExtensionPoints []ExtensionPoint `json:"extensionPoints"`
AddedFunctions []AddedFunction `json:"addedFunctions"`
}
type Extensions ExtensionsV2
@ -76,6 +77,7 @@ func (e *Extensions) UnmarshalJSON(data []byte) error {
e.AddedLinks = extensionsV2.AddedLinks
e.ExposedComponents = extensionsV2.ExposedComponents
e.ExtensionPoints = extensionsV2.ExtensionPoints
e.AddedFunctions = extensionsV2.AddedFunctions
return nil
}
@ -123,6 +125,11 @@ type AddedComponent struct {
Description string `json:"description"`
}
type AddedFunction struct {
Targets []string `json:"targets"`
Title string `json:"title"`
}
type ExposedComponent struct {
Id string `json:"id"`
Title string `json:"title"`
@ -267,6 +274,7 @@ type PluginMetaDTO struct {
Angular AngularMeta `json:"angular"`
MultiValueFilterOperators bool `json:"multiValueFilterOperators"`
LoadingStrategy LoadingStrategy `json:"loadingStrategy"`
Extensions Extensions `json:"extensions"`
}
type DataSourceDTO struct {