grafana/pkg/services/plugindashboards/plugindashboards.go
Marcus Efraimsson 6c7d326499
Plugins: Refactor GetPluginDashboards/LoadPluginDashboard (#46316)
Refactors GetPluginDashboards/LoadPluginDashboard by moving database 
interaction from plugin management to the plugindashboards service.

Fixes #44553

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-03-10 18:38:04 +01:00

57 lines
1.8 KiB
Go

package plugindashboards
import (
"context"
"github.com/grafana/grafana/pkg/models"
)
// PluginDashboard plugin dashboard model..
type PluginDashboard struct {
UID string `json:"uid"`
PluginId string `json:"pluginId"`
Title string `json:"title"`
Imported bool `json:"imported"`
ImportedUri string `json:"importedUri"`
ImportedUrl string `json:"importedUrl"`
Slug string `json:"slug"`
DashboardId int64 `json:"dashboardId"`
FolderId int64 `json:"folderId"`
ImportedRevision int64 `json:"importedRevision"`
Revision int64 `json:"revision"`
Description string `json:"description"`
Reference string `json:"path"`
Removed bool `json:"removed"`
}
// ListPluginDashboardsRequest request object for listing plugin dashboards.
type ListPluginDashboardsRequest struct {
OrgID int64
PluginID string
}
// ListPluginDashboardsResponse response object for listing plugin dashboards.
type ListPluginDashboardsResponse struct {
Items []*PluginDashboard
}
// LoadPluginDashboardRequest request object for loading a plugin dashboard.
type LoadPluginDashboardRequest struct {
PluginID string
Reference string
}
// LoadPluginDashboardResponse response object for loading a plugin dashboard.
type LoadPluginDashboardResponse struct {
Dashboard *models.Dashboard
}
// Service interface for listing plugin dashboards.
type Service interface {
// ListPluginDashboards list plugin dashboards identified by org/plugin.
ListPluginDashboards(ctx context.Context, req *ListPluginDashboardsRequest) (*ListPluginDashboardsResponse, error)
// LoadPluginDashboard loads a plugin dashboard identified by plugin and reference.
LoadPluginDashboard(ctx context.Context, req *LoadPluginDashboardRequest) (*LoadPluginDashboardResponse, error)
}