Publicdasboards: Add annotations support (#56413)
adds annotations support for public dashboards
This commit is contained in:
@@ -13,6 +13,7 @@ var (
|
||||
ErrBaseTagLimitExceeded = errutil.NewBase(errutil.StatusBadRequest, "annotations.tag-limit-exceeded", errutil.WithPublicMessage("Tags length exceeds the maximum allowed."))
|
||||
)
|
||||
|
||||
//go:generate mockery --name Repository --structname FakeAnnotationsRepo --inpackage --filename annotations_repository_mock.go
|
||||
type Repository interface {
|
||||
Save(ctx context.Context, item *Item) error
|
||||
Update(ctx context.Context, item *Item) error
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
// Code generated by mockery v2.12.1. DO NOT EDIT.
|
||||
|
||||
package annotations
|
||||
|
||||
import (
|
||||
context "context"
|
||||
testing "testing"
|
||||
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// FakeAnnotationsRepo is an autogenerated mock type for the Repository type
|
||||
type FakeAnnotationsRepo struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// Delete provides a mock function with given fields: ctx, params
|
||||
func (_m *FakeAnnotationsRepo) Delete(ctx context.Context, params *DeleteParams) error {
|
||||
ret := _m.Called(ctx, params)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *DeleteParams) error); ok {
|
||||
r0 = rf(ctx, params)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// Find provides a mock function with given fields: ctx, query
|
||||
func (_m *FakeAnnotationsRepo) Find(ctx context.Context, query *ItemQuery) ([]*ItemDTO, error) {
|
||||
ret := _m.Called(ctx, query)
|
||||
|
||||
var r0 []*ItemDTO
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *ItemQuery) []*ItemDTO); ok {
|
||||
r0 = rf(ctx, query)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*ItemDTO)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(context.Context, *ItemQuery) error); ok {
|
||||
r1 = rf(ctx, query)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// FindTags provides a mock function with given fields: ctx, query
|
||||
func (_m *FakeAnnotationsRepo) FindTags(ctx context.Context, query *TagsQuery) (FindTagsResult, error) {
|
||||
ret := _m.Called(ctx, query)
|
||||
|
||||
var r0 FindTagsResult
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *TagsQuery) FindTagsResult); ok {
|
||||
r0 = rf(ctx, query)
|
||||
} else {
|
||||
r0 = ret.Get(0).(FindTagsResult)
|
||||
}
|
||||
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(1).(func(context.Context, *TagsQuery) error); ok {
|
||||
r1 = rf(ctx, query)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Save provides a mock function with given fields: ctx, item
|
||||
func (_m *FakeAnnotationsRepo) Save(ctx context.Context, item *Item) error {
|
||||
ret := _m.Called(ctx, item)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *Item) error); ok {
|
||||
r0 = rf(ctx, item)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// Update provides a mock function with given fields: ctx, item
|
||||
func (_m *FakeAnnotationsRepo) Update(ctx context.Context, item *Item) error {
|
||||
ret := _m.Called(ctx, item)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *Item) error); ok {
|
||||
r0 = rf(ctx, item)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// NewFakeAnnotationsRepo creates a new instance of FakeAnnotationsRepo. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
func NewFakeAnnotationsRepo(t testing.TB) *FakeAnnotationsRepo {
|
||||
mock := &FakeAnnotationsRepo{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
||||
Reference in New Issue
Block a user