Documentation
¶
Index ¶
- Variables
- type CreateLibraryElementCommand
- type CreateLibraryElementParams
- type DeleteLibraryElementByUIDParams
- type DeleteLibraryElementResponse
- type FolderFilter
- type GetLibraryElementByUIDParams
- type GetLibraryElementConnectionsParams
- type GetLibraryElementConnectionsResponse
- type GetLibraryElementResponse
- type GetLibraryElementsParams
- type GetLibraryElementsResponse
- type LibraryConnectionKind
- type LibraryElement
- type LibraryElementArrayResponse
- type LibraryElementByNameParams
- type LibraryElementByUID
- type LibraryElementConnectionDTO
- type LibraryElementConnectionsResponse
- type LibraryElementDTO
- type LibraryElementDTOMeta
- type LibraryElementDTOMetaUser
- type LibraryElementResponse
- type LibraryElementSearchResponse
- type LibraryElementSearchResult
- type LibraryElementService
- func (l *LibraryElementService) ConnectElementsToDashboard(c context.Context, signedInUser *user.SignedInUser, elementUIDs []string, ...) error
- func (l *LibraryElementService) CreateElement(c context.Context, signedInUser *user.SignedInUser, ...) (LibraryElementDTO, error)
- func (l *LibraryElementService) DeleteLibraryElementsInFolder(c context.Context, signedInUser *user.SignedInUser, folderUID string) error
- func (l *LibraryElementService) DisconnectElementsFromDashboard(c context.Context, dashboardID int64) error
- func (l *LibraryElementService) GetElement(c context.Context, signedInUser *user.SignedInUser, UID string) (LibraryElementDTO, error)
- func (l *LibraryElementService) GetElementsForDashboard(c context.Context, dashboardID int64) (map[string]LibraryElementDTO, error)
- type LibraryElementWithMeta
- type Pair
- type PatchLibraryElementCommand
- type Service
- type UpdateLibraryElementParam
Constants ¶
This section is empty.
Variables ¶
var ( // ErrLibraryElementNotFound is an error for when a library element can't be found. ErrLibraryElementNotFound = errors.New("library element could not be found") // ErrFolderHasConnectedLibraryElements is an error for when a user deletes a folder that contains connected library elements. ErrFolderHasConnectedLibraryElements = errors.New("folder contains library elements that are linked in use") )
Functions ¶
This section is empty.
Types ¶
type CreateLibraryElementCommand ¶
type CreateLibraryElementCommand struct { // ID of the folder where the library element is stored. FolderID int64 `json:"folderId"` // UID of the folder where the library element is stored. FolderUID *string `json:"folderUid"` // Name of the library element. Name string `json:"name"` // The JSON model for the library element. // swagger:type object Model json.RawMessage `json:"model"` // Kind of element to create, Use 1 for library panels or 2 for c. // Description: // * 1 - library panels // * 2 - library variables // Enum: 1,2 Kind int64 `json:"kind" binding:"Required"` // required: false UID string `json:"uid"` }
CreateLibraryElementCommand is the command for adding a LibraryElement swagger:model
type CreateLibraryElementParams ¶
type CreateLibraryElementParams struct { // in:body // required:true Body CreateLibraryElementCommand `json:"body"` }
swagger:parameters createLibraryElement
type DeleteLibraryElementByUIDParams ¶
type DeleteLibraryElementByUIDParams struct { // in:path // required:true UID string `json:"library_element_uid"` }
swagger:parameters deleteLibraryElementByUID
type DeleteLibraryElementResponse ¶
DeleteLibraryElementResponse is the response struct for deleting a library element.
type FolderFilter ¶
type FolderFilter struct {
// contains filtered or unexported fields
}
type GetLibraryElementByUIDParams ¶
type GetLibraryElementByUIDParams struct { // in:path // required:true UID string `json:"library_element_uid"` }
swagger:parameters getLibraryElementByUID
type GetLibraryElementConnectionsParams ¶
type GetLibraryElementConnectionsParams struct { // in:path // required:true UID string `json:"library_element_uid"` }
swagger:parameters GetLibraryElementConnectionsParams
type GetLibraryElementConnectionsResponse ¶
type GetLibraryElementConnectionsResponse struct { // in: body Body LibraryElementConnectionsResponse `json:"body"` }
swagger:response getLibraryElementConnectionsResponse
type GetLibraryElementResponse ¶
type GetLibraryElementResponse struct { // in: body Body LibraryElementResponse `json:"body"` }
swagger:response getLibraryElementResponse
type GetLibraryElementsParams ¶
type GetLibraryElementsParams struct { // Part of the name or description searched for. // in:query // required:false SearchString string `json:"searchString"` // Kind of element to search for. // in:query // required:false // Description: // * 1 - library panels // * 2 - library variables // enum: 1,2 Kind int `json:"kind"` // Sort order of elements. // in:query // required:false // Description: // * alpha-asc: ascending // * alpha-desc: descending // Enum: alpha-asc,alpha-desc SortDirection string `json:"sortDirection"` // A comma separated list of types to filter the elements by // in:query // required:false TypeFilter string `json:"typeFilter"` // Element UID to exclude from search results. // in:query // required:false ExcludeUID string `json:"excludeUid"` // A comma separated list of folder ID(s) to filter the elements by. // in:query // required:false FolderFilter string `json:"folderFilter"` // The number of results per page. // in:query // required:false // default: 100 PerPage int `json:"perPage"` // The page for a set of records, given that only perPage records are returned at a time. Numbering starts at 1. // in:query // required:false // default: 1 Page int `json:"page"` }
swagger:parameters getLibraryElements
type GetLibraryElementsResponse ¶
type GetLibraryElementsResponse struct { // in: body Body LibraryElementSearchResponse `json:"body"` }
swagger:response getLibraryElementsResponse
type LibraryConnectionKind ¶
type LibraryConnectionKind int
const (
Dashboard LibraryConnectionKind = iota + 1
)
type LibraryElement ¶
type LibraryElement struct { ID int64 `xorm:"pk autoincr 'id'"` OrgID int64 `xorm:"org_id"` FolderID int64 `xorm:"folder_id"` UID string `xorm:"uid"` Name string Kind int64 Type string Description string Model json.RawMessage Version int64 Created time.Time Updated time.Time CreatedBy int64 UpdatedBy int64 }
LibraryElement is the model for library element definitions.
type LibraryElementArrayResponse ¶
type LibraryElementArrayResponse struct {
Result []LibraryElementDTO `json:"result"`
}
LibraryElementArrayResponse is a response struct for an array of LibraryElementDTO.
type LibraryElementByNameParams ¶
type LibraryElementByNameParams struct { // in:path // required:true Name string `json:"library_element_name"` }
swagger:parameters getLibraryElementByName
type LibraryElementByUID ¶
type LibraryElementByUID struct { // in:path // required:true UID string `json:"library_element_uid"` }
swagger:parameters getLibraryElementByUID getLibraryElementConnections
type LibraryElementConnectionDTO ¶
type LibraryElementConnectionDTO struct { ID int64 `json:"id"` Kind int64 `json:"kind"` ElementID int64 `json:"elementId"` ConnectionID int64 `json:"connectionId"` ConnectionUID string `json:"connectionUid"` Created time.Time `json:"created"` CreatedBy LibraryElementDTOMetaUser `json:"createdBy"` }
LibraryElementConnectionDTO is the frontend DTO for element connections.
type LibraryElementConnectionsResponse ¶
type LibraryElementConnectionsResponse struct {
Result []LibraryElementConnectionDTO `json:"result"`
}
LibraryElementConnectionsResponse is a response struct for an array of LibraryElementConnectionDTO.
type LibraryElementDTO ¶
type LibraryElementDTO struct { ID int64 `json:"id"` OrgID int64 `json:"orgId"` FolderID int64 `json:"folderId"` FolderUID string `json:"folderUid"` UID string `json:"uid"` Name string `json:"name"` Kind int64 `json:"kind"` Type string `json:"type"` Description string `json:"description"` Model json.RawMessage `json:"model"` Version int64 `json:"version"` Meta LibraryElementDTOMeta `json:"meta"` }
LibraryElementDTO is the frontend DTO for entities.
type LibraryElementDTOMeta ¶
type LibraryElementDTOMeta struct { FolderName string `json:"folderName"` FolderUID string `json:"folderUid"` ConnectedDashboards int64 `json:"connectedDashboards"` Created time.Time `json:"created"` Updated time.Time `json:"updated"` CreatedBy LibraryElementDTOMetaUser `json:"createdBy"` UpdatedBy LibraryElementDTOMetaUser `json:"updatedBy"` }
LibraryElementDTOMeta is the meta information for LibraryElementDTO.
type LibraryElementDTOMetaUser ¶
type LibraryElementDTOMetaUser struct { ID int64 `json:"id"` Name string `json:"name"` AvatarURL string `json:"avatarUrl"` }
LibraryElementDTOMetaUser is the meta information for user that creates/changes the library element.
type LibraryElementResponse ¶
type LibraryElementResponse struct {
Result LibraryElementDTO `json:"result"`
}
LibraryElementResponse is a response struct for LibraryElementDTO.
type LibraryElementSearchResponse ¶
type LibraryElementSearchResponse struct {
Result LibraryElementSearchResult `json:"result"`
}
LibraryElementSearchResponse is a response struct for LibraryElementSearchResult.
type LibraryElementSearchResult ¶
type LibraryElementSearchResult struct { TotalCount int64 `json:"totalCount"` Elements []LibraryElementDTO `json:"elements"` Page int `json:"page"` PerPage int `json:"perPage"` }
LibraryElementSearchResult is the search result for entities.
type LibraryElementService ¶
type LibraryElementService struct { Cfg *setting.Cfg SQLStore *sqlstore.SQLStore RouteRegister routing.RouteRegister // contains filtered or unexported fields }
LibraryElementService is the service for the Library Element feature.
func ProvideService ¶
func ProvideService(cfg *setting.Cfg, sqlStore *sqlstore.SQLStore, routeRegister routing.RouteRegister, folderService dashboards.FolderService) *LibraryElementService
func (*LibraryElementService) ConnectElementsToDashboard ¶
func (l *LibraryElementService) ConnectElementsToDashboard(c context.Context, signedInUser *user.SignedInUser, elementUIDs []string, dashboardID int64) error
ConnectElementsToDashboard connects elements to a specific dashboard.
func (*LibraryElementService) CreateElement ¶
func (l *LibraryElementService) CreateElement(c context.Context, signedInUser *user.SignedInUser, cmd CreateLibraryElementCommand) (LibraryElementDTO, error)
CreateElement creates a Library Element.
func (*LibraryElementService) DeleteLibraryElementsInFolder ¶
func (l *LibraryElementService) DeleteLibraryElementsInFolder(c context.Context, signedInUser *user.SignedInUser, folderUID string) error
DeleteLibraryElementsInFolder deletes all elements for a specific folder.
func (*LibraryElementService) DisconnectElementsFromDashboard ¶
func (l *LibraryElementService) DisconnectElementsFromDashboard(c context.Context, dashboardID int64) error
DisconnectElementsFromDashboard disconnects elements from a specific dashboard.
func (*LibraryElementService) GetElement ¶
func (l *LibraryElementService) GetElement(c context.Context, signedInUser *user.SignedInUser, UID string) (LibraryElementDTO, error)
GetElement gets an element from a UID.
func (*LibraryElementService) GetElementsForDashboard ¶
func (l *LibraryElementService) GetElementsForDashboard(c context.Context, dashboardID int64) (map[string]LibraryElementDTO, error)
GetElementsForDashboard gets all connected elements for a specific dashboard.
type LibraryElementWithMeta ¶
type LibraryElementWithMeta struct { ID int64 `xorm:"pk autoincr 'id'"` OrgID int64 `xorm:"org_id"` FolderID int64 `xorm:"folder_id"` UID string `xorm:"uid"` Name string Kind int64 Type string Description string Model json.RawMessage Version int64 Created time.Time Updated time.Time FolderName string FolderUID string `xorm:"folder_uid"` ConnectedDashboards int64 CreatedBy int64 UpdatedBy int64 CreatedByName string CreatedByEmail string UpdatedByName string UpdatedByEmail string }
LibraryElementWithMeta is the model used to retrieve entities with additional meta information.
type PatchLibraryElementCommand ¶
type PatchLibraryElementCommand struct { // ID of the folder where the library element is stored. FolderID int64 `json:"folderId" binding:"Default(-1)"` // UID of the folder where the library element is stored. FolderUID *string `json:"folderUid"` // Name of the library element. Name string `json:"name"` // The JSON model for the library element. Model json.RawMessage `json:"model,omitempty"` // Kind of element to create, Use 1 for library panels or 2 for c. // Description: // * 1 - library panels // * 2 - library variables // Enum: 1,2 Kind int64 `json:"kind" binding:"Required"` // Version of the library element you are updating. Version int64 `json:"version" binding:"Required"` // required: false UID string `json:"uid"` }
PatchLibraryElementCommand is the command for patching a LibraryElement
type Service ¶
type Service interface { CreateElement(c context.Context, signedInUser *user.SignedInUser, cmd CreateLibraryElementCommand) (LibraryElementDTO, error) GetElement(c context.Context, signedInUser *user.SignedInUser, UID string) (LibraryElementDTO, error) GetElementsForDashboard(c context.Context, dashboardID int64) (map[string]LibraryElementDTO, error) ConnectElementsToDashboard(c context.Context, signedInUser *user.SignedInUser, elementUIDs []string, dashboardID int64) error DisconnectElementsFromDashboard(c context.Context, dashboardID int64) error DeleteLibraryElementsInFolder(c context.Context, signedInUser *user.SignedInUser, folderUID string) error }
Service is a service for operating on library elements.
type UpdateLibraryElementParam ¶
type UpdateLibraryElementParam struct { // in:body // required:true Body PatchLibraryElementCommand `json:"body"` // in:path // required:true UID string `json:"library_element_uid"` }
swagger:parameters updateLibraryElement