Plugins: Expose core APIs only for certain plugins (#107967)

* feat(plugins): add a way to expose core apis only to certain plugins

* review: update naming

* review: update the owners of the feature toggle

* feat: share the restricted apis with extensions

* fix: linters

* feat: remove the `addPanel` api

* chore: fix linting and betterer issue

* tests: use `@ts-expect-error` for more clarity
This commit is contained in:
Levente Balogh
2025-09-01 11:57:00 +02:00
committed by GitHub
parent da43e2ae07
commit d31e682345
20 changed files with 504 additions and 43 deletions
+9
View File
@@ -1869,6 +1869,15 @@ var (
Owner: grafanaAlertingSquad,
HideFromAdminPage: true,
HideFromDocs: true,
},
{
Name: "restrictedPluginApis",
Description: "Enables sharing a list of APIs with a list of plugins",
Stage: FeatureStageExperimental,
Owner: grafanaPluginsPlatformSquad,
HideFromAdminPage: true,
HideFromDocs: true,
FrontendOnly: true,
Expression: "false",
},
{
+1
View File
@@ -241,6 +241,7 @@ unifiedStorageSearchDualReaderEnabled,experimental,@grafana/search-and-storage,f
dashboardDsAdHocFiltering,experimental,@grafana/datapro,false,false,true
dashboardLevelTimeMacros,experimental,@grafana/dashboards-squad,false,false,true
alertmanagerRemoteSecondaryWithRemoteState,experimental,@grafana/alerting-squad,false,false,false
restrictedPluginApis,experimental,@grafana/plugins-platform-backend,false,false,true
adhocFiltersInTooltips,experimental,@grafana/datapro,false,false,true
favoriteDatasources,experimental,@grafana/plugins-platform-backend,false,false,true
newLogContext,experimental,@grafana/observability-logs,false,false,true
1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
241 dashboardDsAdHocFiltering experimental @grafana/datapro false false true
242 dashboardLevelTimeMacros experimental @grafana/dashboards-squad false false true
243 alertmanagerRemoteSecondaryWithRemoteState experimental @grafana/alerting-squad false false false
244 restrictedPluginApis experimental @grafana/plugins-platform-backend false false true
245 adhocFiltersInTooltips experimental @grafana/datapro false false true
246 favoriteDatasources experimental @grafana/plugins-platform-backend false false true
247 newLogContext experimental @grafana/observability-logs false false true
+4
View File
@@ -975,6 +975,10 @@ const (
// Starts Grafana in remote secondary mode pulling the latest state from the remote Alertmanager to avoid duplicate notifications.
FlagAlertmanagerRemoteSecondaryWithRemoteState = "alertmanagerRemoteSecondaryWithRemoteState"
// FlagRestrictedPluginApis
// Enables sharing a list of APIs with a list of plugins
FlagRestrictedPluginApis = "restrictedPluginApis"
// FlagAdhocFiltersInTooltips
// Enable adhoc filter buttons in visualization tooltips
FlagAdhocFiltersInTooltips = "adhocFiltersInTooltips"
+25 -4
View File
@@ -572,16 +572,18 @@
{
"metadata": {
"name": "alertmanagerRemoteSecondaryWithRemoteState",
"resourceVersion": "1753448760331",
"creationTimestamp": "2025-07-25T13:06:00Z"
"resourceVersion": "1753776005753",
"creationTimestamp": "2025-07-25T13:06:00Z",
"annotations": {
"grafana.app/updatedTimestamp": "2025-07-29 08:00:05.753498 +0000 UTC"
}
},
"spec": {
"description": "Starts Grafana in remote secondary mode pulling the latest state from the remote Alertmanager to avoid duplicate notifications.",
"stage": "experimental",
"codeowner": "@grafana/alerting-squad",
"hideFromAdminPage": true,
"hideFromDocs": true,
"expression": "false"
"hideFromDocs": true
}
},
{
@@ -2889,6 +2891,25 @@
"expression": "false"
}
},
{
"metadata": {
"name": "restrictedPluginApis",
"resourceVersion": "1753776783657",
"creationTimestamp": "2025-07-25T07:46:26Z",
"annotations": {
"grafana.app/updatedTimestamp": "2025-07-29 08:13:03.657209 +0000 UTC"
}
},
"spec": {
"description": "Enables sharing a list of APIs with a list of plugins",
"stage": "experimental",
"codeowner": "@grafana/plugins-platform-backend",
"frontend": true,
"hideFromAdminPage": true,
"hideFromDocs": true,
"expression": "false"
}
},
{
"metadata": {
"name": "rolePickerDrawer",