2025-02-19 22:50:39 +08:00
|
|
|
package dualwrite
|
|
|
|
|
|
|
|
import (
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
|
|
|
|
2025-04-24 02:21:59 +08:00
|
|
|
dashboard "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v1beta1"
|
2025-04-15 04:20:10 +08:00
|
|
|
folders "github.com/grafana/grafana/apps/folder/pkg/apis/folder/v1beta1"
|
2025-02-19 22:50:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func IsReadingLegacyDashboardsAndFolders(ctx context.Context, svc Service) bool {
|
|
|
|
f, _ := svc.ReadFromUnified(ctx, folders.FolderResourceInfo.GroupResource())
|
|
|
|
d, _ := svc.ReadFromUnified(ctx, schema.GroupResource{
|
|
|
|
Group: dashboard.GROUP,
|
|
|
|
Resource: dashboard.DASHBOARD_RESOURCE,
|
|
|
|
})
|
2025-04-10 20:42:23 +08:00
|
|
|
return !f || !d
|
2025-02-19 22:50:39 +08:00
|
|
|
}
|