Просмотр исходного кода

Remove customer dashboard method

Mauricio Araujo 2 лет назад
Родитель
Сommit
ff738faa7f
2 измененных файлов с 0 добавлено и 41 удалено
  1. 0 12
      dashboard/src/shared/api.tsx
  2. 0 29
      internal/billing/metronome.go

+ 0 - 12
dashboard/src/shared/api.tsx

@@ -3466,17 +3466,6 @@ const getPorterCredits = baseApi<
   }
 >("GET", ({ project_id }) => `/api/projects/${project_id}/billing/credits`);
 
-const getUsageDashboard = baseApi<
-  {
-    dashboard: string;
-    dashboard_options?: { key: string; value: string }[];
-    color_overrides?: { name: string; value: string }[];
-  },
-  {
-    project_id?: number;
-  }
->("POST", ({ project_id }) => `/api/projects/${project_id}/billing/dashboard`);
-
 const getHasBilling = baseApi<{}, { project_id: number }>(
   "GET",
   ({ project_id }) => `/api/projects/${project_id}/billing`
@@ -3876,7 +3865,6 @@ export default {
   getPublishableKey,
   getPorterCredits,
   getCustomerPlan,
-  getUsageDashboard,
   listPaymentMethod,
   addPaymentMethod,
   setDefaultPaymentMethod,

+ 0 - 29
internal/billing/metronome.go

@@ -205,35 +205,6 @@ func (m MetronomeClient) ListCustomerCredits(ctx context.Context, customerID uui
 	return result.Data, nil
 }
 
-func (m MetronomeClient) GetCustomerDashboard(ctx context.Context, customerID uuid.UUID, dashboardType string, options []types.DashboardOptions, colorOverrides []types.ColorOverrides) (url string, err error) {
-	ctx, span := telemetry.NewSpan(ctx, "get-customer-usage-dashboard")
-	defer span.End()
-
-	if customerID == uuid.Nil {
-		return url, telemetry.Error(ctx, span, err, "customer id empty")
-	}
-
-	path := "dashboards/getEmbeddableUrl"
-
-	req := types.EmbeddableDashboardRequest{
-		CustomerID:     customerID,
-		Options:        options,
-		DashboardType:  dashboardType,
-		ColorOverrides: colorOverrides,
-	}
-
-	var result struct {
-		Data map[string]string `json:"data"`
-	}
-
-	err = do(http.MethodPost, path, m.ApiKey, req, &result)
-	if err != nil {
-		return url, telemetry.Error(ctx, span, err, "failed to get embeddable dashboard")
-	}
-
-	return result.Data["url"], nil
-}
-
 func do(method string, path string, apiKey string, body interface{}, data interface{}) (err error) {
 	client := http.Client{}
 	endpoint, err := url.JoinPath(metronomeBaseUrl, path)