mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Remove dummy trim dashboard api (#77249)
Co-authored-by: nikimanoledaki <niki.manoledaki@grafana.com>
This commit is contained in:
@@ -471,7 +471,6 @@ func (hs *HTTPServer) registerRoutes() {
|
||||
|
||||
dashboardRoute.Post("/calculate-diff", authorize(ac.EvalPermission(dashboards.ActionDashboardsWrite)), routing.Wrap(hs.CalculateDashboardDiff))
|
||||
dashboardRoute.Post("/validate", authorize(ac.EvalPermission(dashboards.ActionDashboardsWrite)), routing.Wrap(hs.ValidateDashboard))
|
||||
dashboardRoute.Post("/trim", routing.Wrap(hs.TrimDashboard))
|
||||
|
||||
dashboardRoute.Post("/db", authorize(ac.EvalAny(ac.EvalPermission(dashboards.ActionDashboardsCreate), ac.EvalPermission(dashboards.ActionDashboardsWrite))), routing.Wrap(hs.PostDashboard))
|
||||
dashboardRoute.Get("/home", routing.Wrap(hs.GetHomeDashboard))
|
||||
|
||||
@@ -68,32 +68,6 @@ func dashboardGuardianResponse(err error) response.Response {
|
||||
return response.Error(http.StatusForbidden, "Access denied to this dashboard", nil)
|
||||
}
|
||||
|
||||
// swagger:route POST /dashboards/trim dashboards trimDashboard
|
||||
//
|
||||
// Trim defaults from dashboard.
|
||||
//
|
||||
// Responses:
|
||||
// 200: trimDashboardResponse
|
||||
// 401: unauthorisedError
|
||||
// 500: internalServerError
|
||||
func (hs *HTTPServer) TrimDashboard(c *contextmodel.ReqContext) response.Response {
|
||||
cmd := dashboards.TrimDashboardCommand{}
|
||||
if err := web.Bind(c.Req, &cmd); err != nil {
|
||||
return response.Error(http.StatusBadRequest, "bad request data", err)
|
||||
}
|
||||
dash := cmd.Dashboard
|
||||
meta := cmd.Meta
|
||||
|
||||
// TODO temporarily just return the input as a no-op while we convert to thema calls
|
||||
dto := dtos.TrimDashboardFullWithMeta{
|
||||
Dashboard: dash,
|
||||
Meta: meta,
|
||||
}
|
||||
|
||||
c.TimeRequest(metrics.MApiDashboardGet)
|
||||
return response.JSON(http.StatusOK, dto)
|
||||
}
|
||||
|
||||
// swagger:route GET /dashboards/uid/{uid} dashboards getDashboardByUID
|
||||
//
|
||||
// Get dashboard by uid.
|
||||
@@ -1233,13 +1207,6 @@ type CalcDashboardDiffParams struct {
|
||||
}
|
||||
}
|
||||
|
||||
// swagger:parameters trimDashboard
|
||||
type TrimDashboardParams struct {
|
||||
// in:body
|
||||
// required:true
|
||||
Body dashboards.TrimDashboardCommand
|
||||
}
|
||||
|
||||
// swagger:response dashboardResponse
|
||||
type DashboardResponse struct {
|
||||
// The response message
|
||||
@@ -1315,12 +1282,6 @@ type CalculateDashboardDiffResponse struct {
|
||||
Body []byte `json:"body"`
|
||||
}
|
||||
|
||||
// swagger:response trimDashboardResponse
|
||||
type TrimDashboardResponse struct {
|
||||
// in: body
|
||||
Body dtos.TrimDashboardFullWithMeta `json:"body"`
|
||||
}
|
||||
|
||||
// swagger:response getHomeDashboardResponse
|
||||
type GetHomeDashboardResponse struct {
|
||||
// in: body
|
||||
|
||||
@@ -51,11 +51,6 @@ type DashboardFullWithMeta struct {
|
||||
Dashboard *simplejson.Json `json:"dashboard"`
|
||||
}
|
||||
|
||||
type TrimDashboardFullWithMeta struct {
|
||||
Meta *simplejson.Json `json:"meta"`
|
||||
Dashboard *simplejson.Json `json:"dashboard"`
|
||||
}
|
||||
|
||||
type DashboardRedirect struct {
|
||||
RedirectUri string `json:"redirectUri"`
|
||||
}
|
||||
|
||||
@@ -9,12 +9,6 @@ package featuremgmt
|
||||
var (
|
||||
// Register each toggle here
|
||||
standardFeatureFlags = []FeatureFlag{
|
||||
{
|
||||
Name: "trimDefaults",
|
||||
Description: "Use cue schema to remove values that will be applied automatically",
|
||||
Stage: FeatureStagePublicPreview,
|
||||
Owner: grafanaAsCodeSquad,
|
||||
},
|
||||
{
|
||||
Name: "disableEnvelopeEncryption",
|
||||
Description: "Disable envelope encryption (emergency only)",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
Name,Stage,Owner,requiresDevMode,RequiresLicense,RequiresRestart,FrontendOnly
|
||||
trimDefaults,preview,@grafana/grafana-as-code,false,false,false,false
|
||||
disableEnvelopeEncryption,GA,@grafana/grafana-as-code,false,false,false,false
|
||||
live-service-web-worker,experimental,@grafana/grafana-app-platform-squad,false,false,false,true
|
||||
queryOverLive,experimental,@grafana/grafana-app-platform-squad,false,false,false,true
|
||||
|
||||
|
@@ -7,10 +7,6 @@
|
||||
package featuremgmt
|
||||
|
||||
const (
|
||||
// FlagTrimDefaults
|
||||
// Use cue schema to remove values that will be applied automatically
|
||||
FlagTrimDefaults = "trimDefaults"
|
||||
|
||||
// FlagDisableEnvelopeEncryption
|
||||
// Disable envelope encryption (emergency only)
|
||||
FlagDisableEnvelopeEncryption = "disableEnvelopeEncryption"
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
|
||||
func TestFeatureUsageStats(t *testing.T) {
|
||||
featureManagerWithAllFeatures := WithFeatures(
|
||||
"trimDefaults",
|
||||
"database_metrics",
|
||||
"live-config",
|
||||
"UPPER_SNAKE_CASE",
|
||||
@@ -17,7 +16,6 @@ func TestFeatureUsageStats(t *testing.T) {
|
||||
)
|
||||
|
||||
require.Equal(t, map[string]any{
|
||||
"stats.features.trim_defaults.count": 1,
|
||||
"stats.features.database_metrics.count": 1,
|
||||
"stats.features.live_config.count": 1,
|
||||
"stats.features.upper_snake_case.count": 1,
|
||||
|
||||
Reference in New Issue
Block a user