mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
k8s: add feature toggle and stub to save dashboards k8s (#62053)
This commit is contained in:
93
pkg/services/store/k8saccess/dashboard_service.go
Normal file
93
pkg/services/store/k8saccess/dashboard_service.go
Normal file
@@ -0,0 +1,93 @@
|
||||
package k8saccess
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/dashboards"
|
||||
"github.com/grafana/grafana/pkg/services/store/entity"
|
||||
)
|
||||
|
||||
type k8sDashboardService struct {
|
||||
orig dashboards.DashboardService
|
||||
store entity.EntityStoreServer
|
||||
}
|
||||
|
||||
var _ dashboards.DashboardService = (*k8sDashboardService)(nil)
|
||||
|
||||
func NewDashboardService(orig dashboards.DashboardService, store entity.EntityStoreServer) dashboards.DashboardService {
|
||||
return &k8sDashboardService{
|
||||
orig: orig,
|
||||
store: store,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) BuildSaveDashboardCommand(ctx context.Context, dto *dashboards.SaveDashboardDTO, shouldValidateAlerts bool, validateProvisionedDashboard bool) (*dashboards.SaveDashboardCommand, error) {
|
||||
return s.orig.BuildSaveDashboardCommand(ctx, dto, shouldValidateAlerts, validateProvisionedDashboard)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) DeleteDashboard(ctx context.Context, dashboardId int64, orgId int64) error {
|
||||
return s.orig.DeleteDashboard(ctx, dashboardId, orgId)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) FindDashboards(ctx context.Context, query *models.FindPersistedDashboardsQuery) ([]dashboards.DashboardSearchProjection, error) {
|
||||
return s.orig.FindDashboards(ctx, query)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) GetDashboard(ctx context.Context, query *dashboards.GetDashboardQuery) error {
|
||||
return s.orig.GetDashboard(ctx, query)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) GetDashboardACLInfoList(ctx context.Context, query *dashboards.GetDashboardACLInfoListQuery) error {
|
||||
return s.orig.GetDashboardACLInfoList(ctx, query)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) GetDashboards(ctx context.Context, query *dashboards.GetDashboardsQuery) error {
|
||||
return s.orig.GetDashboards(ctx, query)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) GetDashboardTags(ctx context.Context, query *dashboards.GetDashboardTagsQuery) error {
|
||||
return s.orig.GetDashboardTags(ctx, query)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) GetDashboardUIDByID(ctx context.Context, query *dashboards.GetDashboardRefByIDQuery) error {
|
||||
return s.orig.GetDashboardUIDByID(ctx, query)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) HasAdminPermissionInDashboardsOrFolders(ctx context.Context, query *models.HasAdminPermissionInDashboardsOrFoldersQuery) error {
|
||||
return s.orig.HasAdminPermissionInDashboardsOrFolders(ctx, query)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) HasEditPermissionInFolders(ctx context.Context, query *models.HasEditPermissionInFoldersQuery) error {
|
||||
return s.orig.HasEditPermissionInFolders(ctx, query)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) ImportDashboard(ctx context.Context, dto *dashboards.SaveDashboardDTO) (*dashboards.Dashboard, error) {
|
||||
return s.orig.ImportDashboard(ctx, dto)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) MakeUserAdmin(ctx context.Context, orgID int64, userID, dashboardID int64, setViewAndEditPermissions bool) error {
|
||||
return s.orig.MakeUserAdmin(ctx, orgID, userID, dashboardID, setViewAndEditPermissions)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) SaveDashboard(ctx context.Context, dto *dashboards.SaveDashboardDTO, allowUiUpdate bool) (*dashboards.Dashboard, error) {
|
||||
fmt.Printf("SAVE: " + dto.Dashboard.UID)
|
||||
return s.orig.SaveDashboard(ctx, dto, allowUiUpdate)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) SearchDashboards(ctx context.Context, query *models.FindPersistedDashboardsQuery) error {
|
||||
return s.orig.SearchDashboards(ctx, query)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) UpdateDashboardACL(ctx context.Context, uid int64, items []*dashboards.DashboardACL) error {
|
||||
return s.orig.UpdateDashboardACL(ctx, uid, items)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) DeleteACLByUser(ctx context.Context, userID int64) error {
|
||||
return s.orig.DeleteACLByUser(ctx, userID)
|
||||
}
|
||||
|
||||
func (s *k8sDashboardService) CountDashboardsInFolder(ctx context.Context, query *dashboards.CountDashboardsInFolderQuery) (int64, error) {
|
||||
return s.orig.CountDashboardsInFolder(ctx, query)
|
||||
}
|
||||
Reference in New Issue
Block a user