dashboards

package
v0.0.1-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2022 License: AGPL-3.0 Imports: 10 Imported by: 377

Documentation

Index

Constants

View Source
const (
	ScopeFoldersRoot   = "folders"
	ScopeFoldersPrefix = "folders:uid:"

	ActionFoldersCreate           = "folders:create"
	ActionFoldersRead             = "folders:read"
	ActionFoldersWrite            = "folders:write"
	ActionFoldersDelete           = "folders:delete"
	ActionFoldersPermissionsRead  = "folders.permissions:read"
	ActionFoldersPermissionsWrite = "folders.permissions:write"

	ScopeDashboardsRoot   = "dashboards"
	ScopeDashboardsPrefix = "dashboards:uid:"

	ActionDashboardsCreate           = "dashboards:create"
	ActionDashboardsRead             = "dashboards:read"
	ActionDashboardsWrite            = "dashboards:write"
	ActionDashboardsDelete           = "dashboards:delete"
	ActionDashboardsPermissionsRead  = "dashboards.permissions:read"
	ActionDashboardsPermissionsWrite = "dashboards.permissions:write"
	ActionDashboardsPublicWrite      = "dashboards.public:write"
)

Variables

View Source
var (
	ScopeFoldersProvider    = ac.NewScopeProvider(ScopeFoldersRoot)
	ScopeFoldersAll         = ScopeFoldersProvider.GetResourceAllScope()
	ScopeDashboardsProvider = ac.NewScopeProvider(ScopeDashboardsRoot)
	ScopeDashboardsAll      = ScopeDashboardsProvider.GetResourceAllScope()
)
View Source
var (
	ErrDashboardNotFound = DashboardErr{
		Reason:     "Dashboard not found",
		StatusCode: 404,
		Status:     "not-found",
	}
	ErrDashboardCorrupt = DashboardErr{
		Reason:     "Dashboard data is missing or corrupt",
		StatusCode: 500,
		Status:     "not-found",
	}
	ErrDashboardPanelNotFound = DashboardErr{
		Reason:     "Dashboard panel not found",
		StatusCode: 404,
		Status:     "not-found",
	}
	ErrDashboardFolderNotFound = DashboardErr{
		Reason:     "Folder not found",
		StatusCode: 404,
	}
	ErrDashboardWithSameUIDExists = DashboardErr{
		Reason:     "A dashboard with the same uid already exists",
		StatusCode: 400,
	}
	ErrDashboardWithSameNameInFolderExists = DashboardErr{
		Reason:     "A dashboard with the same name in the folder already exists",
		StatusCode: 412,
		Status:     "name-exists",
	}
	ErrDashboardVersionMismatch = DashboardErr{
		Reason:     "The dashboard has been changed by someone else",
		StatusCode: 412,
		Status:     "version-mismatch",
	}
	ErrDashboardTitleEmpty = DashboardErr{
		Reason:     "Dashboard title cannot be empty",
		StatusCode: 400,
		Status:     "empty-name",
	}
	ErrDashboardFolderCannotHaveParent = DashboardErr{
		Reason:     "A Dashboard Folder cannot be added to another folder",
		StatusCode: 400,
	}
	ErrDashboardsWithSameSlugExists = DashboardErr{
		Reason:     "Multiple dashboards with the same slug exists",
		StatusCode: 412,
	}
	ErrDashboardFailedGenerateUniqueUid = DashboardErr{
		Reason:     "Failed to generate unique dashboard id",
		StatusCode: 500,
	}
	ErrDashboardTypeMismatch = DashboardErr{
		Reason:     "Dashboard cannot be changed to a folder",
		StatusCode: 400,
	}
	ErrDashboardFolderWithSameNameAsDashboard = DashboardErr{
		Reason:     "Folder name cannot be the same as one of its dashboards",
		StatusCode: 400,
	}
	ErrDashboardWithSameNameAsFolder = DashboardErr{
		Reason:     "Dashboard name cannot be the same as folder",
		StatusCode: 400,
		Status:     "name-match",
	}
	ErrDashboardFolderNameExists = DashboardErr{
		Reason:     "A folder with that name already exists",
		StatusCode: 400,
	}
	ErrDashboardUpdateAccessDenied = DashboardErr{
		Reason:     "Access denied to save dashboard",
		StatusCode: 403,
	}
	ErrDashboardInvalidUid = DashboardErr{
		Reason:     "uid contains illegal characters",
		StatusCode: 400,
	}
	ErrDashboardUidTooLong = DashboardErr{
		Reason:     "uid too long, max 40 characters",
		StatusCode: 400,
	}
	ErrDashboardCannotSaveProvisionedDashboard = DashboardErr{
		Reason:     "Cannot save provisioned dashboard",
		StatusCode: 400,
	}
	ErrDashboardRefreshIntervalTooShort = DashboardErr{
		Reason:     "Dashboard refresh interval is too low",
		StatusCode: 400,
	}
	ErrDashboardCannotDeleteProvisionedDashboard = DashboardErr{
		Reason:     "provisioned dashboard cannot be deleted",
		StatusCode: 400,
	}
	ErrDashboardIdentifierNotSet = DashboardErr{
		Reason:     "Unique identifier needed to be able to get a dashboard",
		StatusCode: 400,
	}
	ErrDashboardIdentifierInvalid = DashboardErr{
		Reason:     "Dashboard ID not a number",
		StatusCode: 400,
	}
	ErrDashboardPanelIdentifierInvalid = DashboardErr{
		Reason:     "Dashboard panel ID not a number",
		StatusCode: 400,
	}
	ErrDashboardOrPanelIdentifierNotSet = DashboardErr{
		Reason:     "Unique identifier needed to be able to get a dashboard panel",
		StatusCode: 400,
	}
	ErrProvisionedDashboardNotFound = DashboardErr{
		Reason:     "Dashboard is not provisioned",
		StatusCode: 404,
		Status:     "not-found",
	}
	ErrDashboardThumbnailNotFound = DashboardErr{
		Reason:     "Dashboard thumbnail not found",
		StatusCode: 404,
		Status:     "not-found",
	}

	ErrFolderNotFound                = errors.New("folder not found")
	ErrFolderVersionMismatch         = errors.New("the folder has been changed by someone else")
	ErrFolderTitleEmpty              = errors.New("folder title cannot be empty")
	ErrFolderWithSameUIDExists       = errors.New("a folder/dashboard with the same uid already exists")
	ErrFolderInvalidUID              = errors.New("invalid uid for folder provided")
	ErrFolderSameNameExists          = errors.New("a folder or dashboard in the general folder with the same name already exists")
	ErrFolderFailedGenerateUniqueUid = errors.New("failed to generate unique folder ID")
	ErrFolderAccessDenied            = errors.New("access denied to folder")
	ErrFolderContainsAlertRules      = errors.New("folder contains alert rules")
)

Typed errors

Functions

func NewDashboardIDScopeResolver

func NewDashboardIDScopeResolver(db Store) (string, ac.ScopeAttributeResolver)

NewDashboardIDScopeResolver provides an ScopeAttributeResolver that is able to convert a scope prefixed with "dashboards:id:" into uid based scopes for both dashboard and folder

func NewDashboardUIDScopeResolver

func NewDashboardUIDScopeResolver(db Store) (string, ac.ScopeAttributeResolver)

NewDashboardUIDScopeResolver provides an ScopeAttributeResolver that is able to convert a scope prefixed with "dashboards:uid:" into uid based scopes for both dashboard and folder

func NewFolderIDScopeResolver

func NewFolderIDScopeResolver(db Store) (string, ac.ScopeAttributeResolver)

NewFolderIDScopeResolver provides an ScopeAttributeResolver that is able to convert a scope prefixed with "folders:id:" into an uid based scope.

func NewFolderNameScopeResolver

func NewFolderNameScopeResolver(db Store) (string, ac.ScopeAttributeResolver)

NewFolderNameScopeResolver provides an ScopeAttributeResolver that is able to convert a scope prefixed with "folders:name:" into an uid based scope.

Types

type DashboardErr

type DashboardErr struct {
	StatusCode int
	Status     string
	Reason     string
}

DashboardErr represents a dashboard error.

func (DashboardErr) Body

func (e DashboardErr) Body() util.DynMap

Body returns the error's response body, if applicable.

func (DashboardErr) Equal

func (e DashboardErr) Equal(o DashboardErr) bool

Equal returns whether equal to another DashboardErr.

func (DashboardErr) Error

func (e DashboardErr) Error() string

Error returns the error message.

type DashboardProvisioningService

type DashboardProvisioningService interface {
	DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
	DeleteProvisionedDashboard(ctx context.Context, dashboardID int64, orgID int64) error
	GetProvisionedDashboardData(ctx context.Context, name string) ([]*models.DashboardProvisioning, error)
	GetProvisionedDashboardDataByDashboardID(ctx context.Context, dashboardID int64) (*models.DashboardProvisioning, error)
	GetProvisionedDashboardDataByDashboardUID(ctx context.Context, orgID int64, dashboardUID string) (*models.DashboardProvisioning, error)
	SaveFolderForProvisionedDashboards(context.Context, *SaveDashboardDTO) (*models.Dashboard, error)
	SaveProvisionedDashboard(ctx context.Context, dto *SaveDashboardDTO, provisioning *models.DashboardProvisioning) (*models.Dashboard, error)
	UnprovisionDashboard(ctx context.Context, dashboardID int64) error
}

DashboardProvisioningService is a service for operating on provisioned dashboards.

type DashboardSearchProjection

type DashboardSearchProjection struct {
	ID          int64  `xorm:"id"`
	UID         string `xorm:"uid"`
	Title       string
	Slug        string
	Term        string
	IsFolder    bool
	FolderID    int64  `xorm:"folder_id"`
	FolderUID   string `xorm:"folder_uid"`
	FolderSlug  string
	FolderTitle string
	SortMeta    int64
}

type DashboardService

type DashboardService interface {
	BuildSaveDashboardCommand(ctx context.Context, dto *SaveDashboardDTO, shouldValidateAlerts bool, validateProvisionedDashboard bool) (*models.SaveDashboardCommand, error)
	DeleteDashboard(ctx context.Context, dashboardId int64, orgId int64) error
	FindDashboards(ctx context.Context, query *models.FindPersistedDashboardsQuery) ([]DashboardSearchProjection, error)
	GetDashboard(ctx context.Context, query *models.GetDashboardQuery) error
	GetDashboardACLInfoList(ctx context.Context, query *models.GetDashboardACLInfoListQuery) error
	GetDashboards(ctx context.Context, query *models.GetDashboardsQuery) error
	GetDashboardTags(ctx context.Context, query *models.GetDashboardTagsQuery) error
	GetDashboardUIDById(ctx context.Context, query *models.GetDashboardRefByIdQuery) error
	HasAdminPermissionInDashboardsOrFolders(ctx context.Context, query *models.HasAdminPermissionInDashboardsOrFoldersQuery) error
	HasEditPermissionInFolders(ctx context.Context, query *models.HasEditPermissionInFoldersQuery) error
	ImportDashboard(ctx context.Context, dto *SaveDashboardDTO) (*models.Dashboard, error)
	MakeUserAdmin(ctx context.Context, orgID int64, userID, dashboardID int64, setViewAndEditPermissions bool) error
	SaveDashboard(ctx context.Context, dto *SaveDashboardDTO, allowUiUpdate bool) (*models.Dashboard, error)
	SearchDashboards(ctx context.Context, query *models.FindPersistedDashboardsQuery) error
	UpdateDashboardACL(ctx context.Context, uid int64, items []*models.DashboardACL) error
	DeleteACLByUser(ctx context.Context, userID int64) error
}

DashboardService is a service for operating on dashboards.

type FakeDashboardProvisioning

type FakeDashboardProvisioning struct {
	mock.Mock
}

FakeDashboardProvisioning is an autogenerated mock type for the DashboardProvisioningService type

func NewFakeDashboardProvisioning

func NewFakeDashboardProvisioning(t testing.TB) *FakeDashboardProvisioning

NewFakeDashboardProvisioning creates a new instance of FakeDashboardProvisioning. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.

func (*FakeDashboardProvisioning) DeleteOrphanedProvisionedDashboards

func (_m *FakeDashboardProvisioning) DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error

DeleteOrphanedProvisionedDashboards provides a mock function with given fields: ctx, cmd

func (*FakeDashboardProvisioning) DeleteProvisionedDashboard

func (_m *FakeDashboardProvisioning) DeleteProvisionedDashboard(ctx context.Context, dashboardID int64, orgID int64) error

DeleteProvisionedDashboard provides a mock function with given fields: ctx, dashboardID, orgID

func (*FakeDashboardProvisioning) GetProvisionedDashboardData

func (_m *FakeDashboardProvisioning) GetProvisionedDashboardData(ctx context.Context, name string) ([]*models.DashboardProvisioning, error)

GetProvisionedDashboardData provides a mock function with given fields: name

func (*FakeDashboardProvisioning) GetProvisionedDashboardDataByDashboardID

func (_m *FakeDashboardProvisioning) GetProvisionedDashboardDataByDashboardID(ctx context.Context, dashboardID int64) (*models.DashboardProvisioning, error)

GetProvisionedDashboardDataByDashboardID provides a mock function with given fields: dashboardID

func (*FakeDashboardProvisioning) GetProvisionedDashboardDataByDashboardUID

func (_m *FakeDashboardProvisioning) GetProvisionedDashboardDataByDashboardUID(ctx context.Context, orgID int64, dashboardUID string) (*models.DashboardProvisioning, error)

GetProvisionedDashboardDataByDashboardUID provides a mock function with given fields: orgID, dashboardUID

func (*FakeDashboardProvisioning) SaveFolderForProvisionedDashboards

func (_m *FakeDashboardProvisioning) SaveFolderForProvisionedDashboards(_a0 context.Context, _a1 *SaveDashboardDTO) (*models.Dashboard, error)

SaveFolderForProvisionedDashboards provides a mock function with given fields: _a0, _a1

func (*FakeDashboardProvisioning) SaveProvisionedDashboard

func (_m *FakeDashboardProvisioning) SaveProvisionedDashboard(ctx context.Context, dto *SaveDashboardDTO, provisioning *models.DashboardProvisioning) (*models.Dashboard, error)

SaveProvisionedDashboard provides a mock function with given fields: ctx, dto, provisioning

func (*FakeDashboardProvisioning) UnprovisionDashboard

func (_m *FakeDashboardProvisioning) UnprovisionDashboard(ctx context.Context, dashboardID int64) error

UnprovisionDashboard provides a mock function with given fields: ctx, dashboardID

type FakeDashboardService

type FakeDashboardService struct {
	mock.Mock
	ExpectedError error
}

FakeDashboardService is an autogenerated mock type for the DashboardService type

func NewFakeDashboardService

func NewFakeDashboardService(t testing.TB) *FakeDashboardService

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 (*FakeDashboardService) BuildSaveDashboardCommand

func (_m *FakeDashboardService) BuildSaveDashboardCommand(ctx context.Context, dto *SaveDashboardDTO, shouldValidateAlerts bool, validateProvisionedDashboard bool) (*models.SaveDashboardCommand, error)

BuildSaveDashboardCommand provides a mock function with given fields: ctx, dto, shouldValidateAlerts, validateProvisionedDashboard

func (*FakeDashboardService) DeleteACLByUser

func (_m *FakeDashboardService) DeleteACLByUser(ctx context.Context, userID int64) error

func (*FakeDashboardService) DeleteDashboard

func (_m *FakeDashboardService) DeleteDashboard(ctx context.Context, dashboardId int64, orgId int64) error

DeleteDashboard provides a mock function with given fields: ctx, dashboardId, orgId

func (*FakeDashboardService) FindDashboards

FindDashboards provides a mock function with given fields: ctx, query

func (*FakeDashboardService) GetDashboard

func (_m *FakeDashboardService) GetDashboard(ctx context.Context, query *models.GetDashboardQuery) error

GetDashboard provides a mock function with given fields: ctx, query

func (*FakeDashboardService) GetDashboardACLInfoList

func (_m *FakeDashboardService) GetDashboardACLInfoList(ctx context.Context, query *models.GetDashboardACLInfoListQuery) error

GetDashboardACLInfoList provides a mock function with given fields: ctx, query

func (*FakeDashboardService) GetDashboardTags

func (_m *FakeDashboardService) GetDashboardTags(ctx context.Context, query *models.GetDashboardTagsQuery) error

GetDashboardTags provides a mock function with given fields: ctx, query

func (*FakeDashboardService) GetDashboardUIDById

func (_m *FakeDashboardService) GetDashboardUIDById(ctx context.Context, query *models.GetDashboardRefByIdQuery) error

GetDashboardUIDById provides a mock function with given fields: ctx, query

func (*FakeDashboardService) GetDashboards

func (_m *FakeDashboardService) GetDashboards(ctx context.Context, query *models.GetDashboardsQuery) error

GetDashboards provides a mock function with given fields: ctx, query

func (*FakeDashboardService) HasAdminPermissionInDashboardsOrFolders

func (_m *FakeDashboardService) HasAdminPermissionInDashboardsOrFolders(ctx context.Context, query *models.HasAdminPermissionInDashboardsOrFoldersQuery) error

HasAdminPermissionInDashboardsOrFolders provides a mock function with given fields: ctx, query

func (*FakeDashboardService) HasEditPermissionInFolders

func (_m *FakeDashboardService) HasEditPermissionInFolders(ctx context.Context, query *models.HasEditPermissionInFoldersQuery) error

HasEditPermissionInFolders provides a mock function with given fields: ctx, query

func (*FakeDashboardService) ImportDashboard

func (_m *FakeDashboardService) ImportDashboard(ctx context.Context, dto *SaveDashboardDTO) (*models.Dashboard, error)

ImportDashboard provides a mock function with given fields: ctx, dto

func (*FakeDashboardService) MakeUserAdmin

func (_m *FakeDashboardService) MakeUserAdmin(ctx context.Context, orgID int64, userID int64, dashboardID int64, setViewAndEditPermissions bool) error

MakeUserAdmin provides a mock function with given fields: ctx, orgID, userID, dashboardID, setViewAndEditPermissions

func (*FakeDashboardService) SaveDashboard

func (_m *FakeDashboardService) SaveDashboard(ctx context.Context, dto *SaveDashboardDTO, allowUiUpdate bool) (*models.Dashboard, error)

SaveDashboard provides a mock function with given fields: ctx, dto, allowUiUpdate

func (*FakeDashboardService) SearchDashboards

SearchDashboards provides a mock function with given fields: ctx, query

func (*FakeDashboardService) UpdateDashboardACL

func (_m *FakeDashboardService) UpdateDashboardACL(ctx context.Context, uid int64, items []*models.DashboardACL) error

UpdateDashboardACL provides a mock function with given fields: ctx, uid, items

type FakeDashboardStore

type FakeDashboardStore struct {
	mock.Mock
	ExpectedError error
}

FakeDashboardStore is an autogenerated mock type for the Store type

func NewFakeDashboardStore

func NewFakeDashboardStore(t testing.TB) *FakeDashboardStore

NewFakeDashboardStore creates a new instance of FakeDashboardStore. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.

func (*FakeDashboardStore) DeleteACLByUser

func (_m *FakeDashboardStore) DeleteACLByUser(ctx context.Context, userID int64) error

func (*FakeDashboardStore) DeleteDashboard

func (_m *FakeDashboardStore) DeleteDashboard(ctx context.Context, cmd *models.DeleteDashboardCommand) error

DeleteDashboard provides a mock function with given fields: ctx, cmd

func (*FakeDashboardStore) DeleteOrphanedProvisionedDashboards

func (_m *FakeDashboardStore) DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error

DeleteOrphanedProvisionedDashboards provides a mock function with given fields: ctx, cmd

func (*FakeDashboardStore) FindDashboards

FindDashboards provides a mock function with given fields: ctx, query

func (*FakeDashboardStore) GetDashboard

func (_m *FakeDashboardStore) GetDashboard(ctx context.Context, query *models.GetDashboardQuery) (*models.Dashboard, error)

GetDashboard provides a mock function with given fields: ctx, query

func (*FakeDashboardStore) GetDashboardACLInfoList

func (_m *FakeDashboardStore) GetDashboardACLInfoList(ctx context.Context, query *models.GetDashboardACLInfoListQuery) error

GetDashboardACLInfoList provides a mock function with given fields: ctx, query

func (*FakeDashboardStore) GetDashboardTags

func (_m *FakeDashboardStore) GetDashboardTags(ctx context.Context, query *models.GetDashboardTagsQuery) error

GetDashboardTags provides a mock function with given fields: ctx, query

func (*FakeDashboardStore) GetDashboardUIDById

func (_m *FakeDashboardStore) GetDashboardUIDById(ctx context.Context, query *models.GetDashboardRefByIdQuery) error

GetDashboardUIDById provides a mock function with given fields: ctx, query

func (*FakeDashboardStore) GetDashboards

func (_m *FakeDashboardStore) GetDashboards(ctx context.Context, query *models.GetDashboardsQuery) error

GetDashboards provides a mock function with given fields: ctx, query

func (*FakeDashboardStore) GetDashboardsByPluginID

func (_m *FakeDashboardStore) GetDashboardsByPluginID(ctx context.Context, query *models.GetDashboardsByPluginIdQuery) error

GetDashboardsByPluginID provides a mock function with given fields: ctx, query

func (*FakeDashboardStore) GetFolderByID

func (_m *FakeDashboardStore) GetFolderByID(ctx context.Context, orgID int64, id int64) (*models.Folder, error)

GetFolderByID provides a mock function with given fields: ctx, orgID, id

func (*FakeDashboardStore) GetFolderByTitle

func (_m *FakeDashboardStore) GetFolderByTitle(ctx context.Context, orgID int64, title string) (*models.Folder, error)

GetFolderByTitle provides a mock function with given fields: ctx, orgID, title

func (*FakeDashboardStore) GetFolderByUID

func (_m *FakeDashboardStore) GetFolderByUID(ctx context.Context, orgID int64, uid string) (*models.Folder, error)

GetFolderByUID provides a mock function with given fields: ctx, orgID, uid

func (*FakeDashboardStore) GetProvisionedDashboardData

func (_m *FakeDashboardStore) GetProvisionedDashboardData(ctx context.Context, name string) ([]*models.DashboardProvisioning, error)

GetProvisionedDashboardData provides a mock function with given fields: name

func (*FakeDashboardStore) GetProvisionedDataByDashboardID

func (_m *FakeDashboardStore) GetProvisionedDataByDashboardID(ctx context.Context, dashboardID int64) (*models.DashboardProvisioning, error)

GetProvisionedDataByDashboardID provides a mock function with given fields: dashboardID

func (*FakeDashboardStore) GetProvisionedDataByDashboardUID

func (_m *FakeDashboardStore) GetProvisionedDataByDashboardUID(ctx context.Context, orgID int64, dashboardUID string) (*models.DashboardProvisioning, error)

GetProvisionedDataByDashboardUID provides a mock function with given fields: orgID, dashboardUID

func (*FakeDashboardStore) HasAdminPermissionInDashboardsOrFolders

func (_m *FakeDashboardStore) HasAdminPermissionInDashboardsOrFolders(ctx context.Context, query *models.HasAdminPermissionInDashboardsOrFoldersQuery) error

HasAdminPermissionInDashboardsOrFolders provides a mock function with given fields: ctx, query

func (*FakeDashboardStore) HasEditPermissionInFolders

func (_m *FakeDashboardStore) HasEditPermissionInFolders(ctx context.Context, query *models.HasEditPermissionInFoldersQuery) error

HasEditPermissionInFolders provides a mock function with given fields: ctx, query

func (*FakeDashboardStore) SaveAlerts

func (_m *FakeDashboardStore) SaveAlerts(ctx context.Context, dashID int64, alerts []*models.Alert) error

SaveAlerts provides a mock function with given fields: ctx, dashID, alerts

func (*FakeDashboardStore) SaveDashboard

SaveDashboard provides a mock function with given fields: cmd

func (*FakeDashboardStore) SaveProvisionedDashboard

func (_m *FakeDashboardStore) SaveProvisionedDashboard(ctx context.Context, cmd models.SaveDashboardCommand, provisioning *models.DashboardProvisioning) (*models.Dashboard, error)

SaveProvisionedDashboard provides a mock function with given fields: cmd, provisioning

func (*FakeDashboardStore) UnprovisionDashboard

func (_m *FakeDashboardStore) UnprovisionDashboard(ctx context.Context, id int64) error

UnprovisionDashboard provides a mock function with given fields: ctx, id

func (*FakeDashboardStore) UpdateDashboardACL

func (_m *FakeDashboardStore) UpdateDashboardACL(ctx context.Context, uid int64, items []*models.DashboardACL) error

UpdateDashboardACL provides a mock function with given fields: ctx, uid, items

func (*FakeDashboardStore) ValidateDashboardBeforeSave

func (_m *FakeDashboardStore) ValidateDashboardBeforeSave(ctx context.Context, dashboard *models.Dashboard, overwrite bool) (bool, error)

ValidateDashboardBeforeSave provides a mock function with given fields: dashboard, overwrite

type FakeFolderService

type FakeFolderService struct {
	mock.Mock
}

FakeFolderService is an autogenerated mock type for the FolderService type

func NewFakeFolderService

func NewFakeFolderService(t testing.TB) *FakeFolderService

NewFakeFolderService creates a new instance of FakeFolderService. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.

func (*FakeFolderService) CreateFolder

func (_m *FakeFolderService) CreateFolder(ctx context.Context, usr *user.SignedInUser, orgID int64, title string, uid string) (*models.Folder, error)

CreateFolder provides a mock function with given fields: ctx, user, orgID, title, uid

func (*FakeFolderService) DeleteFolder

func (_m *FakeFolderService) DeleteFolder(ctx context.Context, usr *user.SignedInUser, orgID int64, uid string, forceDeleteRules bool) (*models.Folder, error)

DeleteFolder provides a mock function with given fields: ctx, user, orgID, uid, forceDeleteRules

func (*FakeFolderService) GetFolderByID

func (_m *FakeFolderService) GetFolderByID(ctx context.Context, usr *user.SignedInUser, id int64, orgID int64) (*models.Folder, error)

GetFolderByID provides a mock function with given fields: ctx, user, id, orgID

func (*FakeFolderService) GetFolderByTitle

func (_m *FakeFolderService) GetFolderByTitle(ctx context.Context, usr *user.SignedInUser, orgID int64, title string) (*models.Folder, error)

GetFolderByTitle provides a mock function with given fields: ctx, user, orgID, title

func (*FakeFolderService) GetFolderByUID

func (_m *FakeFolderService) GetFolderByUID(ctx context.Context, usr *user.SignedInUser, orgID int64, uid string) (*models.Folder, error)

GetFolderByUID provides a mock function with given fields: ctx, user, orgID, uid

func (*FakeFolderService) GetFolders

func (_m *FakeFolderService) GetFolders(ctx context.Context, usr *user.SignedInUser, orgID int64, limit int64, page int64) ([]*models.Folder, error)

GetFolders provides a mock function with given fields: ctx, user, orgID, limit, page

func (*FakeFolderService) MakeUserAdmin

func (_m *FakeFolderService) MakeUserAdmin(ctx context.Context, orgID int64, userID int64, folderID int64, setViewAndEditPermissions bool) error

MakeUserAdmin provides a mock function with given fields: ctx, orgID, userID, folderID, setViewAndEditPermissions

func (*FakeFolderService) UpdateFolder

func (_m *FakeFolderService) UpdateFolder(ctx context.Context, usr *user.SignedInUser, orgID int64, existingUid string, cmd *models.UpdateFolderCommand) error

UpdateFolder provides a mock function with given fields: ctx, user, orgID, existingUid, cmd

type FakeFolderStore

type FakeFolderStore struct {
	mock.Mock
}

FakeFolderStore is an autogenerated mock type for the FolderStore type

func NewFakeFolderStore

func NewFakeFolderStore(t testing.TB) *FakeFolderStore

NewFakeFolderStore creates a new instance of FakeFolderStore. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.

func (*FakeFolderStore) GetFolderByID

func (_m *FakeFolderStore) GetFolderByID(ctx context.Context, orgID int64, id int64) (*models.Folder, error)

GetFolderByID provides a mock function with given fields: ctx, orgID, id

func (*FakeFolderStore) GetFolderByTitle

func (_m *FakeFolderStore) GetFolderByTitle(ctx context.Context, orgID int64, title string) (*models.Folder, error)

GetFolderByTitle provides a mock function with given fields: ctx, orgID, title

func (*FakeFolderStore) GetFolderByUID

func (_m *FakeFolderStore) GetFolderByUID(ctx context.Context, orgID int64, uid string) (*models.Folder, error)

GetFolderByUID provides a mock function with given fields: ctx, orgID, uid

type FolderService

type FolderService interface {
	GetFolders(ctx context.Context, user *user.SignedInUser, orgID int64, limit int64, page int64) ([]*models.Folder, error)
	GetFolderByID(ctx context.Context, user *user.SignedInUser, id int64, orgID int64) (*models.Folder, error)
	GetFolderByUID(ctx context.Context, user *user.SignedInUser, orgID int64, uid string) (*models.Folder, error)
	GetFolderByTitle(ctx context.Context, user *user.SignedInUser, orgID int64, title string) (*models.Folder, error)
	CreateFolder(ctx context.Context, user *user.SignedInUser, orgID int64, title, uid string) (*models.Folder, error)
	UpdateFolder(ctx context.Context, user *user.SignedInUser, orgID int64, existingUid string, cmd *models.UpdateFolderCommand) error
	DeleteFolder(ctx context.Context, user *user.SignedInUser, orgID int64, uid string, forceDeleteRules bool) (*models.Folder, error)
	MakeUserAdmin(ctx context.Context, orgID int64, userID, folderID int64, setViewAndEditPermissions bool) error
}

FolderService is a service for operating on folders.

type FolderStore

type FolderStore interface {
	// GetFolderByTitle retrieves a folder by its title
	GetFolderByTitle(ctx context.Context, orgID int64, title string) (*models.Folder, error)
	// GetFolderByUID retrieves a folder by its UID
	GetFolderByUID(ctx context.Context, orgID int64, uid string) (*models.Folder, error)
	// GetFolderByID retrieves a folder by its ID
	GetFolderByID(ctx context.Context, orgID int64, id int64) (*models.Folder, error)
}

FolderStore is a folder store.

type PluginService

type PluginService interface {
	GetDashboardsByPluginID(ctx context.Context, query *models.GetDashboardsByPluginIdQuery) error
}

PluginService is a service for operating on plugin dashboards.

type SaveDashboardDTO

type SaveDashboardDTO struct {
	OrgId     int64
	UpdatedAt time.Time
	User      *user.SignedInUser
	Message   string
	Overwrite bool
	Dashboard *models.Dashboard
}

type Store

type Store interface {
	DeleteDashboard(ctx context.Context, cmd *models.DeleteDashboardCommand) error
	DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
	FindDashboards(ctx context.Context, query *models.FindPersistedDashboardsQuery) ([]DashboardSearchProjection, error)
	GetDashboard(ctx context.Context, query *models.GetDashboardQuery) (*models.Dashboard, error)
	GetDashboardACLInfoList(ctx context.Context, query *models.GetDashboardACLInfoListQuery) error
	GetDashboardUIDById(ctx context.Context, query *models.GetDashboardRefByIdQuery) error
	GetDashboards(ctx context.Context, query *models.GetDashboardsQuery) error
	// GetDashboardsByPluginID retrieves dashboards identified by plugin.
	GetDashboardsByPluginID(ctx context.Context, query *models.GetDashboardsByPluginIdQuery) error
	GetDashboardTags(ctx context.Context, query *models.GetDashboardTagsQuery) error
	GetProvisionedDashboardData(ctx context.Context, name string) ([]*models.DashboardProvisioning, error)
	GetProvisionedDataByDashboardID(ctx context.Context, dashboardID int64) (*models.DashboardProvisioning, error)
	GetProvisionedDataByDashboardUID(ctx context.Context, orgID int64, dashboardUID string) (*models.DashboardProvisioning, error)
	HasAdminPermissionInDashboardsOrFolders(ctx context.Context, query *models.HasAdminPermissionInDashboardsOrFoldersQuery) error
	HasEditPermissionInFolders(ctx context.Context, query *models.HasEditPermissionInFoldersQuery) error
	// SaveAlerts saves dashboard alerts.
	SaveAlerts(ctx context.Context, dashID int64, alerts []*models.Alert) error
	SaveDashboard(ctx context.Context, cmd models.SaveDashboardCommand) (*models.Dashboard, error)
	SaveProvisionedDashboard(ctx context.Context, cmd models.SaveDashboardCommand, provisioning *models.DashboardProvisioning) (*models.Dashboard, error)
	UnprovisionDashboard(ctx context.Context, id int64) error
	UpdateDashboardACL(ctx context.Context, uid int64, items []*models.DashboardACL) error
	// ValidateDashboardBeforeSave validates a dashboard before save.
	ValidateDashboardBeforeSave(ctx context.Context, dashboard *models.Dashboard, overwrite bool) (bool, error)
	DeleteACLByUser(context.Context, int64) error

	FolderStore
}

Store is a dashboard store.

type UpdatePluginDashboardError

type UpdatePluginDashboardError struct {
	PluginId string
}

func (UpdatePluginDashboardError) Error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL