From 29de419e20215247f5f7638e1ecd36756e8ce195 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Mon, 17 Nov 2025 15:53:34 +0100 Subject: [PATCH] refactor: delete safeguard api update (#10992) --- .../FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx | 2 ++ .../hooks/api/actions/useSafeguardsApi/useSafeguardsApi.ts | 4 +++- frontend/src/interfaces/releasePlans.ts | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx index 5cfab191af..930e823300 100644 --- a/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureOverview/ReleasePlan/ReleasePlan.tsx @@ -409,11 +409,13 @@ export const ReleasePlan = ({ const handleSafeguardDelete = async () => { try { + if (safeguards.length === 0) return; await deleteSafeguard({ projectId, featureName, environment, planId: id, + safeguardId: safeguards[0].id, }); setToastData({ type: 'success', diff --git a/frontend/src/hooks/api/actions/useSafeguardsApi/useSafeguardsApi.ts b/frontend/src/hooks/api/actions/useSafeguardsApi/useSafeguardsApi.ts index 6882b7212f..bb5aad203d 100644 --- a/frontend/src/hooks/api/actions/useSafeguardsApi/useSafeguardsApi.ts +++ b/frontend/src/hooks/api/actions/useSafeguardsApi/useSafeguardsApi.ts @@ -14,6 +14,7 @@ export interface DeleteSafeguardParams { featureName: string; environment: string; planId: string; + safeguardId: string; } export const useSafeguardsApi = () => { @@ -47,9 +48,10 @@ export const useSafeguardsApi = () => { featureName, environment, planId, + safeguardId, }: DeleteSafeguardParams): Promise => { const requestId = 'deleteSafeguard'; - const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/release-plans/${planId}/safeguards`; + const path = `api/admin/projects/${projectId}/features/${featureName}/environments/${environment}/release-plans/${planId}/safeguards/${safeguardId}`; const req = createRequest( path, { diff --git a/frontend/src/interfaces/releasePlans.ts b/frontend/src/interfaces/releasePlans.ts index 9bb6346b9f..e6465cc00a 100644 --- a/frontend/src/interfaces/releasePlans.ts +++ b/frontend/src/interfaces/releasePlans.ts @@ -22,6 +22,7 @@ export interface IReleasePlanTemplate { } export interface ISafeguard { + id: string; impactMetric: { aggregationMode: MetricQuerySchemaAggregationMode; metricName: string;