mirror of https://github.com/buster-so/buster.git
Merge branch 'evals' of https://github.com/buster-so/buster into evals
This commit is contained in:
commit
904cb6deb2
|
@ -1,10 +1,7 @@
|
||||||
use axum::{
|
use axum::{extract::Path, http::StatusCode, Extension, Json};
|
||||||
extract::Path,
|
use handlers::metrics::{
|
||||||
http::StatusCode,
|
delete_metric_handler, delete_metrics_handler, DeleteMetricsRequest, DeleteMetricsResponse,
|
||||||
Json,
|
|
||||||
Extension,
|
|
||||||
};
|
};
|
||||||
use handlers::metrics::{delete_metric_handler, delete_metrics_handler, DeleteMetricsRequest, DeleteMetricsResponse};
|
|
||||||
use middleware::AuthenticatedUser;
|
use middleware::AuthenticatedUser;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
@ -50,18 +47,21 @@ pub async fn delete_metrics_rest_handler(
|
||||||
if response.failed_ids.is_empty() && !response.successful_ids.is_empty() {
|
if response.failed_ids.is_empty() && !response.successful_ids.is_empty() {
|
||||||
return Ok(ApiResponse::NoContent);
|
return Ok(ApiResponse::NoContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return 207 Multi-Status if there were mixed results
|
// Return 207 Multi-Status if there were mixed results
|
||||||
if !response.failed_ids.is_empty() {
|
if !response.failed_ids.is_empty() {
|
||||||
return Ok(ApiResponse::custom(StatusCode::MULTI_STATUS, response));
|
return Ok(ApiResponse::JsonData(response));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return 200 OK for other cases (like empty list)
|
// Return 200 OK for other cases (like empty list)
|
||||||
Ok(ApiResponse::Ok(response))
|
Ok(ApiResponse::JsonData(response))
|
||||||
},
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::error!("Error in bulk metric deletion: {}", e);
|
tracing::error!("Error in bulk metric deletion: {}", e);
|
||||||
Err((StatusCode::INTERNAL_SERVER_ERROR, format!("Failed to delete metrics: {}", e)))
|
Err((
|
||||||
|
StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
format!("Failed to delete metrics: {}", e),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ export const updateMetric = async (params: UpdateMetricParams) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteMetrics = async (params: { ids: string[] }) => {
|
export const deleteMetrics = async (params: { ids: string[] }) => {
|
||||||
return mainApi.delete<null>(`/metrics/delete`, {
|
return mainApi.delete<null>(`/metrics`, {
|
||||||
data: { ids: params.ids }
|
data: { ids: params.ids }
|
||||||
}).then((res) => res.data);
|
}).then((res) => res.data);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue