models

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: 5 Imported by: 0

Documentation

Index

Constants

View Source
const QueryFailure = "failure"
View Source
const QuerySuccess = "success"

Variables

View Source
var (
	ErrPublicDashboardFailedGenerateUniqueUid = PublicDashboardErr{
		Reason:     "failed to generate unique public dashboard id",
		StatusCode: 500,
	}
	ErrPublicDashboardFailedGenerateAccesstoken = PublicDashboardErr{
		Reason:     "failed to public dashboard access token",
		StatusCode: 500,
	}
	ErrPublicDashboardNotFound = PublicDashboardErr{
		Reason:     "public dashboard not found",
		StatusCode: 404,
		Status:     "not-found",
	}
	ErrPublicDashboardPanelNotFound = PublicDashboardErr{
		Reason:     "panel not found in dashboard",
		StatusCode: 404,
		Status:     "not-found",
	}
	ErrPublicDashboardIdentifierNotSet = PublicDashboardErr{
		Reason:     "no Uid for public dashboard specified",
		StatusCode: 400,
	}
	ErrPublicDashboardHasTemplateVariables = PublicDashboardErr{
		Reason:     "public dashboard has template variables",
		StatusCode: 422,
	}
	ErrPublicDashboardBadRequest = PublicDashboardErr{
		Reason:     "bad Request",
		StatusCode: 400,
	}
)
View Source
var QueryResultStatuses = []string{QuerySuccess, QueryFailure}

Functions

This section is empty.

Types

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
	TimeSettings *TimeSettings `json:"timeSettings" xorm:"time_settings"`
	IsEnabled    bool          `json:"isEnabled" xorm:"is_enabled"`
	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"`
}

func (PublicDashboard) BuildTimeSettings

func (pd PublicDashboard) BuildTimeSettings(dashboard *models.Dashboard) TimeSettings

build time settings object from json on public dashboard. If empty, use defaults on the dashboard

func (PublicDashboard) TableName

func (pd PublicDashboard) TableName() string

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 PublicDashboardQueryDTO

type PublicDashboardQueryDTO struct {
	IntervalMs    int64
	MaxDataPoints int64
}

type SavePublicDashboardConfigCommand

type SavePublicDashboardConfigCommand struct {
	PublicDashboard PublicDashboard
}

type SavePublicDashboardConfigDTO

type SavePublicDashboardConfigDTO struct {
	DashboardUid    string
	OrgId           int64
	UserId          int64
	PublicDashboard *PublicDashboard
}

DTO for transforming user input in the api

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)

Jump to

Keyboard shortcuts

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