models

package
v0.0.0-test.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QuerySuccess              = "success"
	QueryFailure              = "failure"
	EmailShareType  ShareType = "email"
	PublicShareType ShareType = "public"
)

Variables

View Source
var (
	ErrInternalServerError = errutil.NewBase(errutil.StatusInternal, "publicdashboards.internalServerError", errutil.WithPublicMessage("Internal server error"))

	ErrPublicDashboardNotFound = errutil.NewBase(errutil.StatusNotFound, "publicdashboards.notFound", errutil.WithPublicMessage("Public dashboard not found"))
	ErrDashboardNotFound       = errutil.NewBase(errutil.StatusNotFound, "publicdashboards.dashboardNotFound", errutil.WithPublicMessage("Dashboard not found"))
	ErrPanelNotFound           = errutil.NewBase(errutil.StatusNotFound, "publicdashboards.panelNotFound", errutil.WithPublicMessage("Public dashboard panel not found"))

	ErrBadRequest                          = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.badRequest")
	ErrPanelQueriesNotFound                = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.panelQueriesNotFound", errutil.WithPublicMessage("Failed to extract queries from panel"))
	ErrInvalidAccessToken                  = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.invalidAccessToken", errutil.WithPublicMessage("Invalid access token"))
	ErrInvalidPanelId                      = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.invalidPanelId", errutil.WithPublicMessage("Invalid panel id"))
	ErrInvalidUid                          = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.invalidUid", errutil.WithPublicMessage("Invalid Uid"))
	ErrPublicDashboardIdentifierNotSet     = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.identifierNotSet", errutil.WithPublicMessage("No Uid for public dashboard specified"))
	ErrPublicDashboardHasTemplateVariables = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.hasTemplateVariables", errutil.WithPublicMessage("Public dashboard has template variables"))
	ErrInvalidInterval                     = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.invalidInterval", errutil.WithPublicMessage("intervalMS should be greater than 0"))
	ErrInvalidMaxDataPoints                = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.maxDataPoints", errutil.WithPublicMessage("maxDataPoints should be greater than 0"))
	ErrInvalidTimeRange                    = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.invalidTimeRange", errutil.WithPublicMessage("Invalid time range"))
	ErrInvalidShareType                    = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.invalidShareType", errutil.WithPublicMessage("Invalid share type"))
	ErrDashboardIsPublic                   = errutil.NewBase(errutil.StatusBadRequest, "publicdashboards.dashboardIsPublic", errutil.WithPublicMessage("Dashboard is already public"))

	ErrPublicDashboardNotEnabled = errutil.NewBase(errutil.StatusForbidden, "publicdashboards.notEnabled", errutil.WithPublicMessage("Public dashboard paused"))
)
View Source
var (
	QueryResultStatuses = []string{QuerySuccess, QueryFailure}
	ValidShareTypes     = []ShareType{EmailShareType, PublicShareType}
)

Functions

This section is empty.

Types

type AnnotationEvent

type AnnotationEvent struct {
	Id          int64                     `json:"id"`
	DashboardId int64                     `json:"dashboardId"`
	PanelId     int64                     `json:"panelId"`
	Tags        []string                  `json:"tags"`
	IsRegion    bool                      `json:"isRegion"`
	Text        string                    `json:"text"`
	Color       string                    `json:"color"`
	Time        int64                     `json:"time"`
	TimeEnd     int64                     `json:"timeEnd"`
	Source      dashboard.AnnotationQuery `json:"source"`
}

type AnnotationsDto

type AnnotationsDto struct {
	Annotations struct {
		List []DashAnnotation `json:"list"`
	}
}

type AnnotationsQueryDTO

type AnnotationsQueryDTO struct {
	From int64
	To   int64
}

type DashAnnotation

type DashAnnotation = dashboard.AnnotationQuery

Alias the generated type

type EmailDTO

type EmailDTO struct {
	Uid       string `json:"uid"`
	Recipient string `json:"recipient"`
}

type Metrics

type Metrics struct {
	TotalPublicDashboards []*TotalPublicDashboard
}

type PublicDashboard

type PublicDashboard struct {
	Uid          string    `json:"uid" xorm:"pk uid"`
	DashboardUid string    `json:"dashboardUid" xorm:"dashboard_uid"`
	OrgId        int64     `json:"-" xorm:"org_id"` // Don't ever marshal orgId to Json
	AccessToken  string    `json:"accessToken" xorm:"access_token"`
	CreatedBy    int64     `json:"createdBy" xorm:"created_by"`
	UpdatedBy    int64     `json:"updatedBy" xorm:"updated_by"`
	CreatedAt    time.Time `json:"createdAt" xorm:"created_at"`
	UpdatedAt    time.Time `json:"updatedAt" xorm:"updated_at"`
	//config fields
	TimeSettings         *TimeSettings `json:"-" xorm:"time_settings"`
	TimeSelectionEnabled bool          `json:"timeSelectionEnabled" xorm:"time_selection_enabled"`
	IsEnabled            bool          `json:"isEnabled" xorm:"is_enabled"`
	AnnotationsEnabled   bool          `json:"annotationsEnabled" xorm:"annotations_enabled"`
	Share                ShareType     `json:"share" xorm:"share"`
	Recipients           []EmailDTO    `json:"recipients,omitempty" xorm:"-"`
}

func (PublicDashboard) TableName

func (pd PublicDashboard) TableName() string

type PublicDashboardDTO

type PublicDashboardDTO struct {
	TimeSelectionEnabled *bool     `json:"timeSelectionEnabled"`
	IsEnabled            *bool     `json:"isEnabled"`
	AnnotationsEnabled   *bool     `json:"annotationsEnabled"`
	Share                ShareType `json:"share"`
}

type PublicDashboardErr

type PublicDashboardErr struct {
	StatusCode int
	Status     string
	Reason     string
}

PublicDashboardErr represents a dashboard error.

func (PublicDashboardErr) Error

func (e PublicDashboardErr) Error() string

Error returns the error message.

type PublicDashboardListQuery

type PublicDashboardListQuery struct {
	OrgID  int64
	Query  string
	Page   int
	Limit  int
	Offset int
	User   *user.SignedInUser
}

type PublicDashboardListResponse

type PublicDashboardListResponse struct {
	Uid          string `json:"uid" xorm:"uid"`
	AccessToken  string `json:"accessToken" xorm:"access_token"`
	Title        string `json:"title" xorm:"title"`
	DashboardUid string `json:"dashboardUid" xorm:"dashboard_uid"`
	IsEnabled    bool   `json:"isEnabled" xorm:"is_enabled"`
}

type PublicDashboardListResponseWithPagination

type PublicDashboardListResponseWithPagination struct {
	PublicDashboards []*PublicDashboardListResponse `json:"publicDashboards"`
	TotalCount       int64                          `json:"totalCount"`
	Page             int                            `json:"page"`
	PerPage          int                            `json:"perPage"`
}

type PublicDashboardQueryDTO

type PublicDashboardQueryDTO struct {
	IntervalMs      int64
	MaxDataPoints   int64
	QueryCachingTTL int64
	TimeRange       TimeRangeDTO
}

type SavePublicDashboardCommand

type SavePublicDashboardCommand struct {
	PublicDashboard PublicDashboard
}

type SavePublicDashboardDTO

type SavePublicDashboardDTO struct {
	Uid             string
	DashboardUid    string
	OrgID           int64
	UserId          int64
	PublicDashboard *PublicDashboardDTO
}

DTO for transforming user input in the api

type ShareType

type ShareType string

type TimeRangeDTO

type TimeRangeDTO struct {
	From     string
	To       string
	Timezone string
}

type TimeSettings

type TimeSettings struct {
	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

func (*TimeSettings) FromDB

func (ts *TimeSettings) FromDB(data []byte) error

func (*TimeSettings) ToDB

func (ts *TimeSettings) ToDB() ([]byte, error)

type TotalPublicDashboard

type TotalPublicDashboard struct {
	TotalCount float64
	IsEnabled  bool
	ShareType  string
}

Jump to

Keyboard shortcuts

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