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:
parent
778328aa98
commit
29de419e20
@ -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',
|
||||||
|
|||||||
@ -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,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user