annotations

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Organization annotationType = iota
	Dashboard
)

Variables

View Source
var (
	ErrTimerangeMissing     = errors.New("missing timerange")
	ErrBaseTagLimitExceeded = errutil.NewBase(errutil.StatusBadRequest, "annotations.tag-limit-exceeded", errutil.WithPublicMessage("Tags length exceeds the maximum allowed."))
)

Functions

This section is empty.

Types

type Cleaner

type Cleaner interface {
	Run(ctx context.Context, cfg *setting.Cfg) (int64, int64, error)
}

Cleaner is responsible for cleaning up old annotations

type DeleteParams

type DeleteParams struct {
	OrgID       int64
	ID          int64
	DashboardID int64
	PanelID     int64
}

type FakeAnnotationsRepo

type FakeAnnotationsRepo struct {
	mock.Mock
}

FakeAnnotationsRepo is an autogenerated mock type for the Repository type

func NewFakeAnnotationsRepo

func NewFakeAnnotationsRepo(t testing.TB) *FakeAnnotationsRepo

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 (*FakeAnnotationsRepo) Delete

func (_m *FakeAnnotationsRepo) Delete(ctx context.Context, params *DeleteParams) error

Delete provides a mock function with given fields: ctx, params

func (*FakeAnnotationsRepo) Find

func (_m *FakeAnnotationsRepo) Find(ctx context.Context, query *ItemQuery) ([]*ItemDTO, error)

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

func (*FakeAnnotationsRepo) FindTags

func (_m *FakeAnnotationsRepo) FindTags(ctx context.Context, query *TagsQuery) (FindTagsResult, error)

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

func (*FakeAnnotationsRepo) Save

func (_m *FakeAnnotationsRepo) Save(ctx context.Context, item *Item) error

Save provides a mock function with given fields: ctx, item

func (*FakeAnnotationsRepo) SaveMany

func (_m *FakeAnnotationsRepo) SaveMany(ctx context.Context, items []Item) error

SaveMany provides a mock function with given fields: ctx, items

func (*FakeAnnotationsRepo) Update

func (_m *FakeAnnotationsRepo) Update(ctx context.Context, item *Item) error

Update provides a mock function with given fields: ctx, item

type FindTagsResult

type FindTagsResult struct {
	Tags []*TagsDTO `json:"tags"`
}

FindTagsResult is the result of a tags search.

type GetAnnotationTagsResponse

type GetAnnotationTagsResponse struct {
	Result FindTagsResult `json:"result"`
}

GetAnnotationTagsResponse is a response struct for FindTagsResult.

type Item

type Item struct {
	ID          int64            `json:"id" xorm:"pk autoincr 'id'"`
	OrgID       int64            `json:"orgId" xorm:"org_id"`
	UserID      int64            `json:"userId" xorm:"user_id"`
	DashboardID int64            `json:"dashboardId" xorm:"dashboard_id"`
	PanelID     int64            `json:"panelId" xorm:"panel_id"`
	Text        string           `json:"text"`
	AlertID     int64            `json:"alertId" xorm:"alert_id"`
	PrevState   string           `json:"prevState"`
	NewState    string           `json:"newState"`
	Epoch       int64            `json:"epoch"`
	EpochEnd    int64            `json:"epochEnd"`
	Created     int64            `json:"created"`
	Updated     int64            `json:"updated"`
	Tags        []string         `json:"tags"`
	Data        *simplejson.Json `json:"data"`

	// needed until we remove it from db
	Type  string
	Title string
}

func (Item) TableName

func (i Item) TableName() string

type ItemDTO

type ItemDTO struct {
	ID           int64            `json:"id" xorm:"id"`
	AlertID      int64            `json:"alertId" xorm:"alert_id"`
	AlertName    string           `json:"alertName"`
	DashboardID  int64            `json:"dashboardId" xorm:"dashboard_id"`
	DashboardUID *string          `json:"dashboardUID" xorm:"dashboard_uid"`
	PanelID      int64            `json:"panelId" xorm:"panel_id"`
	UserID       int64            `json:"userId" xorm:"user_id"`
	NewState     string           `json:"newState"`
	PrevState    string           `json:"prevState"`
	Created      int64            `json:"created"`
	Updated      int64            `json:"updated"`
	Time         int64            `json:"time"`
	TimeEnd      int64            `json:"timeEnd"`
	Text         string           `json:"text"`
	Tags         []string         `json:"tags"`
	Login        string           `json:"login"`
	Email        string           `json:"email"`
	AvatarURL    string           `json:"avatarUrl" xorm:"avatar_url"`
	Data         *simplejson.Json `json:"data"`
}

func (*ItemDTO) GetType

func (annotation *ItemDTO) GetType() annotationType

type ItemQuery

type ItemQuery struct {
	OrgID        int64    `json:"orgId"`
	From         int64    `json:"from"`
	To           int64    `json:"to"`
	UserID       int64    `json:"userId"`
	AlertID      int64    `json:"alertId"`
	DashboardID  int64    `json:"dashboardId"`
	DashboardUID string   `json:"dashboardUID"`
	PanelID      int64    `json:"panelId"`
	AnnotationID int64    `json:"annotationId"`
	Tags         []string `json:"tags"`
	Type         string   `json:"type"`
	MatchAny     bool     `json:"matchAny"`
	SignedInUser *user.SignedInUser

	Limit int64 `json:"limit"`
}

type Repository

type Repository interface {
	Save(ctx context.Context, item *Item) error
	SaveMany(ctx context.Context, items []Item) error
	Update(ctx context.Context, item *Item) error
	Find(ctx context.Context, query *ItemQuery) ([]*ItemDTO, error)
	Delete(ctx context.Context, params *DeleteParams) error
	FindTags(ctx context.Context, query *TagsQuery) (FindTagsResult, error)
}

type Tag

type Tag struct {
	Key   string
	Value string
	Count int64
}

Tag is the DB result of a tags search.

type TagsDTO

type TagsDTO struct {
	Tag   string `json:"tag"`
	Count int64  `json:"count"`
}

TagsDTO is the frontend DTO for Tag.

type TagsQuery

type TagsQuery struct {
	OrgID int64  `json:"orgId"`
	Tag   string `json:"tag"`

	Limit int64 `json:"limit"`
}

TagsQuery is the query for a tags search.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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