librarypanels

package
v0.0.0-...-900be4e Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrFolderHasConnectedLibraryPanels is an error for when an user deletes a folder that contains connected library panels.
	ErrFolderHasConnectedLibraryPanels = errors.New("folder contains library panels that are linked to dashboards")
)

Functions

This section is empty.

Types

type LibraryPanel

type LibraryPanel struct {
	ID          int64  `xorm:"pk autoincr 'id'"`
	OrgID       int64  `xorm:"org_id"`
	FolderID    int64  `xorm:"folder_id"`
	UID         string `xorm:"uid"`
	Name        string
	Type        string
	Description string
	Model       json.RawMessage
	Version     int64

	Created time.Time
	Updated time.Time

	CreatedBy int64
	UpdatedBy int64
}

LibraryPanel is the model for library panel definitions.

type LibraryPanelDTO

type LibraryPanelDTO struct {
	ID          int64               `json:"id"`
	OrgID       int64               `json:"orgId"`
	FolderID    int64               `json:"folderId"`
	UID         string              `json:"uid"`
	Name        string              `json:"name"`
	Type        string              `json:"type"`
	Description string              `json:"description"`
	Model       json.RawMessage     `json:"model"`
	Version     int64               `json:"version"`
	Meta        LibraryPanelDTOMeta `json:"meta"`
}

LibraryPanelDTO is the frontend DTO for library panels.

type LibraryPanelDTOMeta

type LibraryPanelDTOMeta struct {
	CanEdit             bool  `json:"canEdit"`
	ConnectedDashboards int64 `json:"connectedDashboards"`

	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`

	CreatedBy LibraryPanelDTOMetaUser `json:"createdBy"`
	UpdatedBy LibraryPanelDTOMetaUser `json:"updatedBy"`
}

LibraryPanelDTOMeta is the meta information for LibraryPanelDTO.

type LibraryPanelDTOMetaUser

type LibraryPanelDTOMetaUser struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	AvatarUrl string `json:"avatarUrl"`
}

LibraryPanelDTOMetaUser is the meta information for user that creates/changes the library panel.

type LibraryPanelSearchResult

type LibraryPanelSearchResult struct {
	TotalCount    int64             `json:"totalCount"`
	LibraryPanels []LibraryPanelDTO `json:"libraryPanels"`
	Page          int               `json:"page"`
	PerPage       int               `json:"perPage"`
}

LibraryPanelSearchResult is the search result for library panels.

type LibraryPanelService

type LibraryPanelService struct {
	Cfg           *setting.Cfg          `inject:""`
	SQLStore      *sqlstore.SQLStore    `inject:""`
	RouteRegister routing.RouteRegister `inject:""`
	// contains filtered or unexported fields
}

LibraryPanelService is the service for the Panel Library feature.

func (*LibraryPanelService) AddMigration

func (lps *LibraryPanelService) AddMigration(mg *migrator.Migrator)

AddMigration defines database migrations. If Panel Library is not enabled does nothing.

func (*LibraryPanelService) CleanLibraryPanelsForDashboard

func (lps *LibraryPanelService) CleanLibraryPanelsForDashboard(dash *models.Dashboard) error

CleanLibraryPanelsForDashboard loops through all panels in dashboard JSON and cleans up any library panel JSON so that only the necessary JSON properties remain when storing the dashboard JSON.

func (*LibraryPanelService) ConnectLibraryPanelsForDashboard

func (lps *LibraryPanelService) ConnectLibraryPanelsForDashboard(c *models.ReqContext, dash *models.Dashboard) error

ConnectLibraryPanelsForDashboard loops through all panels in dashboard JSON and connects any library panels to the dashboard.

func (*LibraryPanelService) DeleteLibraryPanelsInFolder

func (lps *LibraryPanelService) DeleteLibraryPanelsInFolder(c *models.ReqContext, folderUID string) error

func (*LibraryPanelService) DisconnectLibraryPanelsForDashboard

func (lps *LibraryPanelService) DisconnectLibraryPanelsForDashboard(c *models.ReqContext, dash *models.Dashboard) error

DisconnectLibraryPanelsForDashboard loops through all panels in dashboard JSON and disconnects any library panels from the dashboard.

func (*LibraryPanelService) Init

func (lps *LibraryPanelService) Init() error

Init initializes the LibraryPanel service

func (*LibraryPanelService) IsEnabled

func (lps *LibraryPanelService) IsEnabled() bool

IsEnabled returns true if the Panel Library feature is enabled for this instance.

func (*LibraryPanelService) LoadLibraryPanelsForDashboard

func (lps *LibraryPanelService) LoadLibraryPanelsForDashboard(c *models.ReqContext, dash *models.Dashboard) error

LoadLibraryPanelsForDashboard loops through all panels in dashboard JSON and replaces any library panel JSON with JSON stored for library panel in db.

type LibraryPanelWithMeta

type LibraryPanelWithMeta struct {
	ID          int64  `xorm:"pk autoincr 'id'"`
	OrgID       int64  `xorm:"org_id"`
	FolderID    int64  `xorm:"folder_id"`
	UID         string `xorm:"uid"`
	Name        string
	Type        string
	Description string
	Model       json.RawMessage
	Version     int64

	Created time.Time
	Updated time.Time

	CanEdit             bool
	ConnectedDashboards int64
	CreatedBy           int64
	UpdatedBy           int64
	CreatedByName       string
	CreatedByEmail      string
	UpdatedByName       string
	UpdatedByEmail      string
}

LibraryPanelWithMeta is the model used to retrieve library panels with additional meta information.

Jump to

Keyboard shortcuts

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