#44449: hide dashboard preview admin UI (#45493)

This commit is contained in:
Artur Wierzbicki
2022-02-17 12:34:07 +04:00
committed by GitHub
parent 10b47480eb
commit 3e53a08090
6 changed files with 20 additions and 5 deletions

View File

@ -23,6 +23,7 @@ export interface FeatureToggles {
database_metrics?: boolean; database_metrics?: boolean;
dashboardPreviews?: boolean; dashboardPreviews?: boolean;
dashboardPreviewsScheduler?: boolean; dashboardPreviewsScheduler?: boolean;
dashboardPreviewsAdmin?: boolean;
['live-config']?: boolean; ['live-config']?: boolean;
['live-pipeline']?: boolean; ['live-pipeline']?: boolean;
['live-service-web-worker']?: boolean; ['live-service-web-worker']?: boolean;

View File

@ -336,8 +336,11 @@ func (hs *HTTPServer) registerRoutes() {
if hs.ThumbService != nil { if hs.ThumbService != nil {
dashboardRoute.Get("/uid/:uid/img/:kind/:theme", hs.ThumbService.GetImage) dashboardRoute.Get("/uid/:uid/img/:kind/:theme", hs.ThumbService.GetImage)
dashboardRoute.Post("/uid/:uid/img/:kind/:theme", hs.ThumbService.SetImage)
dashboardRoute.Put("/uid/:uid/img/:kind/:theme", hs.ThumbService.UpdateThumbnailState) if hs.Features.IsEnabled(featuremgmt.FlagDashboardPreviewsAdmin) {
dashboardRoute.Post("/uid/:uid/img/:kind/:theme", reqGrafanaAdmin, hs.ThumbService.SetImage)
dashboardRoute.Put("/uid/:uid/img/:kind/:theme", reqGrafanaAdmin, hs.ThumbService.UpdateThumbnailState)
}
} }
dashboardRoute.Post("/calculate-diff", routing.Wrap(hs.CalculateDashboardDiff)) dashboardRoute.Post("/calculate-diff", routing.Wrap(hs.CalculateDashboardDiff))
@ -470,7 +473,7 @@ func (hs *HTTPServer) registerRoutes() {
adminRoute.Get("/stats", authorize(reqGrafanaAdmin, ac.EvalPermission(ac.ActionServerStatsRead)), routing.Wrap(hs.AdminGetStats)) adminRoute.Get("/stats", authorize(reqGrafanaAdmin, ac.EvalPermission(ac.ActionServerStatsRead)), routing.Wrap(hs.AdminGetStats))
adminRoute.Post("/pause-all-alerts", reqGrafanaAdmin, routing.Wrap(hs.PauseAllAlerts)) adminRoute.Post("/pause-all-alerts", reqGrafanaAdmin, routing.Wrap(hs.PauseAllAlerts))
if hs.ThumbService != nil { if hs.ThumbService != nil && hs.Features.IsEnabled(featuremgmt.FlagDashboardPreviewsAdmin) {
adminRoute.Post("/crawler/start", reqGrafanaAdmin, routing.Wrap(hs.ThumbService.StartCrawler)) adminRoute.Post("/crawler/start", reqGrafanaAdmin, routing.Wrap(hs.ThumbService.StartCrawler))
adminRoute.Post("/crawler/stop", reqGrafanaAdmin, routing.Wrap(hs.ThumbService.StopCrawler)) adminRoute.Post("/crawler/stop", reqGrafanaAdmin, routing.Wrap(hs.ThumbService.StopCrawler))
adminRoute.Get("/crawler/status", reqGrafanaAdmin, routing.Wrap(hs.ThumbService.CrawlerStatus)) adminRoute.Get("/crawler/status", reqGrafanaAdmin, routing.Wrap(hs.ThumbService.CrawlerStatus))

View File

@ -38,6 +38,11 @@ var (
Description: "Schedule automatic updates to dashboard previews", Description: "Schedule automatic updates to dashboard previews",
State: FeatureStateAlpha, State: FeatureStateAlpha,
}, },
{
Name: "dashboardPreviewsAdmin",
Description: "Manage the dashboard previews crawler process from the UI",
State: FeatureStateAlpha,
},
{ {
Name: "live-config", Name: "live-config",
Description: "Save grafana live configuration in SQL tables", Description: "Save grafana live configuration in SQL tables",

View File

@ -31,6 +31,10 @@ const (
// Schedule automatic updates to dashboard previews // Schedule automatic updates to dashboard previews
FlagDashboardPreviewsScheduler = "dashboardPreviewsScheduler" FlagDashboardPreviewsScheduler = "dashboardPreviewsScheduler"
// FlagDashboardPreviewsAdmin
// Manage the dashboard previews crawler process from the UI
FlagDashboardPreviewsAdmin = "dashboardPreviewsAdmin"
// FlagLiveConfig // FlagLiveConfig
// Save grafana live configuration in SQL tables // Save grafana live configuration in SQL tables
FlagLiveConfig = "live-config" FlagLiveConfig = "live-config"

View File

@ -94,7 +94,7 @@ export const ServerStats = () => {
<p className={styles.notFound}>No stats found.</p> <p className={styles.notFound}>No stats found.</p>
)} )}
{config.featureToggles.dashboardPreviews && <CrawlerStatus />} {config.featureToggles.dashboardPreviews && config.featureToggles.dashboardPreviewsAdmin && <CrawlerStatus />}
</> </>
); );
}; };

View File

@ -122,7 +122,9 @@ export function GeneralSettingsUnconnected({ dashboard, updateTimeZone, updateWe
</Field> </Field>
</div> </div>
{config.featureToggles.dashboardPreviews && <PreviewSettings uid={dashboard.uid} />} {config.featureToggles.dashboardPreviews && config.featureToggles.dashboardPreviewsAdmin && (
<PreviewSettings uid={dashboard.uid} />
)}
<TimePickerSettings <TimePickerSettings
onTimeZoneChange={onTimeZoneChange} onTimeZoneChange={onTimeZoneChange}