1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-11-24 20:06:55 +01:00

refactor: delete safeguard api update (#10992)

This commit is contained in:
Mateusz Kwasniewski 2025-11-17 15:53:34 +01:00 committed by GitHub
parent 778328aa98
commit 29de419e20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 1 deletions

View File

@ -409,11 +409,13 @@ export const ReleasePlan = ({
const handleSafeguardDelete = async () => { const handleSafeguardDelete = async () => {
try { try {
if (safeguards.length === 0) return;
await deleteSafeguard({ await deleteSafeguard({
projectId, projectId,
featureName, featureName,
environment, environment,
planId: id, planId: id,
safeguardId: safeguards[0].id,
}); });
setToastData({ setToastData({
type: 'success', type: 'success',

View File

@ -14,6 +14,7 @@ export interface DeleteSafeguardParams {
featureName: string; featureName: string;
environment: string; environment: string;
planId: string; planId: string;
safeguardId: string;
} }
export const useSafeguardsApi = () => { export const useSafeguardsApi = () => {
@ -47,9 +48,10 @@ export const useSafeguardsApi = () => {
featureName, featureName,
environment, environment,
planId, planId,
safeguardId,
}: DeleteSafeguardParams): Promise<void> => { }: DeleteSafeguardParams): Promise<void> => {
const requestId = 'deleteSafeguard'; 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( const req = createRequest(
path, path,
{ {

View File

@ -22,6 +22,7 @@ export interface IReleasePlanTemplate {
} }
export interface ISafeguard { export interface ISafeguard {
id: string;
impactMetric: { impactMetric: {
aggregationMode: MetricQuerySchemaAggregationMode; aggregationMode: MetricQuerySchemaAggregationMode;
metricName: string; metricName: string;