[Folders] Put move and counts behid a feature flag (#98317)

* Put move and counts behid a feature flag

* Gen toggles

* Generate feature flag

* Make feature name more explicit

* Remove unused code

* Update toggle  name
This commit is contained in:
Leonor Oliveira 2024-12-27 18:10:44 +01:00 committed by GitHub
parent e72ba20ff6
commit df36e77cd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 92 additions and 2 deletions

View File

@ -230,6 +230,8 @@ Experimental features might be changed or removed without prior notice.
| `useV2DashboardsAPI` | Use the v2 kubernetes API in the frontend for dashboards |
| `unifiedHistory` | Displays the navigation history so the user can navigate back to previous pages |
| `investigationsBackend` | Enable the investigations backend API |
| `k8SFolderCounts` | Enable folder's api server counts |
| `k8SFolderMove` | Enable folder's api server move |
## Development feature toggles

View File

@ -248,4 +248,6 @@ export interface FeatureToggles {
unifiedHistory?: boolean;
lokiLabelNamesQueryApi?: boolean;
investigationsBackend?: boolean;
k8SFolderCounts?: boolean;
k8SFolderMove?: boolean;
}

View File

@ -63,8 +63,16 @@ func (hs *HTTPServer) registerFolderAPI(apiRoute routing.RouteRegister, authoriz
folderUidRoute.Put("/", handler.updateFolder)
folderUidRoute.Delete("/", handler.deleteFolder)
folderUidRoute.Get("/", handler.getFolder)
folderUidRoute.Get("/counts", handler.countFolderContent)
folderUidRoute.Post("/move", handler.moveFolder)
if hs.Features.IsEnabledGlobally(featuremgmt.FlagK8SFolderCounts) {
folderUidRoute.Get("/counts", handler.countFolderContent)
} else {
folderUidRoute.Get("/counts", authorize(accesscontrol.EvalPermission(dashboards.ActionFoldersRead, uidScope)), routing.Wrap(hs.GetFolderDescendantCounts))
}
if hs.Features.IsEnabledGlobally(featuremgmt.FlagK8SFolderMove) {
folderUidRoute.Post("/move", handler.moveFolder)
} else {
folderUidRoute.Post("/move", authorize(accesscontrol.EvalPermission(dashboards.ActionFoldersWrite, uidScope)), routing.Wrap(hs.MoveFolder))
}
})
} else {
folderRoute.Post("/", authorize(accesscontrol.EvalPermission(dashboards.ActionFoldersCreate)), routing.Wrap(hs.CreateFolder))

View File

@ -1719,6 +1719,20 @@ var (
Owner: grafanaAppPlatformSquad,
Expression: "false",
},
{
Name: "k8SFolderCounts",
Description: "Enable folder's api server counts",
Stage: FeatureStageExperimental,
Owner: grafanaSearchAndStorageSquad,
Expression: "false",
},
{
Name: "k8SFolderMove",
Description: "Enable folder's api server move",
Stage: FeatureStageExperimental,
Owner: grafanaSearchAndStorageSquad,
Expression: "false",
},
}
)

View File

@ -229,3 +229,5 @@ elasticsearchCrossClusterSearch,preview,@grafana/aws-datasources,false,false,fal
unifiedHistory,experimental,@grafana/grafana-frontend-platform,false,false,true
lokiLabelNamesQueryApi,GA,@grafana/observability-logs,false,false,false
investigationsBackend,experimental,@grafana/grafana-app-platform-squad,false,false,false
k8SFolderCounts,experimental,@grafana/search-and-storage,false,false,false
k8SFolderMove,experimental,@grafana/search-and-storage,false,false,false

1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
229 unifiedHistory experimental @grafana/grafana-frontend-platform false false true
230 lokiLabelNamesQueryApi GA @grafana/observability-logs false false false
231 investigationsBackend experimental @grafana/grafana-app-platform-squad false false false
232 k8SFolderCounts experimental @grafana/search-and-storage false false false
233 k8SFolderMove experimental @grafana/search-and-storage false false false

View File

@ -926,4 +926,12 @@ const (
// FlagInvestigationsBackend
// Enable the investigations backend API
FlagInvestigationsBackend = "investigationsBackend"
// FlagK8SFolderCounts
// Enable folder's api server counts
FlagK8SFolderCounts = "k8SFolderCounts"
// FlagK8SFolderMove
// Enable folder's api server move
FlagK8SFolderMove = "k8SFolderMove"
)

View File

@ -1586,6 +1586,34 @@
"frontend": true
}
},
{
"metadata": {
"name": "folderCounts",
"resourceVersion": "1734702013658",
"creationTimestamp": "2024-12-20T13:40:13Z",
"deletionTimestamp": "2024-12-27T10:19:54Z"
},
"spec": {
"description": "Enable folder's api server counts",
"stage": "experimental",
"codeowner": "@grafana/search-and-storage",
"expression": "false"
}
},
{
"metadata": {
"name": "folderMove",
"resourceVersion": "1734702013658",
"creationTimestamp": "2024-12-20T13:40:13Z",
"deletionTimestamp": "2024-12-27T10:19:54Z"
},
"spec": {
"description": "Enable folder's api server move",
"stage": "experimental",
"codeowner": "@grafana/search-and-storage",
"expression": "false"
}
},
{
"metadata": {
"name": "formatString",
@ -1886,6 +1914,32 @@
"hideFromDocs": true
}
},
{
"metadata": {
"name": "k8SFolderCounts",
"resourceVersion": "1735294794086",
"creationTimestamp": "2024-12-27T10:19:54Z"
},
"spec": {
"description": "Enable folder's api server counts",
"stage": "experimental",
"codeowner": "@grafana/search-and-storage",
"expression": "false"
}
},
{
"metadata": {
"name": "k8SFolderMove",
"resourceVersion": "1735294794086",
"creationTimestamp": "2024-12-27T10:19:54Z"
},
"spec": {
"description": "Enable folder's api server move",
"stage": "experimental",
"codeowner": "@grafana/search-and-storage",
"expression": "false"
}
},
{
"metadata": {
"name": "kubernetesAggregator",