service

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogPrefix = "publicdashboards.service"
View Source
var NewDataTimeRange = legacydata.NewDataTimeRange

NewDataTimeRange declared to be able to stub this function in tests

Functions

func GenerateAccessToken

func GenerateAccessToken() (string, error)

GenerateAccessToken generates an uuid formatted without dashes to use as access token

func LogQueryFailure

func LogQueryFailure(datasources []string, log log.Logger, err error)

func LogQuerySuccess

func LogQuerySuccess(datasources []string, log log.Logger)

func UnmarshalDashboardAnnotations

func UnmarshalDashboardAnnotations(sj *simplejson.Json) (*models.AnnotationsDto, error)

Types

type PublicDashboardServiceImpl

type PublicDashboardServiceImpl struct {
	QueryDataService query.Service
	AnnotationsRepo  annotations.Repository
	// contains filtered or unexported fields
}

PublicDashboardServiceImpl Define the Service Implementation. We're generating mock implementation automatically

func ProvideService

ProvideService Factory for method used by wire to inject dependencies. builds the service, and api, and configures routes

func (*PublicDashboardServiceImpl) Create

func (pd *PublicDashboardServiceImpl) Create(ctx context.Context, u *user.SignedInUser, dto *SavePublicDashboardDTO) (*PublicDashboard, error)

Creates and validates the public dashboard and saves it to the database

func (*PublicDashboardServiceImpl) Delete

func (pd *PublicDashboardServiceImpl) Delete(ctx context.Context, uid string) error

func (*PublicDashboardServiceImpl) DeleteByDashboard

func (pd *PublicDashboardServiceImpl) DeleteByDashboard(ctx context.Context, dashboard *dashboards.Dashboard) error

func (*PublicDashboardServiceImpl) ExistsEnabledByAccessToken

func (pd *PublicDashboardServiceImpl) ExistsEnabledByAccessToken(ctx context.Context, accessToken string) (bool, error)

func (*PublicDashboardServiceImpl) ExistsEnabledByDashboardUid

func (pd *PublicDashboardServiceImpl) ExistsEnabledByDashboardUid(ctx context.Context, dashboardUid string) (bool, error)

func (*PublicDashboardServiceImpl) Find

func (pd *PublicDashboardServiceImpl) Find(ctx context.Context, uid string) (*PublicDashboard, error)

func (*PublicDashboardServiceImpl) FindAllWithPagination

func (pd *PublicDashboardServiceImpl) FindAllWithPagination(ctx context.Context, query *PublicDashboardListQuery) (*PublicDashboardListResponseWithPagination, error)

FindAllWithPagination Returns a list of public dashboards by orgId, based on permissions and with pagination

func (*PublicDashboardServiceImpl) FindAnnotations

func (pd *PublicDashboardServiceImpl) FindAnnotations(ctx context.Context, reqDTO models.AnnotationsQueryDTO, accessToken string) ([]models.AnnotationEvent, error)

FindAnnotations returns annotations for a public dashboard

func (*PublicDashboardServiceImpl) FindByAccessToken

func (pd *PublicDashboardServiceImpl) FindByAccessToken(ctx context.Context, accessToken string) (*PublicDashboard, error)

FindByAccessToken Gets public dashboard by access token

func (*PublicDashboardServiceImpl) FindByDashboardUid

func (pd *PublicDashboardServiceImpl) FindByDashboardUid(ctx context.Context, orgId int64, dashboardUid string) (*PublicDashboard, error)

FindByDashboardUid this method would be replaced by another implementation for Enterprise version

func (*PublicDashboardServiceImpl) FindDashboard

func (pd *PublicDashboardServiceImpl) FindDashboard(ctx context.Context, orgId int64, dashboardUid string) (*dashboards.Dashboard, error)

FindDashboard Gets a dashboard by Uid

func (*PublicDashboardServiceImpl) FindEnabledPublicDashboardAndDashboardByAccessToken

func (pd *PublicDashboardServiceImpl) FindEnabledPublicDashboardAndDashboardByAccessToken(ctx context.Context, accessToken string) (*PublicDashboard, *dashboards.Dashboard, error)

FindEnabledPublicDashboardAndDashboardByAccessToken Gets public dashboard and a dashboard by access token if public dashboard is enabled

func (*PublicDashboardServiceImpl) FindPublicDashboardAndDashboardByAccessToken

func (pd *PublicDashboardServiceImpl) FindPublicDashboardAndDashboardByAccessToken(ctx context.Context, accessToken string) (*PublicDashboard, *dashboards.Dashboard, error)

FindPublicDashboardAndDashboardByAccessToken Gets public dashboard and a dashboard by access token

func (*PublicDashboardServiceImpl) GetMetricRequest

func (pd *PublicDashboardServiceImpl) GetMetricRequest(ctx context.Context, dashboard *dashboards.Dashboard, publicDashboard *models.PublicDashboard, panelId int64, queryDto models.PublicDashboardQueryDTO) (dtos.MetricRequest, error)

GetMetricRequest returns a metric request for the given panel and query

func (*PublicDashboardServiceImpl) GetOrgIdByAccessToken

func (pd *PublicDashboardServiceImpl) GetOrgIdByAccessToken(ctx context.Context, accessToken string) (int64, error)

func (*PublicDashboardServiceImpl) GetQueryDataResponse

func (pd *PublicDashboardServiceImpl) GetQueryDataResponse(ctx context.Context, skipDSCache bool, queryDto models.PublicDashboardQueryDTO, panelId int64, accessToken string) (*backend.QueryDataResponse, error)

GetQueryDataResponse returns a query data response for the given panel and query

func (*PublicDashboardServiceImpl) NewPublicDashboardAccessToken

func (pd *PublicDashboardServiceImpl) NewPublicDashboardAccessToken(ctx context.Context) (string, error)

NewPublicDashboardAccessToken Generates a unique accessToken to create a public dashboard. Will make 3 attempts and fail if it cannot find an unused access token

func (*PublicDashboardServiceImpl) NewPublicDashboardUid

func (pd *PublicDashboardServiceImpl) NewPublicDashboardUid(ctx context.Context) (string, error)

NewPublicDashboardUid Generates a unique uid to create a public dashboard. Will make 3 attempts and fail if it cannot find an unused uid

func (*PublicDashboardServiceImpl) Update

func (pd *PublicDashboardServiceImpl) Update(ctx context.Context, u *user.SignedInUser, dto *SavePublicDashboardDTO) (*PublicDashboard, error)

Update: updates an existing public dashboard based on publicdashboard.Uid

type PublicDashboardServiceWrapperImpl

type PublicDashboardServiceWrapperImpl struct {
	// contains filtered or unexported fields
}

PublicDashboardServiceWrapperImpl Define the Service Implementation. We're generating mock implementation automatically

func ProvideServiceWrapper

func ProvideServiceWrapper(
	store publicdashboards.Store,
) *PublicDashboardServiceWrapperImpl

ProvideServiceWrapper Factory for method used by wire to inject dependencies. builds the service, and api, and configures routes

func (*PublicDashboardServiceWrapperImpl) Delete

func (*PublicDashboardServiceWrapperImpl) FindByDashboardUid

func (pd *PublicDashboardServiceWrapperImpl) FindByDashboardUid(ctx context.Context, orgId int64, dashboardUid string) (*PublicDashboard, error)

FindByDashboardUid is a helper method to retrieve the public dashboard configuration for a given dashboard from the database

Jump to

Keyboard shortcuts

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