mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 11:44:26 -06:00
52ed651958
This PR adds endpoints for saving and retrieving a public dashboard configuration and and api endpoint to retrieve the public dashboard. All of this is highly experimental and APIs will change. Notably, we will be removing isPublic from the dashboard model and moving it over to the public dashboard table in the next release. Further context can be found here: https://github.com/grafana/grafana/pull/49131#issuecomment-1145456952
343 lines
10 KiB
Go
343 lines
10 KiB
Go
// Code generated by mockery v2.12.1. DO NOT EDIT.
|
|
|
|
package dashboards
|
|
|
|
import (
|
|
context "context"
|
|
|
|
models "github.com/grafana/grafana/pkg/models"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
testing "testing"
|
|
)
|
|
|
|
// FakeDashboardService is an autogenerated mock type for the DashboardService type
|
|
type FakeDashboardService struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// BuildSaveDashboardCommand provides a mock function with given fields: ctx, dto, shouldValidateAlerts, validateProvisionedDashboard
|
|
func (_m *FakeDashboardService) BuildSaveDashboardCommand(ctx context.Context, dto *SaveDashboardDTO, shouldValidateAlerts bool, validateProvisionedDashboard bool) (*models.SaveDashboardCommand, error) {
|
|
ret := _m.Called(ctx, dto, shouldValidateAlerts, validateProvisionedDashboard)
|
|
|
|
var r0 *models.SaveDashboardCommand
|
|
if rf, ok := ret.Get(0).(func(context.Context, *SaveDashboardDTO, bool, bool) *models.SaveDashboardCommand); ok {
|
|
r0 = rf(ctx, dto, shouldValidateAlerts, validateProvisionedDashboard)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.SaveDashboardCommand)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, *SaveDashboardDTO, bool, bool) error); ok {
|
|
r1 = rf(ctx, dto, shouldValidateAlerts, validateProvisionedDashboard)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// DeleteDashboard provides a mock function with given fields: ctx, dashboardId, orgId
|
|
func (_m *FakeDashboardService) DeleteDashboard(ctx context.Context, dashboardId int64, orgId int64) error {
|
|
ret := _m.Called(ctx, dashboardId, orgId)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) error); ok {
|
|
r0 = rf(ctx, dashboardId, orgId)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// FindDashboards provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) FindDashboards(ctx context.Context, query *models.FindPersistedDashboardsQuery) ([]DashboardSearchProjection, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
var r0 []DashboardSearchProjection
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.FindPersistedDashboardsQuery) []DashboardSearchProjection); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]DashboardSearchProjection)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, *models.FindPersistedDashboardsQuery) error); ok {
|
|
r1 = rf(ctx, query)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetDashboard provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) GetDashboard(ctx context.Context, query *models.GetDashboardQuery) error {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.GetDashboardQuery) error); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// GetDashboardAclInfoList provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) GetDashboardAclInfoList(ctx context.Context, query *models.GetDashboardAclInfoListQuery) error {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.GetDashboardAclInfoListQuery) error); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// GetDashboardTags provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) GetDashboardTags(ctx context.Context, query *models.GetDashboardTagsQuery) error {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.GetDashboardTagsQuery) error); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// GetDashboardUIDById provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) GetDashboardUIDById(ctx context.Context, query *models.GetDashboardRefByIdQuery) error {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.GetDashboardRefByIdQuery) error); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// GetDashboards provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) GetDashboards(ctx context.Context, query *models.GetDashboardsQuery) error {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.GetDashboardsQuery) error); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// GetPublicDashboard provides a mock function with given fields: ctx, publicDashboardUid
|
|
func (_m *FakeDashboardService) GetPublicDashboard(ctx context.Context, publicDashboardUid string) (*models.Dashboard, error) {
|
|
ret := _m.Called(ctx, publicDashboardUid)
|
|
|
|
var r0 *models.Dashboard
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) *models.Dashboard); ok {
|
|
r0 = rf(ctx, publicDashboardUid)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.Dashboard)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, publicDashboardUid)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetPublicDashboardConfig provides a mock function with given fields: ctx, orgId, dashboardUid
|
|
func (_m *FakeDashboardService) GetPublicDashboardConfig(ctx context.Context, orgId int64, dashboardUid string) (*models.PublicDashboardConfig, error) {
|
|
ret := _m.Called(ctx, orgId, dashboardUid)
|
|
|
|
var r0 *models.PublicDashboardConfig
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string) *models.PublicDashboardConfig); ok {
|
|
r0 = rf(ctx, orgId, dashboardUid)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.PublicDashboardConfig)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string) error); ok {
|
|
r1 = rf(ctx, orgId, dashboardUid)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// HasAdminPermissionInFolders provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) HasAdminPermissionInFolders(ctx context.Context, query *models.HasAdminPermissionInFoldersQuery) error {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.HasAdminPermissionInFoldersQuery) error); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// HasEditPermissionInFolders provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) HasEditPermissionInFolders(ctx context.Context, query *models.HasEditPermissionInFoldersQuery) error {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.HasEditPermissionInFoldersQuery) error); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// ImportDashboard provides a mock function with given fields: ctx, dto
|
|
func (_m *FakeDashboardService) ImportDashboard(ctx context.Context, dto *SaveDashboardDTO) (*models.Dashboard, error) {
|
|
ret := _m.Called(ctx, dto)
|
|
|
|
var r0 *models.Dashboard
|
|
if rf, ok := ret.Get(0).(func(context.Context, *SaveDashboardDTO) *models.Dashboard); ok {
|
|
r0 = rf(ctx, dto)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.Dashboard)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, *SaveDashboardDTO) error); ok {
|
|
r1 = rf(ctx, dto)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MakeUserAdmin provides a mock function with given fields: ctx, orgID, userID, dashboardID, setViewAndEditPermissions
|
|
func (_m *FakeDashboardService) MakeUserAdmin(ctx context.Context, orgID int64, userID int64, dashboardID int64, setViewAndEditPermissions bool) error {
|
|
ret := _m.Called(ctx, orgID, userID, dashboardID, setViewAndEditPermissions)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, int64, int64, bool) error); ok {
|
|
r0 = rf(ctx, orgID, userID, dashboardID, setViewAndEditPermissions)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// SaveDashboard provides a mock function with given fields: ctx, dto, allowUiUpdate
|
|
func (_m *FakeDashboardService) SaveDashboard(ctx context.Context, dto *SaveDashboardDTO, allowUiUpdate bool) (*models.Dashboard, error) {
|
|
ret := _m.Called(ctx, dto, allowUiUpdate)
|
|
|
|
var r0 *models.Dashboard
|
|
if rf, ok := ret.Get(0).(func(context.Context, *SaveDashboardDTO, bool) *models.Dashboard); ok {
|
|
r0 = rf(ctx, dto, allowUiUpdate)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.Dashboard)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, *SaveDashboardDTO, bool) error); ok {
|
|
r1 = rf(ctx, dto, allowUiUpdate)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// SavePublicDashboardConfig provides a mock function with given fields: ctx, dto
|
|
func (_m *FakeDashboardService) SavePublicDashboardConfig(ctx context.Context, dto *SavePublicDashboardConfigDTO) (*models.PublicDashboardConfig, error) {
|
|
ret := _m.Called(ctx, dto)
|
|
|
|
var r0 *models.PublicDashboardConfig
|
|
if rf, ok := ret.Get(0).(func(context.Context, *SavePublicDashboardConfigDTO) *models.PublicDashboardConfig); ok {
|
|
r0 = rf(ctx, dto)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.PublicDashboardConfig)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, *SavePublicDashboardConfigDTO) error); ok {
|
|
r1 = rf(ctx, dto)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// SearchDashboards provides a mock function with given fields: ctx, query
|
|
func (_m *FakeDashboardService) SearchDashboards(ctx context.Context, query *models.FindPersistedDashboardsQuery) error {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.FindPersistedDashboardsQuery) error); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateDashboardACL provides a mock function with given fields: ctx, uid, items
|
|
func (_m *FakeDashboardService) UpdateDashboardACL(ctx context.Context, uid int64, items []*models.DashboardAcl) error {
|
|
ret := _m.Called(ctx, uid, items)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, []*models.DashboardAcl) error); ok {
|
|
r0 = rf(ctx, uid, items)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// NewFakeDashboardService creates a new instance of FakeDashboardService. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.
|
|
func NewFakeDashboardService(t testing.TB) *FakeDashboardService {
|
|
mock := &FakeDashboardService{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|