models

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 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"
	FeaturePublicDashboardsEmailSharing           = "publicDashboardsEmailSharing"
)

Variables

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

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

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

	ErrPublicDashboardNotEnabled = errutil.Forbidden("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 {
	Uid                  string    `json:"uid"`
	AccessToken          string    `json:"accessToken"`
	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"`
	Slug         string `json:"slug" xorm:"slug"`
}

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