2021-12-23 11:43:53 -06:00
|
|
|
package thumbs
|
|
|
|
|
|
|
|
import (
|
2022-02-10 12:45:00 -06:00
|
|
|
"context"
|
2022-04-15 07:01:58 -05:00
|
|
|
"net/http"
|
2022-02-10 12:45:00 -06:00
|
|
|
|
2021-12-23 11:43:53 -06:00
|
|
|
"github.com/grafana/grafana/pkg/api/response"
|
|
|
|
"github.com/grafana/grafana/pkg/models"
|
|
|
|
)
|
|
|
|
|
|
|
|
// When the feature flag is not enabled we just implement a dummy service
|
|
|
|
type dummyService struct{}
|
|
|
|
|
2022-04-28 04:06:49 -05:00
|
|
|
func (ds *dummyService) GetUsageStats(ctx context.Context) map[string]interface{} {
|
|
|
|
return make(map[string]interface{})
|
|
|
|
}
|
|
|
|
|
2021-12-23 11:43:53 -06:00
|
|
|
func (ds *dummyService) GetImage(c *models.ReqContext) {
|
|
|
|
c.JSON(400, map[string]string{"error": "invalid size"})
|
|
|
|
}
|
|
|
|
|
2022-02-09 03:23:32 -06:00
|
|
|
func (ds *dummyService) UpdateThumbnailState(c *models.ReqContext) {
|
|
|
|
c.JSON(400, map[string]string{"error": "invalid size"})
|
|
|
|
}
|
|
|
|
|
2021-12-23 11:43:53 -06:00
|
|
|
func (ds *dummyService) SetImage(c *models.ReqContext) {
|
|
|
|
c.JSON(400, map[string]string{"error": "invalid size"})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ds *dummyService) Enabled() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-02-16 11:49:50 -06:00
|
|
|
func (ds *dummyService) GetDashboardPreviewsSetupSettings(c *models.ReqContext) dashboardPreviewsSetupConfig {
|
|
|
|
return dashboardPreviewsSetupConfig{
|
|
|
|
SystemRequirements: dashboardPreviewsSystemRequirements{
|
|
|
|
Met: false,
|
|
|
|
RequiredImageRendererPluginVersion: "",
|
|
|
|
},
|
|
|
|
ThumbnailsExist: false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-23 11:43:53 -06:00
|
|
|
func (ds *dummyService) StartCrawler(c *models.ReqContext) response.Response {
|
|
|
|
result := make(map[string]string)
|
|
|
|
result["error"] = "Not enabled"
|
2022-04-15 07:01:58 -05:00
|
|
|
return response.JSON(http.StatusOK, result)
|
2021-12-23 11:43:53 -06:00
|
|
|
}
|
2022-01-10 10:21:35 -06:00
|
|
|
|
2021-12-23 11:43:53 -06:00
|
|
|
func (ds *dummyService) StopCrawler(c *models.ReqContext) response.Response {
|
|
|
|
result := make(map[string]string)
|
|
|
|
result["error"] = "Not enabled"
|
2022-04-15 07:01:58 -05:00
|
|
|
return response.JSON(http.StatusOK, result)
|
2021-12-23 11:43:53 -06:00
|
|
|
}
|
2022-01-10 10:21:35 -06:00
|
|
|
|
|
|
|
func (ds *dummyService) CrawlerStatus(c *models.ReqContext) response.Response {
|
|
|
|
result := make(map[string]string)
|
|
|
|
result["error"] = "Not enabled"
|
2022-04-15 07:01:58 -05:00
|
|
|
return response.JSON(http.StatusOK, result)
|
2022-01-10 10:21:35 -06:00
|
|
|
}
|
2022-02-10 12:45:00 -06:00
|
|
|
|
|
|
|
func (ds *dummyService) Run(ctx context.Context) error {
|
|
|
|
return nil
|
|
|
|
}
|